- Linting (ESLint): Update polyfills to new compat rules of

eslint-config-ash-nazg and adhere to new rules (prefer `for-of`
  (or array methods) to `for`, catch preferred `includes` to `indexOf`);
  avoid `no-zero-fractions` rule for now
- npm: Update devDeps (removing one unneeded)
master
Brett Zamir 2019-03-31 17:39:19 +08:00
parent 28c0c60bb8
commit 1ae6e91bb0
26 changed files with 2311 additions and 1863 deletions

View File

@ -12,7 +12,39 @@ module.exports = {
browser: true browser: true
}, },
settings: { settings: {
polyfills: ["url", "promises", "fetch", "queryselector", "object-values"], polyfills: [
"Array.isArray",
"Blob",
"console",
"Date.now",
"document.body",
"document.evaluate",
"document.head",
"document.importNode",
"document.querySelector", "document.querySelectorAll",
"DOMParser",
"Error",
"fetch",
"FileReader",
"history.pushState",
"history.replaceState",
"JSON",
"location.href",
"location.origin",
"MutationObserver",
"Object.assign", "Object.defineProperty", "Object.defineProperties",
"Object.getOwnPropertyDescriptor",
"Object.entries", "Object.keys", "Object.values",
"Promise",
"Set",
"Uint8Array",
"URL",
"window.getComputedStyle",
"window.postMessage",
"window.scrollX", "window.scrollY",
"XMLHttpRequest",
"XMLSerializer"
],
jsdoc: { jsdoc: {
additionalTagNames: { additionalTagNames: {
// In case we need to extend // In case we need to extend
@ -140,13 +172,14 @@ module.exports = {
rules: { rules: {
// Override these `ash-nazg/sauron` rules which are difficult for us // Override these `ash-nazg/sauron` rules which are difficult for us
// to apply at this time // to apply at this time
"default-case": ["off"], "default-case": "off",
"require-unicode-regexp": ["off"], "require-unicode-regexp": "off",
"max-len": ["off", { "max-len": ["off", {
ignoreUrls: true, ignoreUrls: true,
ignoreRegExpLiterals: true ignoreRegExpLiterals: true
}], }],
"unicorn/prefer-query-selector": ["off"], "unicorn/prefer-query-selector": "off",
"unicorn/prefer-node-append": ["off"] "unicorn/prefer-node-append": "off",
"unicorn/no-zero-fractions": "off"
} }
}; };

View File

@ -13,10 +13,15 @@
- Enhancement: Add CAD Placemark extension (@NeiroNx) - Enhancement: Add CAD Placemark extension (@NeiroNx)
- Refactoring: Make dialog OK button retrievable locale-independently - Refactoring: Make dialog OK button retrievable locale-independently
via a `data-ok` attribute (using for testing) via a `data-ok` attribute (using for testing)
- Linting (ESLint): Update polyfills to new compat rules of
eslint-config-ash-nazg and adhere to new rules (prefer `for-of`
(or array methods) to `for`, catch preferred `includes` to `indexOf`);
avoid `no-zero-fractions` rule for now
- Testing (UI Refactoring): Abstract out to helper file functions - Testing (UI Refactoring): Abstract out to helper file functions
- Testing (UI Refactoring): Avoid testing being locale-dependent; - Testing (UI Refactoring): Avoid testing being locale-dependent;
approve storage (and set locale to English) before each test approve storage (and set locale to English) before each test
- npm: Update devDeps; update nested deps for security audit - npm: Update devDeps; update nested deps for security audit; remove
one unneeded)
## 4.2.0 ## 4.2.0

View File

@ -149,7 +149,7 @@
return; return;
} }
this.parentNode.removeChild(this); this.parentNode.removeChild(this); // eslint-disable-line unicorn/prefer-node-remove
} }
}; };
mixin(DocumentType, ChildNode); mixin(DocumentType, ChildNode);

View File

