@idraw/core 0.2.0-alpha.24 → 0.2.0-alpha.25
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/dist/index.cjs.js +48 -43
- package/dist/index.es.js +48 -43
- package/dist/index.global.js +48 -43
- package/dist/index.global.min.js +1 -1
- package/package.json +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -86,7 +86,7 @@ function createUUID$4() {
|
|
|
86
86
|
function str4() {
|
|
87
87
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
88
88
|
}
|
|
89
|
-
return ""
|
|
89
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
90
90
|
}
|
|
91
91
|
function deepClone$6(target) {
|
|
92
92
|
function _clone(t) {
|
|
@@ -202,7 +202,7 @@ function __generator$3(thisArg, body) {
|
|
|
202
202
|
function parseHTMLToDataURL$2(html, opts) {
|
|
203
203
|
var width = opts.width, height = opts.height;
|
|
204
204
|
return new Promise(function (resolve, reject) {
|
|
205
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
205
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
206
206
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
207
207
|
var reader = new FileReader();
|
|
208
208
|
reader.readAsDataURL(blob);
|
|
@@ -424,11 +424,11 @@ var Context$1$1 = (function () {
|
|
|
424
424
|
Context.prototype.setFont = function (opts) {
|
|
425
425
|
var strList = [];
|
|
426
426
|
if (opts.fontWeight === 'bold') {
|
|
427
|
-
strList.push(""
|
|
427
|
+
strList.push("".concat(opts.fontWeight));
|
|
428
428
|
}
|
|
429
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
430
|
-
strList.push(""
|
|
431
|
-
this._ctx.font = ""
|
|
429
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
430
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
431
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
432
432
|
};
|
|
433
433
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
434
434
|
this._ctx.textBaseline = baseline;
|
|
@@ -503,16 +503,16 @@ function color$5(value) {
|
|
|
503
503
|
return isColorStr$4(value);
|
|
504
504
|
}
|
|
505
505
|
function imageURL$3(value) {
|
|
506
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
506
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
507
507
|
}
|
|
508
508
|
function imageBase64$3(value) {
|
|
509
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
509
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
510
510
|
}
|
|
511
511
|
function imageSrc$3(value) {
|
|
512
512
|
return (imageBase64$3(value) || imageURL$3(value));
|
|
513
513
|
}
|
|
514
514
|
function svg$3(value) {
|
|
515
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
515
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
516
516
|
}
|
|
517
517
|
function html$3(value) {
|
|
518
518
|
var result = false;
|
|
@@ -830,18 +830,23 @@ var ScreenWatcher = (function () {
|
|
|
830
830
|
this._initParentEvent();
|
|
831
831
|
};
|
|
832
832
|
ScreenWatcher.prototype._initParentEvent = function () {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
if (target.
|
|
838
|
-
target.
|
|
833
|
+
try {
|
|
834
|
+
var target = window;
|
|
835
|
+
var targetOrigin = target.origin;
|
|
836
|
+
while (target.self !== target.top) {
|
|
837
|
+
if (target.self !== target.parent) {
|
|
838
|
+
if (target.origin === targetOrigin) {
|
|
839
|
+
target.parent.window.addEventListener('mousemove', this._listSameOriginParentWindow.bind(this), false);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
target = target.parent;
|
|
843
|
+
if (!target) {
|
|
844
|
+
break;
|
|
839
845
|
}
|
|
840
846
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
847
|
+
}
|
|
848
|
+
catch (err) {
|
|
849
|
+
console.warn(err);
|
|
845
850
|
}
|
|
846
851
|
};
|
|
847
852
|
ScreenWatcher.prototype._listenHover = function (e) {
|
|
@@ -1019,7 +1024,7 @@ function setStyle(dom, style) {
|
|
|
1019
1024
|
var keys = Object.keys(_style);
|
|
1020
1025
|
var styleStr = '';
|
|
1021
1026
|
keys.forEach(function (key) {
|
|
1022
|
-
styleStr += key
|
|
1027
|
+
styleStr += "".concat(key, ":").concat(_style[key] || '', ";");
|
|
1023
1028
|
});
|
|
1024
1029
|
dom.setAttribute('style', styleStr);
|
|
1025
1030
|
}
|
|
@@ -1476,8 +1481,8 @@ var Board = (function () {
|
|
|
1476
1481
|
this[_displayCanvas].width = width * devicePixelRatio;
|
|
1477
1482
|
this[_displayCanvas].height = height * devicePixelRatio;
|
|
1478
1483
|
setStyle(this[_displayCanvas], {
|
|
1479
|
-
width: width
|
|
1480
|
-
height: height
|
|
1484
|
+
width: "".concat(width, "px"),
|
|
1485
|
+
height: "".concat(height, "px"),
|
|
1481
1486
|
});
|
|
1482
1487
|
};
|
|
1483
1488
|
Board.prototype[_parsePrivateOptions] = function (opts) {
|
|
@@ -1625,7 +1630,7 @@ function createUUID$3() {
|
|
|
1625
1630
|
function str4() {
|
|
1626
1631
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
1627
1632
|
}
|
|
1628
|
-
return ""
|
|
1633
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
1629
1634
|
}
|
|
1630
1635
|
function deepClone$5(target) {
|
|
1631
1636
|
function _clone(t) {
|
|
@@ -1741,7 +1746,7 @@ function __generator$2(thisArg, body) {
|
|
|
1741
1746
|
function parseHTMLToDataURL$1(html, opts) {
|
|
1742
1747
|
var width = opts.width, height = opts.height;
|
|
1743
1748
|
return new Promise(function (resolve, reject) {
|
|
1744
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
1749
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
1745
1750
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
1746
1751
|
var reader = new FileReader();
|
|
1747
1752
|
reader.readAsDataURL(blob);
|
|
@@ -1963,11 +1968,11 @@ var Context$2 = (function () {
|
|
|
1963
1968
|
Context.prototype.setFont = function (opts) {
|
|
1964
1969
|
var strList = [];
|
|
1965
1970
|
if (opts.fontWeight === 'bold') {
|
|
1966
|
-
strList.push(""
|
|
1971
|
+
strList.push("".concat(opts.fontWeight));
|
|
1967
1972
|
}
|
|
1968
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
1969
|
-
strList.push(""
|
|
1970
|
-
this._ctx.font = ""
|
|
1973
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
1974
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
1975
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
1971
1976
|
};
|
|
1972
1977
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
1973
1978
|
this._ctx.textBaseline = baseline;
|
|
@@ -2042,16 +2047,16 @@ function color$4(value) {
|
|
|
2042
2047
|
return isColorStr$3(value);
|
|
2043
2048
|
}
|
|
2044
2049
|
function imageURL$2(value) {
|
|
2045
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
2050
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
2046
2051
|
}
|
|
2047
2052
|
function imageBase64$2(value) {
|
|
2048
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
2053
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
2049
2054
|
}
|
|
2050
2055
|
function imageSrc$2(value) {
|
|
2051
2056
|
return (imageBase64$2(value) || imageURL$2(value));
|
|
2052
2057
|
}
|
|
2053
2058
|
function svg$2(value) {
|
|
2054
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
2059
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
2055
2060
|
}
|
|
2056
2061
|
function html$2(value) {
|
|
2057
2062
|
var result = false;
|
|
@@ -2378,7 +2383,7 @@ function createUUID$1$1() {
|
|
|
2378
2383
|
function str4() {
|
|
2379
2384
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
2380
2385
|
}
|
|
2381
|
-
return ""
|
|
2386
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
2382
2387
|
}
|
|
2383
2388
|
function deepClone$2$1(target) {
|
|
2384
2389
|
function _clone(t) {
|
|
@@ -2494,7 +2499,7 @@ function __generator(thisArg, body) {
|
|
|
2494
2499
|
function parseHTMLToDataURL(html, opts) {
|
|
2495
2500
|
var width = opts.width, height = opts.height;
|
|
2496
2501
|
return new Promise(function (resolve, reject) {
|
|
2497
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
2502
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
2498
2503
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
2499
2504
|
var reader = new FileReader();
|
|
2500
2505
|
reader.readAsDataURL(blob);
|
|
@@ -2716,11 +2721,11 @@ var Context$1 = (function () {
|
|
|
2716
2721
|
Context.prototype.setFont = function (opts) {
|
|
2717
2722
|
var strList = [];
|
|
2718
2723
|
if (opts.fontWeight === 'bold') {
|
|
2719
|
-
strList.push(""
|
|
2724
|
+
strList.push("".concat(opts.fontWeight));
|
|
2720
2725
|
}
|
|
2721
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
2722
|
-
strList.push(""
|
|
2723
|
-
this._ctx.font = ""
|
|
2726
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
2727
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
2728
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
2724
2729
|
};
|
|
2725
2730
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
2726
2731
|
this._ctx.textBaseline = baseline;
|
|
@@ -2795,16 +2800,16 @@ function color$2(value) {
|
|
|
2795
2800
|
return isColorStr$1(value);
|
|
2796
2801
|
}
|
|
2797
2802
|
function imageURL$1(value) {
|
|
2798
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
2803
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
2799
2804
|
}
|
|
2800
2805
|
function imageBase64$1(value) {
|
|
2801
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
2806
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
2802
2807
|
}
|
|
2803
2808
|
function imageSrc$1(value) {
|
|
2804
2809
|
return (imageBase64$1(value) || imageURL$1(value));
|
|
2805
2810
|
}
|
|
2806
2811
|
function svg$1(value) {
|
|
2807
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
2812
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
2808
2813
|
}
|
|
2809
2814
|
function html$1(value) {
|
|
2810
2815
|
var result = false;
|
|
@@ -3850,16 +3855,16 @@ function color(value) {
|
|
|
3850
3855
|
return isColorStr(value);
|
|
3851
3856
|
}
|
|
3852
3857
|
function imageURL(value) {
|
|
3853
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
3858
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
3854
3859
|
}
|
|
3855
3860
|
function imageBase64(value) {
|
|
3856
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
3861
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
3857
3862
|
}
|
|
3858
3863
|
function imageSrc(value) {
|
|
3859
3864
|
return (imageBase64(value) || imageURL(value));
|
|
3860
3865
|
}
|
|
3861
3866
|
function svg(value) {
|
|
3862
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
3867
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
3863
3868
|
}
|
|
3864
3869
|
function html(value) {
|
|
3865
3870
|
var result = false;
|
package/dist/index.es.js
CHANGED
|
@@ -84,7 +84,7 @@ function createUUID$4() {
|
|
|
84
84
|
function str4() {
|
|
85
85
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
86
86
|
}
|
|
87
|
-
return ""
|
|
87
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
88
88
|
}
|
|
89
89
|
function deepClone$6(target) {
|
|
90
90
|
function _clone(t) {
|
|
@@ -200,7 +200,7 @@ function __generator$3(thisArg, body) {
|
|
|
200
200
|
function parseHTMLToDataURL$2(html, opts) {
|
|
201
201
|
var width = opts.width, height = opts.height;
|
|
202
202
|
return new Promise(function (resolve, reject) {
|
|
203
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
203
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
204
204
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
205
205
|
var reader = new FileReader();
|
|
206
206
|
reader.readAsDataURL(blob);
|
|
@@ -422,11 +422,11 @@ var Context$1$1 = (function () {
|
|
|
422
422
|
Context.prototype.setFont = function (opts) {
|
|
423
423
|
var strList = [];
|
|
424
424
|
if (opts.fontWeight === 'bold') {
|
|
425
|
-
strList.push(""
|
|
425
|
+
strList.push("".concat(opts.fontWeight));
|
|
426
426
|
}
|
|
427
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
428
|
-
strList.push(""
|
|
429
|
-
this._ctx.font = ""
|
|
427
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
428
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
429
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
430
430
|
};
|
|
431
431
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
432
432
|
this._ctx.textBaseline = baseline;
|
|
@@ -501,16 +501,16 @@ function color$5(value) {
|
|
|
501
501
|
return isColorStr$4(value);
|
|
502
502
|
}
|
|
503
503
|
function imageURL$3(value) {
|
|
504
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
504
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
505
505
|
}
|
|
506
506
|
function imageBase64$3(value) {
|
|
507
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
507
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
508
508
|
}
|
|
509
509
|
function imageSrc$3(value) {
|
|
510
510
|
return (imageBase64$3(value) || imageURL$3(value));
|
|
511
511
|
}
|
|
512
512
|
function svg$3(value) {
|
|
513
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
513
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
514
514
|
}
|
|
515
515
|
function html$3(value) {
|
|
516
516
|
var result = false;
|
|
@@ -828,18 +828,23 @@ var ScreenWatcher = (function () {
|
|
|
828
828
|
this._initParentEvent();
|
|
829
829
|
};
|
|
830
830
|
ScreenWatcher.prototype._initParentEvent = function () {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
if (target.
|
|
836
|
-
target.
|
|
831
|
+
try {
|
|
832
|
+
var target = window;
|
|
833
|
+
var targetOrigin = target.origin;
|
|
834
|
+
while (target.self !== target.top) {
|
|
835
|
+
if (target.self !== target.parent) {
|
|
836
|
+
if (target.origin === targetOrigin) {
|
|
837
|
+
target.parent.window.addEventListener('mousemove', this._listSameOriginParentWindow.bind(this), false);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
target = target.parent;
|
|
841
|
+
if (!target) {
|
|
842
|
+
break;
|
|
837
843
|
}
|
|
838
844
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}
|
|
845
|
+
}
|
|
846
|
+
catch (err) {
|
|
847
|
+
console.warn(err);
|
|
843
848
|
}
|
|
844
849
|
};
|
|
845
850
|
ScreenWatcher.prototype._listenHover = function (e) {
|
|
@@ -1017,7 +1022,7 @@ function setStyle(dom, style) {
|
|
|
1017
1022
|
var keys = Object.keys(_style);
|
|
1018
1023
|
var styleStr = '';
|
|
1019
1024
|
keys.forEach(function (key) {
|
|
1020
|
-
styleStr += key
|
|
1025
|
+
styleStr += "".concat(key, ":").concat(_style[key] || '', ";");
|
|
1021
1026
|
});
|
|
1022
1027
|
dom.setAttribute('style', styleStr);
|
|
1023
1028
|
}
|
|
@@ -1474,8 +1479,8 @@ var Board = (function () {
|
|
|
1474
1479
|
this[_displayCanvas].width = width * devicePixelRatio;
|
|
1475
1480
|
this[_displayCanvas].height = height * devicePixelRatio;
|
|
1476
1481
|
setStyle(this[_displayCanvas], {
|
|
1477
|
-
width: width
|
|
1478
|
-
height: height
|
|
1482
|
+
width: "".concat(width, "px"),
|
|
1483
|
+
height: "".concat(height, "px"),
|
|
1479
1484
|
});
|
|
1480
1485
|
};
|
|
1481
1486
|
Board.prototype[_parsePrivateOptions] = function (opts) {
|
|
@@ -1623,7 +1628,7 @@ function createUUID$3() {
|
|
|
1623
1628
|
function str4() {
|
|
1624
1629
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
1625
1630
|
}
|
|
1626
|
-
return ""
|
|
1631
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
1627
1632
|
}
|
|
1628
1633
|
function deepClone$5(target) {
|
|
1629
1634
|
function _clone(t) {
|
|
@@ -1739,7 +1744,7 @@ function __generator$2(thisArg, body) {
|
|
|
1739
1744
|
function parseHTMLToDataURL$1(html, opts) {
|
|
1740
1745
|
var width = opts.width, height = opts.height;
|
|
1741
1746
|
return new Promise(function (resolve, reject) {
|
|
1742
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
1747
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
1743
1748
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
1744
1749
|
var reader = new FileReader();
|
|
1745
1750
|
reader.readAsDataURL(blob);
|
|
@@ -1961,11 +1966,11 @@ var Context$2 = (function () {
|
|
|
1961
1966
|
Context.prototype.setFont = function (opts) {
|
|
1962
1967
|
var strList = [];
|
|
1963
1968
|
if (opts.fontWeight === 'bold') {
|
|
1964
|
-
strList.push(""
|
|
1969
|
+
strList.push("".concat(opts.fontWeight));
|
|
1965
1970
|
}
|
|
1966
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
1967
|
-
strList.push(""
|
|
1968
|
-
this._ctx.font = ""
|
|
1971
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
1972
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
1973
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
1969
1974
|
};
|
|
1970
1975
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
1971
1976
|
this._ctx.textBaseline = baseline;
|
|
@@ -2040,16 +2045,16 @@ function color$4(value) {
|
|
|
2040
2045
|
return isColorStr$3(value);
|
|
2041
2046
|
}
|
|
2042
2047
|
function imageURL$2(value) {
|
|
2043
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
2048
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
2044
2049
|
}
|
|
2045
2050
|
function imageBase64$2(value) {
|
|
2046
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
2051
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
2047
2052
|
}
|
|
2048
2053
|
function imageSrc$2(value) {
|
|
2049
2054
|
return (imageBase64$2(value) || imageURL$2(value));
|
|
2050
2055
|
}
|
|
2051
2056
|
function svg$2(value) {
|
|
2052
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
2057
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
2053
2058
|
}
|
|
2054
2059
|
function html$2(value) {
|
|
2055
2060
|
var result = false;
|
|
@@ -2376,7 +2381,7 @@ function createUUID$1$1() {
|
|
|
2376
2381
|
function str4() {
|
|
2377
2382
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
2378
2383
|
}
|
|
2379
|
-
return ""
|
|
2384
|
+
return "".concat(str4()).concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4(), "-").concat(str4()).concat(str4()).concat(str4());
|
|
2380
2385
|
}
|
|
2381
2386
|
function deepClone$2$1(target) {
|
|
2382
2387
|
function _clone(t) {
|
|
@@ -2492,7 +2497,7 @@ function __generator(thisArg, body) {
|
|
|
2492
2497
|
function parseHTMLToDataURL(html, opts) {
|
|
2493
2498
|
var width = opts.width, height = opts.height;
|
|
2494
2499
|
return new Promise(function (resolve, reject) {
|
|
2495
|
-
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""
|
|
2500
|
+
var _svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width || '', "\" height = \"").concat(height || '', "\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n ").concat(html, "\n </div>\n </foreignObject>\n </svg>\n ");
|
|
2496
2501
|
var blob = new Blob([_svg], { type: 'image/svg+xml;charset=utf-8' });
|
|
2497
2502
|
var reader = new FileReader();
|
|
2498
2503
|
reader.readAsDataURL(blob);
|
|
@@ -2714,11 +2719,11 @@ var Context$1 = (function () {
|
|
|
2714
2719
|
Context.prototype.setFont = function (opts) {
|
|
2715
2720
|
var strList = [];
|
|
2716
2721
|
if (opts.fontWeight === 'bold') {
|
|
2717
|
-
strList.push(""
|
|
2722
|
+
strList.push("".concat(opts.fontWeight));
|
|
2718
2723
|
}
|
|
2719
|
-
strList.push(this._doSize(opts.fontSize || 12)
|
|
2720
|
-
strList.push(""
|
|
2721
|
-
this._ctx.font = ""
|
|
2724
|
+
strList.push("".concat(this._doSize(opts.fontSize || 12), "px"));
|
|
2725
|
+
strList.push("".concat(opts.fontFamily || 'sans-serif'));
|
|
2726
|
+
this._ctx.font = "".concat(strList.join(' '));
|
|
2722
2727
|
};
|
|
2723
2728
|
Context.prototype.setTextBaseline = function (baseline) {
|
|
2724
2729
|
this._ctx.textBaseline = baseline;
|
|
@@ -2793,16 +2798,16 @@ function color$2(value) {
|
|
|
2793
2798
|
return isColorStr$1(value);
|
|
2794
2799
|
}
|
|
2795
2800
|
function imageURL$1(value) {
|
|
2796
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
2801
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
2797
2802
|
}
|
|
2798
2803
|
function imageBase64$1(value) {
|
|
2799
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
2804
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
2800
2805
|
}
|
|
2801
2806
|
function imageSrc$1(value) {
|
|
2802
2807
|
return (imageBase64$1(value) || imageURL$1(value));
|
|
2803
2808
|
}
|
|
2804
2809
|
function svg$1(value) {
|
|
2805
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
2810
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
2806
2811
|
}
|
|
2807
2812
|
function html$1(value) {
|
|
2808
2813
|
var result = false;
|
|
@@ -3848,16 +3853,16 @@ function color(value) {
|
|
|
3848
3853
|
return isColorStr(value);
|
|
3849
3854
|
}
|
|
3850
3855
|
function imageURL(value) {
|
|
3851
|
-
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test(""
|
|
3856
|
+
return (typeof value === 'string' && /^(http:\/\/|https:\/\/|\.\/|\/)/.test("".concat(value)));
|
|
3852
3857
|
}
|
|
3853
3858
|
function imageBase64(value) {
|
|
3854
|
-
return (typeof value === 'string' && /^(data:image\/)/.test(""
|
|
3859
|
+
return (typeof value === 'string' && /^(data:image\/)/.test("".concat(value)));
|
|
3855
3860
|
}
|
|
3856
3861
|
function imageSrc(value) {
|
|
3857
3862
|
return (imageBase64(value) || imageURL(value));
|
|
3858
3863
|
}
|
|
3859
3864
|
function svg(value) {
|
|
3860
|
-
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test(
|
|
3865
|
+
return (typeof value === 'string' && /^(<svg[\s]{1,}|<svg>)/i.test("".concat(value).trim()) && /<\/[\s]{0,}svg>$/i.test("".concat(value).trim()));
|
|
3861
3866
|
}
|
|
3862
3867
|
function html(value) {
|
|
3863
3868
|
var result = false;
|