- Linting (ESLint): As per latest ash-nazg (jsdoc for classes/methods)
- npm: Update devDeps
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable new-cap, class-methods-use-this */
|
||||
/* eslint-disable new-cap, class-methods-use-this, jsdoc/require-jsdoc */
|
||||
// Todo: Compare with latest canvg (add any improvements of ours) and add full JSDocs (denoting links to standard APIs and which are custom): https://github.com/canvg/canvg
|
||||
/**
|
||||
* Javascript SVG parser and renderer on Canvas.
|
||||
|
||||
113
editor/external/jamilih/jml-es.js
vendored
113
editor/external/jamilih/jml-es.js
vendored
@@ -325,7 +325,7 @@ var win = typeof window !== 'undefined' && window; // istanbul ignore next
|
||||
var doc = typeof document !== 'undefined' && document || win && win.document; // STATIC PROPERTIES
|
||||
|
||||
var possibleOptions = ['$plugins', // '$mode', // Todo (SVG/XML)
|
||||
// 'state', // Used internally
|
||||
// '$state', // Used internally
|
||||
'$map' // Add any other options here
|
||||
];
|
||||
var NS_HTML = 'http://www.w3.org/1999/xhtml',
|
||||
@@ -408,9 +408,7 @@ function _applyAnyStylesheet(node) {
|
||||
|
||||
|
||||
function _appendNode(parent, child) {
|
||||
var parentName = _getHTMLNodeName(parent);
|
||||
|
||||
var childName = _getHTMLNodeName(child); // IE only
|
||||
var parentName = _getHTMLNodeName(parent); // IE only
|
||||
// istanbul ignore if
|
||||
|
||||
|
||||
@@ -436,6 +434,9 @@ function _appendNode(parent, child) {
|
||||
parent.append(child); // IE9 is now ok with this
|
||||
} catch (e) {
|
||||
// istanbul ignore next
|
||||
var childName = _getHTMLNodeName(child); // istanbul ignore next
|
||||
|
||||
|
||||
if (parentName === 'select' && childName === 'option') {
|
||||
try {
|
||||
// Since this is now DOM Level 4 standard behavior (and what IE7+ can handle), we try it first
|
||||
@@ -591,20 +592,6 @@ function _replaceDefiner(xmlnsObj) {
|
||||
return retStr;
|
||||
};
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @returns {Element}
|
||||
*/
|
||||
|
||||
|
||||
function _optsOrUndefinedJML() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return jml.apply(void 0, _toConsumableArray(args[0] === undefined ? args.slice(1) : args));
|
||||
}
|
||||
/**
|
||||
* @typedef {JamilihAttributes} AttributeArray
|
||||
* @property {string} 0 The key
|
||||
@@ -630,7 +617,7 @@ function _childrenToJML(node) {
|
||||
return function (childNodeJML, i) {
|
||||
var cn = node.childNodes[i];
|
||||
var j = Array.isArray(childNodeJML) ? jml.apply(void 0, _toConsumableArray(childNodeJML)) : jml(childNodeJML);
|
||||
cn.parentNode.replaceChild(j, cn);
|
||||
cn.replaceWith(j);
|
||||
};
|
||||
}
|
||||
/**
|
||||
@@ -649,7 +636,11 @@ function _childrenToJML(node) {
|
||||
|
||||
function _appendJML(node) {
|
||||
return function (childJML) {
|
||||
node.append(jml.apply(void 0, _toConsumableArray(childJML)));
|
||||
if (Array.isArray(childJML)) {
|
||||
node.append(jml.apply(void 0, _toConsumableArray(childJML)));
|
||||
} else {
|
||||
node.append(jml(childJML));
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
@@ -670,8 +661,10 @@ function _appendJMLOrText(node) {
|
||||
return function (childJML) {
|
||||
if (typeof childJML === 'string') {
|
||||
node.append(childJML);
|
||||
} else {
|
||||
} else if (Array.isArray(childJML)) {
|
||||
node.append(jml.apply(void 0, _toConsumableArray(childJML)));
|
||||
} else {
|
||||
node.append(jml(childJML));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -717,15 +710,15 @@ function _DOMfromJMLOrString (childNodeJML) {
|
||||
* Creates an XHTML or HTML element (XHTML is preferred, but only in browsers
|
||||
* that support); any element after element can be omitted, and any subsequent
|
||||
* type or types added afterwards.
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {JamilihReturn} The newly created (and possibly already appended)
|
||||
* element or array of elements
|
||||
*/
|
||||
|
||||
|
||||
var jml = function jml() {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var elem = doc.createDocumentFragment();
|
||||
@@ -768,7 +761,8 @@ var jml = function jml() {
|
||||
case '#':
|
||||
{
|
||||
// Document fragment
|
||||
nodes[nodes.length] = _optsOrUndefinedJML(opts, attVal);
|
||||
opts.$state = 'fragmentChilden';
|
||||
nodes[nodes.length] = jml(opts, attVal);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -815,6 +809,12 @@ var jml = function jml() {
|
||||
break;
|
||||
}
|
||||
|
||||
case '$state':
|
||||
{
|
||||
// Handled internally
|
||||
break;
|
||||
}
|
||||
|
||||
case 'is':
|
||||
{
|
||||
// Currently only in Chrome
|
||||
@@ -847,6 +847,7 @@ var jml = function jml() {
|
||||
throw new TypeError('Expected `is` with `$define` on built-in');
|
||||
}
|
||||
|
||||
opts.$state = 'attributeValue';
|
||||
elem.setAttribute('is', atts.is);
|
||||
is = atts.is;
|
||||
}
|
||||
@@ -1159,6 +1160,7 @@ var jml = function jml() {
|
||||
break;
|
||||
}
|
||||
|
||||
opts.$state = 'attributeValue';
|
||||
elem.setAttribute(att, attVal);
|
||||
break;
|
||||
|
||||
@@ -1200,6 +1202,7 @@ var jml = function jml() {
|
||||
} // setAttribute unfortunately erases any existing styles
|
||||
|
||||
|
||||
opts.$state = 'attributeValue';
|
||||
elem.setAttribute(att, attVal);
|
||||
/*
|
||||
// The following reorders which is troublesome for serialization, e.g., as used in our testing
|
||||
@@ -1213,12 +1216,13 @@ var jml = function jml() {
|
||||
break;
|
||||
}
|
||||
|
||||
var matchingPlugin = opts && opts.$plugins && opts.$plugins.find(function (p) {
|
||||
var matchingPlugin = opts.$plugins && opts.$plugins.find(function (p) {
|
||||
return p.name === att;
|
||||
});
|
||||
|
||||
if (matchingPlugin) {
|
||||
matchingPlugin.set({
|
||||
opts: opts,
|
||||
element: elem,
|
||||
attribute: {
|
||||
name: att,
|
||||
@@ -1228,6 +1232,7 @@ var jml = function jml() {
|
||||
break;
|
||||
}
|
||||
|
||||
opts.$state = 'attributeValue';
|
||||
elem.setAttribute(att, attVal);
|
||||
break;
|
||||
}
|
||||
@@ -1251,9 +1256,9 @@ var jml = function jml() {
|
||||
})) {
|
||||
opts = args[0];
|
||||
|
||||
if (opts.state !== 'child') {
|
||||
if (opts.$state === undefined) {
|
||||
isRoot = true;
|
||||
opts.state = 'child';
|
||||
opts.$state = 'root';
|
||||
}
|
||||
|
||||
if (opts.$map && !opts.$map.root && opts.$map.root !== false) {
|
||||
@@ -1283,10 +1288,14 @@ var jml = function jml() {
|
||||
}
|
||||
|
||||
args = args.slice(1);
|
||||
} else {
|
||||
opts = {
|
||||
$state: undefined
|
||||
};
|
||||
}
|
||||
|
||||
var argc = args.length;
|
||||
var defaultMap = opts && opts.$map && opts.$map.root;
|
||||
var defaultMap = opts.$map && opts.$map.root;
|
||||
|
||||
var setMap = function setMap(dataVal) {
|
||||
var map, obj; // Boolean indicating use of default map and object
|
||||
@@ -1412,6 +1421,7 @@ var jml = function jml() {
|
||||
|
||||
case '':
|
||||
nodes[nodes.length] = elem = doc.createDocumentFragment();
|
||||
opts.$state = 'fragment';
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1440,6 +1450,7 @@ var jml = function jml() {
|
||||
elem = doc.createElement(elStr);
|
||||
}
|
||||
|
||||
opts.$state = 'element';
|
||||
nodes[nodes.length] = elem; // Add to parent
|
||||
|
||||
break;
|
||||
@@ -1469,7 +1480,8 @@ var jml = function jml() {
|
||||
|
||||
|
||||
elem = nodes[nodes.length - 1] = new win.DOMParser().parseFromString(new win.XMLSerializer().serializeToString(elem) // Mozilla adds XHTML namespace
|
||||
.replace(' xmlns="' + NS_HTML + '"', replacer), 'application/xml').documentElement; // }catch(e) {alert(elem.outerHTML);throw e;}
|
||||
.replace(' xmlns="' + NS_HTML + '"', replacer), 'application/xml').documentElement;
|
||||
opts.$state = 'element'; // }catch(e) {alert(elem.outerHTML);throw e;}
|
||||
}
|
||||
|
||||
_checkAtts(_atts);
|
||||
@@ -1487,6 +1499,7 @@ var jml = function jml() {
|
||||
if (i === 0) {
|
||||
// Allow wrapping of element, fragment, or document
|
||||
elem = arg;
|
||||
opts.$state = 'element';
|
||||
}
|
||||
|
||||
if (i === argc - 1 || i === argc - 2 && args[i + 1] === null) {
|
||||
@@ -1534,10 +1547,14 @@ var jml = function jml() {
|
||||
default:
|
||||
if (Array.isArray(childContent)) {
|
||||
// Arrays representing child elements
|
||||
_appendNode(elem, _optsOrUndefinedJML.apply(void 0, [opts].concat(_toConsumableArray(childContent))));
|
||||
opts.$state = 'children';
|
||||
|
||||
_appendNode(elem, jml.apply(void 0, [opts].concat(_toConsumableArray(childContent))));
|
||||
} else if (childContent['#']) {
|
||||
// Fragment
|
||||
_appendNode(elem, _optsOrUndefinedJML(opts, childContent['#']));
|
||||
opts.$state = 'fragmentChildren';
|
||||
|
||||
_appendNode(elem, jml(opts, childContent['#']));
|
||||
} else {
|
||||
// Single DOM element children
|
||||
_appendNode(elem, childContent);
|
||||
@@ -1554,7 +1571,7 @@ var jml = function jml() {
|
||||
|
||||
var ret = nodes[0] || elem;
|
||||
|
||||
if (opts && isRoot && opts.$map && opts.$map.root) {
|
||||
if (isRoot && opts.$map && opts.$map.root) {
|
||||
setMap(true);
|
||||
}
|
||||
|
||||
@@ -1940,7 +1957,7 @@ jml.toJMLString = function (dom, config) {
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {JamilihReturn}
|
||||
*/
|
||||
|
||||
@@ -1951,7 +1968,7 @@ jml.toDOM = function () {
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
@@ -1966,7 +1983,7 @@ jml.toHTML = function () {
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
@@ -1977,7 +1994,7 @@ jml.toDOMString = function () {
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
@@ -1988,7 +2005,7 @@ jml.toXML = function () {
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {JamilihArray} args
|
||||
* @param {...JamilihArray} args
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
@@ -2028,8 +2045,8 @@ function (_Map) {
|
||||
|
||||
elem = typeof elem === 'string' ? $(elem) : elem;
|
||||
|
||||
for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
||||
args[_key3 - 2] = arguments[_key3];
|
||||
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return (_this$get = this.get(elem))[methodName].apply(_this$get, [elem].concat(args));
|
||||
@@ -2069,8 +2086,8 @@ function (_WeakMap) {
|
||||
|
||||
elem = typeof elem === 'string' ? $(elem) : elem;
|
||||
|
||||
for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
||||
args[_key4 - 2] = arguments[_key4];
|
||||
for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
||||
args[_key3 - 2] = arguments[_key3];
|
||||
}
|
||||
|
||||
return (_this$get2 = this.get(elem))[methodName].apply(_this$get2, [elem].concat(args));
|
||||
@@ -2097,8 +2114,8 @@ jml.WeakMap = JamilihWeakMap;
|
||||
jml.weak = function (obj) {
|
||||
var map = new JamilihWeakMap();
|
||||
|
||||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
||||
args[_key5 - 1] = arguments[_key5];
|
||||
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
||||
args[_key4 - 1] = arguments[_key4];
|
||||
}
|
||||
|
||||
var elem = jml.apply(void 0, [{
|
||||
@@ -2116,8 +2133,8 @@ jml.weak = function (obj) {
|
||||
jml.strong = function (obj) {
|
||||
var map = new JamilihMap();
|
||||
|
||||
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
||||
args[_key6 - 1] = arguments[_key6];
|
||||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
||||
args[_key5 - 1] = arguments[_key5];
|
||||
}
|
||||
|
||||
var elem = jml.apply(void 0, [{
|
||||
@@ -2152,8 +2169,8 @@ jml.command = function (elem, symOrMap, methodName) {
|
||||
elem = typeof elem === 'string' ? $(elem) : elem;
|
||||
var func;
|
||||
|
||||
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key7 = 3; _key7 < _len7; _key7++) {
|
||||
args[_key7 - 3] = arguments[_key7];
|
||||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
||||
args[_key6 - 3] = arguments[_key6];
|
||||
}
|
||||
|
||||
if (['symbol', 'string'].includes(_typeof(symOrMap))) {
|
||||
|
||||
@@ -99,12 +99,14 @@ class Command {
|
||||
/**
|
||||
* History command for an element that had its DOM position changed.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The DOM element that was moved
|
||||
* @param {Element} oldNextSibling - The element's next sibling before it was moved
|
||||
* @param {Element} oldParent - The element's parent before it was moved
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
export class MoveElementCommand extends Command {
|
||||
/**
|
||||
* @param {Element} elem - The DOM element that was moved
|
||||
* @param {Element} oldNextSibling - The element's next sibling before it was moved
|
||||
* @param {Element} oldParent - The element's parent before it was moved
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
constructor (elem, oldNextSibling, oldParent, text) {
|
||||
super();
|
||||
this.elem = elem;
|
||||
@@ -114,6 +116,9 @@ export class MoveElementCommand extends Command {
|
||||
this.newNextSibling = elem.nextSibling;
|
||||
this.newParent = elem.parentNode;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.MoveElementCommand"}
|
||||
*/
|
||||
type () { // eslint-disable-line class-methods-use-this
|
||||
return 'svgedit.history.MoveElementCommand';
|
||||
}
|
||||
@@ -167,11 +172,12 @@ MoveElementCommand.type = MoveElementCommand.prototype.type;
|
||||
/**
|
||||
* History command for an element that was added to the DOM.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
*
|
||||
* @param {Element} elem - The newly added DOM element
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
export class InsertElementCommand extends Command {
|
||||
/**
|
||||
* @param {Element} elem - The newly added DOM element
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
constructor (elem, text) {
|
||||
super();
|
||||
this.elem = elem;
|
||||
@@ -180,6 +186,9 @@ export class InsertElementCommand extends Command {
|
||||
this.nextSibling = this.elem.nextSibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {"svgedit.history.InsertElementCommand"}
|
||||
*/
|
||||
type () { // eslint-disable-line class-methods-use-this
|
||||
return 'svgedit.history.InsertElementCommand';
|
||||
}
|
||||
@@ -233,12 +242,14 @@ InsertElementCommand.type = InsertElementCommand.prototype.type;
|
||||
/**
|
||||
* History command for an element removed from the DOM.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The removed DOM element
|
||||
* @param {Node} oldNextSibling - The DOM element's nextSibling when it was in the DOM
|
||||
* @param {Element} oldParent - The DOM element's parent
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
export class RemoveElementCommand extends Command {
|
||||
/**
|
||||
* @param {Element} elem - The removed DOM element
|
||||
* @param {Node} oldNextSibling - The DOM element's nextSibling when it was in the DOM
|
||||
* @param {Element} oldParent - The DOM element's parent
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
constructor (elem, oldNextSibling, oldParent, text) {
|
||||
super();
|
||||
this.elem = elem;
|
||||
@@ -249,6 +260,9 @@ export class RemoveElementCommand extends Command {
|
||||
// special hack for webkit: remove this element's entry in the svgTransformLists map
|
||||
removeElementFromListMap(elem);
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.RemoveElementCommand"}
|
||||
*/
|
||||
type () { // eslint-disable-line class-methods-use-this
|
||||
return 'svgedit.history.RemoveElementCommand';
|
||||
}
|
||||
@@ -317,11 +331,13 @@ RemoveElementCommand.type = RemoveElementCommand.prototype.type;
|
||||
* History command to make a change to an element.
|
||||
* Usually an attribute change, but can also be textcontent.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The DOM element that was changed
|
||||
* @param {module:history.CommandAttributes} attrs - Attributes to be changed with the values they had *before* the change
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
export class ChangeElementCommand extends Command {
|
||||
/**
|
||||
* @param {Element} elem - The DOM element that was changed
|
||||
* @param {module:history.CommandAttributes} attrs - Attributes to be changed with the values they had *before* the change
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
constructor (elem, attrs, text) {
|
||||
super();
|
||||
this.elem = elem;
|
||||
@@ -338,6 +354,9 @@ export class ChangeElementCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.ChangeElementCommand"}
|
||||
*/
|
||||
type () { // eslint-disable-line class-methods-use-this
|
||||
return 'svgedit.history.ChangeElementCommand';
|
||||
}
|
||||
@@ -473,6 +492,9 @@ export class BatchCommand extends Command {
|
||||
this.stack = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {"svgedit.history.BatchCommand"}
|
||||
*/
|
||||
type () { // eslint-disable-line class-methods-use-this
|
||||
return 'svgedit.history.BatchCommand';
|
||||
}
|
||||
|
||||
@@ -72,11 +72,12 @@ const jPicker = function ($) {
|
||||
* Encapsulate slider functionality for the ColorMap and ColorBar -
|
||||
* could be useful to use a jQuery UI draggable for this with certain extensions.
|
||||
* @memberof module:jPicker
|
||||
* @param {external:jQuery} bar
|
||||
* @param {module:jPicker.SliderOptions} options
|
||||
* @returns {void}
|
||||
*/
|
||||
class Slider {
|
||||
/**
|
||||
* @param {external:jQuery} bar
|
||||
* @param {module:jPicker.SliderOptions} options
|
||||
*/
|
||||
constructor (bar, options) {
|
||||
const that = this;
|
||||
/**
|
||||
@@ -402,12 +403,14 @@ const jPicker = function ($) {
|
||||
|
||||
/**
|
||||
* Controls for all the input elements for the typing in color values.
|
||||
* @param {external:jQuery} picker
|
||||
* @param {external:jQuery.jPicker.Color} color
|
||||
* @param {external:jQuery.fn.$.fn.jPicker} bindedHex
|
||||
* @param {Float} alphaPrecision
|
||||
*/
|
||||
class ColorValuePicker {
|
||||
/**
|
||||
* @param {external:jQuery} picker
|
||||
* @param {external:jQuery.jPicker.Color} color
|
||||
* @param {external:jQuery.fn.$.fn.jPicker} bindedHex
|
||||
* @param {Float} alphaPrecision
|
||||
*/
|
||||
constructor (picker, color, bindedHex, alphaPrecision) {
|
||||
const that = this; // private properties and methods
|
||||
const inputs = picker.find('td.Text input');
|
||||
|
||||
@@ -261,6 +261,9 @@ export class Selector {
|
||||
* Manage all selector objects (selection boxes).
|
||||
*/
|
||||
export class SelectorManager {
|
||||
/**
|
||||
* Sets up properties and calls `initGroup`.
|
||||
*/
|
||||
constructor () {
|
||||
// this will hold the <g> element that contains all selector rects/grips
|
||||
this.selectorParentGroup = null;
|
||||
|
||||
@@ -5078,7 +5078,14 @@ editor.init = function () {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Paint box class.
|
||||
*/
|
||||
class PaintBox {
|
||||
/**
|
||||
* @param {string|Element|external:jQuery} container
|
||||
* @param {"fill"} type
|
||||
*/
|
||||
constructor (container, type) {
|
||||
const cur = curConfig[type === 'fill' ? 'initFill' : 'initStroke'];
|
||||
// set up gradients to be used for the buttons
|
||||
@@ -5101,6 +5108,12 @@ editor.init = function () {
|
||||
this.paint = new $.jGraduate.Paint({solidColor: cur.color});
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:jGraduate~Paint} paint
|
||||
* @param {boolean} apply
|
||||
* @returns {void}
|
||||
*/
|
||||
setPaint (paint, apply) {
|
||||
this.paint = paint;
|
||||
|
||||
@@ -5131,6 +5144,10 @@ editor.init = function () {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} apply
|
||||
* @returns {void}
|
||||
*/
|
||||
update (apply) {
|
||||
if (!selectedElement) { return; }
|
||||
|
||||
@@ -5189,6 +5206,9 @@ editor.init = function () {
|
||||
this.setPaint(paint);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
prep () {
|
||||
const ptype = this.paint.type;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* including the latest spec changes which were implemented in Firefox 43 and
|
||||
* Chrome 46.
|
||||
*/
|
||||
/* eslint-disable no-shadow, class-methods-use-this */
|
||||
/* eslint-disable no-shadow, class-methods-use-this, jsdoc/require-jsdoc */
|
||||
// Linting: We avoid `no-shadow` as ESLint thinks these are still available globals
|
||||
// Linting: We avoid `class-methods-use-this` as this is a polyfill that must
|
||||
// follow the conventions
|
||||
|
||||
@@ -327,7 +327,7 @@
|
||||
* Chrome 46.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-shadow, class-methods-use-this */
|
||||
/* eslint-disable no-shadow, class-methods-use-this, jsdoc/require-jsdoc */
|
||||
// Linting: We avoid `no-shadow` as ESLint thinks these are still available globals
|
||||
// Linting: We avoid `class-methods-use-this` as this is a polyfill that must
|
||||
// follow the conventions
|
||||
@@ -3865,10 +3865,6 @@
|
||||
/**
|
||||
* History command for an element that had its DOM position changed.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The DOM element that was moved
|
||||
* @param {Element} oldNextSibling - The element's next sibling before it was moved
|
||||
* @param {Element} oldParent - The element's parent before it was moved
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
|
||||
|
||||
@@ -3877,6 +3873,12 @@
|
||||
function (_Command) {
|
||||
_inherits(MoveElementCommand, _Command);
|
||||
|
||||
/**
|
||||
* @param {Element} elem - The DOM element that was moved
|
||||
* @param {Element} oldNextSibling - The element's next sibling before it was moved
|
||||
* @param {Element} oldParent - The element's parent before it was moved
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
function MoveElementCommand(elem, oldNextSibling, oldParent, text) {
|
||||
var _this;
|
||||
|
||||
@@ -3891,6 +3893,10 @@
|
||||
_this.newParent = elem.parentNode;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.MoveElementCommand"}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(MoveElementCommand, [{
|
||||
key: "type",
|
||||
@@ -3956,9 +3962,6 @@
|
||||
/**
|
||||
* History command for an element that was added to the DOM.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
*
|
||||
* @param {Element} elem - The newly added DOM element
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
|
||||
var InsertElementCommand =
|
||||
@@ -3966,6 +3969,10 @@
|
||||
function (_Command2) {
|
||||
_inherits(InsertElementCommand, _Command2);
|
||||
|
||||
/**
|
||||
* @param {Element} elem - The newly added DOM element
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
function InsertElementCommand(elem, text) {
|
||||
var _this2;
|
||||
|
||||
@@ -3978,6 +3985,10 @@
|
||||
_this2.nextSibling = _this2.elem.nextSibling;
|
||||
return _this2;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.InsertElementCommand"}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(InsertElementCommand, [{
|
||||
key: "type",
|
||||
@@ -4043,10 +4054,6 @@
|
||||
/**
|
||||
* History command for an element removed from the DOM.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The removed DOM element
|
||||
* @param {Node} oldNextSibling - The DOM element's nextSibling when it was in the DOM
|
||||
* @param {Element} oldParent - The DOM element's parent
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
|
||||
var RemoveElementCommand =
|
||||
@@ -4054,6 +4061,12 @@
|
||||
function (_Command3) {
|
||||
_inherits(RemoveElementCommand, _Command3);
|
||||
|
||||
/**
|
||||
* @param {Element} elem - The removed DOM element
|
||||
* @param {Node} oldNextSibling - The DOM element's nextSibling when it was in the DOM
|
||||
* @param {Element} oldParent - The DOM element's parent
|
||||
* @param {string} [text] - An optional string visible to user related to this change
|
||||
*/
|
||||
function RemoveElementCommand(elem, oldNextSibling, oldParent, text) {
|
||||
var _this3;
|
||||
|
||||
@@ -4068,6 +4081,10 @@
|
||||
removeElementFromListMap(elem);
|
||||
return _this3;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.RemoveElementCommand"}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(RemoveElementCommand, [{
|
||||
key: "type",
|
||||
@@ -4151,9 +4168,6 @@
|
||||
* History command to make a change to an element.
|
||||
* Usually an attribute change, but can also be textcontent.
|
||||
* @implements {module:history.HistoryCommand}
|
||||
* @param {Element} elem - The DOM element that was changed
|
||||
* @param {module:history.CommandAttributes} attrs - Attributes to be changed with the values they had *before* the change
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
|
||||
var ChangeElementCommand =
|
||||
@@ -4161,6 +4175,11 @@
|
||||
function (_Command4) {
|
||||
_inherits(ChangeElementCommand, _Command4);
|
||||
|
||||
/**
|
||||
* @param {Element} elem - The DOM element that was changed
|
||||
* @param {module:history.CommandAttributes} attrs - Attributes to be changed with the values they had *before* the change
|
||||
* @param {string} text - An optional string visible to user related to this change
|
||||
*/
|
||||
function ChangeElementCommand(elem, attrs, text) {
|
||||
var _this4;
|
||||
|
||||
@@ -4184,6 +4203,10 @@
|
||||
|
||||
return _this4;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.ChangeElementCommand"}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(ChangeElementCommand, [{
|
||||
key: "type",
|
||||
@@ -4360,6 +4383,10 @@
|
||||
_this7.stack = [];
|
||||
return _this7;
|
||||
}
|
||||
/**
|
||||
* @returns {"svgedit.history.BatchCommand"}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(BatchCommand, [{
|
||||
key: "type",
|
||||
@@ -13363,6 +13390,9 @@
|
||||
var SelectorManager =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
/**
|
||||
* Sets up properties and calls `initGroup`.
|
||||
*/
|
||||
function SelectorManager() {
|
||||
_classCallCheck(this, SelectorManager);
|
||||
|
||||
@@ -24765,13 +24795,15 @@
|
||||
* Encapsulate slider functionality for the ColorMap and ColorBar -
|
||||
* could be useful to use a jQuery UI draggable for this with certain extensions.
|
||||
* @memberof module:jPicker
|
||||
* @param {external:jQuery} bar
|
||||
* @param {module:jPicker.SliderOptions} options
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
var Slider = function Slider(bar, options) {
|
||||
var Slider =
|
||||
/**
|
||||
* @param {external:jQuery} bar
|
||||
* @param {module:jPicker.SliderOptions} options
|
||||
*/
|
||||
function Slider(bar, options) {
|
||||
_classCallCheck(this, Slider);
|
||||
|
||||
var that = this;
|
||||
@@ -25177,14 +25209,17 @@
|
||||
};
|
||||
/**
|
||||
* Controls for all the input elements for the typing in color values.
|
||||
*/
|
||||
|
||||
|
||||
var ColorValuePicker =
|
||||
/**
|
||||
* @param {external:jQuery} picker
|
||||
* @param {external:jQuery.jPicker.Color} color
|
||||
* @param {external:jQuery.fn.$.fn.jPicker} bindedHex
|
||||
* @param {Float} alphaPrecision
|
||||
*/
|
||||
|
||||
|
||||
var ColorValuePicker = function ColorValuePicker(picker, color, bindedHex, alphaPrecision) {
|
||||
function ColorValuePicker(picker, color, bindedHex, alphaPrecision) {
|
||||
_classCallCheck(this, ColorValuePicker);
|
||||
|
||||
var that = this; // private properties and methods
|
||||
@@ -34420,10 +34455,18 @@
|
||||
$$b('#color_picker').hide();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Paint box class.
|
||||
*/
|
||||
|
||||
|
||||
var PaintBox =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
/**
|
||||
* @param {string|Element|external:jQuery} container
|
||||
* @param {"fill"} type
|
||||
*/
|
||||
function PaintBox(container, type) {
|
||||
_classCallCheck(this, PaintBox);
|
||||
|
||||
@@ -34441,6 +34484,12 @@
|
||||
});
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @param {module:jGraduate~Paint} paint
|
||||
* @param {boolean} apply
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(PaintBox, [{
|
||||
key: "setPaint",
|
||||
@@ -34474,6 +34523,11 @@
|
||||
svgCanvas.setPaintOpacity(this.type, this._paintOpacity, true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {boolean} apply
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "update",
|
||||
value: function update(apply) {
|
||||
@@ -34543,6 +34597,10 @@
|
||||
|
||||
this.setPaint(paint);
|
||||
}
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "prep",
|
||||
value: function prep() {
|
||||
|
||||
Reference in New Issue
Block a user