- Breaking change: `loadSvgString` now returns a `Promise` rather than accepting a callback

- Breaking change: Treat callbacks to `editor.ready` as Promises, only resolving after all resolve
- Breaking change: Make `editor.runCallbacks` return a `Promise` which resolves upon all callbacks resolving
- Breaking change: Require `npx` (used with `babel-node`) to allow Node files
  for HTML building and JSDoc type checking to be expressed as ESM.
- Breaking change: `addExtension` now throws upon a repeated attempt to add an already-added extension
- Breaking change (storage preference cookies): Namespace the cookie as "svgeditstore" instead of just "store"
- Breaking change (API): Remove `svgCanvas.rasterExport` fourth (callback) argument, collapsing fifth (options) to fourth
- Breaking change (API): Remove `svgCanvas.exportPDF` third (callback) argument
- Breaking change (API): `editor/contextmenu.js` `add` now throws instead of giving a console error only upon detecting a bad menuitem or preexisting context menu
- Breaking change (API): Remove `svgCanvas.embedImage` second (callback) argument
- Breaking change (API): Make `getHelpXML` a class instead of instance method of `RGBColor`
- Breaking change (internal API): Refactor `dbox` (and `alert`/`confirm`/`process`/`prompt`/`select`) to avoid a callback argument in favor of return a Promise
- Fix: Avoid running in extension `langReady` multiple times or serially
- Enhancement (API): Add svgCanvas.runExtension to run just one extension and add `nameFilter` callback to `runExtensions`
- Enhancement (API): Supply `$` (our wrapped jQuery) to extensions so can use its plugins, e.g., dbox with its `alert`
- Enhancement: Use alert dialog in place of `alert` in webappfind
- Enhancement: `editor.ready` now returns a Promise resolving when all callbacks have resolved
- Enhancement: Allow `noAlert` option as part of second argument to `loadSvgString` (and `loadFromURL` and `loadFromDataURI`) to avoid UI alert (and trigger promise rejection)
- Enhancement: Make `dbox` as a separate module for alert, prompt, etc. dialogs
- Refactoring: Internal `PaintBox` as class; other misc. tweaks; no bitwise in canvg
- Linting (ESLint): Further linting changes (for editor); rename `.eslintrc` -> `.eslintrc.json` per recommendation
- Optimization: Recompress images (imageoptim-cli updated)
- npm: Update devDeps
- npm: Bump to 4.0.0
master
Brett Zamir 2018-11-08 14:48:01 +08:00
parent 7c470e9909
commit 2e5c7557a9
159 changed files with 25502 additions and 15658 deletions

368
.eslintrc
View File

