redhotmagma-graphics-editor 1.51.1 → 1.51.3

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.
Files changed (50) hide show
  1. package/App.js +76 -81
  2. package/CanvasAdapters/Mock/Canvas.js +54 -62
  3. package/CanvasAdapters/Mock/Objects/CanvasObject.js +15 -17
  4. package/CanvasAdapters/Mock/Objects/Group.js +21 -23
  5. package/CanvasAdapters/Mock/Objects/Image.js +21 -23
  6. package/CanvasAdapters/Mock/Objects/Text.js +22 -24
  7. package/CanvasAdapters/PaperJs/Canvas.js +144 -164
  8. package/CanvasAdapters/PaperJs/Objects/CanvasObject.js +24 -25
  9. package/CanvasAdapters/PaperJs/Objects/Group.js +22 -24
  10. package/CanvasAdapters/PaperJs/Objects/Image.js +56 -62
  11. package/CanvasAdapters/PaperJs/Objects/Text.js +35 -36
  12. package/CanvasAdapters/PaperJs/Utils/HTML2Paper.js +11 -12
  13. package/CanvasAdapters/PaperJs/Utils/SVGfix.js +5 -5
  14. package/CanvasAdapters/PaperJs/Utils/StyleParams.js +3 -3
  15. package/CanvasAdapters/PaperJs/Utils/TextToSVGRepository.js +26 -27
  16. package/CanvasAdapters/PaperJs/Utils/UseColorLayer.js +1 -1
  17. package/CanvasAdapters/PaperJs/Utils/UseMask.js +49 -55
  18. package/CanvasInterface/Canvas.js +56 -61
  19. package/CanvasInterface/CanvasProvider.js +22 -24
  20. package/CanvasInterface/Objects/CanvasObject.js +16 -19
  21. package/CanvasInterface/Observable.js +10 -11
  22. package/CanvasInterface/canvasConnect.js +21 -23
  23. package/CanvasInterface/index.js +1 -2
  24. package/Components/Canvas/Canvas.js +20 -22
  25. package/Components/Canvas/CanvasContainer.js +1 -1
  26. package/Components/DelayedContainer.js +19 -21
  27. package/Components/Editor/Editor.js +19 -20
  28. package/Components/Editor/EditorContainer.js +30 -32
  29. package/Components/InlineToolbox/InlineToolbox.js +40 -42
  30. package/Components/InlineToolbox/InlineToolboxButton.js +7 -7
  31. package/Components/ManipulableContainer.js +20 -22
  32. package/Components/ResizeDetect/ResizeDetect.js +20 -22
  33. package/Components/Rulers/Ruler.js +22 -25
  34. package/Components/Rulers/Rulers.js +17 -19
  35. package/Components/SelectionToolbox/ColorPalette.js +20 -23
  36. package/Components/SelectionToolbox/SelectionToolbox.js +25 -26
  37. package/Components/SelectionToolbox/TextTools.js +29 -31
  38. package/Components/StandardToolbox/StandardToolbox.js +63 -65
  39. package/Components/TextEditor/TextEditor.js +39 -41
  40. package/Components/TextEditor/TextEditorStateProvider.js +19 -21
  41. package/Components/Toolbox/ToolboxContainer.js +4 -4
  42. package/Components/Toolbox/ToolboxRow.js +4 -4
  43. package/Utils/DOM.js +7 -7
  44. package/Utils/Device.js +1 -1
  45. package/Utils/Logger.js +7 -8
  46. package/Utils/Range.js +1 -1
  47. package/_demos/UsingExternalControls/App.js +18 -20
  48. package/_demos/UsingRenderProps/App.js +21 -23
  49. package/index.js +4 -2
  50. package/package.json +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Canvas = void 0;
7
7
  var _paper = _interopRequireDefault(require("paper"));
8
- var _Canvas = require("../../CanvasInterface/Canvas");
8
+ var _Canvas2 = require("../../CanvasInterface/Canvas");
9
9
  var _Group = require("./Objects/Group");
10
10
  var _Image = require("./Objects/Image");
11
11
  var _Text = require("./Objects/Text");
@@ -16,66 +16,67 @@ var _HTML2Paper = require("./Utils/HTML2Paper");
16
16
  var _SVGfix = require("./Utils/SVGfix");
