@svgedit/svgcanvas 7.2.6 → 7.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +6 -0
- package/core/history.js +1 -1
- package/core/paint.js +15 -9
- package/core/recalculate.js +28 -9
- package/core/sanitize.js +31 -26
- package/core/svg-exec.js +4 -2
- package/core/utilities.js +36 -35
- package/dist/svgcanvas.js +295 -167
- package/dist/svgcanvas.js.map +1 -1
- package/package.json +1 -1
package/dist/svgcanvas.js
CHANGED
|
@@ -1520,7 +1520,7 @@ function _mergeNamespaces(n, m) {
|
|
|
1520
1520
|
class Paint {
|
|
1521
1521
|
/**
|
|
1522
1522
|
* @param {module:jGraduate.jGraduatePaintOptions} [opt]
|
|
1523
|
-
|
|
1523
|
+
*/
|
|
1524
1524
|
constructor(opt) {
|
|
1525
1525
|
const options = opt || {};
|
|
1526
1526
|
this.alpha = isNaN(options.alpha) ? 100 : options.alpha;
|
|
@@ -1571,8 +1571,9 @@ class Paint {
|
|
|
1571
1571
|
this.type = 'linearGradient';
|
|
1572
1572
|
this.solidColor = null;
|
|
1573
1573
|
this.radialGradient = null;
|
|
1574
|
-
|
|
1575
|
-
|
|
1574
|
+
const hrefAttr = options.linearGradient.getAttribute('href') || options.linearGradient.getAttribute('xlink:href');
|
|
1575
|
+
if (hrefAttr) {
|
|
1576
|
+
const xhref = document.getElementById(hrefAttr.replace(/^#/, ''));
|
|
1576
1577
|
this.linearGradient = xhref.cloneNode(true);
|
|
1577
1578
|
} else {
|
|
1578
1579
|
this.linearGradient = options.linearGradient.cloneNode(true);
|
|
@@ -1582,8 +1583,9 @@ class Paint {
|
|
|
1582
1583
|
this.type = 'radialGradient';
|
|
1583
1584
|
this.solidColor = null;
|
|
1584
1585
|
this.linearGradient = null;
|
|
1585
|
-
|
|
1586
|
-
|
|
1586
|
+
const hrefAttr = options.radialGradient.getAttribute('href') || options.radialGradient.getAttribute('xlink:href');
|
|
1587
|
+
if (hrefAttr) {
|
|
1588
|
+
const xhref = document.getElementById(hrefAttr.replace(/^#/, ''));
|
|
1587
1589
|
this.radialGradient = xhref.cloneNode(true);
|
|
1588
1590
|
} else {
|
|
1589
1591
|
this.radialGradient = options.radialGradient.cloneNode(true);
|
|
@@ -2584,21 +2586,22 @@ const getUrlFromAttr = function (attrVal) {
|
|
|
2584
2586
|
/**
|
|
2585
2587
|
* @function module:utilities.getHref
|
|
2586
2588
|
* @param {Element} elem
|
|
2587
|
-
* @returns {string} The given element's `
|
|
2589
|
+
* @returns {string} The given element's `href` value
|
|
2588
2590
|
*/
|
|
2589
2591
|
let getHref = function (elem) {
|
|
2590
|
-
|
|
2592
|
+
// Prefer 'href', fallback to 'xlink:href'
|
|
2593
|
+
return elem.getAttribute('href') || elem.getAttributeNS(NS.XLINK, 'href');
|
|
2591
2594
|
};
|
|
2592
2595
|
|
|
2593
2596
|
/**
|
|
2594
|
-
* Sets the given element's `
|
|
2597
|
+
* Sets the given element's `href` value.
|
|
2595
2598
|
* @function module:utilities.setHref
|
|
2596
2599
|
* @param {Element} elem
|
|
2597
2600
|
* @param {string} val
|
|
2598
2601
|
* @returns {void}
|
|
2599
2602
|
*/
|
|
2600
2603
|
let setHref = function (elem, val) {
|
|
2601
|
-
elem.
|
|
2604
|
+
elem.setAttribute('href', val);
|
|
2602
2605
|
};
|
|
2603
2606
|
|
|
2604
2607
|
/**
|
|
@@ -2773,8 +2776,7 @@ const getPathDFromElement = function (elem) {
|
|
|
2773
2776
|
const h = b.height;
|
|
2774
2777
|
num = 4 - num; // Why? Because!
|
|
2775
2778
|
|
|
2776
|
-
d = !rx && !ry
|
|
2777
|
-
// Regular rect
|
|
2779
|
+
d = !rx && !ry // Regular rect
|
|
2778
2780
|
? getPathDFromSegments([['M', [x, y]], ['L', [x + w, y]], ['L', [x + w, y + h]], ['L', [x, y + h]], ['L', [x, y]], ['Z', []]]) : getPathDFromSegments([['M', [x, y + ry]], ['C', [x, y + ry / num, x + rx / num, y, x + rx, y]], ['L', [x + w - rx, y]], ['C', [x + w - rx / num, y, x + w, y + ry / num, x + w, y + ry]], ['L', [x + w, y + h - ry]], ['C', [x + w, y + h - ry / num, x + w - rx / num, y + h, x + w - rx, y + h]], ['L', [x + rx, y + h]], ['C', [x + rx / num, y + h, x, y + h - ry / num, x, y + h - ry]], ['L', [x, y + ry]], ['Z', []]]);
|
|
2779
2781
|
break;
|
|
2780
2782
|
}
|
|
@@ -3738,7 +3740,7 @@ let BatchCommand$4 = class BatchCommand extends Command {
|
|
|
3738
3740
|
*/
|
|
3739
3741
|
unapply(handler) {
|
|
3740
3742
|
super.unapply(handler, () => {
|
|
3741
|
-
this.stack.reverse().forEach(stackItem => {
|
|
3743
|
+
[...this.stack].reverse().forEach(stackItem => {
|
|
3742
3744
|
console.assert(stackItem, 'stack item should not be null');
|
|
3743
3745
|
stackItem && stackItem.unapply(handler);
|
|
3744
3746
|
});
|
|
@@ -4975,7 +4977,7 @@ class Path {
|
|
|
4975
4977
|
*/
|
|
4976
4978
|
|
|
4977
4979
|
let svgCanvas$g = null;
|
|
4978
|
-
let path$
|
|
4980
|
+
let path$2 = null;
|
|
4979
4981
|
|
|
4980
4982
|
/**
|
|
4981
4983
|
* @function module:path-actions.init
|
|
@@ -5357,7 +5359,7 @@ const pathActionsMethod = function () {
|
|
|
5357
5359
|
}));
|
|
5358
5360
|
// set stretchy line to first point
|
|
5359
5361
|
stretchy.setAttribute('d', ['M', mouseX, mouseY, mouseX, mouseY].join(' '));
|
|
5360
|
-
index = subpath ? path$
|
|
5362
|
+
index = subpath ? path$2.segs.length : 0;
|
|
5361
5363
|
svgCanvas$g.addPointGrip(index, mouseX, mouseY);
|
|
5362
5364
|
} else {
|
|
5363
5365
|
// determine if we clicked on an existing point
|
|
@@ -5414,18 +5416,18 @@ const pathActionsMethod = function () {
|
|
|
5414
5416
|
svgCanvas$g.setDrawnPath(null);
|
|
5415
5417
|
svgCanvas$g.setStarted(false);
|
|
5416
5418
|
if (subpath) {
|
|
5417
|
-
if (path$
|
|
5418
|
-
svgCanvas$g.remapElement(newpath, {}, path$
|
|
5419
|
+
if (path$2.matrix) {
|
|
5420
|
+
svgCanvas$g.remapElement(newpath, {}, path$2.matrix.inverse());
|
|
5419
5421
|
}
|
|
5420
5422
|
const newD = newpath.getAttribute('d');
|
|
5421
|
-
const origD = path$
|
|
5422
|
-
path$
|
|
5423
|
+
const origD = path$2.elem.getAttribute('d');
|
|
5424
|
+
path$2.elem.setAttribute('d', origD + newD);
|
|
5423
5425
|
newpath.parentNode.removeChild(newpath);
|
|
5424
|
-
if (path$
|
|
5426
|
+
if (path$2.matrix) {
|
|
5425
5427
|
svgCanvas$g.recalcRotatedPath();
|
|
5426
5428
|
}
|
|
5427
|
-
pathActionsMethod.toEditMode(path$
|
|
5428
|
-
path$
|
|
5429
|
+
pathActionsMethod.toEditMode(path$2.elem);
|
|
5430
|
+
path$2.selectPt();
|
|
5429
5431
|
return false;
|
|
5430
5432
|
}
|
|
5431
5433
|
// else, create a new point, update path element
|
|
@@ -5458,7 +5460,7 @@ const pathActionsMethod = function () {
|
|
|
5458
5460
|
stretchy.setAttribute('d', ['M', x, y, x, y].join(' '));
|
|
5459
5461
|
index = num;
|
|
5460
5462
|
if (subpath) {
|
|
5461
|
-
index += path$
|
|
5463
|
+
index += path$2.segs.length;
|
|
5462
5464
|
}
|
|
5463
5465
|
svgCanvas$g.addPointGrip(index, x, y);
|
|
5464
5466
|
}
|
|
@@ -5468,42 +5470,42 @@ const pathActionsMethod = function () {
|
|
|
5468
5470
|
}
|
|
5469
5471
|
|
|
5470
5472
|
// TODO: Make sure currentPath isn't null at this point
|
|
5471
|
-
if (!path$
|
|
5473
|
+
if (!path$2) {
|
|
5472
5474
|
return undefined;
|
|
5473
5475
|
}
|
|
5474
|
-
path$
|
|
5476
|
+
path$2.storeD();
|
|
5475
5477
|
({
|
|
5476
5478
|
id
|
|
5477
5479
|
} = evt.target);
|
|
5478
5480
|
let curPt;
|
|
5479
5481
|
if (id.substr(0, 14) === 'pathpointgrip_') {
|
|
5480
5482
|
// Select this point
|
|
5481
|
-
curPt = path$
|
|
5482
|
-
path$
|
|
5483
|
-
const seg = path$
|
|
5483
|
+
curPt = path$2.cur_pt = Number.parseInt(id.substr(14));
|
|
5484
|
+
path$2.dragging = [startX, startY];
|
|
5485
|
+
const seg = path$2.segs[curPt];
|
|
5484
5486
|
|
|
5485
5487
|
// only clear selection if shift is not pressed (otherwise, add
|
|
5486
5488
|
// node to selection)
|
|
5487
5489
|
if (!evt.shiftKey) {
|
|
5488
|
-
if (path$
|
|
5489
|
-
path$
|
|
5490
|
+
if (path$2.selected_pts.length <= 1 || !seg.selected) {
|
|
5491
|
+
path$2.clearSelection();
|
|
5490
5492
|
}
|
|
5491
|
-
path$
|
|
5493
|
+
path$2.addPtsToSelection(curPt);
|
|
5492
5494
|
} else if (seg.selected) {
|
|
5493
|
-
path$
|
|
5495
|
+
path$2.removePtFromSelection(curPt);
|
|
5494
5496
|
} else {
|
|
5495
|
-
path$
|
|
5497
|
+
path$2.addPtsToSelection(curPt);
|
|
5496
5498
|
}
|
|
5497
5499
|
} else if (id.startsWith('ctrlpointgrip_')) {
|
|
5498
|
-
path$
|
|
5500
|
+
path$2.dragging = [startX, startY];
|
|
5499
5501
|
const parts = id.split('_')[1].split('c');
|
|
5500
5502
|
curPt = Number(parts[0]);
|
|
5501
5503
|
const ctrlNum = Number(parts[1]);
|
|
5502
|
-
path$
|
|
5504
|
+
path$2.selectPt(curPt, ctrlNum);
|
|
5503
5505
|
}
|
|
5504
5506
|
|
|
5505
5507
|
// Start selection box
|
|
5506
|
-
if (!path$
|
|
5508
|
+
if (!path$2.dragging) {
|
|
5507
5509
|
let rubberBox = svgCanvas$g.getRubberBox();
|
|
5508
5510
|
if (!rubberBox) {
|
|
5509
5511
|
rubberBox = svgCanvas$g.setRubberBox(svgCanvas$g.selectorManager.getRubberBandBox());
|
|
@@ -5599,26 +5601,26 @@ const pathActionsMethod = function () {
|
|
|
5599
5601
|
return;
|
|
5600
5602
|
}
|
|
5601
5603
|
// if we are dragging a point, let's move it
|
|
5602
|
-
if (path$
|
|
5604
|
+
if (path$2.dragging) {
|
|
5603
5605
|
const pt = svgCanvas$g.getPointFromGrip({
|
|
5604
|
-
x: path$
|
|
5605
|
-
y: path$
|
|
5606
|
-
}, path$
|
|
5606
|
+
x: path$2.dragging[0],
|
|
5607
|
+
y: path$2.dragging[1]
|
|
5608
|
+
}, path$2);
|
|
5607
5609
|
const mpt = svgCanvas$g.getPointFromGrip({
|
|
5608
5610
|
x: mouseX,
|
|
5609
5611
|
y: mouseY
|
|
5610
|
-
}, path$
|
|
5612
|
+
}, path$2);
|
|
5611
5613
|
const diffX = mpt.x - pt.x;
|
|
5612
5614
|
const diffY = mpt.y - pt.y;
|
|
5613
|
-
path$
|
|
5614
|
-
if (path$
|
|
5615
|
-
path$
|
|
5615
|
+
path$2.dragging = [mouseX, mouseY];
|
|
5616
|
+
if (path$2.dragctrl) {
|
|
5617
|
+
path$2.moveCtrl(diffX, diffY);
|
|
5616
5618
|
} else {
|
|
5617
|
-
path$
|
|
5619
|
+
path$2.movePts(diffX, diffY);
|
|
5618
5620
|
}
|
|
5619
5621
|
} else {
|
|
5620
|
-
path$
|
|
5621
|
-
path$
|
|
5622
|
+
path$2.selected_pts = [];
|
|
5623
|
+
path$2.eachSeg(function (_i) {
|
|
5622
5624
|
const seg = this;
|
|
5623
5625
|
if (!seg.next && !seg.prev) {
|
|
5624
5626
|
return;
|
|
@@ -5638,7 +5640,7 @@ const pathActionsMethod = function () {
|
|
|
5638
5640
|
this.select(sel);
|
|
5639
5641
|
// Note that addPtsToSelection is not being run
|
|
5640
5642
|
if (sel) {
|
|
5641
|
-
path$
|
|
5643
|
+
path$2.selected_pts.push(seg.index);
|
|
5642
5644
|
}
|
|
5643
5645
|
});
|
|
5644
5646
|
}
|
|
@@ -5674,16 +5676,16 @@ const pathActionsMethod = function () {
|
|
|
5674
5676
|
|
|
5675
5677
|
// Edit mode
|
|
5676
5678
|
const rubberBox = svgCanvas$g.getRubberBox();
|
|
5677
|
-
if (path$
|
|
5678
|
-
const lastPt = path$
|
|
5679
|
-
path$
|
|
5680
|
-
path$
|
|
5681
|
-
path$
|
|
5679
|
+
if (path$2.dragging) {
|
|
5680
|
+
const lastPt = path$2.cur_pt;
|
|
5681
|
+
path$2.dragging = false;
|
|
5682
|
+
path$2.dragctrl = false;
|
|
5683
|
+
path$2.update();
|
|
5682
5684
|
if (hasMoved) {
|
|
5683
|
-
path$
|
|
5685
|
+
path$2.endChanges('Move path point(s)');
|
|
5684
5686
|
}
|
|
5685
5687
|
if (!evt.shiftKey && !hasMoved) {
|
|
5686
|
-
path$
|
|
5688
|
+
path$2.selectPt(lastPt);
|
|
5687
5689
|
}
|
|
5688
5690
|
} else if (rubberBox?.getAttribute('display') !== 'none') {
|
|
5689
5691
|
// Done with multi-node-select
|
|
@@ -5704,12 +5706,12 @@ const pathActionsMethod = function () {
|
|
|
5704
5706
|
* @returns {void}
|
|
5705
5707
|
*/
|
|
5706
5708
|
toEditMode(element) {
|
|
5707
|
-
path$
|
|
5709
|
+
path$2 = svgCanvas$g.getPath_(element);
|
|
5708
5710
|
svgCanvas$g.setCurrentMode('pathedit');
|
|
5709
5711
|
svgCanvas$g.clearSelection();
|
|
5710
|
-
path$
|
|
5711
|
-
path$
|
|
5712
|
-
path$
|
|
5712
|
+
path$2.setPathContext();
|
|
5713
|
+
path$2.show(true).update();
|
|
5714
|
+
path$2.oldbbox = getBBox(path$2.elem);
|
|
5713
5715
|
subpath = false;
|
|
5714
5716
|
},
|
|
5715
5717
|
/**
|
|
@@ -5718,13 +5720,13 @@ const pathActionsMethod = function () {
|
|
|
5718
5720
|
* @returns {void}
|
|
5719
5721
|
*/
|
|
5720
5722
|
toSelectMode(elem) {
|
|
5721
|
-
const selPath = elem === path$
|
|
5723
|
+
const selPath = elem === path$2.elem;
|
|
5722
5724
|
svgCanvas$g.setCurrentMode('select');
|
|
5723
|
-
path$
|
|
5724
|
-
path$
|
|
5725
|
+
path$2.setPathContext();
|
|
5726
|
+
path$2.show(false);
|
|
5725
5727
|
currentPath = false;
|
|
5726
5728
|
svgCanvas$g.clearSelection();
|
|
5727
|
-
if (path$
|
|
5729
|
+
if (path$2.matrix) {
|
|
5728
5730
|
// Rotated, so may need to re-calculate the center
|
|
5729
5731
|
svgCanvas$g.recalcRotatedPath();
|
|
5730
5732
|
}
|
|
@@ -5745,7 +5747,7 @@ const pathActionsMethod = function () {
|
|
|
5745
5747
|
subpath = true;
|
|
5746
5748
|
} else {
|
|
5747
5749
|
pathActionsMethod.clear(true);
|
|
5748
|
-
pathActionsMethod.toEditMode(path$
|
|
5750
|
+
pathActionsMethod.toEditMode(path$2.elem);
|
|
5749
5751
|
}
|
|
5750
5752
|
},
|
|
5751
5753
|
/**
|
|
@@ -5813,8 +5815,8 @@ const pathActionsMethod = function () {
|
|
|
5813
5815
|
} else if (svgCanvas$g.getCurrentMode() === 'pathedit') {
|
|
5814
5816
|
this.toSelectMode();
|
|
5815
5817
|
}
|
|
5816
|
-
if (path$
|
|
5817
|
-
path$
|
|
5818
|
+
if (path$2) {
|
|
5819
|
+
path$2.init().show(false);
|
|
5818
5820
|
}
|
|
5819
5821
|
},
|
|
5820
5822
|
/**
|
|
@@ -5869,7 +5871,7 @@ const pathActionsMethod = function () {
|
|
|
5869
5871
|
*/
|
|
5870
5872
|
zoomChange() {
|
|
5871
5873
|
if (svgCanvas$g.getCurrentMode() === 'pathedit') {
|
|
5872
|
-
path$
|
|
5874
|
+
path$2.update();
|
|
5873
5875
|
}
|
|
5874
5876
|
},
|
|
5875
5877
|
/**
|
|
@@ -5882,8 +5884,8 @@ const pathActionsMethod = function () {
|
|
|
5882
5884
|
* @returns {module:path.NodePoint}
|
|
5883
5885
|
*/
|
|
5884
5886
|
getNodePoint() {
|
|
5885
|
-
const selPt = path$
|
|
5886
|
-
const seg = path$
|
|
5887
|
+
const selPt = path$2.selected_pts.length ? path$2.selected_pts[0] : 1;
|
|
5888
|
+
const seg = path$2.segs[selPt];
|
|
5887
5889
|
return {
|
|
5888
5890
|
x: seg.item.x,
|
|
5889
5891
|
y: seg.item.y,
|
|
@@ -5901,33 +5903,33 @@ const pathActionsMethod = function () {
|
|
|
5901
5903
|
* @returns {void}
|
|
5902
5904
|
*/
|
|
5903
5905
|
clonePathNode() {
|
|
5904
|
-
path$
|
|
5905
|
-
const selPts = path$
|
|
5906
|
+
path$2.storeD();
|
|
5907
|
+
const selPts = path$2.selected_pts;
|
|
5906
5908
|
// const {segs} = path;
|
|
5907
5909
|
|
|
5908
5910
|
let i = selPts.length;
|
|
5909
5911
|
const nums = [];
|
|
5910
5912
|
while (i--) {
|
|
5911
5913
|
const pt = selPts[i];
|
|
5912
|
-
path$
|
|
5914
|
+
path$2.addSeg(pt);
|
|
5913
5915
|
nums.push(pt + i);
|
|
5914
5916
|
nums.push(pt + i + 1);
|
|
5915
5917
|
}
|
|
5916
|
-
path$
|
|
5917
|
-
path$
|
|
5918
|
+
path$2.init().addPtsToSelection(nums);
|
|
5919
|
+
path$2.endChanges('Clone path node(s)');
|
|
5918
5920
|
},
|
|
5919
5921
|
/**
|
|
5920
5922
|
* @returns {void}
|
|
5921
5923
|
*/
|
|
5922
5924
|
opencloseSubPath() {
|
|
5923
|
-
const selPts = path$
|
|
5925
|
+
const selPts = path$2.selected_pts;
|
|
5924
5926
|
// Only allow one selected node for now
|
|
5925
5927
|
if (selPts.length !== 1) {
|
|
5926
5928
|
return;
|
|
5927
5929
|
}
|
|
5928
5930
|
const {
|
|
5929
5931
|
elem
|
|
5930
|
-
} = path$
|
|
5932
|
+
} = path$2;
|
|
5931
5933
|
const list = elem.pathSegList;
|
|
5932
5934
|
|
|
5933
5935
|
// const len = list.numberOfItems;
|
|
@@ -5937,7 +5939,7 @@ const pathActionsMethod = function () {
|
|
|
5937
5939
|
let startItem = null;
|
|
5938
5940
|
|
|
5939
5941
|
// Check if subpath is already open
|
|
5940
|
-
path$
|
|
5942
|
+
path$2.eachSeg(function (i) {
|
|
5941
5943
|
if (this.type === 2 && i <= index) {
|
|
5942
5944
|
startItem = this.item;
|
|
5943
5945
|
}
|
|
@@ -5958,7 +5960,7 @@ const pathActionsMethod = function () {
|
|
|
5958
5960
|
});
|
|
5959
5961
|
if (!openPt) {
|
|
5960
5962
|
// Single path, so close last seg
|
|
5961
|
-
openPt = path$
|
|
5963
|
+
openPt = path$2.segs.length - 1;
|
|
5962
5964
|
}
|
|
5963
5965
|
if (openPt !== false) {
|
|
5964
5966
|
// Close this path
|
|
@@ -5966,14 +5968,14 @@ const pathActionsMethod = function () {
|
|
|
5966
5968
|
// Create a line going to the previous "M"
|
|
5967
5969
|
const newseg = elem.createSVGPathSegLinetoAbs(startItem.x, startItem.y);
|
|
5968
5970
|
const closer = elem.createSVGPathSegClosePath();
|
|
5969
|
-
if (openPt === path$
|
|
5971
|
+
if (openPt === path$2.segs.length - 1) {
|
|
5970
5972
|
list.appendItem(newseg);
|
|
5971
5973
|
list.appendItem(closer);
|
|
5972
5974
|
} else {
|
|
5973
5975
|
list.insertItemBefore(closer, openPt);
|
|
5974
5976
|
list.insertItemBefore(newseg, openPt);
|
|
5975
5977
|
}
|
|
5976
|
-
path$
|
|
5978
|
+
path$2.init().selectPt(openPt + 1);
|
|
5977
5979
|
return;
|
|
5978
5980
|
}
|
|
5979
5981
|
|
|
@@ -5983,11 +5985,11 @@ const pathActionsMethod = function () {
|
|
|
5983
5985
|
// M 1,1 L 2,2 L 1,1 z M 4,4 L 5,5 L6,6 L 5,5 z
|
|
5984
5986
|
// M 1,1 L 2,2 L 1,1 z [M 4,4] L 5,5 L(M)6,6 L 5,5 z
|
|
5985
5987
|
|
|
5986
|
-
const seg = path$
|
|
5988
|
+
const seg = path$2.segs[index];
|
|
5987
5989
|
if (seg.mate) {
|
|
5988
5990
|
list.removeItem(index); // Removes last "L"
|
|
5989
5991
|
list.removeItem(index); // Removes the "Z"
|
|
5990
|
-
path$
|
|
5992
|
+
path$2.init().selectPt(index - 1);
|
|
5991
5993
|
return;
|
|
5992
5994
|
}
|
|
5993
5995
|
let lastM;
|
|
@@ -6021,7 +6023,7 @@ const pathActionsMethod = function () {
|
|
|
6021
6023
|
|
|
6022
6024
|
// i = index; // i is local here, so has no effect; what was the intent for this?
|
|
6023
6025
|
|
|
6024
|
-
path$
|
|
6026
|
+
path$2.init().selectPt(0);
|
|
6025
6027
|
},
|
|
6026
6028
|
/**
|
|
6027
6029
|
* @returns {void}
|
|
@@ -6030,17 +6032,17 @@ const pathActionsMethod = function () {
|
|
|
6030
6032
|
if (!pathActionsMethod.canDeleteNodes) {
|
|
6031
6033
|
return;
|
|
6032
6034
|
}
|
|
6033
|
-
path$
|
|
6034
|
-
const selPts = path$
|
|
6035
|
+
path$2.storeD();
|
|
6036
|
+
const selPts = path$2.selected_pts;
|
|
6035
6037
|
let i = selPts.length;
|
|
6036
6038
|
while (i--) {
|
|
6037
6039
|
const pt = selPts[i];
|
|
6038
|
-
path$
|
|
6040
|
+
path$2.deleteSeg(pt);
|
|
6039
6041
|
}
|
|
6040
6042
|
|
|
6041
6043
|
// Cleanup
|
|
6042
6044
|
const cleanup = function () {
|
|
6043
|
-
const segList = path$
|
|
6045
|
+
const segList = path$2.elem.pathSegList;
|
|
6044
6046
|
let len = segList.numberOfItems;
|
|
6045
6047
|
const remItems = function (pos, count) {
|
|
6046
6048
|
while (count--) {
|
|
@@ -6084,21 +6086,21 @@ const pathActionsMethod = function () {
|
|
|
6084
6086
|
cleanup();
|
|
6085
6087
|
|
|
6086
6088
|
// Completely delete a path with 1 or 0 segments
|
|
6087
|
-
if (path$
|
|
6088
|
-
pathActionsMethod.toSelectMode(path$
|
|
6089
|
+
if (path$2.elem.pathSegList.numberOfItems <= 1) {
|
|
6090
|
+
pathActionsMethod.toSelectMode(path$2.elem);
|
|
6089
6091
|
svgCanvas$g.canvas.deleteSelectedElements();
|
|
6090
6092
|
return;
|
|
6091
6093
|
}
|
|
6092
|
-
path$
|
|
6093
|
-
path$
|
|
6094
|
+
path$2.init();
|
|
6095
|
+
path$2.clearSelection();
|
|
6094
6096
|
|
|
6095
6097
|
// TODO: Find right way to select point now
|
|
6096
6098
|
// path.selectPt(selPt);
|
|
6097
6099
|
if (window.opera) {
|
|
6098
6100
|
// Opera repaints incorrectly
|
|
6099
|
-
path$
|
|
6101
|
+
path$2.elem.setAttribute('d', path$2.elem.getAttribute('d'));
|
|
6100
6102
|
}
|
|
6101
|
-
path$
|
|
6103
|
+
path$2.endChanges('Delete path node(s)');
|
|
6102
6104
|
},
|
|
6103
6105
|
// Can't seem to use `@borrows` here, so using `@see`
|
|
6104
6106
|
/**
|
|
@@ -6113,7 +6115,7 @@ const pathActionsMethod = function () {
|
|
|
6113
6115
|
* @returns {void}
|
|
6114
6116
|
*/
|
|
6115
6117
|
setSegType(v) {
|
|
6116
|
-
path$
|
|
6118
|
+
path$2?.setSegType(v);
|
|
6117
6119
|
},
|
|
6118
6120
|
/**
|
|
6119
6121
|
* @param {string} attr
|
|
@@ -6121,21 +6123,21 @@ const pathActionsMethod = function () {
|
|
|
6121
6123
|
* @returns {void}
|
|
6122
6124
|
*/
|
|
6123
6125
|
moveNode(attr, newValue) {
|
|
6124
|
-
const selPts = path$
|
|
6126
|
+
const selPts = path$2.selected_pts;
|
|
6125
6127
|
if (!selPts.length) {
|
|
6126
6128
|
return;
|
|
6127
6129
|
}
|
|
6128
|
-
path$
|
|
6130
|
+
path$2.storeD();
|
|
6129
6131
|
|
|
6130
6132
|
// Get first selected point
|
|
6131
|
-
const seg = path$
|
|
6133
|
+
const seg = path$2.segs[selPts[0]];
|
|
6132
6134
|
const diff = {
|
|
6133
6135
|
x: 0,
|
|
6134
6136
|
y: 0
|
|
6135
6137
|
};
|
|
6136
6138
|
diff[attr] = newValue - seg.item[attr];
|
|
6137
6139
|
seg.move(diff.x, diff.y);
|
|
6138
|
-
path$
|
|
6140
|
+
path$2.endChanges('Move path point');
|
|
6139
6141
|
},
|
|
6140
6142
|
/**
|
|
6141
6143
|
* @param {Element} elem
|
|
@@ -6243,7 +6245,7 @@ const setLinkControlPoints = lcp => {
|
|
|
6243
6245
|
* @type {null|module:path.Path}
|
|
6244
6246
|
* @memberof module:path
|
|
6245
6247
|
*/
|
|
6246
|
-
let path = null;
|
|
6248
|
+
let path$1 = null;
|
|
6247
6249
|
|
|
6248
6250
|
/**
|
|
6249
6251
|
* @external MouseEvent
|
|
@@ -6412,10 +6414,10 @@ const init$g = canvas => {
|
|
|
6412
6414
|
return uiStrings;
|
|
6413
6415
|
};
|
|
6414
6416
|
svgCanvas$f.getPathObj = () => {
|
|
6415
|
-
return path;
|
|
6417
|
+
return path$1;
|
|
6416
6418
|
};
|
|
6417
6419
|
svgCanvas$f.setPathObj = obj => {
|
|
6418
|
-
path = obj;
|
|
6420
|
+
path$1 = obj;
|
|
6419
6421
|
};
|
|
6420
6422
|
svgCanvas$f.getPathFuncs = () => {
|
|
6421
6423
|
return pathFuncs;
|
|
@@ -6646,13 +6648,13 @@ const getRotVals = (x, y) => {
|
|
|
6646
6648
|
* @returns {void}
|
|
6647
6649
|
*/
|
|
6648
6650
|
const recalcRotatedPath = () => {
|
|
6649
|
-
const currentPath = path.elem;
|
|
6651
|
+
const currentPath = path$1.elem;
|
|
6650
6652
|
angle = getRotationAngle(currentPath, true);
|
|
6651
6653
|
if (!angle) {
|
|
6652
6654
|
return;
|
|
6653
6655
|
}
|
|
6654
6656
|
// selectedBBoxes[0] = path.oldbbox;
|
|
6655
|
-
const oldbox = path.oldbbox; // selectedBBoxes[0],
|
|
6657
|
+
const oldbox = path$1.oldbbox; // selectedBBoxes[0],
|
|
6656
6658
|
oldcx = oldbox.x + oldbox.width / 2;
|
|
6657
6659
|
oldcy = oldbox.y + oldbox.height / 2;
|
|
6658
6660
|
const box = getBBox(currentPath);
|
|
@@ -6999,7 +7001,7 @@ var pathModule = /*#__PURE__*/Object.freeze({
|
|
|
6999
7001
|
getPointGrip: getPointGrip,
|
|
7000
7002
|
getSegSelector: getSegSelector,
|
|
7001
7003
|
init: init$g,
|
|
7002
|
-
get path () { return path; },
|
|
7004
|
+
get path () { return path$1; },
|
|
7003
7005
|
pathActions: pathActions,
|
|
7004
7006
|
ptObjToArr: ptObjToArr,
|
|
7005
7007
|
recalcRotatedPath: recalcRotatedPath,
|
|
@@ -13095,12 +13097,37 @@ const recalculateDimensions = selected => {
|
|
|
13095
13097
|
// Handle rotation transformations
|
|
13096
13098
|
const angle = getRotationAngle(selected);
|
|
13097
13099
|
if (angle) {
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
x
|
|
13101
|
-
y
|
|
13102
|
-
|
|
13103
|
-
|
|
13100
|
+
if (selected.localName === 'image') {
|
|
13101
|
+
// Use the center of the image as the rotation center
|
|
13102
|
+
const xAttr = convertToNum('x', selected.getAttribute('x') || '0');
|
|
13103
|
+
const yAttr = convertToNum('y', selected.getAttribute('y') || '0');
|
|
13104
|
+
const width = convertToNum('width', selected.getAttribute('width') || '0');
|
|
13105
|
+
const height = convertToNum('height', selected.getAttribute('height') || '0');
|
|
13106
|
+
const cx = xAttr + width / 2;
|
|
13107
|
+
const cy = yAttr + height / 2;
|
|
13108
|
+
oldcenter = {
|
|
13109
|
+
x: cx,
|
|
13110
|
+
y: cy
|
|
13111
|
+
};
|
|
13112
|
+
const transform = transformListToTransform(tlist).matrix;
|
|
13113
|
+
newcenter = transformPoint(cx, cy, transform);
|
|
13114
|
+
} else if (selected.localName === 'text') {
|
|
13115
|
+
// Use the center of the bounding box as the rotation center for text
|
|
13116
|
+
const cx = box.x + box.width / 2;
|
|
13117
|
+
const cy = box.y + box.height / 2;
|
|
13118
|
+
oldcenter = {
|
|
13119
|
+
x: cx,
|
|
13120
|
+
y: cy
|
|
13121
|
+
};
|
|
13122
|
+
newcenter = transformPoint(cx, cy, transformListToTransform(tlist).matrix);
|
|
13123
|
+
} else {
|
|
13124
|
+
// Include x and y in the rotation center calculation for other elements
|
|
13125
|
+
oldcenter = {
|
|
13126
|
+
x: box.x + box.width / 2 + x,
|
|
13127
|
+
y: box.y + box.height / 2 + y
|
|
13128
|
+
};
|
|
13129
|
+
newcenter = transformPoint(box.x + box.width / 2 + x, box.y + box.height / 2 + y, transformListToTransform(tlist).matrix);
|
|
13130
|
+
}
|
|
13104
13131
|
|
|
13105
13132
|
// Remove the rotation transform from the list
|
|
13106
13133
|
for (let i = 0; i < tlist.numberOfItems; ++i) {
|
|
@@ -14615,7 +14642,7 @@ const REVERSE_NS = getReverseNS();
|
|
|
14615
14642
|
const svgGenericWhiteList = ['class', 'id', 'display', 'transform', 'style'];
|
|
14616
14643
|
const svgWhiteList_ = {
|
|
14617
14644
|
// SVG Elements
|
|
14618
|
-
a: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'xlink:href', 'xlink:title'],
|
|
14645
|
+
a: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'href', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'xlink:href', 'xlink:title'],
|
|
14619
14646
|
circle: ['clip-path', 'clip-rule', 'cx', 'cy', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'r', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage'],
|
|
14620
14647
|
clipPath: ['clipPathUnits'],
|
|
14621
14648
|
defs: [],
|
|
@@ -14630,20 +14657,20 @@ const svgWhiteList_ = {
|
|
|
14630
14657
|
feMergeNode: ['in'],
|
|
14631
14658
|
feMorphology: ['in', 'operator', 'radius'],
|
|
14632
14659
|
feOffset: ['dx', 'in', 'dy', 'result'],
|
|
14633
|
-
filter: ['color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'],
|
|
14660
|
+
filter: ['color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'href', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'],
|
|
14634
14661
|
foreignObject: ['font-size', 'height', 'opacity', 'requiredFeatures', 'width', 'x', 'y'],
|
|
14635
14662
|
g: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-anchor'],
|
|
14636
|
-
image: ['clip-path', 'clip-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'systemLanguage', 'width', 'x', 'xlink:href', 'xlink:title', 'y'],
|
|
14663
|
+
image: ['clip-path', 'clip-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'systemLanguage', 'width', 'x', 'href', 'xlink:href', 'xlink:title', 'y'],
|
|
14637
14664
|
line: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'x1', 'x2', 'y1', 'y2'],
|
|
14638
|
-
linearGradient: ['gradientTransform', 'gradientUnits', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'x1', 'x2', 'xlink:href', 'y1', 'y2'],
|
|
14665
|
+
linearGradient: ['gradientTransform', 'gradientUnits', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'x1', 'x2', 'href', 'xlink:href', 'y1', 'y2'],
|
|
14639
14666
|
marker: ['markerHeight', 'markerUnits', 'markerWidth', 'orient', 'preserveAspectRatio', 'refX', 'refY', 'se_type', 'systemLanguage', 'viewBox'],
|
|
14640
14667
|
mask: ['height', 'maskContentUnits', 'maskUnits', 'width', 'x', 'y'],
|
|
14641
14668
|
metadata: [],
|
|
14642
14669
|
path: ['clip-path', 'clip-rule', 'd', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage'],
|
|
14643
|
-
pattern: ['height', 'patternContentUnits', 'patternTransform', 'patternUnits', 'requiredFeatures', 'systemLanguage', 'viewBox', 'width', 'x', 'xlink:href', 'y'],
|
|
14670
|
+
pattern: ['height', 'patternContentUnits', 'patternTransform', 'patternUnits', 'requiredFeatures', 'systemLanguage', 'viewBox', 'width', 'x', 'href', 'xlink:href', 'y'],
|
|
14644
14671
|
polygon: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'sides', 'shape', 'edge', 'point', 'starRadiusMultiplier', 'r', 'radialshift', 'r2', 'orient', 'cx', 'cy'],
|
|
14645
14672
|
polyline: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'se:connector'],
|
|
14646
|
-
radialGradient: ['cx', 'cy', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'r', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'xlink:href'],
|
|
14673
|
+
radialGradient: ['cx', 'cy', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'r', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'href', 'xlink:href'],
|
|
14647
14674
|
rect: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'rx', 'ry', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'width', 'x', 'y'],
|
|
14648
14675
|
stop: ['offset', 'requiredFeatures', 'stop-opacity', 'systemLanguage', 'stop-color', 'gradientUnits', 'gradientTransform'],
|
|
14649
14676
|
style: ['type'],
|
|
@@ -14651,10 +14678,10 @@ const svgWhiteList_ = {
|
|
|
14651
14678
|
switch: ['requiredFeatures', 'systemLanguage'],
|
|
14652
14679
|
symbol: ['fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'opacity', 'overflow', 'preserveAspectRatio', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'viewBox', 'width', 'height'],
|
|
14653
14680
|
text: ['clip-path', 'clip-rule', 'dominant-baseline', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'text-anchor', 'letter-spacing', 'word-spacing', 'text-decoration', 'textLength', 'lengthAdjust', 'x', 'xml:space', 'y'],
|
|
14654
|
-
textPath: ['dominant-baseline', 'method', 'requiredFeatures', 'spacing', 'startOffset', 'systemLanguage', 'xlink:href'],
|
|
14681
|
+
textPath: ['dominant-baseline', 'href', 'method', 'requiredFeatures', 'spacing', 'startOffset', 'systemLanguage', 'xlink:href'],
|
|
14655
14682
|
title: [],
|
|
14656
14683
|
tspan: ['clip-path', 'clip-rule', 'dx', 'dy', 'dominant-baseline', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'mask', 'opacity', 'requiredFeatures', 'rotate', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'text-anchor', 'textLength', 'x', 'xml:space', 'y'],
|
|
14657
|
-
use: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'width', 'x', 'xlink:href', 'y', 'overflow'],
|
|
14684
|
+
use: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'href', 'mask', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'width', 'x', 'xlink:href', 'y', 'overflow'],
|
|
14658
14685
|
// Filter Primitives
|
|
14659
14686
|
feComponentTransfer: ['in', 'result'],
|
|
14660
14687
|
feFuncR: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
|
|
@@ -14684,7 +14711,7 @@ const svgWhiteList_ = {
|
|
|
14684
14711
|
mphantom: [],
|
|
14685
14712
|
mprescripts: [],
|
|
14686
14713
|
mroot: [],
|
|
14687
|
-
mrow: ['xlink:href', 'xlink:type', 'xmlns:xlink'],
|
|
14714
|
+
mrow: ['href', 'xlink:href', 'xlink:type', 'xmlns:xlink'],
|
|
14688
14715
|
mspace: ['depth', 'height', 'width'],
|
|
14689
14716
|
msqrt: [],
|
|
14690
14717
|
mstyle: ['displaystyle', 'mathbackground', 'mathcolor', 'mathvariant', 'scriptlevel'],
|
|
@@ -14783,16 +14810,20 @@ const sanitizeSvg = node => {
|
|
|
14783
14810
|
// Check that an attribute with the correct localName in the correct namespace is on
|
|
14784
14811
|
// our whitelist or is a namespace declaration for one of our allowed namespaces
|
|
14785
14812
|
if (attrNsURI !== allowedAttrsNS[attrLocalName] && attrNsURI !== NS.XMLNS && !(attrNsURI === NS.XMLNS && REVERSE_NS[attr.value])) {
|
|
14786
|
-
//
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
// We
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14813
|
+
// Special case: allow href attribute even without namespace if it's in the whitelist
|
|
14814
|
+
const isHrefAttribute = attrLocalName === 'href' && allowedAttrs.includes('href');
|
|
14815
|
+
if (!isHrefAttribute) {
|
|
14816
|
+
// Bypassing the whitelist to allow se: and oi: prefixes
|
|
14817
|
+
// We can add specific namepaces on demand for now.
|
|
14818
|
+
// Is there a more appropriate way to do this?
|
|
14819
|
+
if (attrName.startsWith('se:') || attrName.startsWith('oi:') || attrName.startsWith('data-')) {
|
|
14820
|
+
// We should bypass the namespace aswell
|
|
14821
|
+
const seAttrNS = attrName.startsWith('se:') ? NS.SE : attrName.startsWith('oi:') ? NS.OI : null;
|
|
14822
|
+
seAttrs.push([attrName, attr.value, seAttrNS]);
|
|
14823
|
+
} else {
|
|
14824
|
+
console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed: ${node.outerHTML}`);
|
|
14825
|
+
node.removeAttributeNS(attrNsURI, attrLocalName);
|
|
14826
|
+
}
|
|
14796
14827
|
}
|
|
14797
14828
|
}
|
|
14798
14829
|
|
|
@@ -14816,22 +14847,37 @@ const sanitizeSvg = node => {
|
|
|
14816
14847
|
node.setAttributeNS(ns, att, val);
|
|
14817
14848
|
});
|
|
14818
14849
|
|
|
14819
|
-
// for some elements that have a xlink:href, ensure the URI refers to a local element
|
|
14820
|
-
// (but not for links)
|
|
14850
|
+
// for some elements that have a xlink:href or href, ensure the URI refers to a local element
|
|
14851
|
+
// (but not for links and other elements where external hrefs are allowed)
|
|
14821
14852
|
const href = getHref(node);
|
|
14822
14853
|
if (href && ['filter', 'linearGradient', 'pattern', 'radialGradient', 'textPath', 'use'].includes(node.nodeName) && href[0] !== '#') {
|
|
14823
14854
|
// remove the attribute (but keep the element)
|
|
14824
14855
|
setHref(node, '');
|
|
14825
|
-
console.warn(`sanitizeSvg: attribute href in element ${node.nodeName} pointing to a non-local reference (${href}) is removed`);
|
|
14856
|
+
console.warn(`sanitizeSvg: attribute href in element ${node.nodeName} pointing to a non-local reference (${href}) is removed: ${node.outerHTML}`);
|
|
14826
14857
|
node.removeAttributeNS(NS.XLINK, 'href');
|
|
14858
|
+
node.removeAttribute('href');
|
|
14827
14859
|
}
|
|
14828
14860
|
|
|
14829
14861
|
// Safari crashes on a <use> without a xlink:href, so we just remove the node here
|
|
14830
14862
|
if (node.nodeName === 'use' && !getHref(node)) {
|
|
14831
|
-
console.warn(`sanitizeSvg: element ${node.nodeName} without a xlink:href is removed`);
|
|
14863
|
+
console.warn(`sanitizeSvg: element ${node.nodeName} without a xlink:href or href is removed: ${node.outerHTML}`);
|
|
14832
14864
|
node.remove();
|
|
14833
14865
|
return;
|
|
14834
14866
|
}
|
|
14867
|
+
// if the element has attributes pointing to a non-local reference,
|
|
14868
|
+
// need to remove the attribute
|
|
14869
|
+
['clip-path', 'fill', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'stroke'].forEach(attr => {
|
|
14870
|
+
let val = node.getAttribute(attr);
|
|
14871
|
+
if (val) {
|
|
14872
|
+
val = getUrlFromAttr(val);
|
|
14873
|
+
// simply check for first character being a '#'
|
|
14874
|
+
if (val && val[0] !== '#') {
|
|
14875
|
+
node.setAttribute(attr, '');
|
|
14876
|
+
console.warn(`sanitizeSvg: attribute ${attr} in element ${node.nodeName} pointing to a non-local reference (${val}) is removed: ${node.outerHTML}`);
|
|
14877
|
+
node.removeAttribute(attr);
|
|
14878
|
+
}
|
|
14879
|
+
}
|
|
14880
|
+
});
|
|
14835
14881
|
|
|
14836
14882
|
// recurse to children
|
|
14837
14883
|
i = node.childNodes.length;
|
|
@@ -14842,7 +14888,7 @@ const sanitizeSvg = node => {
|
|
|
14842
14888
|
} else {
|
|
14843
14889
|
// remove all children from this node and insert them before this node
|
|
14844
14890
|
// TODO: in the case of animation elements this will hardly ever be correct
|
|
14845
|
-
console.warn(`sanitizeSvg: element ${node.nodeName} not supported is removed`);
|
|
14891
|
+
console.warn(`sanitizeSvg: element ${node.nodeName} not supported is removed: ${node.outerHTML}`);
|
|
14846
14892
|
const children = [];
|
|
14847
14893
|
while (node.hasChildNodes()) {
|
|
14848
14894
|
children.push(parent.insertBefore(node.firstChild, node));
|
|
@@ -31478,7 +31524,8 @@ const setSvgString = (xmlString, preventUndo) => {
|
|
|
31478
31524
|
// const url = decodeURIComponent(m.groups.url);
|
|
31479
31525
|
const iimg = new Image();
|
|
31480
31526
|
iimg.addEventListener('load', () => {
|
|
31481
|
-
|
|
31527
|
+
// Set the href attribute to the data URL
|
|
31528
|
+
setHref(image, val);
|
|
31482
31529
|
});
|
|
31483
31530
|
iimg.src = url;
|
|
31484
31531
|
}
|
|
@@ -31860,7 +31907,7 @@ const convertImagesToBase64 = async svgElement => {
|
|
|
31860
31907
|
const reader = new FileReader();
|
|
31861
31908
|
return new Promise(resolve => {
|
|
31862
31909
|
reader.onload = () => {
|
|
31863
|
-
img
|
|
31910
|
+
setHref(img, reader.result);
|
|
31864
31911
|
resolve();
|
|
31865
31912
|
};
|
|
31866
31913
|
reader.readAsDataURL(blob);
|
|
@@ -43674,10 +43721,10 @@ function requireSharedStore () {
|
|
|
43674
43721
|
var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
43675
43722
|
|
|
43676
43723
|
(store.versions || (store.versions = [])).push({
|
|
43677
|
-
version: '3.
|
|
43724
|
+
version: '3.43.0',
|
|
43678
43725
|
mode: IS_PURE ? 'pure' : 'global',
|
|
43679
43726
|
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
|
|
43680
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
43727
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE',
|
|
43681
43728
|
source: 'https://github.com/zloirock/core-js'
|
|
43682
43729
|
});
|
|
43683
43730
|
return sharedStore.exports;
|
|
@@ -43745,7 +43792,7 @@ function requireUid () {
|
|
|
43745
43792
|
|
|
43746
43793
|
var id = 0;
|
|
43747
43794
|
var postfix = Math.random();
|
|
43748
|
-
var toString = uncurryThis(1.
|
|
43795
|
+
var toString = uncurryThis(1.1.toString);
|
|
43749
43796
|
|
|
43750
43797
|
uid = function (key) {
|
|
43751
43798
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
@@ -44682,6 +44729,18 @@ function requireEnvironmentIsNode () {
|
|
|
44682
44729
|
return environmentIsNode;
|
|
44683
44730
|
}
|
|
44684
44731
|
|
|
44732
|
+
var path;
|
|
44733
|
+
var hasRequiredPath;
|
|
44734
|
+
|
|
44735
|
+
function requirePath () {
|
|
44736
|
+
if (hasRequiredPath) return path;
|
|
44737
|
+
hasRequiredPath = 1;
|
|
44738
|
+
var globalThis = requireGlobalThis();
|
|
44739
|
+
|
|
44740
|
+
path = globalThis;
|
|
44741
|
+
return path;
|
|
44742
|
+
}
|
|
44743
|
+
|
|
44685
44744
|
var functionUncurryThisAccessor;
|
|
44686
44745
|
var hasRequiredFunctionUncurryThisAccessor;
|
|
44687
44746
|
|
|
@@ -45545,6 +45604,7 @@ function requireEs_promise_constructor () {
|
|
|
45545
45604
|
var IS_PURE = requireIsPure();
|
|
45546
45605
|
var IS_NODE = requireEnvironmentIsNode();
|
|
45547
45606
|
var globalThis = requireGlobalThis();
|
|
45607
|
+
var path = requirePath();
|
|
45548
45608
|
var call = requireFunctionCall();
|
|
45549
45609
|
var defineBuiltIn = requireDefineBuiltIn();
|
|
45550
45610
|
var setPrototypeOf = requireObjectSetPrototypeOf();
|
|
@@ -45828,6 +45888,8 @@ function requireEs_promise_constructor () {
|
|
|
45828
45888
|
Promise: PromiseConstructor
|
|
45829
45889
|
});
|
|
45830
45890
|
|
|
45891
|
+
PromiseWrapper = path.Promise;
|
|
45892
|
+
|
|
45831
45893
|
setToStringTag(PromiseConstructor, PROMISE, false, true);
|
|
45832
45894
|
setSpecies(PROMISE);
|
|
45833
45895
|
return es_promise_constructor;
|
|
@@ -45976,7 +46038,7 @@ function requireIterate () {
|
|
|
45976
46038
|
var iterator, iterFn, index, length, result, next, step;
|
|
45977
46039
|
|
|
45978
46040
|
var stop = function (condition) {
|
|
45979
|
-
if (iterator) iteratorClose(iterator, 'normal'
|
|
46041
|
+
if (iterator) iteratorClose(iterator, 'normal');
|
|
45980
46042
|
return new Result(true, condition);
|
|
45981
46043
|
};
|
|
45982
46044
|
|
|
@@ -46865,6 +46927,85 @@ function requireAdvanceStringIndex () {
|
|
|
46865
46927
|
return advanceStringIndex;
|
|
46866
46928
|
}
|
|
46867
46929
|
|
|
46930
|
+
var regexpFlagsDetection;
|
|
46931
|
+
var hasRequiredRegexpFlagsDetection;
|
|
46932
|
+
|
|
46933
|
+
function requireRegexpFlagsDetection () {
|
|
46934
|
+
if (hasRequiredRegexpFlagsDetection) return regexpFlagsDetection;
|
|
46935
|
+
hasRequiredRegexpFlagsDetection = 1;
|
|
46936
|
+
var globalThis = requireGlobalThis();
|
|
46937
|
+
var fails = requireFails();
|
|
46938
|
+
|
|
46939
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
|
|
46940
|
+
var RegExp = globalThis.RegExp;
|
|
46941
|
+
|
|
46942
|
+
var FLAGS_GETTER_IS_CORRECT = !fails(function () {
|
|
46943
|
+
var INDICES_SUPPORT = true;
|
|
46944
|
+
try {
|
|
46945
|
+
RegExp('.', 'd');
|
|
46946
|
+
} catch (error) {
|
|
46947
|
+
INDICES_SUPPORT = false;
|
|
46948
|
+
}
|
|
46949
|
+
|
|
46950
|
+
var O = {};
|
|
46951
|
+
// modern V8 bug
|
|
46952
|
+
var calls = '';
|
|
46953
|
+
var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
|
|
46954
|
+
|
|
46955
|
+
var addGetter = function (key, chr) {
|
|
46956
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
46957
|
+
Object.defineProperty(O, key, { get: function () {
|
|
46958
|
+
calls += chr;
|
|
46959
|
+
return true;
|
|
46960
|
+
} });
|
|
46961
|
+
};
|
|
46962
|
+
|
|
46963
|
+
var pairs = {
|
|
46964
|
+
dotAll: 's',
|
|
46965
|
+
global: 'g',
|
|
46966
|
+
ignoreCase: 'i',
|
|
46967
|
+
multiline: 'm',
|
|
46968
|
+
sticky: 'y'
|
|
46969
|
+
};
|
|
46970
|
+
|
|
46971
|
+
if (INDICES_SUPPORT) pairs.hasIndices = 'd';
|
|
46972
|
+
|
|
46973
|
+
for (var key in pairs) addGetter(key, pairs[key]);
|
|
46974
|
+
|
|
46975
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
46976
|
+
var result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O);
|
|
46977
|
+
|
|
46978
|
+
return result !== expected || calls !== expected;
|
|
46979
|
+
});
|
|
46980
|
+
|
|
46981
|
+
regexpFlagsDetection = { correct: FLAGS_GETTER_IS_CORRECT };
|
|
46982
|
+
return regexpFlagsDetection;
|
|
46983
|
+
}
|
|
46984
|
+
|
|
46985
|
+
var regexpGetFlags;
|
|
46986
|
+
var hasRequiredRegexpGetFlags;
|
|
46987
|
+
|
|
46988
|
+
function requireRegexpGetFlags () {
|
|
46989
|
+
if (hasRequiredRegexpGetFlags) return regexpGetFlags;
|
|
46990
|
+
hasRequiredRegexpGetFlags = 1;
|
|
46991
|
+
var call = requireFunctionCall();
|
|
46992
|
+
var hasOwn = requireHasOwnProperty();
|
|
46993
|
+
var isPrototypeOf = requireObjectIsPrototypeOf();
|
|
46994
|
+
var regExpFlagsDetection = requireRegexpFlagsDetection();
|
|
46995
|
+
var regExpFlagsGetterImplementation = requireRegexpFlags();
|
|
46996
|
+
|
|
46997
|
+
var RegExpPrototype = RegExp.prototype;
|
|
46998
|
+
|
|
46999
|
+
regexpGetFlags = regExpFlagsDetection.correct ? function (it) {
|
|
47000
|
+
return it.flags;
|
|
47001
|
+
} : function (it) {
|
|
47002
|
+
return (!regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype, it) && !hasOwn(it, 'flags'))
|
|
47003
|
+
? call(regExpFlagsGetterImplementation, it)
|
|
47004
|
+
: it.flags;
|
|
47005
|
+
};
|
|
47006
|
+
return regexpGetFlags;
|
|
47007
|
+
}
|
|
47008
|
+
|
|
46868
47009
|
var regexpExecAbstract;
|
|
46869
47010
|
var hasRequiredRegexpExecAbstract;
|
|
46870
47011
|
|
|
@@ -46900,6 +47041,7 @@ function requireEs_string_match () {
|
|
|
46900
47041
|
if (hasRequiredEs_string_match) return es_string_match;
|
|
46901
47042
|
hasRequiredEs_string_match = 1;
|
|
46902
47043
|
var call = requireFunctionCall();
|
|
47044
|
+
var uncurryThis = requireFunctionUncurryThis();
|
|
46903
47045
|
var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic();
|
|
46904
47046
|
var anObject = requireAnObject();
|
|
46905
47047
|
var isObject = requireIsObject();
|
|
@@ -46908,8 +47050,11 @@ function requireEs_string_match () {
|
|
|
46908
47050
|
var requireObjectCoercible = requireRequireObjectCoercible();
|
|
46909
47051
|
var getMethod = requireGetMethod();
|
|
46910
47052
|
var advanceStringIndex = requireAdvanceStringIndex();
|
|
47053
|
+
var getRegExpFlags = requireRegexpGetFlags();
|
|
46911
47054
|
var regExpExec = requireRegexpExecAbstract();
|
|
46912
47055
|
|
|
47056
|
+
var stringIndexOf = uncurryThis(''.indexOf);
|
|
47057
|
+
|
|
46913
47058
|
// @@match logic
|
|
46914
47059
|
fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
|
|
46915
47060
|
return [
|
|
@@ -46929,9 +47074,11 @@ function requireEs_string_match () {
|
|
|
46929
47074
|
|
|
46930
47075
|
if (res.done) return res.value;
|
|
46931
47076
|
|
|
46932
|
-
|
|
47077
|
+
var flags = toString(getRegExpFlags(rx));
|
|
47078
|
+
|
|
47079
|
+
if (stringIndexOf(flags, 'g') === -1) return regExpExec(rx, S);
|
|
46933
47080
|
|
|
46934
|
-
var fullUnicode =
|
|
47081
|
+
var fullUnicode = stringIndexOf(flags, 'u') !== -1;
|
|
46935
47082
|
rx.lastIndex = 0;
|
|
46936
47083
|
var A = [];
|
|
46937
47084
|
var n = 0;
|
|
@@ -47027,6 +47174,7 @@ function requireEs_string_replace () {
|
|
|
47027
47174
|
var advanceStringIndex = requireAdvanceStringIndex();
|
|
47028
47175
|
var getMethod = requireGetMethod();
|
|
47029
47176
|
var getSubstitution = requireGetSubstitution();
|
|
47177
|
+
var getRegExpFlags = requireRegexpGetFlags();
|
|
47030
47178
|
var regExpExec = requireRegexpExecAbstract();
|
|
47031
47179
|
var wellKnownSymbol = requireWellKnownSymbol();
|
|
47032
47180
|
|
|
@@ -47100,10 +47248,11 @@ function requireEs_string_replace () {
|
|
|
47100
47248
|
var functionalReplace = isCallable(replaceValue);
|
|
47101
47249
|
if (!functionalReplace) replaceValue = toString(replaceValue);
|
|
47102
47250
|
|
|
47103
|
-
var
|
|
47251
|
+
var flags = toString(getRegExpFlags(rx));
|
|
47252
|
+
var global = stringIndexOf(flags, 'g') !== -1;
|
|
47104
47253
|
var fullUnicode;
|
|
47105
47254
|
if (global) {
|
|
47106
|
-
fullUnicode =
|
|
47255
|
+
fullUnicode = stringIndexOf(flags, 'u') !== -1;
|
|
47107
47256
|
rx.lastIndex = 0;
|
|
47108
47257
|
}
|
|
47109
47258
|
|
|
@@ -48731,7 +48880,7 @@ function p(t, r, e, i) {
|
|
|
48731
48880
|
h = 3 * n;
|
|
48732
48881
|
return Math.abs(s) < a ? [-h / u] : function (t, r, e) {
|
|
48733
48882
|
var i = t * t / 4 - r;
|
|
48734
|
-
if (i < -
|
|
48883
|
+
if (i < -e) return [];
|
|
48735
48884
|
if (i <= e) return [-t / 2];
|
|
48736
48885
|
var a = Math.sqrt(i);
|
|
48737
48886
|
return [-t / 2 - a, -t / 2 + a];
|
|
@@ -49141,27 +49290,6 @@ var O,
|
|
|
49141
49290
|
|
|
49142
49291
|
var es_regexp_toString = {};
|
|
49143
49292
|
|
|
49144
|
-
var regexpGetFlags;
|
|
49145
|
-
var hasRequiredRegexpGetFlags;
|
|
49146
|
-
|
|
49147
|
-
function requireRegexpGetFlags () {
|
|
49148
|
-
if (hasRequiredRegexpGetFlags) return regexpGetFlags;
|
|
49149
|
-
hasRequiredRegexpGetFlags = 1;
|
|
49150
|
-
var call = requireFunctionCall();
|
|
49151
|
-
var hasOwn = requireHasOwnProperty();
|
|
49152
|
-
var isPrototypeOf = requireObjectIsPrototypeOf();
|
|
49153
|
-
var regExpFlags = requireRegexpFlags();
|
|
49154
|
-
|
|
49155
|
-
var RegExpPrototype = RegExp.prototype;
|
|
49156
|
-
|
|
49157
|
-
regexpGetFlags = function (R) {
|
|
49158
|
-
var flags = R.flags;
|
|
49159
|
-
return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)
|
|
49160
|
-
? call(regExpFlags, R) : flags;
|
|
49161
|
-
};
|
|
49162
|
-
return regexpGetFlags;
|
|
49163
|
-
}
|
|
49164
|
-
|
|
49165
49293
|
var hasRequiredEs_regexp_toString;
|
|
49166
49294
|
|
|
49167
49295
|
function requireEs_regexp_toString () {
|
|
@@ -52326,9 +52454,9 @@ class TextElement extends RenderedElement {
|
|
|
52326
52454
|
var isRTL = false; // we treat RTL like LTR
|
|
52327
52455
|
|
|
52328
52456
|
var shift = 0;
|
|
52329
|
-
if (textAnchor === 'start' &&
|
|
52457
|
+
if (textAnchor === 'start' && !isRTL || textAnchor === 'end' && isRTL) {
|
|
52330
52458
|
shift = firstElement.x - this.minX;
|
|
52331
|
-
} else if (textAnchor === 'end' &&
|
|
52459
|
+
} else if (textAnchor === 'end' && !isRTL || textAnchor === 'start' && isRTL) {
|
|
52332
52460
|
shift = firstElement.x - this.maxX;
|
|
52333
52461
|
} else {
|
|
52334
52462
|
shift = firstElement.x - (this.minX + this.maxX) / 2;
|