@ -1,368 +0,0 @@
{
"extends": [
"standard", "plugin:compat/recommended",
"plugin:qunit/recommended", "plugin:testcafe/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"plugins": ["compat", "qunit", "testcafe", "jsdoc", "markdown", "import", "node", "promise"],
"env": {
"node": false,
"browser": true
},
"settings": {
"polyfills": ["url", "promises", "fetch", "queryselector"],
"jsdoc": {
"additionalTagNames": {
"customTags": []
},
"tagNamePreference": {
"arg": "param",
"return": "returns"
},
"allowOverrideWithoutParam": true,
"allowImplementsWithoutParam": true,
"allowAugmentsExtendsWithoutParam": true
}
},
"overrides": [
{
"files": ["editor/locale/lang.*.js"],
"rules": {
"import/no-anonymous-default-export": ["off"]
}
},
{
"files": ["editor/extensions/ext-locale/**"],
"rules": {
"import/no-anonymous-default-export": ["off"]
}
},
{
"files": ["editor/extensions/**/ext-*.js"],
"rules": {
"consistent-this": ["error", "svgEditor"],
"import/no-anonymous-default-export": ["off"]
}
},
{
"files": [
"editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js",
"editor/redirect-on-no-module-support.js",
"test/all_tests.js", "screencasts/svgopen2010/script.js",
"opera-widget/handlers.js",
"firefox-extension/handlers.js",
"firefox-extension/content/svg-edit-overlay.js"
],
"rules": {
"import/unambiguous": ["off"]
}
},
{
"files": ["**/*.md"],
"rules": {
"no-undef": ["off"],
"no-unused-vars": ["warn"],
"padded-blocks": ["off"],
"import/unambiguous": ["off"]
}
},
{
"files": ["test/**"],
"rules": {
"no-console": ["off"]
}
},
{
"files": [
"docs/jsdoc-config.js", "build-html.js", "jsdoc-check-overly-generic-types.js",
"rollup.config.js", "rollup-config.config.js"
],
"rules": {
"node/no-extraneous-import": ["error"],
"node/no-extraneous-require": ["error"],
"node/no-missing-import": ["error"],
"node/no-missing-require": ["error"],
"node/no-unpublished-bin": ["error"],
"node/no-unpublished-import": ["error"],
"node/no-unpublished-require": ["error"],
"node/no-unsupported-features/es-builtins": ["error"],
"node/no-unsupported-features/es-syntax": ["error"],
"node/no-unsupported-features/node-builtins": ["error"],
"node/process-exit-as-throw": ["error"],
"node/shebang": ["error"],
"node/exports-style": ["error", "module.exports"],
"node/prefer-global/buffer": ["error", "always"],
"node/prefer-global/console": ["error", "always"],
"node/prefer-global/process": ["error", "always"],
"node/prefer-global/text-decoder": ["error", "always"],
"node/prefer-global/text-encoder": ["error", "always"],
"node/prefer-global/url-search-params": ["error", "always"],
"node/prefer-global/url": ["error", "always"]
}
},
{
"files": ["rollup.config.js", "rollup-config.config.js"],
"rules": {
"node/no-unsupported-features/es-syntax": "off",
"node/no-unpublished-import": "off"
}
},
{
"files": ["jsdoc-check-overly-generic-types.js", "build-html.js"],
"rules": {
"import/unambiguous": "off",
"import/no-commonjs": "off"
}
}
],
"rules": {
"array-bracket-newline": ["error", "consistent"],
"array-bracket-spacing": ["error"],
"array-callback-return": ["error"],
"array-element-newline": ["off"],
"arrow-body-style": ["off"],
"arrow-parens": ["error"],
"block-scoped-var": ["error"],
"callback-return": ["error"],
"class-methods-use-this": ["warn"],
"computed-property-spacing": ["error"],
"consistent-return": ["error"],
"consistent-this": ["warn"],
"dot-notation": ["error"],
"for-direction": ["error"],
"func-name-matching": ["error"],
"func-names": ["off"],
"func-style": ["off"],
"function-paren-newline": ["error", "consistent"],
"getter-return": ["error"],
"global-require": ["error"],
"guard-for-in": ["error"],
"id-blacklist": ["off"],
"id-length": ["off"],
"id-match": ["off"],
"implicit-arrow-linebreak": ["error"],
"init-declarations": ["off"],
"jsx-quotes": ["error"],
"line-comment-position": ["off"],
"linebreak-style": ["error"],
"lines-around-comment": ["off"],
"lines-between-class-members": ["off"],
"max-classes-per-file": ["off"],
"max-depth": ["off"],
"max-lines-per-function": ["off"],
"max-lines": ["off"],
"max-nested-callbacks": ["error"],
"max-params": ["off"],
"max-statements-per-line": ["off"],
"max-statements": ["off"],
"multiline-comment-style": ["off"],
"multiline-ternary": ["error", "always-multiline"],
"newline-after-var": ["off"],
"newline-before-return": ["off"],
"newline-per-chained-call": ["off"],
"no-alert": ["warn"],
"no-async-promise-executor": ["error"],
"no-await-in-loop": ["error"],
"no-bitwise": ["error"],
"no-buffer-constructor": ["error"],
"no-case-declarations": ["error"],
"no-confusing-arrow": ["error"],
"no-console": ["warn"],
"no-continue": ["off"],
"no-div-regex": ["error"],
"no-duplicate-imports": ["error"],
"no-else-return": ["error"],
"no-empty-function": ["warn"],
"no-empty": ["error", {"allowEmptyCatch": true}],
"no-eq-null": ["error"],
"no-extra-label": ["error"],
"no-extra-semi": ["error"],
"no-implicit-coercion": ["error"],
"no-implicit-globals": ["error"],
"no-inline-comments": ["off"],
"no-invalid-this": ["off"],
"no-lonely-if": ["error"],
"no-loop-func": ["error"],
"no-misleading-character-class": ["error"],
"no-mixed-requires": ["error", {"grouping": true, "allowCall": true}],
"no-multi-assign": ["off"],
"no-negated-condition": ["off"],
"no-nested-ternary": ["off"],
"no-param-reassign": ["off"],
"no-plusplus": ["off"],
"no-process-env": ["error"],
"no-process-exit": ["error"],
"no-prototype-builtins": ["error"],
"no-restricted-globals": ["error", {
"name": "event",
"message": "Use local event parameter instead (preferably as \"e\" or \"ev\")."
}, {
"name": "fdescribe",
"message": "Do not commit fdescribe. Use describe instead."
}],
"no-restricted-imports": ["off"],
"no-restricted-modules": ["off"],
"no-restricted-properties": ["error", {
"property": "__defineGetter__",
"message": "Please use `Object.defineProperty` instead."
}],
"no-restricted-syntax": ["off"],
"no-script-url": ["error"],
"no-shadow": ["error", {"builtinGlobals": true, "hoist": "functions", "allow": ["parent", "top", "open", "name", "closed", "start"]}],
"no-spaced-func": ["error"],
"no-sync": ["error"],
"no-ternary": ["off"],
"no-undefined": ["off"],
"no-underscore-dangle": ["off"],
"no-unused-labels": ["error"],
"no-useless-concat": ["off"],
"no-var": ["error"],
"no-void": ["error"],
"nonblock-statement-body-position": ["error"],
"object-curly-newline": ["off"],
"object-shorthand": ["error", "always", {"avoidExplicitReturnArrows": true}],
"one-var-declaration-per-line": ["off"],
"operator-assignment": ["error"],
"padding-line-between-statements": ["off"],
"prefer-arrow-callback": ["off"],
"prefer-const": ["error"],
"prefer-destructuring": ["error", {"object": true}],
"prefer-numeric-literals": ["warn"],
"prefer-object-spread": ["error"],
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"prefer-template": ["off"],
"quote-props": ["error", "as-needed"],
"radix": ["error", "as-needed"],
"require-atomic-updates": ["error"],
"require-await": ["error"],
"require-jsdoc": ["warn"],
"require-yield": ["error"],
"semi-style": ["error"],
"sort-imports": ["off"],
"sort-keys": ["off"],
"sort-vars": ["off"],
"strict": ["error"],
"switch-colon-spacing": ["error"],
"vars-on-top": ["warn"],
"wrap-regex": ["error"],
"semi": ["error", "always"],
"indent": ["error", 2, {"outerIIFEBody": 0}],
"object-property-newline": ["off"],
"one-var": ["off"],
"object-curly-spacing": ["error", "never"],
"promise/catch-or-return": "error",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"promise/always-return": "error",
"promise/no-native": "off",
"promise/no-nesting": "warn",
"promise/no-promise-in-callback": "warn",
"promise/no-callback-in-promise": "warn",
"promise/avoid-new": "warn",
"promise/no-new-statics": "error",
"promise/no-return-in-finally": "warn",
"promise/valid-params": "warn",
"promise/prefer-await-to-then": "error",
"promise/prefer-await-to-callbacks": "warn",
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "error",
"import/namespace": "error",
"import/no-restricted-paths": "off",
"import/no-absolute-path": "error",
"import/no-dynamic-require": "error",
"import/no-internal-modules": "off",
"import/no-webpack-loader-syntax": "error",
"import/no-self-import": "error",
"import/no-cycle": "off",
"import/no-useless-path-segments": "error",
"import/no-relative-parent-imports": "off",
"import/export": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-deprecated": "error",
"import/no-extraneous-dependencies": "error",
"import/no-mutable-exports": "error",
"import/unambiguous": "warn",
"import/no-commonjs": "error",
"import/no-amd": "error",
"import/no-nodejs-modules": "off",
"import/first": "error",
"import/exports-last": "off",
"import/no-duplicates": "error",
"import/no-namespace": "off",
"import/extensions": ["error", "always", {"ignorePackages": true}],
"import/order": ["error", {"groups": [
"builtin",
"external",
"internal",
["parent", "sibling", "index"]
]}],
"import/newline-after-import": "error",
"import/prefer-default-export": "off",
"import/max-dependencies": "off",
"import/no-unassigned-import": "off",
"import/no-named-default": "error",
"import/no-default-export": "off",
"import/no-named-export": "off",
"import/no-anonymous-default-export": "error",
"import/group-exports": "off",
"import/dynamic-import-chunkname": "off",
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 0,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-param": 1,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 0,
"jsdoc/require-returns-type": 1,
"jsdoc/no-undefined-types": ["off"],
"jsdoc/valid-types": ["error"],
"valid-jsdoc": ["error", {
"prefer": {
"arg": "param",
"argument": "param",
"return": "returns",
"virtual": "abstract"
},
"preferType": {
"Boolean": "boolean",
"Number": "number",
"String": "string",
"object": "Object",
"array": "Array"
},
"requireReturn": true,
"requireReturnType": true,
"requireParamType": true,
"matchDescription": "^([A-Z][\\s\\S]*[.`?!])?$",
"requireParamDescription": false,
"requireReturnDescription": false
}],
"no-warning-comments": ["off"],
"default-case": ["off"],
"complexity": ["off"],
"require-unicode-regexp": ["off"],
"capitalized-comments": ["off"],
"no-magic-numbers": ["off"],
"max-len": ["off", {
"ignoreUrls": true,
"ignoreRegExpLiterals": true
}]
}
}

154
.eslintrc.js Normal file
View File

@ -0,0 +1,154 @@
module.exports = {
"extends": [
"ash-nazg/sauron-node",
"plugin:qunit/recommended", "plugin:testcafe/recommended"
],
"parserOptions": {
"sourceType": "module"
},
// Need to make explicit here for processing by jsdoc/check-examples
"plugins": ["qunit"],
"env": {
"browser": true
},
"settings": {
"polyfills": ["url", "promises", "fetch", "queryselector"],
"jsdoc": {
"additionalTagNames": {
// In case we need to extend
"customTags": []
},
"tagNamePreference": {
"arg": "param",
"return": "returns"
},
"allowOverrideWithoutParam": true,
"allowImplementsWithoutParam": true,
"allowAugmentsExtendsWithoutParam": true,
// For `jsdoc/check-examples` in `ash-nazg`
"matchingFileName": "dummy.md",
"rejectExampleCodeRegex": "^`",
}
},
"overrides": [
// These would otherwise currently break because of these issues:
// 1. `event:` https://github.com/eslint/doctrine/issues/221 and https://github.com/Kuniwak/jsdoctypeparser/pull/49 with https://github.com/Kuniwak/jsdoctypeparser/issues/47
// 1. `@implements`/`@augments`/`@extends`/`@override`: https://github.com/eslint/doctrine/issues/222
{
"files": [
"test/utilities_test.js", "editor/svg-editor.js", "editor/svgcanvas.js",
"editor/coords.js",
"editor/extensions/ext-eyedropper.js", "editor/extensions/ext-webappfind.js"
],
"rules": {
"jsdoc/valid-types": "off",
"valid-jsdoc": "off"
}
},
// Locales have no need for importing outside of SVG-Edit
{
"files": [
"editor/locale/lang.*.js", "editor/extensions/ext-locale/**",
"docs/tutorials/ExtensionDocs.md"
],
"rules": {
"import/no-anonymous-default-export": ["off"]
}
},
// For extensions, `this` is generally assigned to be the more
// descriptive `svgEditor`; they also have no need for importing outside
// of SVG-Edit
{
"files": ["editor/extensions/**/ext-*.js"],
"rules": {
"consistent-this": ["error", "svgEditor"],
"import/no-anonymous-default-export": ["off"]
}
},
// These browser files don't do importing or requiring
{
"files": [
"editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js",
"editor/redirect-on-no-module-support.js",
"editor/extensions/imagelib/index.js",
"editor/external/dom-polyfill/dom-polyfill.js",
"test/all_tests.js", "screencasts/svgopen2010/script.js",
"opera-widget/handlers.js",
"firefox-extension/handlers.js",
"firefox-extension/content/svg-edit-overlay.js"
],
"rules": {
"import/unambiguous": ["off"]
}
},
// Our Markdown rules (and used for JSDoc examples as well, by way of
// our use of `matchingFileName` in conjunction with
// `jsdoc/check-examples` within `ash-nazg`)
{
"files": ["**/*.md"],
"rules": {
"eol-last": ["off"],
"no-console": ["off"],
"no-undef": ["off"],
"no-unused-vars": ["warn"],
"padded-blocks": ["off"],
"import/unambiguous": ["off"],
"import/no-unresolved": ["off"],
"node/no-missing-import": ["off"]
}
},
// Dis-apply Node rules mistakenly giving errors with browser files
{
"files": ["editor/**", "test/**"],
"rules": {
"node/no-unsupported-features/node-builtins": ["off"]
}
},
// We want console in tests!
{
"files": ["test/**"],
"rules": {
"no-console": ["off"]
}
},
{
// Node files
"files": [
"docs/jsdoc-config.js",
"build-html.js", "jsdoc-check-overly-generic-types.js",
"rollup.config.js", "rollup-config.config.js"
],
"env": {
"node": true,
},
"rules": {
"node/no-unpublished-import": ["off"],
"node/no-unsupported-features/es-syntax": ["off"]
}
},
{
// As consumed by jsdoc, cannot be expressed as ESM
"files": ["docs/jsdoc-config.js"],
"parserOptions": {
"sourceType": "script"
},
"rules": {
"import/no-commonjs": "off"
}
}
],
"rules": {
// Override these `ash-nazg/sauron` rules which are difficult for us
// to apply at this time
"capitalized-comments": ["off"],
"complexity": ["off"],
"default-case": ["off"],
"require-unicode-regexp": ["off"],
"no-magic-numbers": ["off"],
"no-warning-comments": ["off"],
"max-len": ["off", {
"ignoreUrls": true,
"ignoreRegExpLiterals": true
}]
}
};

View File

@ -1,5 +1,62 @@
# SVG-Edit CHANGES
# 4.0.0
- Breaking change (storage preference cookies): Namespace the cookie as
"svgeditstore" instead of just "store"
- Breaking change: `loadSvgString` now returns a `Promise` rather than
accepting a callback.
- Breaking change: Treat callbacks to `editor.ready` as Promises, only
resolving after all resolve. May require no changes unless for timing.
- Breaking change: Make `editor.runCallbacks` return a `Promise` which
resolves upon all callbacks resolving.
- Breaking change: Require `npx` (used with `babel-node`) to allow Node files
for HTML building and JSDoc type checking to be expressed as ESM.
- Breaking change: `addExtension` now throws upon a repeated attempt to
add an already-added extension
- Breaking change (API): Remove `svgCanvas.rasterExport` fourth (callback)
argument, collapsing fifth (options) to fourth
- Breaking change (API): Remove `svgCanvas.exportPDF` third (callback)
argument
- Breaking change (API): `editor/contextmenu.js` `add` now throws instead
of giving a console error only upon detecting a bad menuitem or
preexisting context menu
- Breaking change (API): Remove `svgCanvas.embedImage` second (callback)
argument
- Breaking change (API): Make `getHelpXML` a class instead of instance method
of `RGBColor`
- Breaking change (internal API): Refactor `dbox` (and
`alert`/`confirm`/`process`/`prompt`/`select`) to avoid a callback argument
in favor of returning a Promise
- Breaking internal API change: `updateGripCursor` moved to be class method
of Selector rather than instance method
- Breaking internal API change: `subpathIsClosed` moved to be class method
of `Path` rather than instance method
- Fix: Avoid running in extension `langReady` multiple times or serially
- Enhancement (API): Add `svgCanvas.runExtension` to run just one extension and
add `nameFilter` callback to `runExtensions`
- Enhancement (API): Supply `$` (our wrapped jQuery) to extensions so can use
its plugins, e.g., dbox with its `alert`
- Enhancement: Use alert dialog in place of `alert` in webappfind
- Enhancement: `editor.ready` now returns a Promise resolving when all
callbacks have resolved
- Enhancement: Allow `noAlert` option as part of second argument to
`loadSvgString` (and `loadFromURL` and `loadFromDataURI`) to avoid UI
alert (and trigger promise rejection)
- Enhancement: Make `dbox` as a separate module for alert, prompt, etc. dialogs
- Optimization: Recompress images (imageoptim-cli updated)
- Refactoring: Internal `PaintBox` as class; other misc. tweaks; no bitwise
in canvg
- Refactoring: Reuse utilities base64 encoder for SVG icons plugin
- Linting (ESLint): Further linting changes (for editor); rename
`.eslintrc` -> `.eslintrc.js` per recommendation and to more transparently
allow comments; apply new strict `eslint-config-ash-nazg` rules.
- Linting (ESLint): Stricter rules (or switch to warning)
- Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and
`mouseDown` (may also be a boolean) of `pathActions`; other JSDoc
additions/improvements
- npm: Update devDeps
## 3.2.0
- Refactoring: Avoid unnecessary `addEventListener` `false`; change internal
@ -21,7 +78,9 @@
<https://github.com/eslint/eslint-plugin-markdown/issues/109>,
<https://github.com/gajus/eslint-plugin-jsdoc/issues/101>,
<https://github.com/gajus/eslint-plugin-jsdoc/issues/99>,
<https://github.com/eslint/eslint/issues/11043>
<https://github.com/eslint/eslint/issues/11043>; NOTE:
if we need to tap into Markdown within JSDoc, see <https://github.com/jsdoc3/jsdoc#b21427343c7294bbf1f14c718a390f3e955e37cb>
for commit not present in npm.
- Docs (README): Indicate minimal polyfills needed for older browsers
(IE <= 11, IE Mobile, Opera Mini, Blackberry Browser <= 10,
Android Browser 4.4.3-4.4.4)

View File

@ -107,6 +107,7 @@ incorporating SVGEdit.
## Recent news
- 2018-11-16 Published 4.0.0 (Move to Promise-based APIs)
- 2018-11-01 Published 3.2.0 (Update qunit to resolve security vulnerability of a dependency)
- 2018-10-25 Published 3.1.1 (Fix for saving SVG on Firefox)
- 2018-10-24 Published 3.1.0 (Redirect on modular page for non-module-support;

View File

@ -1,5 +1,5 @@
/* eslint-env node */
const fs = require('promise-fs');
import fs from 'promise-fs';
const filesAndReplacements = [
{
@ -122,26 +122,27 @@ const filesAndReplacements = [
}
];
filesAndReplacements.reduce(async (p, {input, output, replacements}) => {
(async () => {
await filesAndReplacements.reduce(async (p, {input, output, replacements}) => {
await p;
let data;
try {
data = await fs.readFile(input, 'utf8');
} catch (err) {
console.log(`Error reading ${input} file`, err);
console.log(`Error reading ${input} file`, err); // eslint-disable-line no-console
}
data = replacements.reduce((s, [find, replacement]) => {
return s.replace(find, replacement);
data = replacements.reduce((s, [fnd, replacement]) => {
return s.replace(fnd, replacement);
}, data);
try {
await fs.writeFile(output, data);
} catch (err) {
console.log(`Error writing file: ${err}`, err);
console.log(`Error writing file: ${err}`, err); // eslint-disable-line no-console
return;
}
console.log(`Completed file ${input} rewriting!`);
}, Promise.resolve()).then(() => {
console.log('Finished!');
});
console.log(`Completed file ${input} rewriting!`); // eslint-disable-line no-console
}, Promise.resolve());
console.log('Finished!'); // eslint-disable-line no-console
})();

656
dist/canvg.js vendored

File diff suppressed because it is too large Load Diff

17
dist/dom-polyfill.js vendored
View File

@ -2,6 +2,17 @@
'use strict';
// From https://github.com/inexorabletash/polyfill/blob/master/dom.js
/**
* @module DOMPolyfill
*/
/**
*
* @param {Node} o
* @param {module:DOMPolyfill~ParentNode|module:DOMPolyfill~ChildNode} ps
* @returns {undefined}
*/
function mixin(o, ps) {
if (!o) return;
Object.keys(ps).forEach(function (p) {
@ -17,6 +28,12 @@
}
});
}
/**
*
* @param {Node[]} nodes
* @returns {Node}
*/
function convertNodesIntoANode(nodes) {
nodes = nodes.map(function (node) {

View File

@ -37,8 +37,6 @@ var svgEditorExtension_arrows = (function () {
};
}
/* globals jQuery */
/**
* ext-arrows.js
*
@ -53,12 +51,12 @@ var svgEditorExtension_arrows = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(S) {
var strings, svgEditor, svgCanvas, $, addElem, nonce, prefix, selElems, arrowprefix, randomizeIds, setArrowNonce, unsetArrowNonce, pathdata, getLinked, showPanel, resetMarker, addMarker, setArrow, colorChanged, contextTools;
var strings, svgEditor, svgCanvas, addElem, nonce, $, prefix, selElems, arrowprefix, randomizeIds, setArrowNonce, unsetArrowNonce, pathdata, getLinked, showPanel, resetMarker, addMarker, setArrow, colorChanged, contextTools;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
colorChanged = function _ref9(elem) {
colorChanged = function _ref10(elem) {
var color = elem.getAttribute('stroke');
var mtypes = ['start', 'mid', 'end'];
var defs = svgCanvas.findDefs();
@ -84,7 +82,7 @@ var svgEditorExtension_arrows = (function () {
if (attrs.fill === color && attrs.d === curD) {
// Found another marker with this color and this path
newMarker = this;
newMarker = this; // eslint-disable-line consistent-this
}
});
@ -100,17 +98,22 @@ var svgEditorExtension_arrows = (function () {
var remove = true;
$(S.svgcontent).find('line, polyline, path, polygon').each(function () {
var elem = this;
var element = this; // eslint-disable-line consistent-this
$.each(mtypes, function (j, mtype) {
if ($(elem).attr('marker-' + mtype) === 'url(#' + marker.id + ')') {
if ($(element).attr('marker-' + mtype) === 'url(#' + marker.id + ')') {
remove = false;
return remove;
}
return undefined;
});
if (!remove) {
return false;
}
return undefined;
}); // Not found, so can safely remove
if (remove) {
@ -119,7 +122,7 @@ var svgEditorExtension_arrows = (function () {
});
};
setArrow = function _ref8() {
setArrow = function _ref9() {
resetMarker();
var type = this.value;
@ -147,7 +150,7 @@ var svgEditorExtension_arrows = (function () {
svgCanvas.call('changed', selElems);
};
addMarker = function _ref7(dir, type, id) {
addMarker = function _ref8(dir, type, id) {
// TODO: Make marker (or use?) per arrow type, since refX can be different
id = id || arrowprefix + dir;
var data = pathdata[dir];
@ -188,14 +191,14 @@ var svgEditorExtension_arrows = (function () {
return marker;
};
resetMarker = function _ref6() {
resetMarker = function _ref7() {
var el = selElems[0];
el.removeAttribute('marker-start');
el.removeAttribute('marker-mid');
el.removeAttribute('marker-end');
};
showPanel = function _ref5(on) {
showPanel = function _ref6(on) {
$('#arrow_panel').toggle(on);
if (on) {
@ -227,7 +230,7 @@ var svgEditorExtension_arrows = (function () {
}
};
getLinked = function _ref4(elem, attr) {
getLinked = function _ref5(elem, attr) {
var str = elem.getAttribute(attr);
if (!str) {
@ -243,14 +246,14 @@ var svgEditorExtension_arrows = (function () {
return svgCanvas.getElem(m[1]);
};
unsetArrowNonce = function _ref3(window) {
unsetArrowNonce = function _ref4(win) {
randomizeIds = false;
arrowprefix = prefix;
pathdata.fw.id = arrowprefix + 'fw';
pathdata.bk.id = arrowprefix + 'bk';
};
setArrowNonce = function _ref2(window, n) {
setArrowNonce = function _ref3(win, n) {
randomizeIds = true;
arrowprefix = prefix + n + '_';
pathdata.fw.id = arrowprefix + 'fw';
@ -264,10 +267,15 @@ var svgEditorExtension_arrows = (function () {
strings = _context2.sent;
svgEditor = this;
svgCanvas = svgEditor.canvas;
$ = jQuery;
// {svgcontent} = S,
addElem = svgCanvas.addSVGElementFromJson, nonce = S.nonce, prefix = 'se_arrow_';
addElem = svgCanvas.addSVGElementFromJson, nonce = S.nonce, $ = S.$, prefix = 'se_arrow_';
randomizeIds = S.randomize_ids;
/**
* @param {Window} win
* @param {!(string|Integer)} n
* @returns {undefined}
*/
svgCanvas.bind('setnonce', setArrowNonce);
svgCanvas.bind('unsetnonce', unsetArrowNonce);
@ -289,6 +297,13 @@ var svgEditorExtension_arrows = (function () {
id: arrowprefix + 'bk'
}
};
/**
* Gets linked element.
* @param {Element} elem
* @param {string} attr
* @returns {Element}
*/
contextTools = [{
type: 'select',
panel: 'arrow_panel',
@ -312,7 +327,8 @@ var svgEditorExtension_arrows = (function () {
var _addLangData = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var lang, importLocale, strings;
var lang, importLocale, _ref2, langList;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -322,12 +338,13 @@ var svgEditorExtension_arrows = (function () {
return importLocale();
case 3:
strings = _context.sent;
_ref2 = _context.sent;
langList = _ref2.langList;
return _context.abrupt("return", {
data: strings.langList
data: langList
});
case 5:
case 6:
case "end":
return _context.stop();
}
@ -372,7 +389,7 @@ var svgEditorExtension_arrows = (function () {
}
});
case 22:
case 21:
case "end":
return _context2.stop();
}

View File

@ -37,8 +37,6 @@ var svgEditorExtension_closepath = (function () {
};
}
/* globals jQuery */
/**
* ext-closepath.js
*
@ -55,18 +53,17 @@ var svgEditorExtension_closepath = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, strings, $, svgEditor, selElems, updateButton, showPanel, toggleClosed, buttons;
var importLocale, $, strings, svgEditor, selElems, updateButton, showPanel, toggleClosed, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
importLocale = _ref.importLocale;
importLocale = _ref.importLocale, $ = _ref.$;
_context.next = 3;
return importLocale();
case 3:
strings = _context.sent;
$ = jQuery;
svgEditor = this;
updateButton = function updateButton(path) {
@ -157,7 +154,7 @@ var svgEditorExtension_closepath = (function () {
}
});
case 11:
case 10:
case "end":
return _context.stop();
}

View File

@ -37,8 +37,6 @@ var svgEditorExtension_connector = (function () {
};
}
/* globals jQuery */
/**
* ext-connector.js
*
@ -52,11 +50,11 @@ var svgEditorExtension_connector = (function () {
init: function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(S) {
var $, svgEditor, svgCanvas, getElem, svgroot, importLocale, addElem, selManager, connSel, elData, strings, startX, startY, curLine, startElem, endElem, seNs, svgcontent, started, connections, selElems, getBBintersect, getOffset, showPanel, setPoint, updateLine, findConnectors, updateConnectors, init, buttons;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
regeneratorRuntime.mark(function _callee(S) {
var svgEditor, svgCanvas, getElem, $, svgroot, importLocale, addElem, selManager, connSel, elData, strings, startX, startY, curLine, startElem, endElem, seNs, svgcontent, started, connections, selElems, getBBintersect, getOffset, showPanel, setPoint, updateLine, findConnectors, updateConnectors, init, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context.prev = _context.next) {
case 0:
init = function _ref9() {
// Make sure all connectors have data set
@ -133,6 +131,10 @@ var svgEditorExtension_connector = (function () {
connectors.each(function () {
var addThis;
/**
*
* @returns {undefined}
*/
function add() {
if (elems.includes(this)) {
@ -147,14 +149,15 @@ var svgEditorExtension_connector = (function () {
var key = 'c_' + pos;
var part = elData(this, key);
if (part == null) {
if (part === null || part === undefined) {
// Does this ever return nullish values?
part = document.getElementById(this.attributes['se:connector'].value.split(' ')[i]);
elData(this, 'c_' + pos, part.id);
elData(this, pos + '_bb', svgCanvas.getStrokedBBox([part]));
} else part = document.getElementById(part);
parts.push(part);
}.bind(this));
}, this);
for (var i = 0; i < 2; i++) {
var cElem = parts[i];
@ -257,7 +260,7 @@ var svgEditorExtension_connector = (function () {
};
getOffset = function _ref3(side, line) {
var giveOffset = !!line.getAttribute('marker-' + side); // const giveOffset = $(line).data(side+'_off');
var giveOffset = line.getAttribute('marker-' + side); // const giveOffset = $(line).data(side+'_off');
// TODO: Make this number (5) be based on marker width/height
var size = line.getAttribute('stroke-width') * 5;
@ -293,17 +296,24 @@ var svgEditorExtension_connector = (function () {
};
};
$ = jQuery;
svgEditor = this;
svgCanvas = svgEditor.canvas;
getElem = svgCanvas.getElem;
svgroot = S.svgroot, importLocale = S.importLocale, addElem = svgCanvas.addSVGElementFromJson, selManager = S.selectorManager, connSel = '.se_connector', elData = $.data;
_context2.next = 15;
$ = S.$, svgroot = S.svgroot, importLocale = S.importLocale, addElem = svgCanvas.addSVGElementFromJson, selManager = S.selectorManager, connSel = '.se_connector', elData = $.data;
_context.next = 14;
return importLocale();
case 15:
strings = _context2.sent;
case 14:
strings = _context.sent;
svgcontent = S.svgcontent, started = false, connections = [], selElems = [];
/**
*
* @param {Float} x
* @param {Float} y
* @param {module:utilities.BBoxObject} bb
* @param {Float} offset
* @returns {module:math.XYObject}
*/
// Do once
(function () {
@ -311,19 +321,32 @@ var svgEditorExtension_connector = (function () {
svgCanvas.groupSelectedElements = function () {
svgCanvas.removeFromSelection($(connSel).toArray());
return gse.apply(this, arguments);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return gse.apply(this, args);
};
var mse = svgCanvas.moveSelectedElements;
svgCanvas.moveSelectedElements = function () {
var cmd = mse.apply(this, arguments);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var cmd = mse.apply(this, args);
updateConnectors();
return cmd;
};
seNs = svgCanvas.getEditorNS();
})(); // Do on reset
})();
/**
* Do on reset.
* @returns {undefined}
*/
// $(svgroot).parent().mousemove(function (e) {
@ -351,38 +374,21 @@ var svgEditorExtension_connector = (function () {
}
}
}];
return _context2.abrupt("return", {
return _context.abrupt("return", {
name: strings.name,
svgicons: svgEditor.curConfig.imgPath + 'conn.svg',
buttons: strings.buttons.map(function (button, i) {
return Object.assign(buttons[i], button);
}),
addLangData: function () {
var _addLangData = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var lang, importLocale;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
lang = _ref.lang, importLocale = _ref.importLocale;
return _context.abrupt("return", {
data: strings.langList
});
case 2:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return function addLangData(_x2) {
return _addLangData.apply(this, arguments);
/* async */
addLangData: function addLangData(_ref) {
var lang = _ref.lang;
// , importLocale: importLoc
return {
data: strings.langList
};
}(),
},
mouseDown: function mouseDown(opts) {
var e = opts.event;
startX = opts.start_x;
@ -392,7 +398,7 @@ var svgEditorExtension_connector = (function () {
if (mode === 'connector') {
if (started) {
return;
return undefined;
}
var mouseTarget = e.target;
@ -431,6 +437,8 @@ var svgEditorExtension_connector = (function () {
if (mode === 'select') {
findConnectors();
}
return undefined;
},
mouseMove: function mouseMove(opts) {
var zoom = svgCanvas.getZoom(); // const e = opts.event;
@ -476,7 +484,7 @@ var svgEditorExtension_connector = (function () {
var mouseTarget = e.target;
if (svgCanvas.getMode() !== 'connector') {
return;
return undefined;
}
var fo = $(mouseTarget).closest('foreignObject');
@ -521,6 +529,8 @@ var svgEditorExtension_connector = (function () {
if (conn === connStr || conn === altStr) {
return true;
}
return false;
});
if (dupe.length) {
@ -598,7 +608,7 @@ var svgEditorExtension_connector = (function () {
var mid = elem.getAttribute('marker-mid');
var end = elem.getAttribute('marker-end');
curLine = elem;
$(elem).data('start_off', !!start).data('end_off', !!end);
$(elem).data('start_off', Boolean(start)).data('end_off', Boolean(end));
if (elem.tagName === 'line' && mid) {
// Convert to polyline to accept mid-arrow
@ -666,12 +676,12 @@ var svgEditorExtension_connector = (function () {
}
});
case 20:
case 19:
case "end":
return _context2.stop();
return _context.stop();
}
}
}, _callee2, this);
}, _callee, this);
}));
return function init(_x) {

View File

@ -37,8 +37,6 @@ var svgEditorExtension_eyedropper = (function () {
};
}
/* globals jQuery */
/**
* ext-eyedropper.js
*
@ -94,8 +92,7 @@ var svgEditorExtension_eyedropper = (function () {
case 3:
strings = _context.sent;
svgEditor = this;
$ = jQuery;
ChangeElementCommand = S.ChangeElementCommand, svgCanvas = svgEditor.canvas, addToHistory = function addToHistory(cmd) {
$ = S.$, ChangeElementCommand = S.ChangeElementCommand, svgCanvas = svgEditor.canvas, addToHistory = function addToHistory(cmd) {
svgCanvas.undoMgr.addCommandToHistory(cmd);
}, currentStyle = {
fillPaint: 'red',
@ -108,6 +105,12 @@ var svgEditorExtension_eyedropper = (function () {
strokeLinecap: 'butt',
strokeLinejoin: 'miter'
};
/**
*
* @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged|module:svgcanvas.SvgCanvas#event:ext-elementChanged} opts
* @returns {undefined}
*/
buttons = [{
id: 'tool_eyedropper',
icon: svgEditor.curConfig.extIconsPath + 'eyedropper.png',
@ -184,7 +187,7 @@ var svgEditorExtension_eyedropper = (function () {
}
});
case 9:
case 8:
case "end":
return _context.stop();
}

View File

@ -37,8 +37,6 @@ var svgEditorExtension_foreignobject = (function () {
};
}
/* globals jQuery */
/**
* ext-foreignobject.js
*
@ -52,18 +50,18 @@ var svgEditorExtension_foreignobject = (function () {
init: function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(S) {
var svgEditor, text2xml, NS, importLocale, $, svgCanvas, svgdoc, strings, properlySourceSizeTextArea, showPanel, toggleSourceButtons, selElems, started, newFO, editingforeign, setForeignString, showForeignEditor, setAttr, buttons, contextTools;
return regeneratorRuntime.wrap(function _callee$(_context) {
regeneratorRuntime.mark(function _callee2(S) {
var svgEditor, $, text2xml, NS, importLocale, svgCanvas, svgdoc, strings, properlySourceSizeTextArea, showPanel, toggleSourceButtons, selElems, started, newFO, editingforeign, setForeignString, showForeignEditor, setAttr, buttons, contextTools;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
setAttr = function _ref5(attr, val) {
setAttr = function _ref6(attr, val) {
svgCanvas.changeSelectedAttribute(attr, val);
svgCanvas.call('changed', selElems);
};
showForeignEditor = function _ref4() {
showForeignEditor = function _ref5() {
var elt = selElems[0];
if (!elt || editingforeign) {
@ -80,8 +78,8 @@ var svgEditorExtension_foreignobject = (function () {
$('#svg_source_textarea').focus();
};
setForeignString = function _ref3(xmlString) {
var elt = selElems[0];
setForeignString = function _ref4(xmlString) {
var elt = selElems[0]; // The parent `Element` to append to
try {
// convert string into XML document
@ -92,19 +90,21 @@ var svgEditorExtension_foreignobject = (function () {
svgCanvas.call('changed', [elt]);
svgCanvas.clearSelection();
} catch (e) {
console.log(e);
// Todo: Surface error to user
console.log(e); // eslint-disable-line no-console
return false;
}
return true;
};
toggleSourceButtons = function _ref2(on) {
toggleSourceButtons = function _ref3(on) {
$('#tool_source_save, #tool_source_cancel').toggle(!on);
$('#foreign_save, #foreign_cancel').toggle(on);
};
showPanel = function _ref(on) {
showPanel = function _ref2(on) {
var fcRules = $('#fc_rules');
if (!fcRules.length) {
@ -116,27 +116,30 @@ var svgEditorExtension_foreignobject = (function () {
};
svgEditor = this;
text2xml = S.text2xml, NS = S.NS, importLocale = S.importLocale;
$ = jQuery;
$ = S.$, text2xml = S.text2xml, NS = S.NS, importLocale = S.importLocale;
svgCanvas = svgEditor.canvas;
svgdoc = S.svgroot.parentNode.ownerDocument;
_context.next = 12;
_context2.next = 11;
return importLocale();
case 12:
strings = _context.sent;
case 11:
strings = _context2.sent;
properlySourceSizeTextArea = function properlySourceSizeTextArea() {
// TODO: remove magic numbers here and get values from CSS
var height = $('#svg_source_container').height() - 80;
$('#svg_source_textarea').css('height', height);
};
/**
* @param {boolean} on
* @returns {undefined}
*/
editingforeign = false;
/**
* This function sets the content of element elt to the input XML.
* @param {string} xmlString - The XML text
* @param {Element} elt - the parent element to append to
* @returns {boolean} This function returns false if the set was unsuccessful, true otherwise.
*/
@ -191,7 +194,7 @@ var svgEditorExtension_foreignobject = (function () {
}
}
}];
return _context.abrupt("return", {
return _context2.abrupt("return", {
name: strings.name,
svgicons: svgEditor.curConfig.extIconsPath + 'foreignobject-icons.xml',
buttons: strings.buttons.map(function (button, i) {
@ -215,24 +218,57 @@ var svgEditorExtension_foreignobject = (function () {
// Create source save/cancel buttons
/* const save = */
$('#tool_source_save').clone().hide().attr('id', 'foreign_save').unbind().appendTo('#tool_source_back').click(function () {
if (!editingforeign) {
return;
}
$('#tool_source_save').clone().hide().attr('id', 'foreign_save').unbind().appendTo('#tool_source_back').click(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var ok;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (editingforeign) {
_context.next = 2;
break;
}
if (!setForeignString($('#svg_source_textarea').val())) {
$.confirm('Errors found. Revert to original?', function (ok) {
if (!ok) {
return false;
return _context.abrupt("return");
case 2:
if (setForeignString($('#svg_source_textarea').val())) {
_context.next = 11;
break;
}
_context.next = 5;
return $.confirm('Errors found. Revert to original?');
case 5:
ok = _context.sent;
if (ok) {
_context.next = 8;
break;
}
return _context.abrupt("return");
case 8:
endChanges();
_context.next = 12;
break;
case 11:
endChanges();
case 12:
case "end":
return _context.stop();
}
endChanges();
});
} else {
endChanges();
} // setSelectMode();
});
}
}, _callee, this);
})));
/* const cancel = */
$('#tool_source_cancel').clone().hide().attr('id', 'foreign_cancel').unbind().appendTo('#tool_source_back').click(function () {
@ -242,49 +278,53 @@ var svgEditorExtension_foreignobject = (function () {
},
mouseDown: function mouseDown(opts) {
// const e = opts.event;
if (svgCanvas.getMode() === 'foreign') {
started = true;
newFO = svgCanvas.addSVGElementFromJson({
element: 'foreignObject',
attr: {
x: opts.start_x,
y: opts.start_y,
id: svgCanvas.getNextId(),
'font-size': 16,
// cur_text.font_size,
width: '48',
height: '20',
style: 'pointer-events:inherit'
}
});
var m = svgdoc.createElementNS(NS.MATH, 'math');
m.setAttributeNS(NS.XMLNS, 'xmlns', NS.MATH);
m.setAttribute('display', 'inline');
var mi = svgdoc.createElementNS(NS.MATH, 'mi');
mi.setAttribute('mathvariant', 'normal');
mi.textContent = "\u03A6";
var mo = svgdoc.createElementNS(NS.MATH, 'mo');
mo.textContent = "\u222A";
var mi2 = svgdoc.createElementNS(NS.MATH, 'mi');
mi2.textContent = "\u2133";
m.append(mi, mo, mi2);
newFO.append(m);
return {
started: true
};
if (svgCanvas.getMode() !== 'foreign') {
return undefined;
}
started = true;
newFO = svgCanvas.addSVGElementFromJson({
element: 'foreignObject',
attr: {
x: opts.start_x,
y: opts.start_y,
id: svgCanvas.getNextId(),
'font-size': 16,
// cur_text.font_size,
width: '48',
height: '20',
style: 'pointer-events:inherit'
}
});
var m = svgdoc.createElementNS(NS.MATH, 'math');
m.setAttributeNS(NS.XMLNS, 'xmlns', NS.MATH);
m.setAttribute('display', 'inline');
var mi = svgdoc.createElementNS(NS.MATH, 'mi');
mi.setAttribute('mathvariant', 'normal');
mi.textContent = "\u03A6";
var mo = svgdoc.createElementNS(NS.MATH, 'mo');
mo.textContent = "\u222A";
var mi2 = svgdoc.createElementNS(NS.MATH, 'mi');
mi2.textContent = "\u2133";
m.append(mi, mo, mi2);
newFO.append(m);
return {
started: true
};
},
mouseUp: function mouseUp(opts) {
// const e = opts.event;
if (svgCanvas.getMode() === 'foreign' && started) {
var attrs = $(newFO).attr(['width', 'height']);
var keep = attrs.width !== '0' || attrs.height !== '0';
svgCanvas.addToSelection([newFO], true);
return {
keep: keep,
element: newFO
};
if (svgCanvas.getMode() !== 'foreign' || !started) {
return undefined;
}
var attrs = $(newFO).attr(['width', 'height']);
var keep = attrs.width !== '0' || attrs.height !== '0';
svgCanvas.addToSelection([newFO], true);
return {
keep: keep,
element: newFO
};
},
selectedChanged: function selectedChanged(opts) {
// Use this to update the current selected elements
@ -311,12 +351,12 @@ var svgEditorExtension_foreignobject = (function () {
elementChanged: function elementChanged(opts) {}
});
case 18:
case 17:
case "end":
return _context.stop();
return _context2.stop();
}
}
}, _callee, this);
}, _callee2, this);
}));
return function init(_x) {

View File

@ -37,8 +37,6 @@ var svgEditorExtension_grid = (function () {
};
}
/* globals jQuery */
/**
* ext-grid.js
*
@ -53,7 +51,7 @@ var svgEditorExtension_grid = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var NS, getTypeMap, importLocale, strings, svgEditor, $, svgCanvas, svgdoc, assignAttributes, hcanvas, canvBG, units, intervals, showGrid, canvasGrid, gridPattern, gridimg, gridBox, updateGrid, gridUpdate, buttons;
var $, NS, getTypeMap, importLocale, strings, svgEditor, svgCanvas, svgdoc, assignAttributes, hcanvas, canvBG, units, intervals, showGrid, canvasGrid, gridPattern, gridimg, gridBox, updateGrid, gridUpdate, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -121,14 +119,13 @@ var svgEditorExtension_grid = (function () {
svgCanvas.setHref(gridimg, datauri);
};
NS = _ref.NS, getTypeMap = _ref.getTypeMap, importLocale = _ref.importLocale;
$ = _ref.$, NS = _ref.NS, getTypeMap = _ref.getTypeMap, importLocale = _ref.importLocale;
_context.next = 5;
return importLocale();
case 5:
strings = _context.sent;
svgEditor = this;
$ = jQuery;
svgCanvas = svgEditor.canvas;
svgdoc = document.getElementById('svgcanvas').ownerDocument, assignAttributes = svgCanvas.assignAttributes, hcanvas = document.createElement('canvas'), canvBG = $('#canvasBackground'), units = getTypeMap(), intervals = [0.01, 0.1, 1, 10, 100, 1000];
showGrid = svgEditor.curConfig.showGrid || false;
@ -178,6 +175,12 @@ var svgEditorExtension_grid = (function () {
style: 'pointer-events: none; display:visible;'
});
$('#canvasGrid').append(gridBox);
/**
*
* @param {Float} zoom
* @returns {undefined}
*/
buttons = [{
id: 'view_grid',
icon: svgEditor.curConfig.extIconsPath + 'grid.png',
@ -208,7 +211,7 @@ var svgEditorExtension_grid = (function () {
})
});
case 26:
case 25:
case "end":
return _context.stop();
}

View File

@ -75,8 +75,6 @@ var svgEditorExtension_helloworld = (function () {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
/* globals jQuery */
/**
* ext-helloworld.js
*
@ -97,19 +95,18 @@ var svgEditorExtension_helloworld = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, strings, svgEditor, $, svgCanvas;
var $, importLocale, strings, svgEditor, svgCanvas;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
importLocale = _ref.importLocale;
$ = _ref.$, importLocale = _ref.importLocale;
_context.next = 3;
return importLocale();
case 3:
strings = _context.sent;
svgEditor = this;
$ = jQuery;
svgCanvas = svgEditor.canvas;
return _context.abrupt("return", {
name: strings.name,
@ -148,6 +145,8 @@ var svgEditorExtension_helloworld = (function () {
started: true
};
}
return undefined;
},
// This is triggered from anywhere, but "started" must have been set
// to true (see above). Note that "opts" is an object with event info
@ -173,7 +172,7 @@ var svgEditorExtension_helloworld = (function () {
}
});
case 8:
case 7:
case "end":
return _context.stop();
}

View File

@ -51,8 +51,6 @@ var svgEditorExtension_imagelib = (function () {
};
}
/* globals jQuery */
/**
* ext-imagelib.js
*
@ -66,13 +64,13 @@ var svgEditorExtension_imagelib = (function () {
init: function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var decode64, importLocale, dropXMLInternalSubset, imagelibStrings, modularVersion, svgEditor, $, uiStrings, svgCanvas, extIconsPath, allowedImageLibOrigins, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, toggleMulti, showBrowser, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
regeneratorRuntime.mark(function _callee2(_ref) {
var $, decode64, importLocale, dropXMLInternalSubset, imagelibStrings, modularVersion, svgEditor, uiStrings, svgCanvas, extIconsPath, allowedImageLibOrigins, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, toggleMulti, showBrowser, buttons;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
showBrowser = function _ref9() {
showBrowser = function _ref10() {
var browser = $('#imgbrowse');
if (!browser.length) {
@ -128,10 +126,10 @@ var svgEditorExtension_imagelib = (function () {
});
cancel.prepend($.getSvgIcon('cancel', true));
back.prepend($.getSvgIcon('tool_imagelib', true));
imagelibStrings.imgLibs.forEach(function (_ref5) {
var name = _ref5.name,
url = _ref5.url,
description = _ref5.description;
imagelibStrings.imgLibs.forEach(function (_ref6) {
var name = _ref6.name,
url = _ref6.url,
description = _ref6.description;
$('<li>').appendTo(libOpts).text(name).on('click touchend', function () {
frame.attr('src', url).show();
header.text(name);
@ -144,7 +142,7 @@ var svgEditorExtension_imagelib = (function () {
}
};
toggleMulti = function _ref8(show) {
toggleMulti = function _ref9(show) {
$('#lib_framewrap, #imglib_opts').css({
right: show ? 200 : 10
});
@ -186,7 +184,7 @@ var svgEditorExtension_imagelib = (function () {
submit.toggle(show);
};
importImage = function _ref7(url) {
importImage = function _ref8(url) {
var newImage = svgCanvas.addSVGElementFromJson({
element: 'image',
attr: {
@ -203,19 +201,18 @@ var svgEditorExtension_imagelib = (function () {
svgCanvas.setImageURL(url);
};
closeBrowser = function _ref6() {
closeBrowser = function _ref7() {
$('#imgbrowse_holder').hide();
};
decode64 = _ref.decode64, importLocale = _ref.importLocale, dropXMLInternalSubset = _ref.dropXMLInternalSubset;
_context.next = 7;
$ = _ref.$, decode64 = _ref.decode64, importLocale = _ref.importLocale, dropXMLInternalSubset = _ref.dropXMLInternalSubset;
_context2.next = 7;
return importLocale();
case 7:
imagelibStrings = _context.sent;
imagelibStrings = _context2.sent;
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false;
svgEditor = this;
$ = jQuery;
uiStrings = svgEditor.uiStrings, svgCanvas = svgEditor.canvas, extIconsPath = svgEditor.curConfig.extIconsPath;
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(function (_ref2) {
var name = _ref2.name,
@ -238,233 +235,316 @@ var svgEditorExtension_imagelib = (function () {
return location.origin;
}
});
/**
*
* @returns {undefined}
*/
pending = {};
mode = 's';
multiArr = [];
transferStopped = false;
// Receive `postMessage` data
window.addEventListener('message', function (_ref4) {
var origin = _ref4.origin,
response = _ref4.data;
window.addEventListener('message',
/*#__PURE__*/
function () {
var _ref5 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref4) {
var origin, response, id, type, hasName, hasHref, char1, secondpos, entry, curMeta, svgStr, imgStr, name, message, pre, src, title, xml, ok;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
origin = _ref4.origin, response = _ref4.data;
if (!response || !['string', 'object'].includes(_typeof(response))) {
// Do nothing
return;
}
if (!(!response || !['string', 'object'].includes(_typeof(response)))) {
_context.next = 3;
break;
}
var id;
var type;
return _context.abrupt("return");
try {
// Todo: This block can be removed (and the above check changed to
// insist on an object) if embedAPI moves away from a string to
// an object (if IE9 support not needed)
response = _typeof(response) === 'object' ? response : JSON.parse(response);
case 3:
_context.prev = 3;
// Todo: This block can be removed (and the above check changed to
// insist on an object) if embedAPI moves away from a string to
// an object (if IE9 support not needed)
response = _typeof(response) === 'object' ? response : JSON.parse(response);
if (response.namespace !== 'imagelib') {
return;
}
if (!(response.namespace !== 'imagelib')) {
_context.next = 7;
break;
}
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
console.log("Origin ".concat(origin, " not whitelisted for posting to ").concat(window.origin));
return;
}
return _context.abrupt("return");
var hasName = 'name' in response;
var hasHref = 'href' in response;
case 7:
if (!(!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin))) {
_context.next = 10;
break;
}
if (!hasName && transferStopped) {
transferStopped = false;
return;
}
// Todo: Surface this error to user?
console.log("Origin ".concat(origin, " not whitelisted for posting to ").concat(window.origin)); // eslint-disable-line no-console
if (hasHref) {
id = response.href;
response = response.data;
} // Hide possible transfer dialog box
return _context.abrupt("return");
case 10:
hasName = 'name' in response;
hasHref = 'href' in response;
if (!(!hasName && transferStopped)) {
_context.next = 15;
break;
}
transferStopped = false;
return _context.abrupt("return");
case 15:
if (hasHref) {
id = response.href;
response = response.data;
} // Hide possible transfer dialog box
$('#dialog_box').hide();
type = hasName ? 'meta' : response.charAt(0);
} catch (e) {
// This block is for backward compatibility (for IAN and Openclipart);
// should otherwise return
if (typeof response === 'string') {
var char1 = response.charAt(0);
$('#dialog_box').hide();
type = hasName ? 'meta' : response.charAt(0);
_context.next = 28;
break;
if (char1 !== '{' && transferStopped) {
transferStopped = false;
return;
}
case 20:
_context.prev = 20;
_context.t0 = _context["catch"](3);
if (char1 === '|') {
var secondpos = response.indexOf('|', 1);
id = response.substr(1, secondpos - 1);
response = response.substr(secondpos + 1);
type = response.charAt(0);
}
}
}
if (!(typeof response === 'string')) {
_context.next = 28;
break;
}
var entry, curMeta, svgStr, imgStr;
char1 = response.charAt(0);
switch (type) {
case 'meta':
{
// Metadata
transferStopped = false;
curMeta = response; // Should be safe to add dynamic property as passed metadata
if (!(char1 !== '{' && transferStopped)) {
_context.next = 27;
break;
}
pending[curMeta.id] = curMeta; // lgtm [js/remote-property-injection]
transferStopped = false;
return _context.abrupt("return");
var name = curMeta.name || 'file';
var message = uiStrings.notification.retrieving.replace('%s', name);
case 27:
if (char1 === '|') {
secondpos = response.indexOf('|', 1);
id = response.substr(1, secondpos - 1);
response = response.substr(secondpos + 1);
type = response.charAt(0);
}
if (mode !== 'm') {
$.process_cancel(message, function () {
case 28:
_context.t1 = type;
_context.next = _context.t1 === 'meta' ? 31 : _context.t1 === '<' ? 47 : _context.t1 === 'd' ? 49 : 60;
break;
case 31:
// Metadata
transferStopped = false;
curMeta = response; // Should be safe to add dynamic property as passed metadata
pending[curMeta.id] = curMeta; // lgtm [js/remote-property-injection]
name = curMeta.name || 'file';
message = uiStrings.notification.retrieving.replace('%s', name);
if (!(mode !== 'm')) {
_context.next = 43;
break;
}
_context.next = 39;
return $.process_cancel(message);
case 39:
transferStopped = true; // Should a message be sent back to the frame?
$('#dialog_box').hide();
});
} else {
entry = $('<div>').text(message).data('id', curMeta.id);
preview.append(entry);
curMeta.entry = entry;
}
_context.next = 46;
break;
return;
}
case 43:
entry = $('<div>').text(message).data('id', curMeta.id);
preview.append(entry);
curMeta.entry = entry;
case '<':
svgStr = true;
break;
case 46:
return _context.abrupt("return");
case 'd':
{
if (response.startsWith('data:image/svg+xml')) {
var pre = 'data:image/svg+xml;base64,';
var src = response.substring(pre.length);
response = decode64(src);
svgStr = true;
break;
} else if (response.startsWith('data:image/')) {
imgStr = true;
break;
}
}
// Else fall through
case 47:
svgStr = true;
return _context.abrupt("break", 62);
default:
// TODO: See if there's a way to base64 encode the binary data stream
// const str = 'data:;base64,' + svgedit.utilities.encode64(response, true);
// Assume it's raw image data
// importImage(str);
// Don't give warning as postMessage may have been used by something else
if (mode !== 'm') {
closeBrowser();
} else {
pending[id].entry.remove();
} // $.alert('Unexpected data was returned: ' + response, function() {
// if (mode !== 'm') {
// closeBrowser();
// } else {
// pending[id].entry.remove();
// }
// });
case 49:
if (!response.startsWith('data:image/svg+xml')) {
_context.next = 57;
break;
}
pre = 'data:image/svg+xml;base64,';
src = response.substring(pre.length);
response = decode64(src);
svgStr = true;
return _context.abrupt("break", 62);
case 57:
if (!response.startsWith('data:image/')) {
_context.next = 60;
break;
}
imgStr = true;
return _context.abrupt("break", 62);
case 60:
// TODO: See if there's a way to base64 encode the binary data stream
// const str = 'data:;base64,' + svgedit.utilities.encode64(response, true);
// Assume it's raw image data
// importImage(str);
// Don't give warning as postMessage may have been used by something else
if (mode !== 'm') {
closeBrowser();
} else {
pending[id].entry.remove();
} // await $.alert('Unexpected data was returned: ' + response, function() {
// if (mode !== 'm') {
// closeBrowser();
// } else {
// pending[id].entry.remove();
// }
// });
return;
}
return _context.abrupt("return");
switch (mode) {
case 's':
// Import one
if (svgStr) {
svgCanvas.importSvgString(response);
} else if (imgStr) {
importImage(response);
}
case 62:
_context.t2 = mode;
_context.next = _context.t2 === 's' ? 65 : _context.t2 === 'm' ? 68 : _context.t2 === 'o' ? 72 : 83;
break;
closeBrowser();
break;
case 65:
// Import one
if (svgStr) {
svgCanvas.importSvgString(response);
} else if (imgStr) {
importImage(response);
}
case 'm':
// Import multiple
multiArr.push([svgStr ? 'svg' : 'img', response]);
curMeta = pending[id];
var title;
closeBrowser();
return _context.abrupt("break", 83);
if (svgStr) {
if (curMeta && curMeta.name) {
title = curMeta.name;
} else {
// Try to find a title
// `dropXMLInternalSubset` is to help prevent the billion laughs attack
var xml = new DOMParser().parseFromString(dropXMLInternalSubset(response), 'text/xml').documentElement; // lgtm [js/xml-bomb]
case 68:
// Import multiple
multiArr.push([svgStr ? 'svg' : 'img', response]);
curMeta = pending[id];
title = $(xml).children('title').first().text() || '(SVG #' + response.length + ')';
}
if (curMeta) {
preview.children().each(function () {
if ($(this).data('id') === id) {
if (curMeta.preview_url) {
$(this).html($('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title)));
if (svgStr) {
if (curMeta && curMeta.name) {
title = curMeta.name;
} else {
$(this).text(title);
// Try to find a title
// `dropXMLInternalSubset` is to help prevent the billion laughs attack
xml = new DOMParser().parseFromString(dropXMLInternalSubset(response), 'text/xml').documentElement; // lgtm [js/xml-bomb]
title = $(xml).children('title').first().text() || '(SVG #' + response.length + ')';
}
submit.removeAttr('disabled');
}
});
} else {
preview.append($('<div>').text(title));
submit.removeAttr('disabled');
}
} else {
if (curMeta && curMeta.preview_url) {
title = curMeta.name || '';
}
if (curMeta) {
preview.children().each(function () {
if ($(this).data('id') === id) {
if (curMeta.preview_url) {
$(this).html($('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title)));
} else {
$(this).text(title);
}
if (curMeta && curMeta.preview_url) {
entry = $('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title));
} else {
entry = $('<img>').attr('src', response);
}
submit.removeAttr('disabled');
}
});
} else {
preview.append($('<div>').text(title));
submit.removeAttr('disabled');
}
} else {
if (curMeta && curMeta.preview_url) {
title = curMeta.name || '';
}
if (curMeta) {
preview.children().each(function () {
if ($(this).data('id') === id) {
$(this).html(entry);
submit.removeAttr('disabled');
if (curMeta && curMeta.preview_url) {
entry = $('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title));
} else {
entry = $('<img>').attr('src', response);
}
if (curMeta) {
preview.children().each(function () {
if ($(this).data('id') === id) {
$(this).html(entry);
submit.removeAttr('disabled');
}
});
} else {
preview.append($('<div>').append(entry));
submit.removeAttr('disabled');
}
}
});
} else {
preview.append($('<div>').append(entry));
submit.removeAttr('disabled');
return _context.abrupt("break", 83);
case 72:
if (svgStr) {
_context.next = 74;
break;
}
return _context.abrupt("break", 83);
case 74:
closeBrowser();
_context.next = 77;
return svgEditor.openPrep();
case 77:
ok = _context.sent;
if (ok) {
_context.next = 80;
break;
}
return _context.abrupt("return");
case 80:
svgCanvas.clear();
svgCanvas.setSvgString(response); // updateCanvas();
return _context.abrupt("break", 83);
case 83:
case "end":
return _context.stop();
}
}
}, _callee, this, [[3, 20]]);
}));
break;
return function (_x2) {
return _ref5.apply(this, arguments);
};
}(), true);
/**
* @param {boolean} show
* @returns {undefined}
*/
case 'o':
// Open
if (!svgStr) {
break;
}
svgEditor.openPrep(function (ok) {
if (!ok) {
return;
}
svgCanvas.clear();
svgCanvas.setSvgString(response); // updateCanvas();
});
closeBrowser();
break;
}
}, true);
buttons = [{
id: 'tool_imagelib',
type: 'app_menu',
@ -475,7 +555,7 @@ var svgEditorExtension_imagelib = (function () {
mouseup: showBrowser
}
}];
return _context.abrupt("return", {
return _context2.abrupt("return", {
svgicons: extIconsPath + 'ext-imagelib.xml',
buttons: imagelibStrings.buttons.map(function (button, i) {
return Object.assign(buttons[i], button);
@ -485,12 +565,12 @@ var svgEditorExtension_imagelib = (function () {
}
});
case 21:
case 20:
case "end":
return _context.stop();
return _context2.stop();
}
}
}, _callee, this);
}, _callee2, this);
}));
return function init(_x) {

View File

@ -37,8 +37,6 @@ var svgEditorExtension_markers = (function () {
};
}
/* globals jQuery */
/**
* ext-markers.js
*
@ -74,13 +72,14 @@ var svgEditorExtension_markers = (function () {
init: function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(S) {
var strings, svgEditor, $, svgCanvas, addElem, mtypes, markerPrefix, idPrefix, markerTypes, getLinked, setIcon, selElems, showPanel, addMarker, convertline, setMarker, colorChanged, updateReferences, triggerTextEntry, showTextPrompt, setArrowFromButton, getTitle, buildButtonList, contextTools;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
regeneratorRuntime.mark(function _callee3(S) {
var strings, svgEditor, $, svgCanvas, addElem, mtypes, markerPrefix, idPrefix, markerTypes, getLinked, setIcon, selElems, showPanel, addMarker, convertline, setMarker, colorChanged, updateReferences, triggerTextEntry, showTextPrompt, _showTextPrompt, setArrowFromButton, _setArrowFromButton, getTitle, buildButtonList, contextTools;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context3.prev = _context3.next) {
case 0:
buildButtonList = function _ref14(lang) {
buildButtonList = function _ref16() {
var buttons = []; // const i = 0;
/*
@ -131,42 +130,95 @@ var svgEditorExtension_markers = (function () {
return buttons;
};
getTitle = function _ref13(id) {
getTitle = function _ref15(id) {
var langList = strings.langList;
var item = langList.find(function (item) {
return item.id === id;
var item = langList.find(function (itm) {
return itm.id === id;
});
return item ? item.title : id;
};
setArrowFromButton = function _ref12(obj) {
var parts = this.id.split('_');
var pos = parts[1];
var val = parts[2];
_setArrowFromButton = function _ref14() {
_setArrowFromButton = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(ev) {
var parts, pos, val;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
parts = this.id.split('_');
pos = parts[1];
val = parts[2];
if (parts[3]) {
val += '_' + parts[3];
}
if (parts[3]) {
val += '_' + parts[3];
}
if (val !== 'textmarker') {
triggerTextEntry(pos, '\\' + val);
} else {
showTextPrompt(pos);
}
if (!(val !== 'textmarker')) {
_context2.next = 8;
break;
}
triggerTextEntry(pos, '\\' + val);
_context2.next = 10;
break;
case 8:
_context2.next = 10;
return showTextPrompt(pos);
case 10:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
return _setArrowFromButton.apply(this, arguments);
};
showTextPrompt = function _ref11(pos) {
var def = $('#' + pos + '_marker').val();
setArrowFromButton = function _ref13(_x3) {
return _setArrowFromButton.apply(this, arguments);
};
if (def.substr(0, 1) === '\\') {
def = '';
}
_showTextPrompt = function _ref12() {
_showTextPrompt = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(pos) {
var def, txt;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
def = $('#' + pos + '_marker').val();
$.prompt('Enter text for ' + pos + ' marker', def, function (txt) {
if (txt) {
triggerTextEntry(pos, txt);
}
});
if (def.substr(0, 1) === '\\') {
def = '';
}
_context.next = 4;
return $.prompt('Enter text for ' + pos + ' marker', def);
case 4:
txt = _context.sent;
if (txt) {
triggerTextEntry(pos, txt);
}
case 6:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _showTextPrompt.apply(this, arguments);
};
showTextPrompt = function _ref11(_x2) {
return _showTextPrompt.apply(this, arguments);
};
triggerTextEntry = function _ref10(pos, val) {
@ -333,11 +385,11 @@ var svgEditorExtension_markers = (function () {
var marker = svgCanvas.getElem(id);
if (marker) {
return;
return undefined;
}
if (val === '' || val === '\\nomarker') {
return;
return undefined;
}
var el = selElems[0];
@ -360,7 +412,7 @@ var svgEditorExtension_markers = (function () {
}
if (!markerTypes[seType]) {
return;
return undefined;
} // an unknown type!
// create a generic marker
@ -492,13 +544,13 @@ var svgEditorExtension_markers = (function () {
return svgCanvas.getElem(m[1]);
};
_context2.next = 15;
_context3.next = 17;
return S.importLocale();
case 15:
strings = _context2.sent;
case 17:
strings = _context3.sent;
svgEditor = this;
$ = jQuery;
$ = S.$;
svgCanvas = svgEditor.canvas;
addElem = svgCanvas.addSVGElementFromJson;
mtypes = ['start', 'mid', 'end'];
@ -647,38 +699,21 @@ var svgEditorExtension_markers = (function () {
change: setArrowFromButton
}
}];
return _context2.abrupt("return", {
return _context3.abrupt("return", {
name: strings.name,
svgicons: svgEditor.curConfig.extIconsPath + 'markers-icons.xml',
callback: function callback() {
$('#marker_panel').addClass('toolset').hide();
},
addLangData: function () {
var _addLangData = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, lang;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
importLocale = _ref.importLocale, lang = _ref.lang;
return _context.abrupt("return", {
data: strings.langList
});
case 2:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return function addLangData(_x2) {
return _addLangData.apply(this, arguments);
/* async */
addLangData: function addLangData(_ref) {
var importLocale = _ref.importLocale,
lang = _ref.lang;
return {
data: strings.langList
};
}(),
},
selectedChanged: function selectedChanged(opts) {
// Use this to update the current selected elements
// console.log('selectChanged',opts);
@ -716,12 +751,12 @@ var svgEditorExtension_markers = (function () {
})
});
case 27:
case 29:
case "end":
return _context2.stop();
return _context3.stop();
}
}
}, _callee2, this);
}, _callee3, this);
}));
return function init(_x) {

View File

@ -37,6 +37,14 @@ var svgEditorExtension_mathjax = (function () {
};
}
/**
* Add any of the whitelisted attributes to the script tag.
* @param {HTMLScriptElement} script
* @param {PlainObject.<string, string>} atts
* @returns {undefined}
*/
function addScriptAtts(script, atts) {
['id', 'class', 'type'].forEach(function (prop) {
if (prop in atts) {
@ -55,6 +63,7 @@ var svgEditorExtension_mathjax = (function () {
}
return new Promise(function (resolve, reject) {
// eslint-disable-line promise/avoid-new
var script = document.createElement('script');
var destructor = function destructor() {
@ -87,11 +96,11 @@ var svgEditorExtension_mathjax = (function () {
init: function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, strings, svgEditor, $, svgCanvas, mathjaxSrcSecure, uiStrings, math, locationX, locationY, mathjaxLoaded, saveMath, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
regeneratorRuntime.mark(function _callee2(_ref) {
var $, importLocale, strings, svgEditor, svgCanvas, mathjaxSrcSecure, uiStrings, math, locationX, locationY, mathjaxLoaded, saveMath, buttons;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
saveMath = function _ref2() {
var code = $('#mathjax_code_textarea').val(); // displaystyle to force MathJax NOT to use the inline style. Because it is
@ -145,14 +154,13 @@ var svgEditorExtension_mathjax = (function () {
});
};
importLocale = _ref.importLocale;
_context.next = 4;
$ = _ref.$, importLocale = _ref.importLocale;
_context2.next = 4;
return importLocale();
case 4:
strings = _context.sent;
strings = _context2.sent;
svgEditor = this;
$ = jQuery;
svgCanvas = svgEditor.canvas; // Configuration of the MathJax extention.
// This will be added to the head tag before MathJax is loaded.
@ -182,7 +190,8 @@ var svgEditorExtension_mathjax = (function () {
// Had been on https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG.js
// Obtained Text-AMS-MML_SVG.js from https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/config/TeX-AMS-MML_SVG.js
mathjaxSrcSecure = 'mathjax/MathJax.min.js?config=TeX-AMS-MML_SVG.js', uiStrings = svgEditor.uiStrings;
mathjaxLoaded = false; // TODO: Implement language support. Move these uiStrings to the locale files and the code to the langReady callback.
mathjaxLoaded = false; // TODO: Implement language support. Move these uiStrings to the locale files and
// the code to the langReady callback. Also i18nize alert and HTML below
$.extend(uiStrings, {
mathjax: {
@ -193,74 +202,110 @@ var svgEditorExtension_mathjax = (function () {
title: 'Mathematics code editor'
}
});
/**
*
* @returns {undefined}
*/
buttons = [{
id: 'tool_mathjax',
type: 'mode',
icon: svgEditor.curConfig.extIconsPath + 'mathjax.png',
events: {
click: function click() {
// Only load Mathjax when needed, we don't want to strain Svg-Edit any more.
// From this point on it is very probable that it will be needed, so load it.
if (mathjaxLoaded === false) {
$('<div id="mathjax">' + '<!-- Here is where MathJax creates the math -->' + '<div id="mathjax_creator" class="tex2jax_process" style="display:none">' + '$${}$$' + '</div>' + '<div id="mathjax_overlay"></div>' + '<div id="mathjax_container">' + '<div id="tool_mathjax_back" class="toolbar_button">' + '<button id="tool_mathjax_save">OK</button>' + '<button id="tool_mathjax_cancel">Cancel</button>' + '</div>' + '<fieldset>' + '<legend id="mathjax_legend">Mathematics Editor</legend>' + '<label>' + '<span id="mathjax_explication">Please type your mathematics in ' + '<a href="https://en.wikipedia.org/wiki/Help:Displaying_a_formula" target="_blank">TeX</a> code.</span></label>' + '<textarea id="mathjax_code_textarea" spellcheck="false"></textarea>' + '</fieldset>' + '</div>' + '</div>').insertAfter('#svg_prefs').hide(); // Make the MathEditor draggable.
click: function () {
var _click = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
// Set the mode.
svgCanvas.setMode('mathjax'); // Only load Mathjax when needed, we don't want to strain Svg-Edit any more.
// From this point on it is very probable that it will be needed, so load it.
$('#mathjax_container').draggable({
cancel: 'button,fieldset',
containment: 'window'
}); // Add functionality and picture to cancel button.
if (!(mathjaxLoaded === false)) {
_context.next = 17;
break;
}
$('#tool_mathjax_cancel').prepend($.getSvgIcon('cancel', true)).on('click touched', function () {
$('#mathjax').hide();
}); // Add functionality and picture to the save button.
$('<div id="mathjax">' + '<!-- Here is where MathJax creates the math -->' + '<div id="mathjax_creator" class="tex2jax_process" style="display:none">' + '$${}$$' + '</div>' + '<div id="mathjax_overlay"></div>' + '<div id="mathjax_container">' + '<div id="tool_mathjax_back" class="toolbar_button">' + '<button id="tool_mathjax_save">OK</button>' + '<button id="tool_mathjax_cancel">Cancel</button>' + '</div>' + '<fieldset>' + '<legend id="mathjax_legend">Mathematics Editor</legend>' + '<label>' + '<span id="mathjax_explication">Please type your mathematics in ' + '<a href="https://en.wikipedia.org/wiki/Help:Displaying_a_formula" target="_blank">TeX</a> code.</span></label>' + '<textarea id="mathjax_code_textarea" spellcheck="false"></textarea>' + '</fieldset>' + '</div>' + '</div>').insertAfter('#svg_prefs').hide(); // Make the MathEditor draggable.
$('#tool_mathjax_save').prepend($.getSvgIcon('ok', true)).on('click touched', function () {
saveMath();
$('#mathjax').hide();
}); // MathJax preprocessing has to ignore most of the page.
$('#mathjax_container').draggable({
cancel: 'button,fieldset',
containment: 'window'
}); // Add functionality and picture to cancel button.
$('body').addClass('tex2jax_ignore'); // Now get (and run) the MathJax Library.
// Todo: insert script with modules once widely supported
// and if MathJax (and its `TeX-AMS-MML_SVG.js` dependency) ends up
// providing an ES6 module export: https://github.com/mathjax/MathJax/issues/1998
$('#tool_mathjax_cancel').prepend($.getSvgIcon('cancel', true)).on('click touched', function () {
$('#mathjax').hide();
}); // Add functionality and picture to the save button.
/*
const modularVersion = !('svgEditor' in window) ||
!window.svgEditor ||
window.svgEditor.modules !== false;
// Add as second argument to `importScript`
{
type: modularVersion
? 'module' // Make this the default when widely supported
: 'text/javascript'
}
// If only using modules, just use this:
const {default: MathJax} = await importModule( // or `import()` when widely supported
svgEditor.curConfig.extIconsPath + mathjaxSrcSecure
);
*/
// We use `extIconsPath` here for now as it does not vary with
// the modular type as does `extPath`
$('#tool_mathjax_save').prepend($.getSvgIcon('ok', true)).on('click touched', function () {
saveMath();
$('#mathjax').hide();
}); // MathJax preprocessing has to ignore most of the page.
importScript(svgEditor.curConfig.extIconsPath + mathjaxSrcSecure).then(function () {
// When MathJax is loaded get the div where the math will be rendered.
MathJax.Hub.queue.Push(function () {
math = MathJax.Hub.getAllJax('#mathjax_creator')[0];
console.log(math);
mathjaxLoaded = true;
console.log('MathJax Loaded');
});
}).catch(function () {
console.log('Failed loadeing MathJax.');
$.alert('Failed loading MathJax. You will not be able to change the mathematics.');
});
} // Set the mode.
$('body').addClass('tex2jax_ignore'); // Now get (and run) the MathJax Library.
// Todo: insert script with modules once widely supported
// and if MathJax (and its `TeX-AMS-MML_SVG.js` dependency) ends up
// providing an ES6 module export: https://github.com/mathjax/MathJax/issues/1998
/*
const modularVersion = !('svgEditor' in window) ||
!window.svgEditor ||
window.svgEditor.modules !== false;
// Add as second argument to `importScript`
{
type: modularVersion
? 'module' // Make this the default when widely supported
: 'text/javascript'
}
// If only using modules, just use this:
const {default: MathJax} = await importModule( // or `import()` when widely supported
svgEditor.curConfig.extIconsPath + mathjaxSrcSecure
);
*/
// We use `extIconsPath` here for now as it does not vary with
// the modular type as does `extPath`
svgCanvas.setMode('mathjax');
}
_context.prev = 7;
_context.next = 10;
return importScript(svgEditor.curConfig.extIconsPath + mathjaxSrcSecure);
case 10:
// When MathJax is loaded get the div where the math will be rendered.
MathJax.Hub.queue.Push(function () {
math = MathJax.Hub.getAllJax('#mathjax_creator')[0];
console.log(math); // eslint-disable-line no-console
mathjaxLoaded = true;
console.log('MathJax Loaded'); // eslint-disable-line no-console
});
_context.next = 17;
break;
case 13:
_context.prev = 13;
_context.t0 = _context["catch"](7);
console.log('Failed loading MathJax.'); // eslint-disable-line no-console
$.alert('Failed loading MathJax. You will not be able to change the mathematics.');
case 17:
case "end":
return _context.stop();
}
}
}, _callee, this, [[7, 13]]);
}));
return function click() {
return _click.apply(this, arguments);
};
}()
}
}];
return _context.abrupt("return", {
return _context2.abrupt("return", {
name: strings.name,
svgicons: svgEditor.curConfig.extIconsPath + 'mathjax-icons.xml',
buttons: strings.buttons.map(function (button, i) {
@ -272,6 +317,8 @@ var svgEditorExtension_mathjax = (function () {
started: true
};
}
return undefined;
},
mouseUp: function mouseUp(opts) {
if (svgCanvas.getMode() === 'mathjax') {
@ -285,6 +332,8 @@ var svgEditorExtension_mathjax = (function () {
started: false
}; // Otherwise the last selected object dissapears.
}
return undefined;
},
callback: function callback() {
$('<style>').text('#mathjax fieldset{' + 'padding: 5px;' + 'margin: 5px;' + 'border: 1px solid #DDD;' + '}' + '#mathjax label{' + 'display: block;' + 'margin: .5em;' + '}' + '#mathjax legend {' + 'max-width:195px;' + '}' + '#mathjax_overlay {' + 'position: absolute;' + 'top: 0;' + 'left: 0;' + 'right: 0;' + 'bottom: 0;' + 'background-color: black;' + 'opacity: 0.6;' + 'z-index: 20000;' + '}' + '#mathjax_container {' + 'position: absolute;' + 'top: 50px;' + 'padding: 10px;' + 'background-color: #B0B0B0;' + 'border: 1px outset #777;' + 'opacity: 1.0;' + 'font-family: Verdana, Helvetica, sans-serif;' + 'font-size: .8em;' + 'z-index: 20001;' + '}' + '#tool_mathjax_back {' + 'margin-left: 1em;' + 'overflow: auto;' + '}' + '#mathjax_legend{' + 'font-weight: bold;' + 'font-size:1.1em;' + '}' + '#mathjax_code_textarea {\\n' + 'margin: 5px .7em;' + 'overflow: hidden;' + 'width: 416px;' + 'display: block;' + 'height: 100px;' + '}').appendTo('head'); // Add the MathJax configuration.
@ -292,12 +341,12 @@ var svgEditorExtension_mathjax = (function () {
}
});
case 13:
case 12:
case "end":
return _context.stop();
return _context2.stop();
}
}
}, _callee, this);
}, _callee2, this);
}));
return function init(_x) {

View File

@ -1,8 +1,6 @@
var svgEditorExtension_overview_window = (function () {
'use strict';
/* globals jQuery */
/**
* ext-overview_window.js
*
@ -14,18 +12,18 @@ var svgEditorExtension_overview_window = (function () {
var extOverview_window = {
name: 'overview_window',
init: function init(_ref) {
var isChrome = _ref.isChrome,
var $ = _ref.$,
isChrome = _ref.isChrome,
isIE = _ref.isIE;
var $ = jQuery;
var overviewWindowGlobals = {}; // Disabled in Chrome 48-, see https://github.com/SVG-Edit/svgedit/issues/26 and
// https://code.google.com/p/chromium/issues/detail?id=565120.
if (isChrome()) {
var verIndex = navigator.userAgent.indexOf('Chrome/') + 7;
var chromeVersion = parseInt(navigator.userAgent.substring(verIndex), 10);
var chromeVersion = parseInt(navigator.userAgent.substring(verIndex));
if (chromeVersion < 49) {
return;
return undefined;
}
} // Define and insert the base html element.

View File

@ -91,6 +91,8 @@ var svgEditorExtension_panning = (function () {
started: true
};
}
return undefined;
},
mouseUp: function mouseUp() {
if (svgCanvas.getMode() === 'ext-panning') {
@ -100,6 +102,8 @@ var svgEditorExtension_panning = (function () {
element: null
};
}
return undefined;
}
});

View File

@ -1,15 +1,18 @@
var svgEditorExtension_php_savefile = (function () {
'use strict';
/* globals jQuery */
// TODO: Might add support for "exportImage" custom
// handler as in "ext-server_opensave.js" (and in savefile.php)
var extPhp_savefile = {
name: 'php_savefile',
init: function init() {
init: function init(_ref) {
var $ = _ref.$;
var svgEditor = this;
var $ = jQuery;
var svgCanvas = svgEditor.canvas;
/**
* Get file name out of SVGEdit document title.
* @returns {string}
*/
function getFileNameFromTitle() {
var title = svgCanvas.getDocumentTitle();

View File

@ -37,8 +37,6 @@ var svgEditorExtension_polygon = (function () {
};
}
/* globals jQuery */
/**
* ext-polygon.js
*
@ -52,7 +50,7 @@ var svgEditorExtension_polygon = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(S) {
var svgEditor, $, svgCanvas, importLocale, editingitex, strings, selElems, started, newFO, showPanel, setAttr, cot, sec, buttons, contextTools;
var svgEditor, svgCanvas, $, importLocale, editingitex, strings, selElems, started, newFO, showPanel, setAttr, cot, sec, buttons, contextTools;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -82,13 +80,12 @@ var svgEditorExtension_polygon = (function () {
};
svgEditor = this;
$ = jQuery;
svgCanvas = svgEditor.canvas;
importLocale = S.importLocale, editingitex = false;
_context.next = 10;
$ = S.$, importLocale = S.importLocale, editingitex = false;
_context.next = 9;
return importLocale();
case 10:
case 9:
strings = _context.sent;
/**
@ -189,88 +186,89 @@ var svgEditorExtension_polygon = (function () {
}, 3000);
},
mouseDown: function mouseDown(opts) {
// const e = opts.event;
if (svgCanvas.getMode() !== 'polygon') {
return undefined;
} // const e = opts.event;
var rgb = svgCanvas.getColor('fill'); // const ccRgbEl = rgb.substring(1, rgb.length);
var sRgb = svgCanvas.getColor('stroke'); // ccSRgbEl = sRgb.substring(1, rgb.length);
var sWidth = svgCanvas.getStrokeWidth();
if (svgCanvas.getMode() === 'polygon') {
started = true;
newFO = svgCanvas.addSVGElementFromJson({
element: 'polygon',
attr: {
cx: opts.start_x,
cy: opts.start_y,
id: svgCanvas.getNextId(),
shape: 'regularPoly',
sides: document.getElementById('polySides').value,
orient: 'x',
edge: 0,
fill: rgb,
strokecolor: sRgb,
strokeWidth: sWidth
}
});
return {
started: true
};
}
started = true;
newFO = svgCanvas.addSVGElementFromJson({
element: 'polygon',
attr: {
cx: opts.start_x,
cy: opts.start_y,
id: svgCanvas.getNextId(),
shape: 'regularPoly',
sides: document.getElementById('polySides').value,
orient: 'x',
edge: 0,
fill: rgb,
strokecolor: sRgb,
strokeWidth: sWidth
}
});
return {
started: true
};
},
mouseMove: function mouseMove(opts) {
if (!started) {
return;
}
if (svgCanvas.getMode() === 'polygon') {
// const e = opts.event;
var c = $(newFO).attr(['cx', 'cy', 'sides', 'orient', 'fill', 'strokecolor', 'strokeWidth']);
var x = opts.mouse_x;
var y = opts.mouse_y;
var cx = c.cx,
cy = c.cy,
fill = c.fill,
strokecolor = c.strokecolor,
strokeWidth = c.strokeWidth,
sides = c.sides,
edg = Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)) / 1.5;
newFO.setAttribute('edge', edg);
var inradius = edg / 2 * cot(Math.PI / sides);
var circumradius = inradius * sec(Math.PI / sides);
var points = '';
for (var s = 0; sides >= s; s++) {
var angle = 2.0 * Math.PI * s / sides;
x = circumradius * Math.cos(angle) + cx;
y = circumradius * Math.sin(angle) + cy;
points += x + ',' + y + ' ';
} // const poly = newFO.createElementNS(NS.SVG, 'polygon');
if (!started || svgCanvas.getMode() !== 'polygon') {
return undefined;
} // const e = opts.event;
newFO.setAttribute('points', points);
newFO.setAttribute('fill', fill);
newFO.setAttribute('stroke', strokecolor);
newFO.setAttribute('stroke-width', strokeWidth); // newFO.setAttribute('transform', 'rotate(-90)');
// const shape = newFO.getAttribute('shape');
// newFO.append(poly);
// DrawPoly(cx, cy, sides, edg, orient);
var c = $(newFO).attr(['cx', 'cy', 'sides', 'orient', 'fill', 'strokecolor', 'strokeWidth']);
var x = opts.mouse_x;
var y = opts.mouse_y;
var cx = c.cx,
cy = c.cy,
fill = c.fill,
strokecolor = c.strokecolor,
strokeWidth = c.strokeWidth,
sides = c.sides,
edg = Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)) / 1.5;
newFO.setAttribute('edge', edg);
var inradius = edg / 2 * cot(Math.PI / sides);
var circumradius = inradius * sec(Math.PI / sides);
var points = '';
return {
started: true
};
}
for (var s = 0; sides >= s; s++) {
var angle = 2.0 * Math.PI * s / sides;
x = circumradius * Math.cos(angle) + cx;
y = circumradius * Math.sin(angle) + cy;
points += x + ',' + y + ' ';
} // const poly = newFO.createElementNS(NS.SVG, 'polygon');
newFO.setAttribute('points', points);
newFO.setAttribute('fill', fill);
newFO.setAttribute('stroke', strokecolor);
newFO.setAttribute('stroke-width', strokeWidth); // newFO.setAttribute('transform', 'rotate(-90)');
// const shape = newFO.getAttribute('shape');
// newFO.append(poly);
// DrawPoly(cx, cy, sides, edg, orient);
return {
started: true
};
},
mouseUp: function mouseUp(opts) {
if (svgCanvas.getMode() === 'polygon') {
var attrs = $(newFO).attr('edge');
var keep = attrs.edge !== '0'; // svgCanvas.addToSelection([newFO], true);
return {
keep: keep,
element: newFO
};
if (svgCanvas.getMode() !== 'polygon') {
return undefined;
}
var attrs = $(newFO).attr('edge');
var keep = attrs.edge !== '0'; // svgCanvas.addToSelection([newFO], true);
return {
keep: keep,
element: newFO
};
},
selectedChanged: function selectedChanged(opts) {
// Use this to update the current selected elements
@ -295,7 +293,7 @@ var svgEditorExtension_polygon = (function () {
elementChanged: function elementChanged(opts) {}
});
case 14:
case 13:
case "end":
return _context.stop();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,43 @@ var svgEditorExtension_shapes = (function () {
};
}
/* globals jQuery */
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
/**
* ext-shapes.js
@ -53,12 +89,12 @@ var svgEditorExtension_shapes = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, strings, svgEditor, $, canv, svgroot, lastBBox, categories, library, modeId, startClientPos, currentD, curShapeId, curShape, startX, startY, curLib, loadIcons, makeButtons, loadLibrary, buttons;
var $, importLocale, strings, svgEditor, canv, svgroot, lastBBox, categories, library, modeId, startClientPos, currentD, curShapeId, curShape, startX, startY, curLib, loadIcons, makeButtons, loadLibrary, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
loadLibrary = function _ref4(catId) {
loadLibrary = function _ref8(catId) {
var lib = library[catId];
if (!lib) {
@ -84,7 +120,7 @@ var svgEditorExtension_shapes = (function () {
loadIcons();
};
makeButtons = function _ref3(cat, shapes) {
makeButtons = function _ref7(cat, shapes) {
var size = curLib.size || 300;
var fill = curLib.fill || false;
var off = size * 0.05;
@ -97,10 +133,11 @@ var svgEditorExtension_shapes = (function () {
shapeIcon.documentElement.setAttribute('height', height);
var svgElem = $(document.importNode(shapeIcon.documentElement, true));
var data = shapes.data;
curLib.buttons = [];
curLib.buttons = Object.entries(data).map(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
id = _ref3[0],
pathD = _ref3[1];
for (var id in data) {
var pathD = data[id];
var icon = svgElem.clone();
icon.find('path').attr('d', pathD);
var iconBtn = icon.wrap('<div class="tool_button">').parent().attr({
@ -108,22 +145,21 @@ var svgEditorExtension_shapes = (function () {
title: id
}); // Store for later use
curLib.buttons.push(iconBtn[0]);
}
return iconBtn[0];
});
};
loadIcons = function _ref2() {
loadIcons = function _ref6() {
$('#shape_buttons').empty().append(curLib.buttons);
};
importLocale = _ref.importLocale;
$ = _ref.$, importLocale = _ref.importLocale;
_context.next = 6;
return importLocale();
case 6:
strings = _context.sent;
svgEditor = this;
$ = jQuery;
canv = svgEditor.canvas;
svgroot = canv.getRootElem();
lastBBox = {}; // This populates the category list
@ -167,6 +203,11 @@ var svgEditorExtension_shapes = (function () {
modeId = 'shapelib';
startClientPos = {};
curLib = library.basic;
/**
*
* @returns {undefined}
*/
buttons = [{
id: 'tool_shapelib',
icon: svgEditor.curConfig.extIconsPath + 'shapes.png',
@ -185,7 +226,7 @@ var svgEditorExtension_shapes = (function () {
return Object.assign(buttons[i], button);
}),
callback: function callback() {
$('<style>').text('#shape_buttons {' + 'overflow: auto;' + 'width: 180px;' + 'max-height: 300px;' + 'display: table-cell;' + 'vertical-align: middle;' + '}' + '#shape_cats {' + 'min-width: 110px;' + 'display: table-cell;' + 'vertical-align: middle;' + 'height: 300px;' + '}' + '#shape_cats > div {' + 'line-height: 1em;' + 'padding: .5em;' + 'border:1px solid #B0B0B0;' + 'background: #E8E8E8;' + 'margin-bottom: -1px;' + '}' + '#shape_cats div:hover {' + 'background: #FFFFCC;' + '}' + '#shape_cats div.current {' + 'font-weight: bold;' + '}').appendTo('head');
$('<style>').text("\n #shape_buttons {\n overflow: auto;\n width: 180px;\n max-height: 300px;\n display: table-cell;\n vertical-align: middle;\n }\n #shape_cats {\n min-width: 110px;\n display: table-cell;\n vertical-align: middle;\n height: 300px;\n }\n #shape_cats > div {\n line-height: 1em;\n padding: .5em;\n border:1px solid #B0B0B0;\n background: #E8E8E8;\n margin-bottom: -1px;\n }\n #shape_cats div:hover {\n background: #FFFFCC;\n }\n #shape_cats div.current {\n font-weight: bold;\n }\n ").appendTo('head');
var btnDiv = $('<div id="shape_buttons">');
$('#tools_shapelib > *').wrapAll(btnDiv);
var shower = $('#tools_shapelib_show');
@ -233,18 +274,20 @@ var svgEditorExtension_shapes = (function () {
}); // Now add shape categories from locale
var cats = {};
Object.entries(categories).forEach(function (_ref4) {
var _ref5 = _slicedToArray(_ref4, 2),
o = _ref5[0],
categoryName = _ref5[1];
for (var o in categories) {
cats['#shape_cats [data-cat="' + o + '"]'] = categories[o];
}
cats['#shape_cats [data-cat="' + o + '"]'] = categoryName;
});
this.setStrings('content', cats);
},
mouseDown: function mouseDown(opts) {
var mode = canv.getMode();
if (mode !== modeId) {
return;
return undefined;
}
startX = opts.start_x;
@ -349,7 +392,7 @@ var svgEditorExtension_shapes = (function () {
var mode = canv.getMode();
if (mode !== modeId) {
return;
return undefined;
}
var keepObject = opts.event.clientX !== startClientPos.x && opts.event.clientY !== startClientPos.y;
@ -361,7 +404,7 @@ var svgEditorExtension_shapes = (function () {
}
});
case 19:
case 18:
case "end":
return _context.stop();
}

View File

@ -37,8 +37,6 @@ var svgEditorExtension_star = (function () {
};
}
/* globals jQuery */
/**
* ext-star.js
*
@ -52,7 +50,7 @@ var svgEditorExtension_star = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(S) {
var svgEditor, $, svgCanvas, importLocale, selElems, started, newFO, strings, showPanel, setAttr, buttons, contextTools;
var svgEditor, svgCanvas, $, importLocale, selElems, started, newFO, strings, showPanel, setAttr, buttons, contextTools;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -74,14 +72,13 @@ var svgEditorExtension_star = (function () {
};
svgEditor = this;
$ = jQuery;
svgCanvas = svgEditor.canvas;
importLocale = S.importLocale; // {svgcontent},
$ = S.$, importLocale = S.importLocale; // {svgcontent},
_context.next = 8;
_context.next = 7;
return importLocale();
case 8:
case 7:
strings = _context.sent;
/*
@ -175,10 +172,12 @@ var svgEditorExtension_star = (function () {
started: true
};
}
return undefined;
},
mouseMove: function mouseMove(opts) {
if (!started) {
return;
return undefined;
}
if (svgCanvas.getMode() === 'star') {
@ -239,6 +238,8 @@ var svgEditorExtension_star = (function () {
started: true
};
}
return undefined;
},
mouseUp: function mouseUp() {
if (svgCanvas.getMode() === 'star') {
@ -249,6 +250,8 @@ var svgEditorExtension_star = (function () {
element: newFO
};
}
return undefined;
},
selectedChanged: function selectedChanged(opts) {
// Use this to update the current selected elements
@ -275,7 +278,7 @@ var svgEditorExtension_star = (function () {
elementChanged: function elementChanged(opts) {}
});
case 12:
case 11:
case "end":
return _context.stop();
}

View File

@ -37,7 +37,43 @@ var svgEditorExtension_storage = (function () {
};
}
/* globals jQuery */
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
/**
* ext-storage.js
@ -63,9 +99,9 @@ var svgEditorExtension_storage = (function () {
*/
var extStorage = {
name: 'storage',
init: function init() {
init: function init(_ref) {
var $ = _ref.$;
var svgEditor = this;
var $ = jQuery;
var svgCanvas = svgEditor.canvas; // We could empty any already-set data for users when they decline storage,
// but it would be a risk for users who wanted to store but accidentally
// said "no"; instead, we'll let those who already set it, delete it themselves;
@ -78,6 +114,11 @@ var svgEditorExtension_storage = (function () {
forceStorage = _svgEditor$curConfig.forceStorage;
var storage = svgEditor.storage,
updateCanvas = svgEditor.updateCanvas;
/**
* Replace `storagePrompt` parameter within URL.
* @param {string} val
* @returns {undefined}
*/
function replaceStoragePrompt(val) {
val = val ? 'storagePrompt=' + val : '';
@ -91,6 +132,13 @@ var svgEditorExtension_storage = (function () {
loc.href += (loc.href.includes('?') ? '&' : '?') + val;
}
}
/**
* Sets SVG content as a string with "svgedit-" and the current
* canvas name as namespace.
* @param {string} val
* @returns {undefined}
*/
function setSVGContentStorage(val) {
if (storage) {
@ -103,29 +151,42 @@ var svgEditorExtension_storage = (function () {
}
}
}
/**
* Set the cookie to expire.
* @param {string} cookie
* @returns {undefined}
*/
function expireCookie(cookie) {
document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
}
/**
* Expire the storage cookie.
* @returns {undefined}
*/
function removeStoragePrefCookie() {
expireCookie('store');
expireCookie('svgeditstore');
}
/**
* Empties storage for each of the current preferences.
* @returns {undefined}
*/
function emptyStorage() {
setSVGContentStorage('');
Object.keys(svgEditor.curPrefs).forEach(function (name) {
name = 'svg-edit-' + name;
for (var name in svgEditor.curPrefs) {
if (svgEditor.curPrefs.hasOwnProperty(name)) {
name = 'svg-edit-' + name;
if (storage) {
storage.removeItem(name);
}
expireCookie(name);
if (storage) {
storage.removeItem(name);
}
}
expireCookie(name);
});
} // emptyStorage();
/**
@ -142,11 +203,11 @@ var svgEditorExtension_storage = (function () {
function setupBeforeUnloadListener() {
window.addEventListener('beforeunload', function (e) {
// Don't save anything unless the user opted in to storage
if (!document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)) {
if (!document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)) {
return;
}
if (document.cookie.match(/(?:^|;\s*)store=prefsAndContent/)) {
if (document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/)) {
setSVGContentStorage(svgCanvas.getSvgString());
}
@ -156,28 +217,27 @@ var svgEditorExtension_storage = (function () {
// svgEditor.showSaveWarning = false;
var curPrefs = svgEditor.curPrefs;
Object.entries(curPrefs).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
key = _ref3[0],
val = _ref3[1];
for (var key in curPrefs) {
if (curPrefs.hasOwnProperty(key)) {
// It's our own config, so we don't need to iterate up the prototype chain
var val = curPrefs[key];
var store = val !== undefined;
key = 'svg-edit-' + key;
var store = val !== undefined;
key = 'svg-edit-' + key;
if (!store) {
continue;
}
if (storage) {
storage.setItem(key, val);
} else if (window.widget) {
window.widget.setPreferenceForKey(val, key);
} else {
val = encodeURIComponent(val);
document.cookie = encodeURIComponent(key) + '=' + val + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
}
if (!store) {
return;
}
}
if (storage) {
storage.setItem(key, val);
} else if (window.widget) {
window.widget.setPreferenceForKey(val, key);
} else {
val = encodeURIComponent(val);
document.cookie = encodeURIComponent(key) + '=' + val + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
}
});
});
}
@ -187,14 +247,14 @@ var svgEditorExtension_storage = (function () {
langReady: function () {
var _langReady = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, _$$deparam$querystrin, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight;
regeneratorRuntime.mark(function _callee(_ref4) {
var importLocale, _$$deparam$querystrin, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight, _ref5, pref, checked;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
importLocale = _ref.importLocale;
importLocale = _ref4.importLocale;
_$$deparam$querystrin = $.deparam.querystring(true), storagePrompt = _$$deparam$querystrin.storagePrompt;
_context.next = 4;
return importLocale();
@ -217,7 +277,7 @@ var svgEditorExtension_storage = (function () {
// extension! (and to avoid using any prior storage, set the
// config option "noStorageOnLoad" to true).
if (!forceStorage && ( // If the URL has been explicitly set to always prompt the
if (!(!forceStorage && ( // If the URL has been explicitly set to always prompt the
// user (e.g., so one can be pointed to a URL where one
// can alter one's settings, say to prevent future storage)...
storagePrompt === true || // ...or...if the URL at least doesn't explicitly prevent a
@ -225,100 +285,129 @@ var svgEditorExtension_storage = (function () {
// don't want to set cookies at all but who don't want
// continual prompts about it)...
storagePrompt !== false && // ...and this user hasn't previously indicated a desire for storage
!document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/) // ...then show the storage prompt.
)) {
options = [];
!document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/) // ...then show the storage prompt.
))) {
_context.next = 44;
break;
}
if (storage) {
options.unshift({
value: 'prefsAndContent',
text: storagePrefsAndContent
}, {
value: 'prefsOnly',
text: storagePrefsOnly
}, {
value: 'noPrefsOrContent',
text: storageNoPrefsOrContent
});
} else {
options.unshift({
value: 'prefsOnly',
text: storagePrefs
}, {
value: 'noPrefsOrContent',
text: storageNoPrefs
});
} // Hack to temporarily provide a wide and high enough dialog
options = [];
oldContainerWidth = $('#dialog_container')[0].style.width, oldContainerMarginLeft = $('#dialog_container')[0].style.marginLeft, oldContentHeight = $('#dialog_content')[0].style.height, oldContainerHeight = $('#dialog_container')[0].style.height;
$('#dialog_content')[0].style.height = '120px';
$('#dialog_container')[0].style.height = '170px';
$('#dialog_container')[0].style.width = '800px';
$('#dialog_container')[0].style.marginLeft = '-400px'; // Open select-with-checkbox dialog
// From svg-editor.js
$.select(message, options, function (pref, checked) {
if (pref && pref !== 'noPrefsOrContent') {
// Regardless of whether the user opted
// to remember the choice (and move to a URL which won't
// ask them again), we have to assume the user
// doesn't even want to remember their not wanting
// storage, so we don't set the cookie or continue on with
// setting storage on beforeunload
document.cookie = 'store=' + encodeURIComponent(pref) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; // 'prefsAndContent' | 'prefsOnly'
// If the URL was configured to always insist on a prompt, if
// the user does indicate a wish to store their info, we
// don't want ask them again upon page refresh so move
// them instead to a URL which does not always prompt
if (storagePrompt === true && checked) {
replaceStoragePrompt();
return;
}
} else {
// The user does not wish storage (or cancelled, which we treat equivalently)
removeStoragePrefCookie();
if (pref && // If the user explicitly expresses wish for no storage
emptyStorageOnDecline) {
emptyStorage();
}
if (pref && checked) {
// Open a URL which won't set storage and won't prompt user about storage
replaceStoragePrompt('false');
return;
}
} // Reset width/height of dialog (e.g., for use by Export)
$('#dialog_container')[0].style.width = oldContainerWidth;
$('#dialog_container')[0].style.marginLeft = oldContainerMarginLeft;
$('#dialog_content')[0].style.height = oldContentHeight;
$('#dialog_container')[0].style.height = oldContainerHeight; // It should be enough to (conditionally) add to storage on
// beforeunload, but if we wished to update immediately,
// we might wish to try setting:
// svgEditor.setConfig({noStorageOnLoad: true});
// and then call:
// svgEditor.loadContentAndPrefs();
// We don't check for noStorageOnLoad here because
// the prompt gives the user the option to store data
setupBeforeUnloadListener();
svgEditor.storagePromptState = 'closed';
updateCanvas(true);
}, null, null, {
label: rememberLabel,
checked: true,
tooltip: rememberTooltip
if (storage) {
options.unshift({
value: 'prefsAndContent',
text: storagePrefsAndContent
}, {
value: 'prefsOnly',
text: storagePrefsOnly
}, {
value: 'noPrefsOrContent',
text: storageNoPrefsOrContent
});
svgEditor.storagePromptState = 'waiting';
} else if (!noStorageOnLoad || forceStorage) {
} else {
options.unshift({
value: 'prefsOnly',
text: storagePrefs
}, {
value: 'noPrefsOrContent',
text: storageNoPrefs
});
} // Hack to temporarily provide a wide and high enough dialog
oldContainerWidth = $('#dialog_container')[0].style.width, oldContainerMarginLeft = $('#dialog_container')[0].style.marginLeft, oldContentHeight = $('#dialog_content')[0].style.height, oldContainerHeight = $('#dialog_container')[0].style.height;
$('#dialog_content')[0].style.height = '120px';
$('#dialog_container')[0].style.height = '170px';
$('#dialog_container')[0].style.width = '800px';
$('#dialog_container')[0].style.marginLeft = '-400px'; // Open select-with-checkbox dialog
// From svg-editor.js
svgEditor.storagePromptState = 'waiting';
_context.next = 20;
return $.select(message, options, null, null, {
label: rememberLabel,
checked: true,
tooltip: rememberTooltip
});
case 20:
_ref5 = _context.sent;
pref = _ref5.response;
checked = _ref5.checked;
if (!(pref && pref !== 'noPrefsOrContent')) {
_context.next = 30;
break;
}
// Regardless of whether the user opted
// to remember the choice (and move to a URL which won't
// ask them again), we have to assume the user
// doesn't even want to remember their not wanting
// storage, so we don't set the cookie or continue on with
// setting storage on beforeunload
document.cookie = 'svgeditstore=' + encodeURIComponent(pref) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; // 'prefsAndContent' | 'prefsOnly'
// If the URL was configured to always insist on a prompt, if
// the user does indicate a wish to store their info, we
// don't want ask them again upon page refresh so move
// them instead to a URL which does not always prompt
if (!(storagePrompt === true && checked)) {
_context.next = 28;
break;
}
replaceStoragePrompt();
return _context.abrupt("return");
case 28:
_context.next = 35;
break;
case 30:
// The user does not wish storage (or cancelled, which we treat equivalently)
removeStoragePrefCookie();
if (pref && // If the user explicitly expresses wish for no storage
emptyStorageOnDecline) {
emptyStorage();
}
if (!(pref && checked)) {
_context.next = 35;
break;
}
// Open a URL which won't set storage and won't prompt user about storage
replaceStoragePrompt('false');
return _context.abrupt("return");
case 35:
// Reset width/height of dialog (e.g., for use by Export)
$('#dialog_container')[0].style.width = oldContainerWidth;
$('#dialog_container')[0].style.marginLeft = oldContainerMarginLeft;
$('#dialog_content')[0].style.height = oldContentHeight;
$('#dialog_container')[0].style.height = oldContainerHeight; // It should be enough to (conditionally) add to storage on
// beforeunload, but if we wished to update immediately,
// we might wish to try setting:
// svgEditor.setConfig({noStorageOnLoad: true});
// and then call:
// svgEditor.loadContentAndPrefs();
// We don't check for noStorageOnLoad here because
// the prompt gives the user the option to store data
setupBeforeUnloadListener();
svgEditor.storagePromptState = 'closed';
updateCanvas(true);
_context.next = 45;
break;
case 44:
if (!noStorageOnLoad || forceStorage) {
setupBeforeUnloadListener();
}
case 10:
case 45:
case "end":
return _context.stop();
}

View File

@ -49,12 +49,12 @@ var svgEditorExtension_webappfind = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(_ref) {
var importLocale, strings, svgEditor, saveMessage, readMessage, excludedMessages, pathID, buttons;
var importLocale, $, strings, svgEditor, saveMessage, readMessage, excludedMessages, pathID, buttons;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
importLocale = _ref.importLocale;
importLocale = _ref.importLocale, $ = _ref.$;
_context.next = 3;
return importLocale();
@ -73,6 +73,7 @@ var svgEditorExtension_webappfind = (function () {
function (win, _ref2) {
var data = _ref2.data,
origin = _ref2.origin;
// eslint-disable-line no-shadow
// console.log('data, origin', data, origin);
var type, content;
@ -103,7 +104,7 @@ var svgEditorExtension_webappfind = (function () {
break;
case 'save-end':
alert("save complete for pathID ".concat(pathID, "!"));
$.alert("save complete for pathID ".concat(pathID, "!"));
break;
default:

View File

@ -65,7 +65,8 @@ var svgEditorExtension_xdomain_messaging = (function () {
var allowedOrigins = svgEditor.curConfig.allowedOrigins;
if (!allowedOrigins.includes('*') && !allowedOrigins.includes(e.origin)) {
console.log("Origin ".concat(e.origin, " not whitelisted for posting to ").concat(window.origin));
console.log("Origin ".concat(e.origin, " not whitelisted for posting to ").concat(window.origin)); // eslint-disable-line no-console
return;
}
@ -88,7 +89,7 @@ var svgEditorExtension_xdomain_messaging = (function () {
e.source.postMessage(JSON.stringify(message), '*');
});
} catch (err) {
console.log('Error with xdomain message listener: ' + err);
console.log('Error with xdomain message listener: ' + err); // eslint-disable-line no-console
}
}
};

View File

@ -57,7 +57,9 @@
data = canvas.toDataURL();
} catch (err) {
// This fails in Firefox with `file:///` URLs :(
alert('Data URL conversion failed: ' + err);
// Todo: This could use a generic alert library instead
alert('Data URL conversion failed: ' + err); // eslint-disable-line no-alert
data = '';
}

View File

@ -3004,6 +3004,13 @@
manipulation($$1, jml);
var baseAPIURL = 'https://openclipart.org/search/json/';
var jsVoid = 'javascript: void(0);'; // eslint-disable-line no-script-url
/**
* Shows results after query submission.
* @param {string} url
* @returns {undefined}
*/
function processResults(_x) {
return _processResults.apply(this, arguments);
@ -3021,7 +3028,7 @@
case 0:
queryLink = function _ref4(query) {
return ['a', {
href: 'javascript: void(0);',
href: jsVoid,
dataset: {
value: query
},
@ -3046,17 +3053,18 @@
case 6:
json = _context3.sent;
console.log('json', json);
if (!(!json || json.msg !== 'success')) {
_context3.next = 11;
_context3.next = 10;
break;
}
alert('There was a problem downloading the results');
// Todo: This could use a generic alert library instead
alert('There was a problem downloading the results'); // eslint-disable-line no-alert
return _context3.abrupt("return");
case 11:
case 10:
payload = json.payload, _json$info = json.info, numResults = _json$info.results, pages = _json$info.pages, currentPage = _json$info.current_page; // $('#page')[0].value = currentPage;
// $('#page')[0].max = pages;
// Unused properties:
@ -3093,15 +3101,13 @@
var _click = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(e) {
var _this$dataset, svgURL, id, post, result, svg;
var svgurl, post, result, svg;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
e.preventDefault();
_this$dataset = this.dataset, svgURL = _this$dataset.value, id = _this$dataset.id;
console.log('this', id, svgURL);
svgurl = this.dataset.value; // console.log('this', id, svgurl);
post = function post(message) {
// Todo: Make origin customizable as set by opening window
@ -3114,25 +3120,25 @@
post({
name: title,
id: svgURL
id: svgurl
});
_context2.next = 7;
return fetch(svgURL);
_context2.next = 6;
return fetch(svgurl);
case 7:
case 6:
result = _context2.sent;
_context2.next = 10;
_context2.next = 9;
return result.text();
case 10:
case 9:
svg = _context2.sent;
console.log('h', svgURL, svg);
// console.log('url and svg', svgurl, svg);
post({
href: svgURL,
href: svgurl,
data: svg
});
case 13:
case 11:
case "end":
return _context2.stop();
}
@ -3151,7 +3157,7 @@
src: svgURL,
style: "width: ".concat(imgHW, "; height: ").concat(imgHW, ";")
}]]], ['b', [title]], ' ', ['i', [description]], ' ', ['span', ['(ID: ', ['a', {
href: 'javascript: void(0);',
href: jsVoid,
dataset: {
value: id
},
@ -3170,7 +3176,7 @@
return ['span', [' ', queryLink(tag)]];
})))];
})), [['br'], ['br'], currentPage === 1 || pages <= 2 ? '' : ['span', [['a', {
href: 'javascript: void(0);',
href: jsVoid,
$on: {
click: function click(e) {
e.preventDefault();
@ -3179,7 +3185,7 @@
}
}
}, ['First']], ' ']], currentPage === 1 ? '' : ['span', [['a', {
href: 'javascript: void(0);',
href: jsVoid,
$on: {
click: function click(e) {
e.preventDefault();
@ -3188,7 +3194,7 @@
}
}
}, ['Prev']], ' ']], currentPage === pages ? '' : ['span', [['a', {
href: 'javascript: void(0);',
href: jsVoid,
$on: {
click: function click(e) {
e.preventDefault();
@ -3197,7 +3203,7 @@
}
}
}, ['Next']], ' ']], currentPage === pages || pages <= 2 ? '' : ['span', [['a', {
href: 'javascript: void(0);',
href: jsVoid,
$on: {
click: function click(e) {
e.preventDefault();
@ -3207,7 +3213,7 @@
}
}, ['Last']], ' ']]]));
case 14:
case 13:
case "end":
return _context3.stop();
}

7557
dist/index-es.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7557
dist/index-umd.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -237,20 +237,38 @@
var colorDefs = [{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process: function process(bits) {
return [parseInt(bits[1], 10), parseInt(bits[2], 10), parseInt(bits[3], 10)];
process: function process(_) {
for (var _len = arguments.length, bits = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
bits[_key - 1] = arguments[_key];
}
return bits.map(function (b) {
return parseInt(b);
});
}
}, {
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process: function process(bits) {
return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16)];
process: function process(_) {
for (var _len2 = arguments.length, bits = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
bits[_key2 - 1] = arguments[_key2];
}
return bits.map(function (b) {
return parseInt(b, 16);
});
}
}, {
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process: function process(bits) {
return [parseInt(bits[1] + bits[1], 16), parseInt(bits[2] + bits[2], 16), parseInt(bits[3] + bits[3], 16)];
process: function process(_) {
for (var _len3 = arguments.length, bits = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
bits[_key3 - 1] = arguments[_key3];
}
return bits.map(function (b) {
return parseInt(b + b, 16);
});
}
}];
/**
@ -264,6 +282,8 @@
* @param {string} colorString
*/
function RGBColor(colorString) {
var _this = this;
_classCallCheck(this, RGBColor);
this.ok = false; // strip any leading #
@ -283,9 +303,9 @@
// search through the definitions to find a match
for (var i = 0; i < colorDefs.length; i++) {
var re = colorDefs[i].re;
var processor = colorDefs[i].process;
colorDefs.forEach(function (_ref) {
var re = _ref.re,
processor = _ref.process;
var bits = re.exec(colorString);
if (bits) {
@ -295,15 +315,14 @@
g = _processor2[1],
b = _processor2[2];
Object.assign(this, {
Object.assign(_this, {
r: r,
g: g,
b: b
});
this.ok = true;
_this.ok = true;
}
} // validate/cleanup values
}, this); // validate/cleanup values
this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r;
this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g;
@ -345,49 +364,36 @@
return '#' + r + g + b;
}
/**
* Offers a bulleted list of help.
* @returns {HTMLUListElement}
*/
}, {
key: "getHelpXML",
value: function getHelpXML() {
var examples = []; // add regexps
for (var i = 0; i < colorDefs.length; i++) {
var example = colorDefs[i].example;
for (var j = 0; j < example.length; j++) {
examples[examples.length] = example[j];
}
} // add type-in colors
examples.push.apply(examples, _toConsumableArray(Object.keys(simpleColors)));
var xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
for (var _i = 0; _i < examples.length; _i++) {
try {
var listItem = document.createElement('li');
var listColor = new RGBColor(examples[_i]);
var exampleDiv = document.createElement('div');
exampleDiv.style.cssText = "\nmargin: 3px;\nborder: 1px solid black;\nbackground: ".concat(listColor.toHex(), ";\ncolor: ").concat(listColor.toHex(), ";");
exampleDiv.append('test');
var listItemValue = " ".concat(examples[_i], " -> ").concat(listColor.toRGB(), " -> ").concat(listColor.toHex());
listItem.append(exampleDiv, listItemValue);
xml.append(listItem);
} catch (e) {}
}
return xml;
}
}]);
return RGBColor;
}();
RGBColor.getHelpXML = function () {
var examples = _toConsumableArray(colorDefs.flatMap(function (_ref2) {
var example = _ref2.example;
return example;
})).concat(_toConsumableArray(Object.keys(simpleColors)));
var xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
xml.append.apply(xml, _toConsumableArray(examples.map(function (example) {
try {
var listItem = document.createElement('li');
var listColor = new RGBColor(example);
var exampleDiv = document.createElement('div');
exampleDiv.style.cssText = "\nmargin: 3px;\nborder: 1px solid black;\nbackground: ".concat(listColor.toHex(), ";\ncolor: ").concat(listColor.toHex(), ";");
exampleDiv.append('test');
var listItemValue = " ".concat(example, " -> ").concat(listColor.toRGB(), " -> ").concat(listColor.toHex());
listItem.append(exampleDiv, listItemValue);
return listItem;
} catch (e) {
return '';
}
})));
return xml;
};
var jsPDFAPI = jsPDF.API;
var pdfSvgAttr = {
// allowed attributes. all others are removed from the preview.
@ -437,8 +443,9 @@
}
if (nums.length < 4) {
console.log('invalid points attribute:', node);
return;
console.log('invalid points attribute:', node); // eslint-disable-line no-console
return undefined;
}
var _nums = nums,
@ -491,7 +498,7 @@
}
if (attributeIsNotEmpty(node, 'stroke-width')) {
pdf.setLineWidth(k * parseInt(node.getAttribute('stroke-width'), 10));
pdf.setLineWidth(k * parseInt(node.getAttribute('stroke-width')));
}
var strokeColor = node.getAttribute('stroke');
@ -525,142 +532,150 @@
break;
case 'line':
pdf.line(k * parseInt(node.getAttribute('x1'), 10), k * parseInt(node.getAttribute('y1'), 10), k * parseInt(node.getAttribute('x2'), 10), k * parseInt(node.getAttribute('y2'), 10));
pdf.line(k * parseInt(node.getAttribute('x1')), k * parseInt(node.getAttribute('y1')), k * parseInt(node.getAttribute('x2')), k * parseInt(node.getAttribute('y2')));
removeAttributes(node, pdfSvgAttr.line);
break;
case 'rect':
pdf.rect(k * parseInt(node.getAttribute('x'), 10), k * parseInt(node.getAttribute('y'), 10), k * parseInt(node.getAttribute('width'), 10), k * parseInt(node.getAttribute('height'), 10), colorMode);
pdf.rect(k * parseInt(node.getAttribute('x')), k * parseInt(node.getAttribute('y')), k * parseInt(node.getAttribute('width')), k * parseInt(node.getAttribute('height')), colorMode);
removeAttributes(node, pdfSvgAttr.rect);
break;
case 'ellipse':
pdf.ellipse(k * parseInt(node.getAttribute('cx'), 10), k * parseInt(node.getAttribute('cy'), 10), k * parseInt(node.getAttribute('rx'), 10), k * parseInt(node.getAttribute('ry'), 10), colorMode);
pdf.ellipse(k * parseInt(node.getAttribute('cx')), k * parseInt(node.getAttribute('cy')), k * parseInt(node.getAttribute('rx')), k * parseInt(node.getAttribute('ry')), colorMode);
removeAttributes(node, pdfSvgAttr.ellipse);
break;
case 'circle':
pdf.circle(k * parseInt(node.getAttribute('cx'), 10), k * parseInt(node.getAttribute('cy'), 10), k * parseInt(node.getAttribute('r'), 10), colorMode);
pdf.circle(k * parseInt(node.getAttribute('cx')), k * parseInt(node.getAttribute('cy')), k * parseInt(node.getAttribute('r')), colorMode);
removeAttributes(node, pdfSvgAttr.circle);
break;
case 'polygon':
case 'polyline':
var linesOptions = getLinesOptionsOfPoly(node);
{
var linesOptions = getLinesOptionsOfPoly(node);
if (linesOptions) {
pdf.lines(linesOptions.lines, k * linesOptions.x, k * linesOptions.y, [k, k], colorMode, tag === 'polygon' // polygon is closed, polyline is not closed
);
if (linesOptions) {
pdf.lines(linesOptions.lines, k * linesOptions.x, k * linesOptions.y, [k, k], colorMode, tag === 'polygon' // polygon is closed, polyline is not closed
);
}
removeAttributes(node, pdfSvgAttr.polygon);
break; // TODO: path
}
removeAttributes(node, pdfSvgAttr.polygon);
break;
// TODO: path
case 'text':
if (node.hasAttribute('font-family')) {
switch ((node.getAttribute('font-family') || '').toLowerCase()) {
case 'serif':
pdf.setFont('times');
break;
{
if (node.hasAttribute('font-family')) {
switch ((node.getAttribute('font-family') || '').toLowerCase()) {
case 'serif':
pdf.setFont('times');
break;
case 'monospace':
pdf.setFont('courier');
break;
case 'monospace':
pdf.setFont('courier');
break;
default:
node.setAttribute('font-family', 'sans-serif');
pdf.setFont('helvetica');
default:
node.setAttribute('font-family', 'sans-serif');
pdf.setFont('helvetica');
}
}
}
if (hasFillColor) {
pdf.setTextColor(fillRGB.r, fillRGB.g, fillRGB.b);
}
var fontType = '';
if (node.hasAttribute('font-weight')) {
if (node.getAttribute('font-weight') === 'bold') {
fontType = 'bold';
} else {
node.removeAttribute('font-weight');
if (hasFillColor) {
pdf.setTextColor(fillRGB.r, fillRGB.g, fillRGB.b);
}
}
if (node.hasAttribute('font-style')) {
if (node.getAttribute('font-style') === 'italic') {
fontType += 'italic';
} else {
node.removeAttribute('font-style');
var fontType = '';
if (node.hasAttribute('font-weight')) {
if (node.getAttribute('font-weight') === 'bold') {
fontType = 'bold';
} else {
node.removeAttribute('font-weight');
}
}
}
pdf.setFontType(fontType);
var pdfFontSize = node.hasAttribute('font-size') ? parseInt(node.getAttribute('font-size'), 10) : 16;
if (node.hasAttribute('font-style')) {
if (node.getAttribute('font-style') === 'italic') {
fontType += 'italic';
} else {
node.removeAttribute('font-style');
}
}
var getWidth = function getWidth(node) {
var box;
pdf.setFontType(fontType);
var pdfFontSize = node.hasAttribute('font-size') ? parseInt(node.getAttribute('font-size')) : 16;
/**
*
* @param {Element} elem
* @returns {Float}
*/
try {
box = node.getBBox(); // Firefox on MacOS will raise error here
} catch (err) {
// copy and append to body so that getBBox is available
var nodeCopy = node.cloneNode(true);
var svg = node.ownerSVGElement.cloneNode(false);
svg.appendChild(nodeCopy);
document.body.appendChild(svg);
var getWidth = function getWidth(elem) {
var box;
try {
box = nodeCopy.getBBox();
box = elem.getBBox(); // Firefox on MacOS will raise error here
} catch (err) {
box = {
width: 0
};
// copy and append to body so that getBBox is available
var nodeCopy = elem.cloneNode(true);
var svg = elem.ownerSVGElement.cloneNode(false);
svg.appendChild(nodeCopy);
document.body.appendChild(svg);
try {
box = nodeCopy.getBBox();
} catch (error) {
box = {
width: 0
};
}
document.body.removeChild(svg);
}
document.body.removeChild(svg);
}
return box.width;
}; // FIXME: use more accurate positioning!!
return box.width;
}; // FIXME: use more accurate positioning!!
var x,
y,
xOffset = 0;
var x,
y,
xOffset = 0;
if (node.hasAttribute('text-anchor')) {
switch (node.getAttribute('text-anchor')) {
case 'end':
xOffset = getWidth(node);
break;
if (node.hasAttribute('text-anchor')) {
switch (node.getAttribute('text-anchor')) {
case 'end':
xOffset = getWidth(node);
break;
case 'middle':
xOffset = getWidth(node) / 2;
break;
case 'middle':
xOffset = getWidth(node) / 2;
break;
case 'start':
break;
case 'start':
break;
case 'default':
node.setAttribute('text-anchor', 'start');
break;
}
case 'default':
node.setAttribute('text-anchor', 'start');
break;
}
x = parseInt(node.getAttribute('x'), 10) - xOffset;
y = parseInt(node.getAttribute('y'), 10);
} // console.log('fontSize:', pdfFontSize, 'text:', node.textContent);
x = parseInt(node.getAttribute('x')) - xOffset;
y = parseInt(node.getAttribute('y'));
} // console.log('fontSize:', pdfFontSize, 'text:', node.textContent);
pdf.setFontSize(pdfFontSize).text(k * x, k * y, node.textContent);
removeAttributes(node, pdfSvgAttr.text);
break;
// TODO: image
pdf.setFontSize(pdfFontSize).text(k * x, k * y, node.textContent);
removeAttributes(node, pdfSvgAttr.text);
break; // TODO: image
}
default:
if (remove) {
console.log("can't translate to pdf:", node);
console.log("can't translate to pdf:", node); // eslint-disable-line no-console
node.remove();
}

View File

@ -209,7 +209,7 @@ var svgEditorLang_af = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ar = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_az = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_be = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_bg = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ca = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_cs = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_cy = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_da = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_de = (function () {
unsavedChanges: 'Es sind nicht-gespeicherte Änderungen vorhanden.',
enterNewLinkURL: 'Geben Sie die neue URL ein',
errorLoadingSVG: 'Fehler: Kann SVG-Daten nicht laden',
URLloadFail: 'Kann von dieser URL nicht laden',
URLLoadFail: 'Kann von dieser URL nicht laden',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_el = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_en = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_es = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_et = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_fa = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_fi = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: "Retrieving '%s' ...",
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_fr = (function () {
unsavedChanges: 'Il y a des changements non sauvegardés.',
enterNewLinkURL: "Entrez la nouvelle URL de l'hyperlien",
errorLoadingSVG: 'Erreur : Impossible de charger les données SVG',
URLloadFail: "Impossible de charger l'URL",
URLLoadFail: "Impossible de charger l'URL",
retrieving: 'Récupération de « %s »…',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_fy = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\'...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ga = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_gl = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_he = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_hi = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_hr = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_hu = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_hy = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_id = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_is = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_it = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ja = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ko = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_lt = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_lv = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_mk = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ms = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_mt = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_nl = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_no = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -210,7 +210,7 @@ var svgEditorLang_pl = (function () {
unsavedChanges: 'Wykryto niezapisane zmiany.',
enterNewLinkURL: 'Wpisz nowy adres URL hiperłącza',
errorLoadingSVG: 'Błąd: Nie można załadować danych SVG',
URLloadFail: 'Nie można załadować z adresu URL',
URLLoadFail: 'Nie można załadować z adresu URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -208,7 +208,7 @@ var svgEditorLang_pt_BR = (function () {
unsavedChanges: 'Existem alterações não salvas.',
enterNewLinkURL: 'Insira novo URL do hyperlink',
errorLoadingSVG: 'Erro: Impossível carregar dados SVG',
URLloadFail: 'Impossível carregar deste URL',
URLLoadFail: 'Impossível carregar deste URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_pt_PT = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -208,7 +208,7 @@ var svgEditorLang_ro = (function () {
unsavedChanges: 'Sunt schimbări nesalvate.',
enterNewLinkURL: 'IntroduAliniere în raport cu ...sceţi noul URL',
errorLoadingSVG: 'Eroare: Nu se pot încărca datele SVG',
URLloadFail: 'Nu se poate încărca de la URL',
URLLoadFail: 'Nu se poate încărca de la URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_ru = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_sk = (function () {
unsavedChanges: 'Sú tu neuložené zmeny.',
enterNewLinkURL: 'Zadajte nové URL odkazu (hyperlink)',
errorLoadingSVG: 'Chyba: Nedajú sa načítať SVG data',
URLloadFail: 'Nemožno čítať z URL',
URLLoadFail: 'Nemožno čítať z URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -208,7 +208,7 @@ var svgEditorLang_sl = (function () {
unsavedChanges: 'Obstajajo neshranjene spremembe.',
enterNewLinkURL: 'Vnesite novo URL povezavo',
errorLoadingSVG: 'Napaka: Ne morem naložiti SVG podatkov',
URLloadFail: 'Ne morem naložiti z URL',
URLLoadFail: 'Ne morem naložiti z URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_sq = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_sr = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_sv = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_sw = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_test = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_th = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_tl = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_tr = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_uk = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_vi = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_yi = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_zh_CN = (function () {
unsavedChanges: '存在未保存的修改.',
enterNewLinkURL: '输入新建链接的URL地址',
errorLoadingSVG: '错误: 无法加载SVG数据',
URLloadFail: '无法从URL中加载',
URLLoadFail: '无法从URL中加载',
retrieving: '检索 \'%s\'...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_zh_HK = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -209,7 +209,7 @@ var svgEditorLang_zh_TW = (function () {
unsavedChanges: 'There are unsaved changes.',
enterNewLinkURL: 'Enter the new hyperlink URL',
errorLoadingSVG: 'Error: Unable to load SVG data',
URLloadFail: 'Unable to load from URL',
URLLoadFail: 'Unable to load from URL',
retrieving: 'Retrieving \'%s\' ...',
popupWindowBlocked: 'Popup window may be blocked by browser',
exportNoBlur: 'Blurred elements will appear as un-blurred',

View File

@ -89,6 +89,11 @@
* including the latest spec changes which were implemented in Firefox 43 and
* Chrome 46.
*/
/* eslint-disable no-shadow, class-methods-use-this */
// Linting: We avoid `no-shadow` as ESLint thinks these are still available globals
// Linting: We avoid `class-methods-use-this` as this is a polyfill that must
// follow the conventions
(function () {
if (!('SVGPathSeg' in window)) {
// Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSeg
@ -1844,7 +1849,7 @@
return [];
}
var owningPathSegList = this;
var owningPathSegList = this; // eslint-disable-line consistent-this
var Builder =
/*#__PURE__*/
@ -2194,6 +2199,19 @@
return new SVGPathSegClosePath(owningPathSegList);
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
{
var points = {
x1: this._parseNumber(),
y1: this._parseNumber(),
x2: this._parseNumber(),
y2: this._parseNumber(),
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
}
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
{
var _points = {
x1: this._parseNumber(),
@ -2203,23 +2221,21 @@
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoCubicRel(owningPathSegList, _points.x, _points.y, _points.x1, _points.y1, _points.x2, _points.y2);
return new SVGPathSegCurvetoCubicAbs(owningPathSegList, _points.x, _points.y, _points.x1, _points.y1, _points.x2, _points.y2);
}
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
{
var _points2 = {
x1: this._parseNumber(),
y1: this._parseNumber(),
x2: this._parseNumber(),
y2: this._parseNumber(),
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoCubicAbs(owningPathSegList, _points2.x, _points2.y, _points2.x1, _points2.y1, _points2.x2, _points2.y2);
return new SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, _points2.x, _points2.y, _points2.x2, _points2.y2);
}
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
{
var _points3 = {
x2: this._parseNumber(),
@ -2227,21 +2243,21 @@
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, _points3.x, _points3.y, _points3.x2, _points3.y2);
}
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
{
var _points4 = {
x2: this._parseNumber(),
y2: this._parseNumber(),
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, _points4.x, _points4.y, _points4.x2, _points4.y2);
return new SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, _points3.x, _points3.y, _points3.x2, _points3.y2);
}
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
{
var _points4 = {
x1: this._parseNumber(),
y1: this._parseNumber(),
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoQuadraticRel(owningPathSegList, _points4.x, _points4.y, _points4.x1, _points4.y1);
}
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
{
var _points5 = {
x1: this._parseNumber(),
@ -2249,18 +2265,9 @@
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoQuadraticRel(owningPathSegList, _points5.x, _points5.y, _points5.x1, _points5.y1);
return new SVGPathSegCurvetoQuadraticAbs(owningPathSegList, _points5.x, _points5.y, _points5.x1, _points5.y1);
}
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
var points = {
x1: this._parseNumber(),
y1: this._parseNumber(),
x: this._parseNumber(),
y: this._parseNumber()
};
return new SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1);
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
return new SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber());
@ -2416,7 +2423,7 @@
var $ = jQuery;
var supportsSVG_ = function () {
return !!document.createElementNS && !!document.createElementNS(NS.SVG, 'svg').createSVGRect;
return Boolean(document.createElementNS && document.createElementNS(NS.SVG, 'svg').createSVGRect);
}();
/**
* @function module:browser.supportsSvg
@ -2431,7 +2438,7 @@
userAgent = _navigator.userAgent;
var svg = document.createElementNS(NS.SVG, 'svg'); // Note: Browser sniffing should only be used if no other detection method is possible
var isOpera_ = !!window.opera;
var isOpera_ = Boolean(window.opera);
var isWebkit_ = userAgent.includes('AppleWebKit');
var isGecko_ = userAgent.includes('Gecko/');
var isIE_ = userAgent.includes('MSIE');
@ -2440,11 +2447,11 @@
var isMac_ = userAgent.includes('Macintosh');
var supportsSelectors_ = function () {
return !!svg.querySelector;
return Boolean(svg.querySelector);
}();
var supportsXpath_ = function () {
return !!document.evaluate;
return Boolean(document.evaluate);
}(); // segList functions (for FF1.5 and 2.0)

View File

@ -81,7 +81,7 @@ module.exports = {
opts: {
recurse: true,
verbose: true,
// destination: 'docs/jsdoc',
destination: 'docs/jsdoc',
tutorials: 'docs/tutorials'
}
};

51
docs/versions/4.0.0.md Normal file
View File

@ -0,0 +1,51 @@
# Version 4.0.0
This version introduces a number of breaking changes, a number being
required to move to a more Promise-based API and one where problems are
detected early at run-time by throwing rather than logging.
Some API changes also involve switching to class methods over instance
methods, though these were private/internally used APIs.
Please see the CHANGES file (or the Git history or Github tracker) for
fixes and enhancements.
## Breaking changes
- The cookie to track storage preferences is now namespaced as
"svgeditstore" instead of just "store".
- Require `npx` (used with `babel-node`) to allow Node files for HTML
building and JSDoc type checking to be expressed as ESM.
### Breaking changes (public API)
#### Callback-to-Promise changes
- `loadSvgString` now returns a `Promise` rather than accepting a callback.
- Callbacks to `editor.ready` are treated as Promises, only resolving after
all resolve. May require no changes unless for timing.
- `editor.runCallbacks` now returns a `Promise` which resolves upon all
callbacks resolving.
- Removed `svgCanvas.rasterExport` fourth (callback) argument, collapsing
fifth (options) to fourth
- Removed `svgCanvas.exportPDF` third (callback) argument
- Removed `svgCanvas.embedImage` second (callback) argument
- Made `getHelpXML` a class instead of instance method of `RGBColor`.
#### Throwing bad arguments instead of mere logging
- `editor/contextmenu.js` `add` now throws instead
of giving a console error only upon detecting a bad menuitem or
preexisting context menu
- `addExtension` now throws upon a repeated attempt to add an
already-added extension
### Breaking changes (internal API)
- Refactor `dbox` (and
`alert`/`confirm`/`process`/`prompt`/`select`) to avoid a callback argument
in favor of returning a Promise
- `updateGripCursor` moved to be class method
of Selector rather than instance method
- `subpathIsClosed` moved to be class method
of `Path` rather than instance method

View File

@ -1,4 +1,4 @@
/* eslint-disable new-cap */
/* eslint-disable new-cap, class-methods-use-this */
// Todo: Compare with latest canvg (add any improvements of ours) and add full JSDocs (denoting links to standard APIs and which are custom): https://github.com/canvg/canvg
/**
* canvg.js - Javascript SVG parser and renderer on Canvas
@ -20,32 +20,11 @@ const isNullish = (val) => {
return val === null || val === undefined;
};
let canvasRGBA_ = canvasRGBA;
/**
* @callback module:canvg.StackBlurCanvasRGBA
* @param {string} id
* @param {Float} x
* @param {Float} y
* @param {Float} width
* @param {Float} height
* @param {Float} blurRadius
*/
/**
* @callback module:canvg.ForceRedraw
* @returns {boolean}
*/
/**
* @function module:canvg.setStackBlurCanvasRGBA
* @param {module:canvg.StackBlurCanvasRGBA} cb Will be passed the canvas ID, x, y, width, height, blurRadius
* @returns {undefined}
*/
export const setStackBlurCanvasRGBA = (cb) => {
canvasRGBA_ = cb;
};
/**
* @typedef {PlainObject} module:canvg.CanvgOptions
* @property {boolean} opts.ignoreMouse true => ignore mouse events
@ -175,12 +154,13 @@ function build (opts) {
};
// ajax
// Todo: Replace with `fetch` and polyfill
svg.ajax = function (url, asynch) {
const AJAX = window.XMLHttpRequest
? new XMLHttpRequest()
: new window.ActiveXObject('Microsoft.XMLHTTP');
if (asynch) {
return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => { // eslint-disable-line promise/avoid-new
const req = AJAX.open('GET', url, true);
req.addEventListener('load', () => {
resolve(AJAX.responseText);
@ -393,12 +373,12 @@ function build (opts) {
Parse (s) {
const f = {};
const d = svg.trim(svg.compressSpaces(s || '')).split(' ');
const ds = svg.trim(svg.compressSpaces(s || '')).split(' ');
const set = {
fontSize: false, fontStyle: false, fontWeight: false, fontVariant: false
};
let ff = '';
d.forEach((d) => {
ds.forEach((d) => {
if (!set.fontStyle && this.Styles.includes(d)) {
if (d !== 'inherit') {
f.fontStyle = d;
@ -419,8 +399,8 @@ function build (opts) {
f.fontSize = d.split('/')[0];
}
set.fontStyle = set.fontVariant = set.fontWeight = set.fontSize = true;
} else {
if (d !== 'inherit') { ff += d; }
} else if (d !== 'inherit') {
ff += d;
}
});
if (ff !== '') { f.fontFamily = ff; }
@ -431,7 +411,7 @@ function build (opts) {
// points and paths
svg.ToNumberArray = function (s) {
const a = svg.trim(svg.compressSpaces((s || '').replace(/,/g, ' '))).split(' ');
return a.map((a) => parseFloat(a));
return a.map((_a) => parseFloat(_a));
};
svg.Point = class {
constructor (x, y) {
@ -598,9 +578,9 @@ function build (opts) {
ctx.translate(-this.cx, -this.cy);
};
this.applyToPoint = function (p) {
const a = this.angle.toRadians();
const _a = this.angle.toRadians();
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
p.applyTransform([Math.cos(a), Math.sin(a), -Math.sin(a), Math.cos(a), 0, 0]);
p.applyTransform([Math.cos(_a), Math.sin(_a), -Math.sin(_a), Math.cos(_a), 0, 0]);
p.applyTransform([1, 0, 0, 1, -this.p.x || 0.0, -this.p.y || 0.0]);
};
}
@ -727,7 +707,8 @@ function build (opts) {
svg.Element.ElementBase = class {
constructor (node) {
this.captureTextNodes = arguments[1]; // Argument from inheriting class
// Argument from inheriting class
this.captureTextNodes = arguments[1]; // eslint-disable-line prefer-rest-params
this.attributes = {};
this.styles = {};
this.children = [];
@ -757,9 +738,9 @@ function build (opts) {
// add tag styles
let styles = svg.Styles[node.nodeName];
if (!isNullish(styles)) {
for (const name in styles) {
this.styles[name] = styles[name];
}
Object.entries(styles).forEach(([name, styleValue]) => {
this.styles[name] = styleValue;
});
}
// add class styles
@ -768,33 +749,33 @@ function build (opts) {
classes.forEach((clss) => {
styles = svg.Styles['.' + clss];
if (!isNullish(styles)) {
for (const name in styles) {
this.styles[name] = styles[name];
}
Object.entries(styles).forEach(([name, styleValue]) => {
this.styles[name] = styleValue;
});
}
styles = svg.Styles[node.nodeName + '.' + clss];
if (!isNullish(styles)) {
for (const name in styles) {
this.styles[name] = styles[name];
}
Object.entries(styles).forEach(([name, styleValue]) => {
this.styles[name] = styleValue;
});
}
});
}
// add id styles
if (this.attribute('id').hasValue()) {
const styles = svg.Styles['#' + this.attribute('id').value];
if (!isNullish(styles)) {
for (const name in styles) {
this.styles[name] = styles[name];
}
const _styles = svg.Styles['#' + this.attribute('id').value];
if (!isNullish(_styles)) {
Object.entries(_styles).forEach(([name, styleValue]) => {
this.styles[name] = styleValue;
});
}
}
// add inline styles
if (this.attribute('style').hasValue()) {
const styles = this.attribute('style').value.split(';');
styles.forEach((style) => {
const _styles = this.attribute('style').value.split(';');
_styles.forEach((style) => {
if (svg.trim(style) !== '') {
let {name, value} = style.split(':');
name = svg.trim(name);
@ -1232,9 +1213,9 @@ function build (opts) {
ctx.moveTo(x, y);
}
for (let i = 1; i < this.points.length; i++) {
const {x, y} = this.points[i];
bb.addPoint(x, y);
if (!isNullish(ctx)) ctx.lineTo(x, y);
const {x: _x, y: _y} = this.points[i];
bb.addPoint(_x, _y);
if (!isNullish(ctx)) ctx.lineTo(_x, _y);
}
return bb;
}
@ -1410,20 +1391,20 @@ function build (opts) {
pp.nextCommand();
switch (pp.command) {
case 'M':
case 'm':
case 'm': {
const p = pp.getAsCurrentPoint();
pp.addMarker(p);
bb.addPoint(p.x, p.y);
if (!isNullish(ctx)) ctx.moveTo(p.x, p.y);
pp.start = pp.current;
while (!pp.isCommandOrEnd()) {
const p = pp.getAsCurrentPoint();
pp.addMarker(p, pp.start);
bb.addPoint(p.x, p.y);
if (!isNullish(ctx)) ctx.lineTo(p.x, p.y);
const _p = pp.getAsCurrentPoint();
pp.addMarker(_p, pp.start);
bb.addPoint(_p.x, _p.y);
if (!isNullish(ctx)) ctx.lineTo(_p.x, _p.y);
}
break;
case 'L':
} case 'L':
case 'l':
while (!pp.isCommandOrEnd()) {
const c = pp.current;
@ -1570,14 +1551,14 @@ function build (opts) {
bb.addPoint(cp.x, cp.y); // TODO: this is too naive, make it better
if (!isNullish(ctx)) {
const r = rx > ry ? rx : ry;
const _r = rx > ry ? rx : ry;
const sx = rx > ry ? 1 : rx / ry;
const sy = rx > ry ? ry / rx : 1;
ctx.translate(centp.x, centp.y);
ctx.rotate(xAxisRotation);
ctx.scale(sx, sy);
ctx.arc(0, 0, r, a1, a1 + ad, 1 - sweepFlag);
ctx.arc(0, 0, _r, a1, a1 + ad, 1 - sweepFlag);
ctx.scale(1 / sx, 1 / sy);
ctx.rotate(-xAxisRotation);
ctx.translate(-centp.x, -centp.y);
@ -2115,8 +2096,8 @@ function build (opts) {
child.render(ctx);
for (let i = 0; i < child.children.length; i++) {
this.renderChild(ctx, child, i);
for (let j = 0; j < child.children.length; j++) {
this.renderChild(ctx, child, j);
}
}
};
@ -2309,9 +2290,12 @@ function build (opts) {
};
this.img.src = href;
} else {
svg.ajax(href, true).then((img) => {
svg.ajax(href, true).then((img) => { // eslint-disable-line promise/prefer-await-to-then, promise/always-return
this.img = img;
this.loaded = true;
}).catch((err) => { // eslint-disable-line promise/prefer-await-to-callbacks
this.erred = true;
console.error('Ajax error for canvg', err); // eslint-disable-line no-console
});
}
}
@ -2448,6 +2432,7 @@ function build (opts) {
getBoundingBox () {
const {_el: element} = this;
if (!isNullish(element)) return element.getBoundingBox();
return undefined;
}
renderChildren (ctx) {
@ -2605,10 +2590,29 @@ function build (opts) {
}
};
/**
* @param {Uint8ClampedArray} img
* @param {Integer} x
* @param {Integer} y
* @param {Float} width
* @param {Float} height
* @param {Integer} rgba
* @returns {undefined}
*/
function imGet (img, x, y, width, height, rgba) {
return img[y * width * 4 + x * 4 + rgba];
}
/**
* @param {Uint8ClampedArray} img
* @param {Integer} x
* @param {Integer} y
* @param {Float} width
* @param {Float} height
* @param {Integer} rgba
* @param {Float} val
* @returns {undefined}
*/
function imSet (img, x, y, width, height, rgba, val) {
img[y * width * 4 + x * 4 + rgba] = val;
}
@ -2619,7 +2623,7 @@ function build (opts) {
let matrix = svg.ToNumberArray(this.attribute('values').value);
switch (this.attribute('type').valueOrDefault('matrix')) { // https://www.w3.org/TR/SVG/filters.html#feColorMatrixElement
case 'saturate':
case 'saturate': {
const s = matrix[0];
matrix = [
0.213 + 0.787 * s, 0.715 - 0.715 * s, 0.072 - 0.072 * s, 0, 0,
@ -2629,7 +2633,7 @@ function build (opts) {
0, 0, 0, 0, 1
];
break;
case 'hueRotate':
} case 'hueRotate': {
const a = matrix[0] * Math.PI / 180.0;
const c = function (m1, m2, m3) {
return m1 + Math.cos(a) * m2 + Math.sin(a) * m3;
@ -2642,7 +2646,7 @@ function build (opts) {
0, 0, 0, 0, 1
];
break;
case 'luminanceToAlpha':
} case 'luminanceToAlpha':
matrix = [
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
@ -2663,16 +2667,16 @@ function build (opts) {
const {_m: m} = this;
// assuming x==0 && y==0 for now
const srcData = ctx.getImageData(0, 0, width, height);
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const r = imGet(srcData.data, x, y, width, height, 0);
const g = imGet(srcData.data, x, y, width, height, 1);
const b = imGet(srcData.data, x, y, width, height, 2);
const a = imGet(srcData.data, x, y, width, height, 3);
imSet(srcData.data, x, y, width, height, 0, m(0, r) + m(1, g) + m(2, b) + m(3, a) + m(4, 1));
imSet(srcData.data, x, y, width, height, 1, m(5, r) + m(6, g) + m(7, b) + m(8, a) + m(9, 1));
imSet(srcData.data, x, y, width, height, 2, m(10, r) + m(11, g) + m(12, b) + m(13, a) + m(14, 1));
imSet(srcData.data, x, y, width, height, 3, m(15, r) + m(16, g) + m(17, b) + m(18, a) + m(19, 1));
for (let _y = 0; _y < height; _y++) {
for (let _x = 0; _x < width; _x++) {
const r = imGet(srcData.data, _x, _y, width, height, 0);
const g = imGet(srcData.data, _x, _y, width, height, 1);
const b = imGet(srcData.data, _x, _y, width, height, 2);
const a = imGet(srcData.data, _x, _y, width, height, 3);
imSet(srcData.data, _x, _y, width, height, 0, m(0, r) + m(1, g) + m(2, b) + m(3, a) + m(4, 1));
imSet(srcData.data, _x, _y, width, height, 1, m(5, r) + m(6, g) + m(7, b) + m(8, a) + m(9, 1));
imSet(srcData.data, _x, _y, width, height, 2, m(10, r) + m(11, g) + m(12, b) + m(13, a) + m(14, 1));
imSet(srcData.data, _x, _y, width, height, 3, m(15, r) + m(16, g) + m(17, b) + m(18, a) + m(19, 1));
}
}
ctx.clearRect(0, 0, width, height);
@ -2689,17 +2693,12 @@ function build (opts) {
}
apply (ctx, x, y, width, height) {
if (typeof canvasRGBA_ !== 'function') {
svg.log('ERROR: The function `setStackBlurCanvasRGBA` must be present for blur to work');
return;
}
// Todo: This might not be a problem anymore with out `instanceof` fix
// StackBlur requires canvas be on document
ctx.canvas.id = svg.UniqueId();
ctx.canvas.style.display = 'none';
document.body.append(ctx.canvas);
canvasRGBA_(ctx.canvas, x, y, width, height, this.blurRadius);
canvasRGBA(ctx.canvas, x, y, width, height, this.blurRadius);
ctx.canvas.remove();
}
};
@ -2773,14 +2772,14 @@ function build (opts) {
ctx.canvas.onclick = function (e) {
const args = !isNullish(e)
? [e.clientX, e.clientY]
: [event.clientX, event.clientY];
: [event.clientX, event.clientY]; // eslint-disable-line no-restricted-globals
const {x, y} = mapXY(new svg.Point(...args));
svg.Mouse.onclick(x, y);
};
ctx.canvas.onmousemove = function (e) {
const args = !isNullish(e)
? [e.clientX, e.clientY]
: [event.clientX, event.clientY];
: [event.clientX, event.clientY]; // eslint-disable-line no-restricted-globals
const {x, y} = mapXY(new svg.Point(...args));
svg.Mouse.onmousemove(x, y);
};
@ -2878,13 +2877,14 @@ function build (opts) {
// need update from mouse events?
if (svg.opts.ignoreMouse !== true) {
needUpdate = needUpdate | svg.Mouse.hasEvents();
needUpdate = needUpdate || svg.Mouse.hasEvents();
}
// need update from animations?
if (svg.opts.ignoreAnimation !== true) {
svg.Animations.forEach((animation) => {
needUpdate = needUpdate | animation.update(1000 / svg.FRAMERATE);
const needAnimationUpdate = animation.update(1000 / svg.FRAMERATE);
needUpdate = needUpdate || needAnimationUpdate;
});
}
@ -2901,7 +2901,8 @@ function build (opts) {
svg.Mouse.runEvents(); // run and clear our events
}
}, 1000 / svg.FRAMERATE);
return new Promise((resolve, reject) => {
// Todo: Replace with an image loading Promise utility?
return new Promise((resolve, reject) => { // eslint-disable-line promise/avoid-new
if (svg.ImagesLoaded()) {
waitingForImages = false;
draw(resolve);

View File

@ -156,34 +156,22 @@ const colorDefs = [
{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process (bits) {
return [
parseInt(bits[1]),
parseInt(bits[2]),
parseInt(bits[3])
];
process (_, ...bits) {
return bits.map((b) => parseInt(b));
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process (bits) {
return [
parseInt(bits[1], 16),
parseInt(bits[2], 16),
parseInt(bits[3], 16)
];
process (_, ...bits) {
return bits.map((b) => parseInt(b, 16));
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process (bits) {
return [
parseInt(bits[1] + bits[1], 16),
parseInt(bits[2] + bits[2], 16),
parseInt(bits[3] + bits[3], 16)
];
process (_, ...bits) {
return bits.map((b) => parseInt(b + b, 16));
}
}
];
@ -214,16 +202,15 @@ export default class RGBColor {
// end of simple type-in colors
// search through the definitions to find a match
for (let i = 0; i < colorDefs.length; i++) {
const {re} = colorDefs[i];
const processor = colorDefs[i].process;
colorDefs.forEach(({re, process: processor}) => {
const bits = re.exec(colorString);
if (bits) {
const [r, g, b] = processor(bits);
Object.assign(this, {r, g, b});
this.ok = true;
}
}
}, this);
// validate/cleanup values
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
@ -251,41 +238,42 @@ export default class RGBColor {
if (b.length === 1) { b = '0' + b; }
return '#' + r + g + b;
}
}
/**
* Offers a bulleted list of help.
* @returns {HTMLUListElement}
*/
getHelpXML () {
const examples = [];
/**
* Offers a bulleted list of help.
* @returns {HTMLUListElement}
*/
RGBColor.getHelpXML = function () {
const examples = [
// add regexps
for (let i = 0; i < colorDefs.length; i++) {
const {example} = colorDefs[i];
for (let j = 0; j < example.length; j++) {
examples[examples.length] = example[j];
}
}
...colorDefs.flatMap(({example}) => {
return example;
}),
// add type-in colors
examples.push(...Object.keys(simpleColors));
...Object.keys(simpleColors)
];
const xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
for (let i = 0; i < examples.length; i++) {
try {
const listItem = document.createElement('li');
const listColor = new RGBColor(examples[i]);
const exampleDiv = document.createElement('div');
exampleDiv.style.cssText = `
const xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
xml.append(...examples.map((example) => {
try {
const listItem = document.createElement('li');
const listColor = new RGBColor(example);
const exampleDiv = document.createElement('div');
exampleDiv.style.cssText = `
margin: 3px;
border: 1px solid black;
background: ${listColor.toHex()};
color: ${listColor.toHex()};`;
exampleDiv.append('test');
const listItemValue = ` ${examples[i]} -> ${listColor.toRGB()} -> ${listColor.toHex()}`;
listItem.append(exampleDiv, listItemValue);
xml.append(listItem);
} catch (e) {}
exampleDiv.append('test');
const listItemValue = ` ${example} -> ${listColor.toRGB()} -> ${listColor.toHex()}`;
listItem.append(exampleDiv, listItemValue);
return listItem;
} catch (e) {
return '';
}
return xml;
}
}
}));
return xml;
};

Some files were not shown because too many files have changed in this diff Show More