17
17
  var _UseColorLayer = require("./Utils/UseColorLayer");
18
18
  var _excluded = ["type"];
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
20
20
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
21
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
22
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
22
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
23
23
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
26
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
28
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
30
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
31
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
32
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
35
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
36
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
37
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
41
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
42
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
46
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
47
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
25
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
26
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
27
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
28
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
29
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
30
+ function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
31
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
32
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
33
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
34
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
35
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
36
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
37
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
38
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
39
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
40
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
41
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
42
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
43
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
44
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
45
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
46
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
47
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
48
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
49
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
50
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
48
51
  var logger = new _Logger["default"]('Canvas');
49
52
  var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
50
- _inherits(Canvas, _AbstractCanvas);
51
- var _super = _createSuper(Canvas);
52
53
  function Canvas() {
53
54
  var _this;
54
55
  _classCallCheck(this, Canvas);
55
56
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
56
57
  args[_key] = arguments[_key];
57
58
  }
58
- _this = _super.call.apply(_super, [this].concat(args));
59
- _defineProperty(_assertThisInitialized(_this), "Image", Canvas.Image);
60
- _defineProperty(_assertThisInitialized(_this), "Text", Canvas.Text);
61
- _defineProperty(_assertThisInitialized(_this), "Group", Canvas.Group);
62
- _defineProperty(_assertThisInitialized(_this), "_project", void 0);
63
- _defineProperty(_assertThisInitialized(_this), "_view", void 0);
59
+ _this = _callSuper(this, Canvas, [].concat(args));
60
+ _defineProperty(_this, "Image", Canvas.Image);
61
+ _defineProperty(_this, "Text", Canvas.Text);
62
+ _defineProperty(_this, "Group", Canvas.Group);
63
+ _defineProperty(_this, "_project", void 0);
64
+ _defineProperty(_this, "_view", void 0);
64
65
  // prevents dragging out the object (by default lets dragging only up to the 2/3 of the object width)