@ -73,16 +73,10 @@ var svgEditorExtension_grid = (function () {
var rawM = 100 / uMulti; var rawM = 100 / uMulti;
var multi = 1; var multi = 1;
intervals.some(function (num) {
for (var i = 0; i < intervals.length; i++) {
var num = intervals[i];
multi = num; multi = num;
return rawM <= num;
if (rawM <= num) { });
break;
}
}
var bigInt = multi * uMulti; // Set the canvas size to the width of the container var bigInt = multi * uMulti; // Set the canvas size to the width of the container
hcanvas.width = bigInt; hcanvas.width = bigInt;
@ -93,8 +87,8 @@ var svgEditorExtension_grid = (function () {
ctx.globalAlpha = 0.2; ctx.globalAlpha = 0.2;
ctx.strokeStyle = svgEditor.curConfig.gridColor; ctx.strokeStyle = svgEditor.curConfig.gridColor;
for (var _i = 1; _i < 10; _i++) { for (var i = 1; i < 10; i++) {
var subD = Math.round(part * _i) + 0.5; // const lineNum = (i % 2)?12:10; var subD = Math.round(part * i) + 0.5; // const lineNum = (i % 2)?12:10;
var lineNum = 0; var lineNum = 0;
ctx.moveTo(subD, bigInt); ctx.moveTo(subD, bigInt);

85
dist/index-es.js vendored
View File

@ -6286,21 +6286,21 @@ function () {
}, { }, {
key: "addPtsToSelection", key: "addPtsToSelection",
value: function addPtsToSelection(indexes) { value: function addPtsToSelection(indexes) {
var _this = this;
if (!Array.isArray(indexes)) { if (!Array.isArray(indexes)) {
indexes = [indexes]; indexes = [indexes];
} }
for (var _i4 = 0; _i4 < indexes.length; _i4++) { indexes.forEach(function (index) {
var index = indexes[_i4]; var seg = _this.segs[index];
var seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!_this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); _this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
var i = this.selected_pts.length; var i = this.selected_pts.length;
var grips = []; var grips = [];
@ -6308,11 +6308,9 @@ function () {
while (i--) { while (i--) {
var pt = this.selected_pts[i]; var pt = this.selected_pts[i];
var _seg2 = this.segs[pt]; var seg = this.segs[pt];
seg.select(true);
_seg2.select(true); grips[i] = seg.ptgrip;
grips[i] = _seg2.ptgrip;
} }
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]); var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
@ -10843,6 +10841,8 @@ function () {
}, { }, {
key: "cloneLayer", key: "cloneLayer",
value: function cloneLayer(name, hrService) { value: function cloneLayer(name, hrService) {
var _this = this;
if (!this.current_layer) { if (!this.current_layer) {
return null; return null;
} }
@ -10858,17 +10858,15 @@ function () {
var layer = new Layer(name, currentGroup, this.svgElem_); var layer = new Layer(name, currentGroup, this.svgElem_);
var group = layer.getGroup(); // Clone children var group = layer.getGroup(); // Clone children
var children = currentGroup.childNodes; var children = _toConsumableArray(currentGroup.childNodes);
for (var _index = 0; _index < children.length; _index++) { children.forEach(function (child) {
var ch = children[_index]; if (child.localName === 'title') {
return;
if (ch.localName === 'title') {
continue;
} }
group.append(this.copyElem(ch)); group.append(_this.copyElem(child));
} });
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');
@ -16457,9 +16455,9 @@ function SvgCanvas(container, config) {
var commaIndex = coords.indexOf(','); var commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
@ -18737,10 +18735,29 @@ function SvgCanvas(container, config) {
} }
var attrs = svg.attributes; var attrs = svg.attributes;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < attrs.length; i++) { try {
var attr = attrs[i]; for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
symbol.setAttribute(attr.nodeName, attr.value); var attr = _step.value;
// Ok for `NamedNodeMap`
symbol.setAttribute(attr.nodeName, attr.value);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
} }
symbol.id = getNextId(); // Store data symbol.id = getNextId(); // Store data
@ -31398,8 +31415,7 @@ editor.init = function () {
setSelectMode(); setSelectMode();
} }
for (var _i = 0; _i < elems.length; ++_i) { elems.forEach(function (elem) {
var elem = elems[_i];
var isSvgElem = elem && elem.tagName === 'svg'; var isSvgElem = elem && elem.tagName === 'svg';
if (isSvgElem || isLayer(elem)) { if (isSvgElem || isLayer(elem)) {
@ -31414,8 +31430,7 @@ editor.init = function () {
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why // || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
selectedElement = elem; selectedElement = elem;
} }
} });
editor.showSaveWarning = true; // we update the contextual panel with potentially new editor.showSaveWarning = true; // we update the contextual panel with potentially new
// positional/sizing information (we DON'T want to update the // positional/sizing information (we DON'T want to update the
// toolbar here as that creates an infinite loop) // toolbar here as that creates an infinite loop)
@ -34235,10 +34250,10 @@ editor.init = function () {
if (isMac() && !window.opera) { if (isMac() && !window.opera) {
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone']; var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
var _i2 = shortcutButtons.length; var _i = shortcutButtons.length;
while (_i2--) { while (_i--) {
var button = document.getElementById(shortcutButtons[_i2]); var button = document.getElementById(shortcutButtons[_i]);
if (button) { if (button) {
var title = button.title; var title = button.title;
@ -34363,11 +34378,11 @@ editor.init = function () {
var childs = selectedElement.getElementsByTagName('*'); var childs = selectedElement.getElementsByTagName('*');
var gPaint = null; var gPaint = null;
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) { for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
var elem = childs[_i3]; var elem = childs[_i2];
var p = elem.getAttribute(type); var p = elem.getAttribute(type);
if (_i3 === 0) { if (_i2 === 0) {
gPaint = p; gPaint = p;
} else if (gPaint !== p) { } else if (gPaint !== p) {
gPaint = null; gPaint = null;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

85
dist/index-umd.js vendored
View File

@ -6292,21 +6292,21 @@
}, { }, {
key: "addPtsToSelection", key: "addPtsToSelection",
value: function addPtsToSelection(indexes) { value: function addPtsToSelection(indexes) {
var _this = this;
if (!Array.isArray(indexes)) { if (!Array.isArray(indexes)) {
indexes = [indexes]; indexes = [indexes];
} }
for (var _i4 = 0; _i4 < indexes.length; _i4++) { indexes.forEach(function (index) {
var index = indexes[_i4]; var seg = _this.segs[index];
var seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!_this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); _this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
var i = this.selected_pts.length; var i = this.selected_pts.length;
var grips = []; var grips = [];
@ -6314,11 +6314,9 @@
while (i--) { while (i--) {
var pt = this.selected_pts[i]; var pt = this.selected_pts[i];
var _seg2 = this.segs[pt]; var seg = this.segs[pt];
seg.select(true);
_seg2.select(true); grips[i] = seg.ptgrip;
grips[i] = _seg2.ptgrip;
} }
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]); var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
@ -10849,6 +10847,8 @@
}, { }, {
key: "cloneLayer", key: "cloneLayer",
value: function cloneLayer(name, hrService) { value: function cloneLayer(name, hrService) {
var _this = this;
if (!this.current_layer) { if (!this.current_layer) {
return null; return null;
} }
@ -10864,17 +10864,15 @@
var layer = new Layer(name, currentGroup, this.svgElem_); var layer = new Layer(name, currentGroup, this.svgElem_);
var group = layer.getGroup(); // Clone children var group = layer.getGroup(); // Clone children
var children = currentGroup.childNodes; var children = _toConsumableArray(currentGroup.childNodes);
for (var _index = 0; _index < children.length; _index++) { children.forEach(function (child) {
var ch = children[_index]; if (child.localName === 'title') {
return;
if (ch.localName === 'title') {
continue;
} }
group.append(this.copyElem(ch)); group.append(_this.copyElem(child));
} });
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');
@ -16463,9 +16461,9 @@
var commaIndex = coords.indexOf(','); var commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
@ -18743,10 +18741,29 @@
} }
var attrs = svg.attributes; var attrs = svg.attributes;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < attrs.length; i++) { try {
var attr = attrs[i]; for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
symbol.setAttribute(attr.nodeName, attr.value); var attr = _step.value;
// Ok for `NamedNodeMap`
symbol.setAttribute(attr.nodeName, attr.value);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
} }
symbol.id = getNextId(); // Store data symbol.id = getNextId(); // Store data
@ -31404,8 +31421,7 @@
setSelectMode(); setSelectMode();
} }
for (var _i = 0; _i < elems.length; ++_i) { elems.forEach(function (elem) {
var elem = elems[_i];
var isSvgElem = elem && elem.tagName === 'svg'; var isSvgElem = elem && elem.tagName === 'svg';
if (isSvgElem || isLayer(elem)) { if (isSvgElem || isLayer(elem)) {
@ -31420,8 +31436,7 @@
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why // || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
selectedElement = elem; selectedElement = elem;
} }
} });
editor.showSaveWarning = true; // we update the contextual panel with potentially new editor.showSaveWarning = true; // we update the contextual panel with potentially new
// positional/sizing information (we DON'T want to update the // positional/sizing information (we DON'T want to update the
// toolbar here as that creates an infinite loop) // toolbar here as that creates an infinite loop)
@ -34241,10 +34256,10 @@
if (isMac() && !window.opera) { if (isMac() && !window.opera) {
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone']; var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
var _i2 = shortcutButtons.length; var _i = shortcutButtons.length;
while (_i2--) { while (_i--) {
var button = document.getElementById(shortcutButtons[_i2]); var button = document.getElementById(shortcutButtons[_i]);
if (button) { if (button) {
var title = button.title; var title = button.title;
@ -34369,11 +34384,11 @@
var childs = selectedElement.getElementsByTagName('*'); var childs = selectedElement.getElementsByTagName('*');
var gPaint = null; var gPaint = null;
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) { for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
var elem = childs[_i3]; var elem = childs[_i2];
var p = elem.getAttribute(type); var p = elem.getAttribute(type);
if (_i3 === 0) { if (_i2 === 0) {
gPaint = p; gPaint = p;
} else if (gPaint !== p) { } else if (gPaint !== p) {
gPaint = null; gPaint = null;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6348,21 +6348,21 @@ var SvgCanvas = (function () {
}, { }, {
key: "addPtsToSelection", key: "addPtsToSelection",
value: function addPtsToSelection(indexes) { value: function addPtsToSelection(indexes) {
var _this = this;
if (!Array.isArray(indexes)) { if (!Array.isArray(indexes)) {
indexes = [indexes]; indexes = [indexes];
} }
for (var _i4 = 0; _i4 < indexes.length; _i4++) { indexes.forEach(function (index) {
var index = indexes[_i4]; var seg = _this.segs[index];
var seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!_this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); _this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
var i = this.selected_pts.length; var i = this.selected_pts.length;
var grips = []; var grips = [];
@ -6370,11 +6370,9 @@ var SvgCanvas = (function () {
while (i--) { while (i--) {
var pt = this.selected_pts[i]; var pt = this.selected_pts[i];
var _seg2 = this.segs[pt]; var seg = this.segs[pt];
seg.select(true);
_seg2.select(true); grips[i] = seg.ptgrip;
grips[i] = _seg2.ptgrip;
} }
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]); var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
@ -10410,6 +10408,8 @@ var SvgCanvas = (function () {
}, { }, {
key: "cloneLayer", key: "cloneLayer",
value: function cloneLayer(name, hrService) { value: function cloneLayer(name, hrService) {
var _this = this;
if (!this.current_layer) { if (!this.current_layer) {
return null; return null;
} }
@ -10425,17 +10425,15 @@ var SvgCanvas = (function () {
var layer = new Layer(name, currentGroup, this.svgElem_); var layer = new Layer(name, currentGroup, this.svgElem_);
var group = layer.getGroup(); // Clone children var group = layer.getGroup(); // Clone children
var children = currentGroup.childNodes; var children = _toConsumableArray(currentGroup.childNodes);
for (var _index = 0; _index < children.length; _index++) { children.forEach(function (child) {
var ch = children[_index]; if (child.localName === 'title') {
return;
if (ch.localName === 'title') {
continue;
} }
group.append(this.copyElem(ch)); group.append(_this.copyElem(child));
} });
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');
@ -16235,9 +16233,9 @@ var SvgCanvas = (function () {
var commaIndex = coords.indexOf(','); var commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
@ -18515,10 +18513,29 @@ var SvgCanvas = (function () {
} }
var attrs = svg.attributes; var attrs = svg.attributes;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < attrs.length; i++) { try {
var attr = attrs[i]; for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
symbol.setAttribute(attr.nodeName, attr.value); var attr = _step.value;
// Ok for `NamedNodeMap`
symbol.setAttribute(attr.nodeName, attr.value);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
} }
symbol.id = getNextId(); // Store data symbol.id = getNextId(); // Store data

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -574,12 +574,11 @@ export class Drawing {
const group = layer.getGroup(); const group = layer.getGroup();
// Clone children // Clone children
const children = currentGroup.childNodes; const children = [...currentGroup.childNodes];
for (let index = 0; index < children.length; index++) { children.forEach((child) => {
const ch = children[index]; if (child.localName === 'title') { return; }
if (ch.localName === 'title') { continue; } group.append(this.copyElem(child));
group.append(this.copyElem(ch)); });
}
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');

View File

@ -83,13 +83,10 @@ export default {
// Calculate the main number interval // Calculate the main number interval
const rawM = 100 / uMulti; const rawM = 100 / uMulti;
let multi = 1; let multi = 1;
for (let i = 0; i < intervals.length; i++) { intervals.some((num) => {
const num = intervals[i];
multi = num; multi = num;
if (rawM <= num) { return rawM <= num;
break; });
}
}
const bigInt = multi * uMulti; const bigInt = multi * uMulti;
// Set the canvas size to the width of the container // Set the canvas size to the width of the container

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -108,7 +108,7 @@ const ChildNode = {
}, },
remove () { remove () {
if (!this.parentNode) { return; } if (!this.parentNode) { return; }
this.parentNode.removeChild(this); this.parentNode.removeChild(this); // eslint-disable-line unicorn/prefer-node-remove
} }
}; };

View File

@ -1282,15 +1282,14 @@ export class Path {
*/ */
addPtsToSelection (indexes) { addPtsToSelection (indexes) {
if (!Array.isArray(indexes)) { indexes = [indexes]; } if (!Array.isArray(indexes)) { indexes = [indexes]; }
for (let i = 0; i < indexes.length; i++) { indexes.forEach((index) => {
const index = indexes[i];
const seg = this.segs[index]; const seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
let i = this.selected_pts.length; let i = this.selected_pts.length;
const grips = []; const grips = [];

View File

@ -2622,9 +2622,7 @@ editor.init = function () {
setSelectMode(); setSelectMode();
} }
for (let i = 0; i < elems.length; ++i) { elems.forEach((elem) => {
const elem = elems[i];
const isSvgElem = (elem && elem.tagName === 'svg'); const isSvgElem = (elem && elem.tagName === 'svg');
if (isSvgElem || isLayer(elem)) { if (isSvgElem || isLayer(elem)) {
populateLayers(); populateLayers();
@ -2638,7 +2636,7 @@ editor.init = function () {
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why // || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
selectedElement = elem; selectedElement = elem;
} }
} });
editor.showSaveWarning = true; editor.showSaveWarning = true;

View File

@ -2681,9 +2681,9 @@ const mouseUp = function (evt) {
const coords = element.getAttribute('points'); const coords = element.getAttribute('points');
const commaIndex = coords.indexOf(','); const commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
element = pathActions.smoothPolylineIntoPath(element); element = pathActions.smoothPolylineIntoPath(element);
@ -4736,8 +4736,7 @@ this.importSvgString = function (xmlString) {
symbol.append(first); symbol.append(first);
} }
const attrs = svg.attributes; const attrs = svg.attributes;
for (let i = 0; i < attrs.length; i++) { for (const attr of attrs) { // Ok for `NamedNodeMap`
const attr = attrs[i];
symbol.setAttribute(attr.nodeName, attr.value); symbol.setAttribute(attr.nodeName, attr.value);
} }
symbol.id = getNextId(); symbol.id = getNextId();

View File

@ -6289,21 +6289,21 @@
}, { }, {
key: "addPtsToSelection", key: "addPtsToSelection",
value: function addPtsToSelection(indexes) { value: function addPtsToSelection(indexes) {
var _this = this;
if (!Array.isArray(indexes)) { if (!Array.isArray(indexes)) {
indexes = [indexes]; indexes = [indexes];
} }
for (var _i4 = 0; _i4 < indexes.length; _i4++) { indexes.forEach(function (index) {
var index = indexes[_i4]; var seg = _this.segs[index];
var seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!_this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); _this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
var i = this.selected_pts.length; var i = this.selected_pts.length;
var grips = []; var grips = [];
@ -6311,11 +6311,9 @@
while (i--) { while (i--) {
var pt = this.selected_pts[i]; var pt = this.selected_pts[i];
var _seg2 = this.segs[pt]; var seg = this.segs[pt];
seg.select(true);
_seg2.select(true); grips[i] = seg.ptgrip;
grips[i] = _seg2.ptgrip;
} }
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]); var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
@ -10846,6 +10844,8 @@
}, { }, {
key: "cloneLayer", key: "cloneLayer",
value: function cloneLayer(name, hrService) { value: function cloneLayer(name, hrService) {
var _this = this;
if (!this.current_layer) { if (!this.current_layer) {
return null; return null;
} }
@ -10861,17 +10861,15 @@
var layer = new Layer(name, currentGroup, this.svgElem_); var layer = new Layer(name, currentGroup, this.svgElem_);
var group = layer.getGroup(); // Clone children var group = layer.getGroup(); // Clone children
var children = currentGroup.childNodes; var children = _toConsumableArray(currentGroup.childNodes);
for (var _index = 0; _index < children.length; _index++) { children.forEach(function (child) {
var ch = children[_index]; if (child.localName === 'title') {
return;
if (ch.localName === 'title') {
continue;
} }
group.append(this.copyElem(ch)); group.append(_this.copyElem(child));
} });
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');
@ -16460,9 +16458,9 @@
var commaIndex = coords.indexOf(','); var commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
@ -18740,10 +18738,29 @@
} }
var attrs = svg.attributes; var attrs = svg.attributes;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < attrs.length; i++) { try {
var attr = attrs[i]; for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
symbol.setAttribute(attr.nodeName, attr.value); var attr = _step.value;
// Ok for `NamedNodeMap`
symbol.setAttribute(attr.nodeName, attr.value);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
} }
symbol.id = getNextId(); // Store data symbol.id = getNextId(); // Store data
@ -31401,8 +31418,7 @@
setSelectMode(); setSelectMode();
} }
for (var _i = 0; _i < elems.length; ++_i) { elems.forEach(function (elem) {
var elem = elems[_i];
var isSvgElem = elem && elem.tagName === 'svg'; var isSvgElem = elem && elem.tagName === 'svg';
if (isSvgElem || isLayer(elem)) { if (isSvgElem || isLayer(elem)) {
@ -31417,8 +31433,7 @@
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why // || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
selectedElement = elem; selectedElement = elem;
} }
} });
editor.showSaveWarning = true; // we update the contextual panel with potentially new editor.showSaveWarning = true; // we update the contextual panel with potentially new
// positional/sizing information (we DON'T want to update the // positional/sizing information (we DON'T want to update the
// toolbar here as that creates an infinite loop) // toolbar here as that creates an infinite loop)
@ -34238,10 +34253,10 @@
if (isMac() && !window.opera) { if (isMac() && !window.opera) {
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone']; var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
var _i2 = shortcutButtons.length; var _i = shortcutButtons.length;
while (_i2--) { while (_i--) {
var button = document.getElementById(shortcutButtons[_i2]); var button = document.getElementById(shortcutButtons[_i]);
if (button) { if (button) {
var title = button.title; var title = button.title;
@ -34366,11 +34381,11 @@
var childs = selectedElement.getElementsByTagName('*'); var childs = selectedElement.getElementsByTagName('*');
var gPaint = null; var gPaint = null;
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) { for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
var elem = childs[_i3]; var elem = childs[_i2];
var p = elem.getAttribute(type); var p = elem.getAttribute(type);
if (_i3 === 0) { if (_i2 === 0) {
gPaint = p; gPaint = p;
} else if (gPaint !== p) { } else if (gPaint !== p) {
gPaint = null; gPaint = null;

997
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -76,21 +76,21 @@
], ],
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@babel/core": "^7.3.4", "@babel/core": "^7.4.0",
"@babel/node": "^7.2.2", "@babel/node": "^7.2.2",
"@babel/plugin-transform-modules-commonjs": "^7.2.0", "@babel/plugin-transform-modules-commonjs": "^7.4.0",
"@babel/polyfill": "^7.2.5", "@babel/polyfill": "^7.4.0",
"@babel/preset-env": "^7.3.4", "@babel/preset-env": "^7.4.2",
"@mysticatea/eslint-plugin": "^9.0.1", "@mysticatea/eslint-plugin": "^9.0.1",
"axe-testcafe": "^1.1.0", "axe-testcafe": "^1.1.0",
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3", "babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
"eslint": "5.15.2", "eslint": "5.16.0",
"eslint-config-ash-nazg": "0.5.0", "eslint-config-ash-nazg": "1.0.2",
"eslint-config-standard": "12.0.0", "eslint-config-standard": "12.0.0",
"eslint-plugin-compat": "^2.7.0", "eslint-plugin-compat": "^3.1.0",
"eslint-plugin-eslint-comments": "^3.1.1", "eslint-plugin-eslint-comments": "^3.1.1",
"eslint-plugin-import": "2.16.0", "eslint-plugin-import": "2.16.0",
"eslint-plugin-jsdoc": "^4.4.2", "eslint-plugin-jsdoc": "^4.6.0",
"eslint-plugin-markdown": "^1.0.0", "eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-no-use-extend-native": "^0.4.0", "eslint-plugin-no-use-extend-native": "^0.4.0",
"eslint-plugin-node": "8.0.1", "eslint-plugin-node": "8.0.1",
@ -98,7 +98,7 @@
"eslint-plugin-qunit": "^4.0.0", "eslint-plugin-qunit": "^4.0.0",
"eslint-plugin-standard": "4.0.0", "eslint-plugin-standard": "4.0.0",
"eslint-plugin-testcafe": "^0.2.1", "eslint-plugin-testcafe": "^0.2.1",
"eslint-plugin-unicorn": "^7.1.0", "eslint-plugin-unicorn": "^8.0.1",
"find-in-files": "^0.5.0", "find-in-files": "^0.5.0",
"imageoptim-cli": "^2.3.5", "imageoptim-cli": "^2.3.5",
"jamilih": "^0.44.0", "jamilih": "^0.44.0",
@ -112,15 +112,14 @@
"qunit": "^2.9.2", "qunit": "^2.9.2",
"remark-cli": "^6.0.1", "remark-cli": "^6.0.1",
"remark-lint-ordered-list-marker-value": "^1.0.2", "remark-lint-ordered-list-marker-value": "^1.0.2",
"rollup": "1.6.0", "rollup": "1.7.4",
"rollup-plugin-babel": "^4.3.2", "rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.1", "rollup-plugin-commonjs": "^9.2.2",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^4.0.1", "rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-re": "^1.0.7", "rollup-plugin-re": "^1.0.7",
"rollup-plugin-terser": "^4.0.4", "rollup-plugin-terser": "^4.0.4",
"sinon": "^7.2.7", "sinon": "^7.3.1",
"sinon-test": "^2.4.0", "sinon-test": "^2.4.0",
"stackblur-canvas": "^2.2.0", "stackblur-canvas": "^2.2.0",
"testcafe": "^1.1.0" "testcafe": "^1.1.0"

View File

@ -180,7 +180,7 @@ const SlideShow = function (slides) {
SlideShow.prototype = { SlideShow.prototype = {
_slides: [], _slides: [],
_update (dontPush) { _update (dontPush) {
document.querySelector('#presentation-counter').innerText = this.current; document.querySelector('#presentation-counter').textContent = this.current;
if (history.pushState) { if (history.pushState) {
if (!dontPush) { if (!dontPush) {
history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current); history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current);

View File

@ -6289,21 +6289,21 @@
}, { }, {
key: "addPtsToSelection", key: "addPtsToSelection",
value: function addPtsToSelection(indexes) { value: function addPtsToSelection(indexes) {
var _this = this;
if (!Array.isArray(indexes)) { if (!Array.isArray(indexes)) {
indexes = [indexes]; indexes = [indexes];
} }
for (var _i4 = 0; _i4 < indexes.length; _i4++) { indexes.forEach(function (index) {
var index = indexes[_i4]; var seg = _this.segs[index];
var seg = this.segs[index];
if (seg.ptgrip) { if (seg.ptgrip) {
if (!this.selected_pts.includes(index) && index >= 0) { if (!_this.selected_pts.includes(index) && index >= 0) {
this.selected_pts.push(index); _this.selected_pts.push(index);
} }
} }
} });
this.selected_pts.sort(); this.selected_pts.sort();
var i = this.selected_pts.length; var i = this.selected_pts.length;
var grips = []; var grips = [];
@ -6311,11 +6311,9 @@
while (i--) { while (i--) {
var pt = this.selected_pts[i]; var pt = this.selected_pts[i];
var _seg2 = this.segs[pt]; var seg = this.segs[pt];
seg.select(true);
_seg2.select(true); grips[i] = seg.ptgrip;
grips[i] = _seg2.ptgrip;
} }
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]); var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
@ -10846,6 +10844,8 @@
}, { }, {
key: "cloneLayer", key: "cloneLayer",
value: function cloneLayer(name, hrService) { value: function cloneLayer(name, hrService) {
var _this = this;
if (!this.current_layer) { if (!this.current_layer) {
return null; return null;
} }
@ -10861,17 +10861,15 @@
var layer = new Layer(name, currentGroup, this.svgElem_); var layer = new Layer(name, currentGroup, this.svgElem_);
var group = layer.getGroup(); // Clone children var group = layer.getGroup(); // Clone children
var children = currentGroup.childNodes; var children = _toConsumableArray(currentGroup.childNodes);
for (var _index = 0; _index < children.length; _index++) { children.forEach(function (child) {
var ch = children[_index]; if (child.localName === 'title') {
return;
if (ch.localName === 'title') {
continue;
} }
group.append(this.copyElem(ch)); group.append(_this.copyElem(child));
} });
if (hrService) { if (hrService) {
hrService.startBatchCommand('Duplicate Layer'); hrService.startBatchCommand('Duplicate Layer');
@ -16460,9 +16458,9 @@
var commaIndex = coords.indexOf(','); var commaIndex = coords.indexOf(',');
if (commaIndex >= 0) { if (commaIndex >= 0) {
keep = coords.indexOf(',', commaIndex + 1) >= 0; keep = coords.includes(',', commaIndex + 1);
} else { } else {
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0; keep = coords.includes(' ', coords.indexOf(' ') + 1);
} }
if (keep) { if (keep) {
@ -18740,10 +18738,29 @@
} }
var attrs = svg.attributes; var attrs = svg.attributes;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
for (var i = 0; i < attrs.length; i++) { try {
var attr = attrs[i]; for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
symbol.setAttribute(attr.nodeName, attr.value); var attr = _step.value;
// Ok for `NamedNodeMap`
symbol.setAttribute(attr.nodeName, attr.value);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
} }
symbol.id = getNextId(); // Store data symbol.id = getNextId(); // Store data
@ -31401,8 +31418,7 @@
setSelectMode(); setSelectMode();
} }
for (var _i = 0; _i < elems.length; ++_i) { elems.forEach(function (elem) {
var elem = elems[_i];
var isSvgElem = elem && elem.tagName === 'svg'; var isSvgElem = elem && elem.tagName === 'svg';
if (isSvgElem || isLayer(elem)) { if (isSvgElem || isLayer(elem)) {
@ -31417,8 +31433,7 @@
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why // || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
selectedElement = elem; selectedElement = elem;
} }
} });
editor.showSaveWarning = true; // we update the contextual panel with potentially new editor.showSaveWarning = true; // we update the contextual panel with potentially new
// positional/sizing information (we DON'T want to update the // positional/sizing information (we DON'T want to update the
// toolbar here as that creates an infinite loop) // toolbar here as that creates an infinite loop)
@ -34238,10 +34253,10 @@
if (isMac() && !window.opera) { if (isMac() && !window.opera) {
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone']; var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
var _i2 = shortcutButtons.length; var _i = shortcutButtons.length;
while (_i2--) { while (_i--) {
var button = document.getElementById(shortcutButtons[_i2]); var button = document.getElementById(shortcutButtons[_i]);
if (button) { if (button) {
var title = button.title; var title = button.title;
@ -34366,11 +34381,11 @@
var childs = selectedElement.getElementsByTagName('*'); var childs = selectedElement.getElementsByTagName('*');
var gPaint = null; var gPaint = null;
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) { for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
var elem = childs[_i3]; var elem = childs[_i2];
var p = elem.getAttribute(type); var p = elem.getAttribute(type);
if (_i3 === 0) { if (_i2 === 0) {
gPaint = p; gPaint = p;
} else if (gPaint !== p) { } else if (gPaint !== p) {
gPaint = null; gPaint = null;