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