65
- _defineProperty(_assertThisInitialized(_this), "_boundTolerance", 1 / 2 - 2 / 3);
66
- _defineProperty(_assertThisInitialized(_this), "_maskHandler", undefined);
67
- _defineProperty(_assertThisInitialized(_this), "_colorOverlay", undefined);
68
- _defineProperty(_assertThisInitialized(_this), "getScreenshot", function () {
66
+ _defineProperty(_this, "_boundTolerance", 1 / 2 - 2 / 3);
67
+ _defineProperty(_this, "_maskHandler", undefined);
68
+ _defineProperty(_this, "_colorOverlay", undefined);
69
+ _defineProperty(_this, "getScreenshot", function () {
69
70
  // speed up repeated screenshot creation by memoizing the svg output of Paper.js
70
71
  var memoizedSvgStr;
71
72
  var result;
72
73
  return /*#__PURE__*/function () {
73
74
  var _ref = _asyncToGenerator(function (fontToFileMap) {
74
75
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
75
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
76
+ return /*#__PURE__*/_regenerator().m(function _callee() {
76
77
  var _options$memoize, memoize, svgStr, xmlDoc, xmlStr;
77
- return _regeneratorRuntime().wrap(function _callee$(_context) {
78
- while (1) switch (_context.prev = _context.next) {
78
+ return _regenerator().w(function (_context) {
79
+ while (1) switch (_context.n) {
79
80
  case 0:
80
81
  _options$memoize = options.memoize, memoize = _options$memoize === void 0 ? true : _options$memoize;
81
82
  svgStr = (0, _SVGfix.prepareSvgStr)(_this._project.exportSVG({
@@ -83,17 +84,17 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
83
84
  embedImages: false
84
85
  }));
85
86
  if (!(memoize && memoizedSvgStr === svgStr && result)) {
86
- _context.next = 4;
87
+ _context.n = 1;
87
88
  break;
88
89
  }
89
- return _context.abrupt("return", result);
90
- case 4:
90
+ return _context.a(2, result);
91
+ case 1:
91
92
  result = '';
92
93
  xmlDoc = new DOMParser().parseFromString(svgStr, 'text/xml');
93
94
  (0, _HTML2Paper.removePlaceholders)(xmlDoc);
94
- _context.next = 9;
95
+ _context.n = 2;
95
96
  return (0, _TextToSVGRepository.transformTextToPath)(xmlDoc, fontToFileMap);
96
- case 9:
97
+ case 2:
97
98
  (0, _SVGfix.wrapWithViewGroup)(xmlDoc);
98
99
  if (_this._maskHandler) {
99
100
  _this._maskHandler.fixSVGExport(xmlDoc);
@@ -103,10 +104,7 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
103
104
  if (memoize) {
104
105
  memoizedSvgStr = svgStr;
105
106
  }
106
- return _context.abrupt("return", result);
107
- case 15:
108
- case "end":
109
- return _context.stop();
107
+ return _context.a(2, result);
110
108
  }
111
109
  }, _callee);
112
110
  })();
@@ -118,7 +116,8 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
118
116
  }());
119
117
  return _this;
120
118
  }
121
- _createClass(Canvas, [{
119
+ _inherits(Canvas, _AbstractCanvas);
120
+ return _createClass(Canvas, [{
122
121
  key: "setBoundTolerance",
123
122
  value: function setBoundTolerance(value) {
124
123
  this._boundTolerance = value;
@@ -132,7 +131,7 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
132
131
  this._view = this._project.view;
133
132
  this._project.activeLayer.name = 'designerLayer';
134
133
  this.initControls();
135
- _get(_getPrototypeOf(Canvas.prototype), "init", this).call(this, this._view.element, options);
134
+ _superPropGet(Canvas, "init", this, 3)([this._view.element, options]);
136
135
  }
137
136
  }, {
138
137
  key: "initControls",
@@ -167,20 +166,20 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
167
166
  this._view = null;
168
167
  this._project.remove();
169
168
  this._project = null;
170
- _get(_getPrototypeOf(Canvas.prototype), "dispose", this).call(this);
169
+ _superPropGet(Canvas, "dispose", this, 3)([]);
171
170
  }
172
171
  }, {
173
172
  key: "setSize",
174
173
  value: function setSize() {
175
174
  var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSize();
176
- _get(_getPrototypeOf(Canvas.prototype), "setSize", this).call(this, size);
175
+ _superPropGet(Canvas, "setSize", this, 3)([size]);
177
176
  this.updateViewSize();
178
177
  return this;
179
178
  }
180
179
  }, {
181
180
  key: "setZoom",
182
181
  value: function setZoom(zoom) {
183
- _get(_getPrototypeOf(Canvas.prototype), "setZoom", this).call(this, zoom);
182
+ _superPropGet(Canvas, "setZoom", this, 3)([zoom]);
184
183
  this.updateViewSize();
185
184
  return this;
186
185
  }
@@ -233,10 +232,10 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
233
232
  var _drawToContext = _asyncToGenerator(function (ctx, dx, dy, dWidth, dHeight) {
234
233
  var _this3 = this;
235
234
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
236
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
235
+ return /*#__PURE__*/_regenerator().m(function _callee2() {
237
236
  var TILE_SIZE, currentZoom, restoreViewBox, dstSize, srcSize, zoom, framesX, framesY, tiles, _loop, fx;
238
- return _regeneratorRuntime().wrap(function _callee2$(_context4) {
239
- while (1) switch (_context4.prev = _context4.next) {
237
+ return _regenerator().w(function (_context4) {
238
+ while (1) switch (_context4.n) {
240
239
  case 0:
241
240
  TILE_SIZE = 512; // safe for ios
242
241
  currentZoom = Math.min(Math.max(options.currentZoom || 1, 0.0001), 1);
@@ -252,14 +251,14 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
252
251
  return zoom;
253
252
  }
254
253
  });
255
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(fx) {
254
+ _loop = /*#__PURE__*/_regenerator().m(function _loop(fx) {
256
255
  var _loop2, fy;
257
- return _regeneratorRuntime().wrap(function _loop$(_context3) {
258
- while (1) switch (_context3.prev = _context3.next) {
256
+ return _regenerator().w(function (_context3) {
257
+ while (1) switch (_context3.n) {
259
258
  case 0:
260
- _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(fy) {
261
- return _regeneratorRuntime().wrap(function _loop2$(_context2) {
262
- while (1) switch (_context2.prev = _context2.next) {
259
+ _loop2 = /*#__PURE__*/_regenerator().m(function _loop2(fy) {
260
+ return _regenerator().w(function (_context2) {
261
+ while (1) switch (_context2.n) {
263
262
  case 0:
264
263
  tiles.push(new Promise(function (resolve) {
265
264
  window.requestAnimationFrame(function () {
@@ -275,47 +274,44 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
275
274
  });
276
275
  }));
277
276
  case 1:
278
- case "end":
279
- return _context2.stop();
277
+ return _context2.a(2);
280
278
  }
281
279
  }, _loop2);
282
280
  });
283
281
  fy = 0;
284
- case 2:
282
+ case 1:
285
283
  if (!(fy < framesY)) {
286
- _context3.next = 7;
284
+ _context3.n = 3;
287
285
  break;
288
286
  }
289
- return _context3.delegateYield(_loop2(fy), "t0", 4);
290
- case 4:
287
+ return _context3.d(_regeneratorValues(_loop2(fy)), 2);
288
+ case 2:
291
289
  fy++;
292
- _context3.next = 2;
290
+ _context3.n = 1;
293
291
  break;
294
- case 7:
295
- case "end":
296
- return _context3.stop();
292
+ case 3:
293
+ return _context3.a(2);
297
294
  }
298
295
  }, _loop);
299
296
  });
300
297
  fx = 0;
301
- case 12:
298
+ case 1:
302
299
  if (!(fx < framesX)) {
303
- _context4.next = 17;
300
+ _context4.n = 3;
304
301
  break;
305
302
  }
306
- return _context4.delegateYield(_loop(fx), "t0", 14);
307
- case 14:
303
+ return _context4.d(_regeneratorValues(_loop(fx)), 2);
304
+ case 2:
308
305
  fx++;
309
- _context4.next = 12;
306
+ _context4.n = 1;
310
307
  break;
311
- case 17:
312
- _context4.next = 19;
308
+ case 3:
309
+ _context4.n = 4;
313
310
  return Promise.all(tiles);
314
- case 19:
311
+ case 4:
315
312
  restoreViewBox();
316
- case 20:
317
- case "end":
318
- return _context4.stop();
313
+ case 5:
314
+ return _context4.a(2);
319
315
  }
320
316
  }, _callee2);
321
317
  })();
@@ -334,21 +330,18 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
334
330
  }, {
335
331
  key: "useMask",
336
332
  value: function () {
337
- var _useMask2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(maskData) {
338
- return _regeneratorRuntime().wrap(function _callee3$(_context5) {
339
- while (1) switch (_context5.prev = _context5.next) {
333
+ var _useMask2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(maskData) {
334
+ var _t, _t2;
335
+ return _regenerator().w(function (_context5) {
336
+ while (1) switch (_context5.n) {
340
337
  case 0:
341
- _context5.t0 = Object;
342
- _context5.t1 = this._maskHandler || {};
343
- _context5.next = 4;
338
+ _t = Object;
339
+ _t2 = this._maskHandler || {};
340
+ _context5.n = 1;
344
341
  return (0, _UseMask.useMask)(this._project, maskData);
345
- case 4:
346
- _context5.t2 = _context5.sent;
347
- this._maskHandler = _context5.t0.assign.call(_context5.t0, _context5.t1, _context5.t2);
348
- return _context5.abrupt("return", this._maskHandler);
349
- case 7:
350
- case "end":
351
- return _context5.stop();
342
+ case 1:
343
+ this._maskHandler = _t.assign.call(_t, _t2, _context5.v);
344
+ return _context5.a(2, this._maskHandler);
352
345
  }
353
346
  }, _callee3, this);
354
347
  }));
@@ -510,7 +503,7 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
510
503
  key: "setObjectIndex",
511
504
  value: function setObjectIndex(obj, pos) {
512
505
  var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
513
- _get(_getPrototypeOf(Canvas.prototype), "setObjectIndex", this).call(this, obj, pos, overwrite);
506
+ _superPropGet(Canvas, "setObjectIndex", this, 3)([obj, pos, overwrite]);
514
507
  var layer = this._project.activeLayer;
515
508
  layer.removeChildren(layer.firstChild.isClipMask() ? 1 : 0);
516
509
  layer.addChildren(this.objects.map(function (o) {
@@ -520,7 +513,7 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
520
513
  }, {
521
514
  key: "add",
522
515
  value: function add(obj) {
523
- _get(_getPrototypeOf(Canvas.prototype), "add", this).call(this, obj);
516
+ _superPropGet(Canvas, "add", this, 3)([obj]);
524
517
  if (obj.wrappedObject) {
525
518
  // make sure the object is added to the active layer of the associated project
526
519
  obj.wrappedObject.addTo(this._project.activeLayer);
@@ -537,26 +530,23 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
537
530
  }, {
538
531
  key: "addImage",
539
532
  value: function () {
540
- var _addImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
533
+ var _addImage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
541
534
  var src, image;
542
- return _regeneratorRuntime().wrap(function _callee4$(_context6) {
543
- while (1) switch (_context6.prev = _context6.next) {
535
+ return _regenerator().w(function (_context6) {
536
+ while (1) switch (_context6.n) {
544
537
  case 0:
545
538
  src = options.src;
546
539
  image = new this.Image(options);
547
540
  if (!src) {
548
- _context6.next = 5;
541
+ _context6.n = 1;
549
542
  break;
550
543
  }
551
- _context6.next = 5;
544
+ _context6.n = 1;
552
545
  return image.loadFromURL(src);
553
- case 5:
546
+ case 1:
554
547
  this.add(image);
555
548
  logger.log('Image has been added.', image);
556
- return _context6.abrupt("return", image);
557
- case 8:
558
- case "end":
559
- return _context6.stop();
549
+ return _context6.a(2, image);
560
550
  }
561
551
  }, _callee4, this);
562
552
  }));
@@ -568,26 +558,23 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
568
558
  }, {
569
559
  key: "addGroup",
570
560
  value: function () {
571
- var _addGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options) {
561
+ var _addGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(options) {
572
562
  var src, group;
573
- return _regeneratorRuntime().wrap(function _callee5$(_context7) {
574
- while (1) switch (_context7.prev = _context7.next) {
563
+ return _regenerator().w(function (_context7) {
564
+ while (1) switch (_context7.n) {
575
565
  case 0:
576
566
  src = options.src;
577
567
  group = new this.Group(options);
578
568
  if (!src) {
579
- _context7.next = 5;
569
+ _context7.n = 1;
580
570
  break;
581
571
  }
582
- _context7.next = 5;
572
+ _context7.n = 1;
583
573
  return group.loadFromURL(src);
584
- case 5:
574
+ case 1:
585
575
  this.add(group);
586
576
  logger.log('Group has been added.', group);
587
- return _context7.abrupt("return", group);
588
- case 8:
589
- case "end":
590
- return _context7.stop();
577
+ return _context7.a(2, group);
591
578
  }
592
579
  }, _callee5, this);
593
580
  }));
@@ -599,45 +586,42 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
599
586
  }, {
600
587
  key: "addItemFromObject",
601
588
  value: function () {
602
- var _addItemFromObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(options, index, overwrite) {
603
- var type, props, object;
604
- return _regeneratorRuntime().wrap(function _callee6$(_context8) {
605
- while (1) switch (_context8.prev = _context8.next) {
589
+ var _addItemFromObject = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(options, index, overwrite) {
590
+ var type, props, object, _t3;
591
+ return _regenerator().w(function (_context8) {
592
+ while (1) switch (_context8.n) {
606
593
  case 0:
607
594
  type = options.type, props = _objectWithoutProperties(options, _excluded);
608
- _context8.t0 = type;
609
- _context8.next = _context8.t0 === 'Image' ? 4 : _context8.t0 === 'Group' ? 8 : _context8.t0 === 'Text' ? 12 : 14;
595
+ _t3 = type;
596
+ _context8.n = _t3 === 'Image' ? 1 : _t3 === 'Group' ? 3 : _t3 === 'Text' ? 5 : 6;
610
597
  break;
611
- case 4:
612
- _context8.next = 6;
598
+ case 1:
599
+ _context8.n = 2;
613
600
  return this.addImage(props);
614
- case 6:
615
- object = _context8.sent;
616
- return _context8.abrupt("break", 16);
617
- case 8:
618
- _context8.next = 10;
601
+ case 2:
602
+ object = _context8.v;
603
+ return _context8.a(3, 7);
604
+ case 3:
605
+ _context8.n = 4;
619
606
  return this.addGroup(props);
620
- case 10:
621
- object = _context8.sent;
622
- return _context8.abrupt("break", 16);
623
- case 12:
607
+ case 4:
608
+ object = _context8.v;
609
+ return _context8.a(3, 7);
610
+ case 5:
624
611
  object = this.addText(props);
625
- return _context8.abrupt("break", 16);
626
- case 14:
612
+ return _context8.a(3, 7);
613
+ case 6:
627
614
  logger.error('Unknown type: ' + type);
628
- return _context8.abrupt("return");
629
- case 16:
615
+ return _context8.a(2);
616
+ case 7:
630
617
  if (typeof index === 'number') {
631
618
  object.setIndex(index, overwrite);
632
619
  }
633
- return _context8.abrupt("return", object);
634
- case 18:
635
- case "end":
636
- return _context8.stop();
620
+ return _context8.a(2, object);
637
621
  }
638
622
  }, _callee6, this);
639
623
  }));
640
- function addItemFromObject(_x10, _x11, _x12) {
624
+ function addItemFromObject(_x0, _x1, _x10) {
641
625
  return _addItemFromObject.apply(this, arguments);
642
626
  }
643
627
  return addItemFromObject;
@@ -645,25 +629,25 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
645
629
  }, {
646
630
  key: "getScreenshotsOfElements",
647
631
  value: function () {
648
- var _getScreenshotsOfElements = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(fontToFileMap) {
632
+ var _getScreenshotsOfElements = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(fontToFileMap) {
649
633
  var svgStr, xmlDoc, designerLayer, elements, _iterator, _step, element, xmlSerializer, screenshots, _iterator2, _step2, _element;
650
- return _regeneratorRuntime().wrap(function _callee7$(_context9) {
651
- while (1) switch (_context9.prev = _context9.next) {
634
+ return _regenerator().w(function (_context9) {
635
+ while (1) switch (_context9.n) {
652
636
  case 0:
653
- _context9.next = 2;
637
+ _context9.n = 1;
654
638
  return this.getScreenshot(fontToFileMap, {
655
639
  memoize: false
656
640
  });
657
- case 2:
658
- svgStr = _context9.sent;
641
+ case 1:
642
+ svgStr = _context9.v;
659
643
  xmlDoc = new DOMParser().parseFromString(svgStr, 'text/xml');
660
644
  designerLayer = xmlDoc.getElementById('designerLayer');
661
645
  if (designerLayer) {
662
- _context9.next = 7;
646
+ _context9.n = 2;
663
647
  break;
664
648
  }
665
- return _context9.abrupt("return", []);
666
- case 7:
649
+ return _context9.a(2, []);
650
+ case 2:
667
651
  elements = _toConsumableArray(designerLayer.children); // remove all elements from the active layer
668
652
  _iterator = _createForOfIteratorHelper(elements);
669
653
  try {
@@ -691,21 +675,17 @@ var Canvas = exports.Canvas = /*#__PURE__*/function (_AbstractCanvas) {
691
675
  } finally {
692
676
  _iterator2.f();
693
677
  }
694
- return _context9.abrupt("return", screenshots);
695
- case 15:
696
- case "end":
697
- return _context9.stop();
678
+ return _context9.a(2, screenshots);
698
679
  }
699
680
  }, _callee7, this);
700
681
  }));
701
- function getScreenshotsOfElements(_x13) {
682
+ function getScreenshotsOfElements(_x11) {
702
683
  return _getScreenshotsOfElements.apply(this, arguments);
703
684
  }
704
685
  return getScreenshotsOfElements;
705
686
  }()
706
687
  }]);
707
- return Canvas;
708
- }(_Canvas.AbstractCanvas);
688
+ }(_Canvas2.AbstractCanvas);
709
689
  _defineProperty(Canvas, "Image", _Image.Image);
710
690
  _defineProperty(Canvas, "Text", _Text.Text);
711
691
  _defineProperty(Canvas, "Group", _Group.Group);