- Fix: Avoid race condition in `jQuery.svgIcons.js` (evident
when attempting to load from `file:` URL in Chrome) - npm: Update devDepsmaster
parent
b5e61a238e
commit
f734625587
|
@ -4,6 +4,8 @@
|
|||
|
||||
- Deprecated: Should now use `avoidClientSideDownload` in place of
|
||||
`avoidClientSide` (config for `ext-server_opensave.js`).
|
||||
- Fix: Avoid race condition in `jQuery.svgIcons.js` (evident
|
||||
when attempting to load from `file:` URL in Chrome)
|
||||
- Enhancement: Added `avoidClientSideOpen` config for
|
||||
`ext-server_opensave.js`
|
||||
- Optimization: Re-rerun image optimization per update
|
||||
|
|
|
@ -134,6 +134,44 @@ var canvg = (function (exports) {
|
|||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -238,6 +276,71 @@ var canvg = (function (exports) {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* For parsing color values
|
||||
* @module RGBColor
|
||||
|
@ -392,7 +495,11 @@ var canvg = (function (exports) {
|
|||
}; // array of color definition objects
|
||||
|
||||
var colorDefs = [{
|
||||
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
|
||||
re: _wrapRegExp(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
|
||||
process: function process(_) {
|
||||
for (var _len = arguments.length, bits = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
@ -404,7 +511,11 @@ var canvg = (function (exports) {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{2})(\w{2})(\w{2})$/,
|
||||
re: _wrapRegExp(/^(\w{2})(\w{2})(\w{2})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#00ff00', '336699'],
|
||||
process: function process(_) {
|
||||
for (var _len2 = arguments.length, bits = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
|
@ -416,7 +527,11 @@ var canvg = (function (exports) {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{1})(\w{1})(\w{1})$/,
|
||||
re: _wrapRegExp(/^(\w{1})(\w{1})(\w{1})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#fb0', 'f0f'],
|
||||
process: function process(_) {
|
||||
for (var _len3 = arguments.length, bits = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
|
@ -479,7 +594,7 @@ var canvg = (function (exports) {
|
|||
});
|
||||
_this.ok = true;
|
||||
}
|
||||
}, this); // validate/cleanup values
|
||||
}); // validate/cleanup values
|
||||
|
||||
this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r;
|
||||
this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g;
|
||||
|
@ -890,7 +1005,7 @@ var canvg = (function (exports) {
|
|||
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -971,6 +1086,8 @@ var canvg = (function (exports) {
|
|||
|
||||
return svg.load(ctx, s);
|
||||
};
|
||||
/* eslint-disable jsdoc/check-types */
|
||||
|
||||
/**
|
||||
* @param {module:canvg.CanvgOptions} opts
|
||||
* @returns {object}
|
||||
|
@ -978,6 +1095,7 @@ var canvg = (function (exports) {
|
|||
*/
|
||||
|
||||
function build(opts) {
|
||||
/* eslint-enable jsdoc/check-types */
|
||||
var svg = {
|
||||
opts: opts
|
||||
};
|
||||
|
|
|
@ -37,6 +37,170 @@ var svgEditorExtension_arrows = (function () {
|
|||
};
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-arrows.js
|
||||
*
|
||||
|
@ -237,13 +401,15 @@ var svgEditorExtension_arrows = (function () {
|
|||
return null;
|
||||
}
|
||||
|
||||
var m = str.match(/\(#(.*)\)/);
|
||||
var m = str.match(_wrapRegExp(/\(#(.+)\)/, {
|
||||
id: 1
|
||||
}));
|
||||
|
||||
if (!m || m.length !== 2) {
|
||||
if (!m || !m.groups.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return svgCanvas.getElem(m[1]);
|
||||
return svgCanvas.getElem(m.groups.id);
|
||||
};
|
||||
|
||||
unsetArrowNonce = function _ref4(win) {
|
||||
|
|
|
@ -37,6 +37,170 @@ var svgEditorExtension_markers = (function () {
|
|||
};
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-markers.js
|
||||
*
|
||||
|
@ -337,7 +501,7 @@ var svgEditorExtension_markers = (function () {
|
|||
convertline = function _ref6(elem) {
|
||||
// this routine came from the connectors extension
|
||||
// it is needed because midpoint markers don't work with line elements
|
||||
if (!(elem.tagName === 'line')) {
|
||||
if (elem.tagName !== 'line') {
|
||||
return elem;
|
||||
} // Convert to polyline to accept mid-arrow
|
||||
|
||||
|
@ -535,13 +699,15 @@ var svgEditorExtension_markers = (function () {
|
|||
return null;
|
||||
}
|
||||
|
||||
var m = str.match(/\(#(.*)\)/);
|
||||
var m = str.match(_wrapRegExp(/\(#(.+)\)/, {
|
||||
id: 1
|
||||
}));
|
||||
|
||||
if (!m || m.length !== 2) {
|
||||
if (!m || !m.groups.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return svgCanvas.getElem(m[1]);
|
||||
return svgCanvas.getElem(m.groups.id);
|
||||
};
|
||||
|
||||
_context3.next = 17;
|
||||
|
|
|
@ -37,6 +37,105 @@ var svgEditorExtension_placemark = (function () {
|
|||
};
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
@ -75,6 +174,71 @@ var svgEditorExtension_placemark = (function () {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-placemark.js
|
||||
*
|
||||
|
@ -321,13 +485,15 @@ var svgEditorExtension_placemark = (function () {
|
|||
return null;
|
||||
}
|
||||
|
||||
var m = str.match(/\(#(.*)\)/);
|
||||
var m = str.match(_wrapRegExp(/\(#(.+)\)/, {
|
||||
id: 1
|
||||
}));
|
||||
|
||||
if (!m || m.length !== 2) {
|
||||
if (!m || !m.groups.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return svgCanvas.getElem(m[1]);
|
||||
return svgCanvas.getElem(m.groups.id);
|
||||
};
|
||||
|
||||
showPanel = function _ref(on) {
|
||||
|
|
|
@ -134,6 +134,44 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -238,6 +276,71 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* For parsing color values
|
||||
* @module RGBColor
|
||||
|
@ -392,7 +495,11 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
}; // array of color definition objects
|
||||
|
||||
var colorDefs = [{
|
||||
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
|
||||
re: _wrapRegExp(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
|
||||
process: function process(_) {
|
||||
for (var _len = arguments.length, bits = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
@ -404,7 +511,11 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{2})(\w{2})(\w{2})$/,
|
||||
re: _wrapRegExp(/^(\w{2})(\w{2})(\w{2})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#00ff00', '336699'],
|
||||
process: function process(_) {
|
||||
for (var _len2 = arguments.length, bits = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
|
@ -416,7 +527,11 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{1})(\w{1})(\w{1})$/,
|
||||
re: _wrapRegExp(/^(\w{1})(\w{1})(\w{1})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#fb0', 'f0f'],
|
||||
process: function process(_) {
|
||||
for (var _len3 = arguments.length, bits = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
|
@ -479,7 +594,7 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
});
|
||||
_this.ok = true;
|
||||
}
|
||||
}, this); // validate/cleanup values
|
||||
}); // validate/cleanup values
|
||||
|
||||
this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r;
|
||||
this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g;
|
||||
|
@ -890,7 +1005,7 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -971,6 +1086,8 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
|
||||
return svg.load(ctx, s);
|
||||
};
|
||||
/* eslint-disable jsdoc/check-types */
|
||||
|
||||
/**
|
||||
* @param {module:canvg.CanvgOptions} opts
|
||||
* @returns {object}
|
||||
|
@ -978,6 +1095,7 @@ var svgEditorExtension_server_moinsave = (function () {
|
|||
*/
|
||||
|
||||
function build(opts) {
|
||||
/* eslint-enable jsdoc/check-types */
|
||||
var svg = {
|
||||
opts: opts
|
||||
};
|
||||
|
|
|
@ -134,6 +134,44 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -238,6 +276,71 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* For parsing color values
|
||||
* @module RGBColor
|
||||
|
@ -392,7 +495,11 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
}; // array of color definition objects
|
||||
|
||||
var colorDefs = [{
|
||||
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
|
||||
re: _wrapRegExp(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
|
||||
process: function process(_) {
|
||||
for (var _len = arguments.length, bits = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
@ -404,7 +511,11 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{2})(\w{2})(\w{2})$/,
|
||||
re: _wrapRegExp(/^(\w{2})(\w{2})(\w{2})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#00ff00', '336699'],
|
||||
process: function process(_) {
|
||||
for (var _len2 = arguments.length, bits = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
|
@ -416,7 +527,11 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{1})(\w{1})(\w{1})$/,
|
||||
re: _wrapRegExp(/^(\w{1})(\w{1})(\w{1})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#fb0', 'f0f'],
|
||||
process: function process(_) {
|
||||
for (var _len3 = arguments.length, bits = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
|
@ -479,7 +594,7 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
});
|
||||
_this.ok = true;
|
||||
}
|
||||
}, this); // validate/cleanup values
|
||||
}); // validate/cleanup values
|
||||
|
||||
this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r;
|
||||
this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g;
|
||||
|
@ -890,7 +1005,7 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -971,6 +1086,8 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
|
||||
return svg.load(ctx, s);
|
||||
};
|
||||
/* eslint-disable jsdoc/check-types */
|
||||
|
||||
/**
|
||||
* @param {module:canvg.CanvgOptions} opts
|
||||
* @returns {object}
|
||||
|
@ -978,6 +1095,7 @@ var svgEditorExtension_server_opensave = (function () {
|
|||
*/
|
||||
|
||||
function build(opts) {
|
||||
/* eslint-enable jsdoc/check-types */
|
||||
var svg = {
|
||||
opts: opts
|
||||
};
|
||||
|
|
|
@ -37,6 +37,105 @@ var svgEditorExtension_storage = (function () {
|
|||
};
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
@ -75,6 +174,71 @@ var svgEditorExtension_storage = (function () {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-storage.js
|
||||
*
|
||||
|
@ -125,8 +289,11 @@ var svgEditorExtension_storage = (function () {
|
|||
var loc = top.location; // Allow this to work with the embedded editor as well
|
||||
|
||||
if (loc.href.includes('storagePrompt=')) {
|
||||
loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) {
|
||||
return (val ? n1 : '') + val + (!val && amp ? n1 : amp || '');
|
||||
loc.href = loc.href.replace(_wrapRegExp(/([&?])storagePrompt=[^&]*(&?)/, {
|
||||
sep: 1,
|
||||
amp: 2
|
||||
}), function (n0, sep, amp) {
|
||||
return (val ? sep : '') + val + (!val && amp ? sep : amp || '');
|
||||
});
|
||||
} else {
|
||||
loc.href += (loc.href.includes('?') ? '&' : '?') + val;
|
||||
|
|
|
@ -119,6 +119,74 @@ function _setPrototypeOf(o, p) {
|
|||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -193,6 +261,71 @@ function _nonIterableRest() {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
// http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
|
||||
|
||||
/**
|
||||
|
@ -3167,22 +3300,35 @@ function () {
|
|||
} // TODO: Add skew support in future
|
||||
|
||||
|
||||
var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;
|
||||
var re = _wrapRegExp(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/, {
|
||||
xform: 1
|
||||
});
|
||||
|
||||
var m = true;
|
||||
|
||||
while (m) {
|
||||
m = str.match(re);
|
||||
str = str.replace(re, '');
|
||||
|
||||
if (m && m[1]) {
|
||||
if (m && m.groups.xform) {
|
||||
(function () {
|
||||
var x = m[1];
|
||||
var bits = x.split(/\s*\(/);
|
||||
var name = bits[0];
|
||||
var valBits = bits[1].match(/\s*(.*?)\s*\)/);
|
||||
valBits[1] = valBits[1].replace(/(\d)-/g, '$1 -');
|
||||
var valArr = valBits[1].split(/[, ]+/);
|
||||
var letters = 'abcdef'.split('');
|
||||
var x = m.groups.xform;
|
||||
|
||||
var _x$split = x.split(/\s*\(/),
|
||||
_x$split2 = _slicedToArray(_x$split, 2),
|
||||
name = _x$split2[0],
|
||||
bits = _x$split2[1];
|
||||
|
||||
var valBits = bits.match(_wrapRegExp(/\s*(.*?)\s*\)/, {
|
||||
nonWhitespace: 1
|
||||
}));
|
||||
valBits.groups.nonWhitespace = valBits.groups.nonWhitespace.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
var valArr = valBits.groups.nonWhitespace.split(/[, ]+/);
|
||||
|
||||
var letters = _toConsumableArray('abcdef');
|
||||
|
||||
var mtx = svgroot.createSVGMatrix();
|
||||
Object.values(valArr).forEach(function (item, i) {
|
||||
valArr[i] = parseFloat(item);
|
||||
|
@ -6515,11 +6661,12 @@ var reorientGrads = function reorientGrads(elem, m) {
|
|||
var pt1 = transformPoint(x1, y1, m);
|
||||
var pt2 = transformPoint(x2, y2, m); // Convert back to BB points
|
||||
|
||||
var gCoords = {};
|
||||
gCoords.x1 = (pt1.x - bb.x) / bb.width;
|
||||
gCoords.y1 = (pt1.y - bb.y) / bb.height;
|
||||
gCoords.x2 = (pt2.x - bb.x) / bb.width;
|
||||
gCoords.y2 = (pt2.y - bb.y) / bb.height;
|
||||
var gCoords = {
|
||||
x1: (pt1.x - bb.x) / bb.width,
|
||||
y1: (pt1.y - bb.y) / bb.height,
|
||||
x2: (pt2.x - bb.x) / bb.width,
|
||||
y2: (pt2.y - bb.y) / bb.height
|
||||
};
|
||||
var newgrad = grad.cloneNode(true);
|
||||
$$1(newgrad).attr(gCoords);
|
||||
newgrad.id = editorContext_.getNextId();
|
||||
|
@ -6703,6 +6850,7 @@ var convertPath = function convertPath(pth, toRel) {
|
|||
|
||||
d += pathDSegment(letter, [[x1, y1], [x, y]]);
|
||||
break;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
|
||||
case 10:
|
||||
// absolute elliptical arc (A)
|
||||
|
@ -7950,7 +8098,10 @@ var init$2 = function init(editorContext) {
|
|||
*/
|
||||
|
||||
var dropXMLInteralSubset = function dropXMLInteralSubset(str) {
|
||||
return str.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, '$1$2');
|
||||
return str.replace(_wrapRegExp(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, {
|
||||
doctypeOpen: 1,
|
||||
doctypeClose: 2
|
||||
}), '$<doctypeOpen>$<doctypeClose>');
|
||||
};
|
||||
/**
|
||||
* Converts characters in a string to XML-friendly entities.
|
||||
|
@ -8090,9 +8241,16 @@ var dataURLToObjectURL = function dataURLToObjectURL(dataurl) {
|
|||
return '';
|
||||
}
|
||||
|
||||
var arr = dataurl.split(','),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]);
|
||||
var _dataurl$split = dataurl.split(','),
|
||||
_dataurl$split2 = _slicedToArray(_dataurl$split, 2),
|
||||
prefix = _dataurl$split2[0],
|
||||
suffix = _dataurl$split2[1],
|
||||
_prefix$match = prefix.match(_wrapRegExp(/:(.*?);/, {
|
||||
mime: 1
|
||||
})),
|
||||
mime = _prefix$match.groups.mime,
|
||||
bstr = atob(suffix);
|
||||
|
||||
var n = bstr.length;
|
||||
var u8arr = new Uint8Array(n);
|
||||
|
||||
|
@ -8144,6 +8302,7 @@ var blankPageObjectURL = function () {
|
|||
|
||||
var text2xml = function text2xml(sXML) {
|
||||
if (sXML.includes('<svg:svg')) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
sXML = sXML.replace(/<(\/?)svg:/g, '<$1').replace('xmlns:svg', 'xmlns');
|
||||
}
|
||||
|
||||
|
@ -8525,11 +8684,17 @@ var getBBox = function getBBox(elem) {
|
|||
|
||||
|
||||
if (!isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x') || 0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y') || 0);
|
||||
var _ret = ret,
|
||||
x = _ret.x,
|
||||
y = _ret.y,
|
||||
width = _ret.width,
|
||||
height = _ret.height;
|
||||
var bb = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + parseFloat(selected.getAttribute('x') || 0),
|
||||
y: y + parseFloat(selected.getAttribute('y') || 0)
|
||||
};
|
||||
ret = bb;
|
||||
}
|
||||
} else if (visElemsArr.includes(elname)) {
|
||||
|
@ -8541,12 +8706,13 @@ var getBBox = function getBBox(elem) {
|
|||
// Re: Chrome returning bbox for containing text element, see: https://bugs.chromium.org/p/chromium/issues/detail?id=349835
|
||||
var extent = selected.getExtentOfChar(0); // pos+dimensions of the first glyph
|
||||
|
||||
var width = selected.getComputedTextLength(); // width of the tspan
|
||||
var _width = selected.getComputedTextLength(); // width of the tspan
|
||||
|
||||
|
||||
ret = {
|
||||
x: extent.x,
|
||||
y: extent.y,
|
||||
width: width,
|
||||
width: _width,
|
||||
height: extent.height
|
||||
};
|
||||
}
|
||||
|
@ -9272,7 +9438,7 @@ var copyElem = function copyElem(el, getNextId) {
|
|||
};
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -9379,9 +9545,9 @@ function addScriptAtts(script, atts) {
|
|||
|
||||
/**
|
||||
* @function module:importModule.importSetGlobalDefault
|
||||
* @param {string|GenericArray<Any>} url
|
||||
* @param {string|GenericArray<any>} url
|
||||
* @param {module:importModule.ImportConfig} config
|
||||
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
|
||||
* @returns {Promise<any>} The value to which it resolves depends on the export of the targeted module.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -9502,7 +9668,7 @@ function importScript(url) {
|
|||
* @param {PlainObject} [atts={}]
|
||||
* @param {PlainObject} opts
|
||||
* @param {boolean} [opts.returnDefault=false} = {}]
|
||||
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
|
||||
* @returns {Promise<any>} Resolves to value of loading module or rejects with
|
||||
* `Error` upon a script loading error.
|
||||
*/
|
||||
|
||||
|
@ -11575,7 +11741,9 @@ var sanitizeSvg = function sanitizeSvg(node) {
|
|||
case 'gradientTransform':
|
||||
case 'patternTransform':
|
||||
{
|
||||
var val = attr.value.replace(/(\d)-/g, '$1 -');
|
||||
var val = attr.value.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
node.setAttribute(attrName, val);
|
||||
break;
|
||||
}
|
||||
|
@ -11708,9 +11876,8 @@ var init$4 = function init(editorContext) {
|
|||
};
|
||||
/**
|
||||
* Applies coordinate changes to an element based on the given matrix.
|
||||
* @function module:coords.remapElement
|
||||
* @implements {module:path.EditorContext#remapElement}
|
||||
* @returns {void}
|
||||
* @name module:coords.remapElement
|
||||
* @type {module:path.EditorContext#remapElement}
|
||||
*/
|
||||
|
||||
var remapElement = function remapElement(selected, changes, m) {
|
||||
|
@ -13681,9 +13848,8 @@ function SvgCanvas(container, config) {
|
|||
canvas.current_drawing_ = new Drawing(svgcontent, idprefix);
|
||||
/**
|
||||
* Returns the current Drawing.
|
||||
* @function module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @implements {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
* @returns {module:draw.Drawing}
|
||||
* @name module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @type {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
*/
|
||||
|
||||
var getCurrentDrawing = canvas.getCurrentDrawing = function () {
|
||||
|
@ -13762,9 +13928,8 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @implements {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
* @returns {Element} The new element
|
||||
* @name module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @type {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13820,8 +13985,7 @@ function SvgCanvas(container, config) {
|
|||
canvas.hasMatrixTransform = hasMatrixTransform;
|
||||
canvas.transformListToTransform = transformListToTransform;
|
||||
/**
|
||||
* @implements {module:utilities.EditorContext#getBaseUnit}
|
||||
* @returns {string}
|
||||
* @type {module:utilities.EditorContext#getBaseUnit}
|
||||
*/
|
||||
|
||||
var getBaseUnit = function getBaseUnit() {
|
||||
|
@ -13853,8 +14017,7 @@ function SvgCanvas(container, config) {
|
|||
canvas.convertToNum = convertToNum;
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @implements {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
*/
|
||||
|
||||
var getSVGContent = function getSVGContent() {
|
||||
|
@ -13862,9 +14025,8 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* Should really be an intersection with all needing to apply rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @implements {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
* @returns {Element[]} the array with selected DOM elements
|
||||
* @name module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @type {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13875,8 +14037,7 @@ function SvgCanvas(container, config) {
|
|||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
*/
|
||||
|
||||
var getSVGRoot = function getSVGRoot() {
|
||||
|
@ -13920,8 +14081,7 @@ function SvgCanvas(container, config) {
|
|||
this.cleanupElement = cleanupElement;
|
||||
/**
|
||||
* This should actually be an intersection not a union as all should apply.
|
||||
* @implements {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
* @returns {boolean}
|
||||
* @type {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
*/
|
||||
|
||||
var getGridSnapping = function getGridSnapping() {
|
||||
|
@ -14035,8 +14195,8 @@ function SvgCanvas(container, config) {
|
|||
});
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas~addCommandToHistory
|
||||
* @implements {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
* @name module:svgcanvas~addCommandToHistory
|
||||
* @type {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
*/
|
||||
|
||||
var addCommandToHistory = function addCommandToHistory(cmd) {
|
||||
|
@ -14044,9 +14204,8 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getZoom
|
||||
* @implements {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
* @returns {Float} The current zoom level
|
||||
* @name module:svgcanvas.SvgCanvas#getZoom
|
||||
* @type {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14055,9 +14214,8 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* This method rounds the incoming value to the nearest value based on the `currentZoom`
|
||||
* @function module:svgcanvas.SvgCanvas#round
|
||||
* @implements {module:path.EditorContext#round}
|
||||
* @returns {Float} Rounded value to nearest value based on `currentZoom`
|
||||
* @name module:svgcanvas.SvgCanvas#round
|
||||
* @type {module:path.EditorContext#round}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14090,18 +14248,16 @@ function SvgCanvas(container, config) {
|
|||
|
||||
var selectorManager = this.selectorManager = getSelectorManager();
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getNextId
|
||||
* @implements {module:path.EditorContext#getNextId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getNextId
|
||||
* @type {module:path.EditorContext#getNextId}
|
||||
*/
|
||||
|
||||
var getNextId = canvas.getNextId = function () {
|
||||
return getCurrentDrawing().getNextId();
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getId
|
||||
* @implements {module:path.EditorContext#getId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getId
|
||||
* @type {module:path.EditorContext#getId}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14110,11 +14266,8 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* The "implements" should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#call
|
||||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
* @name module:svgcanvas.SvgCanvas#call
|
||||
* @type {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14128,8 +14281,8 @@ function SvgCanvas(container, config) {
|
|||
/**
|
||||
* Clears the selection. The 'selected' handler is then optionally called.
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @implements {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @type {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
*/
|
||||
|
||||
|
@ -14150,10 +14303,9 @@ function SvgCanvas(container, config) {
|
|||
};
|
||||
/**
|
||||
* Adds a list of elements to the selection. The 'selected' handler is then called.
|
||||
* @function module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @implements {module:path.EditorContext#addToSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @type {module:path.EditorContext#addToSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14235,8 +14387,7 @@ function SvgCanvas(container, config) {
|
|||
}
|
||||
};
|
||||
/**
|
||||
* @implements {module:path.EditorContext#getOpacity}
|
||||
* @returns {Float}
|
||||
* @type {module:path.EditorContext#getOpacity}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14244,9 +14395,8 @@ function SvgCanvas(container, config) {
|
|||
return curShape.opacity;
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @implements {module:path.EditorContext#getMouseTarget}
|
||||
* @returns {Element} DOM element we want
|
||||
* @name module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @type {module:path.EditorContext#getMouseTarget}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14314,7 +14464,7 @@ function SvgCanvas(container, config) {
|
|||
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
* @type {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
|
@ -14979,7 +15129,7 @@ function SvgCanvas(container, config) {
|
|||
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
* @property {Any} data The data
|
||||
* @property {any} data The data
|
||||
* @property {string} origin The origin
|
||||
*/
|
||||
|
||||
|
@ -18584,10 +18734,12 @@ function SvgCanvas(container, config) {
|
|||
if (val) {
|
||||
if (val.startsWith('data:')) {
|
||||
// Check if an SVG-edit data URI
|
||||
var m = val.match(/svgedit_url=(.*?);/);
|
||||
var m = val.match(_wrapRegExp(/svgedit_url=(.*?);/, {
|
||||
url: 1
|
||||
}));
|
||||
|
||||
if (m) {
|
||||
var url = decodeURIComponent(m[1]);
|
||||
var url = decodeURIComponent(m.groups.url);
|
||||
$$9(new Image()).load(function () {
|
||||
image.setAttributeNS(NS.XLINK, 'xlink:href', url);
|
||||
}).attr('src', url);
|
||||
|
@ -22380,6 +22532,65 @@ $(function() {
|
|||
});
|
||||
*/
|
||||
|
||||
var isOpera$1 = Boolean(window.opera);
|
||||
|
||||
var fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera$1) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
|
||||
* @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
|
||||
|
@ -22391,9 +22602,9 @@ $(function() {
|
|||
* @returns {external:jQuery} The enhanced jQuery object
|
||||
*/
|
||||
|
||||
|
||||
function jQueryPluginSVGIcons($) {
|
||||
var svgIcons = {};
|
||||
var fixIDs;
|
||||
/**
|
||||
* Map of raster images with each key being the SVG icon ID
|
||||
* to replace, and the value the image file name
|
||||
|
@ -22452,8 +22663,7 @@ function jQueryPluginSVGIcons($) {
|
|||
iconsMade = false,
|
||||
dataLoaded = false,
|
||||
loadAttempts = 0;
|
||||
var isOpera = Boolean(window.opera),
|
||||
// ua = navigator.userAgent,
|
||||
var // ua = navigator.userAgent,
|
||||
// isSafari = (ua.includes('Safari/') && !ua.includes('Chrome/')),
|
||||
dataPre = 'data:image/svg+xml;charset=utf-8;base64,';
|
||||
var dataEl;
|
||||
|
@ -22572,7 +22782,7 @@ function jQueryPluginSVGIcons($) {
|
|||
|
||||
|
||||
function setIcon(target, icon, id, setID) {
|
||||
if (isOpera) icon.css('visibility', 'hidden');
|
||||
if (isOpera$1) icon.css('visibility', 'hidden');
|
||||
|
||||
if (opts.replace) {
|
||||
if (setID) icon.attr('id', id);
|
||||
|
@ -22594,7 +22804,7 @@ function jQueryPluginSVGIcons($) {
|
|||
target.append(icon);
|
||||
}
|
||||
|
||||
if (isOpera) {
|
||||
if (isOpera$1) {
|
||||
setTimeout(function () {
|
||||
icon.removeAttr('style');
|
||||
}, 1);
|
||||
|
@ -22686,7 +22896,7 @@ function jQueryPluginSVGIcons($) {
|
|||
svgroot.setAttribute('class', 'svg_icon'); // Without cloning, Firefox will make another GET request.
|
||||
// With cloning, causes issue in Opera/Win/Non-EN
|
||||
|
||||
if (!isOpera) svg = svg.cloneNode(true);
|
||||
if (!isOpera$1) svg = svg.cloneNode(true);
|
||||
svgroot.append(svg);
|
||||
var icon = void 0;
|
||||
|
||||
|
@ -22717,7 +22927,7 @@ function jQueryPluginSVGIcons($) {
|
|||
if (!svgIcons[id]) return;
|
||||
$(sel).each(function (i) {
|
||||
var copy = svgIcons[id].clone();
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i, true);
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i);
|
||||
setIcon($(this), copy, id);
|
||||
});
|
||||
});
|
||||
|
@ -22733,64 +22943,6 @@ function jQueryPluginSVGIcons($) {
|
|||
iconsMade = true;
|
||||
if (opts.callback) opts.callback(svgIcons);
|
||||
}
|
||||
|
||||
fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -22822,7 +22974,7 @@ function jQueryPluginSVGIcons($) {
|
|||
var icon = svgIcons[id];
|
||||
|
||||
if (uniqueClone && icon) {
|
||||
icon = fixIDs(icon, 0, true).clone(true);
|
||||
icon = fixIDs(icon, 0).clone(true);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
@ -24895,7 +25047,7 @@ function toFixedNumeric(value, precision) {
|
|||
}
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -29344,7 +29496,7 @@ editor.setConfig = function (opts, cfgCfg) {
|
|||
*
|
||||
* @param {module:SVGEditor.Config|module:SVGEditor.Prefs} cfgObj
|
||||
* @param {string} key
|
||||
* @param {Any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @param {any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
@ -29621,7 +29773,9 @@ editor.init = function () {
|
|||
if (!src) {
|
||||
// urldata.source may have been null if it ended with '='
|
||||
if (qstr.includes('source=data:')) {
|
||||
src = qstr.match(/source=(data:[^&]*)/)[1];
|
||||
src = qstr.match(_wrapRegExp(/source=(data:[^&]*)/, {
|
||||
src: 1
|
||||
})).groups.src;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29725,7 +29879,9 @@ editor.init = function () {
|
|||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
extName = extname.match(/^ext-(.+)\.js/);
|
||||
extName = extname.match(_wrapRegExp(/^ext-(.+)\.js/, {
|
||||
extName: 1
|
||||
})).groups.extName;
|
||||
|
||||
if (extName) {
|
||||
_context2.next = 3;
|
||||
|
@ -29748,12 +29904,12 @@ editor.init = function () {
|
|||
_context2.prev = 4;
|
||||
_context2.next = 7;
|
||||
return importSetGlobalDefault(url, {
|
||||
global: 'svgEditorExtension_' + extName[1].replace(/-/g, '_')
|
||||
global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
|
||||
});
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: _name2
|
||||
|
@ -29867,7 +30023,7 @@ editor.init = function () {
|
|||
|
||||
|
||||
var uaPrefix = function () {
|
||||
var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var regex = /^(?:Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var someScript = document.getElementsByTagName('script')[0];
|
||||
|
||||
for (var prop in someScript.style) {
|
||||
|
@ -31795,7 +31951,7 @@ editor.init = function () {
|
|||
zoomDone();
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32761,14 +32917,14 @@ editor.init = function () {
|
|||
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url'));
|
||||
$$b('#image_save_opts input').val([$$b.pref('img_save')]);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
var changeRectRadius = function changeRectRadius(ctl) {
|
||||
svgCanvas.setRectRadius(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32776,7 +32932,7 @@ editor.init = function () {
|
|||
svgCanvas.setFontSize(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32790,7 +32946,7 @@ editor.init = function () {
|
|||
svgCanvas.setStrokeWidth(val);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -35117,8 +35273,7 @@ editor.init = function () {
|
|||
|
||||
$$b(window).bind('load resize', centerCanvas);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
function stepFontSize(elem, step) {
|
||||
|
@ -35149,8 +35304,7 @@ editor.init = function () {
|
|||
return sugVal;
|
||||
}
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -36729,7 +36883,7 @@ var extensionsAdded = false;
|
|||
var messageQueue = [];
|
||||
/**
|
||||
* @param {PlainObject} info
|
||||
* @param {Any} info.data
|
||||
* @param {any} info.data
|
||||
* @param {string} info.origin
|
||||
* @fires module:svgcanvas.SvgCanvas#event:message
|
||||
* @returns {void}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -125,6 +125,74 @@
|
|||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -199,6 +267,71 @@
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
// http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
|
||||
|
||||
/**
|
||||
|
@ -3173,22 +3306,35 @@
|
|||
} // TODO: Add skew support in future
|
||||
|
||||
|
||||
var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;
|
||||
var re = _wrapRegExp(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/, {
|
||||
xform: 1
|
||||
});
|
||||
|
||||
var m = true;
|
||||
|
||||
while (m) {
|
||||
m = str.match(re);
|
||||
str = str.replace(re, '');
|
||||
|
||||
if (m && m[1]) {
|
||||
if (m && m.groups.xform) {
|
||||
(function () {
|
||||
var x = m[1];
|
||||
var bits = x.split(/\s*\(/);
|
||||
var name = bits[0];
|
||||
var valBits = bits[1].match(/\s*(.*?)\s*\)/);
|
||||
valBits[1] = valBits[1].replace(/(\d)-/g, '$1 -');
|
||||
var valArr = valBits[1].split(/[, ]+/);
|
||||
var letters = 'abcdef'.split('');
|
||||
var x = m.groups.xform;
|
||||
|
||||
var _x$split = x.split(/\s*\(/),
|
||||
_x$split2 = _slicedToArray(_x$split, 2),
|
||||
name = _x$split2[0],
|
||||
bits = _x$split2[1];
|
||||
|
||||
var valBits = bits.match(_wrapRegExp(/\s*(.*?)\s*\)/, {
|
||||
nonWhitespace: 1
|
||||
}));
|
||||
valBits.groups.nonWhitespace = valBits.groups.nonWhitespace.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
var valArr = valBits.groups.nonWhitespace.split(/[, ]+/);
|
||||
|
||||
var letters = _toConsumableArray('abcdef');
|
||||
|
||||
var mtx = svgroot.createSVGMatrix();
|
||||
Object.values(valArr).forEach(function (item, i) {
|
||||
valArr[i] = parseFloat(item);
|
||||
|
@ -6521,11 +6667,12 @@
|
|||
var pt1 = transformPoint(x1, y1, m);
|
||||
var pt2 = transformPoint(x2, y2, m); // Convert back to BB points
|
||||
|
||||
var gCoords = {};
|
||||
gCoords.x1 = (pt1.x - bb.x) / bb.width;
|
||||
gCoords.y1 = (pt1.y - bb.y) / bb.height;
|
||||
gCoords.x2 = (pt2.x - bb.x) / bb.width;
|
||||
gCoords.y2 = (pt2.y - bb.y) / bb.height;
|
||||
var gCoords = {
|
||||
x1: (pt1.x - bb.x) / bb.width,
|
||||
y1: (pt1.y - bb.y) / bb.height,
|
||||
x2: (pt2.x - bb.x) / bb.width,
|
||||
y2: (pt2.y - bb.y) / bb.height
|
||||
};
|
||||
var newgrad = grad.cloneNode(true);
|
||||
$$1(newgrad).attr(gCoords);
|
||||
newgrad.id = editorContext_.getNextId();
|
||||
|
@ -6709,6 +6856,7 @@
|
|||
|
||||
d += pathDSegment(letter, [[x1, y1], [x, y]]);
|
||||
break;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
|
||||
case 10:
|
||||
// absolute elliptical arc (A)
|
||||
|
@ -7956,7 +8104,10 @@
|
|||
*/
|
||||
|
||||
var dropXMLInteralSubset = function dropXMLInteralSubset(str) {
|
||||
return str.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, '$1$2');
|
||||
return str.replace(_wrapRegExp(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, {
|
||||
doctypeOpen: 1,
|
||||
doctypeClose: 2
|
||||
}), '$<doctypeOpen>$<doctypeClose>');
|
||||
};
|
||||
/**
|
||||
* Converts characters in a string to XML-friendly entities.
|
||||
|
@ -8096,9 +8247,16 @@
|
|||
return '';
|
||||
}
|
||||
|
||||
var arr = dataurl.split(','),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]);
|
||||
var _dataurl$split = dataurl.split(','),
|
||||
_dataurl$split2 = _slicedToArray(_dataurl$split, 2),
|
||||
prefix = _dataurl$split2[0],
|
||||
suffix = _dataurl$split2[1],
|
||||
_prefix$match = prefix.match(_wrapRegExp(/:(.*?);/, {
|
||||
mime: 1
|
||||
})),
|
||||
mime = _prefix$match.groups.mime,
|
||||
bstr = atob(suffix);
|
||||
|
||||
var n = bstr.length;
|
||||
var u8arr = new Uint8Array(n);
|
||||
|
||||
|
@ -8150,6 +8308,7 @@
|
|||
|
||||
var text2xml = function text2xml(sXML) {
|
||||
if (sXML.includes('<svg:svg')) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
sXML = sXML.replace(/<(\/?)svg:/g, '<$1').replace('xmlns:svg', 'xmlns');
|
||||
}
|
||||
|
||||
|
@ -8531,11 +8690,17 @@
|
|||
|
||||
|
||||
if (!isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x') || 0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y') || 0);
|
||||
var _ret = ret,
|
||||
x = _ret.x,
|
||||
y = _ret.y,
|
||||
width = _ret.width,
|
||||
height = _ret.height;
|
||||
var bb = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + parseFloat(selected.getAttribute('x') || 0),
|
||||
y: y + parseFloat(selected.getAttribute('y') || 0)
|
||||
};
|
||||
ret = bb;
|
||||
}
|
||||
} else if (visElemsArr.includes(elname)) {
|
||||
|
@ -8547,12 +8712,13 @@
|
|||
// Re: Chrome returning bbox for containing text element, see: https://bugs.chromium.org/p/chromium/issues/detail?id=349835
|
||||
var extent = selected.getExtentOfChar(0); // pos+dimensions of the first glyph
|
||||
|
||||
var width = selected.getComputedTextLength(); // width of the tspan
|
||||
var _width = selected.getComputedTextLength(); // width of the tspan
|
||||
|
||||
|
||||
ret = {
|
||||
x: extent.x,
|
||||
y: extent.y,
|
||||
width: width,
|
||||
width: _width,
|
||||
height: extent.height
|
||||
};
|
||||
}
|
||||
|
@ -9278,7 +9444,7 @@
|
|||
};
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -9385,9 +9551,9 @@
|
|||
|
||||
/**
|
||||
* @function module:importModule.importSetGlobalDefault
|
||||
* @param {string|GenericArray<Any>} url
|
||||
* @param {string|GenericArray<any>} url
|
||||
* @param {module:importModule.ImportConfig} config
|
||||
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
|
||||
* @returns {Promise<any>} The value to which it resolves depends on the export of the targeted module.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -9508,7 +9674,7 @@
|
|||
* @param {PlainObject} [atts={}]
|
||||
* @param {PlainObject} opts
|
||||
* @param {boolean} [opts.returnDefault=false} = {}]
|
||||
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
|
||||
* @returns {Promise<any>} Resolves to value of loading module or rejects with
|
||||
* `Error` upon a script loading error.
|
||||
*/
|
||||
|
||||
|
@ -11581,7 +11747,9 @@
|
|||
case 'gradientTransform':
|
||||
case 'patternTransform':
|
||||
{
|
||||
var val = attr.value.replace(/(\d)-/g, '$1 -');
|
||||
var val = attr.value.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
node.setAttribute(attrName, val);
|
||||
break;
|
||||
}
|
||||
|
@ -11714,9 +11882,8 @@
|
|||
};
|
||||
/**
|
||||
* Applies coordinate changes to an element based on the given matrix.
|
||||
* @function module:coords.remapElement
|
||||
* @implements {module:path.EditorContext#remapElement}
|
||||
* @returns {void}
|
||||
* @name module:coords.remapElement
|
||||
* @type {module:path.EditorContext#remapElement}
|
||||
*/
|
||||
|
||||
var remapElement = function remapElement(selected, changes, m) {
|
||||
|
@ -13687,9 +13854,8 @@
|
|||
canvas.current_drawing_ = new Drawing(svgcontent, idprefix);
|
||||
/**
|
||||
* Returns the current Drawing.
|
||||
* @function module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @implements {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
* @returns {module:draw.Drawing}
|
||||
* @name module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @type {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
*/
|
||||
|
||||
var getCurrentDrawing = canvas.getCurrentDrawing = function () {
|
||||
|
@ -13768,9 +13934,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @implements {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
* @returns {Element} The new element
|
||||
* @name module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @type {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13826,8 +13991,7 @@
|
|||
canvas.hasMatrixTransform = hasMatrixTransform;
|
||||
canvas.transformListToTransform = transformListToTransform;
|
||||
/**
|
||||
* @implements {module:utilities.EditorContext#getBaseUnit}
|
||||
* @returns {string}
|
||||
* @type {module:utilities.EditorContext#getBaseUnit}
|
||||
*/
|
||||
|
||||
var getBaseUnit = function getBaseUnit() {
|
||||
|
@ -13859,8 +14023,7 @@
|
|||
canvas.convertToNum = convertToNum;
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @implements {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
*/
|
||||
|
||||
var getSVGContent = function getSVGContent() {
|
||||
|
@ -13868,9 +14031,8 @@
|
|||
};
|
||||
/**
|
||||
* Should really be an intersection with all needing to apply rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @implements {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
* @returns {Element[]} the array with selected DOM elements
|
||||
* @name module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @type {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13881,8 +14043,7 @@
|
|||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
*/
|
||||
|
||||
var getSVGRoot = function getSVGRoot() {
|
||||
|
@ -13926,8 +14087,7 @@
|
|||
this.cleanupElement = cleanupElement;
|
||||
/**
|
||||
* This should actually be an intersection not a union as all should apply.
|
||||
* @implements {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
* @returns {boolean}
|
||||
* @type {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
*/
|
||||
|
||||
var getGridSnapping = function getGridSnapping() {
|
||||
|
@ -14041,8 +14201,8 @@
|
|||
});
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas~addCommandToHistory
|
||||
* @implements {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
* @name module:svgcanvas~addCommandToHistory
|
||||
* @type {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
*/
|
||||
|
||||
var addCommandToHistory = function addCommandToHistory(cmd) {
|
||||
|
@ -14050,9 +14210,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getZoom
|
||||
* @implements {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
* @returns {Float} The current zoom level
|
||||
* @name module:svgcanvas.SvgCanvas#getZoom
|
||||
* @type {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14061,9 +14220,8 @@
|
|||
};
|
||||
/**
|
||||
* This method rounds the incoming value to the nearest value based on the `currentZoom`
|
||||
* @function module:svgcanvas.SvgCanvas#round
|
||||
* @implements {module:path.EditorContext#round}
|
||||
* @returns {Float} Rounded value to nearest value based on `currentZoom`
|
||||
* @name module:svgcanvas.SvgCanvas#round
|
||||
* @type {module:path.EditorContext#round}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14096,18 +14254,16 @@
|
|||
|
||||
var selectorManager = this.selectorManager = getSelectorManager();
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getNextId
|
||||
* @implements {module:path.EditorContext#getNextId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getNextId
|
||||
* @type {module:path.EditorContext#getNextId}
|
||||
*/
|
||||
|
||||
var getNextId = canvas.getNextId = function () {
|
||||
return getCurrentDrawing().getNextId();
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getId
|
||||
* @implements {module:path.EditorContext#getId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getId
|
||||
* @type {module:path.EditorContext#getId}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14116,11 +14272,8 @@
|
|||
};
|
||||
/**
|
||||
* The "implements" should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#call
|
||||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
* @name module:svgcanvas.SvgCanvas#call
|
||||
* @type {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14134,8 +14287,8 @@
|
|||
/**
|
||||
* Clears the selection. The 'selected' handler is then optionally called.
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @implements {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @type {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
*/
|
||||
|
||||
|
@ -14156,10 +14309,9 @@
|
|||
};
|
||||
/**
|
||||
* Adds a list of elements to the selection. The 'selected' handler is then called.
|
||||
* @function module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @implements {module:path.EditorContext#addToSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @type {module:path.EditorContext#addToSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14241,8 +14393,7 @@
|
|||
}
|
||||
};
|
||||
/**
|
||||
* @implements {module:path.EditorContext#getOpacity}
|
||||
* @returns {Float}
|
||||
* @type {module:path.EditorContext#getOpacity}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14250,9 +14401,8 @@
|
|||
return curShape.opacity;
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @implements {module:path.EditorContext#getMouseTarget}
|
||||
* @returns {Element} DOM element we want
|
||||
* @name module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @type {module:path.EditorContext#getMouseTarget}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14320,7 +14470,7 @@
|
|||
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
* @type {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
|
@ -14985,7 +15135,7 @@
|
|||
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
* @property {Any} data The data
|
||||
* @property {any} data The data
|
||||
* @property {string} origin The origin
|
||||
*/
|
||||
|
||||
|
@ -18590,10 +18740,12 @@
|
|||
if (val) {
|
||||
if (val.startsWith('data:')) {
|
||||
// Check if an SVG-edit data URI
|
||||
var m = val.match(/svgedit_url=(.*?);/);
|
||||
var m = val.match(_wrapRegExp(/svgedit_url=(.*?);/, {
|
||||
url: 1
|
||||
}));
|
||||
|
||||
if (m) {
|
||||
var url = decodeURIComponent(m[1]);
|
||||
var url = decodeURIComponent(m.groups.url);
|
||||
$$9(new Image()).load(function () {
|
||||
image.setAttributeNS(NS.XLINK, 'xlink:href', url);
|
||||
}).attr('src', url);
|
||||
|
@ -22386,6 +22538,65 @@
|
|||
});
|
||||
*/
|
||||
|
||||
var isOpera$1 = Boolean(window.opera);
|
||||
|
||||
var fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera$1) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
|
||||
* @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
|
||||
|
@ -22397,9 +22608,9 @@
|
|||
* @returns {external:jQuery} The enhanced jQuery object
|
||||
*/
|
||||
|
||||
|
||||
function jQueryPluginSVGIcons($) {
|
||||
var svgIcons = {};
|
||||
var fixIDs;
|
||||
/**
|
||||
* Map of raster images with each key being the SVG icon ID
|
||||
* to replace, and the value the image file name
|
||||
|
@ -22458,8 +22669,7 @@
|
|||
iconsMade = false,
|
||||
dataLoaded = false,
|
||||
loadAttempts = 0;
|
||||
var isOpera = Boolean(window.opera),
|
||||
// ua = navigator.userAgent,
|
||||
var // ua = navigator.userAgent,
|
||||
// isSafari = (ua.includes('Safari/') && !ua.includes('Chrome/')),
|
||||
dataPre = 'data:image/svg+xml;charset=utf-8;base64,';
|
||||
var dataEl;
|
||||
|
@ -22578,7 +22788,7 @@
|
|||
|
||||
|
||||
function setIcon(target, icon, id, setID) {
|
||||
if (isOpera) icon.css('visibility', 'hidden');
|
||||
if (isOpera$1) icon.css('visibility', 'hidden');
|
||||
|
||||
if (opts.replace) {
|
||||
if (setID) icon.attr('id', id);
|
||||
|
@ -22600,7 +22810,7 @@
|
|||
target.append(icon);
|
||||
}
|
||||
|
||||
if (isOpera) {
|
||||
if (isOpera$1) {
|
||||
setTimeout(function () {
|
||||
icon.removeAttr('style');
|
||||
}, 1);
|
||||
|
@ -22692,7 +22902,7 @@
|
|||
svgroot.setAttribute('class', 'svg_icon'); // Without cloning, Firefox will make another GET request.
|
||||
// With cloning, causes issue in Opera/Win/Non-EN
|
||||
|
||||
if (!isOpera) svg = svg.cloneNode(true);
|
||||
if (!isOpera$1) svg = svg.cloneNode(true);
|
||||
svgroot.append(svg);
|
||||
var icon = void 0;
|
||||
|
||||
|
@ -22723,7 +22933,7 @@
|
|||
if (!svgIcons[id]) return;
|
||||
$(sel).each(function (i) {
|
||||
var copy = svgIcons[id].clone();
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i, true);
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i);
|
||||
setIcon($(this), copy, id);
|
||||
});
|
||||
});
|
||||
|
@ -22739,64 +22949,6 @@
|
|||
iconsMade = true;
|
||||
if (opts.callback) opts.callback(svgIcons);
|
||||
}
|
||||
|
||||
fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -22828,7 +22980,7 @@
|
|||
var icon = svgIcons[id];
|
||||
|
||||
if (uniqueClone && icon) {
|
||||
icon = fixIDs(icon, 0, true).clone(true);
|
||||
icon = fixIDs(icon, 0).clone(true);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
@ -24901,7 +25053,7 @@
|
|||
}
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -29350,7 +29502,7 @@
|
|||
*
|
||||
* @param {module:SVGEditor.Config|module:SVGEditor.Prefs} cfgObj
|
||||
* @param {string} key
|
||||
* @param {Any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @param {any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
@ -29627,7 +29779,9 @@
|
|||
if (!src) {
|
||||
// urldata.source may have been null if it ended with '='
|
||||
if (qstr.includes('source=data:')) {
|
||||
src = qstr.match(/source=(data:[^&]*)/)[1];
|
||||
src = qstr.match(_wrapRegExp(/source=(data:[^&]*)/, {
|
||||
src: 1
|
||||
})).groups.src;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29731,7 +29885,9 @@
|
|||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
extName = extname.match(/^ext-(.+)\.js/);
|
||||
extName = extname.match(_wrapRegExp(/^ext-(.+)\.js/, {
|
||||
extName: 1
|
||||
})).groups.extName;
|
||||
|
||||
if (extName) {
|
||||
_context2.next = 3;
|
||||
|
@ -29754,12 +29910,12 @@
|
|||
_context2.prev = 4;
|
||||
_context2.next = 7;
|
||||
return importSetGlobalDefault(url, {
|
||||
global: 'svgEditorExtension_' + extName[1].replace(/-/g, '_')
|
||||
global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
|
||||
});
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: _name2
|
||||
|
@ -29873,7 +30029,7 @@
|
|||
|
||||
|
||||
var uaPrefix = function () {
|
||||
var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var regex = /^(?:Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var someScript = document.getElementsByTagName('script')[0];
|
||||
|
||||
for (var prop in someScript.style) {
|
||||
|
@ -31801,7 +31957,7 @@
|
|||
zoomDone();
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32767,14 +32923,14 @@
|
|||
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url'));
|
||||
$$b('#image_save_opts input').val([$$b.pref('img_save')]);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
var changeRectRadius = function changeRectRadius(ctl) {
|
||||
svgCanvas.setRectRadius(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32782,7 +32938,7 @@
|
|||
svgCanvas.setFontSize(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32796,7 +32952,7 @@
|
|||
svgCanvas.setStrokeWidth(val);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -35123,8 +35279,7 @@
|
|||
|
||||
$$b(window).bind('load resize', centerCanvas);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
function stepFontSize(elem, step) {
|
||||
|
@ -35155,8 +35310,7 @@
|
|||
return sugVal;
|
||||
}
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -36735,7 +36889,7 @@
|
|||
var messageQueue = [];
|
||||
/**
|
||||
* @param {PlainObject} info
|
||||
* @param {Any} info.data
|
||||
* @param {any} info.data
|
||||
* @param {string} info.origin
|
||||
* @fires module:svgcanvas.SvgCanvas#event:message
|
||||
* @returns {void}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -23,6 +23,105 @@
|
|||
return Constructor;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
@ -81,6 +180,71 @@
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* For parsing color values
|
||||
* @module RGBColor
|
||||
|
@ -235,7 +399,11 @@
|
|||
}; // array of color definition objects
|
||||
|
||||
var colorDefs = [{
|
||||
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
|
||||
re: _wrapRegExp(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
|
||||
process: function process(_) {
|
||||
for (var _len = arguments.length, bits = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
@ -247,7 +415,11 @@
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{2})(\w{2})(\w{2})$/,
|
||||
re: _wrapRegExp(/^(\w{2})(\w{2})(\w{2})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#00ff00', '336699'],
|
||||
process: function process(_) {
|
||||
for (var _len2 = arguments.length, bits = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
|
@ -259,7 +431,11 @@
|
|||
});
|
||||
}
|
||||
}, {
|
||||
re: /^(\w{1})(\w{1})(\w{1})$/,
|
||||
re: _wrapRegExp(/^(\w{1})(\w{1})(\w{1})$/, {
|
||||
r: 1,
|
||||
g: 2,
|
||||
b: 3
|
||||
}),
|
||||
example: ['#fb0', 'f0f'],
|
||||
process: function process(_) {
|
||||
for (var _len3 = arguments.length, bits = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
|
@ -322,7 +498,7 @@
|
|||
});
|
||||
_this.ok = true;
|
||||
}
|
||||
}, this); // validate/cleanup values
|
||||
}); // validate/cleanup values
|
||||
|
||||
this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r;
|
||||
this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g;
|
||||
|
|
|
@ -104,6 +104,74 @@ var SvgCanvas = (function () {
|
|||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -178,6 +246,71 @@ var SvgCanvas = (function () {
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
/* globals SVGPathSeg, SVGPathSegMovetoRel, SVGPathSegMovetoAbs,
|
||||
SVGPathSegMovetoRel, SVGPathSegLinetoRel, SVGPathSegLinetoAbs,
|
||||
SVGPathSegLinetoHorizontalRel, SVGPathSegLinetoHorizontalAbs,
|
||||
|
@ -3282,22 +3415,35 @@ var SvgCanvas = (function () {
|
|||
} // TODO: Add skew support in future
|
||||
|
||||
|
||||
var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;
|
||||
var re = _wrapRegExp(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/, {
|
||||
xform: 1
|
||||
});
|
||||
|
||||
var m = true;
|
||||
|
||||
while (m) {
|
||||
m = str.match(re);
|
||||
str = str.replace(re, '');
|
||||
|
||||
if (m && m[1]) {
|
||||
if (m && m.groups.xform) {
|
||||
(function () {
|
||||
var x = m[1];
|
||||
var bits = x.split(/\s*\(/);
|
||||
var name = bits[0];
|
||||
var valBits = bits[1].match(/\s*(.*?)\s*\)/);
|
||||
valBits[1] = valBits[1].replace(/(\d)-/g, '$1 -');
|
||||
var valArr = valBits[1].split(/[, ]+/);
|
||||
var letters = 'abcdef'.split('');
|
||||
var x = m.groups.xform;
|
||||
|
||||
var _x$split = x.split(/\s*\(/),
|
||||
_x$split2 = _slicedToArray(_x$split, 2),
|
||||
name = _x$split2[0],
|
||||
bits = _x$split2[1];
|
||||
|
||||
var valBits = bits.match(_wrapRegExp(/\s*(.*?)\s*\)/, {
|
||||
nonWhitespace: 1
|
||||
}));
|
||||
valBits.groups.nonWhitespace = valBits.groups.nonWhitespace.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
var valArr = valBits.groups.nonWhitespace.split(/[, ]+/);
|
||||
|
||||
var letters = _toConsumableArray('abcdef');
|
||||
|
||||
var mtx = svgroot.createSVGMatrix();
|
||||
Object.values(valArr).forEach(function (item, i) {
|
||||
valArr[i] = parseFloat(item);
|
||||
|
@ -6587,11 +6733,12 @@ var SvgCanvas = (function () {
|
|||
var pt1 = transformPoint(x1, y1, m);
|
||||
var pt2 = transformPoint(x2, y2, m); // Convert back to BB points
|
||||
|
||||
var gCoords = {};
|
||||
gCoords.x1 = (pt1.x - bb.x) / bb.width;
|
||||
gCoords.y1 = (pt1.y - bb.y) / bb.height;
|
||||
gCoords.x2 = (pt2.x - bb.x) / bb.width;
|
||||
gCoords.y2 = (pt2.y - bb.y) / bb.height;
|
||||
var gCoords = {
|
||||
x1: (pt1.x - bb.x) / bb.width,
|
||||
y1: (pt1.y - bb.y) / bb.height,
|
||||
x2: (pt2.x - bb.x) / bb.width,
|
||||
y2: (pt2.y - bb.y) / bb.height
|
||||
};
|
||||
var newgrad = grad.cloneNode(true);
|
||||
$$1(newgrad).attr(gCoords);
|
||||
newgrad.id = editorContext_.getNextId();
|
||||
|
@ -6775,6 +6922,7 @@ var SvgCanvas = (function () {
|
|||
|
||||
d += pathDSegment(letter, [[x1, y1], [x, y]]);
|
||||
break;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
|
||||
case 10:
|
||||
// absolute elliptical arc (A)
|
||||
|
@ -8022,7 +8170,10 @@ var SvgCanvas = (function () {
|
|||
*/
|
||||
|
||||
var dropXMLInteralSubset = function dropXMLInteralSubset(str) {
|
||||
return str.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, '$1$2');
|
||||
return str.replace(_wrapRegExp(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, {
|
||||
doctypeOpen: 1,
|
||||
doctypeClose: 2
|
||||
}), '$<doctypeOpen>$<doctypeClose>');
|
||||
};
|
||||
/**
|
||||
* Converts characters in a string to XML-friendly entities.
|
||||
|
@ -8162,9 +8313,16 @@ var SvgCanvas = (function () {
|
|||
return '';
|
||||
}
|
||||
|
||||
var arr = dataurl.split(','),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]);
|
||||
var _dataurl$split = dataurl.split(','),
|
||||
_dataurl$split2 = _slicedToArray(_dataurl$split, 2),
|
||||
prefix = _dataurl$split2[0],
|
||||
suffix = _dataurl$split2[1],
|
||||
_prefix$match = prefix.match(_wrapRegExp(/:(.*?);/, {
|
||||
mime: 1
|
||||
})),
|
||||
mime = _prefix$match.groups.mime,
|
||||
bstr = atob(suffix);
|
||||
|
||||
var n = bstr.length;
|
||||
var u8arr = new Uint8Array(n);
|
||||
|
||||
|
@ -8216,6 +8374,7 @@ var SvgCanvas = (function () {
|
|||
|
||||
var text2xml = function text2xml(sXML) {
|
||||
if (sXML.includes('<svg:svg')) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
sXML = sXML.replace(/<(\/?)svg:/g, '<$1').replace('xmlns:svg', 'xmlns');
|
||||
}
|
||||
|
||||
|
@ -8597,11 +8756,17 @@ var SvgCanvas = (function () {
|
|||
|
||||
|
||||
if (!isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x') || 0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y') || 0);
|
||||
var _ret = ret,
|
||||
x = _ret.x,
|
||||
y = _ret.y,
|
||||
width = _ret.width,
|
||||
height = _ret.height;
|
||||
var bb = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + parseFloat(selected.getAttribute('x') || 0),
|
||||
y: y + parseFloat(selected.getAttribute('y') || 0)
|
||||
};
|
||||
ret = bb;
|
||||
}
|
||||
} else if (visElemsArr.includes(elname)) {
|
||||
|
@ -8613,12 +8778,13 @@ var SvgCanvas = (function () {
|
|||
// Re: Chrome returning bbox for containing text element, see: https://bugs.chromium.org/p/chromium/issues/detail?id=349835
|
||||
var extent = selected.getExtentOfChar(0); // pos+dimensions of the first glyph
|
||||
|
||||
var width = selected.getComputedTextLength(); // width of the tspan
|
||||
var _width = selected.getComputedTextLength(); // width of the tspan
|
||||
|
||||
|
||||
ret = {
|
||||
x: extent.x,
|
||||
y: extent.y,
|
||||
width: width,
|
||||
width: _width,
|
||||
height: extent.height
|
||||
};
|
||||
}
|
||||
|
@ -9333,7 +9499,7 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -11142,7 +11308,9 @@ var SvgCanvas = (function () {
|
|||
case 'gradientTransform':
|
||||
case 'patternTransform':
|
||||
{
|
||||
var val = attr.value.replace(/(\d)-/g, '$1 -');
|
||||
var val = attr.value.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
node.setAttribute(attrName, val);
|
||||
break;
|
||||
}
|
||||
|
@ -11386,7 +11554,7 @@ var SvgCanvas = (function () {
|
|||
* @param {PlainObject} [atts={}]
|
||||
* @param {PlainObject} opts
|
||||
* @param {boolean} [opts.returnDefault=false} = {}]
|
||||
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
|
||||
* @returns {Promise<any>} Resolves to value of loading module or rejects with
|
||||
* `Error` upon a script loading error.
|
||||
*/
|
||||
|
||||
|
@ -11486,9 +11654,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* Applies coordinate changes to an element based on the given matrix.
|
||||
* @function module:coords.remapElement
|
||||
* @implements {module:path.EditorContext#remapElement}
|
||||
* @returns {void}
|
||||
* @name module:coords.remapElement
|
||||
* @type {module:path.EditorContext#remapElement}
|
||||
*/
|
||||
|
||||
var remapElement = function remapElement(selected, changes, m) {
|
||||
|
@ -13459,9 +13626,8 @@ var SvgCanvas = (function () {
|
|||
canvas.current_drawing_ = new Drawing(svgcontent, idprefix);
|
||||
/**
|
||||
* Returns the current Drawing.
|
||||
* @function module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @implements {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
* @returns {module:draw.Drawing}
|
||||
* @name module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @type {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
*/
|
||||
|
||||
var getCurrentDrawing = canvas.getCurrentDrawing = function () {
|
||||
|
@ -13540,9 +13706,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @implements {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
* @returns {Element} The new element
|
||||
* @name module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @type {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13598,8 +13763,7 @@ var SvgCanvas = (function () {
|
|||
canvas.hasMatrixTransform = hasMatrixTransform;
|
||||
canvas.transformListToTransform = transformListToTransform;
|
||||
/**
|
||||
* @implements {module:utilities.EditorContext#getBaseUnit}
|
||||
* @returns {string}
|
||||
* @type {module:utilities.EditorContext#getBaseUnit}
|
||||
*/
|
||||
|
||||
var getBaseUnit = function getBaseUnit() {
|
||||
|
@ -13631,8 +13795,7 @@ var SvgCanvas = (function () {
|
|||
canvas.convertToNum = convertToNum;
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @implements {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
*/
|
||||
|
||||
var getSVGContent = function getSVGContent() {
|
||||
|
@ -13640,9 +13803,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* Should really be an intersection with all needing to apply rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @implements {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
* @returns {Element[]} the array with selected DOM elements
|
||||
* @name module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @type {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13653,8 +13815,7 @@ var SvgCanvas = (function () {
|
|||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
*/
|
||||
|
||||
var getSVGRoot = function getSVGRoot() {
|
||||
|
@ -13698,8 +13859,7 @@ var SvgCanvas = (function () {
|
|||
this.cleanupElement = cleanupElement;
|
||||
/**
|
||||
* This should actually be an intersection not a union as all should apply.
|
||||
* @implements {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
* @returns {boolean}
|
||||
* @type {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
*/
|
||||
|
||||
var getGridSnapping = function getGridSnapping() {
|
||||
|
@ -13813,8 +13973,8 @@ var SvgCanvas = (function () {
|
|||
});
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas~addCommandToHistory
|
||||
* @implements {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
* @name module:svgcanvas~addCommandToHistory
|
||||
* @type {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
*/
|
||||
|
||||
var addCommandToHistory = function addCommandToHistory(cmd) {
|
||||
|
@ -13822,9 +13982,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getZoom
|
||||
* @implements {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
* @returns {Float} The current zoom level
|
||||
* @name module:svgcanvas.SvgCanvas#getZoom
|
||||
* @type {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13833,9 +13992,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* This method rounds the incoming value to the nearest value based on the `currentZoom`
|
||||
* @function module:svgcanvas.SvgCanvas#round
|
||||
* @implements {module:path.EditorContext#round}
|
||||
* @returns {Float} Rounded value to nearest value based on `currentZoom`
|
||||
* @name module:svgcanvas.SvgCanvas#round
|
||||
* @type {module:path.EditorContext#round}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13868,18 +14026,16 @@ var SvgCanvas = (function () {
|
|||
|
||||
var selectorManager = this.selectorManager = getSelectorManager();
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getNextId
|
||||
* @implements {module:path.EditorContext#getNextId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getNextId
|
||||
* @type {module:path.EditorContext#getNextId}
|
||||
*/
|
||||
|
||||
var getNextId = canvas.getNextId = function () {
|
||||
return getCurrentDrawing().getNextId();
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getId
|
||||
* @implements {module:path.EditorContext#getId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getId
|
||||
* @type {module:path.EditorContext#getId}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13888,11 +14044,8 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* The "implements" should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#call
|
||||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
* @name module:svgcanvas.SvgCanvas#call
|
||||
* @type {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13906,8 +14059,8 @@ var SvgCanvas = (function () {
|
|||
/**
|
||||
* Clears the selection. The 'selected' handler is then optionally called.
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @implements {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @type {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
*/
|
||||
|
||||
|
@ -13928,10 +14081,9 @@ var SvgCanvas = (function () {
|
|||
};
|
||||
/**
|
||||
* Adds a list of elements to the selection. The 'selected' handler is then called.
|
||||
* @function module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @implements {module:path.EditorContext#addToSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @type {module:path.EditorContext#addToSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14013,8 +14165,7 @@ var SvgCanvas = (function () {
|
|||
}
|
||||
};
|
||||
/**
|
||||
* @implements {module:path.EditorContext#getOpacity}
|
||||
* @returns {Float}
|
||||
* @type {module:path.EditorContext#getOpacity}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14022,9 +14173,8 @@ var SvgCanvas = (function () {
|
|||
return curShape.opacity;
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @implements {module:path.EditorContext#getMouseTarget}
|
||||
* @returns {Element} DOM element we want
|
||||
* @name module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @type {module:path.EditorContext#getMouseTarget}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14092,7 +14242,7 @@ var SvgCanvas = (function () {
|
|||
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
* @type {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
|
@ -14757,7 +14907,7 @@ var SvgCanvas = (function () {
|
|||
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
* @property {Any} data The data
|
||||
* @property {any} data The data
|
||||
* @property {string} origin The origin
|
||||
*/
|
||||
|
||||
|
@ -18362,10 +18512,12 @@ var SvgCanvas = (function () {
|
|||
if (val) {
|
||||
if (val.startsWith('data:')) {
|
||||
// Check if an SVG-edit data URI
|
||||
var m = val.match(/svgedit_url=(.*?);/);
|
||||
var m = val.match(_wrapRegExp(/svgedit_url=(.*?);/, {
|
||||
url: 1
|
||||
}));
|
||||
|
||||
if (m) {
|
||||
var url = decodeURIComponent(m[1]);
|
||||
var url = decodeURIComponent(m.groups.url);
|
||||
$$8(new Image()).load(function () {
|
||||
image.setAttributeNS(NS.XLINK, 'xlink:href', url);
|
||||
}).attr('src', url);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -88,6 +88,66 @@ $(function() {
|
|||
});
|
||||
*/
|
||||
|
||||
const isOpera = Boolean(window.opera);
|
||||
|
||||
const fixIDs = function (svgEl, svgNum, force) {
|
||||
const defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
|
||||
let idElems;
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
const allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
|
||||
idElems.each(function (i) {
|
||||
const {id} = this;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
const newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
|
||||
const oldVal = 'url(#' + id + ')';
|
||||
const newVal = 'url(#' + newId + ')';
|
||||
|
||||
// Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
const elem = allElems[i];
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
|
||||
* @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
|
||||
|
@ -101,7 +161,6 @@ $(function() {
|
|||
export default function jQueryPluginSVGIcons ($) {
|
||||
const svgIcons = {};
|
||||
|
||||
let fixIDs;
|
||||
/**
|
||||
* Map of raster images with each key being the SVG icon ID
|
||||
* to replace, and the value the image file name
|
||||
|
@ -154,8 +213,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
iconsMade = false,
|
||||
dataLoaded = false,
|
||||
loadAttempts = 0;
|
||||
const isOpera = Boolean(window.opera),
|
||||
// ua = navigator.userAgent,
|
||||
const // ua = navigator.userAgent,
|
||||
// isSafari = (ua.includes('Safari/') && !ua.includes('Chrome/')),
|
||||
dataPre = 'data:image/svg+xml;charset=utf-8;base64,';
|
||||
|
||||
|
@ -414,64 +472,6 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
if (opts.callback) opts.callback(svgIcons);
|
||||
}
|
||||
|
||||
fixIDs = function (svgEl, svgNum, force) {
|
||||
const defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
|
||||
let idElems;
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
const allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
|
||||
idElems.each(function (i) {
|
||||
const {id} = this;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
const newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
|
||||
const oldVal = 'url(#' + id + ')';
|
||||
const newVal = 'url(#' + newId + ')';
|
||||
|
||||
// Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
const elem = allElems[i];
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
|
|
@ -122,6 +122,74 @@
|
|||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -196,6 +264,71 @@
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
// http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
|
||||
|
||||
/**
|
||||
|
@ -3170,22 +3303,35 @@
|
|||
} // TODO: Add skew support in future
|
||||
|
||||
|
||||
var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;
|
||||
var re = _wrapRegExp(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/, {
|
||||
xform: 1
|
||||
});
|
||||
|
||||
var m = true;
|
||||
|
||||
while (m) {
|
||||
m = str.match(re);
|
||||
str = str.replace(re, '');
|
||||
|
||||
if (m && m[1]) {
|
||||
if (m && m.groups.xform) {
|
||||
(function () {
|
||||
var x = m[1];
|
||||
var bits = x.split(/\s*\(/);
|
||||
var name = bits[0];
|
||||
var valBits = bits[1].match(/\s*(.*?)\s*\)/);
|
||||
valBits[1] = valBits[1].replace(/(\d)-/g, '$1 -');
|
||||
var valArr = valBits[1].split(/[, ]+/);
|
||||
var letters = 'abcdef'.split('');
|
||||
var x = m.groups.xform;
|
||||
|
||||
var _x$split = x.split(/\s*\(/),
|
||||
_x$split2 = _slicedToArray(_x$split, 2),
|
||||
name = _x$split2[0],
|
||||
bits = _x$split2[1];
|
||||
|
||||
var valBits = bits.match(_wrapRegExp(/\s*(.*?)\s*\)/, {
|
||||
nonWhitespace: 1
|
||||
}));
|
||||
valBits.groups.nonWhitespace = valBits.groups.nonWhitespace.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
var valArr = valBits.groups.nonWhitespace.split(/[, ]+/);
|
||||
|
||||
var letters = _toConsumableArray('abcdef');
|
||||
|
||||
var mtx = svgroot.createSVGMatrix();
|
||||
Object.values(valArr).forEach(function (item, i) {
|
||||
valArr[i] = parseFloat(item);
|
||||
|
@ -6518,11 +6664,12 @@
|
|||
var pt1 = transformPoint(x1, y1, m);
|
||||
var pt2 = transformPoint(x2, y2, m); // Convert back to BB points
|
||||
|
||||
var gCoords = {};
|
||||
gCoords.x1 = (pt1.x - bb.x) / bb.width;
|
||||
gCoords.y1 = (pt1.y - bb.y) / bb.height;
|
||||
gCoords.x2 = (pt2.x - bb.x) / bb.width;
|
||||
gCoords.y2 = (pt2.y - bb.y) / bb.height;
|
||||
var gCoords = {
|
||||
x1: (pt1.x - bb.x) / bb.width,
|
||||
y1: (pt1.y - bb.y) / bb.height,
|
||||
x2: (pt2.x - bb.x) / bb.width,
|
||||
y2: (pt2.y - bb.y) / bb.height
|
||||
};
|
||||
var newgrad = grad.cloneNode(true);
|
||||
$$1(newgrad).attr(gCoords);
|
||||
newgrad.id = editorContext_.getNextId();
|
||||
|
@ -6706,6 +6853,7 @@
|
|||
|
||||
d += pathDSegment(letter, [[x1, y1], [x, y]]);
|
||||
break;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
|
||||
case 10:
|
||||
// absolute elliptical arc (A)
|
||||
|
@ -7953,7 +8101,10 @@
|
|||
*/
|
||||
|
||||
var dropXMLInteralSubset = function dropXMLInteralSubset(str) {
|
||||
return str.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, '$1$2');
|
||||
return str.replace(_wrapRegExp(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, {
|
||||
doctypeOpen: 1,
|
||||
doctypeClose: 2
|
||||
}), '$<doctypeOpen>$<doctypeClose>');
|
||||
};
|
||||
/**
|
||||
* Converts characters in a string to XML-friendly entities.
|
||||
|
@ -8093,9 +8244,16 @@
|
|||
return '';
|
||||
}
|
||||
|
||||
var arr = dataurl.split(','),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]);
|
||||
var _dataurl$split = dataurl.split(','),
|
||||
_dataurl$split2 = _slicedToArray(_dataurl$split, 2),
|
||||
prefix = _dataurl$split2[0],
|
||||
suffix = _dataurl$split2[1],
|
||||
_prefix$match = prefix.match(_wrapRegExp(/:(.*?);/, {
|
||||
mime: 1
|
||||
})),
|
||||
mime = _prefix$match.groups.mime,
|
||||
bstr = atob(suffix);
|
||||
|
||||
var n = bstr.length;
|
||||
var u8arr = new Uint8Array(n);
|
||||
|
||||
|
@ -8147,6 +8305,7 @@
|
|||
|
||||
var text2xml = function text2xml(sXML) {
|
||||
if (sXML.includes('<svg:svg')) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
sXML = sXML.replace(/<(\/?)svg:/g, '<$1').replace('xmlns:svg', 'xmlns');
|
||||
}
|
||||
|
||||
|
@ -8528,11 +8687,17 @@
|
|||
|
||||
|
||||
if (!isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x') || 0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y') || 0);
|
||||
var _ret = ret,
|
||||
x = _ret.x,
|
||||
y = _ret.y,
|
||||
width = _ret.width,
|
||||
height = _ret.height;
|
||||
var bb = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + parseFloat(selected.getAttribute('x') || 0),
|
||||
y: y + parseFloat(selected.getAttribute('y') || 0)
|
||||
};
|
||||
ret = bb;
|
||||
}
|
||||
} else if (visElemsArr.includes(elname)) {
|
||||
|
@ -8544,12 +8709,13 @@
|
|||
// Re: Chrome returning bbox for containing text element, see: https://bugs.chromium.org/p/chromium/issues/detail?id=349835
|
||||
var extent = selected.getExtentOfChar(0); // pos+dimensions of the first glyph
|
||||
|
||||
var width = selected.getComputedTextLength(); // width of the tspan
|
||||
var _width = selected.getComputedTextLength(); // width of the tspan
|
||||
|
||||
|
||||
ret = {
|
||||
x: extent.x,
|
||||
y: extent.y,
|
||||
width: width,
|
||||
width: _width,
|
||||
height: extent.height
|
||||
};
|
||||
}
|
||||
|
@ -9275,7 +9441,7 @@
|
|||
};
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -9382,9 +9548,9 @@
|
|||
|
||||
/**
|
||||
* @function module:importModule.importSetGlobalDefault
|
||||
* @param {string|GenericArray<Any>} url
|
||||
* @param {string|GenericArray<any>} url
|
||||
* @param {module:importModule.ImportConfig} config
|
||||
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
|
||||
* @returns {Promise<any>} The value to which it resolves depends on the export of the targeted module.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -9505,7 +9671,7 @@
|
|||
* @param {PlainObject} [atts={}]
|
||||
* @param {PlainObject} opts
|
||||
* @param {boolean} [opts.returnDefault=false} = {}]
|
||||
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
|
||||
* @returns {Promise<any>} Resolves to value of loading module or rejects with
|
||||
* `Error` upon a script loading error.
|
||||
*/
|
||||
|
||||
|
@ -11578,7 +11744,9 @@
|
|||
case 'gradientTransform':
|
||||
case 'patternTransform':
|
||||
{
|
||||
var val = attr.value.replace(/(\d)-/g, '$1 -');
|
||||
var val = attr.value.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
node.setAttribute(attrName, val);
|
||||
break;
|
||||
}
|
||||
|
@ -11711,9 +11879,8 @@
|
|||
};
|
||||
/**
|
||||
* Applies coordinate changes to an element based on the given matrix.
|
||||
* @function module:coords.remapElement
|
||||
* @implements {module:path.EditorContext#remapElement}
|
||||
* @returns {void}
|
||||
* @name module:coords.remapElement
|
||||
* @type {module:path.EditorContext#remapElement}
|
||||
*/
|
||||
|
||||
var remapElement = function remapElement(selected, changes, m) {
|
||||
|
@ -13684,9 +13851,8 @@
|
|||
canvas.current_drawing_ = new Drawing(svgcontent, idprefix);
|
||||
/**
|
||||
* Returns the current Drawing.
|
||||
* @function module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @implements {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
* @returns {module:draw.Drawing}
|
||||
* @name module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @type {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
*/
|
||||
|
||||
var getCurrentDrawing = canvas.getCurrentDrawing = function () {
|
||||
|
@ -13765,9 +13931,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @implements {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
* @returns {Element} The new element
|
||||
* @name module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @type {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13823,8 +13988,7 @@
|
|||
canvas.hasMatrixTransform = hasMatrixTransform;
|
||||
canvas.transformListToTransform = transformListToTransform;
|
||||
/**
|
||||
* @implements {module:utilities.EditorContext#getBaseUnit}
|
||||
* @returns {string}
|
||||
* @type {module:utilities.EditorContext#getBaseUnit}
|
||||
*/
|
||||
|
||||
var getBaseUnit = function getBaseUnit() {
|
||||
|
@ -13856,8 +14020,7 @@
|
|||
canvas.convertToNum = convertToNum;
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @implements {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
*/
|
||||
|
||||
var getSVGContent = function getSVGContent() {
|
||||
|
@ -13865,9 +14028,8 @@
|
|||
};
|
||||
/**
|
||||
* Should really be an intersection with all needing to apply rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @implements {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
* @returns {Element[]} the array with selected DOM elements
|
||||
* @name module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @type {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13878,8 +14040,7 @@
|
|||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
*/
|
||||
|
||||
var getSVGRoot = function getSVGRoot() {
|
||||
|
@ -13923,8 +14084,7 @@
|
|||
this.cleanupElement = cleanupElement;
|
||||
/**
|
||||
* This should actually be an intersection not a union as all should apply.
|
||||
* @implements {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
* @returns {boolean}
|
||||
* @type {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
*/
|
||||
|
||||
var getGridSnapping = function getGridSnapping() {
|
||||
|
@ -14038,8 +14198,8 @@
|
|||
});
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas~addCommandToHistory
|
||||
* @implements {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
* @name module:svgcanvas~addCommandToHistory
|
||||
* @type {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
*/
|
||||
|
||||
var addCommandToHistory = function addCommandToHistory(cmd) {
|
||||
|
@ -14047,9 +14207,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getZoom
|
||||
* @implements {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
* @returns {Float} The current zoom level
|
||||
* @name module:svgcanvas.SvgCanvas#getZoom
|
||||
* @type {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14058,9 +14217,8 @@
|
|||
};
|
||||
/**
|
||||
* This method rounds the incoming value to the nearest value based on the `currentZoom`
|
||||
* @function module:svgcanvas.SvgCanvas#round
|
||||
* @implements {module:path.EditorContext#round}
|
||||
* @returns {Float} Rounded value to nearest value based on `currentZoom`
|
||||
* @name module:svgcanvas.SvgCanvas#round
|
||||
* @type {module:path.EditorContext#round}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14093,18 +14251,16 @@
|
|||
|
||||
var selectorManager = this.selectorManager = getSelectorManager();
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getNextId
|
||||
* @implements {module:path.EditorContext#getNextId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getNextId
|
||||
* @type {module:path.EditorContext#getNextId}
|
||||
*/
|
||||
|
||||
var getNextId = canvas.getNextId = function () {
|
||||
return getCurrentDrawing().getNextId();
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getId
|
||||
* @implements {module:path.EditorContext#getId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getId
|
||||
* @type {module:path.EditorContext#getId}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14113,11 +14269,8 @@
|
|||
};
|
||||
/**
|
||||
* The "implements" should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#call
|
||||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
* @name module:svgcanvas.SvgCanvas#call
|
||||
* @type {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14131,8 +14284,8 @@
|
|||
/**
|
||||
* Clears the selection. The 'selected' handler is then optionally called.
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @implements {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @type {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
*/
|
||||
|
||||
|
@ -14153,10 +14306,9 @@
|
|||
};
|
||||
/**
|
||||
* Adds a list of elements to the selection. The 'selected' handler is then called.
|
||||
* @function module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @implements {module:path.EditorContext#addToSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @type {module:path.EditorContext#addToSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14238,8 +14390,7 @@
|
|||
}
|
||||
};
|
||||
/**
|
||||
* @implements {module:path.EditorContext#getOpacity}
|
||||
* @returns {Float}
|
||||
* @type {module:path.EditorContext#getOpacity}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14247,9 +14398,8 @@
|
|||
return curShape.opacity;
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @implements {module:path.EditorContext#getMouseTarget}
|
||||
* @returns {Element} DOM element we want
|
||||
* @name module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @type {module:path.EditorContext#getMouseTarget}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14317,7 +14467,7 @@
|
|||
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
* @type {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
|
@ -14982,7 +15132,7 @@
|
|||
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
* @property {Any} data The data
|
||||
* @property {any} data The data
|
||||
* @property {string} origin The origin
|
||||
*/
|
||||
|
||||
|
@ -18587,10 +18737,12 @@
|
|||
if (val) {
|
||||
if (val.startsWith('data:')) {
|
||||
// Check if an SVG-edit data URI
|
||||
var m = val.match(/svgedit_url=(.*?);/);
|
||||
var m = val.match(_wrapRegExp(/svgedit_url=(.*?);/, {
|
||||
url: 1
|
||||
}));
|
||||
|
||||
if (m) {
|
||||
var url = decodeURIComponent(m[1]);
|
||||
var url = decodeURIComponent(m.groups.url);
|
||||
$$9(new Image()).load(function () {
|
||||
image.setAttributeNS(NS.XLINK, 'xlink:href', url);
|
||||
}).attr('src', url);
|
||||
|
@ -22383,6 +22535,65 @@
|
|||
});
|
||||
*/
|
||||
|
||||
var isOpera$1 = Boolean(window.opera);
|
||||
|
||||
var fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera$1) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
|
||||
* @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
|
||||
|
@ -22394,9 +22605,9 @@
|
|||
* @returns {external:jQuery} The enhanced jQuery object
|
||||
*/
|
||||
|
||||
|
||||
function jQueryPluginSVGIcons($) {
|
||||
var svgIcons = {};
|
||||
var fixIDs;
|
||||
/**
|
||||
* Map of raster images with each key being the SVG icon ID
|
||||
* to replace, and the value the image file name
|
||||
|
@ -22455,8 +22666,7 @@
|
|||
iconsMade = false,
|
||||
dataLoaded = false,
|
||||
loadAttempts = 0;
|
||||
var isOpera = Boolean(window.opera),
|
||||
// ua = navigator.userAgent,
|
||||
var // ua = navigator.userAgent,
|
||||
// isSafari = (ua.includes('Safari/') && !ua.includes('Chrome/')),
|
||||
dataPre = 'data:image/svg+xml;charset=utf-8;base64,';
|
||||
var dataEl;
|
||||
|
@ -22575,7 +22785,7 @@
|
|||
|
||||
|
||||
function setIcon(target, icon, id, setID) {
|
||||
if (isOpera) icon.css('visibility', 'hidden');
|
||||
if (isOpera$1) icon.css('visibility', 'hidden');
|
||||
|
||||
if (opts.replace) {
|
||||
if (setID) icon.attr('id', id);
|
||||
|
@ -22597,7 +22807,7 @@
|
|||
target.append(icon);
|
||||
}
|
||||
|
||||
if (isOpera) {
|
||||
if (isOpera$1) {
|
||||
setTimeout(function () {
|
||||
icon.removeAttr('style');
|
||||
}, 1);
|
||||
|
@ -22689,7 +22899,7 @@
|
|||
svgroot.setAttribute('class', 'svg_icon'); // Without cloning, Firefox will make another GET request.
|
||||
// With cloning, causes issue in Opera/Win/Non-EN
|
||||
|
||||
if (!isOpera) svg = svg.cloneNode(true);
|
||||
if (!isOpera$1) svg = svg.cloneNode(true);
|
||||
svgroot.append(svg);
|
||||
var icon = void 0;
|
||||
|
||||
|
@ -22720,7 +22930,7 @@
|
|||
if (!svgIcons[id]) return;
|
||||
$(sel).each(function (i) {
|
||||
var copy = svgIcons[id].clone();
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i, true);
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i);
|
||||
setIcon($(this), copy, id);
|
||||
});
|
||||
});
|
||||
|
@ -22736,64 +22946,6 @@
|
|||
iconsMade = true;
|
||||
if (opts.callback) opts.callback(svgIcons);
|
||||
}
|
||||
|
||||
fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -22825,7 +22977,7 @@
|
|||
var icon = svgIcons[id];
|
||||
|
||||
if (uniqueClone && icon) {
|
||||
icon = fixIDs(icon, 0, true).clone(true);
|
||||
icon = fixIDs(icon, 0).clone(true);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
@ -24898,7 +25050,7 @@
|
|||
}
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -29347,7 +29499,7 @@
|
|||
*
|
||||
* @param {module:SVGEditor.Config|module:SVGEditor.Prefs} cfgObj
|
||||
* @param {string} key
|
||||
* @param {Any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @param {any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
@ -29624,7 +29776,9 @@
|
|||
if (!src) {
|
||||
// urldata.source may have been null if it ended with '='
|
||||
if (qstr.includes('source=data:')) {
|
||||
src = qstr.match(/source=(data:[^&]*)/)[1];
|
||||
src = qstr.match(_wrapRegExp(/source=(data:[^&]*)/, {
|
||||
src: 1
|
||||
})).groups.src;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29728,7 +29882,9 @@
|
|||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
extName = extname.match(/^ext-(.+)\.js/);
|
||||
extName = extname.match(_wrapRegExp(/^ext-(.+)\.js/, {
|
||||
extName: 1
|
||||
})).groups.extName;
|
||||
|
||||
if (extName) {
|
||||
_context2.next = 3;
|
||||
|
@ -29751,12 +29907,12 @@
|
|||
_context2.prev = 4;
|
||||
_context2.next = 7;
|
||||
return importSetGlobalDefault(url, {
|
||||
global: 'svgEditorExtension_' + extName[1].replace(/-/g, '_')
|
||||
global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
|
||||
});
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: _name2
|
||||
|
@ -29870,7 +30026,7 @@
|
|||
|
||||
|
||||
var uaPrefix = function () {
|
||||
var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var regex = /^(?:Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var someScript = document.getElementsByTagName('script')[0];
|
||||
|
||||
for (var prop in someScript.style) {
|
||||
|
@ -31798,7 +31954,7 @@
|
|||
zoomDone();
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32764,14 +32920,14 @@
|
|||
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url'));
|
||||
$$b('#image_save_opts input').val([$$b.pref('img_save')]);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
var changeRectRadius = function changeRectRadius(ctl) {
|
||||
svgCanvas.setRectRadius(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32779,7 +32935,7 @@
|
|||
svgCanvas.setFontSize(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32793,7 +32949,7 @@
|
|||
svgCanvas.setStrokeWidth(val);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -35120,8 +35276,7 @@
|
|||
|
||||
$$b(window).bind('load resize', centerCanvas);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
function stepFontSize(elem, step) {
|
||||
|
@ -35152,8 +35307,7 @@
|
|||
return sugVal;
|
||||
}
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -36732,7 +36886,7 @@
|
|||
var messageQueue = [];
|
||||
/**
|
||||
* @param {PlainObject} info
|
||||
* @param {Any} info.data
|
||||
* @param {any} info.data
|
||||
* @param {string} info.origin
|
||||
* @fires module:svgcanvas.SvgCanvas#event:message
|
||||
* @returns {void}
|
||||
|
|
|
@ -3489,9 +3489,9 @@
|
|||
}
|
||||
},
|
||||
"eslint-config-ash-nazg": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-8.0.1.tgz",
|
||||
"integrity": "sha512-VH1tEN+7tpgpPUFG74aQCW1orVJ8OMm38sO98IXqRJiOWv6r9Y3lkcqPBtL9InrChQ9ea0NRklMuqgz4ludOQQ==",
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-8.0.2.tgz",
|
||||
"integrity": "sha512-VuKP7pADM+WRvSon2gCnzJQgyHFU6U7cB5b2NYbJ7FZUj++TAfCTVbiuAjQgGUJtm5XZgt0eveoPPKus5pDErQ==",
|
||||
"dev": true
|
||||
},
|
||||
"eslint-config-standard": {
|
||||
|
@ -3716,9 +3716,9 @@
|
|||
}
|
||||
},
|
||||
"eslint-plugin-jsdoc": {
|
||||
"version": "10.0.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-10.0.3.tgz",
|
||||
"integrity": "sha512-aTlXmX4iCWf/vZyzcT13ggrHG6WW1QFvFbtrAVHU+Llcm1T7cvS/zQgPdRms2fY5XR4qBmsfeUuLe7RsszzhxQ==",
|
||||
"version": "10.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-10.1.1.tgz",
|
||||
"integrity": "sha512-DOGbG3g5Qke+2nojyWv22SJ2hWjhGhfqzowhte4RpfJz5AdA1LIG9cvKTDHNo30tHbolMW2W7upJq8xnC17cnw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"comment-parser": "^0.5.5",
|
||||
|
|
|
@ -86,14 +86,14 @@
|
|||
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
|
||||
"core-js-bundle": "^3.1.4",
|
||||
"eslint": "6.0.1",
|
||||
"eslint-config-ash-nazg": "8.0.1",
|
||||
"eslint-config-ash-nazg": "8.0.2",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-array-func": "^3.1.3",
|
||||
"eslint-plugin-compat": "^3.2.0",
|
||||
"eslint-plugin-eslint-comments": "^3.1.2",
|
||||
"eslint-plugin-html": "^6.0.0",
|
||||
"eslint-plugin-import": "2.18.0",
|
||||
"eslint-plugin-jsdoc": "^10.0.3",
|
||||
"eslint-plugin-jsdoc": "^10.1.1",
|
||||
"eslint-plugin-markdown": "^1.0.0",
|
||||
"eslint-plugin-no-use-extend-native": "^0.4.1",
|
||||
"eslint-plugin-node": "9.1.0",
|
||||
|
|
|
@ -122,6 +122,74 @@
|
|||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
_construct = Reflect.construct;
|
||||
} else {
|
||||
_construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) _setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !_isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return _setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
|
@ -196,6 +264,71 @@
|
|||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function (re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
};
|
||||
|
||||
var _RegExp = _wrapNativeSuper(RegExp);
|
||||
|
||||
var _super = RegExp.prototype;
|
||||
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
|
||||
_groups.set(_this, groups);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_inherits(BabelRegExp, _RegExp);
|
||||
|
||||
BabelRegExp.prototype.exec = function (str) {
|
||||
var result = _super.exec.call(this, str);
|
||||
|
||||
if (result) result.groups = buildGroups(result, this);
|
||||
return result;
|
||||
};
|
||||
|
||||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
||||
if (typeof substitution === "string") {
|
||||
var groups = _groups.get(this);
|
||||
|
||||
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
||||
return "$" + groups[name];
|
||||
}));
|
||||
} else if (typeof substitution === "function") {
|
||||
var _this = this;
|
||||
|
||||
return _super[Symbol.replace].call(this, str, function () {
|
||||
var args = [];
|
||||
args.push.apply(args, arguments);
|
||||
|
||||
if (typeof args[args.length - 1] !== "object") {
|
||||
args.push(buildGroups(args, _this));
|
||||
}
|
||||
|
||||
return substitution.apply(this, args);
|
||||
});
|
||||
} else {
|
||||
return _super[Symbol.replace].call(this, str, substitution);
|
||||
}
|
||||
};
|
||||
|
||||
function buildGroups(result, re) {
|
||||
var g = _groups.get(re);
|
||||
|
||||
return Object.keys(g).reduce(function (groups, name) {
|
||||
groups[name] = result[g[name]];
|
||||
return groups;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
return _wrapRegExp.apply(this, arguments);
|
||||
}
|
||||
|
||||
// http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
|
||||
|
||||
/**
|
||||
|
@ -3170,22 +3303,35 @@
|
|||
} // TODO: Add skew support in future
|
||||
|
||||
|
||||
var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;
|
||||
var re = _wrapRegExp(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/, {
|
||||
xform: 1
|
||||
});
|
||||
|
||||
var m = true;
|
||||
|
||||
while (m) {
|
||||
m = str.match(re);
|
||||
str = str.replace(re, '');
|
||||
|
||||
if (m && m[1]) {
|
||||
if (m && m.groups.xform) {
|
||||
(function () {
|
||||
var x = m[1];
|
||||
var bits = x.split(/\s*\(/);
|
||||
var name = bits[0];
|
||||
var valBits = bits[1].match(/\s*(.*?)\s*\)/);
|
||||
valBits[1] = valBits[1].replace(/(\d)-/g, '$1 -');
|
||||
var valArr = valBits[1].split(/[, ]+/);
|
||||
var letters = 'abcdef'.split('');
|
||||
var x = m.groups.xform;
|
||||
|
||||
var _x$split = x.split(/\s*\(/),
|
||||
_x$split2 = _slicedToArray(_x$split, 2),
|
||||
name = _x$split2[0],
|
||||
bits = _x$split2[1];
|
||||
|
||||
var valBits = bits.match(_wrapRegExp(/\s*(.*?)\s*\)/, {
|
||||
nonWhitespace: 1
|
||||
}));
|
||||
valBits.groups.nonWhitespace = valBits.groups.nonWhitespace.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
var valArr = valBits.groups.nonWhitespace.split(/[, ]+/);
|
||||
|
||||
var letters = _toConsumableArray('abcdef');
|
||||
|
||||
var mtx = svgroot.createSVGMatrix();
|
||||
Object.values(valArr).forEach(function (item, i) {
|
||||
valArr[i] = parseFloat(item);
|
||||
|
@ -6518,11 +6664,12 @@
|
|||
var pt1 = transformPoint(x1, y1, m);
|
||||
var pt2 = transformPoint(x2, y2, m); // Convert back to BB points
|
||||
|
||||
var gCoords = {};
|
||||
gCoords.x1 = (pt1.x - bb.x) / bb.width;
|
||||
gCoords.y1 = (pt1.y - bb.y) / bb.height;
|
||||
gCoords.x2 = (pt2.x - bb.x) / bb.width;
|
||||
gCoords.y2 = (pt2.y - bb.y) / bb.height;
|
||||
var gCoords = {
|
||||
x1: (pt1.x - bb.x) / bb.width,
|
||||
y1: (pt1.y - bb.y) / bb.height,
|
||||
x2: (pt2.x - bb.x) / bb.width,
|
||||
y2: (pt2.y - bb.y) / bb.height
|
||||
};
|
||||
var newgrad = grad.cloneNode(true);
|
||||
$$1(newgrad).attr(gCoords);
|
||||
newgrad.id = editorContext_.getNextId();
|
||||
|
@ -6706,6 +6853,7 @@
|
|||
|
||||
d += pathDSegment(letter, [[x1, y1], [x, y]]);
|
||||
break;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
|
||||
case 10:
|
||||
// absolute elliptical arc (A)
|
||||
|
@ -7953,7 +8101,10 @@
|
|||
*/
|
||||
|
||||
var dropXMLInteralSubset = function dropXMLInteralSubset(str) {
|
||||
return str.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, '$1$2');
|
||||
return str.replace(_wrapRegExp(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/, {
|
||||
doctypeOpen: 1,
|
||||
doctypeClose: 2
|
||||
}), '$<doctypeOpen>$<doctypeClose>');
|
||||
};
|
||||
/**
|
||||
* Converts characters in a string to XML-friendly entities.
|
||||
|
@ -8093,9 +8244,16 @@
|
|||
return '';
|
||||
}
|
||||
|
||||
var arr = dataurl.split(','),
|
||||
mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]);
|
||||
var _dataurl$split = dataurl.split(','),
|
||||
_dataurl$split2 = _slicedToArray(_dataurl$split, 2),
|
||||
prefix = _dataurl$split2[0],
|
||||
suffix = _dataurl$split2[1],
|
||||
_prefix$match = prefix.match(_wrapRegExp(/:(.*?);/, {
|
||||
mime: 1
|
||||
})),
|
||||
mime = _prefix$match.groups.mime,
|
||||
bstr = atob(suffix);
|
||||
|
||||
var n = bstr.length;
|
||||
var u8arr = new Uint8Array(n);
|
||||
|
||||
|
@ -8147,6 +8305,7 @@
|
|||
|
||||
var text2xml = function text2xml(sXML) {
|
||||
if (sXML.includes('<svg:svg')) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
sXML = sXML.replace(/<(\/?)svg:/g, '<$1').replace('xmlns:svg', 'xmlns');
|
||||
}
|
||||
|
||||
|
@ -8528,11 +8687,17 @@
|
|||
|
||||
|
||||
if (!isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x') || 0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y') || 0);
|
||||
var _ret = ret,
|
||||
x = _ret.x,
|
||||
y = _ret.y,
|
||||
width = _ret.width,
|
||||
height = _ret.height;
|
||||
var bb = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + parseFloat(selected.getAttribute('x') || 0),
|
||||
y: y + parseFloat(selected.getAttribute('y') || 0)
|
||||
};
|
||||
ret = bb;
|
||||
}
|
||||
} else if (visElemsArr.includes(elname)) {
|
||||
|
@ -8544,12 +8709,13 @@
|
|||
// Re: Chrome returning bbox for containing text element, see: https://bugs.chromium.org/p/chromium/issues/detail?id=349835
|
||||
var extent = selected.getExtentOfChar(0); // pos+dimensions of the first glyph
|
||||
|
||||
var width = selected.getComputedTextLength(); // width of the tspan
|
||||
var _width = selected.getComputedTextLength(); // width of the tspan
|
||||
|
||||
|
||||
ret = {
|
||||
x: extent.x,
|
||||
y: extent.y,
|
||||
width: width,
|
||||
width: _width,
|
||||
height: extent.height
|
||||
};
|
||||
}
|
||||
|
@ -9275,7 +9441,7 @@
|
|||
};
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -9382,9 +9548,9 @@
|
|||
|
||||
/**
|
||||
* @function module:importModule.importSetGlobalDefault
|
||||
* @param {string|GenericArray<Any>} url
|
||||
* @param {string|GenericArray<any>} url
|
||||
* @param {module:importModule.ImportConfig} config
|
||||
* @returns {Promise<Any>} The value to which it resolves depends on the export of the targeted module.
|
||||
* @returns {Promise<any>} The value to which it resolves depends on the export of the targeted module.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -9505,7 +9671,7 @@
|
|||
* @param {PlainObject} [atts={}]
|
||||
* @param {PlainObject} opts
|
||||
* @param {boolean} [opts.returnDefault=false} = {}]
|
||||
* @returns {Promise<Any>} Resolves to value of loading module or rejects with
|
||||
* @returns {Promise<any>} Resolves to value of loading module or rejects with
|
||||
* `Error` upon a script loading error.
|
||||
*/
|
||||
|
||||
|
@ -11578,7 +11744,9 @@
|
|||
case 'gradientTransform':
|
||||
case 'patternTransform':
|
||||
{
|
||||
var val = attr.value.replace(/(\d)-/g, '$1 -');
|
||||
var val = attr.value.replace(_wrapRegExp(/(\d)-/g, {
|
||||
digit: 1
|
||||
}), '$<digit> -');
|
||||
node.setAttribute(attrName, val);
|
||||
break;
|
||||
}
|
||||
|
@ -11711,9 +11879,8 @@
|
|||
};
|
||||
/**
|
||||
* Applies coordinate changes to an element based on the given matrix.
|
||||
* @function module:coords.remapElement
|
||||
* @implements {module:path.EditorContext#remapElement}
|
||||
* @returns {void}
|
||||
* @name module:coords.remapElement
|
||||
* @type {module:path.EditorContext#remapElement}
|
||||
*/
|
||||
|
||||
var remapElement = function remapElement(selected, changes, m) {
|
||||
|
@ -13684,9 +13851,8 @@
|
|||
canvas.current_drawing_ = new Drawing(svgcontent, idprefix);
|
||||
/**
|
||||
* Returns the current Drawing.
|
||||
* @function module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @implements {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
* @returns {module:draw.Drawing}
|
||||
* @name module:svgcanvas.SvgCanvas#getCurrentDrawing
|
||||
* @type {module:draw.DrawCanvasInit#getCurrentDrawing}
|
||||
*/
|
||||
|
||||
var getCurrentDrawing = canvas.getCurrentDrawing = function () {
|
||||
|
@ -13765,9 +13931,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @implements {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
* @returns {Element} The new element
|
||||
* @name module:svgcanvas.SvgCanvas#addSVGElementFromJson
|
||||
* @type {module:utilities.EditorContext#addSVGElementFromJson|module:path.EditorContext#addSVGElementFromJson}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13823,8 +13988,7 @@
|
|||
canvas.hasMatrixTransform = hasMatrixTransform;
|
||||
canvas.transformListToTransform = transformListToTransform;
|
||||
/**
|
||||
* @implements {module:utilities.EditorContext#getBaseUnit}
|
||||
* @returns {string}
|
||||
* @type {module:utilities.EditorContext#getBaseUnit}
|
||||
*/
|
||||
|
||||
var getBaseUnit = function getBaseUnit() {
|
||||
|
@ -13856,8 +14020,7 @@
|
|||
canvas.convertToNum = convertToNum;
|
||||
/**
|
||||
* This should really be an intersection implementing all rather than a union.
|
||||
* @implements {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:draw.DrawCanvasInit#getSVGContent|module:utilities.EditorContext#getSVGContent}
|
||||
*/
|
||||
|
||||
var getSVGContent = function getSVGContent() {
|
||||
|
@ -13865,9 +14028,8 @@
|
|||
};
|
||||
/**
|
||||
* Should really be an intersection with all needing to apply rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @implements {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
* @returns {Element[]} the array with selected DOM elements
|
||||
* @name module:svgcanvas.SvgCanvas#getSelectedElements
|
||||
* @type {module:utilities.EditorContext#getSelectedElements|module:draw.DrawCanvasInit#getSelectedElements|module:path.EditorContext#getSelectedElements}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -13878,8 +14040,7 @@
|
|||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
* @returns {SVGSVGElement}
|
||||
* @type {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
*/
|
||||
|
||||
var getSVGRoot = function getSVGRoot() {
|
||||
|
@ -13923,8 +14084,7 @@
|
|||
this.cleanupElement = cleanupElement;
|
||||
/**
|
||||
* This should actually be an intersection not a union as all should apply.
|
||||
* @implements {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
* @returns {boolean}
|
||||
* @type {module:coords.EditorContext#getGridSnapping|module:path.EditorContext#getGridSnapping}
|
||||
*/
|
||||
|
||||
var getGridSnapping = function getGridSnapping() {
|
||||
|
@ -14038,8 +14198,8 @@
|
|||
});
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas~addCommandToHistory
|
||||
* @implements {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
* @name module:svgcanvas~addCommandToHistory
|
||||
* @type {module:path.EditorContext#addCommandToHistory|module:draw.DrawCanvasInit#addCommandToHistory}
|
||||
*/
|
||||
|
||||
var addCommandToHistory = function addCommandToHistory(cmd) {
|
||||
|
@ -14047,9 +14207,8 @@
|
|||
};
|
||||
/**
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#getZoom
|
||||
* @implements {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
* @returns {Float} The current zoom level
|
||||
* @name module:svgcanvas.SvgCanvas#getZoom
|
||||
* @type {module:path.EditorContext#getCurrentZoom|module:select.SVGFactory#getCurrentZoom}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14058,9 +14217,8 @@
|
|||
};
|
||||
/**
|
||||
* This method rounds the incoming value to the nearest value based on the `currentZoom`
|
||||
* @function module:svgcanvas.SvgCanvas#round
|
||||
* @implements {module:path.EditorContext#round}
|
||||
* @returns {Float} Rounded value to nearest value based on `currentZoom`
|
||||
* @name module:svgcanvas.SvgCanvas#round
|
||||
* @type {module:path.EditorContext#round}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14093,18 +14251,16 @@
|
|||
|
||||
var selectorManager = this.selectorManager = getSelectorManager();
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getNextId
|
||||
* @implements {module:path.EditorContext#getNextId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getNextId
|
||||
* @type {module:path.EditorContext#getNextId}
|
||||
*/
|
||||
|
||||
var getNextId = canvas.getNextId = function () {
|
||||
return getCurrentDrawing().getNextId();
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getId
|
||||
* @implements {module:path.EditorContext#getId}
|
||||
* @returns {string}
|
||||
* @name module:svgcanvas.SvgCanvas#getId
|
||||
* @type {module:path.EditorContext#getId}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14113,11 +14269,8 @@
|
|||
};
|
||||
/**
|
||||
* The "implements" should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#call
|
||||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
* @name module:svgcanvas.SvgCanvas#call
|
||||
* @type {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14131,8 +14284,8 @@
|
|||
/**
|
||||
* Clears the selection. The 'selected' handler is then optionally called.
|
||||
* This should really be an intersection applying to all types rather than a union.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @implements {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#clearSelection
|
||||
* @type {module:draw.DrawCanvasInit#clearSelection|module:path.EditorContext#clearSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
*/
|
||||
|
||||
|
@ -14153,10 +14306,9 @@
|
|||
};
|
||||
/**
|
||||
* Adds a list of elements to the selection. The 'selected' handler is then called.
|
||||
* @function module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @implements {module:path.EditorContext#addToSelection}
|
||||
* @name module:svgcanvas.SvgCanvas#addToSelection
|
||||
* @type {module:path.EditorContext#addToSelection}
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14238,8 +14390,7 @@
|
|||
}
|
||||
};
|
||||
/**
|
||||
* @implements {module:path.EditorContext#getOpacity}
|
||||
* @returns {Float}
|
||||
* @type {module:path.EditorContext#getOpacity}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14247,9 +14398,8 @@
|
|||
return curShape.opacity;
|
||||
};
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @implements {module:path.EditorContext#getMouseTarget}
|
||||
* @returns {Element} DOM element we want
|
||||
* @name module:svgcanvas.SvgCanvas#getMouseTarget
|
||||
* @type {module:path.EditorContext#getMouseTarget}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14317,7 +14467,7 @@
|
|||
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
* @type {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
|
@ -14982,7 +15132,7 @@
|
|||
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
* @property {Any} data The data
|
||||
* @property {any} data The data
|
||||
* @property {string} origin The origin
|
||||
*/
|
||||
|
||||
|
@ -18587,10 +18737,12 @@
|
|||
if (val) {
|
||||
if (val.startsWith('data:')) {
|
||||
// Check if an SVG-edit data URI
|
||||
var m = val.match(/svgedit_url=(.*?);/);
|
||||
var m = val.match(_wrapRegExp(/svgedit_url=(.*?);/, {
|
||||
url: 1
|
||||
}));
|
||||
|
||||
if (m) {
|
||||
var url = decodeURIComponent(m[1]);
|
||||
var url = decodeURIComponent(m.groups.url);
|
||||
$$9(new Image()).load(function () {
|
||||
image.setAttributeNS(NS.XLINK, 'xlink:href', url);
|
||||
}).attr('src', url);
|
||||
|
@ -22383,6 +22535,65 @@
|
|||
});
|
||||
*/
|
||||
|
||||
var isOpera$1 = Boolean(window.opera);
|
||||
|
||||
var fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera$1) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
|
||||
* @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
|
||||
|
@ -22394,9 +22605,9 @@
|
|||
* @returns {external:jQuery} The enhanced jQuery object
|
||||
*/
|
||||
|
||||
|
||||
function jQueryPluginSVGIcons($) {
|
||||
var svgIcons = {};
|
||||
var fixIDs;
|
||||
/**
|
||||
* Map of raster images with each key being the SVG icon ID
|
||||
* to replace, and the value the image file name
|
||||
|
@ -22455,8 +22666,7 @@
|
|||
iconsMade = false,
|
||||
dataLoaded = false,
|
||||
loadAttempts = 0;
|
||||
var isOpera = Boolean(window.opera),
|
||||
// ua = navigator.userAgent,
|
||||
var // ua = navigator.userAgent,
|
||||
// isSafari = (ua.includes('Safari/') && !ua.includes('Chrome/')),
|
||||
dataPre = 'data:image/svg+xml;charset=utf-8;base64,';
|
||||
var dataEl;
|
||||
|
@ -22575,7 +22785,7 @@
|
|||
|
||||
|
||||
function setIcon(target, icon, id, setID) {
|
||||
if (isOpera) icon.css('visibility', 'hidden');
|
||||
if (isOpera$1) icon.css('visibility', 'hidden');
|
||||
|
||||
if (opts.replace) {
|
||||
if (setID) icon.attr('id', id);
|
||||
|
@ -22597,7 +22807,7 @@
|
|||
target.append(icon);
|
||||
}
|
||||
|
||||
if (isOpera) {
|
||||
if (isOpera$1) {
|
||||
setTimeout(function () {
|
||||
icon.removeAttr('style');
|
||||
}, 1);
|
||||
|
@ -22689,7 +22899,7 @@
|
|||
svgroot.setAttribute('class', 'svg_icon'); // Without cloning, Firefox will make another GET request.
|
||||
// With cloning, causes issue in Opera/Win/Non-EN
|
||||
|
||||
if (!isOpera) svg = svg.cloneNode(true);
|
||||
if (!isOpera$1) svg = svg.cloneNode(true);
|
||||
svgroot.append(svg);
|
||||
var icon = void 0;
|
||||
|
||||
|
@ -22720,7 +22930,7 @@
|
|||
if (!svgIcons[id]) return;
|
||||
$(sel).each(function (i) {
|
||||
var copy = svgIcons[id].clone();
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i, true);
|
||||
if (i > 0 && !toImage) copy = fixIDs(copy, i);
|
||||
setIcon($(this), copy, id);
|
||||
});
|
||||
});
|
||||
|
@ -22736,64 +22946,6 @@
|
|||
iconsMade = true;
|
||||
if (opts.callback) opts.callback(svgIcons);
|
||||
}
|
||||
|
||||
fixIDs = function fixIDs(svgEl, svgNum, force) {
|
||||
var defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
var idElems;
|
||||
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
|
||||
var allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
idElems.each(function (i) {
|
||||
var id = this.id;
|
||||
/*
|
||||
const noDupes = ($(svgdoc).find('#' + id).length <= 1);
|
||||
if (isOpera) noDupes = false; // Opera didn't clone svgEl, so not reliable
|
||||
if(!force && noDupes) return;
|
||||
*/
|
||||
|
||||
var newId = 'x' + id + svgNum + i;
|
||||
this.id = newId;
|
||||
var oldVal = 'url(#' + id + ')';
|
||||
var newVal = 'url(#' + newId + ')'; // Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svgEl.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + newId + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + newId + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + newId);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + newId + ')');
|
||||
// });
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
var elem = allElems[i];
|
||||
|
||||
if (elem.getAttribute('fill') === oldVal) {
|
||||
elem.setAttribute('fill', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('stroke') === oldVal) {
|
||||
elem.setAttribute('stroke', newVal);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('filter') === oldVal) {
|
||||
elem.setAttribute('filter', newVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return svgEl;
|
||||
};
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -22825,7 +22977,7 @@
|
|||
var icon = svgIcons[id];
|
||||
|
||||
if (uniqueClone && icon) {
|
||||
icon = fixIDs(icon, 0, true).clone(true);
|
||||
icon = fixIDs(icon, 0).clone(true);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
@ -24898,7 +25050,7 @@
|
|||
}
|
||||
/**
|
||||
* Whether a value is `null` or `undefined`.
|
||||
* @param {Any} val
|
||||
* @param {any} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
@ -29347,7 +29499,7 @@
|
|||
*
|
||||
* @param {module:SVGEditor.Config|module:SVGEditor.Prefs} cfgObj
|
||||
* @param {string} key
|
||||
* @param {Any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @param {any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
@ -29624,7 +29776,9 @@
|
|||
if (!src) {
|
||||
// urldata.source may have been null if it ended with '='
|
||||
if (qstr.includes('source=data:')) {
|
||||
src = qstr.match(/source=(data:[^&]*)/)[1];
|
||||
src = qstr.match(_wrapRegExp(/source=(data:[^&]*)/, {
|
||||
src: 1
|
||||
})).groups.src;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29728,7 +29882,9 @@
|
|||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
extName = extname.match(/^ext-(.+)\.js/);
|
||||
extName = extname.match(_wrapRegExp(/^ext-(.+)\.js/, {
|
||||
extName: 1
|
||||
})).groups.extName;
|
||||
|
||||
if (extName) {
|
||||
_context2.next = 3;
|
||||
|
@ -29751,12 +29907,12 @@
|
|||
_context2.prev = 4;
|
||||
_context2.next = 7;
|
||||
return importSetGlobalDefault(url, {
|
||||
global: 'svgEditorExtension_' + extName[1].replace(/-/g, '_')
|
||||
global: 'svgEditorExtension_' + extName.replace(/-/g, '_')
|
||||
});
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: _name2
|
||||
|
@ -29870,7 +30026,7 @@
|
|||
|
||||
|
||||
var uaPrefix = function () {
|
||||
var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var regex = /^(?:Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
|
||||
var someScript = document.getElementsByTagName('script')[0];
|
||||
|
||||
for (var prop in someScript.style) {
|
||||
|
@ -31798,7 +31954,7 @@
|
|||
zoomDone();
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32764,14 +32920,14 @@
|
|||
setBackground($$b.pref('bkgd_color'), $$b.pref('bkgd_url'));
|
||||
$$b('#image_save_opts input').val([$$b.pref('img_save')]);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
var changeRectRadius = function changeRectRadius(ctl) {
|
||||
svgCanvas.setRectRadius(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32779,7 +32935,7 @@
|
|||
svgCanvas.setFontSize(ctl.value);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32793,7 +32949,7 @@
|
|||
svgCanvas.setStrokeWidth(val);
|
||||
};
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.ValueCallback}
|
||||
* @type {module:jQuerySpinButton.ValueCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -35120,8 +35276,7 @@
|
|||
|
||||
$$b(window).bind('load resize', centerCanvas);
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
function stepFontSize(elem, step) {
|
||||
|
@ -35152,8 +35307,7 @@
|
|||
return sugVal;
|
||||
}
|
||||
/**
|
||||
* @implements {module:jQuerySpinButton.StepCallback}
|
||||
* @returns {Float}
|
||||
* @type {module:jQuerySpinButton.StepCallback}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -36732,7 +36886,7 @@
|
|||
var messageQueue = [];
|
||||
/**
|
||||
* @param {PlainObject} info
|
||||
* @param {Any} info.data
|
||||
* @param {any} info.data
|
||||
* @param {string} info.origin
|
||||
* @fires module:svgcanvas.SvgCanvas#event:message
|
||||
* @returns {void}
|
||||
|
|
Loading…
Reference in New Issue