- Linting (ESLint): Remove now unneeded config and add per new update

- Refactoring: Prefer for-of, event.key (newly enforced linting)
- Refactoring: Better var. names
- npm: Update devDeps and update local copies
This commit is contained in:
Brett Zamir
2019-05-24 20:17:17 +08:00
parent f6b5360a58
commit 4177146acd
38 changed files with 2450 additions and 1476 deletions

View File

@@ -90,14 +90,12 @@ export const canvg = function (target, s, opts) {
return svg.load(ctx, s);
};
/* eslint-disable jsdoc/check-types */
/**
* @param {module:canvg.CanvgOptions} opts
* @returns {object}
* @todo Flesh out exactly what object is returned here (after updating to latest and reincluding our changes here and those of StackBlur)
*/
function build (opts) {
/* eslint-enable jsdoc/check-types */
const svg = {opts};
svg.FRAMERATE = 30;

View File

@@ -192,8 +192,8 @@ function jQueryContextMenu ($) {
$(this).each(function () {
if (o !== undefined) {
const d = o.split(',');
for (let i = 0; i < d.length; i++) {
$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
for (const href of d) {
$(this).find('A[href="' + href + '"]').parent().addClass('disabled');
}
}
});
@@ -215,8 +215,8 @@ function jQueryContextMenu ($) {
$(this).each(function () {
if (o !== undefined) {
const d = o.split(',');
for (let i = 0; i < d.length; i++) {
$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
for (const href of d) {
$(this).find('A[href="' + href + '"]').parent().removeClass('disabled');
}
}
});

View File

@@ -35,7 +35,7 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.ResultPromise
*/
/**
* @typedef {PlainObject} module:jQueryPluginDBox.SelectOption
@@ -65,7 +65,7 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance
* @param {module:jQueryPluginDBox.SelectOption[]} [opts]
* @param {module:jQueryPluginDBox.SelectChangeListener} [changeListener]
* @param {module:jQueryPluginDBox.CheckboxInfo} [checkbox]
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
function dbox (type, msg, defaultVal, opts, changeListener, checkbox) {
dialogContent.html('<p>' + msg.replace(/\n/g, '</p><p>') + '</p>')
@@ -141,21 +141,21 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance
/**
* @param {string} msg Message to alert
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
$.alert = function (msg) {
return dbox('alert', msg);
};
/**
* @param {string} msg Message for which to ask confirmation
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
$.confirm = function (msg) {
return dbox('confirm', msg);
};
/**
* @param {string} msg Message to indicate upon cancelable indicator
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
$.process_cancel = function (msg) {
return dbox('process', msg);
@@ -163,7 +163,7 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance
/**
* @param {string} msg Message to accompany the prompt
* @param {string} [defaultText=''] The default text to show for the prompt
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
$.prompt = function (msg, defaultText = '') {
return dbox('prompt', msg, defaultText);

View File

@@ -314,19 +314,17 @@ class EmbeddedSVGEdit {
];
// TODO: rewrite the following, it's pretty scary.
for (let i = 0; i < functions.length; i++) {
this[functions[i]] = getCallbackSetter(functions[i]);
for (const func of functions) {
this[func] = getCallbackSetter(func);
}
// Older IE may need a polyfill for addEventListener, but so it would for SVG
window.addEventListener('message', getMessageListener(this));
window.addEventListener('keydown', (e) => {
const {key, keyCode, charCode, which} = e;
if (e.key === 'Backspace') {
const {type, key} = e;
if (key === 'Backspace') {
e.preventDefault();
const keyboardEvent = new KeyboardEvent(e.type, {
key, keyCode, charCode, which
});
const keyboardEvent = new KeyboardEvent(type, {key});
that.frame.contentDocument.dispatchEvent(keyboardEvent);
}
});

File diff suppressed because one or more lines are too long

View File

@@ -19,7 +19,7 @@ function toAbsoluteURL (url) {
/**
* Add any of the whitelisted attributes to the script tag.
* @param {HTMLScriptElement} script
* @param {PlainObject.<string, string>} atts
* @param {PlainObject<string, string>} atts
* @returns {void}
*/
function addScriptAtts (script, atts) {
@@ -36,15 +36,14 @@ function addScriptAtts (script, atts) {
* @property {string} global The variable name to set on `window` (when not using the modular version)
* @property {boolean} [returnDefault=false]
*/
/* eslint-disable jsdoc/check-types */
/**
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {string|GenericArray<Any>} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
*/
export function importSetGlobalDefault (url, config) {
/* eslint-enable jsdoc/check-types */
return importSetGlobal(url, {...config, returnDefault: true});
}
/**
@@ -113,18 +112,16 @@ export function importScript (url, atts = {}) {
});
}
/* eslint-disable jsdoc/check-types */
/**
*
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
export function importModule (url, atts = {}, {returnDefault = false} = {}) {
/* eslint-enable jsdoc/check-types */
if (Array.isArray(url)) {
return Promise.all(url.map((u) => {
return importModule(u, atts);

File diff suppressed because it is too large Load Diff

View File

@@ -1,87 +1,154 @@
function loadStylesheets(stylesheets, {
before: beforeDefault, after: afterDefault, favicon: faviconDefault,
canvas: canvasDefault, image: imageDefault = true,
acceptErrors
} = {}) {
stylesheets = Array.isArray(stylesheets) ? stylesheets : [stylesheets];
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function setupLink(stylesheetURL) {
let options = {};
if (Array.isArray(stylesheetURL)) {
[stylesheetURL, options = {}] = stylesheetURL;
}
let { favicon = faviconDefault } = options;
const {
before = beforeDefault,
after = afterDefault,
canvas = canvasDefault,
image = imageDefault
} = options;
function addLink() {
if (before) {
before.before(link);
} else if (after) {
after.after(link);
} else {
document.head.appendChild(link);
}
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
const link = document.createElement('link');
return new Promise((resolve, reject) => {
let rej = reject;
if (acceptErrors) {
rej = typeof acceptErrors === 'function' ? error => {
acceptErrors({ error, stylesheetURL, options, resolve, reject });
} : resolve;
}
if (stylesheetURL.endsWith('.css')) {
favicon = false;
} else if (stylesheetURL.endsWith('.ico')) {
favicon = true;
}
if (favicon) {
link.rel = 'shortcut icon';
link.type = 'image/x-icon';
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
if (image === false) {
link.href = stylesheetURL;
addLink();
resolve(link);
return;
}
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
const cnv = document.createElement('canvas');
cnv.width = 16;
cnv.height = 16;
const context = cnv.getContext('2d');
const img = document.createElement('img');
img.addEventListener('error', error => {
reject(error);
});
img.addEventListener('load', () => {
context.drawImage(img, 0, 0);
link.href = canvas ? cnv.toDataURL('image/x-icon') : stylesheetURL;
addLink();
resolve(link);
});
img.src = stylesheetURL;
return;
}
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = stylesheetURL;
addLink();
link.addEventListener('error', error => {
rej(error);
});
link.addEventListener('load', () => {
resolve(link);
});
});
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");
}
function loadStylesheets(stylesheets) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
beforeDefault = _ref.before,
afterDefault = _ref.after,
faviconDefault = _ref.favicon,
canvasDefault = _ref.canvas,
_ref$image = _ref.image,
imageDefault = _ref$image === void 0 ? true : _ref$image,
acceptErrors = _ref.acceptErrors;
stylesheets = Array.isArray(stylesheets) ? stylesheets : [stylesheets];
function setupLink(stylesheetURL) {
var options = {};
if (Array.isArray(stylesheetURL)) {
var _stylesheetURL = stylesheetURL;
var _stylesheetURL2 = _slicedToArray(_stylesheetURL, 2);
stylesheetURL = _stylesheetURL2[0];
var _stylesheetURL2$ = _stylesheetURL2[1];
options = _stylesheetURL2$ === void 0 ? {} : _stylesheetURL2$;
}
return Promise.all(stylesheets.map(setupLink));
var _options = options,
_options$favicon = _options.favicon,
favicon = _options$favicon === void 0 ? faviconDefault : _options$favicon;
var _options2 = options,
_options2$before = _options2.before,
before = _options2$before === void 0 ? beforeDefault : _options2$before,
_options2$after = _options2.after,
after = _options2$after === void 0 ? afterDefault : _options2$after,
_options2$canvas = _options2.canvas,
canvas = _options2$canvas === void 0 ? canvasDefault : _options2$canvas,
_options2$image = _options2.image,
image = _options2$image === void 0 ? imageDefault : _options2$image;
function addLink() {
if (before) {
before.before(link);
} else if (after) {
after.after(link);
} else {
document.head.appendChild(link);
}
}
var link = document.createElement('link');
return new Promise(function (resolve, reject) {
var rej = reject;
if (acceptErrors) {
rej = typeof acceptErrors === 'function' ? function (error) {
acceptErrors({
error: error,
stylesheetURL: stylesheetURL,
options: options,
resolve: resolve,
reject: reject
});
} : resolve;
}
if (stylesheetURL.endsWith('.css')) {
favicon = false;
} else if (stylesheetURL.endsWith('.ico')) {
favicon = true;
}
if (favicon) {
link.rel = 'shortcut icon';
link.type = 'image/x-icon';
if (image === false) {
link.href = stylesheetURL;
addLink();
resolve(link);
return;
}
var cnv = document.createElement('canvas');
cnv.width = 16;
cnv.height = 16;
var context = cnv.getContext('2d');
var img = document.createElement('img');
img.addEventListener('error', function (error) {
reject(error);
});
img.addEventListener('load', function () {
context.drawImage(img, 0, 0);
link.href = canvas ? cnv.toDataURL('image/x-icon') : stylesheetURL;
addLink();
resolve(link);
});
img.src = stylesheetURL;
return;
}
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = stylesheetURL;
addLink();
link.addEventListener('error', function (error) {
rej(error);
});
link.addEventListener('load', function () {
resolve(link);
});
});
}
return Promise.all(stylesheets.map(setupLink));
}
export default loadStylesheets;

View File

@@ -26,7 +26,7 @@ export default function jQueryPluginSVG ($) {
*/
/**
* @function external:jQuery.fn.attr
* @param {string|string[]|PlainObject.<string, string>} key
* @param {string|string[]|PlainObject<string, string>} key
* @param {string} value
* @returns {external:jQuery|module:jQueryAttr.Attributes}
*/

View File

@@ -141,8 +141,8 @@ class Layer {
* @returns {void}
*/
appendChildren (children) {
for (let i = 0; i < children.length; ++i) {
this.group_.append(children[i]);
for (const child of children) {
this.group_.append(child);
}
}

View File

@@ -484,7 +484,7 @@ export const getPointGrip = function (seg, update) {
/**
* @function module:path.getControlPoints
* @param {Segment} seg
* @returns {PlainObject.<string, SVGLineElement|SVGCircleElement>}
* @returns {PlainObject<string, SVGLineElement|SVGCircleElement>}
*/
export const getControlPoints = function (seg) {
const {item, index} = seg;

View File

@@ -2830,7 +2830,7 @@ editor.init = function () {
const allHolders = {};
/**
* @param {PlainObject.<string, module:SVGEditor.ToolButton>} holders Key is a selector
* @param {PlainObject<string, module:SVGEditor.ToolButton>} holders Key is a selector
* @returns {void}
*/
const setupFlyouts = function (holders) {

View File

@@ -1021,7 +1021,7 @@ this.runExtension = function (name, action, vars) {
* @param {module:svgcanvas.SvgCanvas#event:ext_mouseDown|module:svgcanvas.SvgCanvas#event:ext_mouseMove|module:svgcanvas.SvgCanvas#event:ext_mouseUp|module:svgcanvas.SvgCanvas#event:ext_zoomChanged|module:svgcanvas.SvgCanvas#event:ext_IDsUpdated|module:svgcanvas.SvgCanvas#event:ext_canvasUpdated|module:svgcanvas.SvgCanvas#event:ext_toolButtonStateUpdate|module:svgcanvas.SvgCanvas#event:ext_selectedChanged|module:svgcanvas.SvgCanvas#event:ext_elementTransition|module:svgcanvas.SvgCanvas#event:ext_elementChanged|module:svgcanvas.SvgCanvas#event:ext_langReady|module:svgcanvas.SvgCanvas#event:ext_langChanged|module:svgcanvas.SvgCanvas#event:ext_addLangData|module:svgcanvas.SvgCanvas#event:ext_onNewDocument|module:svgcanvas.SvgCanvas#event:ext_workareaResized|module:svgcanvas.ExtensionVarBuilder} [vars]
* @param {boolean} [returnArray]
* @param {module:svgcanvas.ExtensionNameFilter} nameFilter
* @returns {GenericArray.<module:svgcanvas.ExtensionStatus>|module:svgcanvas.ExtensionStatus|false} See {@tutorial ExtensionDocs} on the ExtensionStatus.
* @returns {GenericArray<module:svgcanvas.ExtensionStatus>|module:svgcanvas.ExtensionStatus|false} See {@tutorial ExtensionDocs} on the ExtensionStatus.
*/
const runExtensions = this.runExtensions = function (action, vars, returnArray, nameFilter) {
let result = returnArray ? [] : false;
@@ -1822,9 +1822,9 @@ const mouseDown = function (evt) {
if (!rightClick) {
// insert a dummy transform so if the element(s) are moved it will have
// a transform to use for its translate
for (let i = 0; i < selectedElements.length; ++i) {
if (isNullish(selectedElements[i])) { continue; }
const slist = getTransformList(selectedElements[i]);
for (const selectedElement of selectedElements) {
if (isNullish(selectedElement)) { continue; }
const slist = getTransformList(selectedElement);
if (slist.numberOfItems) {
slist.insertItemBefore(svgroot.createSVGTransform(), 0);
} else {
@@ -4957,9 +4957,9 @@ this.getTitle = function (elem) {
if (!elem) { return undefined; }
elem = $(elem).data('gsvg') || $(elem).data('symbol') || elem;
const childs = elem.childNodes;
for (let i = 0; i < childs.length; i++) {
if (childs[i].nodeName === 'title') {
return childs[i].textContent;
for (const child of childs) {
if (child.nodeName === 'title') {
return child.textContent;
}
}
return '';
@@ -5023,9 +5023,9 @@ this.setDocumentTitle = function (newTitle) {
const batchCmd = new BatchCommand('Change Image Title');
for (let i = 0; i < childs.length; i++) {
if (childs[i].nodeName === 'title') {
docTitle = childs[i];
for (const child of childs) {
if (child.nodeName === 'title') {
docTitle = child;
oldTitle = docTitle.textContent;
break;
}

View File

@@ -123,10 +123,10 @@ export default function jQueryPluginSVGIcons ($) {
* listed under "fallback"
* @param {boolean} [opts.replace] If set to `true`, HTML elements will
* be replaced by, rather than include the SVG icon.
* @param {PlainObject.<string, string>} [opts.placement] Map with selectors
* @param {PlainObject<string, string>} [opts.placement] Map with selectors
* for keys and SVG icon ids as values. This provides a custom method of
* adding icons.
* @param {PlainObject.<string, module:jQuerySVGIcons.Size>} [opts.resize] Map
* @param {PlainObject<string, module:jQuerySVGIcons.Size>} [opts.resize] Map
* with selectors for keys and numbers as values. This allows an easy way to
* resize specific icons.
* @param {module:jQuerySVGIcons.SVGIconsLoadedCallback} [opts.callback] A
@@ -517,7 +517,7 @@ export default function jQueryPluginSVGIcons ($) {
/**
* @function external:jQuery.resizeSvgIcons
* @param {PlainObject.<string, module:jQuerySVGIcons.Size>} obj Object with
* @param {PlainObject<string, module:jQuerySVGIcons.Size>} obj Object with
* selectors as keys. The values are sizes.
* @returns {void}
*/

View File

@@ -808,7 +808,7 @@ export const getPathDFromElement = function (elem) {
* Get a set of attributes from an element that is useful for convertToPath.
* @function module:utilities.getExtraAttributesForConvertToPath
* @param {Element} elem - The element to be probed
* @returns {PlainObject.<"marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path", string>} An object with attributes.
* @returns {PlainObject<"marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path", string>} An object with attributes.
*/
export const getExtraAttributesForConvertToPath = function (elem) {
const attrs = {};
@@ -1219,7 +1219,7 @@ export const getElem = (supportsSelectors())
* Assigns multiple attributes to an element.
* @function module:utilities.assignAttributes
* @param {Element} elem - DOM element to apply new attribute values to
* @param {PlainObject.<string, string>} attrs - Object with attribute keys/values
* @param {PlainObject<string, string>} attrs - Object with attribute keys/values
* @param {Integer} [suspendLength] - Milliseconds to suspend redraw
* @param {boolean} [unitCheck=false] - Boolean to indicate the need to use units.setUnitAttr
* @returns {void}

View File

@@ -2930,7 +2930,7 @@
/**
* @function external:jQuery.fn.attr
* @param {string|string[]|PlainObject.<string, string>} key
* @param {string|string[]|PlainObject<string, string>} key
* @param {string} value
* @returns {external:jQuery|module:jQueryAttr.Attributes}
*/
@@ -3137,6 +3137,7 @@
/**
* @param {Element} elem
* @returns {SVGTransformList}
*/
function SVGTransformList(elem) {
_classCallCheck(this, SVGTransformList);
@@ -3245,7 +3246,7 @@
}
/**
* @param {SVGTransform} newItem
* @returns {SVGTransform}
* @returns {void}
*/
}, {
@@ -5382,7 +5383,7 @@
/**
* @function module:path.getControlPoints
* @param {Segment} seg
* @returns {PlainObject.<string, SVGLineElement|SVGCircleElement>}
* @returns {PlainObject<string, SVGLineElement|SVGCircleElement>}
*/
var getControlPoints = function getControlPoints(seg) {
@@ -7127,7 +7128,7 @@
width: 0,
height: 0,
display: 'inline'
}, 100);
});
}
return undefined;
@@ -8685,7 +8686,7 @@
* Get a set of attributes from an element that is useful for convertToPath.
* @function module:utilities.getExtraAttributesForConvertToPath
* @param {Element} elem - The element to be probed
* @returns {PlainObject.<"marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path", string>} An object with attributes.
* @returns {PlainObject<"marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path", string>} An object with attributes.
*/
var getExtraAttributesForConvertToPath = function getExtraAttributesForConvertToPath(elem) {
@@ -9110,7 +9111,7 @@
* Assigns multiple attributes to an element.
* @function module:utilities.assignAttributes
* @param {Element} elem - DOM element to apply new attribute values to
* @param {PlainObject.<string, string>} attrs - Object with attribute keys/values
* @param {PlainObject<string, string>} attrs - Object with attribute keys/values
* @param {Integer} [suspendLength] - Milliseconds to suspend redraw
* @param {boolean} [unitCheck=false] - Boolean to indicate the need to use units.setUnitAttr
* @returns {void}
@@ -9360,7 +9361,7 @@
/**
* Add any of the whitelisted attributes to the script tag.
* @param {HTMLScriptElement} script
* @param {PlainObject.<string, string>} atts
* @param {PlainObject<string, string>} atts
* @returns {void}
*/
@@ -9381,9 +9382,9 @@
/**
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {string|GenericArray<Any>} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
*/
@@ -9504,7 +9505,7 @@
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
@@ -9610,7 +9611,7 @@
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.ResultPromise
*/
/**
@@ -9644,7 +9645,7 @@
* @param {module:jQueryPluginDBox.SelectOption[]} [opts]
* @param {module:jQueryPluginDBox.SelectChangeListener} [changeListener]
* @param {module:jQueryPluginDBox.CheckboxInfo} [checkbox]
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
function dbox(type, msg, defaultVal, opts, changeListener, checkbox) {
@@ -9732,7 +9733,7 @@
}
/**
* @param {string} msg Message to alert
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
@@ -9741,7 +9742,7 @@
};
/**
* @param {string} msg Message for which to ask confirmation
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
@@ -9750,7 +9751,7 @@
};
/**
* @param {string} msg Message to indicate upon cancelable indicator
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
@@ -9760,7 +9761,7 @@
/**
* @param {string} msg Message to accompany the prompt
* @param {string} [defaultText=''] The default text to show for the prompt
* @returns {jQueryPluginDBox.PromiseResult}
* @returns {jQueryPluginDBox.ResultPromise}
*/
@@ -9933,8 +9934,28 @@
}, {
key: "appendChildren",
value: function appendChildren(children) {
for (var i = 0; i < children.length; ++i) {
this.group_.append(children[i]);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var child = _step.value;
this.group_.append(child);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
/**
@@ -13781,10 +13802,10 @@
'fill-opacity': curShape.fill_opacity,
opacity: curShape.opacity / 2,
style: 'pointer-events:inherit'
}, 100);
});
}
assignAttributes(shape, data.attr, 100);
assignAttributes(shape, data.attr);
cleanupElement(shape); // Children
if (data.children) {
@@ -14513,7 +14534,7 @@
* @param {module:svgcanvas.SvgCanvas#event:ext_mouseDown|module:svgcanvas.SvgCanvas#event:ext_mouseMove|module:svgcanvas.SvgCanvas#event:ext_mouseUp|module:svgcanvas.SvgCanvas#event:ext_zoomChanged|module:svgcanvas.SvgCanvas#event:ext_IDsUpdated|module:svgcanvas.SvgCanvas#event:ext_canvasUpdated|module:svgcanvas.SvgCanvas#event:ext_toolButtonStateUpdate|module:svgcanvas.SvgCanvas#event:ext_selectedChanged|module:svgcanvas.SvgCanvas#event:ext_elementTransition|module:svgcanvas.SvgCanvas#event:ext_elementChanged|module:svgcanvas.SvgCanvas#event:ext_langReady|module:svgcanvas.SvgCanvas#event:ext_langChanged|module:svgcanvas.SvgCanvas#event:ext_addLangData|module:svgcanvas.SvgCanvas#event:ext_onNewDocument|module:svgcanvas.SvgCanvas#event:ext_workareaResized|module:svgcanvas.ExtensionVarBuilder} [vars]
* @param {boolean} [returnArray]
* @param {module:svgcanvas.ExtensionNameFilter} nameFilter
* @returns {GenericArray.<module:svgcanvas.ExtensionStatus>|module:svgcanvas.ExtensionStatus|false} See {@tutorial ExtensionDocs} on the ExtensionStatus.
* @returns {GenericArray<module:svgcanvas.ExtensionStatus>|module:svgcanvas.ExtensionStatus|false} See {@tutorial ExtensionDocs} on the ExtensionStatus.
*/
@@ -15438,12 +15459,14 @@
if (!rightClick) {
// insert a dummy transform so if the element(s) are moved it will have
// a transform to use for its translate
for (var i = 0; i < selectedElements.length; ++i) {
if (isNullish(selectedElements[i])) {
for (var _i2 = 0, _selectedElements = selectedElements; _i2 < _selectedElements.length; _i2++) {
var selectedElement = _selectedElements[_i2];
if (isNullish(selectedElement)) {
continue;
}
var slist = getTransformList(selectedElements[i]);
var slist = getTransformList(selectedElement);
if (slist.numberOfItems) {
slist.insertItemBefore(svgroot.createSVGTransform(), 0);
@@ -15472,7 +15495,7 @@
width: 0,
height: 0,
display: 'inline'
}, 100);
});
}
break;
@@ -15490,7 +15513,7 @@
width: 0,
height: 0,
display: 'inline'
}, 100);
});
break;
case 'resize':
@@ -15547,16 +15570,16 @@
var all = mouseTarget.getElementsByTagName('*'),
len = all.length;
for (var _i2 = 0; _i2 < len; _i2++) {
if (!all[_i2].style) {
for (var i = 0; i < len; i++) {
if (!all[i].style) {
// mathML
continue;
}
all[_i2].style.vectorEffect = 'non-scaling-stroke';
all[i].style.vectorEffect = 'non-scaling-stroke';
if (iswebkit) {
delayedStroke(all[_i2]);
delayedStroke(all[i]);
}
}
}
@@ -15887,7 +15910,7 @@
y: Math.min(rStartY, realY),
width: Math.abs(realX - rStartX),
height: Math.abs(realY - rStartY)
}, 100); // for each selected:
}); // for each selected:
// - if newList contains selected, do nothing
// - if newList doesn't contain selected, remove it from selected
// - for any newList that was not in selectedElements, add it to selected
@@ -16035,7 +16058,7 @@
y: Math.min(rStartY * currentZoom, realY),
width: Math.abs(realX - rStartX * currentZoom),
height: Math.abs(realY - rStartY * currentZoom)
}, 100);
});
break;
}
@@ -16044,7 +16067,7 @@
assignAttributes(shape, {
x: x,
y: y
}, 1000);
});
break;
}
@@ -16103,7 +16126,7 @@
height: h,
x: newX,
y: newY
}, 1000);
});
break;
}
@@ -16235,7 +16258,7 @@
y: Math.min(rStartY * currentZoom, realY),
width: Math.abs(realX - rStartX * currentZoom),
height: Math.abs(realY - rStartY * currentZoom)
}, 100);
});
}
pathActions$1.mouseMove(x, y);
@@ -19009,10 +19032,30 @@
elem = $$9(elem).data('gsvg') || $$9(elem).data('symbol') || elem;
var childs = elem.childNodes;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
for (var i = 0; i < childs.length; i++) {
if (childs[i].nodeName === 'title') {
return childs[i].textContent;
try {
for (var _iterator2 = childs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var child = _step2.value;
if (child.nodeName === 'title') {
return child.textContent;
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
@@ -19079,12 +19122,32 @@
var docTitle = false,
oldTitle = '';
var batchCmd = new BatchCommand$1('Change Image Title');
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
for (var i = 0; i < childs.length; i++) {
if (childs[i].nodeName === 'title') {
docTitle = childs[i];
oldTitle = docTitle.textContent;
break;
try {
for (var _iterator3 = childs[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var child = _step3.value;
if (child.nodeName === 'title') {
docTitle = child;
oldTitle = docTitle.textContent;
break;
}
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
@@ -19925,7 +19988,7 @@
y: '-50%',
width: '200%',
height: '200%'
}, 100); // Removing these attributes hides text in Chrome (see Issue 579)
}); // Removing these attributes hides text in Chrome (see Issue 579)
} else if (!isWebkit()) {
filterElem.removeAttribute('x');
filterElem.removeAttribute('y');
@@ -21071,9 +21134,9 @@
this.moveToTopSelectedElement = function () {
var _selectedElements = selectedElements,
_selectedElements2 = _slicedToArray(_selectedElements, 1),
selected = _selectedElements2[0];
var _selectedElements2 = selectedElements,
_selectedElements3 = _slicedToArray(_selectedElements2, 1),
selected = _selectedElements3[0];
if (!isNullish(selected)) {
var t = selected;
@@ -21098,9 +21161,9 @@
this.moveToBottomSelectedElement = function () {
var _selectedElements3 = selectedElements,
_selectedElements4 = _slicedToArray(_selectedElements3, 1),
selected = _selectedElements4[0];
var _selectedElements4 = selectedElements,
_selectedElements5 = _slicedToArray(_selectedElements4, 1),
selected = _selectedElements5[0];
if (!isNullish(selected)) {
var t = selected;
@@ -22355,10 +22418,10 @@
* listed under "fallback"
* @param {boolean} [opts.replace] If set to `true`, HTML elements will
* be replaced by, rather than include the SVG icon.
* @param {PlainObject.<string, string>} [opts.placement] Map with selectors
* @param {PlainObject<string, string>} [opts.placement] Map with selectors
* for keys and SVG icon ids as values. This provides a custom method of
* adding icons.
* @param {PlainObject.<string, module:jQuerySVGIcons.Size>} [opts.resize] Map
* @param {PlainObject<string, module:jQuerySVGIcons.Size>} [opts.resize] Map
* with selectors for keys and numbers as values. This allows an easy way to
* resize specific icons.
* @param {module:jQuerySVGIcons.SVGIconsLoadedCallback} [opts.callback] A
@@ -22780,7 +22843,7 @@
/**
* @function external:jQuery.resizeSvgIcons
* @param {PlainObject.<string, module:jQuerySVGIcons.Size>} obj Object with
* @param {PlainObject<string, module:jQuerySVGIcons.Size>} obj Object with
* selectors as keys. The values are sizes.
* @returns {void}
*/
@@ -24685,9 +24748,28 @@
$(this).each(function () {
if (o !== undefined) {
var d = o.split(',');
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < d.length; i++) {
$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
try {
for (var _iterator = d[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var href = _step.value;
$(this).find('A[href="' + href + '"]').parent().addClass('disabled');
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
});
@@ -24710,9 +24792,28 @@
$(this).each(function () {
if (o !== undefined) {
var d = o.split(',');
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
for (var i = 0; i < d.length; i++) {
$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
try {
for (var _iterator2 = d[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var href = _step2.value;
$(this).find('A[href="' + href + '"]').parent().removeClass('disabled');
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
});
@@ -28521,6 +28622,44 @@
};
}();
function _slicedToArray$1(arr, i) {
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
}
function _arrayWithHoles$1(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit$1(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$1() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function loadStylesheets(stylesheets) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
beforeDefault = _ref.before,
@@ -28539,7 +28678,7 @@
if (Array.isArray(stylesheetURL)) {
var _stylesheetURL = stylesheetURL;
var _stylesheetURL2 = _slicedToArray(_stylesheetURL, 2);
var _stylesheetURL2 = _slicedToArray$1(_stylesheetURL, 2);
stylesheetURL = _stylesheetURL2[0];
var _stylesheetURL2$ = _stylesheetURL2[1];
@@ -30001,7 +30140,7 @@
setFlyoutPositions();
};
/**
* Setup SVG icons
* Setup SVG icons.
* @returns {void}
*/
@@ -30384,7 +30523,7 @@
}
/**
* This function highlights the layer passed in (by fading out the other layers).
* If no layer is passed in, this function restores the other layers
* If no layer is passed in, this function restores the other layers.
* @param {string} [layerNameToHighlight]
* @returns {void}
*/
@@ -31760,7 +31899,7 @@
var allHolders = {};
/**
* @param {PlainObject.<string, module:SVGEditor.ToolButton>} holders Key is a selector
* @param {PlainObject<string, module:SVGEditor.ToolButton>} holders Key is a selector
* @returns {void}
*/
@@ -35829,7 +35968,7 @@
}
});
/**
* Implements {@see module:jQueryContextMenu.jQueryContextMenuListener}
* Implements {@see module:jQueryContextMenu.jQueryContextMenuListener}.
* @param {"dupe"|"delete"|"merge_down"|"merge_all"} action
* @param {external:jQuery} el
* @param {{x: Float, y: Float, docX: Float, docY: Float}} pos
@@ -36027,7 +36166,7 @@
var result = _ref27.target.result;
/**
* Insert the new image until we know its dimensions
* Insert the new image until we know its dimensions.
* @param {Float} width
* @param {Float} height
* @returns {void}