Merge pull request #426 from SVG-Edit/refactor-folders
Refactor folders
@@ -5,30 +5,32 @@ coverage
|
|||||||
instrumented
|
instrumented
|
||||||
dist
|
dist
|
||||||
docs/jsdoc
|
docs/jsdoc
|
||||||
|
archive
|
||||||
|
|
||||||
svgedit-config-es.js
|
src/svgedit-config-es.js
|
||||||
svgedit-config-iife.js
|
src/svgedit-config-iife.js
|
||||||
svgedit-custom.css
|
svgedit-custom.css
|
||||||
editor/xdomain-svgedit-config-iife.js
|
src/xdomain-svgedit-config-iife.js
|
||||||
|
|
||||||
# Vendor/minified files
|
# Vendor/minified files
|
||||||
editor/jquery.min.js
|
src/editor/jquery.min.js
|
||||||
editor/jquery-ui
|
src/editor/jquery-ui
|
||||||
|
|
||||||
# Previously minified though exporting
|
# Previously minified though exporting
|
||||||
editor/js-hotkeys
|
src/editor/js-hotkeys
|
||||||
|
|
||||||
editor/jspdf/jspdf.min.js
|
src/editor/jspdf/jspdf.min.js
|
||||||
editor/jspdf/underscore-min.js
|
src/editor/jspdf/underscore-min.js
|
||||||
|
|
||||||
editor/extensions/mathjax
|
src/editor/extensions/mathjax
|
||||||
|
|
||||||
# Todo: We should at least check `compat/compat` in our other files, however
|
# Todo: We should at least check `compat/compat` in our other files, however
|
||||||
editor/external/*
|
## Two "external" items are modified locally, so we undo their ignoring
|
||||||
!editor/external/dom-polyfill
|
src/external/*
|
||||||
editor/external/dom-polyfill/*
|
!src/external/dom-polyfill
|
||||||
!editor/external/dom-polyfill/dom-polyfill.js
|
src/external/dom-polyfill/*
|
||||||
!editor/external/dynamic-import-polyfill
|
!src/external/dom-polyfill/dom-polyfill.js
|
||||||
|
!src/external/dynamic-import-polyfill
|
||||||
|
|
||||||
mochawesome-report
|
mochawesome-report
|
||||||
releases
|
releases
|
||||||
|
|||||||
357
.eslintrc.js
@@ -3,49 +3,149 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['ash-nazg/sauron-node'],
|
extends: ['ash-nazg/sauron-node'],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
sourceType: 'module'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true
|
browser: true,
|
||||||
|
es6: true
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
polyfills: [
|
polyfills: [
|
||||||
],
|
// These are the primary polyfills needed by regular users if
|
||||||
jsdoc: {
|
// not present, e.g., with core-js-bundle; also those under
|
||||||
additionalTagNames: {
|
// extensions
|
||||||
// In case we need to extend
|
// 'Array.isArray',
|
||||||
customTags: []
|
// 'Blob',
|
||||||
},
|
// 'console',
|
||||||
augmentsExtendsReplacesDocs: true
|
// 'CustomEvent',
|
||||||
// Todo: Figure out why this is not working and why seem to have to
|
// 'document.body',
|
||||||
// disable for all Markdown:
|
// 'document.createElementNS',
|
||||||
/*
|
// 'document.evaluate',
|
||||||
baseConfig: {
|
// 'document.head',
|
||||||
rules: {
|
// 'document.importNode',
|
||||||
'no-multi-spaces': 'off'
|
// 'document.querySelector',
|
||||||
|
// 'document.querySelectorAll',
|
||||||
|
// 'DOMParser',
|
||||||
|
// 'Error',
|
||||||
|
'fetch',
|
||||||
|
// 'FileReader',
|
||||||
|
// 'JSON',
|
||||||
|
// 'KeyboardEvent',
|
||||||
|
// 'location.href',
|
||||||
|
// 'location.origin',
|
||||||
|
// 'MouseEvent',
|
||||||
|
// 'MutationObserver',
|
||||||
|
// 'navigator',
|
||||||
|
// 'Number.isNaN',
|
||||||
|
// 'Number.parseFloat',
|
||||||
|
// 'Number.parseInt',
|
||||||
|
// 'Object.assign',
|
||||||
|
// 'Object.defineProperty',
|
||||||
|
// 'Object.defineProperties',
|
||||||
|
// 'Object.entries',
|
||||||
|
// 'Object.getOwnPropertyDescriptor',
|
||||||
|
// 'Object.keys',
|
||||||
|
// 'Object.values',
|
||||||
|
'Promise',
|
||||||
|
'Promise.all',
|
||||||
|
// 'Set',
|
||||||
|
'Uint8Array',
|
||||||
|
'URL'
|
||||||
|
// 'URL.createObjectURL',
|
||||||
|
// 'XMLSerializer',
|
||||||
|
// 'XMLHttpRequest',
|
||||||
|
// 'window.getComputedStyle',
|
||||||
|
// 'window.parent',
|
||||||
|
// 'window.scrollX',
|
||||||
|
// 'window.scrollY'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// check-examples is not picking up eslint config properly in some
|
||||||
|
// environments; see also discussion above
|
||||||
|
// `mocha-cleanup/no-assertions-outside-it`
|
||||||
|
'jsdoc/check-examples': ['warn', {
|
||||||
|
rejectExampleCodeRegex: '^`'
|
||||||
|
}],
|
||||||
|
|
||||||
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453
|
||||||
|
'unicorn/regex-shorthand': 0,
|
||||||
|
// The Babel transform seems to have a problem converting these
|
||||||
|
'prefer-named-capture-group': 'off',
|
||||||
|
'jsdoc/require-file-overview': ['error', {
|
||||||
|
tags: {
|
||||||
|
file: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
|
},
|
||||||
|
license: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
|
},
|
||||||
|
copyright: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
|
},
|
||||||
|
author: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
|
},
|
||||||
|
exports: {
|
||||||
|
initialCommentsOnly: true,
|
||||||
|
preventDuplicates: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
}],
|
||||||
}
|
// Warning or Off for now but should be reviewed
|
||||||
|
// Override these rules which are difficult for us
|
||||||
|
// to apply at this time
|
||||||
|
'unicorn/prefer-string-slice': 'off',
|
||||||
|
'default-case': 'off',
|
||||||
|
'require-unicode-regexp': 'off',
|
||||||
|
'max-len':
|
||||||
|
[
|
||||||
|
'warn',
|
||||||
|
{ignoreComments: true, code: 130}
|
||||||
|
], // 130 is too much but too many occurences
|
||||||
|
'unicorn/prefer-query-selector': 'off',
|
||||||
|
'unicorn/no-fn-reference-in-iterator': 'off',
|
||||||
|
'unicorn/prefer-node-append': 'off',
|
||||||
|
'unicorn/no-zero-fractions': 'off',
|
||||||
|
'unicorn/prefer-number-properties': 'off',
|
||||||
|
'eslint-comments/require-description': 'off',
|
||||||
|
'compat/compat': 'error',
|
||||||
|
'consistent-this': 'off',
|
||||||
|
'import/no-anonymous-default-export': 'off',
|
||||||
|
'node/no-unsupported-features/node-builtins': 'warn',
|
||||||
|
'prefer-exponentiation-operator': 'warn'
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
// Locales have no need for importing outside of SVG-Edit
|
// Locales have no need for importing outside of SVG-Edit
|
||||||
|
// and translations may need a longer line length
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
'editor/locale/lang.*.js', 'editor/extensions/ext-locale/**',
|
'src/editor/locale/lang.*.js', 'src/editor/extensions/ext-locale/**',
|
||||||
'docs/tutorials/ExtensionDocs.md'
|
'docs/tutorials/ExtensionDocs.md'
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'import/no-anonymous-default-export': ['off']
|
'import/no-anonymous-default-export': 'off',
|
||||||
|
'max-len': 'off'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// These browser files don't do importing or requiring
|
// These browser files don't do importing or requiring
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
'editor/svgpathseg.js', 'editor/touch.js', 'editor/typedefs.js',
|
'src/editor/svgpathseg.js',
|
||||||
'editor/redirect-on-no-module-support.js',
|
'src/editor/touch.js',
|
||||||
'editor/extensions/imagelib/index.js',
|
'src/editor/typedefs.js',
|
||||||
'editor/external/dom-polyfill/dom-polyfill.js',
|
'src/editor/redirect-on-no-module-support.js',
|
||||||
|
'src/editor/extensions/imagelib/index.js',
|
||||||
|
'src/external/dom-polyfill/dom-polyfill.js',
|
||||||
'screencasts/svgopen2010/script.js'
|
'screencasts/svgopen2010/script.js'
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
@@ -97,7 +197,6 @@ module.exports = {
|
|||||||
// Used in examples of assert-close.js plugin
|
// Used in examples of assert-close.js plugin
|
||||||
'mocha-cleanup/no-assertions-outside-it': 'off',
|
'mocha-cleanup/no-assertions-outside-it': 'off',
|
||||||
'eslint-comments/no-unused-disable': 'warn',
|
'eslint-comments/no-unused-disable': 'warn',
|
||||||
|
|
||||||
'eol-last': ['off'],
|
'eol-last': ['off'],
|
||||||
'no-console': ['off'],
|
'no-console': ['off'],
|
||||||
'no-undef': ['off'],
|
'no-undef': ['off'],
|
||||||
@@ -116,118 +215,6 @@ module.exports = {
|
|||||||
indent: 'off'
|
indent: 'off'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Dis-apply Node rules mistakenly giving errors with browser files,
|
|
||||||
// and treating Node global `root` as being present for shadowing
|
|
||||||
{
|
|
||||||
files: ['editor/**'],
|
|
||||||
globals: {
|
|
||||||
root: 'off'
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
polyfills: [
|
|
||||||
// These are the primary polyfills needed by regular users if
|
|
||||||
// not present, e.g., with core-js-bundle; also those under
|
|
||||||
// extensions
|
|
||||||
'Array.isArray',
|
|
||||||
'Blob',
|
|
||||||
'console',
|
|
||||||
'CustomEvent',
|
|
||||||
'document.body',
|
|
||||||
'document.createElementNS',
|
|
||||||
'document.evaluate',
|
|
||||||
'document.head',
|
|
||||||
'document.importNode',
|
|
||||||
'document.querySelector',
|
|
||||||
'document.querySelectorAll',
|
|
||||||
'DOMParser',
|
|
||||||
'Error',
|
|
||||||
'FileReader',
|
|
||||||
'JSON',
|
|
||||||
'KeyboardEvent',
|
|
||||||
'location.href',
|
|
||||||
'location.origin',
|
|
||||||
'MouseEvent',
|
|
||||||
'MutationObserver',
|
|
||||||
'navigator',
|
|
||||||
'Number.isNaN',
|
|
||||||
'Number.parseFloat',
|
|
||||||
'Number.parseInt',
|
|
||||||
'Object.assign',
|
|
||||||
'Object.defineProperty',
|
|
||||||
'Object.defineProperties',
|
|
||||||
'Object.entries',
|
|
||||||
'Object.getOwnPropertyDescriptor',
|
|
||||||
'Object.keys',
|
|
||||||
'Object.values',
|
|
||||||
'Promise',
|
|
||||||
'Promise.all',
|
|
||||||
'Set',
|
|
||||||
'Uint8Array',
|
|
||||||
'URL',
|
|
||||||
'URL.createObjectURL',
|
|
||||||
'XMLSerializer',
|
|
||||||
'XMLHttpRequest',
|
|
||||||
'window.getComputedStyle',
|
|
||||||
'window.parent',
|
|
||||||
'window.scrollX',
|
|
||||||
'window.scrollY'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// Should probably add this rule to ash-nazg as facilitates tree-shaking
|
|
||||||
'import/no-namespace': ['error'],
|
|
||||||
|
|
||||||
'node/no-unsupported-features/node-builtins': '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/**'],
|
|
||||||
settings: {
|
|
||||||
polyfills: [
|
|
||||||
'console',
|
|
||||||
'fetch',
|
|
||||||
'location.origin',
|
|
||||||
'Number.isNaN',
|
|
||||||
'Number.parseFloat',
|
|
||||||
'Number.parseInt',
|
|
||||||
'window.postMessage'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'consistent-this': ['error', 'svgEditor'],
|
|
||||||
'import/no-anonymous-default-export': ['off']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Node files
|
|
||||||
files: [
|
|
||||||
'docs/jsdoc-config.js',
|
|
||||||
'build/build-html.js',
|
|
||||||
'rollup.config.js', 'rollup-config.config.js'
|
|
||||||
],
|
|
||||||
env: {
|
|
||||||
node: true
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
polyfills: [
|
|
||||||
'console',
|
|
||||||
'Promise.resolve'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
require: true
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// We can't put Rollup in npmignore or user can't get access,
|
|
||||||
// and we have too many modules to add to `peerDependencies`
|
|
||||||
// so this rule can know them to be available, so we instead
|
|
||||||
// disable
|
|
||||||
'node/no-unpublished-import': 'off'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// As consumed by jsdoc, cannot be expressed as ESM
|
// As consumed by jsdoc, cannot be expressed as ESM
|
||||||
files: ['docs/jsdoc-config.js'],
|
files: ['docs/jsdoc-config.js'],
|
||||||
@@ -242,18 +229,6 @@ module.exports = {
|
|||||||
strict: 'off'
|
strict: 'off'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// Should probably have as external, but should still check
|
|
||||||
files: ['canvg/rgbcolor.js'],
|
|
||||||
settings: {
|
|
||||||
polyfills: [
|
|
||||||
'Number.isNaN',
|
|
||||||
'Number.parseInt',
|
|
||||||
'Object.assign',
|
|
||||||
'Object.keys'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
files: ['cypress/plugins/index.js'],
|
files: ['cypress/plugins/index.js'],
|
||||||
extends: [
|
extends: [
|
||||||
@@ -294,7 +269,7 @@ module.exports = {
|
|||||||
// instrument separately from nyc mocha
|
// instrument separately from nyc mocha
|
||||||
'import/no-unresolved': ['error', {ignore: ['/instrumented/']}],
|
'import/no-unresolved': ['error', {ignore: ['/instrumented/']}],
|
||||||
'node/no-missing-import': 'off',
|
'node/no-missing-import': 'off',
|
||||||
|
'jsdoc/check-examples': 'off',
|
||||||
'chai-expect-keywords/no-unsupported-keywords': [
|
'chai-expect-keywords/no-unsupported-keywords': [
|
||||||
'error', {
|
'error', {
|
||||||
allowChaiDOM: true
|
allowChaiDOM: true
|
||||||
@@ -334,63 +309,33 @@ module.exports = {
|
|||||||
'no-console': 0,
|
'no-console': 0,
|
||||||
'import/unambiguous': 0
|
'import/unambiguous': 0
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
],
|
{
|
||||||
rules: {
|
// Node files
|
||||||
// check-examples is not picking up eslint config properly in some
|
files: [
|
||||||
// environments; see also discussion above
|
'docs/jsdoc-config.js',
|
||||||
// `mocha-cleanup/no-assertions-outside-it`
|
'build/build-html.js',
|
||||||
'jsdoc/check-examples': ['warn', {
|
'rollup.config.js', 'rollup-config.config.js'
|
||||||
rejectExampleCodeRegex: '^`'
|
],
|
||||||
}],
|
env: {
|
||||||
|
node: true
|
||||||
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453
|
},
|
||||||
'unicorn/regex-shorthand': 0,
|
settings: {
|
||||||
// The Babel transform seems to have a problem converting these
|
polyfills: [
|
||||||
'prefer-named-capture-group': 'off',
|
'console',
|
||||||
// Override these `ash-nazg/sauron` rules which are difficult for us
|
'Promise.resolve'
|
||||||
// to apply at this time
|
]
|
||||||
'unicorn/prefer-string-slice': 'off',
|
},
|
||||||
'default-case': 'off',
|
globals: {
|
||||||
'require-unicode-regexp': 'off',
|
require: true
|
||||||
'max-len': 'off', /* , {
|
},
|
||||||
ignoreUrls: true,
|
rules: {
|
||||||
ignoreRegExpLiterals: true
|
// We can't put Rollup in npmignore or user can't get access,
|
||||||
} */
|
// and we have too many modules to add to `peerDependencies`
|
||||||
'unicorn/prefer-query-selector': 'off',
|
// so this rule can know them to be available, so we instead
|
||||||
'unicorn/prefer-node-append': 'off',
|
// disable
|
||||||
'unicorn/no-zero-fractions': 'off',
|
'node/no-unpublished-import': 'off'
|
||||||
'unicorn/prefer-number-properties': 'off',
|
|
||||||
'jsdoc/require-file-overview': ['error', {
|
|
||||||
tags: {
|
|
||||||
file: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
},
|
|
||||||
license: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
},
|
|
||||||
copyright: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
},
|
|
||||||
author: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
},
|
|
||||||
exports: {
|
|
||||||
initialCommentsOnly: true,
|
|
||||||
preventDuplicates: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}],
|
}
|
||||||
|
]
|
||||||
// Disable for now
|
|
||||||
'eslint-comments/require-description': 0
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
- Refactoring: Move `build-html` to `build` directory
|
- Refactoring: Move `build-html` to `build` directory
|
||||||
- Refactoring: Add favicon no-op to suppress favicon 404s until
|
- Refactoring: Add favicon no-op to suppress favicon 404s until
|
||||||
loaded dynamically (might make configurable in future)
|
loaded dynamically (might make configurable in future)
|
||||||
|
- Refactoring: create a src folder and subfolders for svgcanvas, editor, common and externals.
|
||||||
- Linting (ESLint): Simplify regexes
|
- Linting (ESLint): Simplify regexes
|
||||||
- Linting (ESLint): Replace `innerHTML` with `textContent` from old demo
|
- Linting (ESLint): Replace `innerHTML` with `textContent` from old demo
|
||||||
- Linting (ESLint): Update as per latest ash-nazg
|
- Linting (ESLint): Update as per latest ash-nazg
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 44.92%</text><text class="high" x="5" y="14">Statements 44.92%</text><text class="shadow" x="125.5" y="15">Branches 33.59%</text><text class="high" x="125" y="14">Branches 33.59%</text><text class="shadow" x="234.5" y="15">Lines 46.07%</text><text class="high" x="234" y="14">Lines 46.07%</text><text class="shadow" x="321.5" y="15">Functions 51.19%</text><text class="high" x="321" y="14">Functions 51.19%</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="green" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 45.57%</text><text class="high" x="5" y="14">Statements 45.57%</text><text class="shadow" x="125.5" y="15">Branches 34.06%</text><text class="high" x="125" y="14">Branches 34.06%</text><text class="shadow" x="234.5" y="15">Lines 46.73%</text><text class="high" x="234" y="14">Lines 46.73%</text><text class="shadow" x="321.5" y="15">Functions 51.69%</text><text class="high" x="321" y="14">Functions 51.69%</text></g></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">130/131</text><text class="high" x="46" y="14">130/131</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#4c1" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">132/132</text><text class="high" x="46" y="14">132/132</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 823 B After Width: | Height: | Size: 820 B |
@@ -3,8 +3,8 @@ import fs from 'promise-fs';
|
|||||||
|
|
||||||
const filesAndReplacements = [
|
const filesAndReplacements = [
|
||||||
{
|
{
|
||||||
input: 'editor/svg-editor-es.html',
|
input: 'src/editor/svg-editor-es.html',
|
||||||
output: 'editor/xdomain-svg-editor-es.html',
|
output: 'src/editor/xdomain-svg-editor-es.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<script type="module" src="../svgedit-config-es.js"></script>',
|
'<script type="module" src="../svgedit-config-es.js"></script>',
|
||||||
@@ -13,8 +13,8 @@ const filesAndReplacements = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'editor/xdomain-svg-editor-es.html',
|
input: 'src/editor/xdomain-svg-editor-es.html',
|
||||||
output: 'editor/xdomain-svg-editor.html',
|
output: 'src/editor/xdomain-svg-editor.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<!DOCTYPE html>',
|
'<!DOCTYPE html>',
|
||||||
@@ -23,15 +23,15 @@ const filesAndReplacements = [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
||||||
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
|
'<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="xdomain-svgedit-config-es.js"></script>',
|
'<script type="module" src="xdomain-svgedit-config-es.js"></script>',
|
||||||
'<script defer="defer" src="xdomain-svgedit-config-iife.js"></script>'
|
'<script defer="defer" src="xdomain-svgedit-config-iife.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
'<script src="../external/dom-polyfill/dom-polyfill.js"></script>',
|
||||||
'<script src="../dist/dom-polyfill.js"></script>'
|
'<script src="../../dist/dom-polyfill.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
||||||
@@ -41,8 +41,8 @@ const filesAndReplacements = [
|
|||||||
},
|
},
|
||||||
// Now that file has copied, we can replace the DOCTYPE in xdomain
|
// Now that file has copied, we can replace the DOCTYPE in xdomain
|
||||||
{
|
{
|
||||||
input: 'editor/xdomain-svg-editor-es.html',
|
input: 'src/editor/xdomain-svg-editor-es.html',
|
||||||
output: 'editor/xdomain-svg-editor-es.html',
|
output: 'src/editor/xdomain-svg-editor-es.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<!DOCTYPE html>',
|
'<!DOCTYPE html>',
|
||||||
@@ -52,8 +52,8 @@ const filesAndReplacements = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'editor/svg-editor-es.html',
|
input: 'src/editor/svg-editor-es.html',
|
||||||
output: 'editor/svg-editor.html',
|
output: 'src/editor/svg-editor.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<!DOCTYPE html>',
|
'<!DOCTYPE html>',
|
||||||
@@ -62,15 +62,15 @@ const filesAndReplacements = [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
||||||
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
|
'<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="../svgedit-config-es.js"></script>',
|
'<script type="module" src="../svgedit-config-es.js"></script>',
|
||||||
'<script defer="defer" src="../svgedit-config-iife.js"></script>'
|
'<script defer="defer" src="../svgedit-config-iife.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
|
'<script src="../external/dom-polyfill/dom-polyfill.js"></script>',
|
||||||
'<script src="../dist/dom-polyfill.js"></script>'
|
'<script src="../../dist/dom-polyfill.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
||||||
@@ -79,8 +79,8 @@ const filesAndReplacements = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'editor/extensions/imagelib/openclipart-es.html',
|
input: 'src/editor/extensions/imagelib/openclipart-es.html',
|
||||||
output: 'editor/extensions/imagelib/openclipart.html',
|
output: 'src/editor/extensions/imagelib/openclipart.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<!DOCTYPE html>',
|
'<!DOCTYPE html>',
|
||||||
@@ -89,11 +89,11 @@ const filesAndReplacements = [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script src="../../external/dom-polyfill/dom-polyfill.js"></script>',
|
'<script src="../../external/dom-polyfill/dom-polyfill.js"></script>',
|
||||||
'<script src="../../../dist/dom-polyfill.js"></script>'
|
'<script src="../../../../dist/dom-polyfill.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="openclipart.js"></script>',
|
'<script type="module" src="openclipart.js"></script>',
|
||||||
'<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>'
|
'<script defer="defer" src="../../../../dist/extensions/imagelib/openclipart.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
||||||
@@ -102,8 +102,8 @@ const filesAndReplacements = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'editor/extensions/imagelib/index-es.html',
|
input: 'src/editor/extensions/imagelib/index-es.html',
|
||||||
output: 'editor/extensions/imagelib/index.html',
|
output: 'src/editor/extensions/imagelib/index.html',
|
||||||
replacements: [
|
replacements: [
|
||||||
[
|
[
|
||||||
'<!DOCTYPE html>',
|
'<!DOCTYPE html>',
|
||||||
@@ -112,7 +112,7 @@ const filesAndReplacements = [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script type="module" src="index.js"></script>',
|
'<script type="module" src="index.js"></script>',
|
||||||
'<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>'
|
'<script defer="defer" src="../../../../dist/extensions/imagelib/index.js"></script>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"baseUrl": "http://localhost:8000",
|
"baseUrl": "http://localhost:8000",
|
||||||
"reporter": "cypress-multi-reporters",
|
"reporter": "cypress-multi-reporters",
|
||||||
|
"video": false,
|
||||||
"reporterOptions": {
|
"reporterOptions": {
|
||||||
"configFile": "mocha-multi-reporters.json"
|
"configFile": "mocha-multi-reporters.json"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
describe('UI - Accessibility', function () {
|
describe('UI - Accessibility', function () {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.visit('/instrumented/svg-editor-es.html');
|
cy.visit('/instrumented/editor/svg-editor-es.html');
|
||||||
cy.injectAxe();
|
cy.injectAxe();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -25,6 +25,16 @@ describe('UI - Accessibility', function () {
|
|||||||
locale: Object
|
locale: Object
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
cy.checkA11y();
|
cy.checkA11y(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'label-title-only': {enabled: false},
|
||||||
|
'page-has-heading-one': {enabled: false},
|
||||||
|
region: {enabled: false},
|
||||||
|
'scrollable-region-focusable': {enabled: false}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
import * as contextmenu from '../../../instrumented/contextmenu.js';
|
import * as contextmenu from '../../../instrumented/editor/contextmenu.js';
|
||||||
|
|
||||||
describe('contextmenu', function () {
|
describe('contextmenu', function () {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as coords from '../../../instrumented/coords.js';
|
import * as coords from '../../../instrumented/svgcanvas/coords.js';
|
||||||
|
|
||||||
describe('coords', function () {
|
describe('coords', function () {
|
||||||
let elemId = 1;
|
let elemId = 1;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as draw from '../../../instrumented/draw.js';
|
import * as draw from '../../../instrumented/svgcanvas/draw.js';
|
||||||
import * as units from '../../../instrumented/units.js';
|
import * as units from '../../../instrumented/common/units.js';
|
||||||
|
|
||||||
describe('draw.Drawing', function () {
|
describe('draw.Drawing', function () {
|
||||||
const addOwnSpies = (obj) => {
|
const addOwnSpies = (obj) => {
|
||||||
@@ -20,6 +20,7 @@ describe('draw.Drawing', function () {
|
|||||||
const PATH_ATTR = {
|
const PATH_ATTR = {
|
||||||
// clone will convert relative to absolute, so the test for equality fails.
|
// clone will convert relative to absolute, so the test for equality fails.
|
||||||
// d: 'm7.38867,57.38867c0,-27.62431 22.37569,-50 50,-50c27.62431,0 50,22.37569 50,50c0,27.62431 -22.37569,50 -50,50c-27.62431,0 -50,-22.37569 -50,-50z',
|
// d: 'm7.38867,57.38867c0,-27.62431 22.37569,-50 50,-50c27.62431,0 50,22.37569 50,50c0,27.62431 -22.37569,50 -50,50c-27.62431,0 -50,-22.37569 -50,-50z',
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
d: 'M7.389,57.389C7.389,29.764 29.764,7.389 57.389,7.389C85.013,7.389 107.389,29.764 107.389,57.389C107.389,85.013 85.013,107.389 57.389,107.389C29.764,107.389 7.389,85.013 7.389,57.389z',
|
d: 'M7.389,57.389C7.389,29.764 29.764,7.389 57.389,7.389C85.013,7.389 107.389,29.764 107.389,57.389C107.389,85.013 85.013,107.389 57.389,107.389C29.764,107.389 7.389,85.013 7.389,57.389z',
|
||||||
transform: 'rotate(45 57.388671875000036,57.388671874999986) ',
|
transform: 'rotate(45 57.388671875000036,57.388671874999986) ',
|
||||||
'stroke-width': '5',
|
'stroke-width': '5',
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as hstory from '../../../instrumented/history.js';
|
import * as hstory from '../../../instrumented/svgcanvas/history.js';
|
||||||
|
|
||||||
describe('history', function () {
|
describe('history', function () {
|
||||||
// TODO(codedread): Write tests for handling history events.
|
// TODO(codedread): Write tests for handling history events.
|
||||||
@@ -20,11 +20,17 @@ describe('history', function () {
|
|||||||
// const svg = document.createElementNS(NS.SVG, 'svg');
|
// const svg = document.createElementNS(NS.SVG, 'svg');
|
||||||
let undoMgr = null;
|
let undoMgr = null;
|
||||||
|
|
||||||
class MockCommand {
|
class MockCommand extends hstory.Command {
|
||||||
constructor (optText) { this.text_ = optText; }
|
constructor (optText) {
|
||||||
apply () { /* */ } // eslint-disable-line class-methods-use-this
|
super();
|
||||||
unapply () { /* */ } // eslint-disable-line class-methods-use-this
|
this.text = optText;
|
||||||
getText () { return this.text_; }
|
}
|
||||||
|
apply (handler) {
|
||||||
|
super.apply(handler, () => { /* */ });
|
||||||
|
}
|
||||||
|
unapply (handler) {
|
||||||
|
super.unapply(handler, () => { /* */ });
|
||||||
|
}
|
||||||
elements () { return []; } // eslint-disable-line class-methods-use-this
|
elements () { return []; } // eslint-disable-line class-methods-use-this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,17 +488,17 @@ describe('history', function () {
|
|||||||
|
|
||||||
it('Test BatchCommand', function () {
|
it('Test BatchCommand', function () {
|
||||||
let concatResult = '';
|
let concatResult = '';
|
||||||
MockCommand.prototype.apply = function () { concatResult += this.text_; };
|
MockCommand.prototype.apply = function (handler) { concatResult += this.text; };
|
||||||
|
|
||||||
const batch = new hstory.BatchCommand();
|
const batch = new hstory.BatchCommand();
|
||||||
assert.ok(batch.unapply);
|
assert.ok(batch.unapply);
|
||||||
assert.ok(batch.apply);
|
assert.ok(batch.apply);
|
||||||
assert.ok(batch.addSubCommand);
|
assert.ok(batch.addSubCommand);
|
||||||
assert.ok(batch.isEmpty);
|
assert.ok(batch.isEmpty);
|
||||||
assert.equal(typeof batch.unapply, typeof function () { /* */ });
|
assert.equal(typeof batch.unapply, 'function');
|
||||||
assert.equal(typeof batch.apply, typeof function () { /* */ });
|
assert.equal(typeof batch.apply, 'function');
|
||||||
assert.equal(typeof batch.addSubCommand, typeof function () { /* */ });
|
assert.equal(typeof batch.addSubCommand, 'function');
|
||||||
assert.equal(typeof batch.isEmpty, typeof function () { /* */ });
|
assert.equal(typeof batch.isEmpty, 'function');
|
||||||
|
|
||||||
assert.ok(batch.isEmpty());
|
assert.ok(batch.isEmpty());
|
||||||
|
|
||||||
@@ -506,8 +512,9 @@ describe('history', function () {
|
|||||||
assert.equal(concatResult, 'abc');
|
assert.equal(concatResult, 'abc');
|
||||||
|
|
||||||
MockCommand.prototype.apply = function () { /* */ };
|
MockCommand.prototype.apply = function () { /* */ };
|
||||||
MockCommand.prototype.unapply = function () { concatResult += this.text_; };
|
MockCommand.prototype.unapply = function () { concatResult += this.text; };
|
||||||
concatResult = '';
|
concatResult = '';
|
||||||
|
assert.ok(!concatResult);
|
||||||
batch.unapply();
|
batch.unapply();
|
||||||
assert.equal(concatResult, 'cba');
|
assert.equal(concatResult, 'cba');
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as math from '../../../instrumented/math.js';
|
import * as math from '../../../instrumented/common/math.js';
|
||||||
|
|
||||||
describe('math', function () {
|
describe('math', function () {
|
||||||
const svg = document.createElementNS(NS.SVG, 'svg');
|
const svg = document.createElementNS(NS.SVG, 'svg');
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* globals SVGPathSeg */
|
/* globals SVGPathSeg */
|
||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import '../../../instrumented/svgpathseg.js';
|
import '../../../instrumented/common/svgpathseg.js';
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as pathModule from '../../../instrumented/path.js';
|
import * as pathModule from '../../../instrumented/svgcanvas/path.js';
|
||||||
import {init as unitsInit} from '../../../instrumented/units.js';
|
import {init as unitsInit} from '../../../instrumented/common/units.js';
|
||||||
|
|
||||||
describe('path', function () {
|
describe('path', function () {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as coords from '../../../instrumented/coords.js';
|
import * as coords from '../../../instrumented/svgcanvas/coords.js';
|
||||||
import * as recalculate from '../../../instrumented/recalculate.js';
|
import * as recalculate from '../../../instrumented/svgcanvas/recalculate.js';
|
||||||
|
|
||||||
describe('recalculate', function () {
|
describe('recalculate', function () {
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as sanitize from '../../../instrumented/sanitize.js';
|
import * as sanitize from '../../../instrumented/svgcanvas/sanitize.js';
|
||||||
|
|
||||||
describe('sanitize', function () {
|
describe('sanitize', function () {
|
||||||
const svg = document.createElementNS(NS.SVG, 'svg');
|
const svg = document.createElementNS(NS.SVG, 'svg');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import * as select from '../../../instrumented/select.js';
|
import * as select from '../../../instrumented/svgcanvas/select.js';
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
|
|
||||||
describe('select', function () {
|
describe('select', function () {
|
||||||
const sandbox = document.createElement('div');
|
const sandbox = document.createElement('div');
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
|
||||||
import {disableSupportsNativeTransformLists} from '../../../instrumented/browser.js';
|
import {disableSupportsNativeTransformLists} from '../../../instrumented/common/browser.js';
|
||||||
|
|
||||||
import almostEqualsPlugin from '../../support/assert-almostEquals.js';
|
import almostEqualsPlugin from '../../support/assert-almostEquals.js';
|
||||||
import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js';
|
import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js';
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
/* eslint-disable max-len */
|
||||||
import '../../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
import '../../../instrumented/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js';
|
||||||
|
|
||||||
import '../../../instrumented/svgpathseg.js';
|
import '../../../instrumented/common/svgpathseg.js';
|
||||||
import SvgCanvas from '../../../instrumented/svgcanvas.js';
|
import SvgCanvas from '../../../instrumented/svgcanvas/svgcanvas.js';
|
||||||
|
|
||||||
describe('Basic Module', function () {
|
describe('Basic Module', function () {
|
||||||
// helper functions
|
// helper functions
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import * as units from '../../../instrumented/units.js';
|
import * as units from '../../../instrumented/common/units.js';
|
||||||
|
|
||||||
describe('units', function () {
|
describe('units', function () {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
/* eslint-disable max-len */
|
||||||
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import '../../../instrumented/svgpathseg.js';
|
import '../../../instrumented/common/svgpathseg.js';
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
|
||||||
import * as math from '../../../instrumented/math.js';
|
import * as math from '../../../instrumented/common/math.js';
|
||||||
import * as path from '../../../instrumented/path.js';
|
import * as path from '../../../instrumented/svgcanvas/path.js';
|
||||||
import setAssertionMethods from '../../support/assert-close.js';
|
import setAssertionMethods from '../../support/assert-close.js';
|
||||||
|
|
||||||
chai.use(setAssertionMethods);
|
chai.use(setAssertionMethods);
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
/* eslint-disable max-len */
|
||||||
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import '../../../instrumented/svgpathseg.js';
|
import '../../../instrumented/common/svgpathseg.js';
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
|
||||||
import * as math from '../../../instrumented/math.js';
|
import * as math from '../../../instrumented/common/math.js';
|
||||||
|
|
||||||
describe('utilities performance', function () {
|
describe('utilities performance', function () {
|
||||||
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;
|
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import '../../../instrumented/jquery.min.js';
|
/* eslint-disable max-len */
|
||||||
|
import '../../../instrumented/editor/jquery.min.js';
|
||||||
|
|
||||||
import * as browser from '../../../instrumented/browser.js';
|
import * as browser from '../../../instrumented/common/browser.js';
|
||||||
import * as utilities from '../../../instrumented/utilities.js';
|
import * as utilities from '../../../instrumented/common/utilities.js';
|
||||||
import {NS} from '../../../instrumented/namespaces.js';
|
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||||
|
|
||||||
describe('utilities', function () {
|
describe('utilities', function () {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import codeCoverageTask from '@cypress/code-coverage/task.js';
|
import codeCoverageTask from '@cypress/code-coverage/task.js';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-anonymous-default-export
|
|
||||||
export default (on, config) => {
|
export default (on, config) => {
|
||||||
// `on` is used to hook into various events Cypress emits
|
// `on` is used to hook into various events Cypress emits
|
||||||
// `config` is the resolved Cypress config
|
// `config` is the resolved Cypress config
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable jsdoc/check-examples */
|
/* eslint-disable max-len */
|
||||||
import assertionWrapper from './assertion-wrapper.js';
|
import assertionWrapper from './assertion-wrapper.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
/* globals require */
|
|
||||||
/* eslint-disable import/no-commonjs */
|
|
||||||
|
|
||||||
const copyfiles = require('copyfiles');
|
|
||||||
const pkg = require('../../package.json');
|
|
||||||
|
|
||||||
copyfiles([
|
|
||||||
...pkg.nyc.exclude,
|
|
||||||
'instrumented'
|
|
||||||
], {
|
|
||||||
up: 1
|
|
||||||
}, () => {
|
|
||||||
console.log('Done');
|
|
||||||
});
|
|
||||||
@@ -4,7 +4,7 @@ export const approveStorage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const visitAndApproveStorage = () => {
|
export const visitAndApproveStorage = () => {
|
||||||
cy.visit('/instrumented/svg-editor-es.html');
|
cy.visit('/instrumented/editor/svg-editor-es.html');
|
||||||
approveStorage();
|
approveStorage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Minimal demo of SvgCanvas</title>
|
<title>Minimal demo of SvgCanvas</title>
|
||||||
<script src="../editor/jquery.min.js"></script>
|
<script src="../src/editor/jquery.min.js"></script>
|
||||||
<script src="../editor/jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
|
<script src="../src/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
|
||||||
<style> #svgroot { overflow: hidden; } </style>
|
<style> #svgroot { overflow: hidden; } </style>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../editor/images/logo.png" />
|
<link rel="shortcut icon" type="image/x-icon" href="../src/editor/images/logo.png" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
/* globals canvas */
|
/* globals canvas */
|
||||||
import SvgCanvas from '../editor/svgcanvas.js';
|
import SvgCanvas from '../src/svgcanvas/svgcanvas.js';
|
||||||
|
|
||||||
const container = document.querySelector('#editorContainer');
|
const container = document.querySelector('#editorContainer');
|
||||||
const {width, height} = {width: 500, height: 300};
|
const {width, height} = {width: 500, height: 300};
|
||||||
|
|||||||
39
dist/canvg.js
vendored
@@ -1799,10 +1799,21 @@ var canvg = (function (exports) {
|
|||||||
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
||||||
} else {
|
} else {
|
||||||
// align
|
// align
|
||||||
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
||||||
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width - desiredWidth, 0);
|
}
|
||||||
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height - desiredHeight);
|
|
||||||
|
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
|
ctx.translate(width - desiredWidth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height - desiredHeight);
|
||||||
|
}
|
||||||
} // scale
|
} // scale
|
||||||
|
|
||||||
|
|
||||||
@@ -3022,7 +3033,11 @@ var canvg = (function (exports) {
|
|||||||
tempSvg.render(ctx);
|
tempSvg.render(ctx);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
||||||
if (this.attribute('orient').valueOrDefault('auto') === 'auto') ctx.rotate(-angle);
|
|
||||||
|
if (this.attribute('orient').valueOrDefault('auto') === 'auto') {
|
||||||
|
ctx.rotate(-angle);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.translate(-point.x, -point.y);
|
ctx.translate(-point.x, -point.y);
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
@@ -4156,7 +4171,8 @@ var canvg = (function (exports) {
|
|||||||
var tempSvg = element;
|
var tempSvg = element;
|
||||||
|
|
||||||
if (element.type === 'symbol') {
|
if (element.type === 'symbol') {
|
||||||
// render me using a temporary svg element in symbol cases (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
// render me using a temporary svg element in symbol cases
|
||||||
|
// (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
||||||
tempSvg = new svg.Element.svg();
|
tempSvg = new svg.Element.svg();
|
||||||
tempSvg.type = 'svg';
|
tempSvg.type = 'svg';
|
||||||
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
||||||
@@ -4167,8 +4183,13 @@ var canvg = (function (exports) {
|
|||||||
|
|
||||||
if (tempSvg.type === 'svg') {
|
if (tempSvg.type === 'svg') {
|
||||||
// if symbol or svg, inherit width/height from me
|
// if symbol or svg, inherit width/height from me
|
||||||
if (this.attribute('width').hasValue()) tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
if (this.attribute('width').hasValue()) {
|
||||||
if (this.attribute('height').hasValue()) tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.attribute('height').hasValue()) {
|
||||||
|
tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldParent = tempSvg.parent;
|
var oldParent = tempSvg.parent;
|
||||||
@@ -4783,9 +4804,9 @@ var canvg = (function (exports) {
|
|||||||
svg.Mouse.runEvents(); // run and clear our events
|
svg.Mouse.runEvents(); // run and clear our events
|
||||||
}
|
}
|
||||||
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
||||||
|
// eslint-disable-next-line promise/avoid-new
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
// eslint-disable-line promise/avoid-new
|
|
||||||
if (svg.ImagesLoaded()) {
|
if (svg.ImagesLoaded()) {
|
||||||
waitingForImages = false;
|
waitingForImages = false;
|
||||||
draw(resolve);
|
draw(resolve);
|
||||||
|
|||||||
4
dist/dom-polyfill.js
vendored
@@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
var node = document.createDocumentFragment();
|
var node = document.createDocumentFragment();
|
||||||
nodes.forEach(function (n) {
|
nodes.forEach(function (n) {
|
||||||
|
// // eslint-disable-next-line unicorn/prefer-node-append
|
||||||
node.appendChild(n);
|
node.appendChild(n);
|
||||||
});
|
});
|
||||||
return node;
|
return node;
|
||||||
@@ -82,7 +83,8 @@
|
|||||||
nodes[_key2] = arguments[_key2];
|
nodes[_key2] = arguments[_key2];
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes = convertNodesIntoANode(nodes);
|
nodes = convertNodesIntoANode(nodes); // // eslint-disable-next-line unicorn/prefer-node-append
|
||||||
|
|
||||||
this.appendChild(nodes);
|
this.appendChild(nodes);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
5
dist/extensions/ext-arrows.js
vendored
@@ -82,7 +82,7 @@ var svgEditorExtension_arrows = (function () {
|
|||||||
|
|
||||||
if (attrs.fill === color && attrs.d === curD) {
|
if (attrs.fill === color && attrs.d === curD) {
|
||||||
// Found another marker with this color and this path
|
// Found another marker with this color and this path
|
||||||
newMarker = this; // eslint-disable-line consistent-this
|
newMarker = this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,8 +98,7 @@ var svgEditorExtension_arrows = (function () {
|
|||||||
|
|
||||||
var remove = true;
|
var remove = true;
|
||||||
$(S.svgcontent).find('line, polyline, path, polygon').each(function () {
|
$(S.svgcontent).find('line, polyline, path, polygon').each(function () {
|
||||||
var element = this; // eslint-disable-line consistent-this
|
var element = this;
|
||||||
|
|
||||||
$.each(mtypes, function (j, mtype) {
|
$.each(mtypes, function (j, mtype) {
|
||||||
if ($(element).attr('marker-' + mtype) === 'url(#' + marker.id + ')') {
|
if ($(element).attr('marker-' + mtype) === 'url(#' + marker.id + ')') {
|
||||||
remove = false;
|
remove = false;
|
||||||
|
|||||||
2430
dist/extensions/ext-closepath.js
vendored
2
dist/extensions/ext-connector.js
vendored
@@ -37,8 +37,6 @@ var svgEditorExtension_connector = (function () {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable unicorn/no-fn-reference-in-iterator */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file ext-connector.js
|
* @file ext-connector.js
|
||||||
*
|
*
|
||||||
|
|||||||
4
dist/extensions/ext-mathjax.js
vendored
@@ -207,7 +207,7 @@ var svgEditorExtension_mathjax = (function () {
|
|||||||
mathjax: {
|
mathjax: {
|
||||||
embed_svg: 'Save as mathematics',
|
embed_svg: 'Save as mathematics',
|
||||||
embed_mathml: 'Save as figure',
|
embed_mathml: 'Save as figure',
|
||||||
svg_save_warning: 'The math will be transformed into a figure is manipulatable like everything else. You will not be able to manipulate the TeX-code anymore. ',
|
svg_save_warning: 'The math will be transformed into a figure is ' + 'manipulatable like everything else. You will not be able to ' + 'manipulate the TeX-code anymore.',
|
||||||
mathml_save_warning: 'Advised. The math will be saved as a figure.',
|
mathml_save_warning: 'Advised. The math will be saved as a figure.',
|
||||||
title: 'Mathematics code editor'
|
title: 'Mathematics code editor'
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ var svgEditorExtension_mathjax = (function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<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.
|
$('<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.
|
||||||
|
|
||||||
$('#mathjax_container').draggable({
|
$('#mathjax_container').draggable({
|
||||||
cancel: 'button,fieldset',
|
cancel: 'button,fieldset',
|
||||||
|
|||||||
2
dist/extensions/ext-overview_window.js
vendored
@@ -28,7 +28,7 @@ var svgEditorExtension_overview_window = (function () {
|
|||||||
} // Define and insert the base html element.
|
} // Define and insert the base html element.
|
||||||
|
|
||||||
|
|
||||||
var propsWindowHtml = '<div id="overview_window_content_pane" style="width:100%; word-wrap:break-word; display:inline-block; margin-top:20px;">' + '<div id="overview_window_content" style="position:relative; left:12px; top:0px;">' + '<div style="background-color:#A0A0A0; display:inline-block; overflow:visible;">' + '<svg id="overviewMiniView" width="150" height="100" x="0" y="0" viewBox="0 0 4800 3600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' + '<use x="0" y="0" xlink:href="#svgroot"> </use>' + '</svg>' + '<div id="overview_window_view_box" style="min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);">' + '</div>' + '</div>' + '</div>' + '</div>';
|
var propsWindowHtml = '<div id="overview_window_content_pane" style="width:100%; ' + 'word-wrap:break-word; display:inline-block; margin-top:20px;">' + '<div id="overview_window_content" style="position:relative; ' + 'left:12px; top:0px;">' + '<div style="background-color:#A0A0A0; display:inline-block; ' + 'overflow:visible;">' + '<svg id="overviewMiniView" width="150" height="100" x="0" ' + 'y="0" viewBox="0 0 4800 3600" ' + 'xmlns="http://www.w3.org/2000/svg" ' + 'xmlns:xlink="http://www.w3.org/1999/xlink">' + '<use x="0" y="0" xlink:href="#svgroot"> </use>' + '</svg>' + '<div id="overview_window_view_box" style="min-width:50px; ' + 'min-height:50px; position:absolute; top:30px; left:30px; ' + 'z-index:5; background-color:rgba(255,0,102,0.3);">' + '</div>' + '</div>' + '</div>' + '</div>';
|
||||||
$('#sidepanels').append(propsWindowHtml); // Define dynamic animation of the view box.
|
$('#sidepanels').append(propsWindowHtml); // Define dynamic animation of the view box.
|
||||||
|
|
||||||
var updateViewBox = function updateViewBox() {
|
var updateViewBox = function updateViewBox() {
|
||||||
|
|||||||
39
dist/extensions/ext-server_moinsave.js
vendored
@@ -1799,10 +1799,21 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||||||
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
||||||
} else {
|
} else {
|
||||||
// align
|
// align
|
||||||
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
||||||
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width - desiredWidth, 0);
|
}
|
||||||
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height - desiredHeight);
|
|
||||||
|
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
|
ctx.translate(width - desiredWidth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height - desiredHeight);
|
||||||
|
}
|
||||||
} // scale
|
} // scale
|
||||||
|
|
||||||
|
|
||||||
@@ -3022,7 +3033,11 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||||||
tempSvg.render(ctx);
|
tempSvg.render(ctx);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
||||||
if (this.attribute('orient').valueOrDefault('auto') === 'auto') ctx.rotate(-angle);
|
|
||||||
|
if (this.attribute('orient').valueOrDefault('auto') === 'auto') {
|
||||||
|
ctx.rotate(-angle);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.translate(-point.x, -point.y);
|
ctx.translate(-point.x, -point.y);
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
@@ -4156,7 +4171,8 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||||||
var tempSvg = element;
|
var tempSvg = element;
|
||||||
|
|
||||||
if (element.type === 'symbol') {
|
if (element.type === 'symbol') {
|
||||||
// render me using a temporary svg element in symbol cases (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
// render me using a temporary svg element in symbol cases
|
||||||
|
// (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
||||||
tempSvg = new svg.Element.svg();
|
tempSvg = new svg.Element.svg();
|
||||||
tempSvg.type = 'svg';
|
tempSvg.type = 'svg';
|
||||||
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
||||||
@@ -4167,8 +4183,13 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||||||
|
|
||||||
if (tempSvg.type === 'svg') {
|
if (tempSvg.type === 'svg') {
|
||||||
// if symbol or svg, inherit width/height from me
|
// if symbol or svg, inherit width/height from me
|
||||||
if (this.attribute('width').hasValue()) tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
if (this.attribute('width').hasValue()) {
|
||||||
if (this.attribute('height').hasValue()) tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.attribute('height').hasValue()) {
|
||||||
|
tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldParent = tempSvg.parent;
|
var oldParent = tempSvg.parent;
|
||||||
@@ -4783,9 +4804,9 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||||||
svg.Mouse.runEvents(); // run and clear our events
|
svg.Mouse.runEvents(); // run and clear our events
|
||||||
}
|
}
|
||||||
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
||||||
|
// eslint-disable-next-line promise/avoid-new
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
// eslint-disable-line promise/avoid-new
|
|
||||||
if (svg.ImagesLoaded()) {
|
if (svg.ImagesLoaded()) {
|
||||||
waitingForImages = false;
|
waitingForImages = false;
|
||||||
draw(resolve);
|
draw(resolve);
|
||||||
|
|||||||
39
dist/extensions/ext-server_opensave.js
vendored
@@ -1799,10 +1799,21 @@ var svgEditorExtension_server_opensave = (function () {
|
|||||||
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
||||||
} else {
|
} else {
|
||||||
// align
|
// align
|
||||||
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
if (align.startsWith('xMid') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
||||||
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) ctx.translate(width - desiredWidth, 0);
|
}
|
||||||
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) ctx.translate(0, height - desiredHeight);
|
|
||||||
|
if (align.endsWith('YMid') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.startsWith('xMax') && (meetOrSlice === 'meet' && scaleMin === scaleY || meetOrSlice === 'slice' && scaleMax === scaleY)) {
|
||||||
|
ctx.translate(width - desiredWidth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (align.endsWith('YMax') && (meetOrSlice === 'meet' && scaleMin === scaleX || meetOrSlice === 'slice' && scaleMax === scaleX)) {
|
||||||
|
ctx.translate(0, height - desiredHeight);
|
||||||
|
}
|
||||||
} // scale
|
} // scale
|
||||||
|
|
||||||
|
|
||||||
@@ -3022,7 +3033,11 @@ var svgEditorExtension_server_opensave = (function () {
|
|||||||
tempSvg.render(ctx);
|
tempSvg.render(ctx);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') === 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
|
||||||
if (this.attribute('orient').valueOrDefault('auto') === 'auto') ctx.rotate(-angle);
|
|
||||||
|
if (this.attribute('orient').valueOrDefault('auto') === 'auto') {
|
||||||
|
ctx.rotate(-angle);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.translate(-point.x, -point.y);
|
ctx.translate(-point.x, -point.y);
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
@@ -4156,7 +4171,8 @@ var svgEditorExtension_server_opensave = (function () {
|
|||||||
var tempSvg = element;
|
var tempSvg = element;
|
||||||
|
|
||||||
if (element.type === 'symbol') {
|
if (element.type === 'symbol') {
|
||||||
// render me using a temporary svg element in symbol cases (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
// render me using a temporary svg element in symbol cases
|
||||||
|
// (https://www.w3.org/TR/SVG/struct.html#UseElement)
|
||||||
tempSvg = new svg.Element.svg();
|
tempSvg = new svg.Element.svg();
|
||||||
tempSvg.type = 'svg';
|
tempSvg.type = 'svg';
|
||||||
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
tempSvg.attributes.viewBox = new svg.Property('viewBox', element.attribute('viewBox').value);
|
||||||
@@ -4167,8 +4183,13 @@ var svgEditorExtension_server_opensave = (function () {
|
|||||||
|
|
||||||
if (tempSvg.type === 'svg') {
|
if (tempSvg.type === 'svg') {
|
||||||
// if symbol or svg, inherit width/height from me
|
// if symbol or svg, inherit width/height from me
|
||||||
if (this.attribute('width').hasValue()) tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
if (this.attribute('width').hasValue()) {
|
||||||
if (this.attribute('height').hasValue()) tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
tempSvg.attributes.width = new svg.Property('width', this.attribute('width').value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.attribute('height').hasValue()) {
|
||||||
|
tempSvg.attributes.height = new svg.Property('height', this.attribute('height').value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldParent = tempSvg.parent;
|
var oldParent = tempSvg.parent;
|
||||||
@@ -4783,9 +4804,9 @@ var svgEditorExtension_server_opensave = (function () {
|
|||||||
svg.Mouse.runEvents(); // run and clear our events
|
svg.Mouse.runEvents(); // run and clear our events
|
||||||
}
|
}
|
||||||
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
}, 1000 / svg.FRAMERATE); // Todo: Replace with an image loading Promise utility?
|
||||||
|
// eslint-disable-next-line promise/avoid-new
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
// eslint-disable-line promise/avoid-new
|
|
||||||
if (svg.ImagesLoaded()) {
|
if (svg.ImagesLoaded()) {
|
||||||
waitingForImages = false;
|
waitingForImages = false;
|
||||||
draw(resolve);
|
draw(resolve);
|
||||||
|
|||||||
4
dist/extensions/ext-shapes.js
vendored
@@ -183,6 +183,8 @@ var svgEditorExtension_shapes = (function () {
|
|||||||
lastBBox = {}; // This populates the category list
|
lastBBox = {}; // This populates the category list
|
||||||
|
|
||||||
categories = strings.categories;
|
categories = strings.categories;
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
|
||||||
library = {
|
library = {
|
||||||
basic: {
|
basic: {
|
||||||
data: {
|
data: {
|
||||||
@@ -218,6 +220,8 @@ var svgEditorExtension_shapes = (function () {
|
|||||||
buttons: []
|
buttons: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
|
||||||
modeId = 'shapelib';
|
modeId = 'shapelib';
|
||||||
startClientPos = {};
|
startClientPos = {};
|
||||||
curLib = library.basic;
|
curLib = library.basic;
|
||||||
|
|||||||
7
dist/extensions/imagelib/openclipart.js
vendored
@@ -1132,8 +1132,7 @@
|
|||||||
while (_node2.childNodes[j]) {
|
while (_node2.childNodes[j]) {
|
||||||
var cn = _node2.childNodes[j];
|
var cn = _node2.childNodes[j];
|
||||||
cn.remove(); // `j` should stay the same as removing will cause node to be present
|
cn.remove(); // `j` should stay the same as removing will cause node to be present
|
||||||
} // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
}
|
||||||
|
|
||||||
|
|
||||||
attVal.childNodes.forEach(_childrenToJML(_node2));
|
attVal.childNodes.forEach(_childrenToJML(_node2));
|
||||||
} else {
|
} else {
|
||||||
@@ -1160,13 +1159,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attVal.head) {
|
if (attVal.head) {
|
||||||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
|
||||||
attVal.head.forEach(_appendJML(head));
|
attVal.head.forEach(_appendJML(head));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attVal.body) {
|
if (attVal.body) {
|
||||||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
|
||||||
attVal.body.forEach(_appendJMLOrText(_body));
|
attVal.body.forEach(_appendJMLOrText(_body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1453,7 +1450,7 @@
|
|||||||
// Todo: Fix to allow application of stylesheets of style tags within fragments?
|
// Todo: Fix to allow application of stylesheets of style tags within fragments?
|
||||||
|
|
||||||
|
|
||||||
return nodes.length <= 1 ? nodes[0] // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
return nodes.length <= 1 ? nodes[0] // eslint-disable-next-line
|
||||||
: nodes.reduce(_fragReducer, doc.createDocumentFragment()); // nodes;
|
: nodes.reduce(_fragReducer, doc.createDocumentFragment()); // nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6205
dist/index-es.js
vendored
96
dist/index-es.min.js
vendored
2
dist/index-es.min.js.map
vendored
6207
dist/index-umd.js
vendored
98
dist/index-umd.min.js
vendored
2
dist/index-umd.min.js.map
vendored
4
dist/redirect-on-lacking-support.js
vendored
@@ -118,6 +118,8 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable import/unambiguous, max-len */
|
||||||
|
|
||||||
/* globals SVGPathSeg, SVGPathSegMovetoRel, SVGPathSegMovetoAbs,
|
/* globals SVGPathSeg, SVGPathSegMovetoRel, SVGPathSegMovetoAbs,
|
||||||
SVGPathSegMovetoRel, SVGPathSegLinetoRel, SVGPathSegLinetoAbs,
|
SVGPathSegMovetoRel, SVGPathSegLinetoRel, SVGPathSegLinetoAbs,
|
||||||
SVGPathSegLinetoHorizontalRel, SVGPathSegLinetoHorizontalAbs,
|
SVGPathSegLinetoHorizontalRel, SVGPathSegLinetoHorizontalAbs,
|
||||||
@@ -1893,7 +1895,7 @@
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var owningPathSegList = this; // eslint-disable-line consistent-this
|
var owningPathSegList = this;
|
||||||
|
|
||||||
var Builder = /*#__PURE__*/function () {
|
var Builder = /*#__PURE__*/function () {
|
||||||
function Builder() {
|
function Builder() {
|
||||||
|
|||||||
973
dist/svgcanvas-iife.js
vendored
4
dist/svgcanvas-iife.min.js
vendored
2
dist/svgcanvas-iife.min.js.map
vendored
@@ -61,10 +61,11 @@ module.exports = {
|
|||||||
'cypress',
|
'cypress',
|
||||||
'node_modules',
|
'node_modules',
|
||||||
'dist',
|
'dist',
|
||||||
'editor/external',
|
'external',
|
||||||
'screencasts',
|
'screencasts',
|
||||||
'test'
|
'test'
|
||||||
],
|
],
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
excludePattern: 'svgedit-config-*|build-html.js|rollup*|external/babel-polyfill|extensions/mathjax|imagelib/jquery.min.js|jspdf/jspdf.min.js|jspdf/underscore-min.js|jquery-ui|jquery.min.js|js-hotkeys'
|
excludePattern: 'svgedit-config-*|build-html.js|rollup*|external/babel-polyfill|extensions/mathjax|imagelib/jquery.min.js|jspdf/jspdf.min.js|jspdf/underscore-min.js|jquery-ui|jquery.min.js|js-hotkeys'
|
||||||
},
|
},
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SVG-Edit extensions are standalone JavaScript files that can be either
|
|||||||
included in the HTML file, loaded using `setConfig`, or indicated through
|
included in the HTML file, loaded using `setConfig`, or indicated through
|
||||||
the URL (see [ConfigOptions]{@tutorial ConfigOptions} for usage).
|
the URL (see [ConfigOptions]{@tutorial ConfigOptions} for usage).
|
||||||
|
|
||||||
`svgedit-config-iife.js` in the project root directory (if
|
`svgedit-config-iife.js` in the `src` directory (if
|
||||||
through Git clone, by running `npm run build-by-config`) is the file used
|
through Git clone, by running `npm run build-by-config`) is the file used
|
||||||
by `svg-editor.html` to execute commands before extensions are loaded,
|
by `svg-editor.html` to execute commands before extensions are loaded,
|
||||||
e.g., if you wish to make configuration changes which affect extension
|
e.g., if you wish to make configuration changes which affect extension
|
||||||
|
|||||||
6
lgtm.yml
@@ -2,7 +2,7 @@ extraction:
|
|||||||
javascript:
|
javascript:
|
||||||
index:
|
index:
|
||||||
filters:
|
filters:
|
||||||
- exclude: "editor/xdomain-svgedit-config-iife.js"
|
- exclude: "src/editor/xdomain-svgedit-config-iife.js"
|
||||||
- exclude: "editor/redirect-on-no-module-support.js"
|
- exclude: "src/editor/redirect-on-no-module-support.js"
|
||||||
- exclude: "svgedit-config-iife.js"
|
- exclude: "src/svgedit-config-iife.js"
|
||||||
- exclude: "dist"
|
- exclude: "dist"
|
||||||
|
|||||||