diff options
Diffstat (limited to 'dist')
-rw-r--r-- | dist/svg.js | 12045 | ||||
-rw-r--r-- | dist/svg.min.js | 1 | ||||
-rw-r--r-- | dist/svg.new.js | 6240 | ||||
-rw-r--r-- | dist/svg.new.js.map | 1 |
4 files changed, 6230 insertions, 12057 deletions
diff --git a/dist/svg.js b/dist/svg.js index 028e4f0..a15bea1 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,314 +1,511 @@ var SVG = (function () { 'use strict'; - class Base$1 {
- constructor (node, {extensions = []}) {
- this.tags = [];
-
- for (let extension of extensions) {
- extension.setup.call(this, node);
- this.tags.push(extension.name);
- }
- }
-
- is (ability) {
- return this.tags.includes(ability)
- }
+ function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; + } + + 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; + } } - // Default namespaces
- let ns$1 = 'http://www.w3.org/2000/svg';
- let xmlns = 'http://www.w3.org/2000/xmlns/';
- let xlink = 'http://www.w3.org/1999/xlink';
- let svgjs = 'http://svgjs.com/svgjs'; - - // Parse unit value
- let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i;
-
- // Parse hex value
- let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
-
- // Parse rgb value
- let rgb = /rgb\((\d+),(\d+),(\d+)\)/;
-
- // splits a transformation chain
- let transforms = /\)\s*,?\s*/;
-
- // Whitespace
- let whitespace = /\s/g;
-
- // Test hex value
- let isHex = /^#[a-f0-9]{3,6}$/i;
-
- // Test rgb value
- let isRgb = /^rgb\(/;
-
- // Test for blank string
- let isBlank = /^(\s+)?$/;
-
- // Test for numeric string
- let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
-
- // Test for image url
- let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i;
-
- // split at whitespace and comma
- let delimiter = /[\s,]+/;
-
- // The following regex are used to parse the d attribute of a path
-
- // Matches all hyphens which are not after an exponent
- let hyphen = /([^e])-/gi;
-
- // Replaces and tests for all path letters
- let pathLetters = /[MLHVCSQTAZ]/gi;
-
- // yes we need this one, too
- let isPathLetter = /[MLHVCSQTAZ]/i;
-
- // matches 0.154.23.45
- let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi;
-
- // matches .
- let dots = /\./g; - - function isNulledBox (box) {
- return !box.w && !box.h && !box.x && !box.y
- }
-
- function domContains (node) {
- return (document.documentElement.contains || function (node) {
- // This is IE - it does not support contains() for top-level SVGs
- while (node.parentNode) {
- node = node.parentNode;
- }
- return node === document
- }).call(document.documentElement, node)
- }
-
- function pathRegReplace (a, b, c, d) {
- return c + d.replace(dots, ' .')
- }
-
- // Convert dash-separated-string to camelCase
- function camelCase (s) {
- return s.toLowerCase().replace(/-(.)/g, function (m, g) {
- return g.toUpperCase()
- })
- }
-
- // Capitalize first letter of a string
- function capitalize (s) {
- return s.charAt(0).toUpperCase() + s.slice(1)
- }
-
- // Ensure to six-based hex
- function fullHex (hex$$1) {
- return hex$$1.length === 4
- ? [ '#',
- hex$$1.substring(1, 2), hex$$1.substring(1, 2),
- hex$$1.substring(2, 3), hex$$1.substring(2, 3),
- hex$$1.substring(3, 4), hex$$1.substring(3, 4)
- ].join('')
- : hex$$1
- }
-
- // Component to hex value
- function compToHex (comp) {
- var hex$$1 = comp.toString(16);
- return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1
- }
-
- // Calculate proportional width and height values when necessary
- function proportionalSize$1 (element, width, height) {
- if (width == null || height == null) {
- var box = element.bbox();
-
- if (width == null) {
- width = box.width / box.height * height;
- } else if (height == null) {
- height = box.height / box.width * width;
- }
- }
-
- return {
- width: width,
- height: height
- }
- }
-
- // Map matrix array to object
- function arrayToMatrix (a) {
- return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }
- }
-
- // PathArray Helpers
- function arrayToString (a) {
- for (var i = 0, il = a.length, s = ''; i < il; i++) {
- s += a[i][0];
-
- if (a[i][1] != null) {
- s += a[i][1];
-
- if (a[i][2] != null) {
- s += ' ';
- s += a[i][2];
-
- if (a[i][3] != null) {
- s += ' ';
- s += a[i][3];
- s += ' ';
- s += a[i][4];
-
- if (a[i][5] != null) {
- s += ' ';
- s += a[i][5];
- s += ' ';
- s += a[i][6];
-
- if (a[i][7] != null) {
- s += ' ';
- s += a[i][7];
- }
- }
- }
- }
- }
- }
-
- return s + ' '
- }
-
- // Add more bounding box properties
- function fullBox (b) {
- if (b.x == null) {
- b.x = 0;
- b.y = 0;
- b.width = 0;
- b.height = 0;
- }
-
- b.w = b.width;
- b.h = b.height;
- b.x2 = b.x + b.width;
- b.y2 = b.y + b.height;
- b.cx = b.x + b.width / 2;
- b.cy = b.y + b.height / 2;
-
- return b
- }
-
- // Create matrix array for looping
- let abcdef = 'abcdef'.split('');
-
- function closeEnough (a, b, threshold) {
- return Math.abs(b - a) < (threshold || 1e-6)
- }
-
- function isMatrixLike (o) {
- return (
- o.a != null ||
- o.b != null ||
- o.c != null ||
- o.d != null ||
- o.e != null ||
- o.f != null
- )
- }
-
- function getOrigin (o, element) {
- // Allow origin or around as the names
- let origin = o.origin; // o.around == null ? o.origin : o.around
- let ox, oy;
-
- // Allow the user to pass a string to rotate around a given point
- if (typeof origin === 'string' || origin == null) {
- // Get the bounding box of the element with no transformations applied
- const string = (origin || 'center').toLowerCase().trim();
- const { height, width, x, y } = element.bbox();
-
- // Calculate the transformed x and y coordinates
- let bx = string.includes('left') ? x
- : string.includes('right') ? x + width
- : x + width / 2;
- let by = string.includes('top') ? y
- : string.includes('bottom') ? y + height
- : y + height / 2;
-
- // Set the bounds eg : "bottom-left", "Top right", "middle" etc...
- ox = o.ox != null ? o.ox : bx;
- oy = o.oy != null ? o.oy : by;
- } else {
- ox = origin[0];
- oy = origin[1];
- }
-
- // Return the origin as it is if it wasn't a string
- return [ ox, oy ]
+ 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 nodeOrNew$1 (name, node) {
- return node || makeNode$1(name)
- }
-
- // Method for element creation
- function makeNode$1 (name) {
- // create element
- return document.createElementNS(ns$1, name)
- }
-
- // Method for extending objects
- function extend$1 (modules, methods) {
- var key, i;
-
- if (Array.isArray(methods)) {
- methods.forEach((method) => {
- extend$1(modules, method);
- });
- return
- }
-
- modules = Array.isArray(modules) ? modules : [modules];
-
- for (i = modules.length - 1; i >= 0; i--) {
- if (methods.name) {
- modules[i].extensions = (modules[i].extensions || []).concat(methods);
- }
- for (key in methods) {
- if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue
- modules[i].prototype[key] = methods[key];
- }
- }
- }
-
- // FIXME: enhanced constructors here
- function addFactory (modules, methods) {
- extend$1(modules, methods);
- }
-
- // Invent new element
- function invent (config) {
- // Create element initializer
- var initializer = typeof config.create === 'function' ? config.create
- : function (node) {
- config.inherit.call(this, node || makeNode$1(config.create));
- };
-
- // Inherit prototype
- if (config.inherit) {
- initializer.prototype = new config.inherit();
- initializer.prototype.constructor = initializer;
- }
-
- // Extend with methods
- if (config.extend) {
- extend$1(initializer, config.extend);
- }
-
- // Attach construct method to parent
- if (config.construct) { extend$1(config.parent || Container, config.construct); }
-
- return initializer
+ 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"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } + } + + function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); + } + + var Base$1 = + /*#__PURE__*/ + function () { + function Base(node, _ref) { + var _ref$extensions = _ref.extensions, + extensions = _ref$extensions === void 0 ? [] : _ref$extensions; + + _classCallCheck(this, Base); + + this.tags = []; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = extensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var extension = _step.value; + extension.setup.call(this, node); + this.tags.push(extension.name); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + } + + _createClass(Base, [{ + key: "is", + value: function is(ability) { + return this.tags.includes(ability); + } + }]); + + return Base; + }(); + + // Default namespaces + var ns$1 = 'http://www.w3.org/2000/svg'; + var xmlns = 'http://www.w3.org/2000/xmlns/'; + var xlink = 'http://www.w3.org/1999/xlink'; + var svgjs = 'http://svgjs.com/svgjs'; + + // Parse unit value + var numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; // Parse hex value + + var hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; // Parse rgb value + + var rgb = /rgb\((\d+),(\d+),(\d+)\)/; // Parse reference id + + var transforms = /\)\s*,?\s*/; // Whitespace + + var whitespace = /\s/g; // Test hex value + + var isHex = /^#[a-f0-9]{3,6}$/i; // Test rgb value + + var isRgb = /^rgb\(/; // Test css declaration + + var isBlank = /^(\s+)?$/; // Test for numeric string + + var isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; // Test for percent value + + var isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; // split at whitespace and comma + + var delimiter = /[\s,]+/; // The following regex are used to parse the d attribute of a path + // Matches all hyphens which are not after an exponent + + var hyphen = /([^e])-/gi; // Replaces and tests for all path letters + + var pathLetters = /[MLHVCSQTAZ]/gi; // yes we need this one, too + + var isPathLetter = /[MLHVCSQTAZ]/i; // matches 0.154.23.45 + + var numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; // matches . + + var dots = /\./g; + + function isNulledBox(box) { + return !box.w && !box.h && !box.x && !box.y; + } + function domContains(node) { + return (document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + + return node === document; + }).call(document.documentElement, node); + } + function pathRegReplace(a, b, c, d) { + return c + d.replace(dots, ' .'); + } // creates deep clone of array + + function camelCase(s) { + return s.toLowerCase().replace(/-(.)/g, function (m, g) { + return g.toUpperCase(); + }); + } // Capitalize first letter of a string + + function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); + } // Ensure to six-based hex + + function fullHex(hex$$1) { + return hex$$1.length === 4 ? ['#', hex$$1.substring(1, 2), hex$$1.substring(1, 2), hex$$1.substring(2, 3), hex$$1.substring(2, 3), hex$$1.substring(3, 4), hex$$1.substring(3, 4)].join('') : hex$$1; + } // Component to hex value + + function compToHex(comp) { + var hex$$1 = comp.toString(16); + return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1; + } // Calculate proportional width and height values when necessary + + function proportionalSize$1(element, width, height) { + if (width == null || height == null) { + var box = element.bbox(); + + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + + return { + width: width, + height: height + }; + } // Map matrix array to object + + function arrayToMatrix(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } // Add centre point to transform object + + function arrayToString(a) { + for (var i = 0, il = a.length, s = ''; i < il; i++) { + s += a[i][0]; + + if (a[i][1] != null) { + s += a[i][1]; + + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + + return s + ' '; + } // Add more bounding box properties + + function fullBox(b) { + if (b.x == null) { + b.x = 0; + b.y = 0; + b.width = 0; + b.height = 0; + } + + b.w = b.width; + b.h = b.height; + b.x2 = b.x + b.width; + b.y2 = b.y + b.height; + b.cx = b.x + b.width / 2; + b.cy = b.y + b.height / 2; + return b; + } // Get id from reference string + + var abcdef = 'abcdef'.split(''); + function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6); + } + function isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } + function getOrigin(o, element) { + // Allow origin or around as the names + var origin = o.origin; // o.around == null ? o.origin : o.around + + var ox, oy; // Allow the user to pass a string to rotate around a given point + + if (typeof origin === 'string' || origin == null) { + // Get the bounding box of the element with no transformations applied + var string = (origin || 'center').toLowerCase().trim(); + + var _element$bbox = element.bbox(), + height = _element$bbox.height, + width = _element$bbox.width, + x = _element$bbox.x, + y = _element$bbox.y; // Calculate the transformed x and y coordinates + + + var bx = string.includes('left') ? x : string.includes('right') ? x + width : x + width / 2; + var by = string.includes('top') ? y : string.includes('bottom') ? y + height : y + height / 2; // Set the bounds eg : "bottom-left", "Top right", "middle" etc... + + ox = o.ox != null ? o.ox : bx; + oy = o.oy != null ? o.oy : by; + } else { + ox = origin[0]; + oy = origin[1]; + } // Return the origin as it is if it wasn't a string + + + return [ox, oy]; + } + + function nodeOrNew$1(name, node) { + return node || makeNode$1(name); + } // Method for element creation + + function makeNode$1(name) { + // create element + return document.createElementNS(ns$1, name); + } // Method for extending objects + + function extend$1(modules, methods) { + var key, i; + + if (Array.isArray(methods)) { + methods.forEach(function (method) { + extend$1(modules, method); + }); + return; + } + + modules = Array.isArray(modules) ? modules : [modules]; + + for (i = modules.length - 1; i >= 0; i--) { + if (methods.name) { + modules[i].extensions = (modules[i].extensions || []).concat(methods); + } + + for (key in methods) { + if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue; + modules[i].prototype[key] = methods[key]; + } + } + } // FIXME: enhanced constructors here + + function addFactory(modules, methods) { + extend$1(modules, methods); + } // Invent new element + + function invent(config) { + // Create element initializer + var initializer = typeof config.create === 'function' ? config.create : function (node) { + config.inherit.call(this, node || makeNode$1(config.create)); + }; // Inherit prototype + + if (config.inherit) { + initializer.prototype = new config.inherit(); + initializer.prototype.constructor = initializer; + } // Extend with methods + + + if (config.extend) { + extend$1(initializer, config.extend); + } // Attach construct method to parent + + + if (config.construct) { + extend$1(config.parent || Container, config.construct); + } + + return initializer; } var tools = /*#__PURE__*/Object.freeze({ @@ -319,192 +516,188 @@ var SVG = (function () { invent: invent }); - function Bare (element, inherit = {}) {
- let custom = class Custom extends inherit {
- constructor (node) {
- super(nodeOrNew$1(element, node), Custom);
- }
-
- words (text) {
- // remove contents
- while (this.node.hasChildNodes()) {
- this.node.removeChild(this.node.lastChild);
- }
-
- // create text node
- this.node.appendChild(document.createTextNode(text));
-
- return this
- }
- };
-
- extend(custom, inherit);
- }
-
- // export let constructors = {
- // // Create an element that is not described by SVG.js
- // element: function (element, inherit) {
- // let custom = createCustom(element, inherit)
- // return this.put(new custom())
- // }
- // }
-
- // extend(Parent, {
- // // Create an element that is not described by SVG.js
- // element: function (element, inherit) {
- // let custom = createCustom(element, inherit)
- // return this.put(new custom())
- // }
+ function Bare(element) { + var inherit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var custom = + /*#__PURE__*/ + function (_inherit) { + _inherits(Custom, _inherit); + + function Custom(node) { + _classCallCheck(this, Custom); + + return _possibleConstructorReturn(this, _getPrototypeOf(Custom).call(this, nodeOrNew$1(element, node), Custom)); + } + + _createClass(Custom, [{ + key: "words", + value: function words(text) { + // remove contents + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } // create text node + + + this.node.appendChild(document.createTextNode(text)); + return this; + } + }]); + + return Custom; + }(inherit); + + extend(custom, inherit); + } // export let constructors = { + // // Create an element that is not described by SVG.js + // element: function (element, inherit) { + // let custom = createCustom(element, inherit) + // return this.put(new custom()) + // } + // } + // extend(Parent, { + // // Create an element that is not described by SVG.js + // element: function (element, inherit) { + // let custom = createCustom(element, inherit) + // return this.put(new custom()) + // } // }) - // Module for unit convertions
- class SVGNumber {
- // Initialize
- constructor (...args) {
- this.init(...args);
- }
-
- init (value, unit) {
- unit = Array.isArray(value) ? value[1] : unit;
- value = Array.isArray(value) ? value[0] : value;
-
- // initialize defaults
- this.value = 0;
- this.unit = unit || '';
-
- // parse value
- if (typeof value === 'number') {
- // ensure a valid numeric value
- this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value;
- } else if (typeof value === 'string') {
- unit = value.match(numberAndUnit);
-
- if (unit) {
- // make value numeric
- this.value = parseFloat(unit[1]);
-
- // normalize
- if (unit[5] === '%') { this.value /= 100; } else if (unit[5] === 's') {
- this.value *= 1000;
- }
-
- // store unit
- this.unit = unit[5];
- }
- } else {
- if (value instanceof SVGNumber) {
- this.value = value.valueOf();
- this.unit = value.unit;
- }
- }
- }
-
- toString () {
- return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6
- : this.unit === 's' ? this.value / 1e3
- : this.value
- ) + this.unit
- }
-
- toJSON () {
- return this.toString()
- }
-
-
- toArray () {
- return [this.value, this.unit]
- }
-
- valueOf () {
- return this.value
- }
-
- // Add number
- plus (number) {
- number = new SVGNumber(number);
- return new SVGNumber(this + number, this.unit || number.unit)
- }
-
- // Subtract number
- minus (number) {
- number = new SVGNumber(number);
- return new SVGNumber(this - number, this.unit || number.unit)
- }
-
- // Multiply number
- times (number) {
- number = new SVGNumber(number);
- return new SVGNumber(this * number, this.unit || number.unit)
- }
-
- // Divide number
- divide (number) {
- number = new SVGNumber(number);
- return new SVGNumber(this / number, this.unit || number.unit)
- }
- } + var SVGNumber = + /*#__PURE__*/ + function () { + // Initialize + function SVGNumber() { + _classCallCheck(this, SVGNumber); + + this.init.apply(this, arguments); + } + + _createClass(SVGNumber, [{ + key: "init", + value: function init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; // initialize defaults + + this.value = 0; + this.unit = unit || ''; // parse value + + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e+38 : +3.4e+38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); // normalize + + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } // store unit + + + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + } + }, { + key: "toString", + value: function toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } + }, { + key: "toJSON", + value: function toJSON() { + return this.toString(); + } + }, { + key: "toArray", + value: function toArray() { + return [this.value, this.unit]; + } + }, { + key: "valueOf", + value: function valueOf() { + return this.value; + } // Add number + + }, { + key: "plus", + value: function plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } // Subtract number + + }, { + key: "minus", + value: function minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } // Multiply number + + }, { + key: "times", + value: function times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } // Divide number + + }, { + key: "divide", + value: function divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + }]); - // FIXME: import this to runner
-
- // Radius x value
- function rx (rx) {
- return this.attr('rx', rx)
- }
-
- // Radius y value
- function ry (ry) {
- return this.attr('ry', ry)
- }
-
- // Move over x-axis
- function x (x) {
- return x == null
- ? this.cx() - this.rx()
- : this.cx(x + this.rx())
- }
-
- // Move over y-axis
- function y (y) {
- return y == null
- ? this.cy() - this.ry()
- : this.cy(y + this.ry())
- }
-
- // Move by center over x-axis
- function cx (x) {
- return x == null
- ? this.attr('cx')
- : this.attr('cx', x)
- }
-
- // Move by center over y-axis
- function cy (y) {
- return y == null
- ? this.attr('cy')
- : this.attr('cy', y)
- }
-
- // Set width of element
- function width (width) {
- return width == null
- ? this.rx() * 2
- : this.rx(new SVGNumber(width).divide(2))
- }
-
- // Set height of element
- function height (height) {
- return height == null
- ? this.ry() * 2
- : this.ry(new SVGNumber(height).divide(2))
- }
-
- // Custom size function
- function size (width, height) {
- var p = proportionalSize$1(this, width, height);
-
- return this
- .rx(new SVGNumber(p.width).divide(2))
- .ry(new SVGNumber(p.height).divide(2))
+ return SVGNumber; + }(); + + // FIXME: import this to runner + + function rx(rx) { + return this.attr('rx', rx); + } // Radius y value + + function ry(ry) { + return this.attr('ry', ry); + } // Move over x-axis + + function x(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); + } // Move over y-axis + + function y(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); + } // Move by center over x-axis + + function cx(x) { + return x == null ? this.attr('cx') : this.attr('cx', x); + } // Move by center over y-axis + + function cy(y) { + return y == null ? this.attr('cy') : this.attr('cy', y); + } // Set width of element + + function width(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); + } // Set height of element + + function height(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); + } // Custom size function + + function size(width, height) { + var p = proportionalSize$1(this, width, height); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); } var circled = /*#__PURE__*/Object.freeze({ @@ -519,237 +712,305 @@ var SVG = (function () { size: size }); - class Circle extends Base$1 {
- constructor (node) {
- super(nodeOrNew$1('circle', node), Circle);
- }
-
- radius (r) {
- return this.attr('r', r)
- }
-
- // Radius x value
- rx (rx$$1) {
- return this.attr('r', rx$$1)
- }
-
- // Alias radius x value
- ry (ry$$1) {
- return this.rx(ry$$1)
- }
- }
-
- extend$1(Circle, {x, y, cx, cy, width, height, size});
-
- Circle.constructors = {
- Element: {
- // Create circle element
- circle (size$$1) {
- return this.put(new Circle())
- .radius(new SVGNumber(size$$1).divide(2))
- .move(0, 0)
- }
- }
+ var Circle = + /*#__PURE__*/ + function (_Base) { + _inherits(Circle, _Base); + + function Circle(node) { + _classCallCheck(this, Circle); + + return _possibleConstructorReturn(this, _getPrototypeOf(Circle).call(this, nodeOrNew$1('circle', node), Circle)); + } + + _createClass(Circle, [{ + key: "radius", + value: function radius(r) { + return this.attr('r', r); + } // Radius x value + + }, { + key: "rx", + value: function rx$$1(_rx) { + return this.attr('r', _rx); + } // Alias radius x value + + }, { + key: "ry", + value: function ry$$1(_ry) { + return this.rx(_ry); + } + }]); + + return Circle; + }(Base$1); + extend$1(Circle, { + x: x, + y: y, + cx: cx, + cy: cy, + width: width, + height: height, + size: size + }); + Circle.constructors = { + Element: { + // Create circle element + circle: function circle(size$$1) { + return this.put(new Circle()).radius(new SVGNumber(size$$1).divide(2)).move(0, 0); + } + } }; - //import find from './selector.js'
- //import {remove} from './Element.js'
-
- class ClipPath extends Base$1 {
- constructor (node) {
- super(nodeOrNew$1('clipPath', node), ClipPath);
- }
-
- // // Unclip all clipped elements and remove itself
- // remove () {
- // // unclip all targets
- // this.targets().forEach(function (el) {
- // el.unclip()
- // })
- //
- // // remove clipPath from parent
- // return remove.call(this)
- // }
- //
- // targets () {
- // return find('svg [clip-path*="' + this.id() + '"]')
- // }
- }
-
-
- ClipPath.constructors = {
- Container: {
- // Create clipping element
- clip: function() {
- return this.defs().put(new ClipPath)
- }
- },
- Element: {
- // Distribute clipPath to svg element
- clipWith (element) {
- // use given clip or create a new one
- let clipper = element instanceof ClipPath
- ? element
- : this.parent().clip().add(element);
-
- // apply mask
- return this.attr('clip-path', 'url("#' + clipper.id() + '")')
- },
-
- // Unclip element
- unclip () {
- return this.attr('clip-path', null)
- },
-
- clipper () {
- return this.reference('clip-path')
- }
- }
+ //import {remove} from './Element.js' + + var ClipPath = + /*#__PURE__*/ + function (_Base) { + _inherits(ClipPath, _Base); + + function ClipPath(node) { + _classCallCheck(this, ClipPath); + + return _possibleConstructorReturn(this, _getPrototypeOf(ClipPath).call(this, nodeOrNew$1('clipPath', node), ClipPath)); + } // // Unclip all clipped elements and remove itself + // remove () { + // // unclip all targets + // this.targets().forEach(function (el) { + // el.unclip() + // }) + // + // // remove clipPath from parent + // return remove.call(this) + // } + // + // targets () { + // return find('svg [clip-path*="' + this.id() + '"]') + // } + + + return ClipPath; + }(Base$1); + ClipPath.constructors = { + Container: { + // Create clipping element + clip: function clip() { + return this.defs().put(new ClipPath()); + } + }, + Element: { + // Distribute clipPath to svg element + clipWith: function clipWith(element) { + // use given clip or create a new one + var clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); // apply mask + + return this.attr('clip-path', 'url("#' + clipper.id() + '")'); + }, + // Unclip element + unclip: function unclip() { + return this.attr('clip-path', null); + }, + clipper: function clipper() { + return this.reference('clip-path'); + } + } }; - class Defs extends Base$1 {
- constructor (node) {
- super(nodeOrNew$1('defs', node), Defs);
- }
-
- flatten () { return this }
- ungroup () { return this }
- } + var Defs = + /*#__PURE__*/ + function (_Base) { + _inherits(Defs, _Base); + + function Defs(node) { + _classCallCheck(this, Defs); + + return _possibleConstructorReturn(this, _getPrototypeOf(Defs).call(this, nodeOrNew$1('defs', node), Defs)); + } + + _createClass(Defs, [{ + key: "flatten", + value: function flatten() { + return this; + } + }, { + key: "ungroup", + value: function ungroup() { + return this; + } + }]); + + return Defs; + }(Base$1); + + var Doc$1 = + /*#__PURE__*/ + function (_Base) { + _inherits(Doc, _Base); - //import {adopt} from './adopter.js'
-
- class Doc$1 extends Base$1 {
- constructor(node) {
- super(nodeOrNew$1('svg', node), Doc$1);
- this.namespace();
- }
-
- isRoot() {
- return !this.node.parentNode
- || !(this.node.parentNode instanceof window.SVGElement)
- || this.node.parentNode.nodeName === '#document'
- }
-
- // Check if this is a root svg
- // If not, call docs from this element
- doc() {
- if (this.isRoot()) return this
- return Element.doc.call(this)
- }
-
- // Add namespaces
- namespace() {
- if (!this.isRoot()) return this.doc().namespace()
- return this
- .attr({ xmlns: ns$1, version: '1.1' })
- .attr('xmlns:xlink', xlink, xmlns)
- .attr('xmlns:svgjs', svgjs, xmlns)
- }
-
- // Creates and returns defs element
- defs() {
- if (!this.isRoot()) return this.doc().defs()
-
- let node = this.node.getElementsByTagName('defs')[0];
- return node ? (node.instance || new Defs(node)) : this.put(new Defs())
- //
- // return adopt(this.node.getElementsByTagName('defs')[0]) ||
- // this.put(new Defs())
- }
-
- // custom parent method
- parent(type) {
- if (this.isRoot()) {
- return this.node.parentNode.nodeName === '#document'
- ? null
- : this.node.parentNode
- }
-
- return Element.parent.call(this, type)
- }
-
- // Removes the doc from the DOM
- remove() {
- if (!this.isRoot()) {
- return Element.remove.call(this)
- }
-
- if (this.parent()) {
- this.parent().removeChild(this.node);
- }
-
- return this
- }
-
- clear() {
- // remove children
- while (this.node.hasChildNodes()) {
- this.node.removeChild(this.node.lastChild);
- }
- return this
- }
- }
-
- Doc$1.constructors = {
- Container: {
- // Create nested svg document
- nested() {
- return this.put(new Doc$1())
- }
- }
+ function Doc(node) { + var _this; + + _classCallCheck(this, Doc); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(Doc).call(this, nodeOrNew$1('svg', node), Doc)); + + _this.namespace(); + + return _this; + } + + _createClass(Doc, [{ + key: "isRoot", + value: function isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof window.SVGElement) || this.node.parentNode.nodeName === '#document'; + } // Check if this is a root svg + // If not, call docs from this element + + }, { + key: "doc", + value: function doc() { + if (this.isRoot()) return this; + return Element.doc.call(this); + } // Add namespaces + + }, { + key: "namespace", + value: function namespace() { + if (!this.isRoot()) return this.doc().namespace(); + return this.attr({ + xmlns: ns$1, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns).attr('xmlns:svgjs', svgjs, xmlns); + } // Creates and returns defs element + + }, { + key: "defs", + value: function defs() { + if (!this.isRoot()) return this.doc().defs(); + var node = this.node.getElementsByTagName('defs')[0]; + return node ? node.instance || new Defs(node) : this.put(new Defs()); // + // return adopt(this.node.getElementsByTagName('defs')[0]) || + // this.put(new Defs()) + } // custom parent method + + }, { + key: "parent", + value: function parent(type) { + if (this.isRoot()) { + return this.node.parentNode.nodeName === '#document' ? null : this.node.parentNode; + } + + return Element.parent.call(this, type); + } // Removes the doc from the DOM + + }, { + key: "remove", + value: function remove() { + if (!this.isRoot()) { + return Element.remove.call(this); + } + + if (this.parent()) { + this.parent().removeChild(this.node); + } + + return this; + } + }, { + key: "clear", + value: function clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + + return this; + } + }]); + + return Doc; + }(Base$1); + Doc$1.constructors = { + Container: { + // Create nested svg document + nested: function nested() { + return this.put(new Doc$1()); + } + } }; - class Ellipse extends Base$1 {
- constructor (node) {
- super(nodeOrNew('ellipse', node), Ellipse);
- }
- }
-
- extend$1(Ellipse, circled);
-
- // addFactory(Container, {
- // // Create an ellipse
- // ellipse: function (width, height) {
- // return this.put(new Ellipse()).size(width, height).move(0, 0)
- // }
+ var Ellipse = + /*#__PURE__*/ + function (_Base) { + _inherits(Ellipse, _Base); + + function Ellipse(node) { + _classCallCheck(this, Ellipse); + + return _possibleConstructorReturn(this, _getPrototypeOf(Ellipse).call(this, nodeOrNew('ellipse', node), Ellipse)); + } + + return Ellipse; + }(Base$1); + extend$1(Ellipse, circled); // addFactory(Container, { + // // Create an ellipse + // ellipse: function (width, height) { + // return this.put(new Ellipse()).size(width, height).move(0, 0) + // } // }) - class Stop extends Base$1 {
- constructor (node) {
- super(nodeOrNew$1('stop', node), Stop);
- }
-
- // add color stops
- update (o) {
- if (typeof o === 'number' || o instanceof SVGNumber) {
- o = {
- offset: arguments[0],
- color: arguments[1],
- opacity: arguments[2]
- };
- }
-
- // set attributes
- if (o.opacity != null) this.attr('stop-opacity', o.opacity);
- if (o.color != null) this.attr('stop-color', o.color);
- if (o.offset != null) this.attr('offset', new SVGNumber(o.offset));
-
- return this
- }
- } + var Stop = + /*#__PURE__*/ + function (_Base) { + _inherits(Stop, _Base); + + function Stop(node) { + _classCallCheck(this, Stop); + + return _possibleConstructorReturn(this, _getPrototypeOf(Stop).call(this, nodeOrNew$1('stop', node), Stop)); + } // add color stops + + + _createClass(Stop, [{ + key: "update", + value: function update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } // set attributes + + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } + }]); - // FIXME: add to runner
-
- function from (x, y) {
- return (this._element || this).type === 'radialGradient'
- ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })
- : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })
- }
-
- function to (x, y) {
- return (this._element || this).type === 'radialGradient'
- ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })
- : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })
+ return Stop; + }(Base$1); + + // FIXME: add to runner + function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) + }); + } + function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); } var gradiented = /*#__PURE__*/Object.freeze({ @@ -757,1231 +1018,1387 @@ var SVG = (function () { to: to }); - //import attr from './attr.js'
-
- class Gradient extends Base$1 {
- constructor (type) {
- super(
- nodeOrNew$1(type + 'Gradient', typeof type === 'string' ? null : type),
- Gradient
- );
- }
-
- // Add a color stop
- stop (offset, color, opacity) {
- return this.put(new Stop()).update(offset, color, opacity)
- }
-
- // Update gradient
- update (block) {
- // remove all stops
- this.clear();
-
- // invoke passed block
- if (typeof block === 'function') {
- block.call(this, this);
- }
-
- return this
- }
-
- // Return the fill id
- url () {
- return 'url(#' + this.id() + ')'
- }
-
- // Alias string convertion to fill
- toString () {
- return this.url()
- }
-
- // // custom attr to handle transform
- // attr (a, b, c) {
- // if (a === 'transform') a = 'gradientTransform'
- // return attr.call(this, a, b, c)
- // }
- }
-
- extend$1(Gradient, gradiented);
-
- Gradient.constructors = {
- Container: {
- // Create gradient element in defs
- gradient (type, block) {
- return this.defs().gradient(type, block)
- }
- },
- // define gradient
- Defs: {
- gradient (type, block) {
- return this.put(new Gradient(type)).update(block)
- }
- }
- }; + var Gradient = + /*#__PURE__*/ + function (_Base) { + _inherits(Gradient, _Base); + + function Gradient(type) { + _classCallCheck(this, Gradient); + + return _possibleConstructorReturn(this, _getPrototypeOf(Gradient).call(this, nodeOrNew$1(type + 'Gradient', typeof type === 'string' ? null : type), Gradient)); + } // Add a color stop + + + _createClass(Gradient, [{ + key: "stop", + value: function stop(offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } // Update gradient + + }, { + key: "update", + value: function update(block) { + // remove all stops + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Return the fill id - class G extends Base$1 {
- constructor (node) {
- super(nodeorNew('g', node), G);
- }
- }
-
- G.constructors = {
- Element: {
- // Create a group element
- group: function () {
- return this.put(new G())
- }
- }
+ }, { + key: "url", + value: function url() { + return 'url(#' + this.id() + ')'; + } // Alias string convertion to fill + + }, { + key: "toString", + value: function toString() { + return this.url(); + } // // custom attr to handle transform + // attr (a, b, c) { + // if (a === 'transform') a = 'gradientTransform' + // return attr.call(this, a, b, c) + // } + + }]); + + return Gradient; + }(Base$1); + extend$1(Gradient, gradiented); + Gradient.constructors = { + Container: { + // Create gradient element in defs + gradient: function gradient(type, block) { + return this.defs().gradient(type, block); + } + }, + // define gradient + Defs: { + gradient: function gradient(type, block) { + return this.put(new Gradient(type)).update(block); + } + } }; - //import {makeInstance} from './adopter.js'
-
- class HtmlNode extends Base$1 {
- constructor (element) {
- super(element, HtmlNode);
- this.node = element;
- }
-
- // add (element, i) {
- // element = makeInstance(element)
- //
- // if (element.node !== this.node.children[i]) {
- // this.node.insertBefore(element.node, this.node.children[i] || null)
- // }
- //
- // return this
- // }
-
- put (element, i) {
- this.add(element, i);
- return element
- }
-
- getEventTarget () {
- return this.node
- }
- } + var G = + /*#__PURE__*/ + function (_Base) { + _inherits(G, _Base); + + function G(node) { + _classCallCheck(this, G); - class A extends Base$1{
- constructor (node) {
- super(nodeOrNew$1('a', node), A);
- }
-
- // Link url
- to (url) {
- return this.attr('href', url, xlink)
- }
-
- // Link target attribute
- target (target) {
- return this.attr('target', target)
- }
- }
-
- A.constructors = {
- Container: {
- // Create a hyperlink element
- link: function (url) {
- return this.put(new A()).to(url)
- }
- },
- Element: {
- // Create a hyperlink element
- linkTo: function (url) {
- var link = new A();
-
- if (typeof url === 'function') { url.call(link, link); } else {
- link.to(url);
- }
-
- return this.parent().put(link).put(this)
- }
- }
+ return _possibleConstructorReturn(this, _getPrototypeOf(G).call(this, nodeorNew('g', node), G)); + } + + return G; + }(Base$1); + G.constructors = { + Element: { + // Create a group element + group: function group() { + return this.put(new G()); + } + } }; - //import attr from './attr.js'
-
- class Pattern extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('pattern', node));
- }
-
- // Return the fill id
- url () {
- return 'url(#' + this.id() + ')'
- }
-
- // Update pattern by rebuilding
- update (block) {
- // remove content
- this.clear();
-
- // invoke passed block
- if (typeof block === 'function') {
- block.call(this, this);
- }
-
- return this
- }
-
- // Alias string convertion to fill
- toString () {
- return this.url()
- }
-
- // // custom attr to handle transform
- // attr (a, b, c) {
- // if (a === 'transform') a = 'patternTransform'
- // return attr.call(this, a, b, c)
- // }
- }
-
- Pattern.constructors = {
- Container: {
- // Create pattern element in defs
- pattern (width, height, block) {
- return this.defs().pattern(width, height, block)
- }
- },
- Defs: {
- pattern (width, height, block) {
- return this.put(new Pattern()).update(block).attr({
- x: 0,
- y: 0,
- width: width,
- height: height,
- patternUnits: 'userSpaceOnUse'
- })
- }
- }
+ var HtmlNode = + /*#__PURE__*/ + function (_Base) { + _inherits(HtmlNode, _Base); + + function HtmlNode(element) { + var _this; + + _classCallCheck(this, HtmlNode); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(HtmlNode).call(this, element, HtmlNode)); + _this.node = element; + return _this; + } // add (element, i) { + // element = makeInstance(element) + // + // if (element.node !== this.node.children[i]) { + // this.node.insertBefore(element.node, this.node.children[i] || null) + // } + // + // return this + // } + + + _createClass(HtmlNode, [{ + key: "put", + value: function put(element, i) { + this.add(element, i); + return element; + } + }, { + key: "getEventTarget", + value: function getEventTarget() { + return this.node; + } + }]); + + return HtmlNode; + }(Base$1); + + var A = + /*#__PURE__*/ + function (_Base) { + _inherits(A, _Base); + + function A(node) { + _classCallCheck(this, A); + + return _possibleConstructorReturn(this, _getPrototypeOf(A).call(this, nodeOrNew$1('a', node), A)); + } // Link url + + + _createClass(A, [{ + key: "to", + value: function to(url) { + return this.attr('href', url, xlink); + } // Link target attribute + + }, { + key: "target", + value: function target(_target) { + return this.attr('target', _target); + } + }]); + + return A; + }(Base$1); + A.constructors = { + Container: { + // Create a hyperlink element + link: function link(url) { + return this.put(new A()).to(url); + } + }, + Element: { + // Create a hyperlink element + linkTo: function linkTo(url) { + var link = new A(); + + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + + return this.parent().put(link).put(this); + } + } }; - // // Add events to elements
- // ;[ 'click',
- // 'dblclick',
- // 'mousedown',
- // 'mouseup',
- // 'mouseover',
- // 'mouseout',
- // 'mousemove',
- // 'mouseenter',
- // 'mouseleave',
- // 'touchstart',
- // 'touchmove',
- // 'touchleave',
- // 'touchend',
- // 'touchcancel' ].forEach(function (event) {
- // // add event to Element
- // Element.prototype[event] = function (f) {
- // if (f === null) {
- // off(this, event)
- // } else {
- // on(this, event, f)
- // }
- // return this
- // }
- // })
-
- let listenerId = 0;
-
- function getEventTarget (node) {
- return node instanceof Base && node.is('EventTarget')
- ? node.getEventTarget()
- : node
- }
-
- // Add event binder in the SVG namespace
- function on (node, events, listener, binding, options) {
- var l = listener.bind(binding || node);
- var n = getEventTarget(node);
-
- // events can be an array of events or a string of events
- events = Array.isArray(events) ? events : events.split(delimiter);
-
- // ensure instance object for nodes which are not adopted
- n.instance = n.instance || {events: {}};
-
- // pull event handlers from the element
- var bag = n.instance.events;
-
- // add id to listener
- if (!listener._svgjsListenerId) {
- listener._svgjsListenerId = ++listenerId;
- }
-
- events.forEach(function (event) {
- var ev = event.split('.')[0];
- var ns = event.split('.')[1] || '*';
-
- // ensure valid object
- bag[ev] = bag[ev] || {};
- bag[ev][ns] = bag[ev][ns] || {};
-
- // reference listener
- bag[ev][ns][listener._svgjsListenerId] = l;
-
- // add listener
- n.addEventListener(ev, l, options || false);
- });
- }
-
- // Add event unbinder in the SVG namespace
- function off (node, events, listener, options) {
- var n = getEventTarget(node);
-
- // we cannot remove an event if its not an svg.js instance
- if (!n.instance) return
-
- // listener can be a function or a number
- if (typeof listener === 'function') {
- listener = listener._svgjsListenerId;
- if (!listener) return
- }
-
- // pull event handlers from the element
- var bag = n.instance.events;
-
- // events can be an array of events or a string or undefined
- events = Array.isArray(events) ? events : (events || '').split(delimiter);
-
- events.forEach(function (event) {
- var ev = event && event.split('.')[0];
- var ns = event && event.split('.')[1];
- var namespace, l;
-
- if (listener) {
- // remove listener reference
- if (bag[ev] && bag[ev][ns || '*']) {
- // removeListener
- n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false);
-
- delete bag[ev][ns || '*'][listener];
- }
- } else if (ev && ns) {
- // remove all listeners for a namespaced event
- if (bag[ev] && bag[ev][ns]) {
- for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l); }
-
- delete bag[ev][ns];
- }
- } else if (ns) {
- // remove all listeners for a specific namespace
- for (event in bag) {
- for (namespace in bag[event]) {
- if (ns === namespace) { off(n, [event, ns].join('.')); }
- }
- }
- } else if (ev) {
- // remove all listeners for the event
- if (bag[ev]) {
- for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')); }
-
- delete bag[ev];
- }
- } else {
- // remove all listeners on a given node
- for (event in bag) { off(n, event); }
-
- n.instance.events = {};
- }
- });
- }
-
- function dispatch (node, event, data) {
- var n = getEventTarget(node);
-
- // Dispatch event
- if (event instanceof window.Event) {
- n.dispatchEvent(event);
- } else {
- event = new window.CustomEvent(event, {detail: data, cancelable: true});
- n.dispatchEvent(event);
- }
- return event
- } + var Pattern = + /*#__PURE__*/ + function (_Base) { + _inherits(Pattern, _Base); + + // Initialize node + function Pattern(node) { + _classCallCheck(this, Pattern); + + return _possibleConstructorReturn(this, _getPrototypeOf(Pattern).call(this, nodeOrNew$1('pattern', node))); + } // Return the fill id + + + _createClass(Pattern, [{ + key: "url", + value: function url() { + return 'url(#' + this.id() + ')'; + } // Update pattern by rebuilding + + }, { + key: "update", + value: function update(block) { + // remove content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Alias string convertion to fill + + }, { + key: "toString", + value: function toString() { + return this.url(); + } // // custom attr to handle transform + // attr (a, b, c) { + // if (a === 'transform') a = 'patternTransform' + // return attr.call(this, a, b, c) + // } - class Image extends Base$1 {
- constructor (node) {
- super(nodeOrNew$1('image', node), Image);
- }
-
- // (re)load image
- load (url, callback) {
- if (!url) return this
-
- var img = new window.Image();
-
- on(img, 'load', function (e) {
- var p = this.parent(Pattern);
-
- // ensure image size
- if (this.width() === 0 && this.height() === 0) {
- this.size(img.width, img.height);
- }
-
- if (p instanceof Pattern) {
- // ensure pattern size if not set
- if (p.width() === 0 && p.height() === 0) {
- p.size(this.width(), this.height());
- }
- }
-
- if (typeof callback === 'function') {
- callback.call(this, {
- width: img.width,
- height: img.height,
- ratio: img.width / img.height,
- url: url
- });
- }
- }, this);
-
- on(img, 'load error', function () {
- // dont forget to unbind memory leaking events
- off(img);
- });
-
- return this.attr('href', (img.src = url), xlink)
- }
- }
-
- Image.constructors = {
- Container: {
- // create image element, load image and set its size
- image (source, callback) {
- return this.put(new Image()).size(0, 0).load(source, callback)
- }
- }
+ }]); + + return Pattern; + }(Base$1); + Pattern.constructors = { + Container: { + // Create pattern element in defs + pattern: function pattern(width, height, block) { + return this.defs().pattern(width, height, block); + } + }, + Defs: { + pattern: function pattern(width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + } + } }; - /* global arrayClone */
-
- let BaseArray = (function() {
- try {
- return Array
- } catch (e) {
- return Array
- }
- })();
-
- class SVGArray extends BaseArray {
- constructor (...args) {
- super();
- this.init(...args);
- }
-
- init (array, fallback) {
- //this.splice(0, this.length)
- this.length = 0;
- this.push(...this.parse(array || fallback));
- }
-
- toArray () {
- return Array.prototype.slice(this)
- }
-
- toString () {
- this.join(' ');
- }
-
- valueOf () {
- return this.toArray()
- }
-
- // Parse whitespace separated string
- parse (array) {
- array = array.valueOf();
-
- // if already is an array, no need to parse it
- if (Array.isArray(array)) return array
-
- return array.trim().split(delimiter).map(parseFloat)
- }
-
- clone () {
- return new this.constructor(this)
- }
-
- toSet () {
- return new Set(this)
- }
+ // ;[ 'click', + // 'dblclick', + // 'mousedown', + // 'mouseup', + // 'mouseover', + // 'mouseout', + // 'mousemove', + // 'mouseenter', + // 'mouseleave', + // 'touchstart', + // 'touchmove', + // 'touchleave', + // 'touchend', + // 'touchcancel' ].forEach(function (event) { + // // add event to Element + // Element.prototype[event] = function (f) { + // if (f === null) { + // off(this, event) + // } else { + // on(this, event, f) + // } + // return this + // } + // }) + + var listenerId = 0; + + function getEventTarget(node) { + return node instanceof Base && node.is('EventTarget') ? node.getEventTarget() : node; + } // Add event binder in the SVG namespace + + + function on(node, events, listener, binding, options) { + var l = listener.bind(binding || node); + var n = getEventTarget(node); // events can be an array of events or a string of events + + events = Array.isArray(events) ? events : events.split(delimiter); // ensure instance object for nodes which are not adopted + + n.instance = n.instance || { + events: {} // pull event handlers from the element + + }; + var bag = n.instance.events; // add id to listener + + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + + events.forEach(function (event) { + var ev = event.split('.')[0]; + var ns = event.split('.')[1] || '*'; // ensure valid object + + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; // reference listener + + bag[ev][ns][listener._svgjsListenerId] = l; // add listener + + n.addEventListener(ev, l, options || false); + }); + } // Add event unbinder in the SVG namespace + + function off(node, events, listener, options) { + var n = getEventTarget(node); // we cannot remove an event if its not an svg.js instance + + if (!n.instance) return; // listener can be a function or a number + + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } // pull event handlers from the element + + + var bag = n.instance.events; // events can be an array of events or a string or undefined + + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + var ev = event && event.split('.')[0]; + var ns = event && event.split('.')[1]; + var namespace, l; + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + + n.instance.events = {}; + } + }); } + function dispatch(node, event, data) { + var n = getEventTarget(node); // Dispatch event + + if (event instanceof window.Event) { + n.dispatchEvent(event); + } else { + event = new window.CustomEvent(event, { + detail: data, + cancelable: true + }); + n.dispatchEvent(event); + } - class PointArray$1 extends SVGArray {
- constructor (array, fallback = [[0, 0]]) {
- super(array, fallback);
- }
-
- // Convert array to string
- toString () {
- // convert to a poly point string
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {
- array.push(this.value[i].join(','));
- }
-
- return array.join(' ')
- }
-
- toArray () {
- return this.value.reduce(function (prev, curr) {
- return [].concat.call(prev, curr)
- }, [])
- }
-
- // Convert array to line object
- toLine () {
- return {
- x1: this.value[0][0],
- y1: this.value[0][1],
- x2: this.value[1][0],
- y2: this.value[1][1]
- }
- }
-
- // Get morphed array at given position
- at (pos) {
- // make sure a destination is defined
- if (!this.destination) return this
-
- // generate morphed point string
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {
- array.push([
- this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos,
- this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos
- ]);
- }
-
- return new PointArray$1(array)
- }
-
- // Parse point string and flat array
- parse (array) {
- var points = [];
-
- array = array.valueOf();
-
- // if it is an array
- if (Array.isArray(array)) {
- // and it is not flat, there is no need to parse it
- if (Array.isArray(array[0])) {
- return array
- }
- } else { // Else, it is considered as a string
- // parse points
- array = array.trim().split(delimiter).map(parseFloat);
- }
-
- // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints
- // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.
- if (array.length % 2 !== 0) array.pop();
-
- // wrap points in two-tuples and parse points as floats
- for (var i = 0, len = array.length; i < len; i = i + 2) {
- points.push([ array[i], array[i + 1] ]);
- }
-
- return points
- }
-
- // Move point string
- move (x, y) {
- var box = this.bbox();
-
- // get relative offset
- x -= box.x;
- y -= box.y;
-
- // move every point
- if (!isNaN(x) && !isNaN(y)) {
- for (var i = this.value.length - 1; i >= 0; i--) {
- this.value[i] = [this.value[i][0] + x, this.value[i][1] + y];
- }
- }
-
- return this
- }
-
- // Resize poly string
- size (width, height) {
- var i;
- var box = this.bbox();
-
- // recalculate position of all points according to new size
- for (i = this.value.length - 1; i >= 0; i--) {
- if (box.width) this.value[i][0] = ((this.value[i][0] - box.x) * width) / box.width + box.x;
- if (box.height) this.value[i][1] = ((this.value[i][1] - box.y) * height) / box.height + box.y;
- }
-
- return this
- }
-
- // Get bounding box of points
- bbox () {
- var maxX = -Infinity;
- var maxY = -Infinity;
- var minX = Infinity;
- var minY = Infinity;
- this.value.forEach(function (el) {
- maxX = Math.max(el[0], maxX);
- maxY = Math.max(el[1], maxY);
- minX = Math.min(el[0], minX);
- minY = Math.min(el[1], minY);
- });
- return {x: minX, y: minY, width: maxX - minX, height: maxY - minY}
- }
+ return event; } - class Line extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('line', node), Line);
- }
-
- // Get array
- array () {
- return new PointArray$1([
- [ this.attr('x1'), this.attr('y1') ],
- [ this.attr('x2'), this.attr('y2') ]
- ])
- }
-
- // Overwrite native plot() method
- plot (x1, y1, x2, y2) {
- if (x1 == null) {
- return this.array()
- } else if (typeof y1 !== 'undefined') {
- x1 = { x1: x1, y1: y1, x2: x2, y2: y2 };
- } else {
- x1 = new PointArray$1(x1).toLine();
- }
-
- return this.attr(x1)
- }
-
- // Move by left top corner
- move (x, y) {
- return this.attr(this.array().move(x, y).toLine())
- }
-
- // Set element size to given width and height
- size (width, height) {
- var p = proportionalSize$1(this, width, height);
- return this.attr(this.array().size(p.width, p.height).toLine())
- }
-
- }
-
- Line.constructors = {
- Container: {
- // Create a line element
- line (...args) {
- // make sure plot is called as a setter
- // x1 is not necessarily a number, it can also be an array, a string and a PointArray
- return Line.prototype.plot.apply(
- this.put(new Line())
- , args[0] != null ? args : [0, 0, 0, 0]
- )
- }
- }
+ var Image = + /*#__PURE__*/ + function (_Base) { + _inherits(Image, _Base); + + function Image(node) { + _classCallCheck(this, Image); + + return _possibleConstructorReturn(this, _getPrototypeOf(Image).call(this, nodeOrNew$1('image', node), Image)); + } // (re)load image + + + _createClass(Image, [{ + key: "load", + value: function load(url, callback) { + if (!url) return this; + var img = new window.Image(); + on(img, 'load', function (e) { + var p = this.parent(Pattern); // ensure image size + + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + + if (typeof callback === 'function') { + callback.call(this, { + width: img.width, + height: img.height, + ratio: img.width / img.height, + url: url + }); + } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } + }]); + + return Image; + }(Base$1); + Image.constructors = { + Container: { + // create image element, load image and set its size + image: function image(source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + } + } }; - // import Defs from './Defs.js'
- // import Line from './Line.js'
- // import Polyline from './Polyline.js'
- // import Polygon from './Polygon.js'
- // import Path from './Path.js'
-
- class Marker extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew('marker', node), Marker);
- }
-
- // Set width of element
- width (width) {
- return this.attr('markerWidth', width)
- }
-
- // Set height of element
- height (height) {
- return this.attr('markerHeight', height)
- }
-
- // Set marker refX and refY
- ref (x, y) {
- return this.attr('refX', x).attr('refY', y)
- }
-
- // Update marker
- update (block) {
- // remove all content
- this.clear();
-
- // invoke passed block
- if (typeof block === 'function') { block.call(this, this); }
-
- return this
- }
-
- // Return the fill id
- toString () {
- return 'url(#' + this.id() + ')'
- }
- }
-
- Marker.constructors = {
- Container: {
- marker (width, height, block) {
- // Create marker element in defs
- return this.defs().marker(width, height, block)
- }
- },
- Defs: {
- // Create marker
- marker (width, height, block) {
- // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto
- return this.put(new Marker())
- .size(width, height)
- .ref(width / 2, height / 2)
- .viewbox(0, 0, width, height)
- .attr('orient', 'auto')
- .update(block)
- }
- },
- marker: {
- // Create and attach markers
- marker (marker, width, height, block) {
- var attr = ['marker'];
-
- // Build attribute name
- if (marker !== 'all') attr.push(marker);
- attr = attr.join('-');
-
- // Set marker attribute
- marker = arguments[1] instanceof Marker
- ? arguments[1]
- : this.defs().marker(width, height, block);
-
- return this.attr(attr, marker)
- }
- }
+ var BaseArray = function () { + try { + var b = + /*#__PURE__*/ + function (_Array) { + _inherits(b, _Array); + + function b() { + _classCallCheck(this, b); + + return _possibleConstructorReturn(this, _getPrototypeOf(b).apply(this, arguments)); + } + + return b; + }(_wrapNativeSuper(Array)); + + return Array; + } catch (e) { + return Array; + } + }(); + + var SVGArray = + /*#__PURE__*/ + function (_BaseArray) { + _inherits(SVGArray, _BaseArray); + + function SVGArray() { + var _this2; + + var _this; + + _classCallCheck(this, SVGArray); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(SVGArray).call(this)); + + (_this2 = _this).init.apply(_this2, arguments); + + return _this; + } + + _createClass(SVGArray, [{ + key: "init", + value: function init(array, fallback) { + //this.splice(0, this.length) + this.length = 0; + this.push.apply(this, _toConsumableArray(this.parse(array || fallback))); + } + }, { + key: "toArray", + value: function toArray() { + return Array.prototype.slice(this); + } + }, { + key: "toString", + value: function toString() { + this.join(' '); + } + }, { + key: "valueOf", + value: function valueOf() { + return this.toArray(); + } // Parse whitespace separated string + + }, { + key: "parse", + value: function parse(array) { + array = array.valueOf(); // if already is an array, no need to parse it + + if (Array.isArray(array)) return array; + return array.trim().split(delimiter).map(parseFloat); + } + }, { + key: "clone", + value: function clone() { + return new this.constructor(this); + } + }, { + key: "toSet", + value: function toSet() { + return new Set(this); + } + }]); + + return SVGArray; + }(BaseArray); + + var PointArray$1 = + /*#__PURE__*/ + function (_SVGArray) { + _inherits(PointArray, _SVGArray); + + function PointArray(array) { + var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [[0, 0]]; + + _classCallCheck(this, PointArray); + + return _possibleConstructorReturn(this, _getPrototypeOf(PointArray).call(this, array, fallback)); + } // Convert array to string + + + _createClass(PointArray, [{ + key: "toString", + value: function toString() { + // convert to a poly point string + for (var i = 0, il = this.value.length, array = []; i < il; i++) { + array.push(this.value[i].join(',')); + } + + return array.join(' '); + } + }, { + key: "toArray", + value: function toArray() { + return this.value.reduce(function (prev, curr) { + return [].concat.call(prev, curr); + }, []); + } // Convert array to line object + + }, { + key: "toLine", + value: function toLine() { + return { + x1: this.value[0][0], + y1: this.value[0][1], + x2: this.value[1][0], + y2: this.value[1][1] + }; + } // Get morphed array at given position + + }, { + key: "at", + value: function at(pos) { + // make sure a destination is defined + if (!this.destination) return this; // generate morphed point string + + for (var i = 0, il = this.value.length, array = []; i < il; i++) { + array.push([this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos, this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos]); + } + + return new PointArray(array); + } // Parse point string and flat array + + }, { + key: "parse", + value: function parse(array) { + var points = []; + array = array.valueOf(); // if it is an array + + if (Array.isArray(array)) { + // and it is not flat, there is no need to parse it + if (Array.isArray(array[0])) { + return array; + } + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + + + if (array.length % 2 !== 0) array.pop(); // wrap points in two-tuples and parse points as floats + + for (var i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + + return points; + } // Move point string + + }, { + key: "move", + value: function move(x, y) { + var box = this.bbox(); // get relative offset + + x -= box.x; + y -= box.y; // move every point + + if (!isNaN(x) && !isNaN(y)) { + for (var i = this.value.length - 1; i >= 0; i--) { + this.value[i] = [this.value[i][0] + x, this.value[i][1] + y]; + } + } + + return this; + } // Resize poly string + + }, { + key: "size", + value: function size(width, height) { + var i; + var box = this.bbox(); // recalculate position of all points according to new size + + for (i = this.value.length - 1; i >= 0; i--) { + if (box.width) this.value[i][0] = (this.value[i][0] - box.x) * width / box.width + box.x; + if (box.height) this.value[i][1] = (this.value[i][1] - box.y) * height / box.height + box.y; + } + + return this; + } // Get bounding box of points + + }, { + key: "bbox", + value: function bbox() { + var maxX = -Infinity; + var maxY = -Infinity; + var minX = Infinity; + var minY = Infinity; + this.value.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + }; + } + }]); + + return PointArray; + }(SVGArray); + + var Line = + /*#__PURE__*/ + function (_Base) { + _inherits(Line, _Base); + + // Initialize node + function Line(node) { + _classCallCheck(this, Line); + + return _possibleConstructorReturn(this, _getPrototypeOf(Line).call(this, nodeOrNew$1('line', node), Line)); + } // Get array + + + _createClass(Line, [{ + key: "array", + value: function array() { + return new PointArray$1([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } // Overwrite native plot() method + + }, { + key: "plot", + value: function plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }; + } else { + x1 = new PointArray$1(x1).toLine(); + } + + return this.attr(x1); + } // Move by left top corner + + }, { + key: "move", + value: function move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } // Set element size to given width and height + + }, { + key: "size", + value: function size(width, height) { + var p = proportionalSize$1(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } + }]); + + return Line; + }(Base$1); + Line.constructors = { + Container: { + // Create a line element + line: function line() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + } + } + }; + + // import Line from './Line.js' + // import Polyline from './Polyline.js' + // import Polygon from './Polygon.js' + // import Path from './Path.js' + + var Marker = + /*#__PURE__*/ + function (_Base) { + _inherits(Marker, _Base); + + // Initialize node + function Marker(node) { + _classCallCheck(this, Marker); + + return _possibleConstructorReturn(this, _getPrototypeOf(Marker).call(this, nodeOrNew('marker', node), Marker)); + } // Set width of element + + + _createClass(Marker, [{ + key: "width", + value: function width(_width) { + return this.attr('markerWidth', _width); + } // Set height of element + + }, { + key: "height", + value: function height(_height) { + return this.attr('markerHeight', _height); + } // Set marker refX and refY + + }, { + key: "ref", + value: function ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } // Update marker + + }, { + key: "update", + value: function update(block) { + // remove all content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Return the fill id + + }, { + key: "toString", + value: function toString() { + return 'url(#' + this.id() + ')'; + } + }]); + + return Marker; + }(Base$1); + Marker.constructors = { + Container: { + marker: function marker(width, height, block) { + // Create marker element in defs + return this.defs().marker(width, height, block); + } + }, + Defs: { + // Create marker + marker: function marker(width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + } + }, + marker: { + // Create and attach markers + marker: function marker(_marker, width, height, block) { + var attr = ['marker']; // Build attribute name + + if (_marker !== 'all') attr.push(_marker); + attr = attr.join('-'); // Set marker attribute + + _marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, _marker); + } + } }; - // import find from './selector.js'
- // import {remove} from './Element.js'
-
- class Mask extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('mask', node));
- }
-
- // // Unmask all masked elements and remove itself
- // remove () {
- // // unmask all targets
- // this.targets().forEach(function (el) {
- // el.unmask()
- // })
- //
- // // remove mask from parent
- // return remove.call(this)
- // }
- //
- // targets () {
- // return find('svg [mask*="' + this.id() + '"]')
- // }
-
- }
-
-
- Mask.constructors = {
- Container: {
- mask () {
- return this.defs().put(new Mask())
- }
- },
- Element: {
- // Distribute mask to svg element
- maskWith (element) {
- // use given mask or create a new one
- var masker = element instanceof Mask
- ? element
- : this.parent().mask().add(element);
-
- // apply mask
- return this.attr('mask', 'url("#' + masker.id() + '")')
- },
-
- // Unmask element
- unmask () {
- return this.attr('mask', null)
- },
-
- masker () {
- return this.reference('mask')
- }
- }
+ // import {remove} from './Element.js' + + var Mask = + /*#__PURE__*/ + function (_Base) { + _inherits(Mask, _Base); + + // Initialize node + function Mask(node) { + _classCallCheck(this, Mask); + + return _possibleConstructorReturn(this, _getPrototypeOf(Mask).call(this, nodeOrNew$1('mask', node))); + } // // Unmask all masked elements and remove itself + // remove () { + // // unmask all targets + // this.targets().forEach(function (el) { + // el.unmask() + // }) + // + // // remove mask from parent + // return remove.call(this) + // } + // + // targets () { + // return find('svg [mask*="' + this.id() + '"]') + // } + + + return Mask; + }(Base$1); + Mask.constructors = { + Container: { + mask: function mask() { + return this.defs().put(new Mask()); + } + }, + Element: { + // Distribute mask to svg element + maskWith: function maskWith(element) { + // use given mask or create a new one + var masker = element instanceof Mask ? element : this.parent().mask().add(element); // apply mask + + return this.attr('mask', 'url("#' + masker.id() + '")'); + }, + // Unmask element + unmask: function unmask() { + return this.attr('mask', null); + }, + masker: function masker() { + return this.reference('mask'); + } + } }; - function parser () {
-
- // Reuse cached element if possible
- if (!parser.nodes) {
- let svg = new Doc$1().size(2, 0).css({
- opacity: 0,
- position: 'absolute',
- left: '-100%',
- top: '-100%',
- overflow: 'hidden'
- });
-
- let path = svg.path().node;
-
- parser.nodes = {svg, path};
- }
-
- if (!parser.nodes.svg.node.parentNode) {
- let b = document.body || document.documentElement;
- parser.nodes.svg.addTo(b);
- }
-
- return parser.nodes
+ function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + var svg = new Doc$1().size(2, 0).css({ + opacity: 0, + position: 'absolute', + left: '-100%', + top: '-100%', + overflow: 'hidden' + }); + var path = svg.path().node; + parser.nodes = { + svg: svg, + path: path + }; + } + + if (!parser.nodes.svg.node.parentNode) { + var b = document.body || document.documentElement; + parser.nodes.svg.addTo(b); + } + + return parser.nodes; } - class Point {
- // Initialize
- constructor (x, y, base) {
- let source;
- base = base || {x: 0, y: 0};
-
- // ensure source as object
- source = Array.isArray(x) ? {x: x[0], y: x[1]}
- : typeof x === 'object' ? {x: x.x, y: x.y}
- : {x: x, y: y};
-
- // merge source
- this.x = source.x == null ? base.x : source.x;
- this.y = source.y == null ? base.y : source.y;
- }
-
- // Clone point
- clone () {
- return new Point(this)
- }
-
- // Convert to native SVGPoint
- native () {
- // create new point
- var point = parser().svg.createSVGPoint();
-
- // update with current values
- point.x = this.x;
- point.y = this.y;
- return point
- }
-
- // transform point with matrix
- transform (m) {
- // Perform the matrix multiplication
- var x = m.a * this.x + m.c * this.y + m.e;
- var y = m.b * this.x + m.d * this.y + m.f;
-
- // Return the required point
- return new Point(x, y)
- }
- }
-
- Point.constructors = {
- Element: {
- // Get point
- point: function (x, y) {
- return new Point(x, y).transform(this.screenCTM().inverse())
- }
- }
+ var Point = + /*#__PURE__*/ + function () { + // Initialize + function Point(x, y, base) { + _classCallCheck(this, Point); + + var source; + base = base || { + x: 0, + y: 0 // ensure source as object + + }; + source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : _typeof(x) === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y // merge source + + }; + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + } // Clone point + + + _createClass(Point, [{ + key: "clone", + value: function clone() { + return new Point(this); + } // Convert to native SVGPoint + + }, { + key: "native", + value: function native() { + // create new point + var point = parser().svg.createSVGPoint(); // update with current values + + point.x = this.x; + point.y = this.y; + return point; + } // transform point with matrix + + }, { + key: "transform", + value: function transform(m) { + // Perform the matrix multiplication + var x = m.a * this.x + m.c * this.y + m.e; + var y = m.b * this.x + m.d * this.y + m.f; // Return the required point + + return new Point(x, y); + } + }]); + + return Point; + }(); + Point.constructors = { + Element: { + // Get point + point: function point(x, y) { + return new Point(x, y).transform(this.screenCTM().inverse()); + } + } }; - let pathHandlers = {
- M: function (c, p, p0) {
- p.x = p0.x = c[0];
- p.y = p0.y = c[1];
-
- return ['M', p.x, p.y]
- },
- L: function (c, p) {
- p.x = c[0];
- p.y = c[1];
- return ['L', c[0], c[1]]
- },
- H: function (c, p) {
- p.x = c[0];
- return ['H', c[0]]
- },
- V: function (c, p) {
- p.y = c[0];
- return ['V', c[0]]
- },
- C: function (c, p) {
- p.x = c[4];
- p.y = c[5];
- return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]
- },
- S: function (c, p) {
- p.x = c[2];
- p.y = c[3];
- return ['S', c[0], c[1], c[2], c[3]]
- },
- Q: function (c, p) {
- p.x = c[2];
- p.y = c[3];
- return ['Q', c[0], c[1], c[2], c[3]]
- },
- T: function (c, p) {
- p.x = c[0];
- p.y = c[1];
- return ['T', c[0], c[1]]
- },
- Z: function (c, p, p0) {
- p.x = p0.x;
- p.y = p0.y;
- return ['Z']
- },
- A: function (c, p) {
- p.x = c[5];
- p.y = c[6];
- return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]
- }
- };
-
- let mlhvqtcsaz = 'mlhvqtcsaz'.split('');
-
- for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
- pathHandlers[mlhvqtcsaz[i]] = (function (i) {
- return function (c, p, p0) {
- if (i === 'H') c[0] = c[0] + p.x;
- else if (i === 'V') c[0] = c[0] + p.y;
- else if (i === 'A') {
- c[5] = c[5] + p.x;
- c[6] = c[6] + p.y;
- } else {
- for (var j = 0, jl = c.length; j < jl; ++j) {
- c[j] = c[j] + (j % 2 ? p.y : p.x);
- }
- }
-
- return pathHandlers[i](c, p, p0)
- }
- })(mlhvqtcsaz[i].toUpperCase());
- }
-
- class PathArray extends SVGArray {
- constructor (array, fallback = [['M', 0, 0]]) {
- super(array, fallback);
- }
-
- // Convert array to string
- toString () {
- return arrayToString(this)
- }
-
- toArray () {
- return this.reduce(function (prev, curr) {
- return [].concat.call(prev, curr)
- }, [])
- }
-
- // Move path string
- move (x, y) {
- // get bounding box of current situation
- var box = this.bbox();
-
- // get relative offset
- x -= box.x;
- y -= box.y;
-
- if (!isNaN(x) && !isNaN(y)) {
- // move every point
- for (var l, i = this.length - 1; i >= 0; i--) {
- l = this[i][0];
-
- if (l === 'M' || l === 'L' || l === 'T') {
- this[i][1] += x;
- this[i][2] += y;
- } else if (l === 'H') {
- this[i][1] += x;
- } else if (l === 'V') {
- this[i][1] += y;
- } else if (l === 'C' || l === 'S' || l === 'Q') {
- this[i][1] += x;
- this[i][2] += y;
- this[i][3] += x;
- this[i][4] += y;
-
- if (l === 'C') {
- this[i][5] += x;
- this[i][6] += y;
- }
- } else if (l === 'A') {
- this[i][6] += x;
- this[i][7] += y;
- }
- }
- }
-
- return this
- }
-
- // Resize path string
- size (width, height) {
- // get bounding box of current situation
- var box = this.bbox();
- var i, l;
-
- // recalculate position of all points according to new size
- for (i = this.length - 1; i >= 0; i--) {
- l = this[i][0];
-
- if (l === 'M' || l === 'L' || l === 'T') {
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;
- this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y;
- } else if (l === 'H') {
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;
- } else if (l === 'V') {
- this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y;
- } else if (l === 'C' || l === 'S' || l === 'Q') {
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;
- this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y;
- this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x;
- this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y;
-
- if (l === 'C') {
- this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x;
- this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y;
- }
- } else if (l === 'A') {
- // resize radii
- this[i][1] = (this[i][1] * width) / box.width;
- this[i][2] = (this[i][2] * height) / box.height;
-
- // move position values
- this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x;
- this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y;
- }
- }
-
- return this
- }
-
- // Test if the passed path array use the same path data commands as this path array
- equalCommands (pathArray) {
- var i, il, equalCommands;
-
- pathArray = new PathArray(pathArray);
-
- equalCommands = this.length === pathArray.value.length;
- for (i = 0, il = this.length; equalCommands && i < il; i++) {
- equalCommands = this[i][0] === pathArray.value[i][0];
- }
-
- return equalCommands
- }
-
- // Make path array morphable
- morph (pathArray) {
- pathArray = new PathArray(pathArray);
-
- if (this.equalCommands(pathArray)) {
- this.destination = pathArray;
- } else {
- this.destination = null;
- }
-
- return this
- }
-
- // Get morphed path array at given position
- at (pos) {
- // make sure a destination is defined
- if (!this.destination) return this
-
- var sourceArray = this;
- var destinationArray = this.destination.value;
- var array = [];
- var pathArray = new PathArray();
- var i, il, j, jl;
-
- // Animate has specified in the SVG spec
- // See: https://www.w3.org/TR/SVG11/paths.html#PathElement
- for (i = 0, il = sourceArray.length; i < il; i++) {
- array[i] = [sourceArray[i][0]];
- for (j = 1, jl = sourceArray[i].length; j < jl; j++) {
- array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos;
- }
- // For the two flags of the elliptical arc command, the SVG spec say:
- // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true
- // Elliptical arc command as an array followed by corresponding indexes:
- // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]
- // 0 1 2 3 4 5 6 7
- if (array[i][0] === 'A') {
- array[i][4] = +(array[i][4] !== 0);
- array[i][5] = +(array[i][5] !== 0);
- }
- }
-
- // Directly modify the value of a path array, this is done this way for performance
- pathArray.value = array;
- return pathArray
- }
-
- // Absolutize and parse path to array
- parse (array) {
- // if it's already a patharray, no need to parse it
- if (array instanceof PathArray) return array.valueOf()
-
- // prepare for parsing
- var s;
- var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 };
-
- if (typeof array === 'string') {
- array = array
- .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123
- .replace(pathLetters, ' $& ') // put some room between letters and numbers
- .replace(hyphen, '$1 -') // add space before hyphen
- .trim() // trim
- .split(delimiter); // split into array
- } else {
- array = array.reduce(function (prev, curr) {
- return [].concat.call(prev, curr)
- }, []);
- }
-
- // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]
- var result = [];
- var p = new Point();
- var p0 = new Point();
- var index = 0;
- var len = array.length;
-
- do {
- // Test if we have a path letter
- if (isPathLetter.test(array[index])) {
- s = array[index];
- ++index;
- // If last letter was a move command and we got no new, it defaults to [L]ine
- } else if (s === 'M') {
- s = 'L';
- } else if (s === 'm') {
- s = 'l';
- }
-
- result.push(pathHandlers[s].call(null,
- array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),
- p, p0
- )
- );
- } while (len > index)
-
- return result
- }
-
- // Get bounding box of path
- bbox () {
- parser().path.setAttribute('d', this.toString());
- return parser.nodes.path.getBBox()
- }
+ var pathHandlers = { + M: function M(c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function L(c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function H(c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function V(c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function C(c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function S(c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function Q(c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function T(c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function Z(c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function A(c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; + } + }; + var mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + + for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (var j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i].toUpperCase()); } - class Path extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('path', node), Path);
- }
-
- // Get array
- array () {
- return this._array || (this._array = new PathArray(this.attr('d')))
- }
-
- // Plot new path
- plot (d) {
- return (d == null) ? this.array()
- : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))
- }
-
- // Clear array cache
- clear () {
- delete this._array;
- return this
- }
-
- // Move by left top corner
- move (x, y) {
- return this.attr('d', this.array().move(x, y))
- }
-
- // Move by left top corner over x-axis
- x (x) {
- return x == null ? this.bbox().x : this.move(x, this.bbox().y)
- }
-
- // Move by left top corner over y-axis
- y (y) {
- return y == null ? this.bbox().y : this.move(this.bbox().x, y)
- }
-
- // Set element size to given width and height
- size (width, height) {
- var p = proportionalSize$1(this, width, height);
- return this.attr('d', this.array().size(p.width, p.height))
- }
-
- // Set width of element
- width (width) {
- return width == null ? this.bbox().width : this.size(width, this.bbox().height)
- }
-
- // Set height of element
- height (height) {
- return height == null ? this.bbox().height : this.size(this.bbox().width, height)
- }
- }
-
- // Define morphable array
- Path.prototype.MorphArray = PathArray;
-
- // Add parent method
- Path.constructors = {
- Container: {
- // Create a wrapped path element
- path (d) {
- // make sure plot is called as a setter
- return this.put(new Path()).plot(d || new PathArray())
- }
- }
+ var PathArray = + /*#__PURE__*/ + function (_SVGArray) { + _inherits(PathArray, _SVGArray); + + function PathArray(array) { + var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [['M', 0, 0]]; + + _classCallCheck(this, PathArray); + + return _possibleConstructorReturn(this, _getPrototypeOf(PathArray).call(this, array, fallback)); + } // Convert array to string + + + _createClass(PathArray, [{ + key: "toString", + value: function toString() { + return arrayToString(this); + } + }, { + key: "toArray", + value: function toArray() { + return this.reduce(function (prev, curr) { + return [].concat.call(prev, curr); + }, []); + } // Move path string + + }, { + key: "move", + value: function move(x, y) { + // get bounding box of current situation + var box = this.bbox(); // get relative offset + + x -= box.x; + y -= box.y; + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (var l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + + return this; + } // Resize path string + + }, { + key: "size", + value: function size(width, height) { + // get bounding box of current situation + var box = this.bbox(); + var i, l; // recalculate position of all points according to new size + + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; // move position values + + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + } + } + + return this; + } // Test if the passed path array use the same path data commands as this path array + + }, { + key: "equalCommands", + value: function equalCommands(pathArray) { + var i, il, equalCommands; + pathArray = new PathArray(pathArray); + equalCommands = this.length === pathArray.value.length; + + for (i = 0, il = this.length; equalCommands && i < il; i++) { + equalCommands = this[i][0] === pathArray.value[i][0]; + } + + return equalCommands; + } // Make path array morphable + + }, { + key: "morph", + value: function morph(pathArray) { + pathArray = new PathArray(pathArray); + + if (this.equalCommands(pathArray)) { + this.destination = pathArray; + } else { + this.destination = null; + } + + return this; + } // Get morphed path array at given position + + }, { + key: "at", + value: function at(pos) { + // make sure a destination is defined + if (!this.destination) return this; + var sourceArray = this; + var destinationArray = this.destination.value; + var array = []; + var pathArray = new PathArray(); + var i, il, j, jl; // Animate has specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/paths.html#PathElement + + for (i = 0, il = sourceArray.length; i < il; i++) { + array[i] = [sourceArray[i][0]]; + + for (j = 1, jl = sourceArray[i].length; j < jl; j++) { + array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; + } // For the two flags of the elliptical arc command, the SVG spec say: + // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true + // Elliptical arc command as an array followed by corresponding indexes: + // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] + // 0 1 2 3 4 5 6 7 + + + if (array[i][0] === 'A') { + array[i][4] = +(array[i][4] !== 0); + array[i][5] = +(array[i][5] !== 0); + } + } // Directly modify the value of a path array, this is done this way for performance + + + pathArray.value = array; + return pathArray; + } // Absolutize and parse path to array + + }, { + key: "parse", + value: function parse(array) { + // if it's already a patharray, no need to parse it + if (array instanceof PathArray) return array.valueOf(); // prepare for parsing + + var s; + var paramCnt = { + 'M': 2, + 'L': 2, + 'H': 1, + 'V': 1, + 'C': 6, + 'S': 4, + 'Q': 4, + 'T': 2, + 'A': 7, + 'Z': 0 + }; + + if (typeof array === 'string') { + array = array.replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 + .replace(pathLetters, ' $& ') // put some room between letters and numbers + .replace(hyphen, '$1 -') // add space before hyphen + .trim() // trim + .split(delimiter); // split into array + } else { + array = array.reduce(function (prev, curr) { + return [].concat.call(prev, curr); + }, []); + } // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] + + + var result = []; + var p = new Point(); + var p0 = new Point(); + var index = 0; + var len = array.length; + + do { + // Test if we have a path letter + if (isPathLetter.test(array[index])) { + s = array[index]; + ++index; // If last letter was a move command and we got no new, it defaults to [L]ine + } else if (s === 'M') { + s = 'L'; + } else if (s === 'm') { + s = 'l'; + } + + result.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0)); + } while (len > index); + + return result; + } // Get bounding box of path + + }, { + key: "bbox", + value: function bbox() { + parser().path.setAttribute('d', this.toString()); + return parser.nodes.path.getBBox(); + } + }]); + + return PathArray; + }(SVGArray); + + var Path = + /*#__PURE__*/ + function (_Base) { + _inherits(Path, _Base); + + // Initialize node + function Path(node) { + _classCallCheck(this, Path); + + return _possibleConstructorReturn(this, _getPrototypeOf(Path).call(this, nodeOrNew$1('path', node), Path)); + } // Get array + + + _createClass(Path, [{ + key: "array", + value: function array() { + return this._array || (this._array = new PathArray(this.attr('d'))); + } // Plot new path + + }, { + key: "plot", + value: function plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); + } // Clear array cache + + }, { + key: "clear", + value: function clear() { + delete this._array; + return this; + } // Move by left top corner + + }, { + key: "move", + value: function move(x, y) { + return this.attr('d', this.array().move(x, y)); + } // Move by left top corner over x-axis + + }, { + key: "x", + value: function x(_x) { + return _x == null ? this.bbox().x : this.move(_x, this.bbox().y); + } // Move by left top corner over y-axis + + }, { + key: "y", + value: function y(_y) { + return _y == null ? this.bbox().y : this.move(this.bbox().x, _y); + } // Set element size to given width and height + + }, { + key: "size", + value: function size(width, height) { + var p = proportionalSize$1(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)); + } // Set width of element + + }, { + key: "width", + value: function width(_width) { + return _width == null ? this.bbox().width : this.size(_width, this.bbox().height); + } // Set height of element + + }, { + key: "height", + value: function height(_height) { + return _height == null ? this.bbox().height : this.size(this.bbox().width, _height); + } + }]); + + return Path; + }(Base$1); // Define morphable array + Path.prototype.MorphArray = PathArray; // Add parent method + + Path.constructors = { + Container: { + // Create a wrapped path element + path: function path(d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + } + } }; - let MorphArray = PointArray$1;
-
- // Move by left top corner over x-axis
- function x$1 (x) {
- return x == null ? this.bbox().x : this.move(x, this.bbox().y)
- }
-
- // Move by left top corner over y-axis
- function y$1 (y) {
- return y == null ? this.bbox().y : this.move(this.bbox().x, y)
- }
-
- // Set width of element
- function width$1 (width) {
- let b = this.bbox();
- return width == null ? b.width : this.size(width, b.height)
- }
-
- // Set height of element
- function height$1 (height) {
- let b = this.bbox();
- return height == null ? b.height : this.size(b.width, height)
+ var MorphArray = PointArray$1; // Move by left top corner over x-axis + + function x$1(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } // Move by left top corner over y-axis + + function y$1(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } // Set width of element + + function width$1(width) { + var b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); + } // Set height of element + + function height$1(height) { + var b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); } var pointed = /*#__PURE__*/Object.freeze({ @@ -1992,35 +2409,28 @@ var SVG = (function () { height: height$1 }); - // Add polygon-specific functions
-
- // Get array
- function array () {
- return this._array || (this._array = new PointArray(this.attr('points')))
- }
-
- // Plot new path
- function plot (p) {
- return (p == null) ? this.array()
- : this.clear().attr('points', typeof p === 'string' ? p
- : (this._array = new PointArray(p)))
- }
-
- // Clear array cache
- function clear () {
- delete this._array;
- return this
- }
-
- // Move by left top corner
- function move (x, y) {
- return this.attr('points', this.array().move(x, y))
- }
-
- // Set element size to given width and height
- function size$1 (width, height) {
- let p = proportionalSize(this, width, height);
- return this.attr('points', this.array().size(p.width, p.height))
+ // Add polygon-specific functions + // Get array + function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); + } // Plot new path + + function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); + } // Clear array cache + + function clear() { + delete this._array; + return this; + } // Move by left top corner + + function move(x, y) { + return this.attr('points', this.array().move(x, y)); + } // Set element size to given width and height + + function size$1(width, height) { + var p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); } var poly = /*#__PURE__*/Object.freeze({ @@ -2031,142 +2441,158 @@ var SVG = (function () { size: size$1 }); - class Polygon extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('polygon', node), Polygon);
- }
- }
-
- Polygon.constructors = {
- Parent: {
- // Create a wrapped polygon element
- polygon (p) {
- // make sure plot is called as a setter
- return this.put(new Polygon()).plot(p || new PointArray$1())
- }
- }
- };
-
- extend$1(Polygon, pointed);
+ var Polygon = + /*#__PURE__*/ + function (_Base) { + _inherits(Polygon, _Base); + + // Initialize node + function Polygon(node) { + _classCallCheck(this, Polygon); + + return _possibleConstructorReturn(this, _getPrototypeOf(Polygon).call(this, nodeOrNew$1('polygon', node), Polygon)); + } + + return Polygon; + }(Base$1); + Polygon.constructors = { + Parent: { + // Create a wrapped polygon element + polygon: function polygon(p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray$1()); + } + } + }; + extend$1(Polygon, pointed); extend$1(Polygon, poly); - class Polyline extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('polyline', node), Polyline);
- }
- }
-
- Polyline.constructors = {
- Parent: {
- // Create a wrapped polygon element
- polyline (p) {
- // make sure plot is called as a setter
- return this.put(new Polyline()).plot(p || new PointArray$1())
- }
- }
- };
-
- extend$1(Polyline, pointed);
+ var Polyline = + /*#__PURE__*/ + function (_Base) { + _inherits(Polyline, _Base); + + // Initialize node + function Polyline(node) { + _classCallCheck(this, Polyline); + + return _possibleConstructorReturn(this, _getPrototypeOf(Polyline).call(this, nodeOrNew$1('polyline', node), Polyline)); + } + + return Polyline; + }(Base$1); + Polyline.constructors = { + Parent: { + // Create a wrapped polygon element + polyline: function polyline(p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray$1()); + } + } + }; + extend$1(Polyline, pointed); extend$1(Polyline, poly); - class Rect extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('rect', node), Rect);
- }
- }
-
- Rect.constructors = {
- Container: {
- // Create a rect element
- rect (width, height) {
- return this.put(new Rect()).size(width, height)
- }
- }
+ var Rect = + /*#__PURE__*/ + function (_Base) { + _inherits(Rect, _Base); + + // Initialize node + function Rect(node) { + _classCallCheck(this, Rect); + + return _possibleConstructorReturn(this, _getPrototypeOf(Rect).call(this, nodeOrNew$1('rect', node), Rect)); + } + + return Rect; + }(Base$1); + Rect.constructors = { + Container: { + // Create a rect element + rect: function rect(width, height) { + return this.put(new Rect()).size(width, height); + } + } }; - class Symbol extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('symbol', node), Symbol);
- }
- }
-
- Symbol.constructors = {
- Container: {
- symbol () {
- return this.put(new Symbol())
- }
- }
+ var _Symbol = + /*#__PURE__*/ + function (_Base) { + _inherits(_Symbol, _Base); + + // Initialize node + function _Symbol(node) { + _classCallCheck(this, _Symbol); + + return _possibleConstructorReturn(this, _getPrototypeOf(_Symbol).call(this, nodeOrNew$1('symbol', node), _Symbol)); + } + + return _Symbol; + }(Base$1); + _Symbol.constructors = { + Container: { + symbol: function symbol() { + return this.put(new _Symbol()); + } + } }; - function noop () {}
-
- // Default animation values
- let timeline = {
- duration: 400,
- ease: '>',
- delay: 0
- };
-
- // Default attribute values
- let attrs = {
-
- // fill and stroke
- 'fill-opacity': 1,
- 'stroke-opacity': 1,
- 'stroke-width': 0,
- 'stroke-linejoin': 'miter',
- 'stroke-linecap': 'butt',
- fill: '#000000',
- stroke: '#000000',
- opacity: 1,
-
- // position
- x: 0,
- y: 0,
- cx: 0,
- cy: 0,
-
- // size
- width: 0,
- height: 0,
-
- // radius
- r: 0,
- rx: 0,
- ry: 0,
-
- // gradient
- offset: 0,
- 'stop-opacity': 1,
- 'stop-color': '#000000',
-
- // text
- 'font-size': 16,
- 'font-family': 'Helvetica, Arial, sans-serif',
- 'text-anchor': 'start'
+ function noop() {} // Default animation values + + var timeline = { + duration: 400, + ease: '>', + delay: 0 // Default attribute values + + }; + var attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'font-size': 16, + 'font-family': 'Helvetica, Arial, sans-serif', + 'text-anchor': 'start' }; - // Create plain text node
- function plain (text) {
- // clear if build mode is disabled
- if (this._build === false) {
- this.clear();
- }
-
- // create text node
- this.node.appendChild(document.createTextNode(text));
-
- return this
- }
-
- // FIXME: Does this also work for textpath?
- // Get length of text element
- function length () {
- return this.node.getComputedTextLength()
+ // Create plain text node + function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } // create text node + + + this.node.appendChild(document.createTextNode(text)); + return this; + } // FIXME: Does this also work for textpath? + // Get length of text element + + function length() { + return this.node.getComputedTextLength(); } var textable = /*#__PURE__*/Object.freeze({ @@ -2174,269 +2600,304 @@ var SVG = (function () { length: length }); - class Text$1 extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('text', node), Text$1);
-
- this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding
- this._rebuild = true; // enable automatic updating of dy values
- this._build = false; // disable build mode for adding multiple lines
-
- // set default font
- this.attr('font-family', attrs['font-family']);
- }
-
- // Move over x-axis
- x (x) {
- // act as getter
- if (x == null) {
- return this.attr('x')
- }
-
- return this.attr('x', x)
- }
-
- // Move over y-axis
- y (y) {
- var oy = this.attr('y');
- var o = typeof oy === 'number' ? oy - this.bbox().y : 0;
-
- // act as getter
- if (y == null) {
- return typeof oy === 'number' ? oy - o : oy
- }
-
- return this.attr('y', typeof y === 'number' ? y + o : y)
- }
-
- // Move center over x-axis
- cx (x) {
- return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)
- }
-
- // Move center over y-axis
- cy (y) {
- return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)
- }
-
- // Set the text content
- text (text) {
- // act as getter
- if (text === undefined) {
- var children = this.node.childNodes;
- var firstLine = 0;
- text = '';
-
- for (var i = 0, len = children.length; i < len; ++i) {
- // skip textPaths - they are no lines
- if (children[i].nodeName === 'textPath') {
- if (i === 0) firstLine = 1;
- continue
- }
-
- // add newline if its not the first child and newLined is set to true
- if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {
- text += '\n';
- }
-
- // add content of this node
- text += children[i].textContent;
- }
-
- return text
- }
-
- // remove existing content
- this.clear().build(true);
-
- if (typeof text === 'function') {
- // call block
- text.call(this, this);
- } else {
- // store text and make sure text is not blank
- text = text.split('\n');
-
- // build new lines
- for (var j = 0, jl = text.length; j < jl; j++) {
- this.tspan(text[j]).newLine();
- }
- }
-
- // disable build mode and rebuild lines
- return this.build(false).rebuild()
- }
-
- // Set / get leading
- leading (value) {
- // act as getter
- if (value == null) {
- return this.dom.leading
- }
-
- // act as setter
- this.dom.leading = new SVGNumber(value);
-
- return this.rebuild()
- }
-
- // Rebuild appearance type
- rebuild (rebuild) {
- // store new rebuild flag if given
- if (typeof rebuild === 'boolean') {
- this._rebuild = rebuild;
- }
-
- // define position of all lines
- if (this._rebuild) {
- var self = this;
- var blankLineOffset = 0;
- var dy = this.dom.leading * new SVGNumber(this.attr('font-size'));
-
- this.each(function () {
- if (this.dom.newLined) {
- this.attr('x', self.attr('x'));
-
- if (this.text() === '\n') {
- blankLineOffset += dy;
- } else {
- this.attr('dy', dy + blankLineOffset);
- blankLineOffset = 0;
- }
- }
- });
-
- this.fire('rebuild');
- }
-
- return this
- }
-
- // Enable / disable build mode
- build (build) {
- this._build = !!build;
- return this
- }
-
- // overwrite method from parent to set data properly
- setData (o) {
- this.dom = o;
- this.dom.leading = new SVGNumber(o.leading || 1.3);
- return this
- }
- }
-
- extend$1(Text$1, textable);
-
- Text$1.constructors = {
- Container: {
- // Create text element
- text (text) {
- return this.put(new Text$1()).text(text)
- },
-
- // Create plain text element
- plain (text) {
- return this.put(new Text$1()).plain(text)
- }
- }
+ var Text$1 = + /*#__PURE__*/ + function (_Base) { + _inherits(Text, _Base); + + // Initialize node + function Text(node) { + var _this; + + _classCallCheck(this, Text); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(Text).call(this, nodeOrNew$1('text', node), Text)); + _this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding + + _this._rebuild = true; // enable automatic updating of dy values + + _this._build = false; // disable build mode for adding multiple lines + // set default font + + _this.attr('font-family', attrs['font-family']); + + return _this; + } // Move over x-axis + + + _createClass(Text, [{ + key: "x", + value: function x(_x) { + // act as getter + if (_x == null) { + return this.attr('x'); + } + + return this.attr('x', _x); + } // Move over y-axis + + }, { + key: "y", + value: function y(_y) { + var oy = this.attr('y'); + var o = typeof oy === 'number' ? oy - this.bbox().y : 0; // act as getter + + if (_y == null) { + return typeof oy === 'number' ? oy - o : oy; + } + + return this.attr('y', typeof _y === 'number' ? _y + o : _y); + } // Move center over x-axis + + }, { + key: "cx", + value: function cx(x) { + return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2); + } // Move center over y-axis + + }, { + key: "cy", + value: function cy(y) { + return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2); + } // Set the text content + + }, { + key: "text", + value: function text(_text) { + // act as getter + if (_text === undefined) { + var children = this.node.childNodes; + var firstLine = 0; + _text = ''; + + for (var i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath') { + if (i === 0) firstLine = 1; + continue; + } // add newline if its not the first child and newLined is set to true + + + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + _text += '\n'; + } // add content of this node + + + _text += children[i].textContent; + } + + return _text; + } // remove existing content + + + this.clear().build(true); + + if (typeof _text === 'function') { + // call block + _text.call(this, this); + } else { + // store text and make sure text is not blank + _text = _text.split('\n'); // build new lines + + for (var j = 0, jl = _text.length; j < jl; j++) { + this.tspan(_text[j]).newLine(); + } + } // disable build mode and rebuild lines + + + return this.build(false).rebuild(); + } // Set / get leading + + }, { + key: "leading", + value: function leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } // act as setter + + + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } // Rebuild appearance type + + }, { + key: "rebuild", + value: function rebuild(_rebuild) { + // store new rebuild flag if given + if (typeof _rebuild === 'boolean') { + this._rebuild = _rebuild; + } // define position of all lines + + + if (this._rebuild) { + var self = this; + var blankLineOffset = 0; + var dy = this.dom.leading * new SVGNumber(this.attr('font-size')); + this.each(function () { + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', dy + blankLineOffset); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); + } + + return this; + } // Enable / disable build mode + + }, { + key: "build", + value: function build(_build) { + this._build = !!_build; + return this; + } // overwrite method from parent to set data properly + + }, { + key: "setData", + value: function setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } + }]); + + return Text; + }(Base$1); + extend$1(Text$1, textable); + Text$1.constructors = { + Container: { + // Create text element + text: function text(_text2) { + return this.put(new Text$1()).text(_text2); + }, + // Create plain text element + plain: function plain$$1(text) { + return this.put(new Text$1()).plain(text); + } + } }; - class TextPath extends Text$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('textPath', node));
- }
-
- // return the array of the path track element
- array () {
- var track = this.track();
-
- return track ? track.array() : null
- }
-
- // Plot path if any
- plot (d) {
- var track = this.track();
- var pathArray = null;
-
- if (track) {
- pathArray = track.plot(d);
- }
-
- return (d == null) ? pathArray : this
- }
-
- // Get the path element
- track () {
- return this.reference('href')
- }
- }
-
- TextPath.constructors = {
- Container: {
- textPath (text, path) {
- return this.defs().path(path).text(text).addTo(this)
- }
- },
- Text: {
- // Create path for text to run on
- path: function (track) {
- var path = new TextPath();
-
- // if d is a path, reuse it
- if (!(track instanceof Path)) {
- // create path element
- track = this.doc().defs().path(track);
- }
-
- // link textPath to path and add content
- path.attr('href', '#' + track, xlink);
-
- // add textPath element as child node and return textPath
- return this.put(path)
- },
-
- // FIXME: make this plural?
- // Get the textPath children
- textPath: function () {
- return this.select('textPath')
- }
- },
- Path: {
- // creates a textPath from this path
- text: function (text) {
- if (text instanceof Text$1) {
- var txt = text.text();
- return text.clear().path(this).text(txt)
- }
- return this.parent().put(new Text$1()).path(this).text(text)
- }
- // FIXME: Maybe add `targets` to get all textPaths associated with this path
- }
- };
-
+ var TextPath = + /*#__PURE__*/ + function (_Text) { + _inherits(TextPath, _Text); + + // Initialize node + function TextPath(node) { + _classCallCheck(this, TextPath); + + return _possibleConstructorReturn(this, _getPrototypeOf(TextPath).call(this, nodeOrNew$1('textPath', node))); + } // return the array of the path track element + + + _createClass(TextPath, [{ + key: "array", + value: function array() { + var track = this.track(); + return track ? track.array() : null; + } // Plot path if any + + }, { + key: "plot", + value: function plot(d) { + var track = this.track(); + var pathArray = null; + + if (track) { + pathArray = track.plot(d); + } + + return d == null ? pathArray : this; + } // Get the path element + + }, { + key: "track", + value: function track() { + return this.reference('href'); + } + }]); + + return TextPath; + }(Text$1); + TextPath.constructors = { + Container: { + textPath: function textPath(text, path) { + return this.defs().path(path).text(text).addTo(this); + } + }, + Text: { + // Create path for text to run on + path: function path(track) { + var path = new TextPath(); // if d is a path, reuse it + + if (!(track instanceof Path)) { + // create path element + track = this.doc().defs().path(track); + } // link textPath to path and add content + + + path.attr('href', '#' + track, xlink); // add textPath element as child node and return textPath + + return this.put(path); + }, + // FIXME: make this plural? + // Get the textPath children + textPath: function textPath() { + return this.select('textPath'); + } + }, + Path: { + // creates a textPath from this path + text: function text(_text) { + if (_text instanceof Text$1) { + var txt = _text.text(); + + return _text.clear().path(this).text(txt); + } + + return this.parent().put(new Text$1()).path(this).text(_text); + } // FIXME: Maybe add `targets` to get all textPaths associated with this path + + } + }; TextPath.prototype.MorphArray = PathArray; - class Use extends Base$1 {
- constructor (node) {
- super(nodeOrNew('use', node), Use);
- }
-
- // Use element as a reference
- element (element, file) {
- // Set lined element
- return this.attr('href', (file || '') + '#' + element, xlink)
- }
- }
-
- Use.constructors = {
- Container: {
- // Create a use element
- use: function (element, file) {
- return this.put(new Use()).element(element, file)
- }
- }
+ var Use = + /*#__PURE__*/ + function (_Base) { + _inherits(Use, _Base); + + function Use(node) { + _classCallCheck(this, Use); + + return _possibleConstructorReturn(this, _getPrototypeOf(Use).call(this, nodeOrNew('use', node), Use)); + } // Use element as a reference + + + _createClass(Use, [{ + key: "element", + value: function element(_element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + _element, xlink); + } + }]); + + return Use; + }(Base$1); + Use.constructors = { + Container: { + // Create a use element + use: function use(element, file) { + return this.put(new Use()).element(element, file); + } + } }; @@ -2462,84 +2923,76 @@ var SVG = (function () { Polyline: Polyline, Rect: Rect, Stop: Stop, - Symbol: Symbol, + Symbol: _Symbol, Text: Text$1, TextPath: TextPath, Use: Use }); - function makeInstance (element) {
- if (element instanceof Base$1) return element
-
- if (typeof element === 'object') {
- return adopt$1(element)
- }
-
- if (element == null) {
- return new Doc()
- }
-
- if (typeof element === 'string' && element.charAt(0) !== '<') {
- return adopt$1(document.querySelector(element))
- }
-
- var node = makeNode('svg');
- node.innerHTML = element;
-
- element = adopt$1(node.firstElementChild);
-
- return element
- }
-
- // Adopt existing svg elements
- function adopt$1 (node) {
- // check for presence of node
- if (!node) return null
-
- // make sure a node isn't already adopted
- if (node.instance instanceof Element) return node.instance
-
- if (!(node instanceof window.SVGElement)) {
- return new HtmlNode(node)
- }
-
- // initialize variables
- var element;
-
- // adopt with element-specific settings
- if (node.nodeName === 'svg') {
- element = new Doc$1(node);
- } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') {
- element = new Gradient(node);
- } else if (elements[capitalize(node.nodeName)]) {
- element = new elements[capitalize(node.nodeName)](node);
- } else {
- element = new Bare(node);
- }
-
- return element
- }
-
- // Element id sequence
- let did = 1000;
-
- // Get next named element id
- function eid (name) {
- return 'Svgjs' + capitalize(name) + (did++)
- }
-
- // Deep new id assignment
- function assignNewId (node) {
- // do the same for SVG child nodes as well
- for (var i = node.children.length - 1; i >= 0; i--) {
- assignNewId(node.children[i]);
- }
-
- if (node.id) {
- return adopt$1(node).id(eid(node.nodeName))
- }
-
- return adopt$1(node)
+ function makeInstance(element) { + if (element instanceof Base$1) return element; + + if (_typeof(element) === 'object') { + return adopt$1(element); + } + + if (element == null) { + return new Doc(); + } + + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopt$1(document.querySelector(element)); + } + + var node = makeNode('svg'); + node.innerHTML = element; + element = adopt$1(node.firstElementChild); + return element; + } // Adopt existing svg elements + + function adopt$1(node) { + // check for presence of node + if (!node) return null; // make sure a node isn't already adopted + + if (node.instance instanceof Element) return node.instance; + + if (!(node instanceof window.SVGElement)) { + return new HtmlNode(node); + } // initialize variables + + + var element; // adopt with element-specific settings + + if (node.nodeName === 'svg') { + element = new Doc$1(node); + } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') { + element = new Gradient(node); + } else if (elements[capitalize(node.nodeName)]) { + element = new elements[capitalize(node.nodeName)](node); + } else { + element = new Bare(node); + } + + return element; + } // Element id sequence + + var did = 1000; // Get next named element id + + function eid(name) { + return 'Svgjs' + capitalize(name) + did++; + } // Deep new id assignment + + function assignNewId(node) { + // do the same for SVG child nodes as well + for (var i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + + if (node.id) { + return adopt$1(node).id(eid(node.nodeName)); + } + + return adopt$1(node); } var adopter = /*#__PURE__*/Object.freeze({ @@ -2549,2582 +3002,2688 @@ var SVG = (function () { assignNewId: assignNewId }); - class Queue {
- constructor () {
- this._first = null;
- this._last = null;
- }
-
- push (value) {
- // An item stores an id and the provided value
- var item = value.next ? value : { value: value, next: null, prev: null };
-
- // Deal with the queue being empty or populated
- if (this._last) {
- item.prev = this._last;
- this._last.next = item;
- this._last = item;
- } else {
- this._last = item;
- this._first = item;
- }
-
- // Update the length and return the current item
- return item
- }
-
- shift () {
- // Check if we have a value
- var remove = this._first;
- if (!remove) return null
-
- // If we do, remove it and relink things
- this._first = remove.next;
- if (this._first) this._first.prev = null;
- this._last = this._first ? this._last : null;
- return remove.value
- }
-
- // Shows us the first item in the list
- first () {
- return this._first && this._first.value
- }
-
- // Shows us the last item in the list
- last () {
- return this._last && this._last.value
- }
-
- // Removes the item that was returned from the push
- remove (item) {
- // Relink the previous item
- if (item.prev) item.prev.next = item.next;
- if (item.next) item.next.prev = item.prev;
- if (item === this._last) this._last = item.prev;
- if (item === this._first) this._first = item.next;
-
- // Invalidate item
- item.prev = null;
- item.next = null;
- }
- } + var Queue = + /*#__PURE__*/ + function () { + function Queue() { + _classCallCheck(this, Queue); + + this._first = null; + this._last = null; + } - const Animator = { + _createClass(Queue, [{ + key: "push", + value: function push(value) { + // An item stores an id and the provided value + var item = value.next ? value : { + value: value, + next: null, + prev: null // Deal with the queue being empty or populated + + }; + + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } // Update the length and return the current item + + + return item; + } + }, { + key: "shift", + value: function shift() { + // Check if we have a value + var remove = this._first; + if (!remove) return null; // If we do, remove it and relink things + + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } // Shows us the first item in the list + + }, { + key: "first", + value: function first() { + return this._first && this._first.value; + } // Shows us the last item in the list + + }, { + key: "last", + value: function last() { + return this._last && this._last.value; + } // Removes the item that was returned from the push + + }, { + key: "remove", + value: function remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; // Invalidate item + + item.prev = null; + item.next = null; + } + }]); + + return Queue; + }(); + + var Animator = { nextDraw: null, frames: new Queue(), timeouts: new Queue(), timer: window.performance || window.Date, transforms: [], - - frame (fn) { + frame: function frame(fn) { // Store the node - var node = Animator.frames.push({ run: fn }); + var node = Animator.frames.push({ + run: fn + }); // Request an animation frame if we don't have one - // Request an animation frame if we don't have one if (Animator.nextDraw === null) { Animator.nextDraw = window.requestAnimationFrame(Animator._draw); - } + } // Return the node so we can remove it easily - // Return the node so we can remove it easily - return node - }, - transform_frame (fn, id) { + return node; + }, + transform_frame: function transform_frame(fn, id) { Animator.transforms[id] = fn; }, + timeout: function timeout(fn, delay) { + delay = delay || 0; // Work out when the event should fire - timeout (fn, delay) { - delay = delay || 0; + var time = Animator.timer.now() + delay; // Add the timeout to the end of the queue - // Work out when the event should fire - var time = Animator.timer.now() + delay; + var node = Animator.timeouts.push({ + run: fn, + time: time + }); // Request another animation frame if we need one - // Add the timeout to the end of the queue - var node = Animator.timeouts.push({ run: fn, time: time }); - - // Request another animation frame if we need one if (Animator.nextDraw === null) { Animator.nextDraw = window.requestAnimationFrame(Animator._draw); } - return node + return node; }, - - cancelFrame (node) { + cancelFrame: function cancelFrame(node) { Animator.frames.remove(node); }, - - clearTimeout (node) { + clearTimeout: function clearTimeout(node) { Animator.timeouts.remove(node); }, - - _draw (now) { + _draw: function _draw(now) { // Run all the timeouts we can run, if they are not ready yet, add them // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) - var nextTimeout = null;
+ var nextTimeout = null; var lastTimeout = Animator.timeouts.last(); - while ((nextTimeout = Animator.timeouts.shift())) { + + while (nextTimeout = Animator.timeouts.shift()) { // Run the timeout if its time, or push it to the end if (now >= nextTimeout.time) { nextTimeout.run(); } else { Animator.timeouts.push(nextTimeout); - } + } // If we hit the last item, we should stop shifting out more items + + + if (nextTimeout === lastTimeout) break; + } // Run all of the animation frames - // If we hit the last item, we should stop shifting out more items - if (nextTimeout === lastTimeout) break - } - // Run all of the animation frames var nextFrame = null; var lastFrame = Animator.frames.last(); - while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) { + + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { nextFrame.run(); } - Animator.transforms.forEach(function (el) { el(); }); + Animator.transforms.forEach(function (el) { + el(); + }); // If we have remaining timeouts or frames, draw until we don't anymore - // If we have remaining timeouts or frames, draw until we don't anymore - Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() - ? window.requestAnimationFrame(Animator._draw) - : null; + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? window.requestAnimationFrame(Animator._draw) : null; } }; - class Tspan extends Base$1 {
- // Initialize node
- constructor (node) {
- super(nodeOrNew$1('tspan', node), Tspan);
- }
-
- // Set text content
- text (text) {
- if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '')
-
- typeof text === 'function' ? text.call(this, this) : this.plain(text);
-
- return this
- }
-
- // Shortcut dx
- dx (dx) {
- return this.attr('dx', dx)
- }
-
- // Shortcut dy
- dy (dy) {
- return this.attr('dy', dy)
- }
-
- // Create new line
- newLine () {
- // fetch text parent
- var t = this.parent(Text);
-
- // mark new line
- this.dom.newLined = true;
-
- // apply new position
- return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())
- }
- }
-
- extend$1(Tspan, textable);
-
- Tspan.constructors = {
- Tspan: {
- tspan (text) {
- var tspan = new Tspan();
-
- // clear if build mode is disabled
- if (!this._build) {
- this.clear();
- }
-
- // add new tspan
- this.node.appendChild(tspan.node);
-
- return tspan.text(text)
- }
- }
+ var Tspan = + /*#__PURE__*/ + function (_Base) { + _inherits(Tspan, _Base); + + // Initialize node + function Tspan(node) { + _classCallCheck(this, Tspan); + + return _possibleConstructorReturn(this, _getPrototypeOf(Tspan).call(this, nodeOrNew$1('tspan', node), Tspan)); + } // Set text content + + + _createClass(Tspan, [{ + key: "text", + value: function text(_text) { + if (_text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + typeof _text === 'function' ? _text.call(this, this) : this.plain(_text); + return this; + } // Shortcut dx + + }, { + key: "dx", + value: function dx(_dx) { + return this.attr('dx', _dx); + } // Shortcut dy + + }, { + key: "dy", + value: function dy(_dy) { + return this.attr('dy', _dy); + } // Create new line + + }, { + key: "newLine", + value: function newLine() { + // fetch text parent + var t = this.parent(Text); // mark new line + + this.dom.newLined = true; // apply new position + + return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()); + } + }]); + + return Tspan; + }(Base$1); + extend$1(Tspan, textable); + Tspan.constructors = { + Tspan: { + tspan: function tspan(text) { + var tspan = new Tspan(); // clear if build mode is disabled + + if (!this._build) { + this.clear(); + } // add new tspan + + + this.node.appendChild(tspan.node); + return tspan.text(text); + } + } }; - // Map function
- function map (array, block) {
- var i;
- var il = array.length;
- var result = [];
-
- for (i = 0; i < il; i++) {
- result.push(block(array[i]));
- }
-
- return result
- }
-
- // Degrees to radians
- function radians (d) {
- return d % 360 * Math.PI / 180
- } + // Map function + function map(array, block) { + var i; + var il = array.length; + var result = []; + + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + + return result; + } // Filter function + + function radians(d) { + return d % 360 * Math.PI / 180; + } // Radians to degrees + + var Matrix = + /*#__PURE__*/ + function () { + function Matrix() { + _classCallCheck(this, Matrix); + + this.init.apply(this, arguments); + } // Initialize + + + _createClass(Matrix, [{ + key: "init", + value: function init(source) { + var base = arrayToMatrix([1, 0, 0, 1, 0, 0]); // ensure source as object + + source = source instanceof Base$1 && source.is('Element') ? source.matrixify() : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? arrayToMatrix(source) : _typeof(source) === 'object' && isMatrixLike(source) ? source : _typeof(source) === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments)) : base; // Merge the source matrix with the base matrix + + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + } // Clones this matrix + + }, { + key: "clone", + value: function clone() { + return new Matrix(this); + } // Transform a matrix into another matrix by manipulating the space + + }, { + key: "transform", + value: function transform(o) { + // Check if o is a matrix and then left multiply it directly + if (isMatrixLike(o)) { + var matrix = new Matrix(o); + return matrix.multiplyO(this); + } // Get the proposed transformations and the current transformations + + + var t = Matrix.formatTransforms(o); + var current = this; + + var _transform = new Point(t.ox, t.oy).transform(current), + ox = _transform.x, + oy = _transform.y; // Construct the resulting matrix + + + var transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); // If we want the origin at a particular place, we force it there + + if (isFinite(t.px) || isFinite(t.py)) { + var origin = new Point(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px) + + var dx = t.px ? t.px - origin.x : 0; + var dy = t.py ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } // Translate now after positioning + + + transformer.translateO(t.tx, t.ty); + return transformer; + } // Applies a matrix defined by its affine parameters + + }, { + key: "compose", + value: function compose(o) { + if (o.origin) { + o.originX = o.origin[0]; + o.originY = o.origin[1]; + } // Get the parameters + + + var ox = o.originX || 0; + var oy = o.originY || 0; + var sx = o.scaleX || 1; + var sy = o.scaleY || 1; + var lam = o.shear || 0; + var theta = o.rotate || 0; + var tx = o.translateX || 0; + var ty = o.translateY || 0; // Apply the standard matrix + + var result = new Matrix().translateO(-ox, -oy).scaleO(sx, sy).shearO(lam).rotateO(theta).translateO(tx, ty).lmultiplyO(this).translateO(ox, oy); + return result; + } // Decomposes this matrix into its affine parameters + + }, { + key: "decompose", + value: function decompose() { + var cx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var cy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + // Get the parameters from the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Figure out if the winding direction is clockwise or counterclockwise + + var determinant = a * d - b * c; + var ccw = determinant > 0 ? 1 : -1; // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + + var sx = ccw * Math.sqrt(a * a + b * b); + var thetaRad = Math.atan2(ccw * b, ccw * a); + var theta = 180 / Math.PI * thetaRad; + var ct = Math.cos(thetaRad); + var st = Math.sin(thetaRad); // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + + var lam = (a * c + b * d) / determinant; + var sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); // Use the translations + + var tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + var ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); // Construct the decomposition and return it + + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } // Left multiplies by the given matrix + + }, { + key: "multiply", + value: function multiply(matrix) { + return this.clone().multiplyO(matrix); + } + }, { + key: "multiplyO", + value: function multiplyO(matrix) { + // Get the matrices + var l = this; + var r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + }, { + key: "lmultiply", + value: function lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + }, { + key: "lmultiplyO", + value: function lmultiplyO(matrix) { + var r = this; + var l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } // Inverses matrix + + }, { + key: "inverseO", + value: function inverseO() { + // Get the current parameters out of the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Invert the 2x2 matrix in the top left + + var det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); // Calculate the top 2x2 matrix + + var na = d / det; + var nb = -b / det; + var nc = -c / det; + var nd = a / det; // Apply the inverted matrix to the top right + + var ne = -(na * e + nc * f); + var nf = -(nb * e + nd * f); // Construct the inverted matrix + + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + return this; + } + }, { + key: "inverse", + value: function inverse() { + return this.clone().inverseO(); + } // Translate matrix + + }, { + key: "translate", + value: function translate(x, y) { + return this.clone().translateO(x, y); + } + }, { + key: "translateO", + value: function translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this; + } // Scale matrix + + }, { + key: "scale", + value: function scale(x, y, cx, cy) { + var _this$clone; + + return (_this$clone = this.clone()).scaleO.apply(_this$clone, arguments); + } + }, { + key: "scaleO", + value: function scaleO(x) { + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; + var cx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var cy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + var a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } // Rotate matrix + + }, { + key: "rotate", + value: function rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); + } + }, { + key: "rotateO", + value: function rotateO(r) { + var cx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var cy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + // Convert degrees to radians + r = radians(r); + var cos = Math.cos(r); + var sin = Math.sin(r); + var a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } // Flip matrix on x or y, at a given offset + + }, { + key: "flip", + value: function flip(axis, around) { + return this.clone().flipO(axis, around); + } + }, { + key: "flipO", + value: function flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } // Shear matrix + + }, { + key: "shear", + value: function shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } + }, { + key: "shearO", + value: function shearO(lx) { + var cy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } // Skew Matrix + + }, { + key: "skew", + value: function skew(x, y, cx, cy) { + var _this$clone2; + + return (_this$clone2 = this.clone()).skewO.apply(_this$clone2, arguments); + } + }, { + key: "skewO", + value: function skewO(x) { + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; + var cx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var cy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } // Convert degrees to radians + + + x = radians(x); + y = radians(y); + var lx = Math.tan(x); + var ly = Math.tan(y); + var a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } // SkewX + + }, { + key: "skewX", + value: function skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); + } + }, { + key: "skewXO", + value: function skewXO(x, cx, cy) { + return this.skewO(x, 0, cx, cy); + } // SkewY + + }, { + key: "skewY", + value: function skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); + } + }, { + key: "skewYO", + value: function skewYO(y, cx, cy) { + return this.skewO(0, y, cx, cy); + } // Transform around a center point + + }, { + key: "aroundO", + value: function aroundO(cx, cy, matrix) { + var dx = cx || 0; + var dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); + } + }, { + key: "around", + value: function around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } // Convert to native SVGMatrix + + }, { + key: "native", + value: function native() { + // create new matrix + var matrix = parser().node.createSVGMatrix(); // update with current values + + for (var i = abcdef.length - 1; i >= 0; i--) { + matrix[abcdef[i]] = this[abcdef[i]]; + } + + return matrix; + } // Check if two matrices are equal + + }, { + key: "equals", + value: function equals(other) { + var comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } // Convert matrix to string + + }, { + key: "toString", + value: function toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } + }, { + key: "toArray", + value: function toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } + }, { + key: "valueOf", + value: function valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } // TODO: Refactor this to a static function of matrix.js + + }], [{ + key: "formatTransforms", + value: function formatTransforms(o) { + // Get all of the parameters required to form the matrix + var flipBoth = o.flip === 'both' || o.flip === true; + var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + var skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + var skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + var shear = o.shear || 0; + var theta = o.rotate || o.theta || 0; + var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + var ox = origin.x; + var oy = origin.y; + var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); + var px = position.x; + var py = position.y; + var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + var tx = translate.x; + var ty = translate.y; + var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + var rx = relative.x; + var ry = relative.y; // Populate all of the values - class Matrix {
- constructor (...args) {
- this.init(...args);
- }
-
- // Initialize
- init (source) {
- var base = arrayToMatrix([1, 0, 0, 1, 0, 0]);
-
- // ensure source as object
- source = source instanceof Base$1 && source.is('Element') ? source.matrixify()
- : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat))
- : Array.isArray(source) ? arrayToMatrix(source)
- : (typeof source === 'object' && isMatrixLike(source)) ? source
- : (typeof source === 'object') ? new Matrix().transform(source)
- : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments))
- : base;
-
- // Merge the source matrix with the base matrix
- this.a = source.a != null ? source.a : base.a;
- this.b = source.b != null ? source.b : base.b;
- this.c = source.c != null ? source.c : base.c;
- this.d = source.d != null ? source.d : base.d;
- this.e = source.e != null ? source.e : base.e;
- this.f = source.f != null ? source.f : base.f;
- }
-
-
- // Clones this matrix
- clone () {
- return new Matrix(this)
- }
-
- // Transform a matrix into another matrix by manipulating the space
- transform (o) {
- // Check if o is a matrix and then left multiply it directly
- if (isMatrixLike(o)) {
- var matrix = new Matrix(o);
- return matrix.multiplyO(this)
- }
-
- // Get the proposed transformations and the current transformations
- var t = Matrix.formatTransforms(o);
- var current = this;
- let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current);
-
- // Construct the resulting matrix
- var transformer = new Matrix()
- .translateO(t.rx, t.ry)
- .lmultiplyO(current)
- .translateO(-ox, -oy)
- .scaleO(t.scaleX, t.scaleY)
- .skewO(t.skewX, t.skewY)
- .shearO(t.shear)
- .rotateO(t.theta)
- .translateO(ox, oy);
-
- // If we want the origin at a particular place, we force it there
- if (isFinite(t.px) || isFinite(t.py)) {
- const origin = new Point(ox, oy).transform(transformer);
- // TODO: Replace t.px with isFinite(t.px)
- const dx = t.px ? t.px - origin.x : 0;
- const dy = t.py ? t.py - origin.y : 0;
- transformer.translateO(dx, dy);
- }
-
- // Translate now after positioning
- transformer.translateO(t.tx, t.ty);
- return transformer
- }
-
- // Applies a matrix defined by its affine parameters
- compose (o) {
- if (o.origin) {
- o.originX = o.origin[0];
- o.originY = o.origin[1];
- }
- // Get the parameters
- var ox = o.originX || 0;
- var oy = o.originY || 0;
- var sx = o.scaleX || 1;
- var sy = o.scaleY || 1;
- var lam = o.shear || 0;
- var theta = o.rotate || 0;
- var tx = o.translateX || 0;
- var ty = o.translateY || 0;
-
- // Apply the standard matrix
- var result = new Matrix()
- .translateO(-ox, -oy)
- .scaleO(sx, sy)
- .shearO(lam)
- .rotateO(theta)
- .translateO(tx, ty)
- .lmultiplyO(this)
- .translateO(ox, oy);
- return result
- }
-
- // Decomposes this matrix into its affine parameters
- decompose (cx = 0, cy = 0) {
- // Get the parameters from the matrix
- var a = this.a;
- var b = this.b;
- var c = this.c;
- var d = this.d;
- var e = this.e;
- var f = this.f;
-
- // Figure out if the winding direction is clockwise or counterclockwise
- var determinant = a * d - b * c;
- var ccw = determinant > 0 ? 1 : -1;
-
- // Since we only shear in x, we can use the x basis to get the x scale
- // and the rotation of the resulting matrix
- var sx = ccw * Math.sqrt(a * a + b * b);
- var thetaRad = Math.atan2(ccw * b, ccw * a);
- var theta = 180 / Math.PI * thetaRad;
- var ct = Math.cos(thetaRad);
- var st = Math.sin(thetaRad);
-
- // We can then solve the y basis vector simultaneously to get the other
- // two affine parameters directly from these parameters
- var lam = (a * c + b * d) / determinant;
- var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a));
-
- // Use the translations
- let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy);
- let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy);
-
- // Construct the decomposition and return it
- return {
- // Return the affine parameters
- scaleX: sx,
- scaleY: sy,
- shear: lam,
- rotate: theta,
- translateX: tx,
- translateY: ty,
- originX: cx,
- originY: cy,
-
- // Return the matrix parameters
- a: this.a,
- b: this.b,
- c: this.c,
- d: this.d,
- e: this.e,
- f: this.f
- }
- }
-
- // Left multiplies by the given matrix
- multiply (matrix) {
- return this.clone().multiplyO(matrix)
- }
-
- multiplyO (matrix) {
- // Get the matrices
- var l = this;
- var r = matrix instanceof Matrix
- ? matrix
- : new Matrix(matrix);
-
- return Matrix.matrixMultiply(l, r, this)
- }
-
- lmultiply (matrix) {
- return this.clone().lmultiplyO(matrix)
- }
-
- lmultiplyO (matrix) {
- var r = this;
- var l = matrix instanceof Matrix
- ? matrix
- : new Matrix(matrix);
-
- return Matrix.matrixMultiply(l, r, this)
- }
-
- // Inverses matrix
- inverseO () {
- // Get the current parameters out of the matrix
- var a = this.a;
- var b = this.b;
- var c = this.c;
- var d = this.d;
- var e = this.e;
- var f = this.f;
-
- // Invert the 2x2 matrix in the top left
- var det = a * d - b * c;
- if (!det) throw new Error('Cannot invert ' + this)
-
- // Calculate the top 2x2 matrix
- var na = d / det;
- var nb = -b / det;
- var nc = -c / det;
- var nd = a / det;
-
- // Apply the inverted matrix to the top right
- var ne = -(na * e + nc * f);
- var nf = -(nb * e + nd * f);
-
- // Construct the inverted matrix
- this.a = na;
- this.b = nb;
- this.c = nc;
- this.d = nd;
- this.e = ne;
- this.f = nf;
-
- return this
- }
-
- inverse () {
- return this.clone().inverseO()
- }
-
- // Translate matrix
- translate (x, y) {
- return this.clone().translateO(x, y)
- }
-
- translateO (x, y) {
- this.e += x || 0;
- this.f += y || 0;
- return this
- }
-
- // Scale matrix
- scale (x, y, cx, cy) {
- return this.clone().scaleO(...arguments)
- }
-
- scaleO (x, y = x, cx = 0, cy = 0) {
- // Support uniform scaling
- if (arguments.length === 3) {
- cy = cx;
- cx = y;
- y = x;
- }
-
- let {a, b, c, d, e, f} = this;
-
- this.a = a * x;
- this.b = b * y;
- this.c = c * x;
- this.d = d * y;
- this.e = e * x - cx * x + cx;
- this.f = f * y - cy * y + cy;
-
- return this
- }
-
- // Rotate matrix
- rotate (r, cx, cy) {
- return this.clone().rotateO(r, cx, cy)
- }
-
- rotateO (r, cx = 0, cy = 0) {
- // Convert degrees to radians
- r = radians(r);
-
- let cos = Math.cos(r);
- let sin = Math.sin(r);
-
- let {a, b, c, d, e, f} = this;
-
- this.a = a * cos - b * sin;
- this.b = b * cos + a * sin;
- this.c = c * cos - d * sin;
- this.d = d * cos + c * sin;
- this.e = e * cos - f * sin + cy * sin - cx * cos + cx;
- this.f = f * cos + e * sin - cx * sin - cy * cos + cy;
-
- return this
- }
-
- // Flip matrix on x or y, at a given offset
- flip (axis, around) {
- return this.clone().flipO(axis, around)
- }
-
- flipO (axis, around) {
- return axis === 'x' ? this.scaleO(-1, 1, around, 0)
- : axis === 'y' ? this.scaleO(1, -1, 0, around)
- : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point
- }
-
- // Shear matrix
- shear (a, cx, cy) {
- return this.clone().shearO(a, cx, cy)
- }
-
- shearO (lx, cx = 0, cy = 0) {
- let {a, b, c, d, e, f} = this;
-
- this.a = a + b * lx;
- this.c = c + d * lx;
- this.e = e + f * lx - cy * lx;
-
- return this
- }
-
- // Skew Matrix
- skew (x, y, cx, cy) {
- return this.clone().skewO(...arguments)
- }
-
- skewO (x, y = x, cx = 0, cy = 0) {
- // support uniformal skew
- if (arguments.length === 3) {
- cy = cx;
- cx = y;
- y = x;
- }
-
- // Convert degrees to radians
- x = radians(x);
- y = radians(y);
-
- let lx = Math.tan(x);
- let ly = Math.tan(y);
-
- let {a, b, c, d, e, f} = this;
-
- this.a = a + b * lx;
- this.b = b + a * ly;
- this.c = c + d * lx;
- this.d = d + c * ly;
- this.e = e + f * lx - cy * lx;
- this.f = f + e * ly - cx * ly;
-
- return this
- }
-
- // SkewX
- skewX (x, cx, cy) {
- return this.skew(x, 0, cx, cy)
- }
-
- skewXO (x, cx, cy) {
- return this.skewO(x, 0, cx, cy)
- }
-
- // SkewY
- skewY (y, cx, cy) {
- return this.skew(0, y, cx, cy)
- }
-
- skewYO (y, cx, cy) {
- return this.skewO(0, y, cx, cy)
- }
-
- // Transform around a center point
- aroundO (cx, cy, matrix) {
- var dx = cx || 0;
- var dy = cy || 0;
- return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)
- }
-
- around (cx, cy, matrix) {
- return this.clone().aroundO(cx, cy, matrix)
- }
-
- // Convert to native SVGMatrix
- native () {
- // create new matrix
- var matrix = parser().node.createSVGMatrix();
-
- // update with current values
- for (var i = abcdef.length - 1; i >= 0; i--) {
- matrix[abcdef[i]] = this[abcdef[i]];
- }
-
- return matrix
- }
-
- // Check if two matrices are equal
- equals (other) {
- var comp = new Matrix(other);
- return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&
- closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&
- closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)
- }
-
- // Convert matrix to string
- toString () {
- return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'
- }
-
- toArray () {
- return [this.a, this.b, this.c, this.d, this.e, this.f]
- }
-
- valueOf () {
- return {
- a: this.a,
- b: this.b,
- c: this.c,
- d: this.d,
- e: this.e,
- f: this.f
- }
- }
-
-
- // TODO: Refactor this to a static function of matrix.js
- static formatTransforms (o) {
- // Get all of the parameters required to form the matrix
- var flipBoth = o.flip === 'both' || o.flip === true;
- var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1;
- var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1;
- var skewX = o.skew && o.skew.length ? o.skew[0]
- : isFinite(o.skew) ? o.skew
- : isFinite(o.skewX) ? o.skewX
- : 0;
- var skewY = o.skew && o.skew.length ? o.skew[1]
- : isFinite(o.skew) ? o.skew
- : isFinite(o.skewY) ? o.skewY
- : 0;
- var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX
- : isFinite(o.scale) ? o.scale * flipX
- : isFinite(o.scaleX) ? o.scaleX * flipX
- : flipX;
- var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY
- : isFinite(o.scale) ? o.scale * flipY
- : isFinite(o.scaleY) ? o.scaleY * flipY
- : flipY;
- var shear = o.shear || 0;
- var theta = o.rotate || o.theta || 0;
- var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY);
- var ox = origin.x;
- var oy = origin.y;
- var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY);
- var px = position.x;
- var py = position.y;
- var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY);
- var tx = translate.x;
- var ty = translate.y;
- var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY);
- var rx = relative.x;
- var ry = relative.y;
-
- // Populate all of the values
- return {
- scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py
- }
- }
-
- // left matrix, right matrix, target matrix which is overwritten
- static matrixMultiply (l, r, o) {
- // Work out the product directly
- var a = l.a * r.a + l.c * r.b;
- var b = l.b * r.a + l.d * r.b;
- var c = l.a * r.c + l.c * r.d;
- var d = l.b * r.c + l.d * r.d;
- var e = l.e + l.a * r.e + l.c * r.f;
- var f = l.f + l.b * r.e + l.d * r.f;
-
- // make sure to use local variables because l/r and o could be the same
- o.a = a;
- o.b = b;
- o.c = c;
- o.d = d;
- o.e = e;
- o.f = f;
-
- return o
- }
- }
-
- Matrix.constructors = {
- Element: {
- // Get current matrix
- ctm () {
- return new Matrix(this.node.getCTM())
- },
-
- // Get current screen matrix
- screenCTM () {
+ return { + scaleX: scaleX, + scaleY: scaleY, + skewX: skewX, + skewY: skewY, + shear: shear, + theta: theta, + rx: rx, + ry: ry, + tx: tx, + ty: ty, + ox: ox, + oy: oy, + px: px, + py: py + }; + } // left matrix, right matrix, target matrix which is overwritten + + }, { + key: "matrixMultiply", + value: function matrixMultiply(l, r, o) { + // Work out the product directly + var a = l.a * r.a + l.c * r.b; + var b = l.b * r.a + l.d * r.b; + var c = l.a * r.c + l.c * r.d; + var d = l.b * r.c + l.d * r.d; + var e = l.e + l.a * r.e + l.c * r.f; + var f = l.f + l.b * r.e + l.d * r.f; // make sure to use local variables because l/r and o could be the same + + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; + } + }]); + + return Matrix; + }(); + Matrix.constructors = { + Element: { + // Get current matrix + ctm: function ctm() { + return new Matrix(this.node.getCTM()); + }, + // Get current screen matrix + screenCTM: function screenCTM() { /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537
This is needed because FF does not return the transformation matrix
for the inner coordinate system when getScreenCTM() is called on nested svgs.
- However all other Browsers do that */
- if (this instanceof Doc && !this.isRoot()) {
- var rect = this.rect(1, 1);
- var m = rect.node.getScreenCTM();
- rect.remove();
- return new Matrix(m)
- }
- return new Matrix(this.node.getScreenCTM())
- }
- }
- }; + However all other Browsers do that */ + if (this instanceof Doc && !this.isRoot()) { + var rect = this.rect(1, 1); + var m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); + } - //import {Parent, Doc, Symbol, Image, Pattern, Marker, Point} from './classes.js'
-
- class Box$1 {
- constructor (...args) {
- this.init(...args);
- }
-
- init (source) {
- var base = [0, 0, 0, 0];
- source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)
- : Array.isArray(source) ? source
- : typeof source === 'object' ? [source.left != null ? source.left
- : source.x, source.top != null ? source.top : source.y, source.width, source.height]
- : arguments.length === 4 ? [].slice.call(arguments)
- : base;
-
- this.x = source[0];
- this.y = source[1];
- this.width = source[2];
- this.height = source[3];
-
- // add center, right, bottom...
- fullBox(this);
- }
-
- // Merge rect box with another, return a new instance
- merge (box) {
- let x = Math.min(this.x, box.x);
- let y = Math.min(this.y, box.y);
- let width = Math.max(this.x + this.width, box.x + box.width) - x;
- let height = Math.max(this.y + this.height, box.y + box.height) - y;
-
- return new Box$1(x, y, width, height)
- }
-
- transform (m) {
- let xMin = Infinity;
- let xMax = -Infinity;
- let yMin = Infinity;
- let yMax = -Infinity;
-
- let pts = [
- new Point(this.x, this.y),
- new Point(this.x2, this.y),
- new Point(this.x, this.y2),
- new Point(this.x2, this.y2)
- ];
-
- pts.forEach(function (p) {
- p = p.transform(m);
- xMin = Math.min(xMin, p.x);
- xMax = Math.max(xMax, p.x);
- yMin = Math.min(yMin, p.y);
- yMax = Math.max(yMax, p.y);
- });
-
- return new Box$1(
- xMin, yMin,
- xMax - xMin,
- yMax - yMin
- )
- }
-
- addOffset () {
- // offset by window scroll position, because getBoundingClientRect changes when window is scrolled
- this.x += window.pageXOffset;
- this.y += window.pageYOffset;
- return this
- }
-
- toString () {
- return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height
- }
-
- toArray () {
- return [this.x, this.y, this.width, this.height]
- }
- }
-
- function getBox(cb) {
- let box;
-
- try {
- box = cb(this.node);
-
- if (isNulledBox(box) && !domContains(this.node)) {
- throw new Error('Element not in the dom')
- }
- } catch (e) {
- try {
- let clone = this.clone(parser().svg).show();
- box = cb(clone.node);
- clone.remove();
- } catch (e) {
- throw (e)
- console.warn('Getting a bounding box of this element is not possible');
- }
- }
- return box
- }
-
- Box$1.constructors = {
- Element: {
- // Get bounding box
- bbox () {
- return new Box$1(getBox.call(this, (node) => node.getBBox()))
- },
-
- rbox (el) {
- let box = new Box$1(getBox.call(this, (node) => node.getBoundingClientRect()));
- if (el) return box.transform(el.screenCTM().inverse())
- return box.addOffset()
- }
- },
- viewbox: function (x, y, width, height) {
- // act as getter
- if (x == null) return new Box$1(this.attr('viewBox'))
-
- // act as setter
- return this.attr('viewBox', new Box$1(x, y, width, height))
- }
+ return new Matrix(this.node.getScreenCTM()); + } + } }; - /* globals fullHex, compToHex */
-
- class Color {
- constructor (...args) {
- this.init(...args);
- }
-
- init (color, g, b) {
- let match;
-
- // initialize defaults
- this.r = 0;
- this.g = 0;
- this.b = 0;
-
- if (!color) return
-
- // parse color
- if (typeof color === 'string') {
- if (isRgb.test(color)) {
- // get rgb values
- match = rgb.exec(color.replace(whitespace, ''));
-
- // parse numeric values
- this.r = parseInt(match[1]);
- this.g = parseInt(match[2]);
- this.b = parseInt(match[3]);
- } else if (isHex.test(color)) {
- // get hex values
- match = hex.exec(fullHex(color));
-
- // parse numeric values
- this.r = parseInt(match[1], 16);
- this.g = parseInt(match[2], 16);
- this.b = parseInt(match[3], 16);
- }
- } else if (Array.isArray(color)) {
- this.r = color[0];
- this.g = color[1];
- this.b = color[2];
- } else if (typeof color === 'object') {
- this.r = color.r;
- this.g = color.g;
- this.b = color.b;
- } else if (arguments.length === 3) {
- this.r = color;
- this.g = g;
- this.b = b;
- }
- }
-
- // Default to hex conversion
- toString () {
- return this.toHex()
- }
-
- toArray () {
- return [this.r, this.g, this.b]
- }
-
- // Build hex value
- toHex () {
- return '#' +
- compToHex(Math.round(this.r)) +
- compToHex(Math.round(this.g)) +
- compToHex(Math.round(this.b))
- }
-
- // Build rgb value
- toRgb () {
- return 'rgb(' + [this.r, this.g, this.b].join() + ')'
- }
-
- // Calculate true brightness
- brightness () {
- return (this.r / 255 * 0.30) +
- (this.g / 255 * 0.59) +
- (this.b / 255 * 0.11)
- }
-
- // Testers
-
- // Test if given value is a color string
- static test (color) {
- color += '';
- return isHex.test(color) || isRgb.test(color)
- }
-
- // Test if given value is a rgb object
- static isRgb (color) {
- return color && typeof color.r === 'number' &&
- typeof color.g === 'number' &&
- typeof color.b === 'number'
- }
-
- // Test if given value is a color
- static isColor (color) {
- return this.isRgb(color) || this.test(color)
- }
+ var Box$1 = + /*#__PURE__*/ + function () { + function Box() { + _classCallCheck(this, Box); + + this.init.apply(this, arguments); + } + + _createClass(Box, [{ + key: "init", + value: function init(source) { + var base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : _typeof(source) === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0]; + this.y = source[1]; + this.width = source[2]; + this.height = source[3]; // add center, right, bottom... + + fullBox(this); + } // Merge rect box with another, return a new instance + + }, { + key: "merge", + value: function merge(box) { + var x = Math.min(this.x, box.x); + var y = Math.min(this.y, box.y); + var width = Math.max(this.x + this.width, box.x + box.width) - x; + var height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + }, { + key: "transform", + value: function transform(m) { + var xMin = Infinity; + var xMax = -Infinity; + var yMin = Infinity; + var yMax = -Infinity; + var pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } + }, { + key: "addOffset", + value: function addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += window.pageXOffset; + this.y += window.pageYOffset; + return this; + } + }, { + key: "toString", + value: function toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; + } + }, { + key: "toArray", + value: function toArray() { + return [this.x, this.y, this.width, this.height]; + } + }]); + + return Box; + }(); + + function getBox(cb) { + var box; + + try { + box = cb(this.node); + + if (isNulledBox(box) && !domContains(this.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + try { + var clone = this.clone(parser().svg).show(); + box = cb(clone.node); + clone.remove(); + } catch (e) { + throw e; + console.warn('Getting a bounding box of this element is not possible'); + } + } + + return box; } + Box$1.constructors = { + Element: { + // Get bounding box + bbox: function bbox() { + return new Box$1(getBox.call(this, function (node) { + return node.getBBox(); + })); + }, + rbox: function rbox(el) { + var box = new Box$1(getBox.call(this, function (node) { + return node.getBoundingClientRect(); + })); + if (el) return box.transform(el.screenCTM().inverse()); + return box.addOffset(); + } + }, + viewbox: function viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box$1(this.attr('viewBox')); // act as setter + + return this.attr('viewBox', new Box$1(x, y, width, height)); + } + }; + + var Color = + /*#__PURE__*/ + function () { + function Color() { + _classCallCheck(this, Color); + + this.init.apply(this, arguments); + } + + _createClass(Color, [{ + key: "init", + value: function init(color, g, b) { + var match; // initialize defaults + + this.r = 0; + this.g = 0; + this.b = 0; + if (!color) return; // parse color + + if (typeof color === 'string') { + if (isRgb.test(color)) { + // get rgb values + match = rgb.exec(color.replace(whitespace, '')); // parse numeric values + + this.r = parseInt(match[1]); + this.g = parseInt(match[2]); + this.b = parseInt(match[3]); + } else if (isHex.test(color)) { + // get hex values + match = hex.exec(fullHex(color)); // parse numeric values + + this.r = parseInt(match[1], 16); + this.g = parseInt(match[2], 16); + this.b = parseInt(match[3], 16); + } + } else if (Array.isArray(color)) { + this.r = color[0]; + this.g = color[1]; + this.b = color[2]; + } else if (_typeof(color) === 'object') { + this.r = color.r; + this.g = color.g; + this.b = color.b; + } else if (arguments.length === 3) { + this.r = color; + this.g = g; + this.b = b; + } + } // Default to hex conversion + + }, { + key: "toString", + value: function toString() { + return this.toHex(); + } + }, { + key: "toArray", + value: function toArray() { + return [this.r, this.g, this.b]; + } // Build hex value + + }, { + key: "toHex", + value: function toHex() { + return '#' + compToHex(Math.round(this.r)) + compToHex(Math.round(this.g)) + compToHex(Math.round(this.b)); + } // Build rgb value + + }, { + key: "toRgb", + value: function toRgb() { + return 'rgb(' + [this.r, this.g, this.b].join() + ')'; + } // Calculate true brightness + + }, { + key: "brightness", + value: function brightness() { + return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11; + } // Testers + // Test if given value is a color string + + }], [{ + key: "test", + value: function test(color) { + color += ''; + return isHex.test(color) || isRgb.test(color); + } // Test if given value is a rgb object + + }, { + key: "isRgb", + value: function isRgb$$1(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } // Test if given value is a color + + }, { + key: "isColor", + value: function isColor(color) { + return this.isRgb(color) || this.test(color); + } + }]); + + return Color; + }(); + /***
Base Class
==========
The base stepper class that will be
- ***/
-
- function makeSetterGetter (k, f) {
- return function (v) {
- if (v == null) return this[v]
- this[k] = v;
- if (f) f.call(this);
- return this
- }
- }
-
- let easing = {
- '-': function (pos) { return pos },
- '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },
- '>': function (pos) { return Math.sin(pos * Math.PI / 2) },
- '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },
- bezier: function (t0, x0, t1, x1) {
- return function (t) {
- // TODO: FINISH
- }
- }
- };
-
-
- class Stepper {
- done () { return false }
- }
-
+ ***/ + + function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[v]; + this[k] = v; + if (f) f.call(this); + return this; + }; + } + + var easing = { + '-': function _(pos) { + return pos; + }, + '<>': function _(pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function _(pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function _(pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function bezier(t0, x0, t1, x1) { + return function (t) {// TODO: FINISH + }; + } + }; + var Stepper = + /*#__PURE__*/ + function () { + function Stepper() { + _classCallCheck(this, Stepper); + } + + _createClass(Stepper, [{ + key: "done", + value: function done() { + return false; + } + }]); + + return Stepper; + }(); /***
Easing Functions
================
- ***/
-
- class Ease extends Stepper {
- constructor (fn) {
- super();
- this.ease = easing[fn || timeline.ease] || fn;
- }
-
- step (from, to, pos) {
- if (typeof from !== 'number') {
- return pos < 1 ? from : to
- }
- return from + (to - from) * this.ease(pos)
- }
- }
-
-
+ ***/ + + var Ease = + /*#__PURE__*/ + function (_Stepper) { + _inherits(Ease, _Stepper); + + function Ease(fn) { + var _this; + + _classCallCheck(this, Ease); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(Ease).call(this)); + _this.ease = easing[fn || timeline.ease] || fn; + return _this; + } + + _createClass(Ease, [{ + key: "step", + value: function step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } + + return from + (to - from) * this.ease(pos); + } + }]); + + return Ease; + }(Stepper); /***
Controller Types
================
- ***/
-
- class Controller extends Stepper {
- constructor (fn) {
- super();
- this.stepper = fn;
- }
-
- step (current, target, dt, c) {
- return this.stepper(current, target, dt, c)
- }
-
- done (c) {
- return c.done
- }
- }
-
- function recalculate () {
- // Apply the default parameters
- var duration = (this._duration || 500) / 1000;
- var overshoot = this._overshoot || 0;
-
- // Calculate the PID natural response
- var eps = 1e-10;
- var pi = Math.PI;
- var os = Math.log(overshoot / 100 + eps);
- var zeta = -os / Math.sqrt(pi * pi + os * os);
- var wn = 3.9 / (zeta * duration);
-
- // Calculate the Spring values
- this.d = 2 * zeta * wn;
- this.k = wn * wn;
- }
-
- class Spring extends Controller {
- constructor (duration, overshoot) {
- super();
- this.duration(duration || 500)
- .overshoot(overshoot || 0);
- }
-
- step (current, target, dt, c) {
- if (typeof current === 'string') return current
- c.done = dt === Infinity;
- if (dt === Infinity) return target
- if (dt === 0) return current
-
- if (dt > 100) dt = 16;
-
- dt /= 1000;
-
- // Get the previous velocity
- var velocity = c.velocity || 0;
-
- // Apply the control to get the new position and store it
- var acceleration = -this.d * velocity - this.k * (current - target);
- var newPosition = current +
- velocity * dt +
- acceleration * dt * dt / 2;
-
- // Store the velocity
- c.velocity = velocity + acceleration * dt;
-
- // Figure out if we have converged, and if so, pass the value
- c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002;
- return c.done ? target : newPosition
- }
- }
-
- extend$1(Spring, {
- duration: makeSetterGetter('_duration', recalculate),
- overshoot: makeSetterGetter('_overshoot', recalculate)
- });
-
- class PID extends Controller {
- constructor (p, i, d, windup) {
- super();
-
- p = p == null ? 0.1 : p;
- i = i == null ? 0.01 : i;
- d = d == null ? 0 : d;
- windup = windup == null ? 1000 : windup;
- this.p(p).i(i).d(d).windup(windup);
- }
-
- step (current, target, dt, c) {
- if (typeof current === 'string') return current
- c.done = dt === Infinity;
-
- if (dt === Infinity) return target
- if (dt === 0) return current
-
- var p = target - current;
- var i = (c.integral || 0) + p * dt;
- var d = (p - (c.error || 0)) / dt;
- var windup = this.windup;
-
- // antiwindup
- if (windup !== false) {
- i = Math.max(-windup, Math.min(i, windup));
- }
-
- c.error = p;
- c.integral = i;
-
- c.done = Math.abs(p) < 0.001;
-
- return c.done ? target : current + (this.P * p + this.I * i + this.D * d)
- }
- }
-
- extend$1(PID, {
- windup: makeSetterGetter('windup'),
- p: makeSetterGetter('P'),
- i: makeSetterGetter('I'),
- d: makeSetterGetter('D')
+ ***/ + + var Controller = + /*#__PURE__*/ + function (_Stepper2) { + _inherits(Controller, _Stepper2); + + function Controller(fn) { + var _this2; + + _classCallCheck(this, Controller); + + _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Controller).call(this)); + _this2.stepper = fn; + return _this2; + } + + _createClass(Controller, [{ + key: "step", + value: function step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } + }, { + key: "done", + value: function done(c) { + return c.done; + } + }]); + + return Controller; + }(Stepper); + + function recalculate() { + // Apply the default parameters + var duration = (this._duration || 500) / 1000; + var overshoot = this._overshoot || 0; // Calculate the PID natural response + + var eps = 1e-10; + var pi = Math.PI; + var os = Math.log(overshoot / 100 + eps); + var zeta = -os / Math.sqrt(pi * pi + os * os); + var wn = 3.9 / (zeta * duration); // Calculate the Spring values + + this.d = 2 * zeta * wn; + this.k = wn * wn; + } + + var Spring = + /*#__PURE__*/ + function (_Controller) { + _inherits(Spring, _Controller); + + function Spring(duration, overshoot) { + var _this3; + + _classCallCheck(this, Spring); + + _this3 = _possibleConstructorReturn(this, _getPrototypeOf(Spring).call(this)); + + _this3.duration(duration || 500).overshoot(overshoot || 0); + + return _this3; + } + + _createClass(Spring, [{ + key: "step", + value: function step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; // Get the previous velocity + + var velocity = c.velocity || 0; // Apply the control to get the new position and store it + + var acceleration = -this.d * velocity - this.k * (current - target); + var newPosition = current + velocity * dt + acceleration * dt * dt / 2; // Store the velocity + + c.velocity = velocity + acceleration * dt; // Figure out if we have converged, and if so, pass the value + + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } + }]); + + return Spring; + }(Controller); + extend$1(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) }); + var PID = + /*#__PURE__*/ + function (_Controller2) { + _inherits(PID, _Controller2); + + function PID(p, i, d, windup) { + var _this4; + + _classCallCheck(this, PID); + + _this4 = _possibleConstructorReturn(this, _getPrototypeOf(PID).call(this)); + p = p == null ? 0.1 : p; + i = i == null ? 0.01 : i; + d = d == null ? 0 : d; + windup = windup == null ? 1000 : windup; + + _this4.p(p).i(i).d(d).windup(windup); + + return _this4; + } + + _createClass(PID, [{ + key: "step", + value: function step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + var p = target - current; + var i = (c.integral || 0) + p * dt; + var d = (p - (c.error || 0)) / dt; + var windup = this.windup; // antiwindup + + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); + } + }]); - class Morphable {
- constructor (stepper) {
- // FIXME: the default stepper does not know about easing
- this._stepper = stepper || new Ease('-');
-
- this._from = null;
- this._to = null;
- this._type = null;
- this._context = null;
- this._morphObj = null;
- }
-
- from (val) {
- if (val == null) {
- return this._from
- }
-
- this._from = this._set(val);
- return this
- }
-
- to (val) {
- if (val == null) {
- return this._to
- }
-
- this._to = this._set(val);
- return this
- }
-
- type (type) {
- // getter
- if (type == null) {
- return this._type
- }
-
- // setter
- this._type = type;
- return this
- }
-
- _set (value) {
- if (!this._type) {
- var type = typeof value;
-
- if (type === 'number') {
- this.type(SVGNumber);
- } else if (type === 'string') {
- if (Color.isColor(value)) {
- this.type(Color);
- } else if (regex.delimiter.test(value)) {
- this.type(regex.pathLetters.test(value)
- ? PathArray
- : SVGArray
- );
- } else if (regex.numberAndUnit.test(value)) {
- this.type(SVGNumber);
- } else {
- this.type(Morphable.NonMorphable);
- }
- } else if (MorphableTypes.indexOf(value.constructor) > -1) {
- this.type(value.constructor);
- } else if (Array.isArray(value)) {
- this.type(SVGArray);
- } else if (type === 'object') {
- this.type(Morphable.ObjectBag);
- } else {
- this.type(Morphable.NonMorphable);
- }
- }
-
- var result = (new this._type(value)).toArray();
- this._morphObj = this._morphObj || new this._type();
- this._context = this._context ||
- Array.apply(null, Array(result.length)).map(Object);
- return result
- }
-
- stepper (stepper) {
- if (stepper == null) return this._stepper
- this._stepper = stepper;
- return this
- }
-
- done () {
- var complete = this._context
- .map(this._stepper.done)
- .reduce(function (last, curr) {
- return last && curr
- }, true);
- return complete
- }
-
- at (pos) {
- var _this = this;
-
- return this._morphObj.fromArray(
- this._from.map(function (i, index) {
- return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)
- })
- )
- }
- }
-
- Morphable.NonMorphable = class {
- constructor (...args) {
- this.init(...args);
- }
-
- init (val) {
- val = Array.isArray(val) ? val[0] : val;
- this.value = val;
- }
-
- valueOf () {
- return this.value
- }
-
- toArray () {
- return [this.value]
- }
- };
-
- Morphable.TransformBag = class {
- constructor (...args) {
- this.init(...args);
- }
-
- init (obj) {
- if (Array.isArray(obj)) {
- obj = {
- scaleX: obj[0],
- scaleY: obj[1],
- shear: obj[2],
- rotate: obj[3],
- translateX: obj[4],
- translateY: obj[5],
- originX: obj[6],
- originY: obj[7]
- };
- }
-
- Object.assign(this, Morphable.TransformBag.defaults, obj);
- }
-
- toArray () {
- var v = this;
-
- return [
- v.scaleX,
- v.scaleY,
- v.shear,
- v.rotate,
- v.translateX,
- v.translateY,
- v.originX,
- v.originY
- ]
- }
- };
-
- Morphable.TransformBag.defaults = {
- scaleX: 1,
- scaleY: 1,
- shear: 0,
- rotate: 0,
- translateX: 0,
- translateY: 0,
- originX: 0,
- originY: 0
- };
-
- Morphable.ObjectBag = class {
- constructor (...args) {
- this.init(...args);
- }
-
- init (objOrArr) {
- this.values = [];
-
- if (Array.isArray(objOrArr)) {
- this.values = objOrArr;
- return
- }
-
- var entries = Object.entries(objOrArr || {}).sort((a, b) => {
- return a[0] - b[0]
- });
-
- this.values = entries.reduce((last, curr) => last.concat(curr), []);
- }
-
- valueOf () {
- var obj = {};
- var arr = this.values;
-
- for (var i = 0, len = arr.length; i < len; i += 2) {
- obj[arr[i]] = arr[i + 1];
- }
-
- return obj
- }
-
- toArray () {
- return this.values
- }
- };
-
- let morphableTypes = [
- SVGNumber,
- Color,
- Box$1,
- Matrix,
- SVGArray,
- PointArray$1,
- PathArray,
- Morphable.NonMorphable,
- Morphable.TransformBag,
- Morphable.ObjectBag
- ];
-
- extend$1(morphableTypes, {
- to (val, args) {
- return new Morphable()
- .type(this.constructor)
- .from(this.valueOf())
- .to(val, args)
- },
- fromArray (arr) {
- this.init(arr);
- return this
- }
+ return PID; + }(Controller); + extend$1(PID, { + windup: makeSetterGetter('windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') }); - var time = window.performance || Date;
-
- var makeSchedule = function (runnerInfo) {
- var start = runnerInfo.start;
- var duration = runnerInfo.runner.duration();
- var end = start + duration;
- return {start: start, duration: duration, end: end, runner: runnerInfo.runner}
- };
-
- class Timeline {
- // Construct a new timeline on the given element
- constructor () {
- this._timeSource = function () {
- return time.now()
- };
-
- this._dispatcher = document.createElement('div');
-
- // Store the timing variables
- this._startTime = 0;
- this._speed = 1.0;
-
- // Play control variables control how the animation proceeds
- this._reverse = false;
- this._persist = 0;
-
- // Keep track of the running animations and their starting parameters
- this._nextFrame = null;
- this._paused = false;
- this._runners = [];
- this._order = [];
- this._time = 0;
- this._lastSourceTime = 0;
- this._lastStepTime = 0;
- }
-
- getEventTarget () {
- return this._dispatcher
- }
-
- /**
- *
- */
-
- // schedules a runner on the timeline
- schedule (runner, delay, when) {
- if (runner == null) {
- return this._runners.map(makeSchedule).sort(function (a, b) {
- return (a.start - b.start) || (a.duration - b.duration)
- })
- }
-
- if (!this.active()) {
- this._step();
- if (when == null) {
- when = 'now';
- }
- }
-
- // The start time for the next animation can either be given explicitly,
- // derived from the current timeline time or it can be relative to the
- // last start time to chain animations direclty
- var absoluteStartTime = 0;
- delay = delay || 0;
-
- // Work out when to start the animation
- if (when == null || when === 'last' || when === 'after') {
- // Take the last time and increment
- absoluteStartTime = this._startTime;
- } else if (when === 'absolute' || when === 'start') {
- absoluteStartTime = delay;
- delay = 0;
- } else if (when === 'now') {
- absoluteStartTime = this._time;
- } else if (when === 'relative') {
- let runnerInfo = this._runners[runner.id];
- if (runnerInfo) {
- absoluteStartTime = runnerInfo.start + delay;
- delay = 0;
- }
- } else {
- throw new Error('Invalid value for the "when" parameter')
- }
-
- // Manage runner
- runner.unschedule();
- runner.timeline(this);
- runner.time(-delay);
-
- // Save startTime for next runner
- this._startTime = absoluteStartTime + runner.duration() + delay;
-
- // Save runnerInfo
- this._runners[runner.id] = {
- persist: this.persist(),
- runner: runner,
- start: absoluteStartTime
- };
-
- // Save order and continue
- this._order.push(runner.id);
- this._continue();
- return this
- }
-
- // Remove the runner from this timeline
- unschedule (runner) {
- var index = this._order.indexOf(runner.id);
- if (index < 0) return this
-
- delete this._runners[runner.id];
- this._order.splice(index, 1);
- runner.timeline(null);
- return this
- }
-
- play () {
- // Now make sure we are not paused and continue the animation
- this._paused = false;
- return this._continue()
- }
-
- pause () {
- // Cancel the next animation frame and pause
- this._nextFrame = null;
- this._paused = true;
- return this
- }
-
- stop () {
- // Cancel the next animation frame and go to start
- this.seek(-this._time);
- return this.pause()
- }
-
- finish () {
- this.seek(Infinity);
- return this.pause()
- }
-
- speed (speed) {
- if (speed == null) return this._speed
- this._speed = speed;
- return this
- }
-
- reverse (yes) {
- var currentSpeed = this.speed();
- if (yes == null) return this.speed(-currentSpeed)
-
- var positive = Math.abs(currentSpeed);
- return this.speed(yes ? positive : -positive)
- }
-
- seek (dt) {
- this._time += dt;
- return this._continue()
- }
-
- time (time) {
- if (time == null) return this._time
- this._time = time;
- return this
- }
-
- persist (dtOrForever) {
- if (dtOrForever == null) return this._persist
- this._persist = dtOrForever;
- return this
- }
-
- source (fn) {
- if (fn == null) return this._timeSource
- this._timeSource = fn;
- return this
- }
-
- _step () {
- // If the timeline is paused, just do nothing
- if (this._paused) return
-
- // Get the time delta from the last time and update the time
- // TODO: Deal with window.blur window.focus to pause animations
- var time = this._timeSource();
- var dtSource = time - this._lastSourceTime;
- var dtTime = this._speed * dtSource + (this._time - this._lastStepTime);
- this._lastSourceTime = time;
-
- // Update the time
- this._time += dtTime;
- this._lastStepTime = this._time;
- // this.fire('time', this._time)
-
- // Run all of the runners directly
- var runnersLeft = false;
- for (var i = 0, len = this._order.length; i < len; i++) {
- // Get and run the current runner and ignore it if its inactive
- var runnerInfo = this._runners[this._order[i]];
- var runner = runnerInfo.runner;
- let dt = dtTime;
-
- // Make sure that we give the actual difference
- // between runner start time and now
- let dtToStart = this._time - runnerInfo.start;
-
- // Dont run runner if not started yet
- if (dtToStart < 0) {
- runnersLeft = true;
- continue
- } else if (dtToStart < dt) {
- // Adjust dt to make sure that animation is on point
- dt = dtToStart;
- }
-
- if (!runner.active()) continue
-
- // If this runner is still going, signal that we need another animation
- // frame, otherwise, remove the completed runner
- var finished = runner.step(dt).done;
- if (!finished) {
- runnersLeft = true;
- // continue
- } else if (runnerInfo.persist !== true) {
- // runner is finished. And runner might get removed
-
- // TODO: Figure out end time of runner
- var endTime = runner.duration() - runner.time() + this._time;
-
- if (endTime + this._persist < this._time) {
- // Delete runner and correct index
- delete this._runners[this._order[i]];
- this._order.splice(i--, 1) && --len;
- runner.timeline(null);
- }
- }
- }
-
- // Get the next animation frame to keep the simulation going
- if (runnersLeft) {
- this._nextFrame = Animator.frame(this._step.bind(this));
- } else {
- this._nextFrame = null;
- }
- return this
- }
-
- // Checks if we are running and continues the animation
- _continue () {
- if (this._paused) return this
- if (!this._nextFrame) {
- this._nextFrame = Animator.frame(this._step.bind(this));
- }
- return this
- }
-
- active () {
- return !!this._nextFrame
- }
- }
-
- Timeline.constructors = {
- Element: {
- timeline: function () {
- this._timeline = (this._timeline || new Timeline());
- return this._timeline
- }
- }
+ var Morphable = + /*#__PURE__*/ + function () { + function Morphable(stepper) { + _classCallCheck(this, Morphable); + + // FIXME: the default stepper does not know about easing + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + + _createClass(Morphable, [{ + key: "from", + value: function from(val) { + if (val == null) { + return this._from; + } + + this._from = this._set(val); + return this; + } + }, { + key: "to", + value: function to(val) { + if (val == null) { + return this._to; + } + + this._to = this._set(val); + return this; + } + }, { + key: "type", + value: function type(_type) { + // getter + if (_type == null) { + return this._type; + } // setter + + + this._type = _type; + return this; + } + }, { + key: "_set", + value: function _set$$1(value) { + if (!this._type) { + var type = _typeof(value); + + if (type === 'number') { + this.type(SVGNumber); + } else if (type === 'string') { + if (Color.isColor(value)) { + this.type(Color); + } else if (regex.delimiter.test(value)) { + this.type(regex.pathLetters.test(value) ? PathArray : SVGArray); + } else if (regex.numberAndUnit.test(value)) { + this.type(SVGNumber); + } else { + this.type(Morphable.NonMorphable); + } + } else if (MorphableTypes.indexOf(value.constructor) > -1) { + this.type(value.constructor); + } else if (Array.isArray(value)) { + this.type(SVGArray); + } else if (type === 'object') { + this.type(Morphable.ObjectBag); + } else { + this.type(Morphable.NonMorphable); + } + } + + var result = new this._type(value).toArray(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object); + return result; + } + }, { + key: "stepper", + value: function stepper(_stepper) { + if (_stepper == null) return this._stepper; + this._stepper = _stepper; + return this; + } + }, { + key: "done", + value: function done() { + var complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); + + return complete; + } + }, { + key: "at", + value: function at(pos) { + var _this = this; + + return this._morphObj.fromArray(this._from.map(function (i, index) { + return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context); + })); + } + }]); + + return Morphable; + }(); + + Morphable.NonMorphable = + /*#__PURE__*/ + function () { + function _class() { + _classCallCheck(this, _class); + + this.init.apply(this, arguments); + } + + _createClass(_class, [{ + key: "init", + value: function init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + } + }, { + key: "valueOf", + value: function valueOf() { + return this.value; + } + }, { + key: "toArray", + value: function toArray() { + return [this.value]; + } + }]); + + return _class; + }(); + + Morphable.TransformBag = + /*#__PURE__*/ + function () { + function _class2() { + _classCallCheck(this, _class2); + + this.init.apply(this, arguments); + } + + _createClass(_class2, [{ + key: "init", + value: function init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + + Object.assign(this, Morphable.TransformBag.defaults, obj); + } + }, { + key: "toArray", + value: function toArray() { + var v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } + }]); + + return _class2; + }(); + + Morphable.TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 + }; + + Morphable.ObjectBag = + /*#__PURE__*/ + function () { + function _class3() { + _classCallCheck(this, _class3); + + this.init.apply(this, arguments); + } + + _createClass(_class3, [{ + key: "init", + value: function init(objOrArr) { + this.values = []; + + if (Array.isArray(objOrArr)) { + this.values = objOrArr; + return; + } + + var entries = Object.entries(objOrArr || {}).sort(function (a, b) { + return a[0] - b[0]; + }); + this.values = entries.reduce(function (last, curr) { + return last.concat(curr); + }, []); + } + }, { + key: "valueOf", + value: function valueOf() { + var obj = {}; + var arr = this.values; + + for (var i = 0, len = arr.length; i < len; i += 2) { + obj[arr[i]] = arr[i + 1]; + } + + return obj; + } + }, { + key: "toArray", + value: function toArray() { + return this.values; + } + }]); + + return _class3; + }(); + + var morphableTypes = [SVGNumber, Color, Box$1, Matrix, SVGArray, PointArray$1, PathArray, Morphable.NonMorphable, Morphable.TransformBag, Morphable.ObjectBag]; + extend$1(morphableTypes, { + to: function to(val, args) { + return new Morphable().type(this.constructor).from(this.valueOf()).to(val, args); + }, + fromArray: function fromArray(arr) { + this.init(arr); + return this; + } + }); + + var time = window.performance || Date; + + var makeSchedule = function makeSchedule(runnerInfo) { + var start = runnerInfo.start; + var duration = runnerInfo.runner.duration(); + var end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + }; + }; + + var Timeline = + /*#__PURE__*/ + function () { + // Construct a new timeline on the given element + function Timeline() { + _classCallCheck(this, Timeline); + + this._timeSource = function () { + return time.now(); + }; + + this._dispatcher = document.createElement('div'); // Store the timing variables + + this._startTime = 0; + this._speed = 1.0; // Play control variables control how the animation proceeds + + this._reverse = false; + this._persist = 0; // Keep track of the running animations and their starting parameters + + this._nextFrame = null; + this._paused = false; + this._runners = []; + this._order = []; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + } + + _createClass(Timeline, [{ + key: "getEventTarget", + value: function getEventTarget() { + return this._dispatcher; + } + /**
+ *
+ */ + // schedules a runner on the timeline + + }, { + key: "schedule", + value: function schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule).sort(function (a, b) { + return a.start - b.start || a.duration - b.duration; + }); + } + + if (!this.active()) { + this._step(); + + if (when == null) { + when = 'now'; + } + } // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations direclty + + + var absoluteStartTime = 0; + delay = delay || 0; // Work out when to start the animation + + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = this._startTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + var runnerInfo = this._runners[runner.id]; + + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else { + throw new Error('Invalid value for the "when" parameter'); + } // Manage runner + + + runner.unschedule(); + runner.timeline(this); + runner.time(-delay); // Save startTime for next runner + + this._startTime = absoluteStartTime + runner.duration() + delay; // Save runnerInfo + + this._runners[runner.id] = { + persist: this.persist(), + runner: runner, + start: absoluteStartTime // Save order and continue + + }; + + this._order.push(runner.id); + + this._continue(); + + return this; + } // Remove the runner from this timeline + + }, { + key: "unschedule", + value: function unschedule(runner) { + var index = this._order.indexOf(runner.id); + + if (index < 0) return this; + delete this._runners[runner.id]; + + this._order.splice(index, 1); + + runner.timeline(null); + return this; + } + }, { + key: "play", + value: function play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this._continue(); + } + }, { + key: "pause", + value: function pause() { + // Cancel the next animation frame and pause + this._nextFrame = null; + this._paused = true; + return this; + } + }, { + key: "stop", + value: function stop() { + // Cancel the next animation frame and go to start + this.seek(-this._time); + return this.pause(); + } + }, { + key: "finish", + value: function finish() { + this.seek(Infinity); + return this.pause(); + } + }, { + key: "speed", + value: function speed(_speed) { + if (_speed == null) return this._speed; + this._speed = _speed; + return this; + } + }, { + key: "reverse", + value: function reverse(yes) { + var currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + var positive = Math.abs(currentSpeed); + return this.speed(yes ? positive : -positive); + } + }, { + key: "seek", + value: function seek(dt) { + this._time += dt; + return this._continue(); + } + }, { + key: "time", + value: function time(_time) { + if (_time == null) return this._time; + this._time = _time; + return this; + } + }, { + key: "persist", + value: function persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + }, { + key: "source", + value: function source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } + }, { + key: "_step", + value: function _step() { + // If the timeline is paused, just do nothing + if (this._paused) return; // Get the time delta from the last time and update the time + // TODO: Deal with window.blur window.focus to pause animations + + var time = this._timeSource(); + + var dtSource = time - this._lastSourceTime; + var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; // Update the time + + this._time += dtTime; + this._lastStepTime = this._time; // this.fire('time', this._time) + // Run all of the runners directly + + var runnersLeft = false; + + for (var i = 0, len = this._order.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + var runnerInfo = this._runners[this._order[i]]; + var runner = runnerInfo.runner; + var dt = dtTime; // Make sure that we give the actual difference + // between runner start time and now + + var dtToStart = this._time - runnerInfo.start; // Dont run runner if not started yet + + if (dtToStart < 0) { + runnersLeft = true; + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + + if (!runner.active()) continue; // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + + var finished = runner.step(dt).done; + + if (!finished) { + runnersLeft = true; // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + // TODO: Figure out end time of runner + var endTime = runner.duration() - runner.time() + this._time; + + if (endTime + this._persist < this._time) { + // Delete runner and correct index + delete this._runners[this._order[i]]; + this._order.splice(i--, 1) && --len; + runner.timeline(null); + } + } + } // Get the next animation frame to keep the simulation going + + + if (runnersLeft) { + this._nextFrame = Animator.frame(this._step.bind(this)); + } else { + this._nextFrame = null; + } + + return this; + } // Checks if we are running and continues the animation + + }, { + key: "_continue", + value: function _continue() { + if (this._paused) return this; + + if (!this._nextFrame) { + this._nextFrame = Animator.frame(this._step.bind(this)); + } + + return this; + } + }, { + key: "active", + value: function active() { + return !!this._nextFrame; + } + }]); + + return Timeline; + }(); + Timeline.constructors = { + Element: { + timeline: function timeline() { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } + } }; - // FIXME: What is this doing here?
- // easing = {
- // '-': function (pos) { return pos },
- // '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },
- // '>': function (pos) { return Math.sin(pos * Math.PI / 2) },
- // '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }
- // }
-
- class Runner {
- constructor (options) {
- // Store a unique id on the runner, so that we can identify it later
- this.id = Runner.id++;
-
- // Ensure a default value
- options = options == null
- ? timeline.duration
- : options;
-
- // Ensure that we get a controller
- options = typeof options === 'function'
- ? new Controller(options)
- : options;
-
- // Declare all of the variables
- this._element = null;
- this._timeline = null;
- this.done = false;
- this._queue = [];
-
- // Work out the stepper and the duration
- this._duration = typeof options === 'number' && options;
- this._isDeclarative = options instanceof Controller;
- this._stepper = this._isDeclarative ? options : new Ease();
-
- // We copy the current values from the timeline because they can change
- this._history = {};
-
- // Store the state of the runner
- this.enabled = true;
- this._time = 0;
- this._last = 0;
-
- // Save transforms applied to this runner
- this.transforms = new Matrix();
- this.transformId = 1;
-
- // Looping variables
- this._haveReversed = false;
- this._reverse = false;
- this._loopsDone = 0;
- this._swing = false;
- this._wait = 0;
- this._times = 1;
- }
-
+ // easing = { + // '-': function (pos) { return pos }, + // '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 }, + // '>': function (pos) { return Math.sin(pos * Math.PI / 2) }, + // '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 } + // } + + var Runner = + /*#__PURE__*/ + function () { + function Runner(options) { + _classCallCheck(this, Runner); + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; // Ensure a default value + + options = options == null ? timeline.duration : options; // Ensure that we get a controller + + options = typeof options === 'function' ? new Controller(options) : options; // Declare all of the variables + + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; // Work out the stepper and the duration + + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); // We copy the current values from the timeline because they can change + + this._history = {}; // Store the state of the runner + + this.enabled = true; + this._time = 0; + this._last = 0; // Save transforms applied to this runner + + this.transforms = new Matrix(); + this.transformId = 1; // Looping variables + + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + } /*
Runner Definitions
==================
These methods help us define the runtime behaviour of the Runner or they
help us make new runners from the current runner
- */
-
- element (element) {
- if (element == null) return this._element
- this._element = element;
- element._prepareRunner();
- return this
- }
-
- timeline (timeline$$1) {
- // check explicitly for undefined so we can set the timeline to null
- if (typeof timeline$$1 === 'undefined') return this._timeline
- this._timeline = timeline$$1;
- return this
- }
-
- animate (duration, delay, when) {
- var o = Runner.sanitise(duration, delay, when);
- var runner = new Runner(o.duration);
- if (this._timeline) runner.timeline(this._timeline);
- if (this._element) runner.element(this._element);
- return runner.loop(o).schedule(delay, when)
- }
-
- schedule (timeline$$1, delay, when) {
- // The user doesn't need to pass a timeline if we already have one
- if (!(timeline$$1 instanceof Timeline)) {
- when = delay;
- delay = timeline$$1;
- timeline$$1 = this.timeline();
- }
-
- // If there is no timeline, yell at the user...
- if (!timeline$$1) {
- throw Error('Runner cannot be scheduled without timeline')
- }
-
- // Schedule the runner on the timeline provided
- timeline$$1.schedule(this, delay, when);
- return this
- }
-
- unschedule () {
- var timeline$$1 = this.timeline();
- timeline$$1 && timeline$$1.unschedule(this);
- return this
- }
-
- loop (times, swing, wait) {
- // Deal with the user passing in an object
- if (typeof times === 'object') {
- swing = times.swing;
- wait = times.wait;
- times = times.times;
- }
-
- // Sanitise the values and store them
- this._times = times || Infinity;
- this._swing = swing || false;
- this._wait = wait || 0;
- return this
- }
-
- delay (delay) {
- return this.animate(0, delay)
- }
-
- /*
- Basic Functionality
- ===================
- These methods allow us to attach basic functions to the runner directly
- */
-
- queue (initFn, runFn, isTransform) {
- this._queue.push({
- initialiser: initFn || noop,
- runner: runFn || noop,
- isTransform: isTransform,
- initialised: false,
- finished: false
- });
- var timeline$$1 = this.timeline();
- timeline$$1 && this.timeline()._continue();
- return this
- }
-
- during (fn) {
- return this.queue(null, fn)
- }
-
- after (fn) {
- return this.on('finish', fn)
- }
-
- /*
- Runner animation methods
- ========================
- Control how the animation plays
- */
-
- time (time) {
- if (time == null) {
- return this._time
- }
- let dt = time - this._time;
- this.step(dt);
- return this
- }
-
- duration () {
- return this._times * (this._wait + this._duration) - this._wait
- }
-
- loops (p) {
- var loopDuration = this._duration + this._wait;
- if (p == null) {
- var loopsDone = Math.floor(this._time / loopDuration);
- var relativeTime = (this._time - loopsDone * loopDuration);
- var position = relativeTime / this._duration;
- return Math.min(loopsDone + position, this._times)
- }
- var whole = Math.floor(p);
- var partial = p % 1;
- var time = loopDuration * whole + this._duration * partial;
- return this.time(time)
- }
-
- position (p) {
- // Get all of the variables we need
- var x = this._time;
- var d = this._duration;
- var w = this._wait;
- var t = this._times;
- var s = this._swing;
- var r = this._reverse;
- var position;
-
- if (p == null) {
- /*
- This function converts a time to a position in the range [0, 1]
- The full explanation can be found in this desmos demonstration
- https://www.desmos.com/calculator/u4fbavgche
- The logic is slightly simplified here because we can use booleans
- */
-
- // Figure out the value without thinking about the start or end time
- const f = function (x) {
- var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d));
- var backwards = (swinging && !r) || (!swinging && r);
- var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards;
- var clipped = Math.max(Math.min(uncliped, 1), 0);
- return clipped
- };
-
- // Figure out the value by incorporating the start time
- var endTime = t * (w + d) - w;
- position = x <= 0 ? Math.round(f(1e-5))
- : x < endTime ? f(x)
- : Math.round(f(endTime - 1e-5));
- return position
- }
-
- // Work out the loops done and add the position to the loops done
- var loopsDone = Math.floor(this.loops());
- var swingForward = s && (loopsDone % 2 === 0);
- var forwards = (swingForward && !r) || (r && swingForward);
- position = loopsDone + (forwards ? p : 1 - p);
- return this.loops(position)
- }
-
- progress (p) {
- if (p == null) {
- return Math.min(1, this._time / this.duration())
- }
- return this.time(p * this.duration())
- }
-
- step (dt) {
- // If we are inactive, this stepper just gets skipped
- if (!this.enabled) return this
-
- // Update the time and get the new position
- dt = dt == null ? 16 : dt;
- this._time += dt;
- var position = this.position();
-
- // Figure out if we need to run the stepper in this frame
- var running = this._lastPosition !== position && this._time >= 0;
- this._lastPosition = position;
-
- // Figure out if we just started
- var duration = this.duration();
- var justStarted = this._lastTime < 0 && this._time > 0;
- var justFinished = this._lastTime < this._time && this.time > duration;
- this._lastTime = this._time;
-
- // Work out if the runner is finished set the done flag here so animations
- // know, that they are running in the last step (this is good for
- // transformations which can be merged)
- var declarative = this._isDeclarative;
- this.done = !declarative && !justFinished && this._time >= duration;
-
- // Call initialise and the run function
- if (running || declarative) {
- this._initialise(running);
-
- // clear the transforms on this runner so they dont get added again and again
- this.transforms = new Matrix();
- var converged = this._run(declarative ? dt : position);
- // this.fire('step', this)
- }
- // correct the done flag here
- // declaritive animations itself know when they converged
- this.done = this.done || (converged && declarative);
- // if (this.done) {
- // this.fire('finish', this)
- // }
- return this
- }
-
- finish () {
- return this.step(Infinity)
- }
-
- reverse (reverse) {
- this._reverse = reverse == null ? !this._reverse : reverse;
- return this
- }
-
- ease (fn) {
- this._stepper = new Ease(fn);
- return this
- }
-
- active (enabled) {
- if (enabled == null) return this.enabled
- this.enabled = enabled;
- return this
- }
-
- /*
- Private Methods
- ===============
- Methods that shouldn't be used externally
- */
-
- // Save a morpher to the morpher list so that we can retarget it later
- _rememberMorpher (method, morpher) {
- this._history[method] = {
- morpher: morpher,
- caller: this._queue[this._queue.length - 1]
- };
- }
-
- // Try to set the target for a morpher if the morpher exists, otherwise
- // do nothing and return false
- _tryRetarget (method, target) {
- if (this._history[method]) {
- // if the last method wasnt even initialised, throw it away
- if (!this._history[method].caller.initialised) {
- let index = this._queue.indexOf(this._history[method].caller);
- this._queue.splice(index, 1);
- return false
- }
-
- // for the case of transformations, we use the special retarget function
- // which has access to the outer scope
- if (this._history[method].caller.isTransform) {
- this._history[method].caller.isTransform(target);
- // for everything else a simple morpher change is sufficient
- } else {
- this._history[method].morpher.to(target);
- }
-
- this._history[method].caller.finished = false;
- var timeline$$1 = this.timeline();
- timeline$$1 && timeline$$1._continue();
- return true
- }
- return false
- }
-
- // Run each initialise function in the runner if required
- _initialise (running) {
- // If we aren't running, we shouldn't initialise when not declarative
- if (!running && !this._isDeclarative) return
-
- // Loop through all of the initialisers
- for (var i = 0, len = this._queue.length; i < len; ++i) {
- // Get the current initialiser
- var current = this._queue[i];
-
- // Determine whether we need to initialise
- var needsIt = this._isDeclarative || (!current.initialised && running);
- running = !current.finished;
-
- // Call the initialiser if we need to
- if (needsIt && running) {
- current.initialiser.call(this);
- current.initialised = true;
- }
- }
- }
-
- // Run each run function for the position or dt given
- _run (positionOrDt) {
- // Run all of the _queue directly
- var allfinished = true;
- for (var i = 0, len = this._queue.length; i < len; ++i) {
- // Get the current function to run
- var current = this._queue[i];
-
- // Run the function if its not finished, we keep track of the finished
- // flag for the sake of declarative _queue
- var converged = current.runner.call(this, positionOrDt);
- current.finished = current.finished || (converged === true);
- allfinished = allfinished && current.finished;
- }
-
- // We report when all of the constructors are finished
- return allfinished
- }
-
- addTransform (transform, index) {
- this.transforms.lmultiplyO(transform);
- return this
- }
-
- clearTransform () {
- this.transforms = new Matrix();
- return this
- }
-
- static sanitise (duration, delay, when) {
- // Initialise the default parameters
- var times = 1;
- var swing = false;
- var wait = 0;
- duration = duration || timeline.duration;
- delay = delay || timeline.delay;
- when = when || 'last';
-
- // If we have an object, unpack the values
- if (typeof duration === 'object' && !(duration instanceof Stepper)) {
- delay = duration.delay || delay;
- when = duration.when || when;
- swing = duration.swing || swing;
- times = duration.times || times;
- wait = duration.wait || wait;
- duration = duration.duration || timeline.duration;
- }
-
- return {
- duration: duration,
- delay: delay,
- swing: swing,
- times: times,
- wait: wait,
- when: when
- }
- }
- }
-
- Runner.id = 0;
-
- class FakeRunner{
- constructor (transforms = new Matrix(), id = -1, done = true) {
- this.transforms = transforms;
- this.id = id;
- this.done = done;
- }
- }
-
- extend$1([Runner, FakeRunner], {
- mergeWith (runner) {
- return new FakeRunner(
- runner.transforms.lmultiply(this.transforms),
- runner.id
- )
- }
- });
-
- // FakeRunner.emptyRunner = new FakeRunner()
-
- const lmultiply = (last, curr) => last.lmultiplyO(curr);
- const getRunnerTransform = (runner) => runner.transforms;
-
- function mergeTransforms () {
- // Find the matrix to apply to the element and apply it
- let runners = this._transformationRunners.runners;
- let netTransform = runners
- .map(getRunnerTransform)
- .reduce(lmultiply, new Matrix());
-
- this.transform(netTransform);
-
- this._transformationRunners.merge();
-
- if (this._transformationRunners.length() === 1) {
- this._frameId = null;
- }
- }
-
- class RunnerArray {
- constructor () {
- this.runners = [];
- this.ids = [];
- }
-
- add (runner) {
- if (this.runners.includes(runner)) return
-
- let id = runner.id + 1;
-
- let leftSibling = this.ids.reduce((last, curr) => {
- if (curr > last && curr < id) return curr
- return last
- }, 0);
-
- let index = this.ids.indexOf(leftSibling) + 1;
-
- this.ids.splice(index, 0, id);
- this.runners.splice(index, 0, runner);
-
- return this
- }
-
- getByID (id) {
- return this.runners[this.ids.indexOf(id + 1)]
- }
-
- remove (id) {
- let index = this.ids.indexOf(id + 1);
- this.ids.splice(index, 1);
- this.runners.splice(index, 1);
- return this
- }
-
- merge () {
- let lastRunner = null;
- this.runners.forEach((runner, i) => {
- if (lastRunner && runner.done && lastRunner.done) {
- this.remove(runner.id);
- this.edit(lastRunner.id, runner.mergeWith(lastRunner));
- }
-
- lastRunner = runner;
- });
-
- return this
- }
-
- edit (id, newRunner) {
- let index = this.ids.indexOf(id + 1);
- this.ids.splice(index, 1, id);
- this.runners.splice(index, 1, newRunner);
- return this
- }
-
- length () {
- return this.ids.length
- }
-
- clearBefore (id) {
- let deleteCnt = this.ids.indexOf(id + 1) || 1;
- this.ids.splice(0, deleteCnt, 0);
- this.runners.splice(0, deleteCnt, new FakeRunner());
- return this
- }
- }
-
- let frameId = 0;
- Runner.constructors = {
- Element: {
- animate (duration, delay, when) {
- var o = Runner.sanitise(duration, delay, when);
- var timeline$$1 = this.timeline();
- return new Runner(o.duration)
- .loop(o)
- .element(this)
- .timeline(timeline$$1)
- .schedule(delay, when)
- },
-
- delay (by, when) {
- return this.animate(0, by, when)
- },
-
- // this function searches for all runners on the element and deletes the ones
- // which run before the current one. This is because absolute transformations
- // overwfrite anything anyway so there is no need to waste time computing
- // other runners
- _clearTransformRunnersBefore (currentRunner) {
- this._transformationRunners.clearBefore(currentRunner.id);
- },
-
- _currentTransform (current) {
- return this._transformationRunners.runners
- // we need the equal sign here to make sure, that also transformations
- // on the same runner which execute before the current transformation are
- // taken into account
- .filter((runner) => runner.id <= current.id)
- .map(getRunnerTransform)
- .reduce(lmultiply, new Matrix())
- },
-
- addRunner (runner) {
- this._transformationRunners.add(runner);
-
- Animator.transform_frame(
- mergeTransforms.bind(this), this._frameId
- );
- },
-
- _prepareRunner () {
- if (this._frameId == null) {
- this._transformationRunners = new RunnerArray()
- .add(new FakeRunner(new Matrix(this)));
-
- this._frameId = frameId++;
- }
- }
- }
- };
-
-
- extend$1(Runner, {
- attr (a, v) {
- return this.styleAttr('attr', a, v)
- },
-
- // Add animatable styles
- css (s, v) {
- return this.styleAttr('css', s, v)
- },
-
- styleAttr (type, name, val) {
- // apply attributes individually
- if (typeof name === 'object') {
- for (var key in val) {
- this.styleAttr(type, key, val[key]);
- }
- }
-
- var morpher = new Morphable(this._stepper).to(val);
-
- this.queue(function () {
- morpher = morpher.from(this.element()[type](name));
- }, function (pos) {
- this.element()[type](name, morpher.at(pos));
- return morpher.done()
- });
-
- return this
- },
-
- zoom (level, point) {
- var morpher = new Morphable(this._stepper).to(new SVGNumber(level));
-
- this.queue(function () {
- morpher = morpher.from(this.zoom());
- }, function (pos) {
- this.element().zoom(morpher.at(pos), point);
- return morpher.done()
- });
-
- return this
- },
-
+ */ + + + _createClass(Runner, [{ + key: "element", + value: function element(_element) { + if (_element == null) return this._element; + this._element = _element; + + _element._prepareRunner(); + + return this; + } + }, { + key: "timeline", + value: function timeline$$1(_timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof _timeline === 'undefined') return this._timeline; + this._timeline = _timeline; + return this; + } + }, { + key: "animate", + value: function animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(delay, when); + } + }, { + key: "schedule", + value: function schedule(timeline$$1, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline$$1 instanceof Timeline)) { + when = delay; + delay = timeline$$1; + timeline$$1 = this.timeline(); + } // If there is no timeline, yell at the user... + + + if (!timeline$$1) { + throw Error('Runner cannot be scheduled without timeline'); + } // Schedule the runner on the timeline provided + + + timeline$$1.schedule(this, delay, when); + return this; + } + }, { + key: "unschedule", + value: function unschedule() { + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1.unschedule(this); + return this; + } + }, { + key: "loop", + value: function loop(times, swing, wait) { + // Deal with the user passing in an object + if (_typeof(times) === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } // Sanitise the values and store them + + + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + return this; + } + }, { + key: "delay", + value: function delay(_delay) { + return this.animate(0, _delay); + } + /*
+ Basic Functionality
+ ===================
+ These methods allow us to attach basic functions to the runner directly
+ */ + + }, { + key: "queue", + value: function queue(initFn, runFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + isTransform: isTransform, + initialised: false, + finished: false + }); + + var timeline$$1 = this.timeline(); + timeline$$1 && this.timeline()._continue(); + return this; + } + }, { + key: "during", + value: function during(fn) { + return this.queue(null, fn); + } + }, { + key: "after", + value: function after(fn) { + return this.on('finish', fn); + } + /*
+ Runner animation methods
+ ========================
+ Control how the animation plays
+ */ + + }, { + key: "time", + value: function time(_time) { + if (_time == null) { + return this._time; + } + + var dt = _time - this._time; + this.step(dt); + return this; + } + }, { + key: "duration", + value: function duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + }, { + key: "loops", + value: function loops(p) { + var loopDuration = this._duration + this._wait; + + if (p == null) { + var loopsDone = Math.floor(this._time / loopDuration); + var relativeTime = this._time - loopsDone * loopDuration; + var position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } + + var whole = Math.floor(p); + var partial = p % 1; + var time = loopDuration * whole + this._duration * partial; + return this.time(time); + } + }, { + key: "position", + value: function position(p) { + // Get all of the variables we need + var x = this._time; + var d = this._duration; + var w = this._wait; + var t = this._times; + var s = this._swing; + var r = this._reverse; + var position; + + if (p == null) { + /*
+ This function converts a time to a position in the range [0, 1]
+ The full explanation can be found in this desmos demonstration
+ https://www.desmos.com/calculator/u4fbavgche
+ The logic is slightly simplified here because we can use booleans
+ */ + // Figure out the value without thinking about the start or end time + var f = function f(x) { + var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); + var backwards = swinging && !r || !swinging && r; + var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; + var clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; // Figure out the value by incorporating the start time + + + var endTime = t * (w + d) - w; + position = x <= 0 ? Math.round(f(1e-5)) : x < endTime ? f(x) : Math.round(f(endTime - 1e-5)); + return position; + } // Work out the loops done and add the position to the loops done + + + var loopsDone = Math.floor(this.loops()); + var swingForward = s && loopsDone % 2 === 0; + var forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } + }, { + key: "progress", + value: function progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } + + return this.time(p * this.duration()); + } + }, { + key: "step", + value: function step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; // Update the time and get the new position + + dt = dt == null ? 16 : dt; + this._time += dt; + var position = this.position(); // Figure out if we need to run the stepper in this frame + + var running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; // Figure out if we just started + + var duration = this.duration(); + var justStarted = this._lastTime < 0 && this._time > 0; + var justFinished = this._lastTime < this._time && this.time > duration; + this._lastTime = this._time; + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + + + var declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; // Call initialise and the run function + + if (running || declarative) { + this._initialise(running); // clear the transforms on this runner so they dont get added again and again + + + this.transforms = new Matrix(); + + var converged = this._run(declarative ? dt : position); // this.fire('step', this) + + } // correct the done flag here + // declaritive animations itself know when they converged + + + this.done = this.done || converged && declarative; // if (this.done) { + // this.fire('finish', this) + // } + + return this; + } + }, { + key: "finish", + value: function finish() { + return this.step(Infinity); + } + }, { + key: "reverse", + value: function reverse(_reverse) { + this._reverse = _reverse == null ? !this._reverse : _reverse; + return this; + } + }, { + key: "ease", + value: function ease(fn) { + this._stepper = new Ease(fn); + return this; + } + }, { + key: "active", + value: function active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + /*
+ Private Methods
+ ===============
+ Methods that shouldn't be used externally
+ */ + // Save a morpher to the morpher list so that we can retarget it later + + }, { + key: "_rememberMorpher", + value: function _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + } // Try to set the target for a morpher if the morpher exists, otherwise + // do nothing and return false + + }, { + key: "_tryRetarget", + value: function _tryRetarget(method, target) { + if (this._history[method]) { + // if the last method wasnt even initialised, throw it away + if (!this._history[method].caller.initialised) { + var index = this._queue.indexOf(this._history[method].caller); + + this._queue.splice(index, 1); + + return false; + } // for the case of transformations, we use the special retarget function + // which has access to the outer scope + + + if (this._history[method].caller.isTransform) { + this._history[method].caller.isTransform(target); // for everything else a simple morpher change is sufficient + + } else { + this._history[method].morpher.to(target); + } + + this._history[method].caller.finished = false; + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1._continue(); + return true; + } + + return false; + } // Run each initialise function in the runner if required + + }, { + key: "_initialise", + value: function _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; // Loop through all of the initialisers + + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + var current = this._queue[i]; // Determine whether we need to initialise + + var needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; // Call the initialiser if we need to + + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } // Run each run function for the position or dt given + + }, { + key: "_run", + value: function _run(positionOrDt) { + // Run all of the _queue directly + var allfinished = true; + + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + var current = this._queue[i]; // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + + var converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } // We report when all of the constructors are finished + + + return allfinished; + } + }, { + key: "addTransform", + value: function addTransform(transform, index) { + this.transforms.lmultiplyO(transform); + return this; + } + }, { + key: "clearTransform", + value: function clearTransform() { + this.transforms = new Matrix(); + return this; + } + }], [{ + key: "sanitise", + value: function sanitise(duration, delay, when) { + // Initialise the default parameters + var times = 1; + var swing = false; + var wait = 0; + duration = duration || timeline.duration; + delay = delay || timeline.delay; + when = when || 'last'; // If we have an object, unpack the values + + if (_typeof(duration) === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay || delay; + when = duration.when || when; + swing = duration.swing || swing; + times = duration.times || times; + wait = duration.wait || wait; + duration = duration.duration || timeline.duration; + } + + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } + }]); + + return Runner; + }(); + Runner.id = 0; + + var FakeRunner = function FakeRunner() { + var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Matrix(); + var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; + var done = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + _classCallCheck(this, FakeRunner); + + this.transforms = transforms; + this.id = id; + this.done = done; + }; + + extend$1([Runner, FakeRunner], { + mergeWith: function mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } + }); // FakeRunner.emptyRunner = new FakeRunner() + + var lmultiply = function lmultiply(last, curr) { + return last.lmultiplyO(curr); + }; + + var getRunnerTransform = function getRunnerTransform(runner) { + return runner.transforms; + }; + + function mergeTransforms() { + // Find the matrix to apply to the element and apply it + var runners = this._transformationRunners.runners; + var netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + + this._transformationRunners.merge(); + + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } + } + + var RunnerArray = + /*#__PURE__*/ + function () { + function RunnerArray() { + _classCallCheck(this, RunnerArray); + + this.runners = []; + this.ids = []; + } + + _createClass(RunnerArray, [{ + key: "add", + value: function add(runner) { + if (this.runners.includes(runner)) return; + var id = runner.id + 1; + var leftSibling = this.ids.reduce(function (last, curr) { + if (curr > last && curr < id) return curr; + return last; + }, 0); + var index = this.ids.indexOf(leftSibling) + 1; + this.ids.splice(index, 0, id); + this.runners.splice(index, 0, runner); + return this; + } + }, { + key: "getByID", + value: function getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + }, { + key: "remove", + value: function remove(id) { + var index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } + }, { + key: "merge", + value: function merge() { + var _this = this; + + var lastRunner = null; + this.runners.forEach(function (runner, i) { + if (lastRunner && runner.done && lastRunner.done) { + _this.remove(runner.id); + + _this.edit(lastRunner.id, runner.mergeWith(lastRunner)); + } + + lastRunner = runner; + }); + return this; + } + }, { + key: "edit", + value: function edit(id, newRunner) { + var index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id); + this.runners.splice(index, 1, newRunner); + return this; + } + }, { + key: "length", + value: function length() { + return this.ids.length; + } + }, { + key: "clearBefore", + value: function clearBefore(id) { + var deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()); + return this; + } + }]); + + return RunnerArray; + }(); + + var frameId = 0; + Runner.constructors = { + Element: { + animate: function animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var timeline$$1 = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline$$1).schedule(delay, when); + }, + delay: function delay(by, when) { + return this.animate(0, by, when); + }, + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwfrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore: function _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + _currentTransform: function _currentTransform(current) { + return this._transformationRunners.runners // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(function (runner) { + return runner.id <= current.id; + }).map(getRunnerTransform).reduce(lmultiply, new Matrix()); + }, + addRunner: function addRunner(runner) { + this._transformationRunners.add(runner); + + Animator.transform_frame(mergeTransforms.bind(this), this._frameId); + }, + _prepareRunner: function _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + this._frameId = frameId++; + } + } + } + }; + extend$1(Runner, { + attr: function attr(a, v) { + return this.styleAttr('attr', a, v); + }, + // Add animatable styles + css: function css(s, v) { + return this.styleAttr('css', s, v); + }, + styleAttr: function styleAttr(type, name, val) { + // apply attributes individually + if (_typeof(name) === 'object') { + for (var key in val) { + this.styleAttr(type, key, val[key]); + } + } + + var morpher = new Morphable(this._stepper).to(val); + this.queue(function () { + morpher = morpher.from(this.element()[type](name)); + }, function (pos) { + this.element()[type](name, morpher.at(pos)); + return morpher.done(); + }); + return this; + }, + zoom: function zoom(level, point) { + var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done(); + }); + return this; + }, + /**
** absolute transformations
- **/
-
- //
- // M v -----|-----(D M v = F v)------|-----> T v
- //
- // 1. define the final state (T) and decompose it (once)
- // t = [tx, ty, the, lam, sy, sx]
- // 2. on every frame: pull the current state of all previous transforms
- // (M - m can change)
- // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]
- // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)
- // - Note F(0) = M
- // - Note F(1) = T
- // 4. Now you get the delta matrix as a result: D = F * inv(M)
-
- transform (transforms, relative, affine) {
- // If we have a declarative function, we should retarget it if possible
- relative = transforms.relative || relative;
- if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {
- return this
- }
-
- // Parse the parameters
- var isMatrix = isMatrixLike(transforms);
- affine = transforms.affine != null
- ? transforms.affine
- : (affine != null ? affine : !isMatrix);
-
- // Create a morepher and set its type
- const morpher = new Morphable()
- .type(affine ? Morphable.TransformBag : Matrix)
- .stepper(this._stepper);
-
- let origin;
- let element;
- let current;
- let currentAngle;
- let startTransform;
-
- function setup () {
- // make sure element and origin is defined
- element = element || this.element();
- origin = origin || getOrigin(transforms, element);
-
- startTransform = new Matrix(relative ? undefined : element);
-
- // add the runner to the element so it can merge transformations
- element.addRunner(this);
-
- // Deactivate all transforms that have run so far if we are absolute
- if (!relative) {
- element._clearTransformRunnersBefore(this);
- }
- }
-
- function run (pos) {
- // clear all other transforms before this in case something is saved
- // on this runner. We are absolute. We dont need these!
- if (!relative) this.clearTransform();
-
- let {x, y} = new Point(origin).transform(element._currentTransform(this));
-
- let target = new Matrix({...transforms, origin: [x, y]});
- let start = this._isDeclarative && current
- ? current
- : startTransform;
-
- if (affine) {
- target = target.decompose(x, y);
- start = start.decompose(x, y);
-
- // Get the current and target angle as it was set
- const rTarget = target.rotate;
- const rCurrent = start.rotate;
-
- // Figure out the shortest path to rotate directly
- const possibilities = [rTarget - 360, rTarget, rTarget + 360];
- const distances = possibilities.map(a => Math.abs(a - rCurrent));
- const shortest = Math.min(...distances);
- const index = distances.indexOf(shortest);
- target.rotate = possibilities[index];
- }
-
- if (relative) {
- // we have to be careful here not to overwrite the rotation
- // with the rotate method of Matrix
- if (!isMatrix) {
- target.rotate = transforms.rotate || 0;
- }
- if (this._isDeclarative && currentAngle) {
- start.rotate = currentAngle;
- }
- }
-
- morpher.from(start);
- morpher.to(target);
-
- let affineParameters = morpher.at(pos);
- currentAngle = affineParameters.rotate;
- current = new Matrix(affineParameters);
-
- this.addTransform(current);
- return morpher.done()
- }
-
- function retarget (newTransforms) {
- // only get a new origin if it changed since the last call
- if (
- (newTransforms.origin || 'center').toString() !==
- (transforms.origin || 'center').toString()
- ) {
- origin = getOrigin(transforms, element);
- }
-
- // overwrite the old transformations with the new ones
- transforms = {...newTransforms, origin};
- }
-
- this.queue(setup, run, retarget);
- this._isDeclarative && this._rememberMorpher('transform', morpher);
- return this
- },
-
- // Animatable x-axis
- x (x, relative) {
- return this._queueNumber('x', x)
- },
-
- // Animatable y-axis
- y (y) {
- return this._queueNumber('y', y)
- },
-
- dx (x) {
- return this._queueNumberDelta('dx', x)
- },
-
- dy (y) {
- return this._queueNumberDelta('dy', y)
- },
-
- _queueNumberDelta (method, to) {
- to = new SVGNumber(to);
-
- // Try to change the target if we have this method already registerd
- if (this._tryRetargetDelta(method, to)) return this
-
- // Make a morpher and queue the animation
- var morpher = new Morphable(this._stepper).to(to);
- this.queue(function () {
- var from = this.element()[method]();
- morpher.from(from);
- morpher.to(from + to);
- }, function (pos) {
- this.element()[method](morpher.at(pos));
- return morpher.done()
- });
-
- // Register the morpher so that if it is changed again, we can retarget it
- this._rememberMorpher(method, morpher);
- return this
- },
-
- _queueObject (method, to) {
- // Try to change the target if we have this method already registerd
- if (this._tryRetarget(method, to)) return this
-
- // Make a morpher and queue the animation
- var morpher = new Morphable(this._stepper).to(to);
- this.queue(function () {
- morpher.from(this.element()[method]());
- }, function (pos) {
- this.element()[method](morpher.at(pos));
- return morpher.done()
- });
-
- // Register the morpher so that if it is changed again, we can retarget it
- this._rememberMorpher(method, morpher);
- return this
- },
-
- _queueNumber (method, value) {
- return this._queueObject(method, new SVGNumber(value))
- },
-
- // Animatable center x-axis
- cx (x) {
- return this._queueNumber('cx', x)
- },
-
- // Animatable center y-axis
- cy (y) {
- return this._queueNumber('cy', y)
- },
-
- // Add animatable move
- move (x, y) {
- return this.x(x).y(y)
- },
-
- // Add animatable center
- center (x, y) {
- return this.cx(x).cy(y)
- },
-
- // Add animatable size
- size (width, height) {
- // animate bbox based size for all other elements
- var box;
-
- if (!width || !height) {
- box = this._element.bbox();
- }
-
- if (!width) {
- width = box.width / box.height * height;
- }
-
- if (!height) {
- height = box.height / box.width * width;
- }
-
- return this
- .width(width)
- .height(height)
- },
-
- // Add animatable width
- width (width) {
- return this._queueNumber('width', width)
- },
-
- // Add animatable height
- height (height) {
- return this._queueNumber('height', height)
- },
-
- // Add animatable plot
- plot (a, b, c, d) {
- // Lines can be plotted with 4 arguments
- if (arguments.length === 4) {
- return this.plot([a, b, c, d])
- }
-
- // FIXME: this needs to be rewritten such that the element is only accesed
- // in the init function
- return this._queueObject('plot', new this._element.MorphArray(a))
-
+ **/ + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + transform: function transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } // Parse the parameters + + + var isMatrix = isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type + + var morpher = new Morphable().type(affine ? Morphable.TransformBag : Matrix).stepper(this._stepper); + var origin; + var element; + var current; + var currentAngle; + var startTransform; + + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations + + element.addRunner(this); // Deactivate all transforms that have run so far if we are absolute + + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + + var _transform = new Point(origin).transform(element._currentTransform(this)), + x = _transform.x, + y = _transform.y; + + var target = new Matrix(_objectSpread({}, transforms, { + origin: [x, y] + })); + var start = this._isDeclarative && current ? current : startTransform; + + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); // Get the current and target angle as it was set + + var rTarget = target.rotate; + var rCurrent = start.rotate; // Figure out the shortest path to rotate directly + + var possibilities = [rTarget - 360, rTarget, rTarget + 360]; + var distances = possibilities.map(function (a) { + return Math.abs(a - rCurrent); + }); + var shortest = Math.min.apply(Math, _toConsumableArray(distances)); + var index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + + morpher.from(start); + morpher.to(target); + var affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + return morpher.done(); + } + + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(transforms, element); + } // overwrite the old transformations with the new ones + + + transforms = _objectSpread({}, newTransforms, { + origin: origin + }); + } + + this.queue(setup, run, retarget); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + // Animatable x-axis + x: function x(_x, relative) { + return this._queueNumber('x', _x); + }, + // Animatable y-axis + y: function y(_y) { + return this._queueNumber('y', _y); + }, + dx: function dx(x) { + return this._queueNumberDelta('dx', x); + }, + dy: function dy(y) { + return this._queueNumberDelta('dy', y); + }, + _queueNumberDelta: function _queueNumberDelta(method, to) { + to = new SVGNumber(to); // Try to change the target if we have this method already registerd + + if (this._tryRetargetDelta(method, to)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + var from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); + + return this; + }, + _queueObject: function _queueObject(method, to) { + // Try to change the target if we have this method already registerd + if (this._tryRetarget(method, to)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); + + return this; + }, + _queueNumber: function _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + // Animatable center x-axis + cx: function cx(x) { + return this._queueNumber('cx', x); + }, + // Animatable center y-axis + cy: function cy(y) { + return this._queueNumber('cy', y); + }, + // Add animatable move + move: function move(x, y) { + return this.x(x).y(y); + }, + // Add animatable center + center: function center(x, y) { + return this.cx(x).cy(y); + }, + // Add animatable size + size: function size(width, height) { + // animate bbox based size for all other elements + var box; + + if (!width || !height) { + box = this._element.bbox(); + } + + if (!width) { + width = box.width / box.height * height; + } + + if (!height) { + height = box.height / box.width * width; + } + + return this.width(width).height(height); + }, + // Add animatable width + width: function width(_width) { + return this._queueNumber('width', _width); + }, + // Add animatable height + height: function height(_height) { + return this._queueNumber('height', _height); + }, + // Add animatable plot + plot: function plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); + } // FIXME: this needs to be rewritten such that the element is only accesed + // in the init function + + + return this._queueObject('plot', new this._element.MorphArray(a)); /*
var morpher = this._element.morphArray().to(a)
-
- this.queue(function () {
+ this.queue(function () {
morpher.from(this._element.array())
}, function (pos) {
this._element.plot(morpher.at(pos))
})
-
- return this
- */
- },
-
- // Add leading method
- leading (value) {
- return this._queueNumber('leading', value)
- },
-
- // Add animatable viewbox
- viewbox (x, y, width, height) {
- return this._queueObject('viewbox', new Box(x, y, width, height))
- },
-
- update (o) {
- if (typeof o !== 'object') {
- return this.update({
- offset: arguments[0],
- color: arguments[1],
- opacity: arguments[2]
- })
- }
-
- if (o.opacity != null) this.attr('stop-opacity', o.opacity);
- if (o.color != null) this.attr('stop-color', o.color);
- if (o.offset != null) this.attr('offset', o.offset);
-
- return this
- }
+ return this
+ */ + }, + // Add leading method + leading: function leading(value) { + return this._queueNumber('leading', value); + }, + // Add animatable viewbox + viewbox: function viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)); + }, + update: function update(o) { + if (_typeof(o) !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + return this; + } }); - // export {default as Animator} from './Animator.js'
- // export {default as SVGArray} from './SVGArray.js'
- // export {default as Bare} from './Bare.js'
- // export {default as Box} from './Box.js'
- // export {default as Circle} from './Circle.js'
- // export {default as ClipPath} from './ClipPath.js'
- // export {default as Color} from './Color.js'
- // export {default as Container} from './Container.js'
- // export {Controller, Ease, PID, Spring} from './Controller.js'
- // export {default as Defs} from './Defs.js'
- // export {default as Doc} from './Doc.js'
- // export {default as Element} from './Element.js'
- // export {default as Ellipse} from './Ellipse.js'
- // export {default as EventTarget} from './EventTarget.js'
- // export {default as Gradient} from './Gradient.js'
- // export {default as G} from './G.js'
- // export {default as HtmlNode} from './HtmlNode.js'
- // export {default as A} from './A.js'
- // export {default as Image} from './Image.js'
- // export {default as Line} from './Line.js'
- // export {default as Marker} from './Marker.js'
- // export {default as Mask} from './Mask.js'
- // export {default as Matrix} from './Matrix.js'
- // export {default as Morphable} from './Morphable.js'
- // export {default as SVGNumber} from './SVGNumber.js'
- // export {default as Parent} from './Parent.js'
- // export {default as Path} from './Path.js'
- // export {default as PathArray} from './PathArray.js'
- // export {default as Pattern} from './Pattern.js'
- // export {default as Point} from './Point.js'
- // export {default as PointArray} from './PointArray.js'
- // export {default as Polygon} from './Polygon.js'
- // export {default as Polyline} from './Polyline.js'
- // export {default as Queue} from './Queue.js'
- // export {default as Rect} from './Rect.js'
- // export {default as Runner} from './Runner.js'
- // export {default as Shape} from './Shape.js'
- // export {default as Stop} from './Stop.js'
- // export {default as Symbol} from './Symbol.js'
- // export {default as Text} from './Text.js'
- // export {default as TextPath} from './TextPath.js'
- // export {default as Timeline} from './Timeline.js'
+ // export {default as SVGArray} from './SVGArray.js' + // export {default as Bare} from './Bare.js' + // export {default as Box} from './Box.js' + // export {default as Circle} from './Circle.js' + // export {default as ClipPath} from './ClipPath.js' + // export {default as Color} from './Color.js' + // export {default as Container} from './Container.js' + // export {Controller, Ease, PID, Spring} from './Controller.js' + // export {default as Defs} from './Defs.js' + // export {default as Doc} from './Doc.js' + // export {default as Element} from './Element.js' + // export {default as Ellipse} from './Ellipse.js' + // export {default as EventTarget} from './EventTarget.js' + // export {default as Gradient} from './Gradient.js' + // export {default as G} from './G.js' + // export {default as HtmlNode} from './HtmlNode.js' + // export {default as A} from './A.js' + // export {default as Image} from './Image.js' + // export {default as Line} from './Line.js' + // export {default as Marker} from './Marker.js' + // export {default as Mask} from './Mask.js' + // export {default as Matrix} from './Matrix.js' + // export {default as Morphable} from './Morphable.js' + // export {default as SVGNumber} from './SVGNumber.js' + // export {default as Parent} from './Parent.js' + // export {default as Path} from './Path.js' + // export {default as PathArray} from './PathArray.js' + // export {default as Pattern} from './Pattern.js' + // export {default as Point} from './Point.js' + // export {default as PointArray} from './PointArray.js' + // export {default as Polygon} from './Polygon.js' + // export {default as Polyline} from './Polyline.js' + // export {default as Queue} from './Queue.js' + // export {default as Rect} from './Rect.js' + // export {default as Runner} from './Runner.js' + // export {default as Shape} from './Shape.js' + // export {default as Stop} from './Stop.js' + // export {default as Symbol} from './Symbol.js' + // export {default as Text} from './Text.js' + // export {default as TextPath} from './TextPath.js' + // export {default as Timeline} from './Timeline.js' // export {default as Use} from './Use.js' var Classes = /*#__PURE__*/Object.freeze({ @@ -5149,7 +5708,7 @@ var SVG = (function () { Polygon: Polygon, Polyline: Polyline, Rect: Rect, - Symbol: Symbol, + Symbol: _Symbol, Text: Text$1, TextPath: TextPath, Tspan: Tspan, @@ -5185,102 +5744,82 @@ var SVG = (function () { Marker: Marker, Mask: Mask, Pattern: Pattern, - Symbol: Symbol + Symbol: _Symbol }); - // ### This module adds backward / forward functionality to elements.
-
- // Get all siblings, including myself
- function siblings () {
- return this.parent().children()
- }
-
- // Get the curent position siblings
- function position () {
- return this.parent().index(this)
- }
-
- // Get the next element (will return null if there is none)
- function next () {
- return this.siblings()[this.position() + 1]
- }
-
- // Get the next element (will return null if there is none)
- function prev () {
- return this.siblings()[this.position() - 1]
- }
-
- // Send given element one step forward
- function forward () {
- var i = this.position() + 1;
- var p = this.parent();
-
- // move node one step forward
- p.removeElement(this).add(this, i);
-
- // make sure defs node is always at the top
- if (p instanceof Doc$1) {
- p.node.appendChild(p.defs().node);
- }
-
- return this
- }
-
- // Send given element one step backward
- function backward () {
- var i = this.position();
-
- if (i > 0) {
- this.parent().removeElement(this).add(this, i - 1);
- }
-
- return this
- }
-
- // Send given element all the way to the front
- function front () {
- var p = this.parent();
-
- // Move node forward
- p.node.appendChild(this.node);
-
- // Make sure defs node is always at the top
- if (p instanceof Doc$1) {
- p.node.appendChild(p.defs().node);
- }
-
- return this
- }
-
- // Send given element all the way to the back
- function back () {
- if (this.position() > 0) {
- this.parent().removeElement(this).add(this, 0);
- }
-
- return this
- }
-
- // Inserts a given element before the targeted element
- function before (element) {
- element.remove();
-
- var i = this.position();
-
- this.parent().add(element, i);
-
- return this
- }
-
- // Inserts a given element after the targeted element
- function after (element) {
- element.remove();
-
- var i = this.position();
-
- this.parent().add(element, i + 1);
-
- return this
+ // Get all siblings, including myself + + function siblings() { + return this.parent().children(); + } // Get the curent position siblings + + function position() { + return this.parent().index(this); + } // Get the next element (will return null if there is none) + + function next() { + return this.siblings()[this.position() + 1]; + } // Get the next element (will return null if there is none) + + function prev() { + return this.siblings()[this.position() - 1]; + } // Send given element one step forward + + function forward() { + var i = this.position() + 1; + var p = this.parent(); // move node one step forward + + p.removeElement(this).add(this, i); // make sure defs node is always at the top + + if (p instanceof Doc$1) { + p.node.appendChild(p.defs().node); + } + + return this; + } // Send given element one step backward + + function backward() { + var i = this.position(); + + if (i > 0) { + this.parent().removeElement(this).add(this, i - 1); + } + + return this; + } // Send given element all the way to the front + + function front() { + var p = this.parent(); // Move node forward + + p.node.appendChild(this.node); // Make sure defs node is always at the top + + if (p instanceof Doc$1) { + p.node.appendChild(p.defs().node); + } + + return this; + } // Send given element all the way to the back + + function back() { + if (this.position() > 0) { + this.parent().removeElement(this).add(this, 0); + } + + return this; + } // Inserts a given element before the targeted element + + function before(element) { + element.remove(); + var i = this.position(); + this.parent().add(element, i); + return this; + } // Inserts a given element after the targeted element + + function after(element) { + element.remove(); + var i = this.position(); + this.parent().add(element, i + 1); + return this; } var arrange = /*#__PURE__*/Object.freeze({ @@ -5296,101 +5835,115 @@ var SVG = (function () { after: after }); - // // Method for getting an element by id
- // SVG.get = function (id) {
- // var node = document.getElementById(idFromReference(id) || id)
- // return SVG.adopt(node)
- // }
- //
- // // Select elements by query string
- // SVG.select = function (query, parent) {
- // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {
- // return SVG.adopt(node)
- // })
- // }
- //
- // SVG.$$ = function (query, parent) {
- // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {
- // return SVG.adopt(node)
- // })
- // }
- //
- // SVG.$ = function (query, parent) {
- // return SVG.adopt((parent || document).querySelector(query))
- // }
-
- function baseFind (query, parent) {
- return utils.map((parent || document).querySelectorAll(query), function (node) {
- return adopt$1(node)
- })
- }
-
- // Scoped find method
- function find (query) {
- return baseFind(query, this.node)
+ // SVG.get = function (id) { + // var node = document.getElementById(idFromReference(id) || id) + // return SVG.adopt(node) + // } + // + // // Select elements by query string + // SVG.select = function (query, parent) { + // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { + // return SVG.adopt(node) + // }) + // } + // + // SVG.$$ = function (query, parent) { + // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { + // return SVG.adopt(node) + // }) + // } + // + // SVG.$ = function (query, parent) { + // return SVG.adopt((parent || document).querySelector(query)) + // } + + function baseFind(query, parent) { + return utils.map((parent || document).querySelectorAll(query), function (node) { + return adopt$1(node); + }); + } // Scoped find method + + function find(query) { + return baseFind(query, this.node); } - // Dynamic style generator
- function css (style, val) {
- let ret = {};
- if (arguments.length === 0) {
- // get full style as object
- this.node.style.cssText.split(/\s*;\s*/)
- .filter(function (el) { return !!el.length })
- .forEach(function (el) {
- let t = el.split(/\s*:\s*/);
- ret[t[0]] = t[1];
- });
- return ret
- }
-
- if (arguments.length < 2) {
- // get style properties in the array
- if (Array.isArray(style)) {
- for (let name of style) {
- let cased = camelCase(name);
- ret[cased] = this.node.style(cased);
- }
- return ret
- }
-
- // get style for property
- if (typeof style === 'string') {
- return this.node.style[camelCase(style)]
- }
-
- // set styles in object
- if (typeof style === 'object') {
- for (name in style) {
- // set empty string if null/undefined/'' was given
- this.node.style[camelCase(name)] =
- (style[name] == null || isBlank.test(style[name])) ? '' : style[name];
- }
- }
- }
-
- // set style for property
- if (arguments.length === 2) {
- this.node.style[camelCase(style)] =
- (val == null || isBlank.test(val)) ? '' : val;
- }
-
- return this
- }
-
- // Show element
- function show () {
- return this.css('display', '')
- }
-
- // Hide element
- function hide () {
- return this.css('display', 'none')
- }
-
- // Is element visible?
- function visible () {
- return this.css('display') !== 'none'
+ function css(style, val) { + var ret = {}; + + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + var t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; + } + + if (arguments.length < 2) { + // get style properties in the array + if (Array.isArray(style)) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = style[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _name = _step.value; + var cased = camelCase(_name); + ret[cased] = this.node.style(cased); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return ret; + } // get style for property + + + if (typeof style === 'string') { + return this.node.style[camelCase(style)]; + } // set styles in object + + + if (_typeof(style) === 'object') { + for (name in style) { + // set empty string if null/undefined/'' was given + this.node.style[camelCase(name)] = style[name] == null || isBlank.test(style[name]) ? '' : style[name]; + } + } + } // set style for property + + + if (arguments.length === 2) { + this.node.style[camelCase(style)] = val == null || isBlank.test(val) ? '' : val; + } + + return this; + } // Show element + + function show() { + return this.css('display', ''); + } // Hide element + + function hide() { + return this.css('display', 'none'); + } // Is element visible? + + function visible() { + return this.css('display') !== 'none'; } var css$1 = /*#__PURE__*/Object.freeze({ @@ -5400,68 +5953,59 @@ var SVG = (function () { visible: visible }); - // Reset all transformations
- function untransform () {
- return this.attr('transform', null)
- }
-
- // merge the whole transformation chain into one matrix and returns it
- function matrixify () {
- var matrix = (this.attr('transform') || '')
- // split transformations
- .split(transforms).slice(0, -1).map(function (str) {
- // generate key => value pairs
- var kv = str.trim().split('(');
- return [kv[0],
- kv[1].split(delimiter)
- .map(function (str) { return parseFloat(str) })
- ]
- })
- .reverse()
- // merge every transformation into one matrix
- .reduce(function (matrix, transform) {
- if (transform[0] === 'matrix') {
- return matrix.lmultiply(arrayToMatrix(transform[1]))
- }
- return matrix[transform[0]].apply(matrix, transform[1])
- }, new Matrix());
-
- return matrix
- }
-
- // add an element to another parent without changing the visual representation on the screen
- function toParent (parent) {
- if (this === parent) return this
- var ctm = this.screenCTM();
- var pCtm = parent.screenCTM().inverse();
-
- this.addTo(parent).untransform().transform(pCtm.multiply(ctm));
-
- return this
- }
-
- // same as above with parent equals root-svg
- function toDoc () {
- return this.toParent(this.doc())
- }
-
- // Add transformations
- function transform (o, relative) {
- // Act as a getter if no object was passed
- if (o == null || typeof o === 'string') {
- var decomposed = new Matrix(this).decompose();
- return decomposed[o] || decomposed
- }
-
- if (!isMatrixLike(o)) {
- // Set the origin according to the defined transform
- o = {...o, origin: getOrigin(o, this)};
- }
-
- // The user can pass a boolean, an Element or an Matrix or nothing
- var cleanRelative = relative === true ? this : (relative || false);
- var result = new Matrix(cleanRelative).transform(o);
- return this.attr('transform', result)
+ function untransform() { + return this.attr('transform', null); + } // merge the whole transformation chain into one matrix and returns it + + function matrixify() { + var matrix = (this.attr('transform') || ''). // split transformations + split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + var kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(arrayToMatrix(transform[1])); + } + + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; + } // add an element to another parent without changing the visual representation on the screen + + function toParent(parent) { + if (this === parent) return this; + var ctm = this.screenCTM(); + var pCtm = parent.screenCTM().inverse(); + this.addTo(parent).untransform().transform(pCtm.multiply(ctm)); + return this; + } // same as above with parent equals root-svg + + function toDoc() { + return this.toParent(this.doc()); + } // Add transformations + + function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + var decomposed = new Matrix(this).decompose(); + return decomposed[o] || decomposed; + } + + if (!isMatrixLike(o)) { + // Set the origin according to the defined transform + o = _objectSpread({}, o, { + origin: getOrigin(o, this) + }); + } // The user can pass a boolean, an Element or an Matrix or nothing + + + var cleanRelative = relative === true ? this : relative || false; + var result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); } var transform$1 = /*#__PURE__*/Object.freeze({ @@ -5472,339 +6016,302 @@ var SVG = (function () { transform: transform }); - // Set svg element attribute
- function attr (attr, val, ns) {
- // act as full getter
- if (attr == null) {
- // get an object of attributes
- attr = {};
- val = this.node.attributes;
-
- for (let node of val) {
- attr[node.nodeName] = isNumer.test(node.nodeValue)
- ? parseFloat(node.nodeValue)
- : node.nodeValue;
- }
-
- return attr
- } else if (Array.isArray(attr)) ; else if (typeof attr === 'object') {
- // apply every attribute individually if an object is passed
- for (val in attr) this.attr(val, attr[val]);
- } else if (val === null) {
- // remove value
- this.node.removeAttribute(attr);
- } else if (val == null) {
- // act as a getter if the first and only argument is not an object
- val = this.node.getAttribute(attr);
- return val == null ? attrs[attr] // FIXME: do we need to return defaults?
- : isNumber.test(val) ? parseFloat(val)
- : val
- } else {
- // convert image fill and stroke to patterns
- if (attr === 'fill' || attr === 'stroke') {
- if (isImage.test(val)) {
- val = this.doc().defs().image(val);
- }
-
- if (val instanceof Image) {
- val = this.doc().defs().pattern(0, 0, function () {
- this.add(val);
- });
- }
- }
-
- // ensure correct numeric values (also accepts NaN and Infinity)
- if (typeof val === 'number') {
- val = new SVGNumber(val);
- } else if (Color.isColor(val)) {
- // ensure full hex color
- val = new Color(val);
- } else if (Array.isArray(val)) {
- // parse array values
- val = new SVGArray(val);
- }
-
- // if the passed attribute is leading...
- if (attr === 'leading') {
- // ... call the leading method instead
- if (this.leading) {
- this.leading(val);
- }
- } else {
- // set given attribute on node
- typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())
- : this.node.setAttribute(attr, val.toString());
- }
-
- // rebuild if required
- if (this.rebuild && (attr === 'font-size' || attr === 'x')) {
- this.rebuild();
- }
- }
-
- return this
+ function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = val[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var node = _step.value; + attr[node.nodeName] = isNumer.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return attr; + } else if (Array.isArray(attr)) ; else if (_typeof(attr) === 'object') { + // apply every attribute individually if an object is passed + for (val in attr) { + this.attr(val, attr[val]); + } + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] // FIXME: do we need to return defaults? + : isNumber.test(val) ? parseFloat(val) : val; + } else { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = this.doc().defs().image(val); + } + + if (val instanceof Image) { + val = this.doc().defs().pattern(0, 0, function () { + this.add(val); + }); + } + } // ensure correct numeric values (also accepts NaN and Infinity) + + + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (Array.isArray(val)) { + // parse array values + val = new SVGArray(val); + } // if the passed attribute is leading... + + + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } // rebuild if required + + + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + + return this; } - const name$1 = 'Element';
-
- function setup (node) {
- // initialize data object
- this.dom = {};
-
- // create circular reference
- this.node = node;
-
- this.type = node.nodeName;
- this.node.instance = this;
-
- if (node.hasAttribute('svgjs:data')) {
- // pull svgjs data from the dom (getAttributeNS doesn't work in html5)
- this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {});
- }
- }
-
- // Move over x-axis
- function x$2 (x) {
- return this.attr('x', x)
- }
-
- // Move over y-axis
- function y$2 (y) {
- return this.attr('y', y)
- }
-
- // Move by center over x-axis
- function cx$1 (x) {
- return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)
- }
-
- // Move by center over y-axis
- function cy$1 (y) {
- return y == null
- ? this.y() + this.height() / 2
- : this.y(y - this.height() / 2)
- }
-
- // Move element to given x and y values
- function move$1 (x, y) {
- return this.x(x).y(y)
- }
-
- // Move element by its center
- function center (x, y) {
- return this.cx(x).cy(y)
- }
-
- // Set width of element
- function width$2 (width) {
- return this.attr('width', width)
- }
-
- // Set height of element
- function height$2 (height) {
- return this.attr('height', height)
- }
-
- // Set element size to given width and height
- function size$2 (width, height) {
- let p = proportionalSize$1(this, width, height);
-
- return this
- .width(new SVGNumber(p.width))
- .height(new SVGNumber(p.height))
- }
-
- // Clone element
- function clone (parent) {
- // write dom data to the dom so the clone can pickup the data
- this.writeDataToDom();
-
- // clone element and assign new id
- let clone = assignNewId(this.node.cloneNode(true));
-
- // insert the clone in the given parent or after myself
- if (parent) parent.add(clone);
- else this.after(clone);
-
- return clone
- }
-
- // Remove element
- function remove () {
- if (this.parent()) { this.parent().removeElement(this); }
-
- return this
- }
-
- // Replace element
- function replace (element) {
- this.after(element).remove();
-
- return element
- }
-
- // Add element to given container and return self
- function addTo (parent) {
- return makeInstance(parent).put(this)
- }
-
- // Add element to given container and return container
- function putIn (parent) {
- return makeInstance(parent).add(this)
- }
-
- // Get / set id
- function id (id) {
- // generate new id if no id set
- if (typeof id === 'undefined' && !this.node.id) {
- this.node.id = eid(this.type);
- }
-
- // dont't set directly width this.node.id to make `null` work correctly
- return this.attr('id', id)
- }
-
- // Checks whether the given point inside the bounding box of the element
- function inside (x, y) {
- let box = this.bbox();
-
- return x > box.x &&
- y > box.y &&
- x < box.x + box.width &&
- y < box.y + box.height
- }
-
- // Return id on string conversion
- function toString () {
- return this.id()
- }
-
- // Return array of classes on the node
- function classes () {
- var attr$$1 = this.attr('class');
- return attr$$1 == null ? [] : attr$$1.trim().split(delimiter)
- }
-
- // Return true if class exists on the node, false otherwise
- function hasClass (name) {
- return this.classes().indexOf(name) !== -1
- }
-
- // Add class to the node
- function addClass (name) {
- if (!this.hasClass(name)) {
- var array = this.classes();
- array.push(name);
- this.attr('class', array.join(' '));
- }
-
- return this
- }
-
- // Remove class from the node
- function removeClass (name) {
- if (this.hasClass(name)) {
- this.attr('class', this.classes().filter(function (c) {
- return c !== name
- }).join(' '));
- }
-
- return this
- }
-
- // Toggle the presence of a class on the node
- function toggleClass (name) {
- return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)
- }
-
- // FIXME: getIdFromReference
- // Get referenced element form attribute value
- function reference$1 (attr$$1) {
- return get(this.attr(attr$$1))
- }
-
- // Returns the parent element instance
- function parent (type) {
- var parent = this;
-
- // check for parent
- if (!parent.node.parentNode) return null
-
- // get parent element
- parent = adopt$1(parent.node.parentNode);
-
- if (!type) return parent
-
- // loop trough ancestors if type is given
- while (parent && parent.node instanceof window.SVGElement) {
- if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent
- parent = adopt$1(parent.node.parentNode);
- }
- }
-
- // Get parent document
- function doc () {
- let p = this.parent(Doc$1);
- return p && p.doc()
- }
-
- // Get defs
- function defs () {
- return this.doc().defs()
- }
-
- // return array of all ancestors of given type up to the root svg
- function parents (type) {
- let parents = [];
- let parent = this;
-
- do {
- parent = parent.parent(type);
- if (!parent || !parent.node) break
-
- parents.push(parent);
- } while (parent.parent)
-
- return parents
- }
-
- // matches the element vs a css selector
- function matches (selector) {
- return matches(this.node, selector)
- }
-
- // Returns the svg node to call native svg methods on it
- function native () {
- return this.node
- }
-
- // Import raw svg
- function svg () {
- // write svgjs data to the dom
- this.writeDataToDom();
-
- return this.node.outerHTML
- }
-
- // write svgjs data to the dom
- function writeDataToDom () {
- // remove previously set data
- this.node.removeAttribute('svgjs:data');
-
- if (Object.keys(this.dom).length) {
- this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428
- }
- return this
- }
-
- // set given data to the elements data property
- function setData (o) {
- this.dom = o;
- return this
- }
-
- function getEventTarget$1 () {
- return this.node
+ var name$1 = 'Element'; + function setup(node) { + // initialize data object + this.dom = {}; // create circular reference + + this.node = node; + this.type = node.nodeName; + this.node.instance = this; + + if (node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); + } + } // Move over x-axis + + function x$2(x) { + return this.attr('x', x); + } // Move over y-axis + + function y$2(y) { + return this.attr('y', y); + } // Move by center over x-axis + + function cx$1(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); + } // Move by center over y-axis + + function cy$1(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } // Move element to given x and y values + + function move$1(x, y) { + return this.x(x).y(y); + } // Move element by its center + + function center(x, y) { + return this.cx(x).cy(y); + } // Set width of element + + function width$2(width) { + return this.attr('width', width); + } // Set height of element + + function height$2(height) { + return this.attr('height', height); + } // Set element size to given width and height + + function size$2(width, height) { + var p = proportionalSize$1(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } // Clone element + + function clone(parent) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); // clone element and assign new id + + var clone = assignNewId(this.node.cloneNode(true)); // insert the clone in the given parent or after myself + + if (parent) parent.add(clone);else this.after(clone); + return clone; + } // Remove element + + function remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + + return this; + } // Replace element + + function replace(element) { + this.after(element).remove(); + return element; + } // Add element to given container and return self + + function addTo(parent) { + return makeInstance(parent).put(this); + } // Add element to given container and return container + + function putIn(parent) { + return makeInstance(parent).add(this); + } // Get / set id + + function id$1(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } // dont't set directly width this.node.id to make `null` work correctly + + + return this.attr('id', id); + } // Checks whether the given point inside the bounding box of the element + + function inside(x, y) { + var box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; + } // Return id on string conversion + + function toString() { + return this.id(); + } // Return array of classes on the node + + function classes() { + var attr$$1 = this.attr('class'); + return attr$$1 == null ? [] : attr$$1.trim().split(delimiter); + } // Return true if class exists on the node, false otherwise + + function hasClass(name) { + return this.classes().indexOf(name) !== -1; + } // Add class to the node + + function addClass(name) { + if (!this.hasClass(name)) { + var array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + + return this; + } // Remove class from the node + + function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } + + return this; + } // Toggle the presence of a class on the node + + function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); + } // FIXME: getIdFromReference + // Get referenced element form attribute value + + function reference$1(attr$$1) { + return get(this.attr(attr$$1)); + } // Returns the parent element instance + + function parent(type) { + var parent = this; // check for parent + + if (!parent.node.parentNode) return null; // get parent element + + parent = adopt$1(parent.node.parentNode); + if (!type) return parent; // loop trough ancestors if type is given + + while (parent && parent.node instanceof window.SVGElement) { + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + parent = adopt$1(parent.node.parentNode); + } + } // Get parent document + + function doc() { + var p = this.parent(Doc$1); + return p && p.doc(); + } // Get defs + + function defs() { + return this.doc().defs(); + } // return array of all ancestors of given type up to the root svg + + function parents(type) { + var parents = []; + var parent = this; + + do { + parent = parent.parent(type); + if (!parent || !parent.node) break; + parents.push(parent); + } while (parent.parent); + + return parents; + } // matches the element vs a css selector + + function matches(selector) { + return matches(this.node, selector); + } // Returns the svg node to call native svg methods on it + + function native() { + return this.node; + } // Import raw svg + + function svg() { + // write svgjs data to the dom + this.writeDataToDom(); + return this.node.outerHTML; + } // write svgjs data to the dom + + function writeDataToDom() { + // remove previously set data + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 + } + + return this; + } // set given data to the elements data property + + function setData(o) { + this.dom = o; + return this; + } + function getEventTarget$1() { + return this.node; } var Element$1 = /*#__PURE__*/Object.freeze({ @@ -5824,7 +6331,7 @@ var SVG = (function () { replace: replace, addTo: addTo, putIn: putIn, - id: id, + id: id$1, inside: inside, toString: toString, classes: classes, @@ -5846,107 +6353,91 @@ var SVG = (function () { attr: attr }); - // Unclip all clipped elements and remove itself
- function clipPathRemove () {
- // unclip all targets
- this.targets().forEach(function (el) {
- el.unclip();
- });
-
- // remove clipPath from parent
- return remove.call(this)
- }
-
- function clipPathTargets () {
- return find('svg [clip-path*="' + this.id() + '"]')
- }
-
- // Unclip all clipped elements and remove itself
- function maskRemove () {
- // unclip all targets
- this.targets().forEach(function (el) {
- el.unmask();
- });
-
- // remove clipPath from parent
- return remove.call(this)
- }
-
- function maskTargets () {
- return find('svg [mask*="' + this.id() + '"]')
- }
-
- // Unclip all clipped elements and remove itself
- function patternGradientRemove () {
- // unclip all targets
- this.targets().forEach(function (el) {
- el.unFill();
- });
-
- // remove clipPath from parent
- return remove.call(this)
- }
-
- function unFill () {
- this.attr('fill', null);
- }
-
- function patternGradientTargets () {
- return find('svg [fill*="' + this.id() + '"]')
- }
-
- // custom attr to handle transform
- function patternAttr (a, b, c) {
- if (a === 'transform') a = 'patternTransform';
- return attr.call(this, a, b, c)
- }
-
- // custom attr to handle transform
- function gradientAttr (a, b, c) {
- if (a === 'transform') a = 'gradientTransform';
- return attr.call(this, a, b, c)
- }
-
- function pathTargets () {
- return find('svg textpath [href*="' + this.id() + '"]')
- }
-
- function HtmlNodeAdd (element, i) {
- element = makeInstance(element);
-
- if (element.node !== this.node.children[i]) {
- this.node.insertBefore(element.node, this.node.children[i] || null);
- }
-
- return this
+ function clipPathRemove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); // remove clipPath from parent + + return remove.call(this); } + function clipPathTargets() { + return find('svg [clip-path*="' + this.id() + '"]'); + } // Unclip all clipped elements and remove itself + + function maskRemove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unmask(); + }); // remove clipPath from parent - const name$2 = 'EventTarget';
-
- function setup$1 (node = {}) {
- this.events = node.events || {};
- }
-
- // Bind given event to listener
- function on$1 (event, listener, binding, options) {
- on(this, event, listener, binding, options);
- return this
- }
-
- // Unbind event from listener
- function off$1 (event, listener) {
- off(this, event, listener);
- return this
- }
-
- function dispatch$1 (event, data) {
- return dispatch(this, event, data)
- }
-
- // Fire given event
- function fire (event, data) {
- this.dispatch(event, data);
- return this
+ return remove.call(this); + } + function maskTargets() { + return find('svg [mask*="' + this.id() + '"]'); + } // Unclip all clipped elements and remove itself + + function patternGradientRemove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unFill(); + }); // remove clipPath from parent + + return remove.call(this); + } + function unFill() { + this.attr('fill', null); + } + function patternGradientTargets() { + return find('svg [fill*="' + this.id() + '"]'); + } // custom attr to handle transform + + function patternAttr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return attr.call(this, a, b, c); + } // custom attr to handle transform + + function gradientAttr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return attr.call(this, a, b, c); + } + function pathTargets() { + return find('svg textpath [href*="' + this.id() + '"]'); + } + function HtmlNodeAdd(element, i) { + element = makeInstance(element); + + if (element.node !== this.node.children[i]) { + this.node.insertBefore(element.node, this.node.children[i] || null); + } + + return this; + } + + var name$2 = 'EventTarget'; + function setup$1() { + var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + this.events = node.events || {}; + } // Bind given event to listener + + function on$1(event, listener, binding, options) { + on(this, event, listener, binding, options); + + return this; + } // Unbind event from listener + + function off$1(event, listener) { + off(this, event, listener); + + return this; + } + function dispatch$1(event, data) { + return dispatch(this, event, data); + } // Fire given event + + function fire(event, data) { + this.dispatch(event, data); + return this; } var EventTarget = /*#__PURE__*/Object.freeze({ @@ -5958,158 +6449,132 @@ var SVG = (function () { fire: fire }); - // Returns all child elements
- function children () {
- return map(this.node.children, function (node) {
- return adopt$1(node)
- })
- }
-
- // Add given element at a position
- function add (element, i) {
- element = makeInstance(element);
-
- if (element.node !== this.node.children[i]) {
- this.node.insertBefore(element.node, this.node.children[i] || null);
- }
-
- return this
- }
-
- // Basically does the same as `add()` but returns the added element instead
- function put (element, i) {
- this.add(element, i);
- return element.instance || element
- }
-
- // Checks if the given element is a child
- function has (element) {
- return this.index(element) >= 0
- }
-
- // Gets index of given element
- function index (element) {
- return [].slice.call(this.node.children).indexOf(element.node)
- }
-
- // Get a element at the given index
- function get$1 (i) {
- return adopt$1(this.node.children[i])
- }
-
- // Get first child
- function first () {
- return this.get(0)
- }
-
- // Get the last child
- function last () {
- return this.get(this.node.children.length - 1)
- }
-
- // Iterates over all children and invokes a given block
- function each (block, deep) {
- var children = this.children();
- var i, il;
-
- for (i = 0, il = children.length; i < il; i++) {
- if (children[i] instanceof Base) {
- block.apply(children[i], [i, children]);
- }
-
- if (deep && (children[i] instanceof Base && children[i].is('Parent'))) {
- children[i].each(block, deep);
- }
- }
-
- return this
- }
-
- // Remove a given child
- function removeElement (element) {
- this.node.removeChild(element.node);
-
- return this
- }
-
- // Remove all elements in this container
- function clear$1 () {
- // remove children
- while (this.node.hasChildNodes()) {
- this.node.removeChild(this.node.lastChild);
- }
-
- // remove defs reference
- delete this._defs;
-
- return this
- }
-
- // Import raw svg
- function svg$1 (svg) {
- var well, len;
-
- // act as a setter if svg is given
- if (svg) {
- // create temporary holder
- well = document.createElementNS(ns, 'svg');
- // dump raw svg
- well.innerHTML = svg;
-
- // transplant nodes
- for (len = well.children.length; len--;) {
- this.node.appendChild(well.firstElementChild);
- }
-
- // otherwise act as a getter
- } else {
- // write svgjs data to the dom
- this.writeDataToDom();
-
- return this.node.outerHTML
- }
-
- return this
- }
-
- // write svgjs data to the dom
- function writeDataToDom$1 () {
- // dump variables recursively
- this.each(function () {
- this.writeDataToDom();
- });
-
- // remove previously set data
- this.node.removeAttribute('svgjs:data');
-
- if (Object.keys(this.dom).length) {
- this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428
- }
- return this
- }
-
- function flatten (parent) {
- this.each(function () {
- if (this.is('Parent')) return this.flatten(parent).ungroup(parent)
- return this.toParent(parent)
- });
-
- // we need this so that Doc does not get removed
- this.node.firstElementChild || this.remove();
-
- return this
- }
-
- function ungroup (parent) {
- parent = parent || this.parent();
-
- this.each(function () {
- return this.toParent(parent)
- });
-
- this.remove();
-
- return this
+ function children() { + return map(this.node.children, function (node) { + return adopt$1(node); + }); + } // Add given element at a position + + function add(element, i) { + element = makeInstance(element); + + if (element.node !== this.node.children[i]) { + this.node.insertBefore(element.node, this.node.children[i] || null); + } + + return this; + } // Basically does the same as `add()` but returns the added element instead + + function put(element, i) { + this.add(element, i); + return element.instance || element; + } // Checks if the given element is a child + + function has(element) { + return this.index(element) >= 0; + } // Gets index of given element + + function index(element) { + return [].slice.call(this.node.children).indexOf(element.node); + } // Get a element at the given index + + function get$1(i) { + return adopt$1(this.node.children[i]); + } // Get first child + + function first() { + return this.get(0); + } // Get the last child + + function last() { + return this.get(this.node.children.length - 1); + } // Iterates over all children and invokes a given block + + function each(block, deep) { + var children = this.children(); + var i, il; + + for (i = 0, il = children.length; i < il; i++) { + if (children[i] instanceof Base) { + block.apply(children[i], [i, children]); + } + + if (deep && children[i] instanceof Base && children[i].is('Parent')) { + children[i].each(block, deep); + } + } + + return this; + } // Remove a given child + + function removeElement(element) { + this.node.removeChild(element.node); + return this; + } // Remove all elements in this container + + function clear$1() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } // remove defs reference + + + delete this._defs; + return this; + } // Import raw svg + + function svg$1(svg) { + var well, len; // act as a setter if svg is given + + if (svg) { + // create temporary holder + well = document.createElementNS(ns, 'svg'); // dump raw svg + + well.innerHTML = svg; // transplant nodes + + for (len = well.children.length; len--;) { + this.node.appendChild(well.firstElementChild); + } // otherwise act as a getter + + } else { + // write svgjs data to the dom + this.writeDataToDom(); + return this.node.outerHTML; + } + + return this; + } // write svgjs data to the dom + + function writeDataToDom$1() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); // remove previously set data + + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 + } + + return this; + } + function flatten(parent) { + this.each(function () { + if (this.is('Parent')) return this.flatten(parent).ungroup(parent); + return this.toParent(parent); + }); // we need this so that Doc does not get removed + + this.node.firstElementChild || this.remove(); + return this; + } + function ungroup(parent) { + parent = parent || this.parent(); + this.each(function () { + return this.toParent(parent); + }); + this.remove(); + return this; } var Parent = /*#__PURE__*/Object.freeze({ @@ -6130,109 +6595,57 @@ var SVG = (function () { ungroup: ungroup }); - // import {extend} from './tools.js'
- const extend$2 = extend$1;
-
- extend$2([
- Doc$1,
- Symbol,
- Image,
- Pattern,
- Marker
- ], {viewbox: Box$1.constructors.viewbox});
-
- extend$2([Line, Polyline, Polygon, Path], {
- ...Marker.constructors.marker
- });
-
- extend$2(Text$1, TextPath.constructors.Text);
- extend$2(Path, TextPath.constructors.Path);
-
- extend$2(Defs, {
- ...Gradient.constructors.Defs,
- ...Marker.constructors.Defs,
- ...Pattern.constructors.Defs,
- });
-
- extend$2([Text$1, Tspan], Tspan.constructors.Tspan);
-
- extend$2([Gradient, Pattern], {
- remove: patternGradientRemove,
- targets: patternGradientTargets,
- unFill: unFill,
- });
-
- extend$2(Gradient, {attr: gradientAttr});
- extend$2(Pattern, {attr: patternAttr});
-
- extend$2(ClipPath, {
- remove: clipPathRemove,
- targets: clipPathTargets
- });
-
- extend$2(Mask, {
- remove: maskRemove,
- targets: maskTargets
- });
-
- extend$2(Path, {targets: pathTargets});
-
- extend$2(HtmlNode, {
- add: HtmlNodeAdd
- });
-
- for (let i in containers) {
- extend$2(containers[i], {
- ...A.constructors.Container,
- ...ClipPath.constructors.Container,
- ...Doc$1.constructors.Container,
- ...G.constructors.Container,
- ...Gradient.constructors.Container,
- ...Line.constructors.Container,
- ...Marker.constructors.Container,
- ...Mask.constructors.Container,
- ...Path.constructors.Container,
- ...Pattern.constructors.Container,
- ...Polygon.constructors.Container,
- ...Polyline.constructors.Container,
- ...Rect.constructors.Container,
- find,
- ...Symbol.constructors.Container,
- ...Text$1.constructors.Container,
- ...TextPath.constructors.Container,
- ...Use.constructors.Container,
- });
- }
-
- for (let i in elements) {
- extend$2(elements[i], {
- ...EventTarget,
- ...Element$1,
- ...Parent,
- ...arrange,
- ...A.constructors.Element,
- ...Box$1.constructors.Element,
- ...Circle.constructors.Element,
- ...ClipPath.constructors.Element,
- ...css$1,
- ...Image.constructors.Element,
- ...Mask.constructors.Element,
- ...Matrix.constructors.Element,
- ...Point.constructors.Element,
- ...Runner.constructors.Element,
- ...Timeline.constructors.Element,
- ...transform$1,
- });
- }
-
-
- // The main wrapping element
- function SVG (element) {
- return makeInstance(element)
- }
-
- Object.assign(SVG, Classes);
- Object.assign(SVG, tools);
+ var extend$2 = extend$1; + extend$2([Doc$1, _Symbol, Image, Pattern, Marker], { + viewbox: Box$1.constructors.viewbox + }); + extend$2([Line, Polyline, Polygon, Path], _objectSpread({}, Marker.constructors.marker)); + extend$2(Text$1, TextPath.constructors.Text); + extend$2(Path, TextPath.constructors.Path); + extend$2(Defs, _objectSpread({}, Gradient.constructors.Defs, Marker.constructors.Defs, Pattern.constructors.Defs)); + extend$2([Text$1, Tspan], Tspan.constructors.Tspan); + extend$2([Gradient, Pattern], { + remove: patternGradientRemove, + targets: patternGradientTargets, + unFill: unFill + }); + extend$2(Gradient, { + attr: gradientAttr + }); + extend$2(Pattern, { + attr: patternAttr + }); + extend$2(ClipPath, { + remove: clipPathRemove, + targets: clipPathTargets + }); + extend$2(Mask, { + remove: maskRemove, + targets: maskTargets + }); + extend$2(Path, { + targets: pathTargets + }); + extend$2(HtmlNode, { + add: HtmlNodeAdd + }); + + for (var i$1 in containers) { + extend$2(containers[i$1], _objectSpread({}, A.constructors.Container, ClipPath.constructors.Container, Doc$1.constructors.Container, G.constructors.Container, Gradient.constructors.Container, Line.constructors.Container, Marker.constructors.Container, Mask.constructors.Container, Path.constructors.Container, Pattern.constructors.Container, Polygon.constructors.Container, Polyline.constructors.Container, Rect.constructors.Container, { + find: find + }, _Symbol.constructors.Container, Text$1.constructors.Container, TextPath.constructors.Container, Use.constructors.Container)); + } + + for (var _i in elements) { + extend$2(elements[_i], _objectSpread({}, EventTarget, Element$1, Parent, arrange, A.constructors.Element, Box$1.constructors.Element, Circle.constructors.Element, ClipPath.constructors.Element, css$1, Image.constructors.Element, Mask.constructors.Element, Matrix.constructors.Element, Point.constructors.Element, Runner.constructors.Element, Timeline.constructors.Element, transform$1)); + } // The main wrapping element + + + function SVG(element) { + return makeInstance(element); + } + Object.assign(SVG, Classes); + Object.assign(SVG, tools); Object.assign(SVG, adopter); return SVG; diff --git a/dist/svg.min.js b/dist/svg.min.js new file mode 100644 index 0000000..bfb399c --- /dev/null +++ b/dist/svg.min.js @@ -0,0 +1 @@ +var SVG=function(){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function _(r){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},e=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),e.forEach(function(t){var e,n,i;e=r,i=s[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return r}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function O(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=function(){function l(t,e){var n=e.extensions,i=void 0===n?[]:n;c(this,l);var r=!0,s=!(this.tags=[]),u=void 0;try{for(var o,a=i[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var h=o.value;h.setup.call(this,t),this.tags.push(h.name)}}catch(t){s=!0,u=t}finally{try{r||null==a.return||a.return()}finally{if(s)throw u}}}return o(l,[{key:"is",value:function(t){return this.tags.includes(t)}}]),l}(),e="http://www.w3.org/2000/svg",s="http://www.w3.org/2000/xmlns/",h="http://www.w3.org/1999/xlink",d=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,v=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,y=/rgb\((\d+),(\d+),(\d+)\)/,t=/\)\s*,?\s*/,p=/\s/g,m=/^#[a-f0-9]{3,6}$/i,g=/^rgb\(/,w=/^(\s+)?$/,x=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,b=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,k=/[\s,]+/,A=/([^e])-/gi,C=/[MLHVCSQTAZ]/gi,M=/[MLHVCSQTAZ]/i,j=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,T=/\./g;function E(t,e,n,i){return n+i.replace(T," .")}function S(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function N(t){return t.charAt(0).toUpperCase()+t.slice(1)}function D(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function P(t,e,n){if(null==e||null==n){var i=t.bbox();null==e?e=i.width/i.height*n:null==n&&(n=i.height/i.width*e)}return{width:e,height:n}}function z(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}var q="abcdef".split("");function L(t,e,n){return Math.abs(e-t)<(n||1e-6)}function R(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}function F(t,e){var n,i,r=t.origin;if("string"==typeof r||null==r){var s=(r||"center").toLowerCase().trim(),u=e.bbox(),o=u.height,a=u.width,h=u.x,l=u.y,c=s.includes("left")?h:s.includes("right")?h+a:h+a/2,f=s.includes("top")?l:s.includes("bottom")?l+o:l+o/2;n=null!=t.ox?t.ox:c,i=null!=t.oy?t.oy:f}else n=r[0],i=r[1];return[n,i]}function I(t,e){return e||X(t)}function X(t){return document.createElementNS(e,t)}function Y(e,t){var n,i;if(Array.isArray(t))t.forEach(function(t){Y(e,t)});else for(i=(e=Array.isArray(e)?e:[e]).length-1;0<=i;i--)for(n in t.name&&(e[i].extensions=(e[i].extensions||[]).concat(t)),t)e[i].prototype[n]||"name"==n||"setup"==n||(e[i].prototype[n]=t[n])}var B=Object.freeze({nodeOrNew:I,makeNode:X,extend:Y,addFactory:function(t,e){Y(t,e)},invent:function(e){var t="function"==typeof e.create?e.create:function(t){e.inherit.call(this,t||X(e.create))};return e.inherit&&(t.prototype=new e.inherit,t.prototype.constructor=t),e.extend&&Y(t,e.extend),e.construct&&Y(e.parent||Container,e.construct),t}});function G(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};extend(function(t){function e(t){return c(this,e),f(this,a(e).call(this,I(n,t),e))}return u(e,i),o(e,[{key:"words",value:function(t){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this.node.appendChild(document.createTextNode(t)),this}}]),e}(),i)}var V=function(){function n(){c(this,n),this.init.apply(this,arguments)}return o(n,[{key:"init",value:function(t,e){e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(d))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n&&(this.value=t.valueOf(),this.unit=t.unit)}},{key:"toString",value:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"toArray",value:function(){return[this.value,this.unit]}},{key:"valueOf",value:function(){return this.value}},{key:"plus",value:function(t){return new n(this+(t=new n(t)),this.unit||t.unit)}},{key:"minus",value:function(t){return new n(this-(t=new n(t)),this.unit||t.unit)}},{key:"times",value:function(t){return new n(this*(t=new n(t)),this.unit||t.unit)}},{key:"divide",value:function(t){return new n(this/(t=new n(t)),this.unit||t.unit)}}]),n}();function H(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function U(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Q(t){return null==t?this.attr("cx"):this.attr("cx",t)}function $(t){return null==t?this.attr("cy"):this.attr("cy",t)}function W(t){return null==t?2*this.rx():this.rx(new V(t).divide(2))}function Z(t){return null==t?2*this.ry():this.ry(new V(t).divide(2))}function J(t,e){var n=P(this,t,e);return this.rx(new V(n.width).divide(2)).ry(new V(n.height).divide(2))}var K=Object.freeze({rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)},x:H,y:U,cx:Q,cy:$,width:W,height:Z,size:J}),tt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("circle",t),e))}return u(e,r),o(e,[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}}]),e}();Y(tt,{x:H,y:U,cx:Q,cy:$,width:W,height:Z,size:J}),tt.constructors={Element:{circle:function(t){return this.put(new tt).radius(new V(t).divide(2)).move(0,0)}}};var et=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("clipPath",t),e))}return u(e,r),e}();et.constructors={Container:{clip:function(){return this.defs().put(new et)}},Element:{clipWith:function(t){var e=t instanceof et?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}};var nt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("defs",t),e))}return u(e,r),o(e,[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}]),e}(),it=function(t){function n(t){var e;return c(this,n),(e=f(this,a(n).call(this,I("svg",t),n))).namespace(),e}return u(n,r),o(n,[{key:"isRoot",value:function(){return!(this.node.parentNode&&this.node.parentNode instanceof window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}},{key:"doc",value:function(){return this.isRoot()?this:Element.doc.call(this)}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:e,version:"1.1"}).attr("xmlns:xlink",h,s).attr("xmlns:svgjs","http://svgjs.com/svgjs",s):this.doc().namespace()}},{key:"defs",value:function(){if(!this.isRoot())return this.doc().defs();var t=this.node.getElementsByTagName("defs")[0];return t?t.instance||new nt(t):this.put(new nt)}},{key:"parent",value:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:this.node.parentNode:Element.parent.call(this,t)}},{key:"remove",value:function(){return this.isRoot()?(this.parent()&&this.parent().removeChild(this.node),this):Element.remove.call(this)}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}}]),n}();it.constructors={Container:{nested:function(){return this.put(new it)}}};var rt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,nodeOrNew("ellipse",t),e))}return u(e,r),e}();Y(rt,K);var st=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("stop",t),e))}return u(e,r),o(e,[{key:"update",value:function(t){return("number"==typeof t||t instanceof V)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new V(t.offset)),this}}]),e}();var ut=Object.freeze({from:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new V(t),fy:new V(e)}):this.attr({x1:new V(t),y1:new V(e)})},to:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new V(t),cy:new V(e)}):this.attr({x2:new V(t),y2:new V(e)})}}),ot=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I(t+"Gradient","string"==typeof t?null:t),e))}return u(e,r),o(e,[{key:"stop",value:function(t,e,n){return this.put(new st).update(t,e,n)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"toString",value:function(){return this.url()}}]),e}();Y(ot,ut),ot.constructors={Container:{gradient:function(t,e){return this.defs().gradient(t,e)}},Defs:{gradient:function(t,e){return this.put(new ot(t)).update(e)}}};var at=function(t){function e(t){return c(this,e),f(this,a(e).call(this,nodeorNew("g",t),e))}return u(e,r),e}();at.constructors={Element:{group:function(){return this.put(new at)}}};var ht=function(t){function n(t){var e;return c(this,n),(e=f(this,a(n).call(this,t,n))).node=t,e}return u(n,r),o(n,[{key:"put",value:function(t,e){return this.add(t,e),t}},{key:"getEventTarget",value:function(){return this.node}}]),n}(),lt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("a",t),e))}return u(e,r),o(e,[{key:"to",value:function(t){return this.attr("href",t,h)}},{key:"target",value:function(t){return this.attr("target",t)}}]),e}();lt.constructors={Container:{link:function(t){return this.put(new lt).to(t)}},Element:{linkTo:function(t){var e=new lt;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}};var ct=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("pattern",t)))}return u(e,r),o(e,[{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return this.url()}}]),e}();ct.constructors={Container:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}},Defs:{pattern:function(t,e,n){return this.put(new ct).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}};var ft=0;function dt(t){return t instanceof Base&&t.is("EventTarget")?t.getEventTarget():t}function vt(t,e,i,n,r){var s=i.bind(n||t),u=dt(t);e=Array.isArray(e)?e:e.split(k),u.instance=u.instance||{events:{}};var o=u.instance.events;i._svgjsListenerId||(i._svgjsListenerId=++ft),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][n]=o[e][n]||{},o[e][n][i._svgjsListenerId]=s,u.addEventListener(e,s,r||!1)})}function yt(t,e,s,u){var o=dt(t);if(o.instance&&("function"!=typeof s||(s=s._svgjsListenerId))){var a=o.instance.events;(e=Array.isArray(e)?e:(e||"").split(k)).forEach(function(t){var e,n,i=t&&t.split(".")[0],r=t&&t.split(".")[1];if(s)a[i]&&a[i][r||"*"]&&(o.removeEventListener(i,a[i][r||"*"][s],u||!1),delete a[i][r||"*"][s]);else if(i&&r){if(a[i]&&a[i][r]){for(n in a[i][r])yt(o,[i,r].join("."),n);delete a[i][r]}}else if(r)for(t in a)for(e in a[t])r===e&&yt(o,[t,r].join("."));else if(i){if(a[i]){for(e in a[i])yt(o,[i,e].join("."));delete a[i]}}else{for(t in a)yt(o,t);o.instance.events={}}})}}var pt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("image",t),e))}return u(e,r),o(e,[{key:"load",value:function(n,i){if(!n)return this;var r=new window.Image;return vt(r,"load",function(t){var e=this.parent(ct);0===this.width()&&0===this.height()&&this.size(r.width,r.height),e instanceof ct&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof i&&i.call(this,{width:r.width,height:r.height,ratio:r.width/r.height,url:n})},this),vt(r,"load error",function(){yt(r)}),this.attr("href",r.src=n,h)}}]),e}();pt.constructors={Container:{image:function(t,e){return this.put(new pt).size(0,0).load(t,e)}}};var mt=function(){try{return Array}catch(t){return Array}}(),gt=function(t){function n(){var t,e;return c(this,n),(t=e=f(this,a(n).call(this))).init.apply(t,arguments),e}return u(n,mt),o(n,[{key:"init",value:function(t,e){this.length=0,this.push.apply(this,O(this.parse(t||e)))}},{key:"toArray",value:function(){return Array.prototype.slice(this)}},{key:"toString",value:function(){this.join(" ")}},{key:"valueOf",value:function(){return this.toArray()}},{key:"parse",value:function(t){return t=t.valueOf(),Array.isArray(t)?t:t.trim().split(k).map(parseFloat)}},{key:"clone",value:function(){return new this.constructor(this)}},{key:"toSet",value:function(){return new Set(this)}}]),n}(),wt=function(t){function r(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[[0,0]];return c(this,r),f(this,a(r).call(this,t,e))}return u(r,gt),o(r,[{key:"toString",value:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)n.push(this.value[t].join(","));return n.join(" ")}},{key:"toArray",value:function(){return this.value.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"toLine",value:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}}},{key:"at",value:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];e<n;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new r(i)}},{key:"parse",value:function(t){var e=[];if(t=t.valueOf(),Array.isArray(t)){if(Array.isArray(t[0]))return t}else t=t.trim().split(k).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,i=t.length;n<i;n+=2)e.push([t[n],t[n+1]]);return e}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;0<=i;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this}},{key:"size",value:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;0<=n;n--)i.width&&(this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x),i.height&&(this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y);return this}},{key:"bbox",value:function(){var e=-1/0,n=-1/0,i=1/0,r=1/0;return this.value.forEach(function(t){e=Math.max(t[0],e),n=Math.max(t[1],n),i=Math.min(t[0],i),r=Math.min(t[1],r)}),{x:i,y:r,width:e-i,height:n-r}}}]),r}(),xt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("line",t),e))}return u(e,r),o(e,[{key:"array",value:function(){return new wt([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"plot",value:function(t,e,n,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:i}:new wt(t).toLine(),this.attr(t))}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}]),e}();xt.constructors={Container:{line:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return xt.prototype.plot.apply(this.put(new xt),null!=e[0]?e:[0,0,0,0])}}};var bt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,nodeOrNew("marker",t),e))}return u(e,r),o(e,[{key:"width",value:function(t){return this.attr("markerWidth",t)}},{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),e}();bt.constructors={Container:{marker:function(t,e,n){return this.defs().marker(t,e,n)}},Defs:{marker:function(t,e,n){return this.put(new bt).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}},marker:{marker:function(t,e,n,i){var r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=e instanceof bt?e:this.defs().marker(e,n,i),this.attr(r,t)}}};var kt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("mask",t)))}return u(e,r),e}();function _t(){if(!_t.nodes){var t=(new it).size(2,0).css({opacity:0,position:"absolute",left:"-100%",top:"-100%",overflow:"hidden"}),e=t.path().node;_t.nodes={svg:t,path:e}}if(!_t.nodes.svg.node.parentNode){var n=document.body||document.documentElement;_t.nodes.svg.addTo(n)}return _t.nodes}kt.constructors={Container:{mask:function(){return this.defs().put(new kt)}},Element:{maskWith:function(t){var e=t instanceof kt?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}};var Ot=function(){function r(t,e,n){var i;c(this,r),n=n||{x:0,y:0},i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===l(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==i.x?n.x:i.x,this.y=null==i.y?n.y:i.y}return o(r,[{key:"clone",value:function(){return new r(this)}},{key:"native",value:function(){var t=_t().svg.createSVGPoint();return t.x=this.x,t.y=this.y,t}},{key:"transform",value:function(t){return new r(t.a*this.x+t.c*this.y+t.e,t.b*this.x+t.d*this.y+t.f)}}]),r}();Ot.constructors={Element:{point:function(t,e){return new Ot(t,e).transform(this.screenCTM().inverse())}}};for(var At={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Ct="mlhvqtcsaz".split(""),Mt=0,jt=Ct.length;Mt<jt;++Mt)At[Ct[Mt]]=function(s){return function(t,e,n){if("H"===s)t[0]=t[0]+e.x;else if("V"===s)t[0]=t[0]+e.y;else if("A"===s)t[5]=t[5]+e.x,t[6]=t[6]+e.y;else for(var i=0,r=t.length;i<r;++i)t[i]=t[i]+(i%2?e.y:e.x);return At[s](t,e,n)}}(Ct[Mt].toUpperCase());var Tt=function(t){function h(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[["M",0,0]];return c(this,h),f(this,a(h).call(this,t,e))}return u(h,gt),o(h,[{key:"toString",value:function(){return function(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}(this)}},{key:"toArray",value:function(){return this.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.length-1;0<=r;r--)"M"===(i=this[r][0])||"L"===i||"T"===i?(this[r][1]+=t,this[r][2]+=e):"H"===i?this[r][1]+=t:"V"===i?this[r][1]+=e:"C"===i||"S"===i||"Q"===i?(this[r][1]+=t,this[r][2]+=e,this[r][3]+=t,this[r][4]+=e,"C"===i&&(this[r][5]+=t,this[r][6]+=e)):"A"===i&&(this[r][6]+=t,this[r][7]+=e);return this}},{key:"size",value:function(t,e){var n,i,r=this.bbox();for(n=this.length-1;0<=n;n--)"M"===(i=this[n][0])||"L"===i||"T"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y):"H"===i?this[n][1]=(this[n][1]-r.x)*t/r.width+r.x:"V"===i?this[n][1]=(this[n][1]-r.y)*e/r.height+r.y:"C"===i||"S"===i||"Q"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y,this[n][3]=(this[n][3]-r.x)*t/r.width+r.x,this[n][4]=(this[n][4]-r.y)*e/r.height+r.y,"C"===i&&(this[n][5]=(this[n][5]-r.x)*t/r.width+r.x,this[n][6]=(this[n][6]-r.y)*e/r.height+r.y)):"A"===i&&(this[n][1]=this[n][1]*t/r.width,this[n][2]=this[n][2]*e/r.height,this[n][6]=(this[n][6]-r.x)*t/r.width+r.x,this[n][7]=(this[n][7]-r.y)*e/r.height+r.y);return this}},{key:"equalCommands",value:function(t){var e,n,i;for(t=new h(t),i=this.length===t.value.length,e=0,n=this.length;i&&e<n;e++)i=this[e][0]===t.value[e][0];return i}},{key:"morph",value:function(t){return t=new h(t),this.equalCommands(t)?this.destination=t:this.destination=null,this}},{key:"at",value:function(t){if(!this.destination)return this;var e,n,i,r,s=this,u=this.destination.value,o=[],a=new h;for(e=0,n=s.length;e<n;e++){for(o[e]=[s[e][0]],i=1,r=s[e].length;i<r;i++)o[e][i]=s[e][i]+(u[e][i]-s[e][i])*t;"A"===o[e][0]&&(o[e][4]=+(0!==o[e][4]),o[e][5]=+(0!==o[e][5]))}return a.value=o,a}},{key:"parse",value:function(t){if(t instanceof h)return t.valueOf();var e,n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(j,E).replace(C," $& ").replace(A,"$1 -").trim().split(k):t.reduce(function(t,e){return[].concat.call(t,e)},[]);for(var i=[],r=new Ot,s=new Ot,u=0,o=t.length;M.test(t[u])?(e=t[u],++u):"M"===e?e="L":"m"===e&&(e="l"),i.push(At[e].call(null,t.slice(u,u+=n[e.toUpperCase()]).map(parseFloat),r,s)),u<o;);return i}},{key:"bbox",value:function(){return _t().path.setAttribute("d",this.toString()),_t.nodes.path.getBBox()}}]),h}(),Et=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("path",t),e))}return u(e,r),o(e,[{key:"array",value:function(){return this._array||(this._array=new Tt(this.attr("d")))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Tt(t))}},{key:"clear",value:function(){return delete this._array,this}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}}]),e}();Et.prototype.MorphArray=Tt,Et.constructors={Container:{path:function(t){return this.put(new Et).plot(t||new Tt)}}};var St=wt;var Nt=Object.freeze({MorphArray:St,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}});var Dt=Object.freeze({array:function(){return this._array||(this._array=new PointArray(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new PointArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=proportionalSize(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),Pt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("polygon",t),e))}return u(e,r),e}();Pt.constructors={Parent:{polygon:function(t){return this.put(new Pt).plot(t||new wt)}}},Y(Pt,Nt),Y(Pt,Dt);var zt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("polyline",t),e))}return u(e,r),e}();zt.constructors={Parent:{polyline:function(t){return this.put(new zt).plot(t||new wt)}}},Y(zt,Nt),Y(zt,Dt);var qt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("rect",t),e))}return u(e,r),e}();qt.constructors={Container:{rect:function(t,e){return this.put(new qt).size(t,e)}}};var Lt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("symbol",t),e))}return u(e,r),e}();function Rt(){}Lt.constructors={Container:{symbol:function(){return this.put(new Lt)}}};var Ft=400,It=">",Xt=0,Yt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"};var Bt=Object.freeze({plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}}),Gt=function(t){function n(t){var e;return c(this,n),(e=f(this,a(n).call(this,I("text",t),n))).dom.leading=new V(1.3),e._rebuild=!0,e._build=!1,e.attr("font-family",Yt["font-family"]),e}return u(n,r),o(n,[{key:"x",value:function(t){return null==t?this.attr("x"):this.attr("x",t)}},{key:"y",value:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)}},{key:"cx",value:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)}},{key:"cy",value:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var i=0,r=e.length;i<r;++i)"textPath"!==e[i].nodeName?(i!==n&&3!==e[i].nodeType&&!0===adopt(e[i]).dom.newLined&&(t+="\n"),t+=e[i].textContent):0===i&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var s=0,u=(t=t.split("\n")).length;s<u;s++)this.tspan(t[s]).newLine();return this.build(!1).rebuild()}},{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new V(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,n=0,i=this.dom.leading*new V(this.attr("font-size"));this.each(function(){this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?n+=i:(this.attr("dy",i+n),n=0))}),this.fire("rebuild")}return this}},{key:"build",value:function(t){return this._build=!!t,this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new V(t.leading||1.3),this}}]),n}();Y(Gt,Bt),Gt.constructors={Container:{text:function(t){return this.put(new Gt).text(t)},plain:function(t){return this.put(new Gt).plain(t)}}};var Vt=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("textPath",t)))}return u(e,Gt),o(e,[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this}},{key:"track",value:function(){return this.reference("href")}}]),e}();Vt.constructors={Container:{textPath:function(t,e){return this.defs().path(e).text(t).addTo(this)}},Text:{path:function(t){var e=new Vt;return t instanceof Et||(t=this.doc().defs().path(t)),e.attr("href","#"+t,h),this.put(e)},textPath:function(){return this.select("textPath")}},Path:{text:function(t){if(t instanceof Gt){var e=t.text();return t.clear().path(this).text(e)}return this.parent().put(new Gt).path(this).text(t)}}},Vt.prototype.MorphArray=Tt;var Ht=function(t){function e(t){return c(this,e),f(this,a(e).call(this,nodeOrNew("use",t),e))}return u(e,r),o(e,[{key:"element",value:function(t,e){return this.attr("href",(e||"")+"#"+t,h)}}]),e}();Ht.constructors={Container:{use:function(t,e){return this.put(new Ht).element(t,e)}}};var Ut=Object.freeze({Bare:G,Circle:tt,ClipPath:et,Defs:nt,Doc:it,Ellipse:rt,Gradient:ot,G:at,HtmlNode:ht,A:lt,Image:pt,Line:xt,Marker:bt,Mask:kt,Path:Et,Pattern:ct,Polygon:Pt,Polyline:zt,Rect:qt,Stop:st,Symbol:Lt,Text:Gt,TextPath:Vt,Use:Ht});function Qt(t){if(t instanceof r)return t;if("object"===l(t))return $t(t);if(null==t)return new Doc;if("string"==typeof t&&"<"!==t.charAt(0))return $t(document.querySelector(t));var e=makeNode("svg");return e.innerHTML=t,t=$t(e.firstElementChild)}function $t(t){return t?t.instance instanceof Element?t.instance:t instanceof window.SVGElement?"svg"===t.nodeName?new it(t):"linearGradient"===t.nodeName||"radialGradient"===t.nodeName?new ot(t):Ut[N(t.nodeName)]?new(Ut[N(t.nodeName)])(t):new G(t):new ht(t):null}var Wt=1e3;function Zt(t){return"Svgjs"+N(t)+Wt++}function Jt(t){for(var e=t.children.length-1;0<=e;e--)Jt(t.children[e]);return t.id?$t(t).id(Zt(t.nodeName)):$t(t)}var Kt=Object.freeze({makeInstance:Qt,adopt:$t,eid:Zt,assignNewId:Jt}),te=function(){function t(){c(this,t),this._first=null,this._last=null}return o(t,[{key:"push",value:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}},{key:"shift",value:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}},{key:"first",value:function(){return this._first&&this._first.value}},{key:"last",value:function(){return this._last&&this._last.value}},{key:"remove",value:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}]),t}(),ee={nextDraw:null,frames:new te,timeouts:new te,timer:window.performance||window.Date,transforms:[],frame:function(t){var e=ee.frames.push({run:t});return null===ee.nextDraw&&(ee.nextDraw=window.requestAnimationFrame(ee._draw)),e},transform_frame:function(t,e){ee.transforms[e]=t},timeout:function(t,e){e=e||0;var n=ee.timer.now()+e,i=ee.timeouts.push({run:t,time:n});return null===ee.nextDraw&&(ee.nextDraw=window.requestAnimationFrame(ee._draw)),i},cancelFrame:function(t){ee.frames.remove(t)},clearTimeout:function(t){ee.timeouts.remove(t)},_draw:function(t){for(var e=null,n=ee.timeouts.last();(e=ee.timeouts.shift())&&(t>=e.time?e.run():ee.timeouts.push(e),e!==n););for(var i=null,r=ee.frames.last();i!==r&&(i=ee.frames.shift());)i.run();ee.transforms.forEach(function(t){t()}),ee.nextDraw=ee.timeouts.first()||ee.frames.first()?window.requestAnimationFrame(ee._draw):null}},ne=function(t){function e(t){return c(this,e),f(this,a(e).call(this,I("tspan",t),e))}return u(e,r),o(e,[{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}},{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"newLine",value:function(){var t=this.parent(Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}]),e}();function ie(t){return t%360*Math.PI/180}Y(ne,Bt),ne.constructors={Tspan:{tspan:function(t){var e=new ne;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)}}};var re=function(){function h(){c(this,h),this.init.apply(this,arguments)}return o(h,[{key:"init",value:function(t){var e=z([1,0,0,1,0,0]);t=t instanceof r&&t.is("Element")?t.matrixify():"string"==typeof t?z(t.split(k).map(parseFloat)):Array.isArray(t)?z(t):"object"===l(t)&&R(t)?t:"object"===l(t)?(new h).transform(t):6===arguments.length?z([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(R(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new Ot(e.ox,e.oy).transform(this),i=n.x,r=n.y,s=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-r).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,r);if(isFinite(e.px)||isFinite(e.py)){var u=new Ot(i,r).transform(s),o=e.px?e.px-u.x:0,a=e.py?e.py-u.y:0;s.translateO(o,a)}return s.translateO(e.tx,e.ty),s}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,i=t.scaleX||1,r=t.scaleY||1,s=t.shear||0,u=t.rotate||0,o=t.translateX||0,a=t.translateY||0;return(new h).translateO(-e,-n).scaleO(i,r).shearO(s).rotateO(u).translateO(o,a).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,o=this.f,a=n*s-i*r,h=0<a?1:-1,l=h*Math.sqrt(n*n+i*i),c=Math.atan2(h*i,h*n),f=180/Math.PI*c,d=Math.cos(c),v=Math.sin(c),y=(n*r+i*s)/a,p=r*l/(y*n-i)||s*l/(y*i+n);return{scaleX:l,scaleY:p,shear:y,rotate:f,translateX:u-t+t*d*l+e*(y*d*l-v*p),translateY:o-e+t*v*l+e*(y*v*l+d*p),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(this,e,this)}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(e,this,this)}},{key:"inverseO",value:function(){var t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,u=t*i-e*n;if(!u)throw new Error("Cannot invert "+this);var o=i/u,a=-e/u,h=-n/u,l=t/u,c=-(o*r+h*s),f=-(a*r+l*s);return this.a=o,this.b=a,this.c=h,this.d=l,this.e=c,this.f=f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"scale",value:function(t,e,n,i){var r;return(r=this.clone()).scaleO.apply(r,arguments)}},{key:"scaleO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t);var r=this.a,s=this.b,u=this.c,o=this.d,a=this.e,h=this.f;return this.a=r*t,this.b=s*e,this.c=u*t,this.d=o*e,this.e=a*t-n*t+n,this.f=h*e-i*e+i,this}},{key:"rotate",value:function(t,e,n){return this.clone().rotateO(t,e,n)}},{key:"rotateO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=ie(t);var i=Math.cos(t),r=Math.sin(t),s=this.a,u=this.b,o=this.c,a=this.d,h=this.e,l=this.f;return this.a=s*i-u*r,this.b=u*i+s*r,this.c=o*i-a*r,this.d=a*i+o*r,this.e=h*i-l*r+n*r-e*i+e,this.f=l*i+h*r-e*r-n*i+n,this}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"shear",value:function(t,e,n){return this.clone().shearO(t,e,n)}},{key:"shearO",value:function(t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,o=this.f;return this.a=n+i*t,this.c=r+s*t,this.e=u+o*t-e*t,this}},{key:"skew",value:function(t,e,n,i){var r;return(r=this.clone()).skewO.apply(r,arguments)}},{key:"skewO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t),t=ie(t),e=ie(e);var r=Math.tan(t),s=Math.tan(e),u=this.a,o=this.b,a=this.c,h=this.d,l=this.e,c=this.f;return this.a=u+o*r,this.b=o+u*s,this.c=a+h*r,this.d=h+a*s,this.e=l+c*r-i*r,this.f=c+l*s-n*s,this}},{key:"skewX",value:function(t,e,n){return this.skew(t,0,e,n)}},{key:"skewXO",value:function(t,e,n){return this.skewO(t,0,e,n)}},{key:"skewY",value:function(t,e,n){return this.skew(0,t,e,n)}},{key:"skewYO",value:function(t,e,n){return this.skewO(0,t,e,n)}},{key:"aroundO",value:function(t,e,n){var i=t||0,r=e||0;return this.translateO(-i,-r).lmultiplyO(n).translateO(i,r)}},{key:"around",value:function(t,e,n){return this.clone().aroundO(t,e,n)}},{key:"native",value:function(){for(var t=_t().node.createSVGMatrix(),e=q.length-1;0<=e;e--)t[q[e]]=this[q[e]];return t}},{key:"equals",value:function(t){var e=new h(t);return L(this.a,e.a)&&L(this.b,e.b)&&L(this.c,e.c)&&L(this.d,e.d)&&L(this.e,e.e)&&L(this.f,e.f)}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],[{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,o=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,a=t.shear||0,h=t.rotate||t.theta||0,l=new Ot(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new Ot(t.position||t.px||t.positionX,t.py||t.positionY),v=d.x,y=d.y,p=new Ot(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=p.x,g=p.y,w=new Ot(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:o,skewX:r,skewY:s,shear:a,theta:h,rx:w.x,ry:w.y,tx:m,ty:g,ox:c,oy:f,px:v,py:y}}},{key:"matrixMultiply",value:function(t,e,n){var i=t.a*e.a+t.c*e.b,r=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,u=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,a=t.f+t.b*e.e+t.d*e.f;return n.a=i,n.b=r,n.c=s,n.d=u,n.e=o,n.f=a,n}}]),h}();re.constructors={Element:{ctm:function(){return new re(this.node.getCTM())},screenCTM:function(){if(this instanceof Doc&&!this.isRoot()){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new re(e)}return new re(this.node.getScreenCTM())}}};var se=function(){function u(){c(this,u),this.init.apply(this,arguments)}return o(u,[{key:"init",value:function(t){var e;t="string"==typeof t?t.split(k).map(parseFloat):Array.isArray(t)?t:"object"===l(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3],null==(e=this).x&&(e.x=0,e.y=0,e.width=0,e.height=0),e.w=e.width,e.h=e.height,e.x2=e.x+e.width,e.y2=e.y+e.height,e.cx=e.x+e.width/2,e.cy=e.y+e.height/2}},{key:"merge",value:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new u(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)}},{key:"transform",value:function(e){var n=1/0,i=-1/0,r=1/0,s=-1/0;return[new Ot(this.x,this.y),new Ot(this.x2,this.y),new Ot(this.x,this.y2),new Ot(this.x2,this.y2)].forEach(function(t){t=t.transform(e),n=Math.min(n,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y)}),new u(n,r,i-n,s-r)}},{key:"addOffset",value:function(){return this.x+=window.pageXOffset,this.y+=window.pageYOffset,this}},{key:"toString",value:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}},{key:"toArray",value:function(){return[this.x,this.y,this.width,this.height]}}]),u}();function ue(e){var n,t,i;try{if(n=e(this.node),!((i=n).w||i.h||i.x||i.y||(t=this.node,(document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===document}).call(document.documentElement,t))))throw new Error("Element not in the dom")}catch(t){try{var r=this.clone(_t().svg).show();n=e(r.node),r.remove()}catch(t){throw t}}return n}se.constructors={Element:{bbox:function(){return new se(ue.call(this,function(t){return t.getBBox()}))},rbox:function(t){var e=new se(ue.call(this,function(t){return t.getBoundingClientRect()}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()}},viewbox:function(t,e,n,i){return null==t?new se(this.attr("viewBox")):this.attr("viewBox",new se(t,e,n,i))}};var oe=function(){function t(){c(this,t),this.init.apply(this,arguments)}return o(t,[{key:"init",value:function(t,e,n){var i,r;(this.r=0,this.g=0,this.b=0,t)&&("string"==typeof t?g.test(t)?(i=y.exec(t.replace(p,"")),this.r=parseInt(i[1]),this.g=parseInt(i[2]),this.b=parseInt(i[3])):m.test(t)&&(i=v.exec(4===(r=t).length?["#",r.substring(1,2),r.substring(1,2),r.substring(2,3),r.substring(2,3),r.substring(3,4),r.substring(3,4)].join(""):r),this.r=parseInt(i[1],16),this.g=parseInt(i[2],16),this.b=parseInt(i[3],16)):Array.isArray(t)?(this.r=t[0],this.g=t[1],this.b=t[2]):"object"===l(t)?(this.r=t.r,this.g=t.g,this.b=t.b):3===arguments.length&&(this.r=t,this.g=e,this.b=n))}},{key:"toString",value:function(){return this.toHex()}},{key:"toArray",value:function(){return[this.r,this.g,this.b]}},{key:"toHex",value:function(){return"#"+D(Math.round(this.r))+D(Math.round(this.g))+D(Math.round(this.b))}},{key:"toRgb",value:function(){return"rgb("+[this.r,this.g,this.b].join()+")"}},{key:"brightness",value:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11}}],[{key:"test",value:function(t){return t+="",m.test(t)||g.test(t)}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"isColor",value:function(t){return this.isRgb(t)||this.test(t)}}]),t}();function ae(e,n){return function(t){return null==t?this[t]:(this[e]=t,n&&n.call(this),this)}}var he={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,i){return function(t){}}},le=function(){function t(){c(this,t)}return o(t,[{key:"done",value:function(){return!1}}]),t}(),ce=function(t){function n(t){var e;return c(this,n),(e=f(this,a(n).call(this))).ease=he[t||It]||t,e}return u(n,le),o(n,[{key:"step",value:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}]),n}(),fe=function(t){function n(t){var e;return c(this,n),(e=f(this,a(n).call(this))).stepper=t,e}return u(n,le),o(n,[{key:"step",value:function(t,e,n,i){return this.stepper(t,e,n,i)}},{key:"done",value:function(t){return t.done}}]),n}();function de(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,i=Math.log(e/100+1e-10),r=-i/Math.sqrt(n*n+i*i),s=3.9/(r*t);this.d=2*r*s,this.k=s*s}var ve=function(t){function i(t,e){var n;return c(this,i),(n=f(this,a(i).call(this))).duration(t||500).overshoot(e||0),n}return u(i,fe),o(i,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;100<n&&(n=16),n/=1e3;var r=i.velocity||0,s=-this.d*r-this.k*(t-e),u=t+r*n+s*n*n/2;return i.velocity=r+s*n,i.done=Math.abs(e-u)+Math.abs(r)<.002,i.done?e:u}}]),i}();Y(ve,{duration:ae("_duration",de),overshoot:ae("_overshoot",de)});var ye=function(t){function s(t,e,n,i){var r;return c(this,s),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,i=null==i?1e3:i,(r=f(this,a(s).call(this))).p(t).i(e).d(n).windup(i),r}return u(s,fe),o(s,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;var r=e-t,s=(i.integral||0)+r*n,u=(r-(i.error||0))/n,o=this.windup;return!1!==o&&(s=Math.max(-o,Math.min(s,o))),i.error=r,i.integral=s,i.done=Math.abs(r)<.001,i.done?e:t+(this.P*r+this.I*s+this.D*u)}}]),s}();Y(ye,{windup:ae("windup"),p:ae("P"),i:ae("I"),d:ae("D")});var pe=function(){function i(t){c(this,i),this._stepper=t||new ce("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return o(i,[{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){if(!this._type){var e=l(t);"number"===e?this.type(V):"string"===e?oe.isColor(t)?this.type(oe):regex.delimiter.test(t)?this.type(regex.pathLetters.test(t)?Tt:gt):regex.numberAndUnit.test(t)?this.type(V):this.type(i.NonMorphable):-1<MorphableTypes.indexOf(t.constructor)?this.type(t.constructor):Array.isArray(t)?this.type(gt):"object"===e?this.type(i.ObjectBag):this.type(i.NonMorphable)}var n=new this._type(t).toArray();return this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object),n}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)}},{key:"at",value:function(n){var i=this;return this._morphObj.fromArray(this._from.map(function(t,e){return i._stepper.step(t,i._to[e],n,i._context[e],i._context)}))}}]),i}();pe.NonMorphable=function(){function t(){c(this,t),this.init.apply(this,arguments)}return o(t,[{key:"init",value:function(t){t=Array.isArray(t)?t[0]:t,this.value=t}},{key:"valueOf",value:function(){return this.value}},{key:"toArray",value:function(){return[this.value]}}]),t}(),pe.TransformBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return o(t,[{key:"init",value:function(t){Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,pe.TransformBag.defaults,t)}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),t}(),pe.TransformBag.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0},pe.ObjectBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return o(t,[{key:"init",value:function(t){if(this.values=[],Array.isArray(t))this.values=t;else{var e=Object.entries(t||{}).sort(function(t,e){return t[0]-e[0]});this.values=e.reduce(function(t,e){return t.concat(e)},[])}}},{key:"valueOf",value:function(){for(var t={},e=this.values,n=0,i=e.length;n<i;n+=2)t[e[n]]=e[n+1];return t}},{key:"toArray",value:function(){return this.values}}]),t}(),Y([V,oe,se,re,gt,wt,Tt,pe.NonMorphable,pe.TransformBag,pe.ObjectBag],{to:function(t,e){return(new pe).type(this.constructor).from(this.valueOf()).to(t,e)},fromArray:function(t){return this.init(t),this}});var me=window.performance||Date,ge=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},we=function(){function t(){c(this,t),this._timeSource=function(){return me.now()},this._dispatcher=document.createElement("div"),this._startTime=0,this._speed=1,this._reverse=!1,this._persist=0,this._nextFrame=null,this._paused=!1,this._runners=[],this._order=[],this._time=0,this._lastSourceTime=0,this._lastStepTime=0}return o(t,[{key:"getEventTarget",value:function(){return this._dispatcher}},{key:"schedule",value:function(t,e,n){if(null==t)return this._runners.map(ge).sort(function(t,e){return t.start-e.start||t.duration-e.duration});this.active()||(this._step(),null==n&&(n="now"));var i=0;if(e=e||0,null==n||"last"===n||"after"===n)i=this._startTime;else if("absolute"===n||"start"===n)i=e,e=0;else if("now"===n)i=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var r=this._runners[t.id];r&&(i=r.start+e,e=0)}return t.unschedule(),t.timeline(this),t.time(-e),this._startTime=i+t.duration()+e,this._runners[t.id]={persist:this.persist(),runner:t,start:i},this._order.push(t.id),this._continue(),this}},{key:"unschedule",value:function(t){var e=this._order.indexOf(t.id);return e<0||(delete this._runners[t.id],this._order.splice(e,1),t.timeline(null)),this}},{key:"play",value:function(){return this._paused=!1,this._continue()}},{key:"pause",value:function(){return this._nextFrame=null,this._paused=!0,this}},{key:"stop",value:function(){return this.seek(-this._time),this.pause()}},{key:"finish",value:function(){return this.seek(1/0),this.pause()}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)}},{key:"seek",value:function(t){return this._time+=t,this._continue()}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this)}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"_step",value:function(){if(!this._paused){var t=this._timeSource(),e=t-this._lastSourceTime,n=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=t,this._time+=n,this._lastStepTime=this._time;for(var i=!1,r=0,s=this._order.length;r<s;r++){var u=this._runners[this._order[r]],o=u.runner,a=n,h=this._time-u.start;if(h<0)i=!0;else if(h<a&&(a=h),o.active())if(o.step(a).done){if(!0!==u.persist){o.duration()-o.time()+this._time+this._persist<this._time&&(delete this._runners[this._order[r]],this._order.splice(r--,1)&&--s,o.timeline(null))}}else i=!0}return this._nextFrame=i?ee.frame(this._step.bind(this)):null,this}}},{key:"_continue",value:function(){return this._paused||this._nextFrame||(this._nextFrame=ee.frame(this._step.bind(this))),this}},{key:"active",value:function(){return!!this._nextFrame}}]),t}();we.constructors={Element:{timeline:function(){return this._timeline=this._timeline||new we,this._timeline}}};var xe=function(){function s(t){c(this,s),this.id=s.id++,t="function"==typeof(t=null==t?Ft:t)?new fe(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof fe,this._stepper=this._isDeclarative?t:new ce,this._history={},this.enabled=!0,this._time=0,this._last=0,this.transforms=new re,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1}return o(s,[{key:"element",value:function(t){return null==t?this._element:((this._element=t)._prepareRunner(),this)}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"animate",value:function(t,e,n){var i=s.sanitise(t,e,n),r=new s(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(e,n)}},{key:"schedule",value:function(t,e,n){if(t instanceof we||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"loop",value:function(t,e,n){return"object"===l(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,this}},{key:"delay",value:function(t){return this.animate(0,t)}},{key:"queue",value:function(t,e,n){return this._queue.push({initialiser:t||Rt,runner:e||Rt,isTransform:n,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}},{key:"during",value:function(t){return this.queue(null,t)}},{key:"after",value:function(t){return this.on("finish",t)}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"duration",value:function(){return this._times*(this._wait+this._duration)-this._wait}},{key:"loops",value:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),i=(this._time-n*e)/this._duration;return Math.min(n+i,this._times)}var r=t%1,s=e*Math.floor(t)+this._duration*r;return this.time(s)}},{key:"position",value:function(t){var e,n=this._time,r=this._duration,s=this._wait,i=this._times,u=this._swing,o=this._reverse;if(null==t){var a=function(t){var e=u*Math.floor(t%(2*(s+r))/(s+r)),n=e&&!o||!e&&o,i=Math.pow(-1,n)*(t%(s+r))/r+n;return Math.max(Math.min(i,1),0)},h=i*(s+r)-s;return e=n<=0?Math.round(a(1e-5)):n<h?a(n):Math.round(a(h-1e-5)),e}var l=Math.floor(this.loops()),c=u&&l%2==0;return e=l+(c&&!o||o&&c?t:1-t),this.loops(e)}},{key:"progress",value:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}},{key:"step",value:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&0<=this._time;this._lastPosition=e;var i=this.duration(),r=(this._lastTime<0&&this._time,this._lastTime<this._time&&this.time>i);this._lastTime=this._time;var s=this._isDeclarative;if(this.done=!s&&!r&&this._time>=i,n||s){this._initialise(n),this.transforms=new re;var u=this._run(s?t:e)}return this.done=this.done||u&&s,this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new ce(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]}}},{key:"_tryRetarget",value:function(t,e){if(this._history[t]){if(!this._history[t].caller.initialised){var n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.isTransform?this._history[t].caller.isTransform(e):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i._continue(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var i=this._queue[e],r=this._isDeclarative||!i.initialised&&t;t=!i.finished,r&&t&&(i.initialiser.call(this),i.initialised=!0)}}},{key:"_run",value:function(t){for(var e=!0,n=0,i=this._queue.length;n<i;++n){var r=this._queue[n],s=r.runner.call(this,t);r.finished=r.finished||!0===s,e=e&&r.finished}return e}},{key:"addTransform",value:function(t,e){return this.transforms.lmultiplyO(t),this}},{key:"clearTransform",value:function(){return this.transforms=new re,this}}],[{key:"sanitise",value:function(t,e,n){var i=1,r=!1,s=0;return e=e||Xt,n=n||"last","object"!==l(t=t||Ft)||t instanceof le||(e=t.delay||e,n=t.when||n,r=t.swing||r,i=t.times||i,s=t.wait||s,t=t.duration||Ft),{duration:t,delay:e,swing:r,times:i,wait:s,when:n}}}]),s}();xe.id=0;var be=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new re,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];c(this,t),this.transforms=e,this.id=n,this.done=i};Y([xe,be],{mergeWith:function(t){return new be(t.transforms.lmultiply(this.transforms),t.id)}});var ke=function(t,e){return t.lmultiplyO(e)},_e=function(t){return t.transforms};var Oe=function(){function t(){c(this,t),this.runners=[],this.ids=[]}return o(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var n=t.id+1,e=this.ids.reduce(function(t,e){return t<e&&e<n?e:t},0),i=this.ids.indexOf(e)+1;return this.ids.splice(i,0,n),this.runners.splice(i,0,t),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var n=this,i=null;return this.runners.forEach(function(t,e){i&&t.done&&i.done&&(n.remove(t.id),n.edit(i.id,t.mergeWith(i))),i=t}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new be),this}}]),t}(),Ae=0;xe.constructors={Element:{animate:function(t,e,n){var i=xe.sanitise(t,e,n),r=this.timeline();return new xe(i.duration).loop(i).element(this).timeline(r).schedule(e,n)},delay:function(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(e){return this._transformationRunners.runners.filter(function(t){return t.id<=e.id}).map(_e).reduce(ke,new re)},addRunner:function(t){this._transformationRunners.add(t),ee.transform_frame(function(){var t=this._transformationRunners.runners.map(_e).reduce(ke,new re);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}.bind(this),this._frameId)},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new Oe).add(new be(new re(this))),this._frameId=Ae++)}}},Y(xe,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(e,n,t){if("object"===l(n))for(var i in t)this.styleAttr(e,i,t[i]);var r=new pe(this._stepper).to(t);return this.queue(function(){r=r.from(this.element()[e](n))},function(t){return this.element()[e](n,r.at(t)),r.done()}),this},zoom:function(t,e){var n=new pe(this._stepper).to(new V(t));return this.queue(function(){n=n.from(this.zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()}),this},transform:function(d,v,y){if(v=d.relative||v,this._isDeclarative&&!v&&this._tryRetarget("transform",d))return this;var p=R(d);y=null!=d.affine?d.affine:null!=y?y:!p;var m,g,w,x,b,k=(new pe).type(y?pe.TransformBag:re).stepper(this._stepper);return this.queue(function(){g=g||this.element(),m=m||F(d,g),b=new re(v?void 0:g),g.addRunner(this),v||g._clearTransformRunnersBefore(this)},function(t){v||this.clearTransform();var e=new Ot(m).transform(g._currentTransform(this)),n=e.x,i=e.y,r=new re(_({},d,{origin:[n,i]})),s=this._isDeclarative&&w?w:b;if(y){r=r.decompose(n,i),s=s.decompose(n,i);var u=r.rotate,o=s.rotate,a=[u-360,u,u+360],h=a.map(function(t){return Math.abs(t-o)}),l=Math.min.apply(Math,O(h)),c=h.indexOf(l);r.rotate=a[c]}v&&(p||(r.rotate=d.rotate||0),this._isDeclarative&&x&&(s.rotate=x)),k.from(s),k.to(r);var f=k.at(t);return x=f.rotate,w=new re(f),this.addTransform(w),k.done()},function(t){(t.origin||"center").toString()!==(d.origin||"center").toString()&&(m=F(d,g)),d=_({},t,{origin:m})}),this._isDeclarative&&this._rememberMorpher("transform",k),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(t){return this._queueNumberDelta("dx",t)},dy:function(t){return this._queueNumberDelta("dy",t)},_queueNumberDelta:function(e,n){if(n=new V(n),this._tryRetargetDelta(e,n))return this;var i=new pe(this._stepper).to(n);return this.queue(function(){var t=this.element()[e]();i.from(t),i.to(t+n)},function(t){return this.element()[e](i.at(t)),i.done()}),this._rememberMorpher(e,i),this},_queueObject:function(e,t){if(this._tryRetarget(e,t))return this;var n=new pe(this._stepper).to(t);return this.queue(function(){n.from(this.element()[e]())},function(t){return this.element()[e](n.at(t)),n.done()}),this._rememberMorpher(e,n),this},_queueNumber:function(t,e){return this._queueObject(t,new V(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,i){return 4===arguments.length?this.plot([t,e,n,i]):this._queueObject("plot",new this._element.MorphArray(t))},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,i){return this._queueObject("viewbox",new Box(t,e,n,i))},update:function(t){return"object"!==l(t)?this.update({offset:t,color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}});var Ce=Object.freeze({HtmlNode:ht,Doc:it,Defs:nt,G:at,Animator:ee,Bare:G,Circle:tt,ClipPath:et,A:lt,Ellipse:rt,Stop:st,Gradient:ot,Image:pt,Line:xt,Marker:bt,Mask:kt,Path:Et,Pattern:ct,Polygon:Pt,Polyline:zt,Rect:qt,Symbol:Lt,Text:Gt,TextPath:Vt,Tspan:ne,Use:Ht,SVGNumber:V,SVGArray:gt,PathArray:Tt,PointArray:wt,Matrix:re,Point:Ot,Box:se,Color:oe,Morphable:pe,Queue:te,Runner:xe,Timeline:we,Controller:fe,Ease:ce,PID:ye,Spring:ve}),Me=Object.freeze({Bare:G,ClipPath:et,Defs:nt,Doc:it,Gradient:ot,G:at,A:lt,Marker:bt,Mask:kt,Pattern:ct,Symbol:Lt});var je=Object.freeze({siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),e instanceof it&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return 0<t&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),t instanceof it&&t.node.appendChild(t.defs().node),this},back:function(){return 0<this.position()&&this.parent().removeElement(this).add(this,0),this},before:function(t){t.remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){t.remove();var e=this.position();return this.parent().add(t,e+1),this}});function Te(t){return e=t,n=this.node,utils.map((n||document).querySelectorAll(e),function(t){return $t(t)});var e,n}var Ee=Object.freeze({css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var i=!0,r=!1,s=void 0;try{for(var u,o=t[Symbol.iterator]();!(i=(u=o.next()).done);i=!0){var a=S(u.value);n[a]=this.node.style(a)}}catch(t){r=!0,s=t}finally{try{i||null==o.return||o.return()}finally{if(r)throw s}}return n}if("string"==typeof t)return this.node.style[S(t)];if("object"===l(t))for(name in t)this.node.style[S(name)]=null==t[name]||w.test(t[name])?"":t[name]}return 2===arguments.length&&(this.node.style[S(t)]=null==e||w.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}});var Se=Object.freeze({untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(t).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(k).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(z(e[1])):t[e[0]].apply(t,e[1])},new re)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())},transform:function(t,e){if(null==t||"string"==typeof t){var n=new re(this).decompose();return n[t]||n}R(t)||(t=_({},t,{origin:F(t,this)}));var i=new re(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});function Ne(t,e,n){if(null==t){t={},e=this.node.attributes;var i=!0,r=!1,s=void 0;try{for(var u,o=e[Symbol.iterator]();!(i=(u=o.next()).done);i=!0){var a=u.value;t[a.nodeName]=isNumer.test(a.nodeValue)?parseFloat(a.nodeValue):a.nodeValue}}catch(t){r=!0,s=t}finally{try{i||null==o.return||o.return()}finally{if(r)throw s}}return t}if(Array.isArray(t));else if("object"===l(t))for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Yt[t]:x.test(e)?parseFloat(e):e;"fill"!==t&&"stroke"!==t||(b.test(e)&&(e=this.doc().defs().image(e)),e instanceof pt&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new V(e):oe.isColor(e)?e=new oe(e):Array.isArray(e)&&(e=new gt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this}function De(){return this.parent()&&this.parent().removeElement(this),this}var Pe=Object.freeze({name:"Element",setup:function(t){this.dom={},this.node=t,this.type=t.nodeName,this.node.instance=this,t.hasAttribute("svgjs:data")&&this.setData(JSON.parse(t.getAttribute("svgjs:data"))||{})},x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=P(this,t,e);return this.width(new V(n.width)).height(new V(n.height))},clone:function(t){this.writeDataToDom();var e=Jt(this.node.cloneNode(!0));return t?t.add(e):this.after(e),e},remove:De,replace:function(t){return this.after(t).remove(),t},addTo:function(t){return Qt(t).put(this)},putIn:function(t){return Qt(t).add(this)},id:function(t){return void 0!==t||this.node.id||(this.node.id=Zt(this.type)),this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},toString:function(){return this.id()},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(k)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return get(this.attr(t))},parent:function(t){var e=this;if(!e.node.parentNode)return null;if(e=$t(e.node.parentNode),!t)return e;for(;e&&e.node instanceof window.SVGElement;){if("string"==typeof t?e.matches(t):e instanceof t)return e;e=$t(e.node.parentNode)}},doc:function(){var t=this.parent(it);return t&&t.doc()},defs:function(){return this.doc().defs()},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function t(e){return t(this.node)},native:function(){return this.node},svg:function(){return this.writeDataToDom(),this.node.outerHTML},writeDataToDom:function(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(t){return this.dom=t,this},getEventTarget:function(){return this.node},attr:Ne});var ze=Object.freeze({name:"EventTarget",setup:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.events=t.events||{}},on:function(t,e,n,i){return vt(this,t,e,n,i),this},off:function(t,e){return yt(this,t,e),this},dispatch:function(t,e){return n=t,i=e,r=dt(this),n instanceof window.Event||(n=new window.CustomEvent(n,{detail:i,cancelable:!0})),r.dispatchEvent(n),n;var n,i,r},fire:function(t,e){return this.dispatch(t,e),this}});var qe=Object.freeze({children:function(){return function(t,e){var n,i=t.length,r=[];for(n=0;n<i;n++)r.push(e(t[n]));return r}(this.node.children,function(t){return $t(t)})},add:function(t,e){return(t=Qt(t)).node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this},put:function(t,e){return this.add(t,e),t.instance||t},has:function(t){return 0<=this.index(t)},index:function(t){return[].slice.call(this.node.children).indexOf(t.node)},get:function(t){return $t(this.node.children[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.children.length-1)},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;n<i;n++)r[n]instanceof Base&&t.apply(r[n],[n,r]),e&&r[n]instanceof Base&&r[n].is("Parent")&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},svg:function(t){var e,n;if(!t)return this.writeDataToDom(),this.node.outerHTML;for((e=document.createElementNS(ns,"svg")).innerHTML=t,n=e.children.length;n--;)this.node.appendChild(e.firstElementChild);return this},writeDataToDom:function(){return this.each(function(){this.writeDataToDom()}),this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},flatten:function(t){return this.each(function(){return this.is("Parent")?this.flatten(t).ungroup(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this},ungroup:function(t){return t=t||this.parent(),this.each(function(){return this.toParent(t)}),this.remove(),this}}),Le=Y;for(var Re in Le([it,Lt,pt,ct,bt],{viewbox:se.constructors.viewbox}),Le([xt,zt,Pt,Et],_({},bt.constructors.marker)),Le(Gt,Vt.constructors.Text),Le(Et,Vt.constructors.Path),Le(nt,_({},ot.constructors.Defs,bt.constructors.Defs,ct.constructors.Defs)),Le([Gt,ne],ne.constructors.Tspan),Le([ot,ct],{remove:function(){return this.targets().forEach(function(t){t.unFill()}),De.call(this)},targets:function(){return Te('svg [fill*="'+this.id()+'"]')},unFill:function(){this.attr("fill",null)}}),Le(ot,{attr:function(t,e,n){return"transform"===t&&(t="gradientTransform"),Ne.call(this,t,e,n)}}),Le(ct,{attr:function(t,e,n){return"transform"===t&&(t="patternTransform"),Ne.call(this,t,e,n)}}),Le(et,{remove:function(){return this.targets().forEach(function(t){t.unclip()}),De.call(this)},targets:function(){return Te('svg [clip-path*="'+this.id()+'"]')}}),Le(kt,{remove:function(){return this.targets().forEach(function(t){t.unmask()}),De.call(this)},targets:function(){return Te('svg [mask*="'+this.id()+'"]')}}),Le(Et,{targets:function(){return Te('svg textpath [href*="'+this.id()+'"]')}}),Le(ht,{add:function(t,e){return(t=Qt(t)).node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this}}),Me)Le(Me[Re],_({},lt.constructors.Container,et.constructors.Container,it.constructors.Container,at.constructors.Container,ot.constructors.Container,xt.constructors.Container,bt.constructors.Container,kt.constructors.Container,Et.constructors.Container,ct.constructors.Container,Pt.constructors.Container,zt.constructors.Container,qt.constructors.Container,{find:Te},Lt.constructors.Container,Gt.constructors.Container,Vt.constructors.Container,Ht.constructors.Container));for(var Fe in Ut)Le(Ut[Fe],_({},ze,Pe,qe,je,lt.constructors.Element,se.constructors.Element,tt.constructors.Element,et.constructors.Element,Ee,pt.constructors.Element,kt.constructors.Element,re.constructors.Element,Ot.constructors.Element,xe.constructors.Element,we.constructors.Element,Se));function Ie(t){return Qt(t)}return Object.assign(Ie,Ce),Object.assign(Ie,B),Object.assign(Ie,Kt),Ie}(); diff --git a/dist/svg.new.js b/dist/svg.new.js deleted file mode 100644 index 1151feb..0000000 --- a/dist/svg.new.js +++ /dev/null @@ -1,6240 +0,0 @@ -var SVG = (function () { - 'use strict'; - - class Base$1 { - constructor (node, {extensions = []}) { - this.tags = []; - - for (let extension of extensions) { - extension.setup.call(this, node); - this.tags.push(extension.name); - } - } - - is (ability) { - return this.tags.includes(ability) - } - } - - // Default namespaces - let ns$1 = 'http://www.w3.org/2000/svg'; - let xmlns = 'http://www.w3.org/2000/xmlns/'; - let xlink = 'http://www.w3.org/1999/xlink'; - let svgjs = 'http://svgjs.com/svgjs'; - - // Parse unit value - let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; - - // Parse hex value - let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; - - // Parse rgb value - let rgb = /rgb\((\d+),(\d+),(\d+)\)/; - - // splits a transformation chain - let transforms = /\)\s*,?\s*/; - - // Whitespace - let whitespace = /\s/g; - - // Test hex value - let isHex = /^#[a-f0-9]{3,6}$/i; - - // Test rgb value - let isRgb = /^rgb\(/; - - // Test for blank string - let isBlank = /^(\s+)?$/; - - // Test for numeric string - let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; - - // Test for image url - let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; - - // split at whitespace and comma - let delimiter = /[\s,]+/; - - // The following regex are used to parse the d attribute of a path - - // Matches all hyphens which are not after an exponent - let hyphen = /([^e])-/gi; - - // Replaces and tests for all path letters - let pathLetters = /[MLHVCSQTAZ]/gi; - - // yes we need this one, too - let isPathLetter = /[MLHVCSQTAZ]/i; - - // matches 0.154.23.45 - let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; - - // matches . - let dots = /\./g; - - function isNulledBox (box) { - return !box.w && !box.h && !box.x && !box.y - } - - function domContains (node) { - return (document.documentElement.contains || function (node) { - // This is IE - it does not support contains() for top-level SVGs - while (node.parentNode) { - node = node.parentNode; - } - return node === document - }).call(document.documentElement, node) - } - - function pathRegReplace (a, b, c, d) { - return c + d.replace(dots, ' .') - } - - // Convert dash-separated-string to camelCase - function camelCase (s) { - return s.toLowerCase().replace(/-(.)/g, function (m, g) { - return g.toUpperCase() - }) - } - - // Capitalize first letter of a string - function capitalize (s) { - return s.charAt(0).toUpperCase() + s.slice(1) - } - - // Ensure to six-based hex - function fullHex (hex$$1) { - return hex$$1.length === 4 - ? [ '#', - hex$$1.substring(1, 2), hex$$1.substring(1, 2), - hex$$1.substring(2, 3), hex$$1.substring(2, 3), - hex$$1.substring(3, 4), hex$$1.substring(3, 4) - ].join('') - : hex$$1 - } - - // Component to hex value - function compToHex (comp) { - var hex$$1 = comp.toString(16); - return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1 - } - - // Calculate proportional width and height values when necessary - function proportionalSize$1 (element, width, height) { - if (width == null || height == null) { - var box = element.bbox(); - - if (width == null) { - width = box.width / box.height * height; - } else if (height == null) { - height = box.height / box.width * width; - } - } - - return { - width: width, - height: height - } - } - - // Map matrix array to object - function arrayToMatrix (a) { - return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] } - } - - // PathArray Helpers - function arrayToString (a) { - for (var i = 0, il = a.length, s = ''; i < il; i++) { - s += a[i][0]; - - if (a[i][1] != null) { - s += a[i][1]; - - if (a[i][2] != null) { - s += ' '; - s += a[i][2]; - - if (a[i][3] != null) { - s += ' '; - s += a[i][3]; - s += ' '; - s += a[i][4]; - - if (a[i][5] != null) { - s += ' '; - s += a[i][5]; - s += ' '; - s += a[i][6]; - - if (a[i][7] != null) { - s += ' '; - s += a[i][7]; - } - } - } - } - } - } - - return s + ' ' - } - - // Add more bounding box properties - function fullBox (b) { - if (b.x == null) { - b.x = 0; - b.y = 0; - b.width = 0; - b.height = 0; - } - - b.w = b.width; - b.h = b.height; - b.x2 = b.x + b.width; - b.y2 = b.y + b.height; - b.cx = b.x + b.width / 2; - b.cy = b.y + b.height / 2; - - return b - } - - // Create matrix array for looping - let abcdef = 'abcdef'.split(''); - - function closeEnough (a, b, threshold) { - return Math.abs(b - a) < (threshold || 1e-6) - } - - function isMatrixLike (o) { - return ( - o.a != null || - o.b != null || - o.c != null || - o.d != null || - o.e != null || - o.f != null - ) - } - - function getOrigin (o, element) { - // Allow origin or around as the names - let origin = o.origin; // o.around == null ? o.origin : o.around - let ox, oy; - - // Allow the user to pass a string to rotate around a given point - if (typeof origin === 'string' || origin == null) { - // Get the bounding box of the element with no transformations applied - const string = (origin || 'center').toLowerCase().trim(); - const { height, width, x, y } = element.bbox(); - - // Calculate the transformed x and y coordinates - let bx = string.includes('left') ? x - : string.includes('right') ? x + width - : x + width / 2; - let by = string.includes('top') ? y - : string.includes('bottom') ? y + height - : y + height / 2; - - // Set the bounds eg : "bottom-left", "Top right", "middle" etc... - ox = o.ox != null ? o.ox : bx; - oy = o.oy != null ? o.oy : by; - } else { - ox = origin[0]; - oy = origin[1]; - } - - // Return the origin as it is if it wasn't a string - return [ ox, oy ] - } - - function nodeOrNew$1 (name, node) { - return node || makeNode$1(name) - } - - // Method for element creation - function makeNode$1 (name) { - // create element - return document.createElementNS(ns$1, name) - } - - // Method for extending objects - function extend$1 (modules, methods) { - var key, i; - - if (Array.isArray(methods)) { - methods.forEach((method) => { - extend$1(modules, method); - }); - return - } - - modules = Array.isArray(modules) ? modules : [modules]; - - for (i = modules.length - 1; i >= 0; i--) { - if (methods.name) { - modules[i].extensions = (modules[i].extensions || []).concat(methods); - } - for (key in methods) { - if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue - modules[i].prototype[key] = methods[key]; - } - } - } - - // FIXME: enhanced constructors here - function addFactory (modules, methods) { - extend$1(modules, methods); - } - - // Invent new element - function invent (config) { - // Create element initializer - var initializer = typeof config.create === 'function' ? config.create - : function (node) { - config.inherit.call(this, node || makeNode$1(config.create)); - }; - - // Inherit prototype - if (config.inherit) { - initializer.prototype = new config.inherit(); - initializer.prototype.constructor = initializer; - } - - // Extend with methods - if (config.extend) { - extend$1(initializer, config.extend); - } - - // Attach construct method to parent - if (config.construct) { extend$1(config.parent || Container, config.construct); } - - return initializer - } - - var tools = /*#__PURE__*/Object.freeze({ - nodeOrNew: nodeOrNew$1, - makeNode: makeNode$1, - extend: extend$1, - addFactory: addFactory, - invent: invent - }); - - function Bare (element, inherit = {}) { - let custom = class Custom extends inherit { - constructor (node) { - super(nodeOrNew$1(element, node), Custom); - } - - words (text) { - // remove contents - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } - - // create text node - this.node.appendChild(document.createTextNode(text)); - - return this - } - }; - - extend(custom, inherit); - } - - // export let constructors = { - // // Create an element that is not described by SVG.js - // element: function (element, inherit) { - // let custom = createCustom(element, inherit) - // return this.put(new custom()) - // } - // } - - // extend(Parent, { - // // Create an element that is not described by SVG.js - // element: function (element, inherit) { - // let custom = createCustom(element, inherit) - // return this.put(new custom()) - // } - // }) - - // Module for unit convertions - class SVGNumber { - // Initialize - constructor (...args) { - this.init(...args); - } - - init (value, unit) { - unit = Array.isArray(value) ? value[1] : unit; - value = Array.isArray(value) ? value[0] : value; - - // initialize defaults - this.value = 0; - this.unit = unit || ''; - - // parse value - if (typeof value === 'number') { - // ensure a valid numeric value - this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value; - } else if (typeof value === 'string') { - unit = value.match(numberAndUnit); - - if (unit) { - // make value numeric - this.value = parseFloat(unit[1]); - - // normalize - if (unit[5] === '%') { this.value /= 100; } else if (unit[5] === 's') { - this.value *= 1000; - } - - // store unit - this.unit = unit[5]; - } - } else { - if (value instanceof SVGNumber) { - this.value = value.valueOf(); - this.unit = value.unit; - } - } - } - - toString () { - return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 - : this.unit === 's' ? this.value / 1e3 - : this.value - ) + this.unit - } - - toJSON () { - return this.toString() - } - - - toArray () { - return [this.value, this.unit] - } - - valueOf () { - return this.value - } - - // Add number - plus (number) { - number = new SVGNumber(number); - return new SVGNumber(this + number, this.unit || number.unit) - } - - // Subtract number - minus (number) { - number = new SVGNumber(number); - return new SVGNumber(this - number, this.unit || number.unit) - } - - // Multiply number - times (number) { - number = new SVGNumber(number); - return new SVGNumber(this * number, this.unit || number.unit) - } - - // Divide number - divide (number) { - number = new SVGNumber(number); - return new SVGNumber(this / number, this.unit || number.unit) - } - } - - // FIXME: import this to runner - - // Radius x value - function rx (rx) { - return this.attr('rx', rx) - } - - // Radius y value - function ry (ry) { - return this.attr('ry', ry) - } - - // Move over x-axis - function x (x) { - return x == null - ? this.cx() - this.rx() - : this.cx(x + this.rx()) - } - - // Move over y-axis - function y (y) { - return y == null - ? this.cy() - this.ry() - : this.cy(y + this.ry()) - } - - // Move by center over x-axis - function cx (x) { - return x == null - ? this.attr('cx') - : this.attr('cx', x) - } - - // Move by center over y-axis - function cy (y) { - return y == null - ? this.attr('cy') - : this.attr('cy', y) - } - - // Set width of element - function width (width) { - return width == null - ? this.rx() * 2 - : this.rx(new SVGNumber(width).divide(2)) - } - - // Set height of element - function height (height) { - return height == null - ? this.ry() * 2 - : this.ry(new SVGNumber(height).divide(2)) - } - - // Custom size function - function size (width, height) { - var p = proportionalSize$1(this, width, height); - - return this - .rx(new SVGNumber(p.width).divide(2)) - .ry(new SVGNumber(p.height).divide(2)) - } - - var circled = /*#__PURE__*/Object.freeze({ - rx: rx, - ry: ry, - x: x, - y: y, - cx: cx, - cy: cy, - width: width, - height: height, - size: size - }); - - class Circle extends Base$1 { - constructor (node) { - super(nodeOrNew$1('circle', node), Circle); - } - - radius (r) { - return this.attr('r', r) - } - - // Radius x value - rx (rx$$1) { - return this.attr('r', rx$$1) - } - - // Alias radius x value - ry (ry$$1) { - return this.rx(ry$$1) - } - } - - extend$1(Circle, {x, y, cx, cy, width, height, size}); - - Circle.constructors = { - Element: { - // Create circle element - circle (size$$1) { - return this.put(new Circle()) - .radius(new SVGNumber(size$$1).divide(2)) - .move(0, 0) - } - } - }; - - //import find from './selector.js' - //import {remove} from './Element.js' - - class ClipPath extends Base$1 { - constructor (node) { - super(nodeOrNew$1('clipPath', node), ClipPath); - } - - // // Unclip all clipped elements and remove itself - // remove () { - // // unclip all targets - // this.targets().forEach(function (el) { - // el.unclip() - // }) - // - // // remove clipPath from parent - // return remove.call(this) - // } - // - // targets () { - // return find('svg [clip-path*="' + this.id() + '"]') - // } - } - - - ClipPath.constructors = { - Container: { - // Create clipping element - clip: function() { - return this.defs().put(new ClipPath) - } - }, - Element: { - // Distribute clipPath to svg element - clipWith (element) { - // use given clip or create a new one - let clipper = element instanceof ClipPath - ? element - : this.parent().clip().add(element); - - // apply mask - return this.attr('clip-path', 'url("#' + clipper.id() + '")') - }, - - // Unclip element - unclip () { - return this.attr('clip-path', null) - }, - - clipper () { - return this.reference('clip-path') - } - } - }; - - class Defs extends Base$1 { - constructor (node) { - super(nodeOrNew$1('defs', node), Defs); - } - - flatten () { return this } - ungroup () { return this } - } - - //import {adopt} from './adopter.js' - - class Doc$1 extends Base$1 { - constructor(node) { - super(nodeOrNew$1('svg', node), Doc$1); - this.namespace(); - } - - isRoot() { - return !this.node.parentNode - || !(this.node.parentNode instanceof window.SVGElement) - || this.node.parentNode.nodeName === '#document' - } - - // Check if this is a root svg - // If not, call docs from this element - doc() { - if (this.isRoot()) return this - return Element.doc.call(this) - } - - // Add namespaces - namespace() { - if (!this.isRoot()) return this.doc().namespace() - return this - .attr({ xmlns: ns$1, version: '1.1' }) - .attr('xmlns:xlink', xlink, xmlns) - .attr('xmlns:svgjs', svgjs, xmlns) - } - - // Creates and returns defs element - defs() { - if (!this.isRoot()) return this.doc().defs() - - let node = this.node.getElementsByTagName('defs')[0]; - return node ? (node.instance || new Defs(node)) : this.put(new Defs()) - // - // return adopt(this.node.getElementsByTagName('defs')[0]) || - // this.put(new Defs()) - } - - // custom parent method - parent(type) { - if (this.isRoot()) { - return this.node.parentNode.nodeName === '#document' - ? null - : this.node.parentNode - } - - return Element.parent.call(this, type) - } - - // Removes the doc from the DOM - remove() { - if (!this.isRoot()) { - return Element.remove.call(this) - } - - if (this.parent()) { - this.parent().removeChild(this.node); - } - - return this - } - - clear() { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } - return this - } - } - - Doc$1.constructors = { - Container: { - // Create nested svg document - nested() { - return this.put(new Doc$1()) - } - } - }; - - class Ellipse extends Base$1 { - constructor (node) { - super(nodeOrNew('ellipse', node), Ellipse); - } - } - - extend$1(Ellipse, circled); - - // addFactory(Container, { - // // Create an ellipse - // ellipse: function (width, height) { - // return this.put(new Ellipse()).size(width, height).move(0, 0) - // } - // }) - - class Stop extends Base$1 { - constructor (node) { - super(nodeOrNew$1('stop', node), Stop); - } - - // add color stops - update (o) { - if (typeof o === 'number' || o instanceof SVGNumber) { - o = { - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - }; - } - - // set attributes - if (o.opacity != null) this.attr('stop-opacity', o.opacity); - if (o.color != null) this.attr('stop-color', o.color); - if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); - - return this - } - } - - // FIXME: add to runner - - function from (x, y) { - return (this._element || this).type === 'radialGradient' - ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) }) - : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) }) - } - - function to (x, y) { - return (this._element || this).type === 'radialGradient' - ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) }) - : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) }) - } - - var gradiented = /*#__PURE__*/Object.freeze({ - from: from, - to: to - }); - - //import attr from './attr.js' - - class Gradient extends Base$1 { - constructor (type) { - super( - nodeOrNew$1(type + 'Gradient', typeof type === 'string' ? null : type), - Gradient - ); - } - - // Add a color stop - stop (offset, color, opacity) { - return this.put(new Stop()).update(offset, color, opacity) - } - - // Update gradient - update (block) { - // remove all stops - this.clear(); - - // invoke passed block - if (typeof block === 'function') { - block.call(this, this); - } - - return this - } - - // Return the fill id - url () { - return 'url(#' + this.id() + ')' - } - - // Alias string convertion to fill - toString () { - return this.url() - } - - // // custom attr to handle transform - // attr (a, b, c) { - // if (a === 'transform') a = 'gradientTransform' - // return attr.call(this, a, b, c) - // } - } - - extend$1(Gradient, gradiented); - - Gradient.constructors = { - Container: { - // Create gradient element in defs - gradient (type, block) { - return this.defs().gradient(type, block) - } - }, - // define gradient - Defs: { - gradient (type, block) { - return this.put(new Gradient(type)).update(block) - } - } - }; - - class G extends Base$1 { - constructor (node) { - super(nodeorNew('g', node), G); - } - } - - G.constructors = { - Element: { - // Create a group element - group: function () { - return this.put(new G()) - } - } - }; - - //import {makeInstance} from './adopter.js' - - class HtmlNode extends Base$1 { - constructor (element) { - super(element, HtmlNode); - this.node = element; - } - - // add (element, i) { - // element = makeInstance(element) - // - // if (element.node !== this.node.children[i]) { - // this.node.insertBefore(element.node, this.node.children[i] || null) - // } - // - // return this - // } - - put (element, i) { - this.add(element, i); - return element - } - - getEventTarget () { - return this.node - } - } - - class A extends Base$1{ - constructor (node) { - super(nodeOrNew$1('a', node), A); - } - - // Link url - to (url) { - return this.attr('href', url, xlink) - } - - // Link target attribute - target (target) { - return this.attr('target', target) - } - } - - A.constructors = { - Container: { - // Create a hyperlink element - link: function (url) { - return this.put(new A()).to(url) - } - }, - Element: { - // Create a hyperlink element - linkTo: function (url) { - var link = new A(); - - if (typeof url === 'function') { url.call(link, link); } else { - link.to(url); - } - - return this.parent().put(link).put(this) - } - } - }; - - //import attr from './attr.js' - - class Pattern extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('pattern', node)); - } - - // Return the fill id - url () { - return 'url(#' + this.id() + ')' - } - - // Update pattern by rebuilding - update (block) { - // remove content - this.clear(); - - // invoke passed block - if (typeof block === 'function') { - block.call(this, this); - } - - return this - } - - // Alias string convertion to fill - toString () { - return this.url() - } - - // // custom attr to handle transform - // attr (a, b, c) { - // if (a === 'transform') a = 'patternTransform' - // return attr.call(this, a, b, c) - // } - } - - Pattern.constructors = { - Container: { - // Create pattern element in defs - pattern (width, height, block) { - return this.defs().pattern(width, height, block) - } - }, - Defs: { - pattern (width, height, block) { - return this.put(new Pattern()).update(block).attr({ - x: 0, - y: 0, - width: width, - height: height, - patternUnits: 'userSpaceOnUse' - }) - } - } - }; - - // // Add events to elements - // ;[ 'click', - // 'dblclick', - // 'mousedown', - // 'mouseup', - // 'mouseover', - // 'mouseout', - // 'mousemove', - // 'mouseenter', - // 'mouseleave', - // 'touchstart', - // 'touchmove', - // 'touchleave', - // 'touchend', - // 'touchcancel' ].forEach(function (event) { - // // add event to Element - // Element.prototype[event] = function (f) { - // if (f === null) { - // off(this, event) - // } else { - // on(this, event, f) - // } - // return this - // } - // }) - - let listenerId = 0; - - function getEventTarget (node) { - return node instanceof Base && node.is('EventTarget') - ? node.getEventTarget() - : node - } - - // Add event binder in the SVG namespace - function on (node, events, listener, binding, options) { - var l = listener.bind(binding || node); - var n = getEventTarget(node); - - // events can be an array of events or a string of events - events = Array.isArray(events) ? events : events.split(delimiter); - - // ensure instance object for nodes which are not adopted - n.instance = n.instance || {events: {}}; - - // pull event handlers from the element - var bag = n.instance.events; - - // add id to listener - if (!listener._svgjsListenerId) { - listener._svgjsListenerId = ++listenerId; - } - - events.forEach(function (event) { - var ev = event.split('.')[0]; - var ns = event.split('.')[1] || '*'; - - // ensure valid object - bag[ev] = bag[ev] || {}; - bag[ev][ns] = bag[ev][ns] || {}; - - // reference listener - bag[ev][ns][listener._svgjsListenerId] = l; - - // add listener - n.addEventListener(ev, l, options || false); - }); - } - - // Add event unbinder in the SVG namespace - function off (node, events, listener, options) { - var n = getEventTarget(node); - - // we cannot remove an event if its not an svg.js instance - if (!n.instance) return - - // listener can be a function or a number - if (typeof listener === 'function') { - listener = listener._svgjsListenerId; - if (!listener) return - } - - // pull event handlers from the element - var bag = n.instance.events; - - // events can be an array of events or a string or undefined - events = Array.isArray(events) ? events : (events || '').split(delimiter); - - events.forEach(function (event) { - var ev = event && event.split('.')[0]; - var ns = event && event.split('.')[1]; - var namespace, l; - - if (listener) { - // remove listener reference - if (bag[ev] && bag[ev][ns || '*']) { - // removeListener - n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); - - delete bag[ev][ns || '*'][listener]; - } - } else if (ev && ns) { - // remove all listeners for a namespaced event - if (bag[ev] && bag[ev][ns]) { - for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l); } - - delete bag[ev][ns]; - } - } else if (ns) { - // remove all listeners for a specific namespace - for (event in bag) { - for (namespace in bag[event]) { - if (ns === namespace) { off(n, [event, ns].join('.')); } - } - } - } else if (ev) { - // remove all listeners for the event - if (bag[ev]) { - for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')); } - - delete bag[ev]; - } - } else { - // remove all listeners on a given node - for (event in bag) { off(n, event); } - - n.instance.events = {}; - } - }); - } - - function dispatch (node, event, data) { - var n = getEventTarget(node); - - // Dispatch event - if (event instanceof window.Event) { - n.dispatchEvent(event); - } else { - event = new window.CustomEvent(event, {detail: data, cancelable: true}); - n.dispatchEvent(event); - } - return event - } - - class Image extends Base$1 { - constructor (node) { - super(nodeOrNew$1('image', node), Image); - } - - // (re)load image - load (url, callback) { - if (!url) return this - - var img = new window.Image(); - - on(img, 'load', function (e) { - var p = this.parent(Pattern); - - // ensure image size - if (this.width() === 0 && this.height() === 0) { - this.size(img.width, img.height); - } - - if (p instanceof Pattern) { - // ensure pattern size if not set - if (p.width() === 0 && p.height() === 0) { - p.size(this.width(), this.height()); - } - } - - if (typeof callback === 'function') { - callback.call(this, { - width: img.width, - height: img.height, - ratio: img.width / img.height, - url: url - }); - } - }, this); - - on(img, 'load error', function () { - // dont forget to unbind memory leaking events - off(img); - }); - - return this.attr('href', (img.src = url), xlink) - } - } - - Image.constructors = { - Container: { - // create image element, load image and set its size - image (source, callback) { - return this.put(new Image()).size(0, 0).load(source, callback) - } - } - }; - - /* global arrayClone */ - - let BaseArray = (function() { - try { - return Array - } catch (e) { - return Array - } - })(); - - class SVGArray extends BaseArray { - constructor (...args) { - super(); - this.init(...args); - } - - init (array, fallback) { - //this.splice(0, this.length) - this.length = 0; - this.push(...this.parse(array || fallback)); - } - - toArray () { - return Array.prototype.slice(this) - } - - toString () { - this.join(' '); - } - - valueOf () { - return this.toArray() - } - - // Parse whitespace separated string - parse (array) { - array = array.valueOf(); - - // if already is an array, no need to parse it - if (Array.isArray(array)) return array - - return array.trim().split(delimiter).map(parseFloat) - } - - clone () { - return new this.constructor(this) - } - - toSet () { - return new Set(this) - } - } - - class PointArray$1 extends SVGArray { - constructor (array, fallback = [[0, 0]]) { - super(array, fallback); - } - - // Convert array to string - toString () { - // convert to a poly point string - for (var i = 0, il = this.value.length, array = []; i < il; i++) { - array.push(this.value[i].join(',')); - } - - return array.join(' ') - } - - toArray () { - return this.value.reduce(function (prev, curr) { - return [].concat.call(prev, curr) - }, []) - } - - // Convert array to line object - toLine () { - return { - x1: this.value[0][0], - y1: this.value[0][1], - x2: this.value[1][0], - y2: this.value[1][1] - } - } - - // Get morphed array at given position - at (pos) { - // make sure a destination is defined - if (!this.destination) return this - - // generate morphed point string - for (var i = 0, il = this.value.length, array = []; i < il; i++) { - array.push([ - this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos, - this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos - ]); - } - - return new PointArray$1(array) - } - - // Parse point string and flat array - parse (array) { - var points = []; - - array = array.valueOf(); - - // if it is an array - if (Array.isArray(array)) { - // and it is not flat, there is no need to parse it - if (Array.isArray(array[0])) { - return array - } - } else { // Else, it is considered as a string - // parse points - array = array.trim().split(delimiter).map(parseFloat); - } - - // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints - // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. - if (array.length % 2 !== 0) array.pop(); - - // wrap points in two-tuples and parse points as floats - for (var i = 0, len = array.length; i < len; i = i + 2) { - points.push([ array[i], array[i + 1] ]); - } - - return points - } - - // Move point string - move (x, y) { - var box = this.bbox(); - - // get relative offset - x -= box.x; - y -= box.y; - - // move every point - if (!isNaN(x) && !isNaN(y)) { - for (var i = this.value.length - 1; i >= 0; i--) { - this.value[i] = [this.value[i][0] + x, this.value[i][1] + y]; - } - } - - return this - } - - // Resize poly string - size (width, height) { - var i; - var box = this.bbox(); - - // recalculate position of all points according to new size - for (i = this.value.length - 1; i >= 0; i--) { - if (box.width) this.value[i][0] = ((this.value[i][0] - box.x) * width) / box.width + box.x; - if (box.height) this.value[i][1] = ((this.value[i][1] - box.y) * height) / box.height + box.y; - } - - return this - } - - // Get bounding box of points - bbox () { - var maxX = -Infinity; - var maxY = -Infinity; - var minX = Infinity; - var minY = Infinity; - this.value.forEach(function (el) { - maxX = Math.max(el[0], maxX); - maxY = Math.max(el[1], maxY); - minX = Math.min(el[0], minX); - minY = Math.min(el[1], minY); - }); - return {x: minX, y: minY, width: maxX - minX, height: maxY - minY} - } - } - - class Line extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('line', node), Line); - } - - // Get array - array () { - return new PointArray$1([ - [ this.attr('x1'), this.attr('y1') ], - [ this.attr('x2'), this.attr('y2') ] - ]) - } - - // Overwrite native plot() method - plot (x1, y1, x2, y2) { - if (x1 == null) { - return this.array() - } else if (typeof y1 !== 'undefined') { - x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }; - } else { - x1 = new PointArray$1(x1).toLine(); - } - - return this.attr(x1) - } - - // Move by left top corner - move (x, y) { - return this.attr(this.array().move(x, y).toLine()) - } - - // Set element size to given width and height - size (width, height) { - var p = proportionalSize$1(this, width, height); - return this.attr(this.array().size(p.width, p.height).toLine()) - } - - } - - Line.constructors = { - Container: { - // Create a line element - line (...args) { - // make sure plot is called as a setter - // x1 is not necessarily a number, it can also be an array, a string and a PointArray - return Line.prototype.plot.apply( - this.put(new Line()) - , args[0] != null ? args : [0, 0, 0, 0] - ) - } - } - }; - - // import Defs from './Defs.js' - // import Line from './Line.js' - // import Polyline from './Polyline.js' - // import Polygon from './Polygon.js' - // import Path from './Path.js' - - class Marker extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew('marker', node), Marker); - } - - // Set width of element - width (width) { - return this.attr('markerWidth', width) - } - - // Set height of element - height (height) { - return this.attr('markerHeight', height) - } - - // Set marker refX and refY - ref (x, y) { - return this.attr('refX', x).attr('refY', y) - } - - // Update marker - update (block) { - // remove all content - this.clear(); - - // invoke passed block - if (typeof block === 'function') { block.call(this, this); } - - return this - } - - // Return the fill id - toString () { - return 'url(#' + this.id() + ')' - } - } - - Marker.constructors = { - Container: { - marker (width, height, block) { - // Create marker element in defs - return this.defs().marker(width, height, block) - } - }, - Defs: { - // Create marker - marker (width, height, block) { - // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto - return this.put(new Marker()) - .size(width, height) - .ref(width / 2, height / 2) - .viewbox(0, 0, width, height) - .attr('orient', 'auto') - .update(block) - } - }, - marker: { - // Create and attach markers - marker (marker, width, height, block) { - var attr = ['marker']; - - // Build attribute name - if (marker !== 'all') attr.push(marker); - attr = attr.join('-'); - - // Set marker attribute - marker = arguments[1] instanceof Marker - ? arguments[1] - : this.defs().marker(width, height, block); - - return this.attr(attr, marker) - } - } - }; - - // import find from './selector.js' - // import {remove} from './Element.js' - - class Mask extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('mask', node)); - } - - // // Unmask all masked elements and remove itself - // remove () { - // // unmask all targets - // this.targets().forEach(function (el) { - // el.unmask() - // }) - // - // // remove mask from parent - // return remove.call(this) - // } - // - // targets () { - // return find('svg [mask*="' + this.id() + '"]') - // } - - } - - - Mask.constructors = { - Container: { - mask () { - return this.defs().put(new Mask()) - } - }, - Element: { - // Distribute mask to svg element - maskWith (element) { - // use given mask or create a new one - var masker = element instanceof Mask - ? element - : this.parent().mask().add(element); - - // apply mask - return this.attr('mask', 'url("#' + masker.id() + '")') - }, - - // Unmask element - unmask () { - return this.attr('mask', null) - }, - - masker () { - return this.reference('mask') - } - } - }; - - function parser () { - - // Reuse cached element if possible - if (!parser.nodes) { - let svg = new Doc$1().size(2, 0).css({ - opacity: 0, - position: 'absolute', - left: '-100%', - top: '-100%', - overflow: 'hidden' - }); - - let path = svg.path().node; - - parser.nodes = {svg, path}; - } - - if (!parser.nodes.svg.node.parentNode) { - let b = document.body || document.documentElement; - parser.nodes.svg.addTo(b); - } - - return parser.nodes - } - - class Point { - // Initialize - constructor (x, y, base) { - let source; - base = base || {x: 0, y: 0}; - - // ensure source as object - source = Array.isArray(x) ? {x: x[0], y: x[1]} - : typeof x === 'object' ? {x: x.x, y: x.y} - : {x: x, y: y}; - - // merge source - this.x = source.x == null ? base.x : source.x; - this.y = source.y == null ? base.y : source.y; - } - - // Clone point - clone () { - return new Point(this) - } - - // Convert to native SVGPoint - native () { - // create new point - var point = parser().svg.createSVGPoint(); - - // update with current values - point.x = this.x; - point.y = this.y; - return point - } - - // transform point with matrix - transform (m) { - // Perform the matrix multiplication - var x = m.a * this.x + m.c * this.y + m.e; - var y = m.b * this.x + m.d * this.y + m.f; - - // Return the required point - return new Point(x, y) - } - } - - Point.constructors = { - Element: { - // Get point - point: function (x, y) { - return new Point(x, y).transform(this.screenCTM().inverse()) - } - } - }; - - let pathHandlers = { - M: function (c, p, p0) { - p.x = p0.x = c[0]; - p.y = p0.y = c[1]; - - return ['M', p.x, p.y] - }, - L: function (c, p) { - p.x = c[0]; - p.y = c[1]; - return ['L', c[0], c[1]] - }, - H: function (c, p) { - p.x = c[0]; - return ['H', c[0]] - }, - V: function (c, p) { - p.y = c[0]; - return ['V', c[0]] - }, - C: function (c, p) { - p.x = c[4]; - p.y = c[5]; - return ['C', c[0], c[1], c[2], c[3], c[4], c[5]] - }, - S: function (c, p) { - p.x = c[2]; - p.y = c[3]; - return ['S', c[0], c[1], c[2], c[3]] - }, - Q: function (c, p) { - p.x = c[2]; - p.y = c[3]; - return ['Q', c[0], c[1], c[2], c[3]] - }, - T: function (c, p) { - p.x = c[0]; - p.y = c[1]; - return ['T', c[0], c[1]] - }, - Z: function (c, p, p0) { - p.x = p0.x; - p.y = p0.y; - return ['Z'] - }, - A: function (c, p) { - p.x = c[5]; - p.y = c[6]; - return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]] - } - }; - - let mlhvqtcsaz = 'mlhvqtcsaz'.split(''); - - for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) { - pathHandlers[mlhvqtcsaz[i]] = (function (i) { - return function (c, p, p0) { - if (i === 'H') c[0] = c[0] + p.x; - else if (i === 'V') c[0] = c[0] + p.y; - else if (i === 'A') { - c[5] = c[5] + p.x; - c[6] = c[6] + p.y; - } else { - for (var j = 0, jl = c.length; j < jl; ++j) { - c[j] = c[j] + (j % 2 ? p.y : p.x); - } - } - - return pathHandlers[i](c, p, p0) - } - })(mlhvqtcsaz[i].toUpperCase()); - } - - class PathArray extends SVGArray { - constructor (array, fallback = [['M', 0, 0]]) { - super(array, fallback); - } - - // Convert array to string - toString () { - return arrayToString(this) - } - - toArray () { - return this.reduce(function (prev, curr) { - return [].concat.call(prev, curr) - }, []) - } - - // Move path string - move (x, y) { - // get bounding box of current situation - var box = this.bbox(); - - // get relative offset - x -= box.x; - y -= box.y; - - if (!isNaN(x) && !isNaN(y)) { - // move every point - for (var l, i = this.length - 1; i >= 0; i--) { - l = this[i][0]; - - if (l === 'M' || l === 'L' || l === 'T') { - this[i][1] += x; - this[i][2] += y; - } else if (l === 'H') { - this[i][1] += x; - } else if (l === 'V') { - this[i][1] += y; - } else if (l === 'C' || l === 'S' || l === 'Q') { - this[i][1] += x; - this[i][2] += y; - this[i][3] += x; - this[i][4] += y; - - if (l === 'C') { - this[i][5] += x; - this[i][6] += y; - } - } else if (l === 'A') { - this[i][6] += x; - this[i][7] += y; - } - } - } - - return this - } - - // Resize path string - size (width, height) { - // get bounding box of current situation - var box = this.bbox(); - var i, l; - - // recalculate position of all points according to new size - for (i = this.length - 1; i >= 0; i--) { - l = this[i][0]; - - if (l === 'M' || l === 'L' || l === 'T') { - this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; - this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; - } else if (l === 'H') { - this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; - } else if (l === 'V') { - this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y; - } else if (l === 'C' || l === 'S' || l === 'Q') { - this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; - this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; - this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x; - this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y; - - if (l === 'C') { - this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x; - this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y; - } - } else if (l === 'A') { - // resize radii - this[i][1] = (this[i][1] * width) / box.width; - this[i][2] = (this[i][2] * height) / box.height; - - // move position values - this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x; - this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y; - } - } - - return this - } - - // Test if the passed path array use the same path data commands as this path array - equalCommands (pathArray) { - var i, il, equalCommands; - - pathArray = new PathArray(pathArray); - - equalCommands = this.length === pathArray.value.length; - for (i = 0, il = this.length; equalCommands && i < il; i++) { - equalCommands = this[i][0] === pathArray.value[i][0]; - } - - return equalCommands - } - - // Make path array morphable - morph (pathArray) { - pathArray = new PathArray(pathArray); - - if (this.equalCommands(pathArray)) { - this.destination = pathArray; - } else { - this.destination = null; - } - - return this - } - - // Get morphed path array at given position - at (pos) { - // make sure a destination is defined - if (!this.destination) return this - - var sourceArray = this; - var destinationArray = this.destination.value; - var array = []; - var pathArray = new PathArray(); - var i, il, j, jl; - - // Animate has specified in the SVG spec - // See: https://www.w3.org/TR/SVG11/paths.html#PathElement - for (i = 0, il = sourceArray.length; i < il; i++) { - array[i] = [sourceArray[i][0]]; - for (j = 1, jl = sourceArray[i].length; j < jl; j++) { - array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; - } - // For the two flags of the elliptical arc command, the SVG spec say: - // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true - // Elliptical arc command as an array followed by corresponding indexes: - // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] - // 0 1 2 3 4 5 6 7 - if (array[i][0] === 'A') { - array[i][4] = +(array[i][4] !== 0); - array[i][5] = +(array[i][5] !== 0); - } - } - - // Directly modify the value of a path array, this is done this way for performance - pathArray.value = array; - return pathArray - } - - // Absolutize and parse path to array - parse (array) { - // if it's already a patharray, no need to parse it - if (array instanceof PathArray) return array.valueOf() - - // prepare for parsing - var s; - var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }; - - if (typeof array === 'string') { - array = array - .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 - .replace(pathLetters, ' $& ') // put some room between letters and numbers - .replace(hyphen, '$1 -') // add space before hyphen - .trim() // trim - .split(delimiter); // split into array - } else { - array = array.reduce(function (prev, curr) { - return [].concat.call(prev, curr) - }, []); - } - - // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] - var result = []; - var p = new Point(); - var p0 = new Point(); - var index = 0; - var len = array.length; - - do { - // Test if we have a path letter - if (isPathLetter.test(array[index])) { - s = array[index]; - ++index; - // If last letter was a move command and we got no new, it defaults to [L]ine - } else if (s === 'M') { - s = 'L'; - } else if (s === 'm') { - s = 'l'; - } - - result.push(pathHandlers[s].call(null, - array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat), - p, p0 - ) - ); - } while (len > index) - - return result - } - - // Get bounding box of path - bbox () { - parser().path.setAttribute('d', this.toString()); - return parser.nodes.path.getBBox() - } - } - - class Path extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('path', node), Path); - } - - // Get array - array () { - return this._array || (this._array = new PathArray(this.attr('d'))) - } - - // Plot new path - plot (d) { - return (d == null) ? this.array() - : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d))) - } - - // Clear array cache - clear () { - delete this._array; - return this - } - - // Move by left top corner - move (x, y) { - return this.attr('d', this.array().move(x, y)) - } - - // Move by left top corner over x-axis - x (x) { - return x == null ? this.bbox().x : this.move(x, this.bbox().y) - } - - // Move by left top corner over y-axis - y (y) { - return y == null ? this.bbox().y : this.move(this.bbox().x, y) - } - - // Set element size to given width and height - size (width, height) { - var p = proportionalSize$1(this, width, height); - return this.attr('d', this.array().size(p.width, p.height)) - } - - // Set width of element - width (width) { - return width == null ? this.bbox().width : this.size(width, this.bbox().height) - } - - // Set height of element - height (height) { - return height == null ? this.bbox().height : this.size(this.bbox().width, height) - } - } - - // Define morphable array - Path.prototype.MorphArray = PathArray; - - // Add parent method - Path.constructors = { - Container: { - // Create a wrapped path element - path (d) { - // make sure plot is called as a setter - return this.put(new Path()).plot(d || new PathArray()) - } - } - }; - - let MorphArray = PointArray$1; - - // Move by left top corner over x-axis - function x$1 (x) { - return x == null ? this.bbox().x : this.move(x, this.bbox().y) - } - - // Move by left top corner over y-axis - function y$1 (y) { - return y == null ? this.bbox().y : this.move(this.bbox().x, y) - } - - // Set width of element - function width$1 (width) { - let b = this.bbox(); - return width == null ? b.width : this.size(width, b.height) - } - - // Set height of element - function height$1 (height) { - let b = this.bbox(); - return height == null ? b.height : this.size(b.width, height) - } - - var pointed = /*#__PURE__*/Object.freeze({ - MorphArray: MorphArray, - x: x$1, - y: y$1, - width: width$1, - height: height$1 - }); - - // Add polygon-specific functions - - // Get array - function array () { - return this._array || (this._array = new PointArray(this.attr('points'))) - } - - // Plot new path - function plot (p) { - return (p == null) ? this.array() - : this.clear().attr('points', typeof p === 'string' ? p - : (this._array = new PointArray(p))) - } - - // Clear array cache - function clear () { - delete this._array; - return this - } - - // Move by left top corner - function move (x, y) { - return this.attr('points', this.array().move(x, y)) - } - - // Set element size to given width and height - function size$1 (width, height) { - let p = proportionalSize(this, width, height); - return this.attr('points', this.array().size(p.width, p.height)) - } - - var poly = /*#__PURE__*/Object.freeze({ - array: array, - plot: plot, - clear: clear, - move: move, - size: size$1 - }); - - class Polygon extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('polygon', node), Polygon); - } - } - - Polygon.constructors = { - Parent: { - // Create a wrapped polygon element - polygon (p) { - // make sure plot is called as a setter - return this.put(new Polygon()).plot(p || new PointArray$1()) - } - } - }; - - extend$1(Polygon, pointed); - extend$1(Polygon, poly); - - class Polyline extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('polyline', node), Polyline); - } - } - - Polyline.constructors = { - Parent: { - // Create a wrapped polygon element - polyline (p) { - // make sure plot is called as a setter - return this.put(new Polyline()).plot(p || new PointArray$1()) - } - } - }; - - extend$1(Polyline, pointed); - extend$1(Polyline, poly); - - class Rect extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('rect', node), Rect); - } - } - - Rect.constructors = { - Container: { - // Create a rect element - rect (width, height) { - return this.put(new Rect()).size(width, height) - } - } - }; - - class Symbol extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('symbol', node), Symbol); - } - } - - Symbol.constructors = { - Container: { - symbol () { - return this.put(new Symbol()) - } - } - }; - - function noop () {} - - // Default animation values - let timeline = { - duration: 400, - ease: '>', - delay: 0 - }; - - // Default attribute values - let attrs = { - - // fill and stroke - 'fill-opacity': 1, - 'stroke-opacity': 1, - 'stroke-width': 0, - 'stroke-linejoin': 'miter', - 'stroke-linecap': 'butt', - fill: '#000000', - stroke: '#000000', - opacity: 1, - - // position - x: 0, - y: 0, - cx: 0, - cy: 0, - - // size - width: 0, - height: 0, - - // radius - r: 0, - rx: 0, - ry: 0, - - // gradient - offset: 0, - 'stop-opacity': 1, - 'stop-color': '#000000', - - // text - 'font-size': 16, - 'font-family': 'Helvetica, Arial, sans-serif', - 'text-anchor': 'start' - }; - - // Create plain text node - function plain (text) { - // clear if build mode is disabled - if (this._build === false) { - this.clear(); - } - - // create text node - this.node.appendChild(document.createTextNode(text)); - - return this - } - - // FIXME: Does this also work for textpath? - // Get length of text element - function length () { - return this.node.getComputedTextLength() - } - - var textable = /*#__PURE__*/Object.freeze({ - plain: plain, - length: length - }); - - class Text$1 extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('text', node), Text$1); - - this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding - this._rebuild = true; // enable automatic updating of dy values - this._build = false; // disable build mode for adding multiple lines - - // set default font - this.attr('font-family', attrs['font-family']); - } - - // Move over x-axis - x (x) { - // act as getter - if (x == null) { - return this.attr('x') - } - - return this.attr('x', x) - } - - // Move over y-axis - y (y) { - var oy = this.attr('y'); - var o = typeof oy === 'number' ? oy - this.bbox().y : 0; - - // act as getter - if (y == null) { - return typeof oy === 'number' ? oy - o : oy - } - - return this.attr('y', typeof y === 'number' ? y + o : y) - } - - // Move center over x-axis - cx (x) { - return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2) - } - - // Move center over y-axis - cy (y) { - return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2) - } - - // Set the text content - text (text) { - // act as getter - if (text === undefined) { - var children = this.node.childNodes; - var firstLine = 0; - text = ''; - - for (var i = 0, len = children.length; i < len; ++i) { - // skip textPaths - they are no lines - if (children[i].nodeName === 'textPath') { - if (i === 0) firstLine = 1; - continue - } - - // add newline if its not the first child and newLined is set to true - if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { - text += '\n'; - } - - // add content of this node - text += children[i].textContent; - } - - return text - } - - // remove existing content - this.clear().build(true); - - if (typeof text === 'function') { - // call block - text.call(this, this); - } else { - // store text and make sure text is not blank - text = text.split('\n'); - - // build new lines - for (var j = 0, jl = text.length; j < jl; j++) { - this.tspan(text[j]).newLine(); - } - } - - // disable build mode and rebuild lines - return this.build(false).rebuild() - } - - // Set / get leading - leading (value) { - // act as getter - if (value == null) { - return this.dom.leading - } - - // act as setter - this.dom.leading = new SVGNumber(value); - - return this.rebuild() - } - - // Rebuild appearance type - rebuild (rebuild) { - // store new rebuild flag if given - if (typeof rebuild === 'boolean') { - this._rebuild = rebuild; - } - - // define position of all lines - if (this._rebuild) { - var self = this; - var blankLineOffset = 0; - var dy = this.dom.leading * new SVGNumber(this.attr('font-size')); - - this.each(function () { - if (this.dom.newLined) { - this.attr('x', self.attr('x')); - - if (this.text() === '\n') { - blankLineOffset += dy; - } else { - this.attr('dy', dy + blankLineOffset); - blankLineOffset = 0; - } - } - }); - - this.fire('rebuild'); - } - - return this - } - - // Enable / disable build mode - build (build) { - this._build = !!build; - return this - } - - // overwrite method from parent to set data properly - setData (o) { - this.dom = o; - this.dom.leading = new SVGNumber(o.leading || 1.3); - return this - } - } - - extend$1(Text$1, textable); - - Text$1.constructors = { - Container: { - // Create text element - text (text) { - return this.put(new Text$1()).text(text) - }, - - // Create plain text element - plain (text) { - return this.put(new Text$1()).plain(text) - } - } - }; - - class TextPath extends Text$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('textPath', node)); - } - - // return the array of the path track element - array () { - var track = this.track(); - - return track ? track.array() : null - } - - // Plot path if any - plot (d) { - var track = this.track(); - var pathArray = null; - - if (track) { - pathArray = track.plot(d); - } - - return (d == null) ? pathArray : this - } - - // Get the path element - track () { - return this.reference('href') - } - } - - TextPath.constructors = { - Container: { - textPath (text, path) { - return this.defs().path(path).text(text).addTo(this) - } - }, - Text: { - // Create path for text to run on - path: function (track) { - var path = new TextPath(); - - // if d is a path, reuse it - if (!(track instanceof Path)) { - // create path element - track = this.doc().defs().path(track); - } - - // link textPath to path and add content - path.attr('href', '#' + track, xlink); - - // add textPath element as child node and return textPath - return this.put(path) - }, - - // FIXME: make this plural? - // Get the textPath children - textPath: function () { - return this.select('textPath') - } - }, - Path: { - // creates a textPath from this path - text: function (text) { - if (text instanceof Text$1) { - var txt = text.text(); - return text.clear().path(this).text(txt) - } - return this.parent().put(new Text$1()).path(this).text(text) - } - // FIXME: Maybe add `targets` to get all textPaths associated with this path - } - }; - - TextPath.prototype.MorphArray = PathArray; - - class Use extends Base$1 { - constructor (node) { - super(nodeOrNew('use', node), Use); - } - - // Use element as a reference - element (element, file) { - // Set lined element - return this.attr('href', (file || '') + '#' + element, xlink) - } - } - - Use.constructors = { - Container: { - // Create a use element - use: function (element, file) { - return this.put(new Use()).element(element, file) - } - } - }; - - - - var elements = /*#__PURE__*/Object.freeze({ - Bare: Bare, - Circle: Circle, - ClipPath: ClipPath, - Defs: Defs, - Doc: Doc$1, - Ellipse: Ellipse, - Gradient: Gradient, - G: G, - HtmlNode: HtmlNode, - A: A, - Image: Image, - Line: Line, - Marker: Marker, - Mask: Mask, - Path: Path, - Pattern: Pattern, - Polygon: Polygon, - Polyline: Polyline, - Rect: Rect, - Stop: Stop, - Symbol: Symbol, - Text: Text$1, - TextPath: TextPath, - Use: Use - }); - - function makeInstance (element) { - if (element instanceof Base$1) return element - - if (typeof element === 'object') { - return adopt$1(element) - } - - if (element == null) { - return new Doc() - } - - if (typeof element === 'string' && element.charAt(0) !== '<') { - return adopt$1(document.querySelector(element)) - } - - var node = makeNode('svg'); - node.innerHTML = element; - - element = adopt$1(node.firstElementChild); - - return element - } - - // Adopt existing svg elements - function adopt$1 (node) { - // check for presence of node - if (!node) return null - - // make sure a node isn't already adopted - if (node.instance instanceof Element) return node.instance - - if (!(node instanceof window.SVGElement)) { - return new HtmlNode(node) - } - - // initialize variables - var element; - - // adopt with element-specific settings - if (node.nodeName === 'svg') { - element = new Doc$1(node); - } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') { - element = new Gradient(node); - } else if (elements[capitalize(node.nodeName)]) { - element = new elements[capitalize(node.nodeName)](node); - } else { - element = new Bare(node); - } - - return element - } - - // Element id sequence - let did = 1000; - - // Get next named element id - function eid (name) { - return 'Svgjs' + capitalize(name) + (did++) - } - - // Deep new id assignment - function assignNewId (node) { - // do the same for SVG child nodes as well - for (var i = node.children.length - 1; i >= 0; i--) { - assignNewId(node.children[i]); - } - - if (node.id) { - return adopt$1(node).id(eid(node.nodeName)) - } - - return adopt$1(node) - } - - var adopter = /*#__PURE__*/Object.freeze({ - makeInstance: makeInstance, - adopt: adopt$1, - eid: eid, - assignNewId: assignNewId - }); - - class Queue { - constructor () { - this._first = null; - this._last = null; - } - - push (value) { - // An item stores an id and the provided value - var item = value.next ? value : { value: value, next: null, prev: null }; - - // Deal with the queue being empty or populated - if (this._last) { - item.prev = this._last; - this._last.next = item; - this._last = item; - } else { - this._last = item; - this._first = item; - } - - // Update the length and return the current item - return item - } - - shift () { - // Check if we have a value - var remove = this._first; - if (!remove) return null - - // If we do, remove it and relink things - this._first = remove.next; - if (this._first) this._first.prev = null; - this._last = this._first ? this._last : null; - return remove.value - } - - // Shows us the first item in the list - first () { - return this._first && this._first.value - } - - // Shows us the last item in the list - last () { - return this._last && this._last.value - } - - // Removes the item that was returned from the push - remove (item) { - // Relink the previous item - if (item.prev) item.prev.next = item.next; - if (item.next) item.next.prev = item.prev; - if (item === this._last) this._last = item.prev; - if (item === this._first) this._first = item.next; - - // Invalidate item - item.prev = null; - item.next = null; - } - } - - const Animator = { - nextDraw: null, - frames: new Queue(), - timeouts: new Queue(), - timer: window.performance || window.Date, - transforms: [], - - frame (fn) { - // Store the node - var node = Animator.frames.push({ run: fn }); - - // Request an animation frame if we don't have one - if (Animator.nextDraw === null) { - Animator.nextDraw = window.requestAnimationFrame(Animator._draw); - } - - // Return the node so we can remove it easily - return node - }, - - transform_frame (fn, id) { - Animator.transforms[id] = fn; - }, - - timeout (fn, delay) { - delay = delay || 0; - - // Work out when the event should fire - var time = Animator.timer.now() + delay; - - // Add the timeout to the end of the queue - var node = Animator.timeouts.push({ run: fn, time: time }); - - // Request another animation frame if we need one - if (Animator.nextDraw === null) { - Animator.nextDraw = window.requestAnimationFrame(Animator._draw); - } - - return node - }, - - cancelFrame (node) { - Animator.frames.remove(node); - }, - - clearTimeout (node) { - Animator.timeouts.remove(node); - }, - - _draw (now) { - // Run all the timeouts we can run, if they are not ready yet, add them - // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) - var nextTimeout = null; - var lastTimeout = Animator.timeouts.last(); - while ((nextTimeout = Animator.timeouts.shift())) { - // Run the timeout if its time, or push it to the end - if (now >= nextTimeout.time) { - nextTimeout.run(); - } else { - Animator.timeouts.push(nextTimeout); - } - - // If we hit the last item, we should stop shifting out more items - if (nextTimeout === lastTimeout) break - } - - // Run all of the animation frames - var nextFrame = null; - var lastFrame = Animator.frames.last(); - while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) { - nextFrame.run(); - } - - Animator.transforms.forEach(function (el) { el(); }); - - // If we have remaining timeouts or frames, draw until we don't anymore - Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() - ? window.requestAnimationFrame(Animator._draw) - : null; - } - }; - - class Tspan extends Base$1 { - // Initialize node - constructor (node) { - super(nodeOrNew$1('tspan', node), Tspan); - } - - // Set text content - text (text) { - if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '') - - typeof text === 'function' ? text.call(this, this) : this.plain(text); - - return this - } - - // Shortcut dx - dx (dx) { - return this.attr('dx', dx) - } - - // Shortcut dy - dy (dy) { - return this.attr('dy', dy) - } - - // Create new line - newLine () { - // fetch text parent - var t = this.parent(Text); - - // mark new line - this.dom.newLined = true; - - // apply new position - return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()) - } - } - - extend$1(Tspan, textable); - - Tspan.constructors = { - Tspan: { - tspan (text) { - var tspan = new Tspan(); - - // clear if build mode is disabled - if (!this._build) { - this.clear(); - } - - // add new tspan - this.node.appendChild(tspan.node); - - return tspan.text(text) - } - } - }; - - // Map function - function map (array, block) { - var i; - var il = array.length; - var result = []; - - for (i = 0; i < il; i++) { - result.push(block(array[i])); - } - - return result - } - - // Degrees to radians - function radians (d) { - return d % 360 * Math.PI / 180 - } - - class Matrix { - constructor (...args) { - this.init(...args); - } - - // Initialize - init (source) { - var base = arrayToMatrix([1, 0, 0, 1, 0, 0]); - - // ensure source as object - source = source instanceof Base$1 && source.is('Element') ? source.matrixify() - : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat)) - : Array.isArray(source) ? arrayToMatrix(source) - : (typeof source === 'object' && isMatrixLike(source)) ? source - : (typeof source === 'object') ? new Matrix().transform(source) - : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments)) - : base; - - // Merge the source matrix with the base matrix - this.a = source.a != null ? source.a : base.a; - this.b = source.b != null ? source.b : base.b; - this.c = source.c != null ? source.c : base.c; - this.d = source.d != null ? source.d : base.d; - this.e = source.e != null ? source.e : base.e; - this.f = source.f != null ? source.f : base.f; - } - - - // Clones this matrix - clone () { - return new Matrix(this) - } - - // Transform a matrix into another matrix by manipulating the space - transform (o) { - // Check if o is a matrix and then left multiply it directly - if (isMatrixLike(o)) { - var matrix = new Matrix(o); - return matrix.multiplyO(this) - } - - // Get the proposed transformations and the current transformations - var t = Matrix.formatTransforms(o); - var current = this; - let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current); - - // Construct the resulting matrix - var transformer = new Matrix() - .translateO(t.rx, t.ry) - .lmultiplyO(current) - .translateO(-ox, -oy) - .scaleO(t.scaleX, t.scaleY) - .skewO(t.skewX, t.skewY) - .shearO(t.shear) - .rotateO(t.theta) - .translateO(ox, oy); - - // If we want the origin at a particular place, we force it there - if (isFinite(t.px) || isFinite(t.py)) { - const origin = new Point(ox, oy).transform(transformer); - // TODO: Replace t.px with isFinite(t.px) - const dx = t.px ? t.px - origin.x : 0; - const dy = t.py ? t.py - origin.y : 0; - transformer.translateO(dx, dy); - } - - // Translate now after positioning - transformer.translateO(t.tx, t.ty); - return transformer - } - - // Applies a matrix defined by its affine parameters - compose (o) { - if (o.origin) { - o.originX = o.origin[0]; - o.originY = o.origin[1]; - } - // Get the parameters - var ox = o.originX || 0; - var oy = o.originY || 0; - var sx = o.scaleX || 1; - var sy = o.scaleY || 1; - var lam = o.shear || 0; - var theta = o.rotate || 0; - var tx = o.translateX || 0; - var ty = o.translateY || 0; - - // Apply the standard matrix - var result = new Matrix() - .translateO(-ox, -oy) - .scaleO(sx, sy) - .shearO(lam) - .rotateO(theta) - .translateO(tx, ty) - .lmultiplyO(this) - .translateO(ox, oy); - return result - } - - // Decomposes this matrix into its affine parameters - decompose (cx = 0, cy = 0) { - // Get the parameters from the matrix - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var e = this.e; - var f = this.f; - - // Figure out if the winding direction is clockwise or counterclockwise - var determinant = a * d - b * c; - var ccw = determinant > 0 ? 1 : -1; - - // Since we only shear in x, we can use the x basis to get the x scale - // and the rotation of the resulting matrix - var sx = ccw * Math.sqrt(a * a + b * b); - var thetaRad = Math.atan2(ccw * b, ccw * a); - var theta = 180 / Math.PI * thetaRad; - var ct = Math.cos(thetaRad); - var st = Math.sin(thetaRad); - - // We can then solve the y basis vector simultaneously to get the other - // two affine parameters directly from these parameters - var lam = (a * c + b * d) / determinant; - var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a)); - - // Use the translations - let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); - let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); - - // Construct the decomposition and return it - return { - // Return the affine parameters - scaleX: sx, - scaleY: sy, - shear: lam, - rotate: theta, - translateX: tx, - translateY: ty, - originX: cx, - originY: cy, - - // Return the matrix parameters - a: this.a, - b: this.b, - c: this.c, - d: this.d, - e: this.e, - f: this.f - } - } - - // Left multiplies by the given matrix - multiply (matrix) { - return this.clone().multiplyO(matrix) - } - - multiplyO (matrix) { - // Get the matrices - var l = this; - var r = matrix instanceof Matrix - ? matrix - : new Matrix(matrix); - - return Matrix.matrixMultiply(l, r, this) - } - - lmultiply (matrix) { - return this.clone().lmultiplyO(matrix) - } - - lmultiplyO (matrix) { - var r = this; - var l = matrix instanceof Matrix - ? matrix - : new Matrix(matrix); - - return Matrix.matrixMultiply(l, r, this) - } - - // Inverses matrix - inverseO () { - // Get the current parameters out of the matrix - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var e = this.e; - var f = this.f; - - // Invert the 2x2 matrix in the top left - var det = a * d - b * c; - if (!det) throw new Error('Cannot invert ' + this) - - // Calculate the top 2x2 matrix - var na = d / det; - var nb = -b / det; - var nc = -c / det; - var nd = a / det; - - // Apply the inverted matrix to the top right - var ne = -(na * e + nc * f); - var nf = -(nb * e + nd * f); - - // Construct the inverted matrix - this.a = na; - this.b = nb; - this.c = nc; - this.d = nd; - this.e = ne; - this.f = nf; - - return this - } - - inverse () { - return this.clone().inverseO() - } - - // Translate matrix - translate (x, y) { - return this.clone().translateO(x, y) - } - - translateO (x, y) { - this.e += x || 0; - this.f += y || 0; - return this - } - - // Scale matrix - scale (x, y, cx, cy) { - return this.clone().scaleO(...arguments) - } - - scaleO (x, y = x, cx = 0, cy = 0) { - // Support uniform scaling - if (arguments.length === 3) { - cy = cx; - cx = y; - y = x; - } - - let {a, b, c, d, e, f} = this; - - this.a = a * x; - this.b = b * y; - this.c = c * x; - this.d = d * y; - this.e = e * x - cx * x + cx; - this.f = f * y - cy * y + cy; - - return this - } - - // Rotate matrix - rotate (r, cx, cy) { - return this.clone().rotateO(r, cx, cy) - } - - rotateO (r, cx = 0, cy = 0) { - // Convert degrees to radians - r = radians(r); - - let cos = Math.cos(r); - let sin = Math.sin(r); - - let {a, b, c, d, e, f} = this; - - this.a = a * cos - b * sin; - this.b = b * cos + a * sin; - this.c = c * cos - d * sin; - this.d = d * cos + c * sin; - this.e = e * cos - f * sin + cy * sin - cx * cos + cx; - this.f = f * cos + e * sin - cx * sin - cy * cos + cy; - - return this - } - - // Flip matrix on x or y, at a given offset - flip (axis, around) { - return this.clone().flipO(axis, around) - } - - flipO (axis, around) { - return axis === 'x' ? this.scaleO(-1, 1, around, 0) - : axis === 'y' ? this.scaleO(1, -1, 0, around) - : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point - } - - // Shear matrix - shear (a, cx, cy) { - return this.clone().shearO(a, cx, cy) - } - - shearO (lx, cx = 0, cy = 0) { - let {a, b, c, d, e, f} = this; - - this.a = a + b * lx; - this.c = c + d * lx; - this.e = e + f * lx - cy * lx; - - return this - } - - // Skew Matrix - skew (x, y, cx, cy) { - return this.clone().skewO(...arguments) - } - - skewO (x, y = x, cx = 0, cy = 0) { - // support uniformal skew - if (arguments.length === 3) { - cy = cx; - cx = y; - y = x; - } - - // Convert degrees to radians - x = radians(x); - y = radians(y); - - let lx = Math.tan(x); - let ly = Math.tan(y); - - let {a, b, c, d, e, f} = this; - - this.a = a + b * lx; - this.b = b + a * ly; - this.c = c + d * lx; - this.d = d + c * ly; - this.e = e + f * lx - cy * lx; - this.f = f + e * ly - cx * ly; - - return this - } - - // SkewX - skewX (x, cx, cy) { - return this.skew(x, 0, cx, cy) - } - - skewXO (x, cx, cy) { - return this.skewO(x, 0, cx, cy) - } - - // SkewY - skewY (y, cx, cy) { - return this.skew(0, y, cx, cy) - } - - skewYO (y, cx, cy) { - return this.skewO(0, y, cx, cy) - } - - // Transform around a center point - aroundO (cx, cy, matrix) { - var dx = cx || 0; - var dy = cy || 0; - return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy) - } - - around (cx, cy, matrix) { - return this.clone().aroundO(cx, cy, matrix) - } - - // Convert to native SVGMatrix - native () { - // create new matrix - var matrix = parser().node.createSVGMatrix(); - - // update with current values - for (var i = abcdef.length - 1; i >= 0; i--) { - matrix[abcdef[i]] = this[abcdef[i]]; - } - - return matrix - } - - // Check if two matrices are equal - equals (other) { - var comp = new Matrix(other); - return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && - closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && - closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f) - } - - // Convert matrix to string - toString () { - return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')' - } - - toArray () { - return [this.a, this.b, this.c, this.d, this.e, this.f] - } - - valueOf () { - return { - a: this.a, - b: this.b, - c: this.c, - d: this.d, - e: this.e, - f: this.f - } - } - - - // TODO: Refactor this to a static function of matrix.js - static formatTransforms (o) { - // Get all of the parameters required to form the matrix - var flipBoth = o.flip === 'both' || o.flip === true; - var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; - var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; - var skewX = o.skew && o.skew.length ? o.skew[0] - : isFinite(o.skew) ? o.skew - : isFinite(o.skewX) ? o.skewX - : 0; - var skewY = o.skew && o.skew.length ? o.skew[1] - : isFinite(o.skew) ? o.skew - : isFinite(o.skewY) ? o.skewY - : 0; - var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX - : isFinite(o.scale) ? o.scale * flipX - : isFinite(o.scaleX) ? o.scaleX * flipX - : flipX; - var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY - : isFinite(o.scale) ? o.scale * flipY - : isFinite(o.scaleY) ? o.scaleY * flipY - : flipY; - var shear = o.shear || 0; - var theta = o.rotate || o.theta || 0; - var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); - var ox = origin.x; - var oy = origin.y; - var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); - var px = position.x; - var py = position.y; - var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); - var tx = translate.x; - var ty = translate.y; - var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); - var rx = relative.x; - var ry = relative.y; - - // Populate all of the values - return { - scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py - } - } - - // left matrix, right matrix, target matrix which is overwritten - static matrixMultiply (l, r, o) { - // Work out the product directly - var a = l.a * r.a + l.c * r.b; - var b = l.b * r.a + l.d * r.b; - var c = l.a * r.c + l.c * r.d; - var d = l.b * r.c + l.d * r.d; - var e = l.e + l.a * r.e + l.c * r.f; - var f = l.f + l.b * r.e + l.d * r.f; - - // make sure to use local variables because l/r and o could be the same - o.a = a; - o.b = b; - o.c = c; - o.d = d; - o.e = e; - o.f = f; - - return o - } - } - - Matrix.constructors = { - Element: { - // Get current matrix - ctm () { - return new Matrix(this.node.getCTM()) - }, - - // Get current screen matrix - screenCTM () { - /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 - This is needed because FF does not return the transformation matrix - for the inner coordinate system when getScreenCTM() is called on nested svgs. - However all other Browsers do that */ - if (this instanceof Doc && !this.isRoot()) { - var rect = this.rect(1, 1); - var m = rect.node.getScreenCTM(); - rect.remove(); - return new Matrix(m) - } - return new Matrix(this.node.getScreenCTM()) - } - } - }; - - //import {Parent, Doc, Symbol, Image, Pattern, Marker, Point} from './classes.js' - - class Box$1 { - constructor (...args) { - this.init(...args); - } - - init (source) { - var base = [0, 0, 0, 0]; - source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) - : Array.isArray(source) ? source - : typeof source === 'object' ? [source.left != null ? source.left - : source.x, source.top != null ? source.top : source.y, source.width, source.height] - : arguments.length === 4 ? [].slice.call(arguments) - : base; - - this.x = source[0]; - this.y = source[1]; - this.width = source[2]; - this.height = source[3]; - - // add center, right, bottom... - fullBox(this); - } - - // Merge rect box with another, return a new instance - merge (box) { - let x = Math.min(this.x, box.x); - let y = Math.min(this.y, box.y); - let width = Math.max(this.x + this.width, box.x + box.width) - x; - let height = Math.max(this.y + this.height, box.y + box.height) - y; - - return new Box$1(x, y, width, height) - } - - transform (m) { - let xMin = Infinity; - let xMax = -Infinity; - let yMin = Infinity; - let yMax = -Infinity; - - let pts = [ - new Point(this.x, this.y), - new Point(this.x2, this.y), - new Point(this.x, this.y2), - new Point(this.x2, this.y2) - ]; - - pts.forEach(function (p) { - p = p.transform(m); - xMin = Math.min(xMin, p.x); - xMax = Math.max(xMax, p.x); - yMin = Math.min(yMin, p.y); - yMax = Math.max(yMax, p.y); - }); - - return new Box$1( - xMin, yMin, - xMax - xMin, - yMax - yMin - ) - } - - addOffset () { - // offset by window scroll position, because getBoundingClientRect changes when window is scrolled - this.x += window.pageXOffset; - this.y += window.pageYOffset; - return this - } - - toString () { - return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height - } - - toArray () { - return [this.x, this.y, this.width, this.height] - } - } - - function getBox(cb) { - let box; - - try { - box = cb(this.node); - - if (isNulledBox(box) && !domContains(this.node)) { - throw new Error('Element not in the dom') - } - } catch (e) { - try { - let clone = this.clone(parser().svg).show(); - box = cb(clone.node); - clone.remove(); - } catch (e) { - throw (e) - console.warn('Getting a bounding box of this element is not possible'); - } - } - return box - } - - Box$1.constructors = { - Element: { - // Get bounding box - bbox () { - return new Box$1(getBox.call(this, (node) => node.getBBox())) - }, - - rbox (el) { - let box = new Box$1(getBox.call(this, (node) => node.getBoundingClientRect())); - if (el) return box.transform(el.screenCTM().inverse()) - return box.addOffset() - } - }, - viewbox: function (x, y, width, height) { - // act as getter - if (x == null) return new Box$1(this.attr('viewBox')) - - // act as setter - return this.attr('viewBox', new Box$1(x, y, width, height)) - } - }; - - /* globals fullHex, compToHex */ - - class Color { - constructor (...args) { - this.init(...args); - } - - init (color, g, b) { - let match; - - // initialize defaults - this.r = 0; - this.g = 0; - this.b = 0; - - if (!color) return - - // parse color - if (typeof color === 'string') { - if (isRgb.test(color)) { - // get rgb values - match = rgb.exec(color.replace(whitespace, '')); - - // parse numeric values - this.r = parseInt(match[1]); - this.g = parseInt(match[2]); - this.b = parseInt(match[3]); - } else if (isHex.test(color)) { - // get hex values - match = hex.exec(fullHex(color)); - - // parse numeric values - this.r = parseInt(match[1], 16); - this.g = parseInt(match[2], 16); - this.b = parseInt(match[3], 16); - } - } else if (Array.isArray(color)) { - this.r = color[0]; - this.g = color[1]; - this.b = color[2]; - } else if (typeof color === 'object') { - this.r = color.r; - this.g = color.g; - this.b = color.b; - } else if (arguments.length === 3) { - this.r = color; - this.g = g; - this.b = b; - } - } - - // Default to hex conversion - toString () { - return this.toHex() - } - - toArray () { - return [this.r, this.g, this.b] - } - - // Build hex value - toHex () { - return '#' + - compToHex(Math.round(this.r)) + - compToHex(Math.round(this.g)) + - compToHex(Math.round(this.b)) - } - - // Build rgb value - toRgb () { - return 'rgb(' + [this.r, this.g, this.b].join() + ')' - } - - // Calculate true brightness - brightness () { - return (this.r / 255 * 0.30) + - (this.g / 255 * 0.59) + - (this.b / 255 * 0.11) - } - - // Testers - - // Test if given value is a color string - static test (color) { - color += ''; - return isHex.test(color) || isRgb.test(color) - } - - // Test if given value is a rgb object - static isRgb (color) { - return color && typeof color.r === 'number' && - typeof color.g === 'number' && - typeof color.b === 'number' - } - - // Test if given value is a color - static isColor (color) { - return this.isRgb(color) || this.test(color) - } - } - - /*** - Base Class - ========== - The base stepper class that will be - ***/ - - function makeSetterGetter (k, f) { - return function (v) { - if (v == null) return this[v] - this[k] = v; - if (f) f.call(this); - return this - } - } - - let easing = { - '-': function (pos) { return pos }, - '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 }, - '>': function (pos) { return Math.sin(pos * Math.PI / 2) }, - '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }, - bezier: function (t0, x0, t1, x1) { - return function (t) { - // TODO: FINISH - } - } - }; - - - class Stepper { - done () { return false } - } - - /*** - Easing Functions - ================ - ***/ - - class Ease extends Stepper { - constructor (fn) { - super(); - this.ease = easing[fn || timeline.ease] || fn; - } - - step (from, to, pos) { - if (typeof from !== 'number') { - return pos < 1 ? from : to - } - return from + (to - from) * this.ease(pos) - } - } - - - /*** - Controller Types - ================ - ***/ - - class Controller extends Stepper { - constructor (fn) { - super(); - this.stepper = fn; - } - - step (current, target, dt, c) { - return this.stepper(current, target, dt, c) - } - - done (c) { - return c.done - } - } - - function recalculate () { - // Apply the default parameters - var duration = (this._duration || 500) / 1000; - var overshoot = this._overshoot || 0; - - // Calculate the PID natural response - var eps = 1e-10; - var pi = Math.PI; - var os = Math.log(overshoot / 100 + eps); - var zeta = -os / Math.sqrt(pi * pi + os * os); - var wn = 3.9 / (zeta * duration); - - // Calculate the Spring values - this.d = 2 * zeta * wn; - this.k = wn * wn; - } - - class Spring extends Controller { - constructor (duration, overshoot) { - super(); - this.duration(duration || 500) - .overshoot(overshoot || 0); - } - - step (current, target, dt, c) { - if (typeof current === 'string') return current - c.done = dt === Infinity; - if (dt === Infinity) return target - if (dt === 0) return current - - if (dt > 100) dt = 16; - - dt /= 1000; - - // Get the previous velocity - var velocity = c.velocity || 0; - - // Apply the control to get the new position and store it - var acceleration = -this.d * velocity - this.k * (current - target); - var newPosition = current + - velocity * dt + - acceleration * dt * dt / 2; - - // Store the velocity - c.velocity = velocity + acceleration * dt; - - // Figure out if we have converged, and if so, pass the value - c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; - return c.done ? target : newPosition - } - } - - extend$1(Spring, { - duration: makeSetterGetter('_duration', recalculate), - overshoot: makeSetterGetter('_overshoot', recalculate) - }); - - class PID extends Controller { - constructor (p, i, d, windup) { - super(); - - p = p == null ? 0.1 : p; - i = i == null ? 0.01 : i; - d = d == null ? 0 : d; - windup = windup == null ? 1000 : windup; - this.p(p).i(i).d(d).windup(windup); - } - - step (current, target, dt, c) { - if (typeof current === 'string') return current - c.done = dt === Infinity; - - if (dt === Infinity) return target - if (dt === 0) return current - - var p = target - current; - var i = (c.integral || 0) + p * dt; - var d = (p - (c.error || 0)) / dt; - var windup = this.windup; - - // antiwindup - if (windup !== false) { - i = Math.max(-windup, Math.min(i, windup)); - } - - c.error = p; - c.integral = i; - - c.done = Math.abs(p) < 0.001; - - return c.done ? target : current + (this.P * p + this.I * i + this.D * d) - } - } - - extend$1(PID, { - windup: makeSetterGetter('windup'), - p: makeSetterGetter('P'), - i: makeSetterGetter('I'), - d: makeSetterGetter('D') - }); - - class Morphable { - constructor (stepper) { - // FIXME: the default stepper does not know about easing - this._stepper = stepper || new Ease('-'); - - this._from = null; - this._to = null; - this._type = null; - this._context = null; - this._morphObj = null; - } - - from (val) { - if (val == null) { - return this._from - } - - this._from = this._set(val); - return this - } - - to (val) { - if (val == null) { - return this._to - } - - this._to = this._set(val); - return this - } - - type (type) { - // getter - if (type == null) { - return this._type - } - - // setter - this._type = type; - return this - } - - _set (value) { - if (!this._type) { - var type = typeof value; - - if (type === 'number') { - this.type(SVGNumber); - } else if (type === 'string') { - if (Color.isColor(value)) { - this.type(Color); - } else if (regex.delimiter.test(value)) { - this.type(regex.pathLetters.test(value) - ? PathArray - : SVGArray - ); - } else if (regex.numberAndUnit.test(value)) { - this.type(SVGNumber); - } else { - this.type(Morphable.NonMorphable); - } - } else if (MorphableTypes.indexOf(value.constructor) > -1) { - this.type(value.constructor); - } else if (Array.isArray(value)) { - this.type(SVGArray); - } else if (type === 'object') { - this.type(Morphable.ObjectBag); - } else { - this.type(Morphable.NonMorphable); - } - } - - var result = (new this._type(value)).toArray(); - this._morphObj = this._morphObj || new this._type(); - this._context = this._context || - Array.apply(null, Array(result.length)).map(Object); - return result - } - - stepper (stepper) { - if (stepper == null) return this._stepper - this._stepper = stepper; - return this - } - - done () { - var complete = this._context - .map(this._stepper.done) - .reduce(function (last, curr) { - return last && curr - }, true); - return complete - } - - at (pos) { - var _this = this; - - return this._morphObj.fromArray( - this._from.map(function (i, index) { - return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context) - }) - ) - } - } - - Morphable.NonMorphable = class { - constructor (...args) { - this.init(...args); - } - - init (val) { - val = Array.isArray(val) ? val[0] : val; - this.value = val; - } - - valueOf () { - return this.value - } - - toArray () { - return [this.value] - } - }; - - Morphable.TransformBag = class { - constructor (...args) { - this.init(...args); - } - - init (obj) { - if (Array.isArray(obj)) { - obj = { - scaleX: obj[0], - scaleY: obj[1], - shear: obj[2], - rotate: obj[3], - translateX: obj[4], - translateY: obj[5], - originX: obj[6], - originY: obj[7] - }; - } - - Object.assign(this, Morphable.TransformBag.defaults, obj); - } - - toArray () { - var v = this; - - return [ - v.scaleX, - v.scaleY, - v.shear, - v.rotate, - v.translateX, - v.translateY, - v.originX, - v.originY - ] - } - }; - - Morphable.TransformBag.defaults = { - scaleX: 1, - scaleY: 1, - shear: 0, - rotate: 0, - translateX: 0, - translateY: 0, - originX: 0, - originY: 0 - }; - - Morphable.ObjectBag = class { - constructor (...args) { - this.init(...args); - } - - init (objOrArr) { - this.values = []; - - if (Array.isArray(objOrArr)) { - this.values = objOrArr; - return - } - - var entries = Object.entries(objOrArr || {}).sort((a, b) => { - return a[0] - b[0] - }); - - this.values = entries.reduce((last, curr) => last.concat(curr), []); - } - - valueOf () { - var obj = {}; - var arr = this.values; - - for (var i = 0, len = arr.length; i < len; i += 2) { - obj[arr[i]] = arr[i + 1]; - } - - return obj - } - - toArray () { - return this.values - } - }; - - let morphableTypes = [ - SVGNumber, - Color, - Box$1, - Matrix, - SVGArray, - PointArray$1, - PathArray, - Morphable.NonMorphable, - Morphable.TransformBag, - Morphable.ObjectBag - ]; - - extend$1(morphableTypes, { - to (val, args) { - return new Morphable() - .type(this.constructor) - .from(this.valueOf()) - .to(val, args) - }, - fromArray (arr) { - this.init(arr); - return this - } - }); - - var time = window.performance || Date; - - var makeSchedule = function (runnerInfo) { - var start = runnerInfo.start; - var duration = runnerInfo.runner.duration(); - var end = start + duration; - return {start: start, duration: duration, end: end, runner: runnerInfo.runner} - }; - - class Timeline { - // Construct a new timeline on the given element - constructor () { - this._timeSource = function () { - return time.now() - }; - - this._dispatcher = document.createElement('div'); - - // Store the timing variables - this._startTime = 0; - this._speed = 1.0; - - // Play control variables control how the animation proceeds - this._reverse = false; - this._persist = 0; - - // Keep track of the running animations and their starting parameters - this._nextFrame = null; - this._paused = false; - this._runners = []; - this._order = []; - this._time = 0; - this._lastSourceTime = 0; - this._lastStepTime = 0; - } - - getEventTarget () { - return this._dispatcher - } - - /** - * - */ - - // schedules a runner on the timeline - schedule (runner, delay, when) { - if (runner == null) { - return this._runners.map(makeSchedule).sort(function (a, b) { - return (a.start - b.start) || (a.duration - b.duration) - }) - } - - if (!this.active()) { - this._step(); - if (when == null) { - when = 'now'; - } - } - - // The start time for the next animation can either be given explicitly, - // derived from the current timeline time or it can be relative to the - // last start time to chain animations direclty - var absoluteStartTime = 0; - delay = delay || 0; - - // Work out when to start the animation - if (when == null || when === 'last' || when === 'after') { - // Take the last time and increment - absoluteStartTime = this._startTime; - } else if (when === 'absolute' || when === 'start') { - absoluteStartTime = delay; - delay = 0; - } else if (when === 'now') { - absoluteStartTime = this._time; - } else if (when === 'relative') { - let runnerInfo = this._runners[runner.id]; - if (runnerInfo) { - absoluteStartTime = runnerInfo.start + delay; - delay = 0; - } - } else { - throw new Error('Invalid value for the "when" parameter') - } - - // Manage runner - runner.unschedule(); - runner.timeline(this); - runner.time(-delay); - - // Save startTime for next runner - this._startTime = absoluteStartTime + runner.duration() + delay; - - // Save runnerInfo - this._runners[runner.id] = { - persist: this.persist(), - runner: runner, - start: absoluteStartTime - }; - - // Save order and continue - this._order.push(runner.id); - this._continue(); - return this - } - - // Remove the runner from this timeline - unschedule (runner) { - var index = this._order.indexOf(runner.id); - if (index < 0) return this - - delete this._runners[runner.id]; - this._order.splice(index, 1); - runner.timeline(null); - return this - } - - play () { - // Now make sure we are not paused and continue the animation - this._paused = false; - return this._continue() - } - - pause () { - // Cancel the next animation frame and pause - this._nextFrame = null; - this._paused = true; - return this - } - - stop () { - // Cancel the next animation frame and go to start - this.seek(-this._time); - return this.pause() - } - - finish () { - this.seek(Infinity); - return this.pause() - } - - speed (speed) { - if (speed == null) return this._speed - this._speed = speed; - return this - } - - reverse (yes) { - var currentSpeed = this.speed(); - if (yes == null) return this.speed(-currentSpeed) - - var positive = Math.abs(currentSpeed); - return this.speed(yes ? positive : -positive) - } - - seek (dt) { - this._time += dt; - return this._continue() - } - - time (time) { - if (time == null) return this._time - this._time = time; - return this - } - - persist (dtOrForever) { - if (dtOrForever == null) return this._persist - this._persist = dtOrForever; - return this - } - - source (fn) { - if (fn == null) return this._timeSource - this._timeSource = fn; - return this - } - - _step () { - // If the timeline is paused, just do nothing - if (this._paused) return - - // Get the time delta from the last time and update the time - // TODO: Deal with window.blur window.focus to pause animations - var time = this._timeSource(); - var dtSource = time - this._lastSourceTime; - var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); - this._lastSourceTime = time; - - // Update the time - this._time += dtTime; - this._lastStepTime = this._time; - // this.fire('time', this._time) - - // Run all of the runners directly - var runnersLeft = false; - for (var i = 0, len = this._order.length; i < len; i++) { - // Get and run the current runner and ignore it if its inactive - var runnerInfo = this._runners[this._order[i]]; - var runner = runnerInfo.runner; - let dt = dtTime; - - // Make sure that we give the actual difference - // between runner start time and now - let dtToStart = this._time - runnerInfo.start; - - // Dont run runner if not started yet - if (dtToStart < 0) { - runnersLeft = true; - continue - } else if (dtToStart < dt) { - // Adjust dt to make sure that animation is on point - dt = dtToStart; - } - - if (!runner.active()) continue - - // If this runner is still going, signal that we need another animation - // frame, otherwise, remove the completed runner - var finished = runner.step(dt).done; - if (!finished) { - runnersLeft = true; - // continue - } else if (runnerInfo.persist !== true) { - // runner is finished. And runner might get removed - - // TODO: Figure out end time of runner - var endTime = runner.duration() - runner.time() + this._time; - - if (endTime + this._persist < this._time) { - // Delete runner and correct index - delete this._runners[this._order[i]]; - this._order.splice(i--, 1) && --len; - runner.timeline(null); - } - } - } - - // Get the next animation frame to keep the simulation going - if (runnersLeft) { - this._nextFrame = Animator.frame(this._step.bind(this)); - } else { - this._nextFrame = null; - } - return this - } - - // Checks if we are running and continues the animation - _continue () { - if (this._paused) return this - if (!this._nextFrame) { - this._nextFrame = Animator.frame(this._step.bind(this)); - } - return this - } - - active () { - return !!this._nextFrame - } - } - - Timeline.constructors = { - Element: { - timeline: function () { - this._timeline = (this._timeline || new Timeline()); - return this._timeline - } - } - }; - - // FIXME: What is this doing here? - // easing = { - // '-': function (pos) { return pos }, - // '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 }, - // '>': function (pos) { return Math.sin(pos * Math.PI / 2) }, - // '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 } - // } - - class Runner { - constructor (options) { - // Store a unique id on the runner, so that we can identify it later - this.id = Runner.id++; - - // Ensure a default value - options = options == null - ? timeline.duration - : options; - - // Ensure that we get a controller - options = typeof options === 'function' - ? new Controller(options) - : options; - - // Declare all of the variables - this._element = null; - this._timeline = null; - this.done = false; - this._queue = []; - - // Work out the stepper and the duration - this._duration = typeof options === 'number' && options; - this._isDeclarative = options instanceof Controller; - this._stepper = this._isDeclarative ? options : new Ease(); - - // We copy the current values from the timeline because they can change - this._history = {}; - - // Store the state of the runner - this.enabled = true; - this._time = 0; - this._last = 0; - - // Save transforms applied to this runner - this.transforms = new Matrix(); - this.transformId = 1; - - // Looping variables - this._haveReversed = false; - this._reverse = false; - this._loopsDone = 0; - this._swing = false; - this._wait = 0; - this._times = 1; - } - - /* - Runner Definitions - ================== - These methods help us define the runtime behaviour of the Runner or they - help us make new runners from the current runner - */ - - element (element) { - if (element == null) return this._element - this._element = element; - element._prepareRunner(); - return this - } - - timeline (timeline$$1) { - // check explicitly for undefined so we can set the timeline to null - if (typeof timeline$$1 === 'undefined') return this._timeline - this._timeline = timeline$$1; - return this - } - - animate (duration, delay, when) { - var o = Runner.sanitise(duration, delay, when); - var runner = new Runner(o.duration); - if (this._timeline) runner.timeline(this._timeline); - if (this._element) runner.element(this._element); - return runner.loop(o).schedule(delay, when) - } - - schedule (timeline$$1, delay, when) { - // The user doesn't need to pass a timeline if we already have one - if (!(timeline$$1 instanceof Timeline)) { - when = delay; - delay = timeline$$1; - timeline$$1 = this.timeline(); - } - - // If there is no timeline, yell at the user... - if (!timeline$$1) { - throw Error('Runner cannot be scheduled without timeline') - } - - // Schedule the runner on the timeline provided - timeline$$1.schedule(this, delay, when); - return this - } - - unschedule () { - var timeline$$1 = this.timeline(); - timeline$$1 && timeline$$1.unschedule(this); - return this - } - - loop (times, swing, wait) { - // Deal with the user passing in an object - if (typeof times === 'object') { - swing = times.swing; - wait = times.wait; - times = times.times; - } - - // Sanitise the values and store them - this._times = times || Infinity; - this._swing = swing || false; - this._wait = wait || 0; - return this - } - - delay (delay) { - return this.animate(0, delay) - } - - /* - Basic Functionality - =================== - These methods allow us to attach basic functions to the runner directly - */ - - queue (initFn, runFn, isTransform) { - this._queue.push({ - initialiser: initFn || noop, - runner: runFn || noop, - isTransform: isTransform, - initialised: false, - finished: false - }); - var timeline$$1 = this.timeline(); - timeline$$1 && this.timeline()._continue(); - return this - } - - during (fn) { - return this.queue(null, fn) - } - - after (fn) { - return this.on('finish', fn) - } - - /* - Runner animation methods - ======================== - Control how the animation plays - */ - - time (time) { - if (time == null) { - return this._time - } - let dt = time - this._time; - this.step(dt); - return this - } - - duration () { - return this._times * (this._wait + this._duration) - this._wait - } - - loops (p) { - var loopDuration = this._duration + this._wait; - if (p == null) { - var loopsDone = Math.floor(this._time / loopDuration); - var relativeTime = (this._time - loopsDone * loopDuration); - var position = relativeTime / this._duration; - return Math.min(loopsDone + position, this._times) - } - var whole = Math.floor(p); - var partial = p % 1; - var time = loopDuration * whole + this._duration * partial; - return this.time(time) - } - - position (p) { - // Get all of the variables we need - var x = this._time; - var d = this._duration; - var w = this._wait; - var t = this._times; - var s = this._swing; - var r = this._reverse; - var position; - - if (p == null) { - /* - This function converts a time to a position in the range [0, 1] - The full explanation can be found in this desmos demonstration - https://www.desmos.com/calculator/u4fbavgche - The logic is slightly simplified here because we can use booleans - */ - - // Figure out the value without thinking about the start or end time - const f = function (x) { - var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); - var backwards = (swinging && !r) || (!swinging && r); - var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; - var clipped = Math.max(Math.min(uncliped, 1), 0); - return clipped - }; - - // Figure out the value by incorporating the start time - var endTime = t * (w + d) - w; - position = x <= 0 ? Math.round(f(1e-5)) - : x < endTime ? f(x) - : Math.round(f(endTime - 1e-5)); - return position - } - - // Work out the loops done and add the position to the loops done - var loopsDone = Math.floor(this.loops()); - var swingForward = s && (loopsDone % 2 === 0); - var forwards = (swingForward && !r) || (r && swingForward); - position = loopsDone + (forwards ? p : 1 - p); - return this.loops(position) - } - - progress (p) { - if (p == null) { - return Math.min(1, this._time / this.duration()) - } - return this.time(p * this.duration()) - } - - step (dt) { - // If we are inactive, this stepper just gets skipped - if (!this.enabled) return this - - // Update the time and get the new position - dt = dt == null ? 16 : dt; - this._time += dt; - var position = this.position(); - - // Figure out if we need to run the stepper in this frame - var running = this._lastPosition !== position && this._time >= 0; - this._lastPosition = position; - - // Figure out if we just started - var duration = this.duration(); - var justStarted = this._lastTime < 0 && this._time > 0; - var justFinished = this._lastTime < this._time && this.time > duration; - this._lastTime = this._time; - - // Work out if the runner is finished set the done flag here so animations - // know, that they are running in the last step (this is good for - // transformations which can be merged) - var declarative = this._isDeclarative; - this.done = !declarative && !justFinished && this._time >= duration; - - // Call initialise and the run function - if (running || declarative) { - this._initialise(running); - - // clear the transforms on this runner so they dont get added again and again - this.transforms = new Matrix(); - var converged = this._run(declarative ? dt : position); - // this.fire('step', this) - } - // correct the done flag here - // declaritive animations itself know when they converged - this.done = this.done || (converged && declarative); - // if (this.done) { - // this.fire('finish', this) - // } - return this - } - - finish () { - return this.step(Infinity) - } - - reverse (reverse) { - this._reverse = reverse == null ? !this._reverse : reverse; - return this - } - - ease (fn) { - this._stepper = new Ease(fn); - return this - } - - active (enabled) { - if (enabled == null) return this.enabled - this.enabled = enabled; - return this - } - - /* - Private Methods - =============== - Methods that shouldn't be used externally - */ - - // Save a morpher to the morpher list so that we can retarget it later - _rememberMorpher (method, morpher) { - this._history[method] = { - morpher: morpher, - caller: this._queue[this._queue.length - 1] - }; - } - - // Try to set the target for a morpher if the morpher exists, otherwise - // do nothing and return false - _tryRetarget (method, target) { - if (this._history[method]) { - // if the last method wasnt even initialised, throw it away - if (!this._history[method].caller.initialised) { - let index = this._queue.indexOf(this._history[method].caller); - this._queue.splice(index, 1); - return false - } - - // for the case of transformations, we use the special retarget function - // which has access to the outer scope - if (this._history[method].caller.isTransform) { - this._history[method].caller.isTransform(target); - // for everything else a simple morpher change is sufficient - } else { - this._history[method].morpher.to(target); - } - - this._history[method].caller.finished = false; - var timeline$$1 = this.timeline(); - timeline$$1 && timeline$$1._continue(); - return true - } - return false - } - - // Run each initialise function in the runner if required - _initialise (running) { - // If we aren't running, we shouldn't initialise when not declarative - if (!running && !this._isDeclarative) return - - // Loop through all of the initialisers - for (var i = 0, len = this._queue.length; i < len; ++i) { - // Get the current initialiser - var current = this._queue[i]; - - // Determine whether we need to initialise - var needsIt = this._isDeclarative || (!current.initialised && running); - running = !current.finished; - - // Call the initialiser if we need to - if (needsIt && running) { - current.initialiser.call(this); - current.initialised = true; - } - } - } - - // Run each run function for the position or dt given - _run (positionOrDt) { - // Run all of the _queue directly - var allfinished = true; - for (var i = 0, len = this._queue.length; i < len; ++i) { - // Get the current function to run - var current = this._queue[i]; - - // Run the function if its not finished, we keep track of the finished - // flag for the sake of declarative _queue - var converged = current.runner.call(this, positionOrDt); - current.finished = current.finished || (converged === true); - allfinished = allfinished && current.finished; - } - - // We report when all of the constructors are finished - return allfinished - } - - addTransform (transform, index) { - this.transforms.lmultiplyO(transform); - return this - } - - clearTransform () { - this.transforms = new Matrix(); - return this - } - - static sanitise (duration, delay, when) { - // Initialise the default parameters - var times = 1; - var swing = false; - var wait = 0; - duration = duration || timeline.duration; - delay = delay || timeline.delay; - when = when || 'last'; - - // If we have an object, unpack the values - if (typeof duration === 'object' && !(duration instanceof Stepper)) { - delay = duration.delay || delay; - when = duration.when || when; - swing = duration.swing || swing; - times = duration.times || times; - wait = duration.wait || wait; - duration = duration.duration || timeline.duration; - } - - return { - duration: duration, - delay: delay, - swing: swing, - times: times, - wait: wait, - when: when - } - } - } - - Runner.id = 0; - - class FakeRunner{ - constructor (transforms = new Matrix(), id = -1, done = true) { - this.transforms = transforms; - this.id = id; - this.done = done; - } - } - - extend$1([Runner, FakeRunner], { - mergeWith (runner) { - return new FakeRunner( - runner.transforms.lmultiply(this.transforms), - runner.id - ) - } - }); - - // FakeRunner.emptyRunner = new FakeRunner() - - const lmultiply = (last, curr) => last.lmultiplyO(curr); - const getRunnerTransform = (runner) => runner.transforms; - - function mergeTransforms () { - // Find the matrix to apply to the element and apply it - let runners = this._transformationRunners.runners; - let netTransform = runners - .map(getRunnerTransform) - .reduce(lmultiply, new Matrix()); - - this.transform(netTransform); - - this._transformationRunners.merge(); - - if (this._transformationRunners.length() === 1) { - this._frameId = null; - } - } - - class RunnerArray { - constructor () { - this.runners = []; - this.ids = []; - } - - add (runner) { - if (this.runners.includes(runner)) return - - let id = runner.id + 1; - - let leftSibling = this.ids.reduce((last, curr) => { - if (curr > last && curr < id) return curr - return last - }, 0); - - let index = this.ids.indexOf(leftSibling) + 1; - - this.ids.splice(index, 0, id); - this.runners.splice(index, 0, runner); - - return this - } - - getByID (id) { - return this.runners[this.ids.indexOf(id + 1)] - } - - remove (id) { - let index = this.ids.indexOf(id + 1); - this.ids.splice(index, 1); - this.runners.splice(index, 1); - return this - } - - merge () { - let lastRunner = null; - this.runners.forEach((runner, i) => { - if (lastRunner && runner.done && lastRunner.done) { - this.remove(runner.id); - this.edit(lastRunner.id, runner.mergeWith(lastRunner)); - } - - lastRunner = runner; - }); - - return this - } - - edit (id, newRunner) { - let index = this.ids.indexOf(id + 1); - this.ids.splice(index, 1, id); - this.runners.splice(index, 1, newRunner); - return this - } - - length () { - return this.ids.length - } - - clearBefore (id) { - let deleteCnt = this.ids.indexOf(id + 1) || 1; - this.ids.splice(0, deleteCnt, 0); - this.runners.splice(0, deleteCnt, new FakeRunner()); - return this - } - } - - let frameId = 0; - Runner.constructors = { - Element: { - animate (duration, delay, when) { - var o = Runner.sanitise(duration, delay, when); - var timeline$$1 = this.timeline(); - return new Runner(o.duration) - .loop(o) - .element(this) - .timeline(timeline$$1) - .schedule(delay, when) - }, - - delay (by, when) { - return this.animate(0, by, when) - }, - - // this function searches for all runners on the element and deletes the ones - // which run before the current one. This is because absolute transformations - // overwfrite anything anyway so there is no need to waste time computing - // other runners - _clearTransformRunnersBefore (currentRunner) { - this._transformationRunners.clearBefore(currentRunner.id); - }, - - _currentTransform (current) { - return this._transformationRunners.runners - // we need the equal sign here to make sure, that also transformations - // on the same runner which execute before the current transformation are - // taken into account - .filter((runner) => runner.id <= current.id) - .map(getRunnerTransform) - .reduce(lmultiply, new Matrix()) - }, - - addRunner (runner) { - this._transformationRunners.add(runner); - - Animator.transform_frame( - mergeTransforms.bind(this), this._frameId - ); - }, - - _prepareRunner () { - if (this._frameId == null) { - this._transformationRunners = new RunnerArray() - .add(new FakeRunner(new Matrix(this))); - - this._frameId = frameId++; - } - } - } - }; - - - extend$1(Runner, { - attr (a, v) { - return this.styleAttr('attr', a, v) - }, - - // Add animatable styles - css (s, v) { - return this.styleAttr('css', s, v) - }, - - styleAttr (type, name, val) { - // apply attributes individually - if (typeof name === 'object') { - for (var key in val) { - this.styleAttr(type, key, val[key]); - } - } - - var morpher = new Morphable(this._stepper).to(val); - - this.queue(function () { - morpher = morpher.from(this.element()[type](name)); - }, function (pos) { - this.element()[type](name, morpher.at(pos)); - return morpher.done() - }); - - return this - }, - - zoom (level, point) { - var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); - - this.queue(function () { - morpher = morpher.from(this.zoom()); - }, function (pos) { - this.element().zoom(morpher.at(pos), point); - return morpher.done() - }); - - return this - }, - - /** - ** absolute transformations - **/ - - // - // M v -----|-----(D M v = F v)------|-----> T v - // - // 1. define the final state (T) and decompose it (once) - // t = [tx, ty, the, lam, sy, sx] - // 2. on every frame: pull the current state of all previous transforms - // (M - m can change) - // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] - // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) - // - Note F(0) = M - // - Note F(1) = T - // 4. Now you get the delta matrix as a result: D = F * inv(M) - - transform (transforms, relative, affine) { - // If we have a declarative function, we should retarget it if possible - relative = transforms.relative || relative; - if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { - return this - } - - // Parse the parameters - var isMatrix = isMatrixLike(transforms); - affine = transforms.affine != null - ? transforms.affine - : (affine != null ? affine : !isMatrix); - - // Create a morepher and set its type - const morpher = new Morphable() - .type(affine ? Morphable.TransformBag : Matrix) - .stepper(this._stepper); - - let origin; - let element; - let current; - let currentAngle; - let startTransform; - - function setup () { - // make sure element and origin is defined - element = element || this.element(); - origin = origin || getOrigin(transforms, element); - - startTransform = new Matrix(relative ? undefined : element); - - // add the runner to the element so it can merge transformations - element.addRunner(this); - - // Deactivate all transforms that have run so far if we are absolute - if (!relative) { - element._clearTransformRunnersBefore(this); - } - } - - function run (pos) { - // clear all other transforms before this in case something is saved - // on this runner. We are absolute. We dont need these! - if (!relative) this.clearTransform(); - - let {x, y} = new Point(origin).transform(element._currentTransform(this)); - - let target = new Matrix({...transforms, origin: [x, y]}); - let start = this._isDeclarative && current - ? current - : startTransform; - - if (affine) { - target = target.decompose(x, y); - start = start.decompose(x, y); - - // Get the current and target angle as it was set - const rTarget = target.rotate; - const rCurrent = start.rotate; - - // Figure out the shortest path to rotate directly - const possibilities = [rTarget - 360, rTarget, rTarget + 360]; - const distances = possibilities.map(a => Math.abs(a - rCurrent)); - const shortest = Math.min(...distances); - const index = distances.indexOf(shortest); - target.rotate = possibilities[index]; - } - - if (relative) { - // we have to be careful here not to overwrite the rotation - // with the rotate method of Matrix - if (!isMatrix) { - target.rotate = transforms.rotate || 0; - } - if (this._isDeclarative && currentAngle) { - start.rotate = currentAngle; - } - } - - morpher.from(start); - morpher.to(target); - - let affineParameters = morpher.at(pos); - currentAngle = affineParameters.rotate; - current = new Matrix(affineParameters); - - this.addTransform(current); - return morpher.done() - } - - function retarget (newTransforms) { - // only get a new origin if it changed since the last call - if ( - (newTransforms.origin || 'center').toString() !== - (transforms.origin || 'center').toString() - ) { - origin = getOrigin(transforms, element); - } - - // overwrite the old transformations with the new ones - transforms = {...newTransforms, origin}; - } - - this.queue(setup, run, retarget); - this._isDeclarative && this._rememberMorpher('transform', morpher); - return this - }, - - // Animatable x-axis - x (x, relative) { - return this._queueNumber('x', x) - }, - - // Animatable y-axis - y (y) { - return this._queueNumber('y', y) - }, - - dx (x) { - return this._queueNumberDelta('dx', x) - }, - - dy (y) { - return this._queueNumberDelta('dy', y) - }, - - _queueNumberDelta (method, to) { - to = new SVGNumber(to); - - // Try to change the target if we have this method already registerd - if (this._tryRetargetDelta(method, to)) return this - - // Make a morpher and queue the animation - var morpher = new Morphable(this._stepper).to(to); - this.queue(function () { - var from = this.element()[method](); - morpher.from(from); - morpher.to(from + to); - }, function (pos) { - this.element()[method](morpher.at(pos)); - return morpher.done() - }); - - // Register the morpher so that if it is changed again, we can retarget it - this._rememberMorpher(method, morpher); - return this - }, - - _queueObject (method, to) { - // Try to change the target if we have this method already registerd - if (this._tryRetarget(method, to)) return this - - // Make a morpher and queue the animation - var morpher = new Morphable(this._stepper).to(to); - this.queue(function () { - morpher.from(this.element()[method]()); - }, function (pos) { - this.element()[method](morpher.at(pos)); - return morpher.done() - }); - - // Register the morpher so that if it is changed again, we can retarget it - this._rememberMorpher(method, morpher); - return this - }, - - _queueNumber (method, value) { - return this._queueObject(method, new SVGNumber(value)) - }, - - // Animatable center x-axis - cx (x) { - return this._queueNumber('cx', x) - }, - - // Animatable center y-axis - cy (y) { - return this._queueNumber('cy', y) - }, - - // Add animatable move - move (x, y) { - return this.x(x).y(y) - }, - - // Add animatable center - center (x, y) { - return this.cx(x).cy(y) - }, - - // Add animatable size - size (width, height) { - // animate bbox based size for all other elements - var box; - - if (!width || !height) { - box = this._element.bbox(); - } - - if (!width) { - width = box.width / box.height * height; - } - - if (!height) { - height = box.height / box.width * width; - } - - return this - .width(width) - .height(height) - }, - - // Add animatable width - width (width) { - return this._queueNumber('width', width) - }, - - // Add animatable height - height (height) { - return this._queueNumber('height', height) - }, - - // Add animatable plot - plot (a, b, c, d) { - // Lines can be plotted with 4 arguments - if (arguments.length === 4) { - return this.plot([a, b, c, d]) - } - - // FIXME: this needs to be rewritten such that the element is only accesed - // in the init function - return this._queueObject('plot', new this._element.MorphArray(a)) - - /* - var morpher = this._element.morphArray().to(a) - - this.queue(function () { - morpher.from(this._element.array()) - }, function (pos) { - this._element.plot(morpher.at(pos)) - }) - - return this - */ - }, - - // Add leading method - leading (value) { - return this._queueNumber('leading', value) - }, - - // Add animatable viewbox - viewbox (x, y, width, height) { - return this._queueObject('viewbox', new Box(x, y, width, height)) - }, - - update (o) { - if (typeof o !== 'object') { - return this.update({ - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - }) - } - - if (o.opacity != null) this.attr('stop-opacity', o.opacity); - if (o.color != null) this.attr('stop-color', o.color); - if (o.offset != null) this.attr('offset', o.offset); - - return this - } - }); - - // export {default as Animator} from './Animator.js' - // export {default as SVGArray} from './SVGArray.js' - // export {default as Bare} from './Bare.js' - // export {default as Box} from './Box.js' - // export {default as Circle} from './Circle.js' - // export {default as ClipPath} from './ClipPath.js' - // export {default as Color} from './Color.js' - // export {default as Container} from './Container.js' - // export {Controller, Ease, PID, Spring} from './Controller.js' - // export {default as Defs} from './Defs.js' - // export {default as Doc} from './Doc.js' - // export {default as Element} from './Element.js' - // export {default as Ellipse} from './Ellipse.js' - // export {default as EventTarget} from './EventTarget.js' - // export {default as Gradient} from './Gradient.js' - // export {default as G} from './G.js' - // export {default as HtmlNode} from './HtmlNode.js' - // export {default as A} from './A.js' - // export {default as Image} from './Image.js' - // export {default as Line} from './Line.js' - // export {default as Marker} from './Marker.js' - // export {default as Mask} from './Mask.js' - // export {default as Matrix} from './Matrix.js' - // export {default as Morphable} from './Morphable.js' - // export {default as SVGNumber} from './SVGNumber.js' - // export {default as Parent} from './Parent.js' - // export {default as Path} from './Path.js' - // export {default as PathArray} from './PathArray.js' - // export {default as Pattern} from './Pattern.js' - // export {default as Point} from './Point.js' - // export {default as PointArray} from './PointArray.js' - // export {default as Polygon} from './Polygon.js' - // export {default as Polyline} from './Polyline.js' - // export {default as Queue} from './Queue.js' - // export {default as Rect} from './Rect.js' - // export {default as Runner} from './Runner.js' - // export {default as Shape} from './Shape.js' - // export {default as Stop} from './Stop.js' - // export {default as Symbol} from './Symbol.js' - // export {default as Text} from './Text.js' - // export {default as TextPath} from './TextPath.js' - // export {default as Timeline} from './Timeline.js' - // export {default as Use} from './Use.js' - - var Classes = /*#__PURE__*/Object.freeze({ - HtmlNode: HtmlNode, - Doc: Doc$1, - Defs: Defs, - G: G, - Animator: Animator, - Bare: Bare, - Circle: Circle, - ClipPath: ClipPath, - A: A, - Ellipse: Ellipse, - Stop: Stop, - Gradient: Gradient, - Image: Image, - Line: Line, - Marker: Marker, - Mask: Mask, - Path: Path, - Pattern: Pattern, - Polygon: Polygon, - Polyline: Polyline, - Rect: Rect, - Symbol: Symbol, - Text: Text$1, - TextPath: TextPath, - Tspan: Tspan, - Use: Use, - SVGNumber: SVGNumber, - SVGArray: SVGArray, - PathArray: PathArray, - PointArray: PointArray$1, - Matrix: Matrix, - Point: Point, - Box: Box$1, - Color: Color, - Morphable: Morphable, - Queue: Queue, - Runner: Runner, - Timeline: Timeline, - Controller: Controller, - Ease: Ease, - PID: PID, - Spring: Spring - }); - - - - var containers = /*#__PURE__*/Object.freeze({ - Bare: Bare, - ClipPath: ClipPath, - Defs: Defs, - Doc: Doc$1, - Gradient: Gradient, - G: G, - A: A, - Marker: Marker, - Mask: Mask, - Pattern: Pattern, - Symbol: Symbol - }); - - // ### This module adds backward / forward functionality to elements. - - // Get all siblings, including myself - function siblings () { - return this.parent().children() - } - - // Get the curent position siblings - function position () { - return this.parent().index(this) - } - - // Get the next element (will return null if there is none) - function next () { - return this.siblings()[this.position() + 1] - } - - // Get the next element (will return null if there is none) - function prev () { - return this.siblings()[this.position() - 1] - } - - // Send given element one step forward - function forward () { - var i = this.position() + 1; - var p = this.parent(); - - // move node one step forward - p.removeElement(this).add(this, i); - - // make sure defs node is always at the top - if (p instanceof Doc$1) { - p.node.appendChild(p.defs().node); - } - - return this - } - - // Send given element one step backward - function backward () { - var i = this.position(); - - if (i > 0) { - this.parent().removeElement(this).add(this, i - 1); - } - - return this - } - - // Send given element all the way to the front - function front () { - var p = this.parent(); - - // Move node forward - p.node.appendChild(this.node); - - // Make sure defs node is always at the top - if (p instanceof Doc$1) { - p.node.appendChild(p.defs().node); - } - - return this - } - - // Send given element all the way to the back - function back () { - if (this.position() > 0) { - this.parent().removeElement(this).add(this, 0); - } - - return this - } - - // Inserts a given element before the targeted element - function before (element) { - element.remove(); - - var i = this.position(); - - this.parent().add(element, i); - - return this - } - - // Inserts a given element after the targeted element - function after (element) { - element.remove(); - - var i = this.position(); - - this.parent().add(element, i + 1); - - return this - } - - var arrange = /*#__PURE__*/Object.freeze({ - siblings: siblings, - position: position, - next: next, - prev: prev, - forward: forward, - backward: backward, - front: front, - back: back, - before: before, - after: after - }); - - // // Method for getting an element by id - // SVG.get = function (id) { - // var node = document.getElementById(idFromReference(id) || id) - // return SVG.adopt(node) - // } - // - // // Select elements by query string - // SVG.select = function (query, parent) { - // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { - // return SVG.adopt(node) - // }) - // } - // - // SVG.$$ = function (query, parent) { - // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { - // return SVG.adopt(node) - // }) - // } - // - // SVG.$ = function (query, parent) { - // return SVG.adopt((parent || document).querySelector(query)) - // } - - function baseFind (query, parent) { - return utils.map((parent || document).querySelectorAll(query), function (node) { - return adopt$1(node) - }) - } - - // Scoped find method - function find (query) { - return baseFind(query, this.node) - } - - // Dynamic style generator - function css (style, val) { - let ret = {}; - if (arguments.length === 0) { - // get full style as object - this.node.style.cssText.split(/\s*;\s*/) - .filter(function (el) { return !!el.length }) - .forEach(function (el) { - let t = el.split(/\s*:\s*/); - ret[t[0]] = t[1]; - }); - return ret - } - - if (arguments.length < 2) { - // get style properties in the array - if (Array.isArray(style)) { - for (let name of style) { - let cased = camelCase(name); - ret[cased] = this.node.style(cased); - } - return ret - } - - // get style for property - if (typeof style === 'string') { - return this.node.style[camelCase(style)] - } - - // set styles in object - if (typeof style === 'object') { - for (name in style) { - // set empty string if null/undefined/'' was given - this.node.style[camelCase(name)] = - (style[name] == null || isBlank.test(style[name])) ? '' : style[name]; - } - } - } - - // set style for property - if (arguments.length === 2) { - this.node.style[camelCase(style)] = - (val == null || isBlank.test(val)) ? '' : val; - } - - return this - } - - // Show element - function show () { - return this.css('display', '') - } - - // Hide element - function hide () { - return this.css('display', 'none') - } - - // Is element visible? - function visible () { - return this.css('display') !== 'none' - } - - var css$1 = /*#__PURE__*/Object.freeze({ - css: css, - show: show, - hide: hide, - visible: visible - }); - - // Reset all transformations - function untransform () { - return this.attr('transform', null) - } - - // merge the whole transformation chain into one matrix and returns it - function matrixify () { - var matrix = (this.attr('transform') || '') - // split transformations - .split(transforms).slice(0, -1).map(function (str) { - // generate key => value pairs - var kv = str.trim().split('('); - return [kv[0], - kv[1].split(delimiter) - .map(function (str) { return parseFloat(str) }) - ] - }) - .reverse() - // merge every transformation into one matrix - .reduce(function (matrix, transform) { - if (transform[0] === 'matrix') { - return matrix.lmultiply(arrayToMatrix(transform[1])) - } - return matrix[transform[0]].apply(matrix, transform[1]) - }, new Matrix()); - - return matrix - } - - // add an element to another parent without changing the visual representation on the screen - function toParent (parent) { - if (this === parent) return this - var ctm = this.screenCTM(); - var pCtm = parent.screenCTM().inverse(); - - this.addTo(parent).untransform().transform(pCtm.multiply(ctm)); - - return this - } - - // same as above with parent equals root-svg - function toDoc () { - return this.toParent(this.doc()) - } - - // Add transformations - function transform (o, relative) { - // Act as a getter if no object was passed - if (o == null || typeof o === 'string') { - var decomposed = new Matrix(this).decompose(); - return decomposed[o] || decomposed - } - - if (!isMatrixLike(o)) { - // Set the origin according to the defined transform - o = {...o, origin: getOrigin(o, this)}; - } - - // The user can pass a boolean, an Element or an Matrix or nothing - var cleanRelative = relative === true ? this : (relative || false); - var result = new Matrix(cleanRelative).transform(o); - return this.attr('transform', result) - } - - var transform$1 = /*#__PURE__*/Object.freeze({ - untransform: untransform, - matrixify: matrixify, - toParent: toParent, - toDoc: toDoc, - transform: transform - }); - - // Set svg element attribute - function attr (attr, val, ns) { - // act as full getter - if (attr == null) { - // get an object of attributes - attr = {}; - val = this.node.attributes; - - for (let node of val) { - attr[node.nodeName] = isNumer.test(node.nodeValue) - ? parseFloat(node.nodeValue) - : node.nodeValue; - } - - return attr - } else if (Array.isArray(attr)) ; else if (typeof attr === 'object') { - // apply every attribute individually if an object is passed - for (val in attr) this.attr(val, attr[val]); - } else if (val === null) { - // remove value - this.node.removeAttribute(attr); - } else if (val == null) { - // act as a getter if the first and only argument is not an object - val = this.node.getAttribute(attr); - return val == null ? attrs[attr] // FIXME: do we need to return defaults? - : isNumber.test(val) ? parseFloat(val) - : val - } else { - // convert image fill and stroke to patterns - if (attr === 'fill' || attr === 'stroke') { - if (isImage.test(val)) { - val = this.doc().defs().image(val); - } - - if (val instanceof Image) { - val = this.doc().defs().pattern(0, 0, function () { - this.add(val); - }); - } - } - - // ensure correct numeric values (also accepts NaN and Infinity) - if (typeof val === 'number') { - val = new SVGNumber(val); - } else if (Color.isColor(val)) { - // ensure full hex color - val = new Color(val); - } else if (Array.isArray(val)) { - // parse array values - val = new SVGArray(val); - } - - // if the passed attribute is leading... - if (attr === 'leading') { - // ... call the leading method instead - if (this.leading) { - this.leading(val); - } - } else { - // set given attribute on node - typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) - : this.node.setAttribute(attr, val.toString()); - } - - // rebuild if required - if (this.rebuild && (attr === 'font-size' || attr === 'x')) { - this.rebuild(); - } - } - - return this - } - - const name$1 = 'Element'; - - function setup (node) { - // initialize data object - this.dom = {}; - - // create circular reference - this.node = node; - - this.type = node.nodeName; - this.node.instance = this; - - if (node.hasAttribute('svgjs:data')) { - // pull svgjs data from the dom (getAttributeNS doesn't work in html5) - this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); - } - } - - // Move over x-axis - function x$2 (x) { - return this.attr('x', x) - } - - // Move over y-axis - function y$2 (y) { - return this.attr('y', y) - } - - // Move by center over x-axis - function cx$1 (x) { - return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2) - } - - // Move by center over y-axis - function cy$1 (y) { - return y == null - ? this.y() + this.height() / 2 - : this.y(y - this.height() / 2) - } - - // Move element to given x and y values - function move$1 (x, y) { - return this.x(x).y(y) - } - - // Move element by its center - function center (x, y) { - return this.cx(x).cy(y) - } - - // Set width of element - function width$2 (width) { - return this.attr('width', width) - } - - // Set height of element - function height$2 (height) { - return this.attr('height', height) - } - - // Set element size to given width and height - function size$2 (width, height) { - let p = proportionalSize$1(this, width, height); - - return this - .width(new SVGNumber(p.width)) - .height(new SVGNumber(p.height)) - } - - // Clone element - function clone (parent) { - // write dom data to the dom so the clone can pickup the data - this.writeDataToDom(); - - // clone element and assign new id - let clone = assignNewId(this.node.cloneNode(true)); - - // insert the clone in the given parent or after myself - if (parent) parent.add(clone); - else this.after(clone); - - return clone - } - - // Remove element - function remove () { - if (this.parent()) { this.parent().removeElement(this); } - - return this - } - - // Replace element - function replace (element) { - this.after(element).remove(); - - return element - } - - // Add element to given container and return self - function addTo (parent) { - return makeInstance(parent).put(this) - } - - // Add element to given container and return container - function putIn (parent) { - return makeInstance(parent).add(this) - } - - // Get / set id - function id (id) { - // generate new id if no id set - if (typeof id === 'undefined' && !this.node.id) { - this.node.id = eid(this.type); - } - - // dont't set directly width this.node.id to make `null` work correctly - return this.attr('id', id) - } - - // Checks whether the given point inside the bounding box of the element - function inside (x, y) { - let box = this.bbox(); - - return x > box.x && - y > box.y && - x < box.x + box.width && - y < box.y + box.height - } - - // Return id on string conversion - function toString () { - return this.id() - } - - // Return array of classes on the node - function classes () { - var attr$$1 = this.attr('class'); - return attr$$1 == null ? [] : attr$$1.trim().split(delimiter) - } - - // Return true if class exists on the node, false otherwise - function hasClass (name) { - return this.classes().indexOf(name) !== -1 - } - - // Add class to the node - function addClass (name) { - if (!this.hasClass(name)) { - var array = this.classes(); - array.push(name); - this.attr('class', array.join(' ')); - } - - return this - } - - // Remove class from the node - function removeClass (name) { - if (this.hasClass(name)) { - this.attr('class', this.classes().filter(function (c) { - return c !== name - }).join(' ')); - } - - return this - } - - // Toggle the presence of a class on the node - function toggleClass (name) { - return this.hasClass(name) ? this.removeClass(name) : this.addClass(name) - } - - // FIXME: getIdFromReference - // Get referenced element form attribute value - function reference$1 (attr$$1) { - return get(this.attr(attr$$1)) - } - - // Returns the parent element instance - function parent (type) { - var parent = this; - - // check for parent - if (!parent.node.parentNode) return null - - // get parent element - parent = adopt$1(parent.node.parentNode); - - if (!type) return parent - - // loop trough ancestors if type is given - while (parent && parent.node instanceof window.SVGElement) { - if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent - parent = adopt$1(parent.node.parentNode); - } - } - - // Get parent document - function doc () { - let p = this.parent(Doc$1); - return p && p.doc() - } - - // Get defs - function defs () { - return this.doc().defs() - } - - // return array of all ancestors of given type up to the root svg - function parents (type) { - let parents = []; - let parent = this; - - do { - parent = parent.parent(type); - if (!parent || !parent.node) break - - parents.push(parent); - } while (parent.parent) - - return parents - } - - // matches the element vs a css selector - function matches (selector) { - return matches(this.node, selector) - } - - // Returns the svg node to call native svg methods on it - function native () { - return this.node - } - - // Import raw svg - function svg () { - // write svgjs data to the dom - this.writeDataToDom(); - - return this.node.outerHTML - } - - // write svgjs data to the dom - function writeDataToDom () { - // remove previously set data - this.node.removeAttribute('svgjs:data'); - - if (Object.keys(this.dom).length) { - this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 - } - return this - } - - // set given data to the elements data property - function setData (o) { - this.dom = o; - return this - } - - function getEventTarget$1 () { - return this.node - } - - var Element$1 = /*#__PURE__*/Object.freeze({ - name: name$1, - setup: setup, - x: x$2, - y: y$2, - cx: cx$1, - cy: cy$1, - move: move$1, - center: center, - width: width$2, - height: height$2, - size: size$2, - clone: clone, - remove: remove, - replace: replace, - addTo: addTo, - putIn: putIn, - id: id, - inside: inside, - toString: toString, - classes: classes, - hasClass: hasClass, - addClass: addClass, - removeClass: removeClass, - toggleClass: toggleClass, - reference: reference$1, - parent: parent, - doc: doc, - defs: defs, - parents: parents, - matches: matches, - native: native, - svg: svg, - writeDataToDom: writeDataToDom, - setData: setData, - getEventTarget: getEventTarget$1, - attr: attr - }); - - // Unclip all clipped elements and remove itself - function clipPathRemove () { - // unclip all targets - this.targets().forEach(function (el) { - el.unclip(); - }); - - // remove clipPath from parent - return remove.call(this) - } - - function clipPathTargets () { - return find('svg [clip-path*="' + this.id() + '"]') - } - - // Unclip all clipped elements and remove itself - function maskRemove () { - // unclip all targets - this.targets().forEach(function (el) { - el.unmask(); - }); - - // remove clipPath from parent - return remove.call(this) - } - - function maskTargets () { - return find('svg [mask*="' + this.id() + '"]') - } - - // Unclip all clipped elements and remove itself - function patternGradientRemove () { - // unclip all targets - this.targets().forEach(function (el) { - el.unFill(); - }); - - // remove clipPath from parent - return remove.call(this) - } - - function unFill () { - this.attr('fill', null); - } - - function patternGradientTargets () { - return find('svg [fill*="' + this.id() + '"]') - } - - // custom attr to handle transform - function patternAttr (a, b, c) { - if (a === 'transform') a = 'patternTransform'; - return attr.call(this, a, b, c) - } - - // custom attr to handle transform - function gradientAttr (a, b, c) { - if (a === 'transform') a = 'gradientTransform'; - return attr.call(this, a, b, c) - } - - function pathTargets () { - return find('svg textpath [href*="' + this.id() + '"]') - } - - function HtmlNodeAdd (element, i) { - element = makeInstance(element); - - if (element.node !== this.node.children[i]) { - this.node.insertBefore(element.node, this.node.children[i] || null); - } - - return this - } - - const name$2 = 'EventTarget'; - - function setup$1 (node = {}) { - this.events = node.events || {}; - } - - // Bind given event to listener - function on$1 (event, listener, binding, options) { - on(this, event, listener, binding, options); - return this - } - - // Unbind event from listener - function off$1 (event, listener) { - off(this, event, listener); - return this - } - - function dispatch$1 (event, data) { - return dispatch(this, event, data) - } - - // Fire given event - function fire (event, data) { - this.dispatch(event, data); - return this - } - - var EventTarget = /*#__PURE__*/Object.freeze({ - name: name$2, - setup: setup$1, - on: on$1, - off: off$1, - dispatch: dispatch$1, - fire: fire - }); - - // Returns all child elements - function children () { - return map(this.node.children, function (node) { - return adopt$1(node) - }) - } - - // Add given element at a position - function add (element, i) { - element = makeInstance(element); - - if (element.node !== this.node.children[i]) { - this.node.insertBefore(element.node, this.node.children[i] || null); - } - - return this - } - - // Basically does the same as `add()` but returns the added element instead - function put (element, i) { - this.add(element, i); - return element.instance || element - } - - // Checks if the given element is a child - function has (element) { - return this.index(element) >= 0 - } - - // Gets index of given element - function index (element) { - return [].slice.call(this.node.children).indexOf(element.node) - } - - // Get a element at the given index - function get$1 (i) { - return adopt$1(this.node.children[i]) - } - - // Get first child - function first () { - return this.get(0) - } - - // Get the last child - function last () { - return this.get(this.node.children.length - 1) - } - - // Iterates over all children and invokes a given block - function each (block, deep) { - var children = this.children(); - var i, il; - - for (i = 0, il = children.length; i < il; i++) { - if (children[i] instanceof Base) { - block.apply(children[i], [i, children]); - } - - if (deep && (children[i] instanceof Base && children[i].is('Parent'))) { - children[i].each(block, deep); - } - } - - return this - } - - // Remove a given child - function removeElement (element) { - this.node.removeChild(element.node); - - return this - } - - // Remove all elements in this container - function clear$1 () { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } - - // remove defs reference - delete this._defs; - - return this - } - - // Import raw svg - function svg$1 (svg) { - var well, len; - - // act as a setter if svg is given - if (svg) { - // create temporary holder - well = document.createElementNS(ns, 'svg'); - // dump raw svg - well.innerHTML = svg; - - // transplant nodes - for (len = well.children.length; len--;) { - this.node.appendChild(well.firstElementChild); - } - - // otherwise act as a getter - } else { - // write svgjs data to the dom - this.writeDataToDom(); - - return this.node.outerHTML - } - - return this - } - - // write svgjs data to the dom - function writeDataToDom$1 () { - // dump variables recursively - this.each(function () { - this.writeDataToDom(); - }); - - // remove previously set data - this.node.removeAttribute('svgjs:data'); - - if (Object.keys(this.dom).length) { - this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 - } - return this - } - - function flatten (parent) { - this.each(function () { - if (this.is('Parent')) return this.flatten(parent).ungroup(parent) - return this.toParent(parent) - }); - - // we need this so that Doc does not get removed - this.node.firstElementChild || this.remove(); - - return this - } - - function ungroup (parent) { - parent = parent || this.parent(); - - this.each(function () { - return this.toParent(parent) - }); - - this.remove(); - - return this - } - - var Parent = /*#__PURE__*/Object.freeze({ - children: children, - add: add, - put: put, - has: has, - index: index, - get: get$1, - first: first, - last: last, - each: each, - removeElement: removeElement, - clear: clear$1, - svg: svg$1, - writeDataToDom: writeDataToDom$1, - flatten: flatten, - ungroup: ungroup - }); - - // import {extend} from './tools.js' - const extend$2 = extend$1; - - extend$2([ - Doc$1, - Symbol, - Image, - Pattern, - Marker - ], {viewbox: Box$1.constructors.viewbox}); - - extend$2([Line, Polyline, Polygon, Path], { - ...Marker.constructors.marker - }); - - extend$2(Text$1, TextPath.constructors.Text); - extend$2(Path, TextPath.constructors.Path); - - extend$2(Defs, { - ...Gradient.constructors.Defs, - ...Marker.constructors.Defs, - ...Pattern.constructors.Defs, - }); - - extend$2([Text$1, Tspan], Tspan.constructors.Tspan); - - extend$2([Gradient, Pattern], { - remove: patternGradientRemove, - targets: patternGradientTargets, - unFill: unFill, - }); - - extend$2(Gradient, {attr: gradientAttr}); - extend$2(Pattern, {attr: patternAttr}); - - extend$2(ClipPath, { - remove: clipPathRemove, - targets: clipPathTargets - }); - - extend$2(Mask, { - remove: maskRemove, - targets: maskTargets - }); - - extend$2(Path, {targets: pathTargets}); - - extend$2(HtmlNode, { - add: HtmlNodeAdd - }); - - for (let i in containers) { - extend$2(containers[i], { - ...A.constructors.Container, - ...ClipPath.constructors.Container, - ...Doc$1.constructors.Container, - ...G.constructors.Container, - ...Gradient.constructors.Container, - ...Line.constructors.Container, - ...Marker.constructors.Container, - ...Mask.constructors.Container, - ...Path.constructors.Container, - ...Pattern.constructors.Container, - ...Polygon.constructors.Container, - ...Polyline.constructors.Container, - ...Rect.constructors.Container, - find, - ...Symbol.constructors.Container, - ...Text$1.constructors.Container, - ...TextPath.constructors.Container, - ...Use.constructors.Container, - }); - } - - for (let i in elements) { - extend$2(elements[i], { - ...EventTarget, - ...Element$1, - ...Parent, - ...arrange, - ...A.constructors.Element, - ...Box$1.constructors.Element, - ...Circle.constructors.Element, - ...ClipPath.constructors.Element, - ...css$1, - ...Image.constructors.Element, - ...Mask.constructors.Element, - ...Matrix.constructors.Element, - ...Point.constructors.Element, - ...Runner.constructors.Element, - ...Timeline.constructors.Element, - ...transform$1, - }); - } - - - // The main wrapping element - function SVG (element) { - return makeInstance(element) - } - - Object.assign(SVG, Classes); - Object.assign(SVG, tools); - Object.assign(SVG, adopter); - - return SVG; - -}()); diff --git a/dist/svg.new.js.map b/dist/svg.new.js.map deleted file mode 100644 index 1c6decf..0000000 --- a/dist/svg.new.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"svg.new.js","sources":["../src/Base.js","../src/namespaces.js","../src/regex.js","../src/helpers.js","../src/tools.js","../src/Bare.js","../src/SVGNumber.js","../src/circled.js","../src/Circle.js","../src/ClipPath.js","../src/Defs.js","../src/Doc.js","../src/Ellipse.js","../src/Stop.js","../src/gradiented.js","../src/Gradient.js","../src/G.js","../src/HtmlNode.js","../src/A.js","../src/Pattern.js","../src/event.js","../src/Image.js","../src/SVGArray.js","../src/PointArray.js","../src/Line.js","../src/Marker.js","../src/Mask.js","../src/parser.js","../src/Point.js","../src/PathArray.js","../src/Path.js","../src/pointed.js","../src/poly.js","../src/Polygon.js","../src/Polyline.js","../src/Rect.js","../src/Symbol.js","../src/defaults.js","../src/textable.js","../src/Text.js","../src/TextPath.js","../src/Use.js","../src/adopter.js","../src/Queue.js","../src/Animator.js","../src/Tspan.js","../src/utils.js","../src/Matrix.js","../src/Box.js","../src/Color.js","../src/Controller.js","../src/Morphable.js","../src/Timeline.js","../src/Runner.js","../src/classes.js","../src/arrange.js","../src/selector.js","../src/css.js","../src/transform.js","../src/attr.js","../src/Element.js","../src/specialNeeds.js","../src/EventTarget.js","../src/Parent.js","../src/svg.js"],"sourcesContent":["export default class Base {\r\n constructor (node, {extensions = []}) {\r\n this.tags = []\r\n\r\n for (let extension of extensions) {\r\n extension.setup.call(this, node)\r\n this.tags.push(extension.name)\r\n }\r\n }\r\n\r\n is (ability) {\r\n return this.tags.includes(ability)\r\n }\r\n}\r\n","// Default namespaces\r\nexport let ns = 'http://www.w3.org/2000/svg'\r\nexport let xmlns = 'http://www.w3.org/2000/xmlns/'\r\nexport let xlink = 'http://www.w3.org/1999/xlink'\r\nexport let svgjs = 'http://svgjs.com/svgjs'\r\n","// Parse unit value\r\nexport let numberAndUnit = /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\r\n\r\n// Parse hex value\r\nexport let hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\r\n\r\n// Parse rgb value\r\nexport let rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\r\n\r\n// Parse reference id\r\nexport let reference = /#([a-z0-9\\-_]+)/i\r\n\r\n// splits a transformation chain\r\nexport let transforms = /\\)\\s*,?\\s*/\r\n\r\n// Whitespace\r\nexport let whitespace = /\\s/g\r\n\r\n// Test hex value\r\nexport let isHex = /^#[a-f0-9]{3,6}$/i\r\n\r\n// Test rgb value\r\nexport let isRgb = /^rgb\\(/\r\n\r\n// Test css declaration\r\nexport let isCss = /[^:]+:[^;]+;?/\r\n\r\n// Test for blank string\r\nexport let isBlank = /^(\\s+)?$/\r\n\r\n// Test for numeric string\r\nexport let isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\r\n\r\n// Test for percent value\r\nexport let isPercent = /^-?[\\d.]+%$/\r\n\r\n// Test for image url\r\nexport let isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\r\n\r\n// split at whitespace and comma\r\nexport let delimiter = /[\\s,]+/\r\n\r\n// The following regex are used to parse the d attribute of a path\r\n\r\n// Matches all hyphens which are not after an exponent\r\nexport let hyphen = /([^e])-/gi\r\n\r\n// Replaces and tests for all path letters\r\nexport let pathLetters = /[MLHVCSQTAZ]/gi\r\n\r\n// yes we need this one, too\r\nexport let isPathLetter = /[MLHVCSQTAZ]/i\r\n\r\n// matches 0.154.23.45\r\nexport let numbersWithDots = /((\\d?\\.\\d+(?:e[+-]?\\d+)?)((?:\\.\\d+(?:e[+-]?\\d+)?)+))+/gi\r\n\r\n// matches .\r\nexport let dots = /\\./g\r\n","import {dots, reference} from './regex.js'\r\n\r\nexport function isNulledBox (box) {\r\n return !box.w && !box.h && !box.x && !box.y\r\n}\r\n\r\nexport function domContains (node) {\r\n return (document.documentElement.contains || function (node) {\r\n // This is IE - it does not support contains() for top-level SVGs\r\n while (node.parentNode) {\r\n node = node.parentNode\r\n }\r\n return node === document\r\n }).call(document.documentElement, node)\r\n}\r\n\r\nexport function pathRegReplace (a, b, c, d) {\r\n return c + d.replace(dots, ' .')\r\n}\r\n\r\n// creates deep clone of array\r\nexport function arrayClone (arr) {\r\n var clone = arr.slice(0)\r\n for (var i = clone.length; i--;) {\r\n if (Array.isArray(clone[i])) {\r\n clone[i] = arrayClone(clone[i])\r\n }\r\n }\r\n return clone\r\n}\r\n\r\n// tests if a given selector matches an element\r\nexport function matcher (el, selector) {\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n}\r\n\r\n// Convert dash-separated-string to camelCase\r\nexport function camelCase (s) {\r\n return s.toLowerCase().replace(/-(.)/g, function (m, g) {\r\n return g.toUpperCase()\r\n })\r\n}\r\n\r\n// Capitalize first letter of a string\r\nexport function capitalize (s) {\r\n return s.charAt(0).toUpperCase() + s.slice(1)\r\n}\r\n\r\n// Ensure to six-based hex\r\nexport function fullHex (hex) {\r\n return hex.length === 4\r\n ? [ '#',\r\n hex.substring(1, 2), hex.substring(1, 2),\r\n hex.substring(2, 3), hex.substring(2, 3),\r\n hex.substring(3, 4), hex.substring(3, 4)\r\n ].join('')\r\n : hex\r\n}\r\n\r\n// Component to hex value\r\nexport function compToHex (comp) {\r\n var hex = comp.toString(16)\r\n return hex.length === 1 ? '0' + hex : hex\r\n}\r\n\r\n// Calculate proportional width and height values when necessary\r\nexport function proportionalSize (element, width, height) {\r\n if (width == null || height == null) {\r\n var box = element.bbox()\r\n\r\n if (width == null) {\r\n width = box.width / box.height * height\r\n } else if (height == null) {\r\n height = box.height / box.width * width\r\n }\r\n }\r\n\r\n return {\r\n width: width,\r\n height: height\r\n }\r\n}\r\n\r\n// Map matrix array to object\r\nexport function arrayToMatrix (a) {\r\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\r\n}\r\n\r\n// Add centre point to transform object\r\nexport function ensureCentre (o, target) {\r\n o.cx = o.cx == null ? target.bbox().cx : o.cx\r\n o.cy = o.cy == null ? target.bbox().cy : o.cy\r\n}\r\n\r\n// PathArray Helpers\r\nexport function arrayToString (a) {\r\n for (var i = 0, il = a.length, s = ''; i < il; i++) {\r\n s += a[i][0]\r\n\r\n if (a[i][1] != null) {\r\n s += a[i][1]\r\n\r\n if (a[i][2] != null) {\r\n s += ' '\r\n s += a[i][2]\r\n\r\n if (a[i][3] != null) {\r\n s += ' '\r\n s += a[i][3]\r\n s += ' '\r\n s += a[i][4]\r\n\r\n if (a[i][5] != null) {\r\n s += ' '\r\n s += a[i][5]\r\n s += ' '\r\n s += a[i][6]\r\n\r\n if (a[i][7] != null) {\r\n s += ' '\r\n s += a[i][7]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return s + ' '\r\n}\r\n\r\n// Add more bounding box properties\r\nexport function fullBox (b) {\r\n if (b.x == null) {\r\n b.x = 0\r\n b.y = 0\r\n b.width = 0\r\n b.height = 0\r\n }\r\n\r\n b.w = b.width\r\n b.h = b.height\r\n b.x2 = b.x + b.width\r\n b.y2 = b.y + b.height\r\n b.cx = b.x + b.width / 2\r\n b.cy = b.y + b.height / 2\r\n\r\n return b\r\n}\r\n\r\n// Get id from reference string\r\nexport function idFromReference (url) {\r\n var m = (url || '').toString().match(reference)\r\n\r\n if (m) return m[1]\r\n}\r\n\r\n// Create matrix array for looping\r\nexport let abcdef = 'abcdef'.split('')\r\n\r\nexport function closeEnough (a, b, threshold) {\r\n return Math.abs(b - a) < (threshold || 1e-6)\r\n}\r\n\r\nexport function isMatrixLike (o) {\r\n return (\r\n o.a != null ||\r\n o.b != null ||\r\n o.c != null ||\r\n o.d != null ||\r\n o.e != null ||\r\n o.f != null\r\n )\r\n}\r\n\r\nexport function getOrigin (o, element) {\r\n // Allow origin or around as the names\r\n let origin = o.origin // o.around == null ? o.origin : o.around\r\n let ox, oy\r\n\r\n // Allow the user to pass a string to rotate around a given point\r\n if (typeof origin === 'string' || origin == null) {\r\n // Get the bounding box of the element with no transformations applied\r\n const string = (origin || 'center').toLowerCase().trim()\r\n const { height, width, x, y } = element.bbox()\r\n\r\n // Calculate the transformed x and y coordinates\r\n let bx = string.includes('left') ? x\r\n : string.includes('right') ? x + width\r\n : x + width / 2\r\n let by = string.includes('top') ? y\r\n : string.includes('bottom') ? y + height\r\n : y + height / 2\r\n\r\n // Set the bounds eg : \"bottom-left\", \"Top right\", \"middle\" etc...\r\n ox = o.ox != null ? o.ox : bx\r\n oy = o.oy != null ? o.oy : by\r\n } else {\r\n ox = origin[0]\r\n oy = origin[1]\r\n }\r\n\r\n // Return the origin as it is if it wasn't a string\r\n return [ ox, oy ]\r\n}\r\n","import {ns} from './namespaces.js'\r\nimport {capitalize} from './helpers.js'\r\n\r\nexport function nodeOrNew (name, node) {\r\n return node || makeNode(name)\r\n}\r\n\r\n// Method for element creation\r\nexport function makeNode (name) {\r\n // create element\r\n return document.createElementNS(ns, name)\r\n}\r\n\r\n// Method for extending objects\r\nexport function extend (modules, methods) {\r\n var key, i\r\n\r\n if (Array.isArray(methods)) {\r\n methods.forEach((method) => {\r\n extend(modules, method)\r\n })\r\n return\r\n }\r\n\r\n modules = Array.isArray(modules) ? modules : [modules]\r\n\r\n for (i = modules.length - 1; i >= 0; i--) {\r\n if (methods.name) {\r\n modules[i].extensions = (modules[i].extensions || []).concat(methods)\r\n }\r\n for (key in methods) {\r\n if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue\r\n modules[i].prototype[key] = methods[key]\r\n }\r\n }\r\n}\r\n\r\n// FIXME: enhanced constructors here\r\nexport function addFactory (modules, methods) {\r\n extend(modules, methods)\r\n}\r\n\r\n// Invent new element\r\nexport function invent (config) {\r\n // Create element initializer\r\n var initializer = typeof config.create === 'function' ? config.create\r\n : function (node) {\r\n config.inherit.call(this, node || makeNode(config.create))\r\n }\r\n\r\n // Inherit prototype\r\n if (config.inherit) {\r\n initializer.prototype = new config.inherit()\r\n initializer.prototype.constructor = initializer\r\n }\r\n\r\n // Extend with methods\r\n if (config.extend) {\r\n extend(initializer, config.extend)\r\n }\r\n\r\n // Attach construct method to parent\r\n if (config.construct) { extend(config.parent || Container, config.construct) }\r\n\r\n return initializer\r\n}\r\n","import {nodeOrNew} from './tools.js'\r\n\r\nexport default function Bare (element, inherit = {}) {\r\n let custom = class Custom extends inherit {\r\n constructor (node) {\r\n super(nodeOrNew(element, node), Custom)\r\n }\r\n\r\n words (text) {\r\n // remove contents\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n\r\n // create text node\r\n this.node.appendChild(document.createTextNode(text))\r\n\r\n return this\r\n }\r\n }\r\n\r\n extend(custom, inherit)\r\n}\r\n\r\n// export let constructors = {\r\n// // Create an element that is not described by SVG.js\r\n// element: function (element, inherit) {\r\n// let custom = createCustom(element, inherit)\r\n// return this.put(new custom())\r\n// }\r\n// }\r\n\r\n// extend(Parent, {\r\n// // Create an element that is not described by SVG.js\r\n// element: function (element, inherit) {\r\n// let custom = createCustom(element, inherit)\r\n// return this.put(new custom())\r\n// }\r\n// })\r\n","import {numberAndUnit} from './regex.js'\r\n\r\n// Module for unit convertions\r\nexport default class SVGNumber {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (value, unit) {\r\n unit = Array.isArray(value) ? value[1] : unit\r\n value = Array.isArray(value) ? value[0] : value\r\n\r\n // initialize defaults\r\n this.value = 0\r\n this.unit = unit || ''\r\n\r\n // parse value\r\n if (typeof value === 'number') {\r\n // ensure a valid numeric value\r\n this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value\r\n } else if (typeof value === 'string') {\r\n unit = value.match(numberAndUnit)\r\n\r\n if (unit) {\r\n // make value numeric\r\n this.value = parseFloat(unit[1])\r\n\r\n // normalize\r\n if (unit[5] === '%') { this.value /= 100 } else if (unit[5] === 's') {\r\n this.value *= 1000\r\n }\r\n\r\n // store unit\r\n this.unit = unit[5]\r\n }\r\n } else {\r\n if (value instanceof SVGNumber) {\r\n this.value = value.valueOf()\r\n this.unit = value.unit\r\n }\r\n }\r\n }\r\n\r\n toString () {\r\n return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6\r\n : this.unit === 's' ? this.value / 1e3\r\n : this.value\r\n ) + this.unit\r\n }\r\n\r\n toJSON () {\r\n return this.toString()\r\n }\r\n\r\n\r\n toArray () {\r\n return [this.value, this.unit]\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n // Add number\r\n plus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this + number, this.unit || number.unit)\r\n }\r\n\r\n // Subtract number\r\n minus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this - number, this.unit || number.unit)\r\n }\r\n\r\n // Multiply number\r\n times (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this * number, this.unit || number.unit)\r\n }\r\n\r\n // Divide number\r\n divide (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this / number, this.unit || number.unit)\r\n }\r\n}\r\n","// FIXME: import this to runner\r\nimport {proportionalSize} from './helpers.js'\r\nimport SVGNumber from './SVGNumber.js'\r\n\r\n// Radius x value\r\nexport function rx (rx) {\r\n return this.attr('rx', rx)\r\n}\r\n\r\n// Radius y value\r\nexport function ry (ry) {\r\n return this.attr('ry', ry)\r\n}\r\n\r\n// Move over x-axis\r\nexport function x (x) {\r\n return x == null\r\n ? this.cx() - this.rx()\r\n : this.cx(x + this.rx())\r\n}\r\n\r\n// Move over y-axis\r\nexport function y (y) {\r\n return y == null\r\n ? this.cy() - this.ry()\r\n : this.cy(y + this.ry())\r\n}\r\n\r\n// Move by center over x-axis\r\nexport function cx (x) {\r\n return x == null\r\n ? this.attr('cx')\r\n : this.attr('cx', x)\r\n}\r\n\r\n// Move by center over y-axis\r\nexport function cy (y) {\r\n return y == null\r\n ? this.attr('cy')\r\n : this.attr('cy', y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n return width == null\r\n ? this.rx() * 2\r\n : this.rx(new SVGNumber(width).divide(2))\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n return height == null\r\n ? this.ry() * 2\r\n : this.ry(new SVGNumber(height).divide(2))\r\n}\r\n\r\n// Custom size function\r\nexport function size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .rx(new SVGNumber(p.width).divide(2))\r\n .ry(new SVGNumber(p.height).divide(2))\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\nimport {x, y, cx, cy, width, height, size} from './circled.js'\r\nimport SVGNumber from './SVGNumber.js'\r\n\r\nexport default class Circle extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('circle', node), Circle)\r\n }\r\n\r\n radius (r) {\r\n return this.attr('r', r)\r\n }\r\n\r\n // Radius x value\r\n rx (rx) {\r\n return this.attr('r', rx)\r\n }\r\n\r\n // Alias radius x value\r\n ry (ry) {\r\n return this.rx(ry)\r\n }\r\n}\r\n\r\nextend(Circle, {x, y, cx, cy, width, height, size})\r\n\r\nCircle.constructors = {\r\n Element: {\r\n // Create circle element\r\n circle (size) {\r\n return this.put(new Circle())\r\n .radius(new SVGNumber(size).divide(2))\r\n .move(0, 0)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\n//import find from './selector.js'\r\n//import {remove} from './Element.js'\r\n\r\nexport default class ClipPath extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('clipPath', node), ClipPath)\r\n }\r\n\r\n // // Unclip all clipped elements and remove itself\r\n // remove () {\r\n // // unclip all targets\r\n // this.targets().forEach(function (el) {\r\n // el.unclip()\r\n // })\r\n //\r\n // // remove clipPath from parent\r\n // return remove.call(this)\r\n // }\r\n //\r\n // targets () {\r\n // return find('svg [clip-path*=\"' + this.id() + '\"]')\r\n // }\r\n}\r\n\r\n\r\nClipPath.constructors = {\r\n Container: {\r\n // Create clipping element\r\n clip: function() {\r\n return this.defs().put(new ClipPath)\r\n }\r\n },\r\n Element: {\r\n // Distribute clipPath to svg element\r\n clipWith (element) {\r\n // use given clip or create a new one\r\n let clipper = element instanceof ClipPath\r\n ? element\r\n : this.parent().clip().add(element)\r\n\r\n // apply mask\r\n return this.attr('clip-path', 'url(\"#' + clipper.id() + '\")')\r\n },\r\n\r\n // Unclip element\r\n unclip () {\r\n return this.attr('clip-path', null)\r\n },\r\n\r\n clipper () {\r\n return this.reference('clip-path')\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew} from './tools.js'\r\n\r\nexport default class Defs extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('defs', node), Defs)\r\n }\r\n\r\n flatten () { return this }\r\n ungroup () { return this }\r\n}\r\n","import Base from './Base.js'\r\nimport Defs from './Defs.js'\r\nimport { extend, nodeOrNew } from './tools.js'\r\nimport { ns, xlink, xmlns, svgjs } from './namespaces.js'\r\n//import {adopt} from './adopter.js'\r\n\r\nexport default class Doc extends Base {\r\n constructor(node) {\r\n super(nodeOrNew('svg', node), Doc)\r\n this.namespace()\r\n }\r\n\r\n isRoot() {\r\n return !this.node.parentNode\r\n || !(this.node.parentNode instanceof window.SVGElement)\r\n || this.node.parentNode.nodeName === '#document'\r\n }\r\n\r\n // Check if this is a root svg\r\n // If not, call docs from this element\r\n doc() {\r\n if (this.isRoot()) return this\r\n return Element.doc.call(this)\r\n }\r\n\r\n // Add namespaces\r\n namespace() {\r\n if (!this.isRoot()) return this.doc().namespace()\r\n return this\r\n .attr({ xmlns: ns, version: '1.1' })\r\n .attr('xmlns:xlink', xlink, xmlns)\r\n .attr('xmlns:svgjs', svgjs, xmlns)\r\n }\r\n\r\n // Creates and returns defs element\r\n defs() {\r\n if (!this.isRoot()) return this.doc().defs()\r\n\r\n let node = this.node.getElementsByTagName('defs')[0]\r\n return node ? (node.instance || new Defs(node)) : this.put(new Defs())\r\n // \r\n // return adopt(this.node.getElementsByTagName('defs')[0]) ||\r\n // this.put(new Defs())\r\n }\r\n\r\n // custom parent method\r\n parent(type) {\r\n if (this.isRoot()) {\r\n return this.node.parentNode.nodeName === '#document'\r\n ? null\r\n : this.node.parentNode\r\n }\r\n\r\n return Element.parent.call(this, type)\r\n }\r\n\r\n // Removes the doc from the DOM\r\n remove() {\r\n if (!this.isRoot()) {\r\n return Element.remove.call(this)\r\n }\r\n\r\n if (this.parent()) {\r\n this.parent().removeChild(this.node)\r\n }\r\n\r\n return this\r\n }\r\n\r\n clear() {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n return this\r\n }\r\n}\r\n\r\nDoc.constructors = {\r\n Container: {\r\n // Create nested svg document\r\n nested() {\r\n return this.put(new Doc())\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport * as circled from './circled.js'\r\nimport {extend} from './tools.js'\r\n\r\nexport default class Ellipse extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('ellipse', node), Ellipse)\r\n }\r\n}\r\n\r\nextend(Ellipse, circled)\r\n\r\n// addFactory(Container, {\r\n// // Create an ellipse\r\n// ellipse: function (width, height) {\r\n// return this.put(new Ellipse()).size(width, height).move(0, 0)\r\n// }\r\n// })\r\n","import Base from './Base.js'\r\nimport SVGNumber from './SVGNumber.js'\r\nimport {nodeOrNew} from './tools.js'\r\n\r\nexport default class Stop extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('stop', node), Stop)\r\n }\r\n\r\n // add color stops\r\n update (o) {\r\n if (typeof o === 'number' || o instanceof SVGNumber) {\r\n o = {\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n }\r\n }\r\n\r\n // set attributes\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\r\n\r\n return this\r\n }\r\n}\r\n","// FIXME: add to runner\r\nimport SVGNumber from './SVGNumber.js'\r\n\r\nexport function from (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\r\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\r\n}\r\n\r\nexport function to (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\r\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\r\n}\r\n","import Stop from './Stop.js'\r\nimport Base from './Base.js'\r\nimport * as gradiented from './gradiented.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\n//import attr from './attr.js'\r\n\r\nexport default class Gradient extends Base {\r\n constructor (type) {\r\n super(\r\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\r\n Gradient\r\n )\r\n }\r\n\r\n // Add a color stop\r\n stop (offset, color, opacity) {\r\n return this.put(new Stop()).update(offset, color, opacity)\r\n }\r\n\r\n // Update gradient\r\n update (block) {\r\n // remove all stops\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // // custom attr to handle transform\r\n // attr (a, b, c) {\r\n // if (a === 'transform') a = 'gradientTransform'\r\n // return attr.call(this, a, b, c)\r\n // }\r\n}\r\n\r\nextend(Gradient, gradiented)\r\n\r\nGradient.constructors = {\r\n Container: {\r\n // Create gradient element in defs\r\n gradient (type, block) {\r\n return this.defs().gradient(type, block)\r\n }\r\n },\r\n // define gradient\r\n Defs: {\r\n gradient (type, block) {\r\n return this.put(new Gradient(type)).update(block)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\n\r\nexport default class G extends Base {\r\n constructor (node) {\r\n super(nodeorNew('g', node), G)\r\n }\r\n}\r\n\r\nG.constructors = {\r\n Element: {\r\n // Create a group element\r\n group: function () {\r\n return this.put(new G())\r\n }\r\n }\r\n}\r\n","//import {makeInstance} from './adopter.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class HtmlNode extends Base {\r\n constructor (element) {\r\n super(element, HtmlNode)\r\n this.node = element\r\n }\r\n\r\n // add (element, i) {\r\n // element = makeInstance(element)\r\n //\r\n // if (element.node !== this.node.children[i]) {\r\n // this.node.insertBefore(element.node, this.node.children[i] || null)\r\n // }\r\n //\r\n // return this\r\n // }\r\n\r\n put (element, i) {\r\n this.add(element, i)\r\n return element\r\n }\r\n\r\n getEventTarget () {\r\n return this.node\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew} from './tools.js'\r\nimport {xlink} from './namespaces.js'\r\n\r\nexport default class A extends Base{\r\n constructor (node) {\r\n super(nodeOrNew('a', node), A)\r\n }\r\n\r\n // Link url\r\n to (url) {\r\n return this.attr('href', url, xlink)\r\n }\r\n\r\n // Link target attribute\r\n target (target) {\r\n return this.attr('target', target)\r\n }\r\n}\r\n\r\nA.constructors = {\r\n Container: {\r\n // Create a hyperlink element\r\n link: function (url) {\r\n return this.put(new A()).to(url)\r\n }\r\n },\r\n Element: {\r\n // Create a hyperlink element\r\n linkTo: function (url) {\r\n var link = new A()\r\n\r\n if (typeof url === 'function') { url.call(link, link) } else {\r\n link.to(url)\r\n }\r\n\r\n return this.parent().put(link).put(this)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew} from './tools.js'\r\n//import attr from './attr.js'\r\n\r\nexport default class Pattern extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('pattern', node))\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Update pattern by rebuilding\r\n update (block) {\r\n // remove content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // // custom attr to handle transform\r\n // attr (a, b, c) {\r\n // if (a === 'transform') a = 'patternTransform'\r\n // return attr.call(this, a, b, c)\r\n // }\r\n}\r\n\r\nPattern.constructors = {\r\n Container: {\r\n // Create pattern element in defs\r\n pattern (width, height, block) {\r\n return this.defs().pattern(width, height, block)\r\n }\r\n },\r\n Defs: {\r\n pattern (width, height, block) {\r\n return this.put(new Pattern()).update(block).attr({\r\n x: 0,\r\n y: 0,\r\n width: width,\r\n height: height,\r\n patternUnits: 'userSpaceOnUse'\r\n })\r\n }\r\n }\r\n}\r\n","import {delimiter} from './regex.js'\r\n\r\n// // Add events to elements\r\n// ;[ 'click',\r\n// 'dblclick',\r\n// 'mousedown',\r\n// 'mouseup',\r\n// 'mouseover',\r\n// 'mouseout',\r\n// 'mousemove',\r\n// 'mouseenter',\r\n// 'mouseleave',\r\n// 'touchstart',\r\n// 'touchmove',\r\n// 'touchleave',\r\n// 'touchend',\r\n// 'touchcancel' ].forEach(function (event) {\r\n// // add event to Element\r\n// Element.prototype[event] = function (f) {\r\n// if (f === null) {\r\n// off(this, event)\r\n// } else {\r\n// on(this, event, f)\r\n// }\r\n// return this\r\n// }\r\n// })\r\n\r\nlet listenerId = 0\r\n\r\nfunction getEventTarget (node) {\r\n return node instanceof Base && node.is('EventTarget')\r\n ? node.getEventTarget()\r\n : node\r\n}\r\n\r\n// Add event binder in the SVG namespace\r\nexport function on (node, events, listener, binding, options) {\r\n var l = listener.bind(binding || node)\r\n var n = getEventTarget(node)\r\n\r\n // events can be an array of events or a string of events\r\n events = Array.isArray(events) ? events : events.split(delimiter)\r\n\r\n // ensure instance object for nodes which are not adopted\r\n n.instance = n.instance || {events: {}}\r\n\r\n // pull event handlers from the element\r\n var bag = n.instance.events\r\n\r\n // add id to listener\r\n if (!listener._svgjsListenerId) {\r\n listener._svgjsListenerId = ++listenerId\r\n }\r\n\r\n events.forEach(function (event) {\r\n var ev = event.split('.')[0]\r\n var ns = event.split('.')[1] || '*'\r\n\r\n // ensure valid object\r\n bag[ev] = bag[ev] || {}\r\n bag[ev][ns] = bag[ev][ns] || {}\r\n\r\n // reference listener\r\n bag[ev][ns][listener._svgjsListenerId] = l\r\n\r\n // add listener\r\n n.addEventListener(ev, l, options || false)\r\n })\r\n}\r\n\r\n// Add event unbinder in the SVG namespace\r\nexport function off (node, events, listener, options) {\r\n var n = getEventTarget(node)\r\n\r\n // we cannot remove an event if its not an svg.js instance\r\n if (!n.instance) return\r\n\r\n // listener can be a function or a number\r\n if (typeof listener === 'function') {\r\n listener = listener._svgjsListenerId\r\n if (!listener) return\r\n }\r\n\r\n // pull event handlers from the element\r\n var bag = n.instance.events\r\n\r\n // events can be an array of events or a string or undefined\r\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\r\n\r\n events.forEach(function (event) {\r\n var ev = event && event.split('.')[0]\r\n var ns = event && event.split('.')[1]\r\n var namespace, l\r\n\r\n if (listener) {\r\n // remove listener reference\r\n if (bag[ev] && bag[ev][ns || '*']) {\r\n // removeListener\r\n n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false)\r\n\r\n delete bag[ev][ns || '*'][listener]\r\n }\r\n } else if (ev && ns) {\r\n // remove all listeners for a namespaced event\r\n if (bag[ev] && bag[ev][ns]) {\r\n for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l) }\r\n\r\n delete bag[ev][ns]\r\n }\r\n } else if (ns) {\r\n // remove all listeners for a specific namespace\r\n for (event in bag) {\r\n for (namespace in bag[event]) {\r\n if (ns === namespace) { off(n, [event, ns].join('.')) }\r\n }\r\n }\r\n } else if (ev) {\r\n // remove all listeners for the event\r\n if (bag[ev]) {\r\n for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')) }\r\n\r\n delete bag[ev]\r\n }\r\n } else {\r\n // remove all listeners on a given node\r\n for (event in bag) { off(n, event) }\r\n\r\n n.instance.events = {}\r\n }\r\n })\r\n}\r\n\r\nexport function dispatch (node, event, data) {\r\n var n = getEventTarget(node)\r\n\r\n // Dispatch event\r\n if (event instanceof window.Event) {\r\n n.dispatchEvent(event)\r\n } else {\r\n event = new window.CustomEvent(event, {detail: data, cancelable: true})\r\n n.dispatchEvent(event)\r\n }\r\n return event\r\n}\r\n","import Base from './Base.js'\r\nimport Pattern from './Pattern.js'\r\nimport {on, off} from './event.js'\r\nimport {nodeOrNew} from './tools.js'\r\nimport {xlink} from './namespaces.js'\r\n\r\nexport default class Image extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('image', node), Image)\r\n }\r\n\r\n // (re)load image\r\n load (url, callback) {\r\n if (!url) return this\r\n\r\n var img = new window.Image()\r\n\r\n on(img, 'load', function (e) {\r\n var p = this.parent(Pattern)\r\n\r\n // ensure image size\r\n if (this.width() === 0 && this.height() === 0) {\r\n this.size(img.width, img.height)\r\n }\r\n\r\n if (p instanceof Pattern) {\r\n // ensure pattern size if not set\r\n if (p.width() === 0 && p.height() === 0) {\r\n p.size(this.width(), this.height())\r\n }\r\n }\r\n\r\n if (typeof callback === 'function') {\r\n callback.call(this, {\r\n width: img.width,\r\n height: img.height,\r\n ratio: img.width / img.height,\r\n url: url\r\n })\r\n }\r\n }, this)\r\n\r\n on(img, 'load error', function () {\r\n // dont forget to unbind memory leaking events\r\n off(img)\r\n })\r\n\r\n return this.attr('href', (img.src = url), xlink)\r\n }\r\n}\r\n\r\nImage.constructors = {\r\n Container: {\r\n // create image element, load image and set its size\r\n image (source, callback) {\r\n return this.put(new Image()).size(0, 0).load(source, callback)\r\n }\r\n }\r\n}\r\n","/* global arrayClone */\r\nimport {delimiter} from './regex.js'\r\nimport ArrayPolyfill from './ArrayPolyfill.js'\r\n\r\nlet BaseArray = (function() {\r\n try {\r\n let b = class extends Array {}\r\n return Array\r\n } catch (e) {\r\n return ArrayPolyfill\r\n }\r\n})()\r\n\r\nexport default class SVGArray extends BaseArray {\r\n constructor (...args) {\r\n super()\r\n this.init(...args)\r\n }\r\n\r\n init (array, fallback) {\r\n //this.splice(0, this.length)\r\n this.length = 0\r\n this.push(...this.parse(array || fallback))\r\n }\r\n\r\n toArray () {\r\n return Array.prototype.slice(this)\r\n }\r\n\r\n toString () {\r\n this.join(' ')\r\n }\r\n\r\n valueOf () {\r\n return this.toArray()\r\n }\r\n\r\n // Parse whitespace separated string\r\n parse (array) {\r\n array = array.valueOf()\r\n\r\n // if already is an array, no need to parse it\r\n if (Array.isArray(array)) return array\r\n\r\n return array.trim().split(delimiter).map(parseFloat)\r\n }\r\n\r\n clone () {\r\n return new this.constructor(this)\r\n }\r\n\r\n toSet () {\r\n return new Set(this)\r\n }\r\n}\r\n","import SVGArray from './SVGArray.js'\r\nimport {delimiter} from './regex.js'\r\n\r\nexport default class PointArray extends SVGArray {\r\n constructor (array, fallback = [[0, 0]]) {\r\n super(array, fallback)\r\n }\r\n\r\n // Convert array to string\r\n toString () {\r\n // convert to a poly point string\r\n for (var i = 0, il = this.value.length, array = []; i < il; i++) {\r\n array.push(this.value[i].join(','))\r\n }\r\n\r\n return array.join(' ')\r\n }\r\n\r\n toArray () {\r\n return this.value.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // Convert array to line object\r\n toLine () {\r\n return {\r\n x1: this.value[0][0],\r\n y1: this.value[0][1],\r\n x2: this.value[1][0],\r\n y2: this.value[1][1]\r\n }\r\n }\r\n\r\n // Get morphed array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n // generate morphed point string\r\n for (var i = 0, il = this.value.length, array = []; i < il; i++) {\r\n array.push([\r\n this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos,\r\n this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos\r\n ])\r\n }\r\n\r\n return new PointArray(array)\r\n }\r\n\r\n // Parse point string and flat array\r\n parse (array) {\r\n var points = []\r\n\r\n array = array.valueOf()\r\n\r\n // if it is an array\r\n if (Array.isArray(array)) {\r\n // and it is not flat, there is no need to parse it\r\n if (Array.isArray(array[0])) {\r\n return array\r\n }\r\n } else { // Else, it is considered as a string\r\n // parse points\r\n array = array.trim().split(delimiter).map(parseFloat)\r\n }\r\n\r\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\r\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\r\n if (array.length % 2 !== 0) array.pop()\r\n\r\n // wrap points in two-tuples and parse points as floats\r\n for (var i = 0, len = array.length; i < len; i = i + 2) {\r\n points.push([ array[i], array[i + 1] ])\r\n }\r\n\r\n return points\r\n }\r\n\r\n // Move point string\r\n move (x, y) {\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n // move every point\r\n if (!isNaN(x) && !isNaN(y)) {\r\n for (var i = this.value.length - 1; i >= 0; i--) {\r\n this.value[i] = [this.value[i][0] + x, this.value[i][1] + y]\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Resize poly string\r\n size (width, height) {\r\n var i\r\n var box = this.bbox()\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.value.length - 1; i >= 0; i--) {\r\n if (box.width) this.value[i][0] = ((this.value[i][0] - box.x) * width) / box.width + box.x\r\n if (box.height) this.value[i][1] = ((this.value[i][1] - box.y) * height) / box.height + box.y\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Get bounding box of points\r\n bbox () {\r\n var maxX = -Infinity\r\n var maxY = -Infinity\r\n var minX = Infinity\r\n var minY = Infinity\r\n this.value.forEach(function (el) {\r\n maxX = Math.max(el[0], maxX)\r\n maxY = Math.max(el[1], maxY)\r\n minX = Math.min(el[0], minX)\r\n minY = Math.min(el[1], minY)\r\n })\r\n return {x: minX, y: minY, width: maxX - minX, height: maxY - minY}\r\n }\r\n}\r\n","import {proportionalSize} from './helpers.js'\r\nimport {nodeOrNew} from './tools.js'\r\nimport PointArray from './PointArray.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class Line extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('line', node), Line)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return new PointArray([\r\n [ this.attr('x1'), this.attr('y1') ],\r\n [ this.attr('x2'), this.attr('y2') ]\r\n ])\r\n }\r\n\r\n // Overwrite native plot() method\r\n plot (x1, y1, x2, y2) {\r\n if (x1 == null) {\r\n return this.array()\r\n } else if (typeof y1 !== 'undefined') {\r\n x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }\r\n } else {\r\n x1 = new PointArray(x1).toLine()\r\n }\r\n\r\n return this.attr(x1)\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr(this.array().move(x, y).toLine())\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr(this.array().size(p.width, p.height).toLine())\r\n }\r\n\r\n}\r\n\r\nLine.constructors = {\r\n Container: {\r\n // Create a line element\r\n line (...args) {\r\n // make sure plot is called as a setter\r\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\r\n return Line.prototype.plot.apply(\r\n this.put(new Line())\r\n , args[0] != null ? args : [0, 0, 0, 0]\r\n )\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\n// import Defs from './Defs.js'\r\n// import Line from './Line.js'\r\n// import Polyline from './Polyline.js'\r\n// import Polygon from './Polygon.js'\r\n// import Path from './Path.js'\r\n\r\nexport default class Marker extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('marker', node), Marker)\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('markerWidth', width)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('markerHeight', height)\r\n }\r\n\r\n // Set marker refX and refY\r\n ref (x, y) {\r\n return this.attr('refX', x).attr('refY', y)\r\n }\r\n\r\n // Update marker\r\n update (block) {\r\n // remove all content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') { block.call(this, this) }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n toString () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n}\r\n\r\nMarker.constructors = {\r\n Container: {\r\n marker (width, height, block) {\r\n // Create marker element in defs\r\n return this.defs().marker(width, height, block)\r\n }\r\n },\r\n Defs: {\r\n // Create marker\r\n marker (width, height, block) {\r\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\r\n return this.put(new Marker())\r\n .size(width, height)\r\n .ref(width / 2, height / 2)\r\n .viewbox(0, 0, width, height)\r\n .attr('orient', 'auto')\r\n .update(block)\r\n }\r\n },\r\n marker: {\r\n // Create and attach markers\r\n marker (marker, width, height, block) {\r\n var attr = ['marker']\r\n\r\n // Build attribute name\r\n if (marker !== 'all') attr.push(marker)\r\n attr = attr.join('-')\r\n\r\n // Set marker attribute\r\n marker = arguments[1] instanceof Marker\r\n ? arguments[1]\r\n : this.defs().marker(width, height, block)\r\n\r\n return this.attr(attr, marker)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew} from './tools.js'\r\n// import find from './selector.js'\r\n// import {remove} from './Element.js'\r\n\r\nexport default class Mask extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('mask', node))\r\n }\r\n\r\n // // Unmask all masked elements and remove itself\r\n // remove () {\r\n // // unmask all targets\r\n // this.targets().forEach(function (el) {\r\n // el.unmask()\r\n // })\r\n //\r\n // // remove mask from parent\r\n // return remove.call(this)\r\n // }\r\n //\r\n // targets () {\r\n // return find('svg [mask*=\"' + this.id() + '\"]')\r\n // }\r\n\r\n}\r\n\r\n\r\nMask.constructors = {\r\n Container: {\r\n mask () {\r\n return this.defs().put(new Mask())\r\n }\r\n },\r\n Element: {\r\n // Distribute mask to svg element\r\n maskWith (element) {\r\n // use given mask or create a new one\r\n var masker = element instanceof Mask\r\n ? element\r\n : this.parent().mask().add(element)\r\n\r\n // apply mask\r\n return this.attr('mask', 'url(\"#' + masker.id() + '\")')\r\n },\r\n\r\n // Unmask element\r\n unmask () {\r\n return this.attr('mask', null)\r\n },\r\n\r\n masker () {\r\n return this.reference('mask')\r\n }\r\n }\r\n}\r\n","import Doc from './Doc.js'\r\n\r\nexport default function parser () {\r\n\r\n // Reuse cached element if possible\r\n if (!parser.nodes) {\r\n let svg = new Doc().size(2, 0).css({\r\n opacity: 0,\r\n position: 'absolute',\r\n left: '-100%',\r\n top: '-100%',\r\n overflow: 'hidden'\r\n })\r\n\r\n let path = svg.path().node\r\n\r\n parser.nodes = {svg, path}\r\n }\r\n\r\n if (!parser.nodes.svg.node.parentNode) {\r\n let b = document.body || document.documentElement\r\n parser.nodes.svg.addTo(b)\r\n }\r\n\r\n return parser.nodes\r\n}\r\n","import parser from './parser.js'\r\n\r\nexport default class Point {\r\n // Initialize\r\n constructor (x, y, base) {\r\n let source\r\n base = base || {x: 0, y: 0}\r\n\r\n // ensure source as object\r\n source = Array.isArray(x) ? {x: x[0], y: x[1]}\r\n : typeof x === 'object' ? {x: x.x, y: x.y}\r\n : {x: x, y: y}\r\n\r\n // merge source\r\n this.x = source.x == null ? base.x : source.x\r\n this.y = source.y == null ? base.y : source.y\r\n }\r\n\r\n // Clone point\r\n clone () {\r\n return new Point(this)\r\n }\r\n\r\n // Convert to native SVGPoint\r\n native () {\r\n // create new point\r\n var point = parser().svg.createSVGPoint()\r\n\r\n // update with current values\r\n point.x = this.x\r\n point.y = this.y\r\n return point\r\n }\r\n\r\n // transform point with matrix\r\n transform (m) {\r\n // Perform the matrix multiplication\r\n var x = m.a * this.x + m.c * this.y + m.e\r\n var y = m.b * this.x + m.d * this.y + m.f\r\n\r\n // Return the required point\r\n return new Point(x, y)\r\n }\r\n}\r\n\r\nPoint.constructors = {\r\n Element: {\r\n // Get point\r\n point: function (x, y) {\r\n return new Point(x, y).transform(this.screenCTM().inverse())\r\n }\r\n }\r\n}\r\n","import {arrayToString, pathRegReplace} from './helpers.js'\r\nimport parser from './parser.js'\r\nimport {numbersWithDots, pathLetters, hyphen, delimiter, isPathLetter} from './regex.js'\r\nimport Point from './Point.js'\r\nimport SVGArray from './SVGArray.js'\r\n\r\nlet pathHandlers = {\r\n M: function (c, p, p0) {\r\n p.x = p0.x = c[0]\r\n p.y = p0.y = c[1]\r\n\r\n return ['M', p.x, p.y]\r\n },\r\n L: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['L', c[0], c[1]]\r\n },\r\n H: function (c, p) {\r\n p.x = c[0]\r\n return ['H', c[0]]\r\n },\r\n V: function (c, p) {\r\n p.y = c[0]\r\n return ['V', c[0]]\r\n },\r\n C: function (c, p) {\r\n p.x = c[4]\r\n p.y = c[5]\r\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\r\n },\r\n S: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['S', c[0], c[1], c[2], c[3]]\r\n },\r\n Q: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['Q', c[0], c[1], c[2], c[3]]\r\n },\r\n T: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['T', c[0], c[1]]\r\n },\r\n Z: function (c, p, p0) {\r\n p.x = p0.x\r\n p.y = p0.y\r\n return ['Z']\r\n },\r\n A: function (c, p) {\r\n p.x = c[5]\r\n p.y = c[6]\r\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\r\n }\r\n}\r\n\r\nlet mlhvqtcsaz = 'mlhvqtcsaz'.split('')\r\n\r\nfor (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\r\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\r\n return function (c, p, p0) {\r\n if (i === 'H') c[0] = c[0] + p.x\r\n else if (i === 'V') c[0] = c[0] + p.y\r\n else if (i === 'A') {\r\n c[5] = c[5] + p.x\r\n c[6] = c[6] + p.y\r\n } else {\r\n for (var j = 0, jl = c.length; j < jl; ++j) {\r\n c[j] = c[j] + (j % 2 ? p.y : p.x)\r\n }\r\n }\r\n\r\n return pathHandlers[i](c, p, p0)\r\n }\r\n })(mlhvqtcsaz[i].toUpperCase())\r\n}\r\n\r\nexport default class PathArray extends SVGArray {\r\n constructor (array, fallback = [['M', 0, 0]]) {\r\n super(array, fallback)\r\n }\r\n\r\n // Convert array to string\r\n toString () {\r\n return arrayToString(this)\r\n }\r\n\r\n toArray () {\r\n return this.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // Move path string\r\n move (x, y) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n if (!isNaN(x) && !isNaN(y)) {\r\n // move every point\r\n for (var l, i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n } else if (l === 'H') {\r\n this[i][1] += x\r\n } else if (l === 'V') {\r\n this[i][1] += y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n this[i][3] += x\r\n this[i][4] += y\r\n\r\n if (l === 'C') {\r\n this[i][5] += x\r\n this[i][6] += y\r\n }\r\n } else if (l === 'A') {\r\n this[i][6] += x\r\n this[i][7] += y\r\n }\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Resize path string\r\n size (width, height) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n var i, l\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n } else if (l === 'H') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n } else if (l === 'V') {\r\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\r\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\r\n\r\n if (l === 'C') {\r\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\r\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\r\n }\r\n } else if (l === 'A') {\r\n // resize radii\r\n this[i][1] = (this[i][1] * width) / box.width\r\n this[i][2] = (this[i][2] * height) / box.height\r\n\r\n // move position values\r\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\r\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Test if the passed path array use the same path data commands as this path array\r\n equalCommands (pathArray) {\r\n var i, il, equalCommands\r\n\r\n pathArray = new PathArray(pathArray)\r\n\r\n equalCommands = this.length === pathArray.value.length\r\n for (i = 0, il = this.length; equalCommands && i < il; i++) {\r\n equalCommands = this[i][0] === pathArray.value[i][0]\r\n }\r\n\r\n return equalCommands\r\n }\r\n\r\n // Make path array morphable\r\n morph (pathArray) {\r\n pathArray = new PathArray(pathArray)\r\n\r\n if (this.equalCommands(pathArray)) {\r\n this.destination = pathArray\r\n } else {\r\n this.destination = null\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Get morphed path array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n var sourceArray = this\r\n var destinationArray = this.destination.value\r\n var array = []\r\n var pathArray = new PathArray()\r\n var i, il, j, jl\r\n\r\n // Animate has specified in the SVG spec\r\n // See: https://www.w3.org/TR/SVG11/paths.html#PathElement\r\n for (i = 0, il = sourceArray.length; i < il; i++) {\r\n array[i] = [sourceArray[i][0]]\r\n for (j = 1, jl = sourceArray[i].length; j < jl; j++) {\r\n array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos\r\n }\r\n // For the two flags of the elliptical arc command, the SVG spec say:\r\n // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true\r\n // Elliptical arc command as an array followed by corresponding indexes:\r\n // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]\r\n // 0 1 2 3 4 5 6 7\r\n if (array[i][0] === 'A') {\r\n array[i][4] = +(array[i][4] !== 0)\r\n array[i][5] = +(array[i][5] !== 0)\r\n }\r\n }\r\n\r\n // Directly modify the value of a path array, this is done this way for performance\r\n pathArray.value = array\r\n return pathArray\r\n }\r\n\r\n // Absolutize and parse path to array\r\n parse (array) {\r\n // if it's already a patharray, no need to parse it\r\n if (array instanceof PathArray) return array.valueOf()\r\n\r\n // prepare for parsing\r\n var s\r\n var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }\r\n\r\n if (typeof array === 'string') {\r\n array = array\r\n .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123\r\n .replace(pathLetters, ' $& ') // put some room between letters and numbers\r\n .replace(hyphen, '$1 -') // add space before hyphen\r\n .trim() // trim\r\n .split(delimiter) // split into array\r\n } else {\r\n array = array.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]\r\n var result = []\r\n var p = new Point()\r\n var p0 = new Point()\r\n var index = 0\r\n var len = array.length\r\n\r\n do {\r\n // Test if we have a path letter\r\n if (isPathLetter.test(array[index])) {\r\n s = array[index]\r\n ++index\r\n // If last letter was a move command and we got no new, it defaults to [L]ine\r\n } else if (s === 'M') {\r\n s = 'L'\r\n } else if (s === 'm') {\r\n s = 'l'\r\n }\r\n\r\n result.push(pathHandlers[s].call(null,\r\n array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),\r\n p, p0\r\n )\r\n )\r\n } while (len > index)\r\n\r\n return result\r\n }\r\n\r\n // Get bounding box of path\r\n bbox () {\r\n parser().path.setAttribute('d', this.toString())\r\n return parser.nodes.path.getBBox()\r\n }\r\n}\r\n","import {proportionalSize} from './helpers.js'\r\nimport {nodeOrNew} from './tools.js'\r\nimport Base from './Base.js'\r\nimport PathArray from './PathArray.js'\r\n\r\nexport default class Path extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('path', node), Path)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return this._array || (this._array = new PathArray(this.attr('d')))\r\n }\r\n\r\n // Plot new path\r\n plot (d) {\r\n return (d == null) ? this.array()\r\n : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))\r\n }\r\n\r\n // Clear array cache\r\n clear () {\r\n delete this._array\r\n return this\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr('d', this.array().move(x, y))\r\n }\r\n\r\n // Move by left top corner over x-axis\r\n x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n }\r\n\r\n // Move by left top corner over y-axis\r\n y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr('d', this.array().size(p.width, p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return width == null ? this.bbox().width : this.size(width, this.bbox().height)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return height == null ? this.bbox().height : this.size(this.bbox().width, height)\r\n }\r\n}\r\n\r\n// Define morphable array\r\nPath.prototype.MorphArray = PathArray\r\n\r\n// Add parent method\r\nPath.constructors = {\r\n Container: {\r\n // Create a wrapped path element\r\n path (d) {\r\n // make sure plot is called as a setter\r\n return this.put(new Path()).plot(d || new PathArray())\r\n }\r\n }\r\n}\r\n","import PointArray from './PointArray.js'\r\n\r\nexport let MorphArray = PointArray\r\n\r\n// Move by left top corner over x-axis\r\nexport function x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n}\r\n\r\n// Move by left top corner over y-axis\r\nexport function y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n let b = this.bbox()\r\n return width == null ? b.width : this.size(width, b.height)\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n let b = this.bbox()\r\n return height == null ? b.height : this.size(b.width, height)\r\n}\r\n","// Add polygon-specific functions\r\n\r\n// Get array\r\nexport function array () {\r\n return this._array || (this._array = new PointArray(this.attr('points')))\r\n}\r\n\r\n// Plot new path\r\nexport function plot (p) {\r\n return (p == null) ? this.array()\r\n : this.clear().attr('points', typeof p === 'string' ? p\r\n : (this._array = new PointArray(p)))\r\n}\r\n\r\n// Clear array cache\r\nexport function clear () {\r\n delete this._array\r\n return this\r\n}\r\n\r\n// Move by left top corner\r\nexport function move (x, y) {\r\n return this.attr('points', this.array().move(x, y))\r\n}\r\n\r\n// Set element size to given width and height\r\nexport function size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n return this.attr('points', this.array().size(p.width, p.height))\r\n}\r\n","import {proportionalSize} from './helpers.js'\r\nimport Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\nimport * as pointed from './pointed.js'\r\nimport * as poly from './poly.js'\r\nimport PointArray from './PointArray.js'\r\n\r\nexport default class Polygon extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polygon', node), Polygon)\r\n }\r\n}\r\n\r\nPolygon.constructors = {\r\n Parent: {\r\n // Create a wrapped polygon element\r\n polygon (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polygon()).plot(p || new PointArray())\r\n }\r\n }\r\n}\r\n\r\nextend(Polygon, pointed)\r\nextend(Polygon, poly)\r\n","import Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\nimport PointArray from './PointArray.js'\r\nimport * as pointed from './pointed.js'\r\nimport * as poly from './poly.js'\r\n\r\nexport default class Polyline extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polyline', node), Polyline)\r\n }\r\n}\r\n\r\nPolyline.constructors = {\r\n Parent: {\r\n // Create a wrapped polygon element\r\n polyline (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polyline()).plot(p || new PointArray())\r\n }\r\n }\r\n}\r\n\r\nextend(Polyline, pointed)\r\nextend(Polyline, poly)\r\n","import Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\n\r\nexport default class Rect extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('rect', node), Rect)\r\n }\r\n}\r\n\r\nRect.constructors = {\r\n Container: {\r\n // Create a rect element\r\n rect (width, height) {\r\n return this.put(new Rect()).size(width, height)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport {nodeOrNew} from './tools.js'\r\n\r\nexport default class Symbol extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('symbol', node), Symbol)\r\n }\r\n}\r\n\r\nSymbol.constructors = {\r\n Container: {\r\n symbol () {\r\n return this.put(new Symbol())\r\n }\r\n }\r\n}\r\n","\r\nexport function noop () {}\r\n\r\n// Default animation values\r\nexport let timeline = {\r\n duration: 400,\r\n ease: '>',\r\n delay: 0\r\n}\r\n\r\n// Default attribute values\r\nexport let attrs = {\r\n\r\n // fill and stroke\r\n 'fill-opacity': 1,\r\n 'stroke-opacity': 1,\r\n 'stroke-width': 0,\r\n 'stroke-linejoin': 'miter',\r\n 'stroke-linecap': 'butt',\r\n fill: '#000000',\r\n stroke: '#000000',\r\n opacity: 1,\r\n\r\n // position\r\n x: 0,\r\n y: 0,\r\n cx: 0,\r\n cy: 0,\r\n\r\n // size\r\n width: 0,\r\n height: 0,\r\n\r\n // radius\r\n r: 0,\r\n rx: 0,\r\n ry: 0,\r\n\r\n // gradient\r\n offset: 0,\r\n 'stop-opacity': 1,\r\n 'stop-color': '#000000',\r\n\r\n // text\r\n 'font-size': 16,\r\n 'font-family': 'Helvetica, Arial, sans-serif',\r\n 'text-anchor': 'start'\r\n}\r\n","// Create plain text node\r\nexport function plain (text) {\r\n // clear if build mode is disabled\r\n if (this._build === false) {\r\n this.clear()\r\n }\r\n\r\n // create text node\r\n this.node.appendChild(document.createTextNode(text))\r\n\r\n return this\r\n}\r\n\r\n// FIXME: Does this also work for textpath?\r\n// Get length of text element\r\nexport function length () {\r\n return this.node.getComputedTextLength()\r\n}\r\n","import Base from './Base.js'\r\nimport SVGNumber from './SVGNumber.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\nimport {attrs} from './defaults.js'\r\nimport * as textable from './textable.js'\r\n\r\nexport default class Text extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('text', node), Text)\r\n\r\n this.dom.leading = new SVGNumber(1.3) // store leading value for rebuilding\r\n this._rebuild = true // enable automatic updating of dy values\r\n this._build = false // disable build mode for adding multiple lines\r\n\r\n // set default font\r\n this.attr('font-family', attrs['font-family'])\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n // act as getter\r\n if (x == null) {\r\n return this.attr('x')\r\n }\r\n\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n var oy = this.attr('y')\r\n var o = typeof oy === 'number' ? oy - this.bbox().y : 0\r\n\r\n // act as getter\r\n if (y == null) {\r\n return typeof oy === 'number' ? oy - o : oy\r\n }\r\n\r\n return this.attr('y', typeof y === 'number' ? y + o : y)\r\n }\r\n\r\n // Move center over x-axis\r\n cx (x) {\r\n return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)\r\n }\r\n\r\n // Move center over y-axis\r\n cy (y) {\r\n return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)\r\n }\r\n\r\n // Set the text content\r\n text (text) {\r\n // act as getter\r\n if (text === undefined) {\r\n var children = this.node.childNodes\r\n var firstLine = 0\r\n text = ''\r\n\r\n for (var i = 0, len = children.length; i < len; ++i) {\r\n // skip textPaths - they are no lines\r\n if (children[i].nodeName === 'textPath') {\r\n if (i === 0) firstLine = 1\r\n continue\r\n }\r\n\r\n // add newline if its not the first child and newLined is set to true\r\n if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {\r\n text += '\\n'\r\n }\r\n\r\n // add content of this node\r\n text += children[i].textContent\r\n }\r\n\r\n return text\r\n }\r\n\r\n // remove existing content\r\n this.clear().build(true)\r\n\r\n if (typeof text === 'function') {\r\n // call block\r\n text.call(this, this)\r\n } else {\r\n // store text and make sure text is not blank\r\n text = text.split('\\n')\r\n\r\n // build new lines\r\n for (var j = 0, jl = text.length; j < jl; j++) {\r\n this.tspan(text[j]).newLine()\r\n }\r\n }\r\n\r\n // disable build mode and rebuild lines\r\n return this.build(false).rebuild()\r\n }\r\n\r\n // Set / get leading\r\n leading (value) {\r\n // act as getter\r\n if (value == null) {\r\n return this.dom.leading\r\n }\r\n\r\n // act as setter\r\n this.dom.leading = new SVGNumber(value)\r\n\r\n return this.rebuild()\r\n }\r\n\r\n // Rebuild appearance type\r\n rebuild (rebuild) {\r\n // store new rebuild flag if given\r\n if (typeof rebuild === 'boolean') {\r\n this._rebuild = rebuild\r\n }\r\n\r\n // define position of all lines\r\n if (this._rebuild) {\r\n var self = this\r\n var blankLineOffset = 0\r\n var dy = this.dom.leading * new SVGNumber(this.attr('font-size'))\r\n\r\n this.each(function () {\r\n if (this.dom.newLined) {\r\n this.attr('x', self.attr('x'))\r\n\r\n if (this.text() === '\\n') {\r\n blankLineOffset += dy\r\n } else {\r\n this.attr('dy', dy + blankLineOffset)\r\n blankLineOffset = 0\r\n }\r\n }\r\n })\r\n\r\n this.fire('rebuild')\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Enable / disable build mode\r\n build (build) {\r\n this._build = !!build\r\n return this\r\n }\r\n\r\n // overwrite method from parent to set data properly\r\n setData (o) {\r\n this.dom = o\r\n this.dom.leading = new SVGNumber(o.leading || 1.3)\r\n return this\r\n }\r\n}\r\n\r\nextend(Text, textable)\r\n\r\nText.constructors = {\r\n Container: {\r\n // Create text element\r\n text (text) {\r\n return this.put(new Text()).text(text)\r\n },\r\n\r\n // Create plain text element\r\n plain (text) {\r\n return this.put(new Text()).plain(text)\r\n }\r\n }\r\n}\r\n","import Path from './Path.js'\r\nimport Text from './Text.js'\r\nimport PathArray from './PathArray.js'\r\nimport {nodeOrNew} from './tools.js'\r\nimport {xlink} from './namespaces.js'\r\n\r\nexport default class TextPath extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('textPath', node))\r\n }\r\n\r\n // return the array of the path track element\r\n array () {\r\n var track = this.track()\r\n\r\n return track ? track.array() : null\r\n }\r\n\r\n // Plot path if any\r\n plot (d) {\r\n var track = this.track()\r\n var pathArray = null\r\n\r\n if (track) {\r\n pathArray = track.plot(d)\r\n }\r\n\r\n return (d == null) ? pathArray : this\r\n }\r\n\r\n // Get the path element\r\n track () {\r\n return this.reference('href')\r\n }\r\n}\r\n\r\nTextPath.constructors = {\r\n Container: {\r\n textPath (text, path) {\r\n return this.defs().path(path).text(text).addTo(this)\r\n }\r\n },\r\n Text: {\r\n // Create path for text to run on\r\n path: function (track) {\r\n var path = new TextPath()\r\n\r\n // if d is a path, reuse it\r\n if (!(track instanceof Path)) {\r\n // create path element\r\n track = this.doc().defs().path(track)\r\n }\r\n\r\n // link textPath to path and add content\r\n path.attr('href', '#' + track, xlink)\r\n\r\n // add textPath element as child node and return textPath\r\n return this.put(path)\r\n },\r\n\r\n // FIXME: make this plural?\r\n // Get the textPath children\r\n textPath: function () {\r\n return this.select('textPath')\r\n }\r\n },\r\n Path: {\r\n // creates a textPath from this path\r\n text: function (text) {\r\n if (text instanceof Text) {\r\n var txt = text.text()\r\n return text.clear().path(this).text(txt)\r\n }\r\n return this.parent().put(new Text()).path(this).text(text)\r\n }\r\n // FIXME: Maybe add `targets` to get all textPaths associated with this path\r\n }\r\n}\r\n\r\nTextPath.prototype.MorphArray = PathArray\r\n","import Base from './Base.js'\r\nimport {xlink} from './namespaces.js'\r\n\r\nexport default class Use extends Base {\r\n constructor (node) {\r\n super(nodeOrNew('use', node), Use)\r\n }\r\n\r\n // Use element as a reference\r\n element (element, file) {\r\n // Set lined element\r\n return this.attr('href', (file || '') + '#' + element, xlink)\r\n }\r\n}\r\n\r\nUse.constructors = {\r\n Container: {\r\n // Create a use element\r\n use: function (element, file) {\r\n return this.put(new Use()).element(element, file)\r\n }\r\n }\r\n}\r\n","import Base from './Base.js'\r\nimport * as elements from './elements.js'\r\nimport {capitalize} from './helpers.js'\r\n\r\nexport function makeInstance (element) {\r\n if (element instanceof Base) return element\r\n\r\n if (typeof element === 'object') {\r\n return adopt(element)\r\n }\r\n\r\n if (element == null) {\r\n return new Doc()\r\n }\r\n\r\n if (typeof element === 'string' && element.charAt(0) !== '<') {\r\n return adopt(document.querySelector(element))\r\n }\r\n\r\n var node = makeNode('svg')\r\n node.innerHTML = element\r\n\r\n element = adopt(node.firstElementChild)\r\n\r\n return element\r\n}\r\n\r\n// Adopt existing svg elements\r\nexport function adopt (node) {\r\n // check for presence of node\r\n if (!node) return null\r\n\r\n // make sure a node isn't already adopted\r\n if (node.instance instanceof Element) return node.instance\r\n\r\n if (!(node instanceof window.SVGElement)) {\r\n return new elements.HtmlNode(node)\r\n }\r\n\r\n // initialize variables\r\n var element\r\n\r\n // adopt with element-specific settings\r\n if (node.nodeName === 'svg') {\r\n element = new elements.Doc(node)\r\n } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') {\r\n element = new elements.Gradient(node)\r\n } else if (elements[capitalize(node.nodeName)]) {\r\n element = new elements[capitalize(node.nodeName)](node)\r\n } else {\r\n element = new elements.Bare(node)\r\n }\r\n\r\n return element\r\n}\r\n\r\n// Element id sequence\r\nlet did = 1000\r\n\r\n// Get next named element id\r\nexport function eid (name) {\r\n return 'Svgjs' + capitalize(name) + (did++)\r\n}\r\n\r\n// Deep new id assignment\r\nexport function assignNewId (node) {\r\n // do the same for SVG child nodes as well\r\n for (var i = node.children.length - 1; i >= 0; i--) {\r\n assignNewId(node.children[i])\r\n }\r\n\r\n if (node.id) {\r\n return adopt(node).id(eid(node.nodeName))\r\n }\r\n\r\n return adopt(node)\r\n}\r\n","export default class Queue {\r\n constructor () {\r\n this._first = null\r\n this._last = null\r\n }\r\n\r\n push (value) {\r\n // An item stores an id and the provided value\r\n var item = value.next ? value : { value: value, next: null, prev: null }\r\n\r\n // Deal with the queue being empty or populated\r\n if (this._last) {\r\n item.prev = this._last\r\n this._last.next = item\r\n this._last = item\r\n } else {\r\n this._last = item\r\n this._first = item\r\n }\r\n\r\n // Update the length and return the current item\r\n return item\r\n }\r\n\r\n shift () {\r\n // Check if we have a value\r\n var remove = this._first\r\n if (!remove) return null\r\n\r\n // If we do, remove it and relink things\r\n this._first = remove.next\r\n if (this._first) this._first.prev = null\r\n this._last = this._first ? this._last : null\r\n return remove.value\r\n }\r\n\r\n // Shows us the first item in the list\r\n first () {\r\n return this._first && this._first.value\r\n }\r\n\r\n // Shows us the last item in the list\r\n last () {\r\n return this._last && this._last.value\r\n }\r\n\r\n // Removes the item that was returned from the push\r\n remove (item) {\r\n // Relink the previous item\r\n if (item.prev) item.prev.next = item.next\r\n if (item.next) item.next.prev = item.prev\r\n if (item === this._last) this._last = item.prev\r\n if (item === this._first) this._first = item.next\r\n\r\n // Invalidate item\r\n item.prev = null\r\n item.next = null\r\n }\r\n}\r\n","import Queue from './Queue.js'\n\nconst Animator = {\n nextDraw: null,\n frames: new Queue(),\n timeouts: new Queue(),\n timer: window.performance || window.Date,\n transforms: [],\n\n frame (fn) {\n // Store the node\n var node = Animator.frames.push({ run: fn })\n\n // Request an animation frame if we don't have one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = window.requestAnimationFrame(Animator._draw)\n }\n\n // Return the node so we can remove it easily\n return node\n },\n\n transform_frame (fn, id) {\n Animator.transforms[id] = fn\n },\n\n timeout (fn, delay) {\n delay = delay || 0\n\n // Work out when the event should fire\n var time = Animator.timer.now() + delay\n\n // Add the timeout to the end of the queue\n var node = Animator.timeouts.push({ run: fn, time: time })\n\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n cancelFrame (node) {\n Animator.frames.remove(node)\n },\n\n clearTimeout (node) {\n Animator.timeouts.remove(node)\n },\n\n _draw (now) {\n // Run all the timeouts we can run, if they are not ready yet, add them\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\n var nextTimeout = null\r\n var lastTimeout = Animator.timeouts.last()\n while ((nextTimeout = Animator.timeouts.shift())) {\n // Run the timeout if its time, or push it to the end\n if (now >= nextTimeout.time) {\n nextTimeout.run()\n } else {\n Animator.timeouts.push(nextTimeout)\n }\n\n // If we hit the last item, we should stop shifting out more items\n if (nextTimeout === lastTimeout) break\n }\n\n // Run all of the animation frames\n var nextFrame = null\n var lastFrame = Animator.frames.last()\n while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) {\n nextFrame.run()\n }\n\n Animator.transforms.forEach(function (el) { el() })\n\n // If we have remaining timeouts or frames, draw until we don't anymore\n Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first()\n ? window.requestAnimationFrame(Animator._draw)\n : null\n }\n}\n\nexport default Animator\n","import Base from './Base.js'\r\nimport {nodeOrNew, extend} from './tools.js'\r\nimport * as textable from './textable.js'\r\n\r\nexport default class Tspan extends Base {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('tspan', node), Tspan)\r\n }\r\n\r\n // Set text content\r\n text (text) {\r\n if (text == null) return this.node.textContent + (this.dom.newLined ? '\\n' : '')\r\n\r\n typeof text === 'function' ? text.call(this, this) : this.plain(text)\r\n\r\n return this\r\n }\r\n\r\n // Shortcut dx\r\n dx (dx) {\r\n return this.attr('dx', dx)\r\n }\r\n\r\n // Shortcut dy\r\n dy (dy) {\r\n return this.attr('dy', dy)\r\n }\r\n\r\n // Create new line\r\n newLine () {\r\n // fetch text parent\r\n var t = this.parent(Text)\r\n\r\n // mark new line\r\n this.dom.newLined = true\r\n\r\n // apply new position\r\n return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())\r\n }\r\n}\r\n\r\nextend(Tspan, textable)\r\n\r\nTspan.constructors = {\r\n Tspan: {\r\n tspan (text) {\r\n var tspan = new Tspan()\r\n\r\n // clear if build mode is disabled\r\n if (!this._build) {\r\n this.clear()\r\n }\r\n\r\n // add new tspan\r\n this.node.appendChild(tspan.node)\r\n\r\n return tspan.text(text)\r\n }\r\n }\r\n}\r\n","\r\n// Map function\r\nexport function map (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n result.push(block(array[i]))\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Filter function\r\nexport function filter (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n if (block(array[i])) { result.push(array[i]) }\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Degrees to radians\r\nexport function radians (d) {\r\n return d % 360 * Math.PI / 180\r\n}\r\n\r\n// Radians to degrees\r\nexport function degrees (r) {\r\n return r * 180 / Math.PI % 360\r\n}\r\n\r\nexport function filterSVGElements (nodes) {\r\n return this.filter(nodes, function (el) { return el instanceof window.SVGElement })\r\n}\r\n","import {abcdef, arrayToMatrix, closeEnough, isMatrixLike} from './helpers.js'\r\nimport Point from './Point.js'\r\nimport {delimiter} from './regex.js'\r\nimport {radians} from './utils.js'\r\nimport parser from './parser.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class Matrix {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n // Initialize\r\n init (source) {\r\n var base = arrayToMatrix([1, 0, 0, 1, 0, 0])\r\n\r\n // ensure source as object\r\n source = source instanceof Base && source.is('Element') ? source.matrixify()\r\n : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat))\r\n : Array.isArray(source) ? arrayToMatrix(source)\r\n : (typeof source === 'object' && isMatrixLike(source)) ? source\r\n : (typeof source === 'object') ? new Matrix().transform(source)\r\n : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments))\r\n : base\r\n\r\n // Merge the source matrix with the base matrix\r\n this.a = source.a != null ? source.a : base.a\r\n this.b = source.b != null ? source.b : base.b\r\n this.c = source.c != null ? source.c : base.c\r\n this.d = source.d != null ? source.d : base.d\r\n this.e = source.e != null ? source.e : base.e\r\n this.f = source.f != null ? source.f : base.f\r\n }\r\n\r\n\r\n // Clones this matrix\r\n clone () {\r\n return new Matrix(this)\r\n }\r\n\r\n // Transform a matrix into another matrix by manipulating the space\r\n transform (o) {\r\n // Check if o is a matrix and then left multiply it directly\r\n if (isMatrixLike(o)) {\r\n var matrix = new Matrix(o)\r\n return matrix.multiplyO(this)\r\n }\r\n\r\n // Get the proposed transformations and the current transformations\r\n var t = Matrix.formatTransforms(o)\r\n var current = this\r\n let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\r\n\r\n // Construct the resulting matrix\r\n var transformer = new Matrix()\r\n .translateO(t.rx, t.ry)\r\n .lmultiplyO(current)\r\n .translateO(-ox, -oy)\r\n .scaleO(t.scaleX, t.scaleY)\r\n .skewO(t.skewX, t.skewY)\r\n .shearO(t.shear)\r\n .rotateO(t.theta)\r\n .translateO(ox, oy)\r\n\r\n // If we want the origin at a particular place, we force it there\r\n if (isFinite(t.px) || isFinite(t.py)) {\r\n const origin = new Point(ox, oy).transform(transformer)\r\n // TODO: Replace t.px with isFinite(t.px)\r\n const dx = t.px ? t.px - origin.x : 0\r\n const dy = t.py ? t.py - origin.y : 0\r\n transformer.translateO(dx, dy)\r\n }\r\n\r\n // Translate now after positioning\r\n transformer.translateO(t.tx, t.ty)\r\n return transformer\r\n }\r\n\r\n // Applies a matrix defined by its affine parameters\r\n compose (o) {\r\n if (o.origin) {\r\n o.originX = o.origin[0]\r\n o.originY = o.origin[1]\r\n }\r\n // Get the parameters\r\n var ox = o.originX || 0\r\n var oy = o.originY || 0\r\n var sx = o.scaleX || 1\r\n var sy = o.scaleY || 1\r\n var lam = o.shear || 0\r\n var theta = o.rotate || 0\r\n var tx = o.translateX || 0\r\n var ty = o.translateY || 0\r\n\r\n // Apply the standard matrix\r\n var result = new Matrix()\r\n .translateO(-ox, -oy)\r\n .scaleO(sx, sy)\r\n .shearO(lam)\r\n .rotateO(theta)\r\n .translateO(tx, ty)\r\n .lmultiplyO(this)\r\n .translateO(ox, oy)\r\n return result\r\n }\r\n\r\n // Decomposes this matrix into its affine parameters\r\n decompose (cx = 0, cy = 0) {\r\n // Get the parameters from the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Figure out if the winding direction is clockwise or counterclockwise\r\n var determinant = a * d - b * c\r\n var ccw = determinant > 0 ? 1 : -1\r\n\r\n // Since we only shear in x, we can use the x basis to get the x scale\r\n // and the rotation of the resulting matrix\r\n var sx = ccw * Math.sqrt(a * a + b * b)\r\n var thetaRad = Math.atan2(ccw * b, ccw * a)\r\n var theta = 180 / Math.PI * thetaRad\r\n var ct = Math.cos(thetaRad)\r\n var st = Math.sin(thetaRad)\r\n\r\n // We can then solve the y basis vector simultaneously to get the other\r\n // two affine parameters directly from these parameters\r\n var lam = (a * c + b * d) / determinant\r\n var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a))\r\n\r\n // Use the translations\r\n let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\r\n let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\r\n\r\n // Construct the decomposition and return it\r\n return {\r\n // Return the affine parameters\r\n scaleX: sx,\r\n scaleY: sy,\r\n shear: lam,\r\n rotate: theta,\r\n translateX: tx,\r\n translateY: ty,\r\n originX: cx,\r\n originY: cy,\r\n\r\n // Return the matrix parameters\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n // Left multiplies by the given matrix\r\n multiply (matrix) {\r\n return this.clone().multiplyO(matrix)\r\n }\r\n\r\n multiplyO (matrix) {\r\n // Get the matrices\r\n var l = this\r\n var r = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n lmultiply (matrix) {\r\n return this.clone().lmultiplyO(matrix)\r\n }\r\n\r\n lmultiplyO (matrix) {\r\n var r = this\r\n var l = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n // Inverses matrix\r\n inverseO () {\r\n // Get the current parameters out of the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Invert the 2x2 matrix in the top left\r\n var det = a * d - b * c\r\n if (!det) throw new Error('Cannot invert ' + this)\r\n\r\n // Calculate the top 2x2 matrix\r\n var na = d / det\r\n var nb = -b / det\r\n var nc = -c / det\r\n var nd = a / det\r\n\r\n // Apply the inverted matrix to the top right\r\n var ne = -(na * e + nc * f)\r\n var nf = -(nb * e + nd * f)\r\n\r\n // Construct the inverted matrix\r\n this.a = na\r\n this.b = nb\r\n this.c = nc\r\n this.d = nd\r\n this.e = ne\r\n this.f = nf\r\n\r\n return this\r\n }\r\n\r\n inverse () {\r\n return this.clone().inverseO()\r\n }\r\n\r\n // Translate matrix\r\n translate (x, y) {\r\n return this.clone().translateO(x, y)\r\n }\r\n\r\n translateO (x, y) {\r\n this.e += x || 0\r\n this.f += y || 0\r\n return this\r\n }\r\n\r\n // Scale matrix\r\n scale (x, y, cx, cy) {\r\n return this.clone().scaleO(...arguments)\r\n }\r\n\r\n scaleO (x, y = x, cx = 0, cy = 0) {\r\n // Support uniform scaling\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n let {a, b, c, d, e, f} = this\r\n\r\n this.a = a * x\r\n this.b = b * y\r\n this.c = c * x\r\n this.d = d * y\r\n this.e = e * x - cx * x + cx\r\n this.f = f * y - cy * y + cy\r\n\r\n return this\r\n }\r\n\r\n // Rotate matrix\r\n rotate (r, cx, cy) {\r\n return this.clone().rotateO(r, cx, cy)\r\n }\r\n\r\n rotateO (r, cx = 0, cy = 0) {\r\n // Convert degrees to radians\r\n r = radians(r)\r\n\r\n let cos = Math.cos(r)\r\n let sin = Math.sin(r)\r\n\r\n let {a, b, c, d, e, f} = this\r\n\r\n this.a = a * cos - b * sin\r\n this.b = b * cos + a * sin\r\n this.c = c * cos - d * sin\r\n this.d = d * cos + c * sin\r\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\r\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\r\n\r\n return this\r\n }\r\n\r\n // Flip matrix on x or y, at a given offset\r\n flip (axis, around) {\r\n return this.clone().flipO(axis, around)\r\n }\r\n\r\n flipO (axis, around) {\r\n return axis === 'x' ? this.scaleO(-1, 1, around, 0)\r\n : axis === 'y' ? this.scaleO(1, -1, 0, around)\r\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\r\n }\r\n\r\n // Shear matrix\r\n shear (a, cx, cy) {\r\n return this.clone().shearO(a, cx, cy)\r\n }\r\n\r\n shearO (lx, cx = 0, cy = 0) {\r\n let {a, b, c, d, e, f} = this\r\n\r\n this.a = a + b * lx\r\n this.c = c + d * lx\r\n this.e = e + f * lx - cy * lx\r\n\r\n return this\r\n }\r\n\r\n // Skew Matrix\r\n skew (x, y, cx, cy) {\r\n return this.clone().skewO(...arguments)\r\n }\r\n\r\n skewO (x, y = x, cx = 0, cy = 0) {\r\n // support uniformal skew\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n // Convert degrees to radians\r\n x = radians(x)\r\n y = radians(y)\r\n\r\n let lx = Math.tan(x)\r\n let ly = Math.tan(y)\r\n\r\n let {a, b, c, d, e, f} = this\r\n\r\n this.a = a + b * lx\r\n this.b = b + a * ly\r\n this.c = c + d * lx\r\n this.d = d + c * ly\r\n this.e = e + f * lx - cy * lx\r\n this.f = f + e * ly - cx * ly\r\n\r\n return this\r\n }\r\n\r\n // SkewX\r\n skewX (x, cx, cy) {\r\n return this.skew(x, 0, cx, cy)\r\n }\r\n\r\n skewXO (x, cx, cy) {\r\n return this.skewO(x, 0, cx, cy)\r\n }\r\n\r\n // SkewY\r\n skewY (y, cx, cy) {\r\n return this.skew(0, y, cx, cy)\r\n }\r\n\r\n skewYO (y, cx, cy) {\r\n return this.skewO(0, y, cx, cy)\r\n }\r\n\r\n // Transform around a center point\r\n aroundO (cx, cy, matrix) {\r\n var dx = cx || 0\r\n var dy = cy || 0\r\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\r\n }\r\n\r\n around (cx, cy, matrix) {\r\n return this.clone().aroundO(cx, cy, matrix)\r\n }\r\n\r\n // Convert to native SVGMatrix\r\n native () {\r\n // create new matrix\r\n var matrix = parser().node.createSVGMatrix()\r\n\r\n // update with current values\r\n for (var i = abcdef.length - 1; i >= 0; i--) {\r\n matrix[abcdef[i]] = this[abcdef[i]]\r\n }\r\n\r\n return matrix\r\n }\r\n\r\n // Check if two matrices are equal\r\n equals (other) {\r\n var comp = new Matrix(other)\r\n return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&\r\n closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&\r\n closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)\r\n }\r\n\r\n // Convert matrix to string\r\n toString () {\r\n return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'\r\n }\r\n\r\n toArray () {\r\n return [this.a, this.b, this.c, this.d, this.e, this.f]\r\n }\r\n\r\n valueOf () {\r\n return {\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n\r\n // TODO: Refactor this to a static function of matrix.js\r\n static formatTransforms (o) {\r\n // Get all of the parameters required to form the matrix\r\n var flipBoth = o.flip === 'both' || o.flip === true\r\n var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\r\n var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\r\n var skewX = o.skew && o.skew.length ? o.skew[0]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewX) ? o.skewX\r\n : 0\r\n var skewY = o.skew && o.skew.length ? o.skew[1]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewY) ? o.skewY\r\n : 0\r\n var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX\r\n : isFinite(o.scale) ? o.scale * flipX\r\n : isFinite(o.scaleX) ? o.scaleX * flipX\r\n : flipX\r\n var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY\r\n : isFinite(o.scale) ? o.scale * flipY\r\n : isFinite(o.scaleY) ? o.scaleY * flipY\r\n : flipY\r\n var shear = o.shear || 0\r\n var theta = o.rotate || o.theta || 0\r\n var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY)\r\n var ox = origin.x\r\n var oy = origin.y\r\n var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY)\r\n var px = position.x\r\n var py = position.y\r\n var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY)\r\n var tx = translate.x\r\n var ty = translate.y\r\n var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY)\r\n var rx = relative.x\r\n var ry = relative.y\r\n\r\n // Populate all of the values\r\n return {\r\n scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py\r\n }\r\n }\r\n\r\n // left matrix, right matrix, target matrix which is overwritten\r\n static matrixMultiply (l, r, o) {\r\n // Work out the product directly\r\n var a = l.a * r.a + l.c * r.b\r\n var b = l.b * r.a + l.d * r.b\r\n var c = l.a * r.c + l.c * r.d\r\n var d = l.b * r.c + l.d * r.d\r\n var e = l.e + l.a * r.e + l.c * r.f\r\n var f = l.f + l.b * r.e + l.d * r.f\r\n\r\n // make sure to use local variables because l/r and o could be the same\r\n o.a = a\r\n o.b = b\r\n o.c = c\r\n o.d = d\r\n o.e = e\r\n o.f = f\r\n\r\n return o\r\n }\r\n}\r\n\r\nMatrix.constructors = {\r\n Element: {\r\n // Get current matrix\r\n ctm () {\r\n return new Matrix(this.node.getCTM())\r\n },\r\n\r\n // Get current screen matrix\r\n screenCTM () {\r\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\r\n This is needed because FF does not return the transformation matrix\r\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\r\n However all other Browsers do that */\r\n if (this instanceof Doc && !this.isRoot()) {\r\n var rect = this.rect(1, 1)\r\n var m = rect.node.getScreenCTM()\r\n rect.remove()\r\n return new Matrix(m)\r\n }\r\n return new Matrix(this.node.getScreenCTM())\r\n }\r\n }\r\n}\r\n","//import {Parent, Doc, Symbol, Image, Pattern, Marker, Point} from './classes.js'\r\nimport Point from './Point.js'\r\nimport parser from './parser.js'\r\nimport {fullBox, domContains, isNulledBox} from './helpers.js'\r\nimport {extend} from './tools.js'\r\nimport {delimiter} from './regex.js'\r\n\r\nexport default class Box {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (source) {\r\n var base = [0, 0, 0, 0]\r\n source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)\r\n : Array.isArray(source) ? source\r\n : typeof source === 'object' ? [source.left != null ? source.left\r\n : source.x, source.top != null ? source.top : source.y, source.width, source.height]\r\n : arguments.length === 4 ? [].slice.call(arguments)\r\n : base\r\n\r\n this.x = source[0]\r\n this.y = source[1]\r\n this.width = source[2]\r\n this.height = source[3]\r\n\r\n // add center, right, bottom...\r\n fullBox(this)\r\n }\r\n\r\n // Merge rect box with another, return a new instance\r\n merge (box) {\r\n let x = Math.min(this.x, box.x)\r\n let y = Math.min(this.y, box.y)\r\n let width = Math.max(this.x + this.width, box.x + box.width) - x\r\n let height = Math.max(this.y + this.height, box.y + box.height) - y\r\n\r\n return new Box(x, y, width, height)\r\n }\r\n\r\n transform (m) {\r\n let xMin = Infinity\r\n let xMax = -Infinity\r\n let yMin = Infinity\r\n let yMax = -Infinity\r\n\r\n let pts = [\r\n new Point(this.x, this.y),\r\n new Point(this.x2, this.y),\r\n new Point(this.x, this.y2),\r\n new Point(this.x2, this.y2)\r\n ]\r\n\r\n pts.forEach(function (p) {\r\n p = p.transform(m)\r\n xMin = Math.min(xMin, p.x)\r\n xMax = Math.max(xMax, p.x)\r\n yMin = Math.min(yMin, p.y)\r\n yMax = Math.max(yMax, p.y)\r\n })\r\n\r\n return new Box(\r\n xMin, yMin,\r\n xMax - xMin,\r\n yMax - yMin\r\n )\r\n }\r\n\r\n addOffset () {\r\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\r\n this.x += window.pageXOffset\r\n this.y += window.pageYOffset\r\n return this\r\n }\r\n\r\n toString () {\r\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y, this.width, this.height]\r\n }\r\n}\r\n\r\nfunction getBox(cb) {\r\n let box\r\n\r\n try {\r\n box = cb(this.node)\r\n\r\n if (isNulledBox(box) && !domContains(this.node)) {\r\n throw new Error('Element not in the dom')\r\n }\r\n } catch (e) {\r\n try {\r\n let clone = this.clone(parser().svg).show()\r\n box = cb(clone.node)\r\n clone.remove()\r\n } catch (e) {\r\n throw (e)\r\n console.warn('Getting a bounding box of this element is not possible')\r\n }\r\n }\r\n return box\r\n}\r\n\r\nBox.constructors = {\r\n Element: {\r\n // Get bounding box\r\n bbox () {\r\n return new Box(getBox.call(this, (node) => node.getBBox()))\r\n },\r\n\r\n rbox (el) {\r\n let box = new Box(getBox.call(this, (node) => node.getBoundingClientRect()))\r\n if (el) return box.transform(el.screenCTM().inverse())\r\n return box.addOffset()\r\n }\r\n },\r\n viewbox: function (x, y, width, height) {\r\n // act as getter\r\n if (x == null) return new Box(this.attr('viewBox'))\r\n\r\n // act as setter\r\n return this.attr('viewBox', new Box(x, y, width, height))\r\n }\r\n}\r\n","/* globals fullHex, compToHex */\r\n\r\n/*\r\n\r\nColor {\r\n constructor (a, b, c, space) {\r\n space: 'hsl'\r\n a: 30\r\n b: 20\r\n c: 10\r\n },\r\n\r\n toRgb () { return new Color in rgb space }\r\n toHsl () { return new Color in hsl space }\r\n toLab () { return new Color in lab space }\r\n\r\n toArray () { [space, a, b, c] }\r\n fromArray () { convert it back }\r\n}\r\n\r\n// Conversions aren't always exact because of monitor profiles etc...\r\nnew Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()\r\nnew Color(100, 100, 100, [space])\r\nnew Color('hsl(30, 20, 10)')\r\n\r\n// Sugar\r\nSVG.rgb(30, 20, 50).lab()\r\nSVG.hsl()\r\nSVG.lab('rgb(100, 100, 100)')\r\n*/\r\n\r\nimport {isHex, isRgb, whitespace, rgb, hex} from './regex.js'\r\nimport {fullHex, compToHex} from './helpers.js'\r\n\r\nexport default class Color {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (color, g, b) {\r\n let match\r\n\r\n // initialize defaults\r\n this.r = 0\r\n this.g = 0\r\n this.b = 0\r\n\r\n if (!color) return\r\n\r\n // parse color\r\n if (typeof color === 'string') {\r\n if (isRgb.test(color)) {\r\n // get rgb values\r\n match = rgb.exec(color.replace(whitespace, ''))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1])\r\n this.g = parseInt(match[2])\r\n this.b = parseInt(match[3])\r\n } else if (isHex.test(color)) {\r\n // get hex values\r\n match = hex.exec(fullHex(color))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1], 16)\r\n this.g = parseInt(match[2], 16)\r\n this.b = parseInt(match[3], 16)\r\n }\r\n } else if (Array.isArray(color)) {\r\n this.r = color[0]\r\n this.g = color[1]\r\n this.b = color[2]\r\n } else if (typeof color === 'object') {\r\n this.r = color.r\r\n this.g = color.g\r\n this.b = color.b\r\n } else if (arguments.length === 3) {\r\n this.r = color\r\n this.g = g\r\n this.b = b\r\n }\r\n }\r\n\r\n // Default to hex conversion\r\n toString () {\r\n return this.toHex()\r\n }\r\n\r\n toArray () {\r\n return [this.r, this.g, this.b]\r\n }\r\n\r\n // Build hex value\r\n toHex () {\r\n return '#' +\r\n compToHex(Math.round(this.r)) +\r\n compToHex(Math.round(this.g)) +\r\n compToHex(Math.round(this.b))\r\n }\r\n\r\n // Build rgb value\r\n toRgb () {\r\n return 'rgb(' + [this.r, this.g, this.b].join() + ')'\r\n }\r\n\r\n // Calculate true brightness\r\n brightness () {\r\n return (this.r / 255 * 0.30) +\r\n (this.g / 255 * 0.59) +\r\n (this.b / 255 * 0.11)\r\n }\r\n\r\n // Testers\r\n\r\n // Test if given value is a color string\r\n static test (color) {\r\n color += ''\r\n return isHex.test(color) || isRgb.test(color)\r\n }\r\n\r\n // Test if given value is a rgb object\r\n static isRgb (color) {\r\n return color && typeof color.r === 'number' &&\r\n typeof color.g === 'number' &&\r\n typeof color.b === 'number'\r\n }\r\n\r\n // Test if given value is a color\r\n static isColor (color) {\r\n return this.isRgb(color) || this.test(color)\r\n }\r\n}\r\n","\r\nimport {timeline} from './defaults.js'\r\nimport {extend} from './tools.js'\r\n\r\n/***\r\nBase Class\r\n==========\r\nThe base stepper class that will be\r\n***/\r\n\r\nfunction makeSetterGetter (k, f) {\r\n return function (v) {\r\n if (v == null) return this[v]\r\n this[k] = v\r\n if (f) f.call(this)\r\n return this\r\n }\r\n}\r\n\r\nlet easing = {\r\n '-': function (pos) { return pos },\r\n '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r\n '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r\n '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },\r\n bezier: function (t0, x0, t1, x1) {\r\n return function (t) {\r\n // TODO: FINISH\r\n }\r\n }\r\n}\r\n\r\n\r\nexport class Stepper {\r\n done () { return false }\r\n}\r\n\r\n/***\r\nEasing Functions\r\n================\r\n***/\r\n\r\nexport class Ease extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.ease = easing[fn || timeline.ease] || fn\r\n }\r\n\r\n step (from, to, pos) {\r\n if (typeof from !== 'number') {\r\n return pos < 1 ? from : to\r\n }\r\n return from + (to - from) * this.ease(pos)\r\n }\r\n}\r\n\r\n\r\n/***\r\nController Types\r\n================\r\n***/\r\n\r\nexport class Controller extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.stepper = fn\r\n }\r\n\r\n step (current, target, dt, c) {\r\n return this.stepper(current, target, dt, c)\r\n }\r\n\r\n done (c) {\r\n return c.done\r\n }\r\n}\r\n\r\nfunction recalculate () {\r\n // Apply the default parameters\r\n var duration = (this._duration || 500) / 1000\r\n var overshoot = this._overshoot || 0\r\n\r\n // Calculate the PID natural response\r\n var eps = 1e-10\r\n var pi = Math.PI\r\n var os = Math.log(overshoot / 100 + eps)\r\n var zeta = -os / Math.sqrt(pi * pi + os * os)\r\n var wn = 3.9 / (zeta * duration)\r\n\r\n // Calculate the Spring values\r\n this.d = 2 * zeta * wn\r\n this.k = wn * wn\r\n}\r\n\r\nexport class Spring extends Controller {\r\n constructor (duration, overshoot) {\r\n super()\r\n this.duration(duration || 500)\r\n .overshoot(overshoot || 0)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n if (dt > 100) dt = 16\r\n\r\n dt /= 1000\r\n\r\n // Get the previous velocity\r\n var velocity = c.velocity || 0\r\n\r\n // Apply the control to get the new position and store it\r\n var acceleration = -this.d * velocity - this.k * (current - target)\r\n var newPosition = current +\r\n velocity * dt +\r\n acceleration * dt * dt / 2\r\n\r\n // Store the velocity\r\n c.velocity = velocity + acceleration * dt\r\n\r\n // Figure out if we have converged, and if so, pass the value\r\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\r\n return c.done ? target : newPosition\r\n }\r\n}\r\n\r\nextend(Spring, {\r\n duration: makeSetterGetter('_duration', recalculate),\r\n overshoot: makeSetterGetter('_overshoot', recalculate)\r\n})\r\n\r\nexport class PID extends Controller {\r\n constructor (p, i, d, windup) {\r\n super()\r\n\r\n p = p == null ? 0.1 : p\r\n i = i == null ? 0.01 : i\r\n d = d == null ? 0 : d\r\n windup = windup == null ? 1000 : windup\r\n this.p(p).i(i).d(d).windup(windup)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n var p = target - current\r\n var i = (c.integral || 0) + p * dt\r\n var d = (p - (c.error || 0)) / dt\r\n var windup = this.windup\r\n\r\n // antiwindup\r\n if (windup !== false) {\r\n i = Math.max(-windup, Math.min(i, windup))\r\n }\r\n\r\n c.error = p\r\n c.integral = i\r\n\r\n c.done = Math.abs(p) < 0.001\r\n\r\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\r\n }\r\n}\r\n\r\nextend(PID, {\r\n windup: makeSetterGetter('windup'),\r\n p: makeSetterGetter('P'),\r\n i: makeSetterGetter('I'),\r\n d: makeSetterGetter('D')\r\n})\r\n","import {extend} from './tools.js'\r\nimport {Ease} from './Controller.js'\r\nimport Color from './Color.js'\r\nimport SVGNumber from './SVGNumber.js'\r\nimport SVGArray from './SVGArray.js'\r\nimport PointArray from './PointArray.js'\r\nimport PathArray from './PathArray.js'\r\nimport Box from './Box.js'\r\nimport Matrix from './Matrix.js'\r\n\r\nexport default class Morphable {\r\n constructor (stepper) {\r\n // FIXME: the default stepper does not know about easing\r\n this._stepper = stepper || new Ease('-')\r\n\r\n this._from = null\r\n this._to = null\r\n this._type = null\r\n this._context = null\r\n this._morphObj = null\r\n }\r\n\r\n from (val) {\r\n if (val == null) {\r\n return this._from\r\n }\r\n\r\n this._from = this._set(val)\r\n return this\r\n }\r\n\r\n to (val) {\r\n if (val == null) {\r\n return this._to\r\n }\r\n\r\n this._to = this._set(val)\r\n return this\r\n }\r\n\r\n type (type) {\r\n // getter\r\n if (type == null) {\r\n return this._type\r\n }\r\n\r\n // setter\r\n this._type = type\r\n return this\r\n }\r\n\r\n _set (value) {\r\n if (!this._type) {\r\n var type = typeof value\r\n\r\n if (type === 'number') {\r\n this.type(SVGNumber)\r\n } else if (type === 'string') {\r\n if (Color.isColor(value)) {\r\n this.type(Color)\r\n } else if (regex.delimiter.test(value)) {\r\n this.type(regex.pathLetters.test(value)\r\n ? PathArray\r\n : SVGArray\r\n )\r\n } else if (regex.numberAndUnit.test(value)) {\r\n this.type(SVGNumber)\r\n } else {\r\n this.type(Morphable.NonMorphable)\r\n }\r\n } else if (MorphableTypes.indexOf(value.constructor) > -1) {\r\n this.type(value.constructor)\r\n } else if (Array.isArray(value)) {\r\n this.type(SVGArray)\r\n } else if (type === 'object') {\r\n this.type(Morphable.ObjectBag)\r\n } else {\r\n this.type(Morphable.NonMorphable)\r\n }\r\n }\r\n\r\n var result = (new this._type(value)).toArray()\r\n this._morphObj = this._morphObj || new this._type()\r\n this._context = this._context ||\r\n Array.apply(null, Array(result.length)).map(Object)\r\n return result\r\n }\r\n\r\n stepper (stepper) {\r\n if (stepper == null) return this._stepper\r\n this._stepper = stepper\r\n return this\r\n }\r\n\r\n done () {\r\n var complete = this._context\r\n .map(this._stepper.done)\r\n .reduce(function (last, curr) {\r\n return last && curr\r\n }, true)\r\n return complete\r\n }\r\n\r\n at (pos) {\r\n var _this = this\r\n\r\n return this._morphObj.fromArray(\r\n this._from.map(function (i, index) {\r\n return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)\r\n })\r\n )\r\n }\r\n}\r\n\r\nMorphable.NonMorphable = class {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (val) {\r\n val = Array.isArray(val) ? val[0] : val\r\n this.value = val\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n toArray () {\r\n return [this.value]\r\n }\r\n}\r\n\r\nMorphable.TransformBag = class {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (obj) {\r\n if (Array.isArray(obj)) {\r\n obj = {\r\n scaleX: obj[0],\r\n scaleY: obj[1],\r\n shear: obj[2],\r\n rotate: obj[3],\r\n translateX: obj[4],\r\n translateY: obj[5],\r\n originX: obj[6],\r\n originY: obj[7]\r\n }\r\n }\r\n\r\n Object.assign(this, Morphable.TransformBag.defaults, obj)\r\n }\r\n\r\n toArray () {\r\n var v = this\r\n\r\n return [\r\n v.scaleX,\r\n v.scaleY,\r\n v.shear,\r\n v.rotate,\r\n v.translateX,\r\n v.translateY,\r\n v.originX,\r\n v.originY\r\n ]\r\n }\r\n}\r\n\r\nMorphable.TransformBag.defaults = {\r\n scaleX: 1,\r\n scaleY: 1,\r\n shear: 0,\r\n rotate: 0,\r\n translateX: 0,\r\n translateY: 0,\r\n originX: 0,\r\n originY: 0\r\n}\r\n\r\nMorphable.ObjectBag = class {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (objOrArr) {\r\n this.values = []\r\n\r\n if (Array.isArray(objOrArr)) {\r\n this.values = objOrArr\r\n return\r\n }\r\n\r\n var entries = Object.entries(objOrArr || {}).sort((a, b) => {\r\n return a[0] - b[0]\r\n })\r\n\r\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\r\n }\r\n\r\n valueOf () {\r\n var obj = {}\r\n var arr = this.values\r\n\r\n for (var i = 0, len = arr.length; i < len; i += 2) {\r\n obj[arr[i]] = arr[i + 1]\r\n }\r\n\r\n return obj\r\n }\r\n\r\n toArray () {\r\n return this.values\r\n }\r\n}\r\n\r\nlet morphableTypes = [\r\n SVGNumber,\r\n Color,\r\n Box,\r\n Matrix,\r\n SVGArray,\r\n PointArray,\r\n PathArray,\r\n Morphable.NonMorphable,\r\n Morphable.TransformBag,\r\n Morphable.ObjectBag\r\n]\r\n\r\nextend(morphableTypes, {\r\n to (val, args) {\r\n return new Morphable()\r\n .type(this.constructor)\r\n .from(this.valueOf())\r\n .to(val, args)\r\n },\r\n fromArray (arr) {\r\n this.init(arr)\r\n return this\r\n }\r\n})\r\n","import Animator from './Animator.js'\r\n\r\nvar time = window.performance || Date\r\n\r\nvar makeSchedule = function (runnerInfo) {\r\n var start = runnerInfo.start\r\n var duration = runnerInfo.runner.duration()\r\n var end = start + duration\r\n return {start: start, duration: duration, end: end, runner: runnerInfo.runner}\r\n}\r\n\r\nexport default class Timeline {\r\n // Construct a new timeline on the given element\r\n constructor () {\r\n this._timeSource = function () {\r\n return time.now()\r\n }\r\n\r\n this._dispatcher = document.createElement('div')\r\n\r\n // Store the timing variables\r\n this._startTime = 0\r\n this._speed = 1.0\r\n\r\n // Play control variables control how the animation proceeds\r\n this._reverse = false\r\n this._persist = 0\r\n\r\n // Keep track of the running animations and their starting parameters\r\n this._nextFrame = null\r\n this._paused = false\r\n this._runners = []\r\n this._order = []\r\n this._time = 0\r\n this._lastSourceTime = 0\r\n this._lastStepTime = 0\r\n }\r\n\r\n getEventTarget () {\r\n return this._dispatcher\r\n }\r\n\r\n /**\r\n *\r\n */\r\n\r\n // schedules a runner on the timeline\r\n schedule (runner, delay, when) {\r\n if (runner == null) {\r\n return this._runners.map(makeSchedule).sort(function (a, b) {\r\n return (a.start - b.start) || (a.duration - b.duration)\r\n })\r\n }\r\n\r\n if (!this.active()) {\r\n this._step()\r\n if (when == null) {\r\n when = 'now'\r\n }\r\n }\r\n\r\n // The start time for the next animation can either be given explicitly,\r\n // derived from the current timeline time or it can be relative to the\r\n // last start time to chain animations direclty\r\n var absoluteStartTime = 0\r\n delay = delay || 0\r\n\r\n // Work out when to start the animation\r\n if (when == null || when === 'last' || when === 'after') {\r\n // Take the last time and increment\r\n absoluteStartTime = this._startTime\r\n } else if (when === 'absolute' || when === 'start') {\r\n absoluteStartTime = delay\r\n delay = 0\r\n } else if (when === 'now') {\r\n absoluteStartTime = this._time\r\n } else if (when === 'relative') {\r\n let runnerInfo = this._runners[runner.id]\r\n if (runnerInfo) {\r\n absoluteStartTime = runnerInfo.start + delay\r\n delay = 0\r\n }\r\n } else {\r\n throw new Error('Invalid value for the \"when\" parameter')\r\n }\r\n\r\n // Manage runner\r\n runner.unschedule()\r\n runner.timeline(this)\r\n runner.time(-delay)\r\n\r\n // Save startTime for next runner\r\n this._startTime = absoluteStartTime + runner.duration() + delay\r\n\r\n // Save runnerInfo\r\n this._runners[runner.id] = {\r\n persist: this.persist(),\r\n runner: runner,\r\n start: absoluteStartTime\r\n }\r\n\r\n // Save order and continue\r\n this._order.push(runner.id)\r\n this._continue()\r\n return this\r\n }\r\n\r\n // Remove the runner from this timeline\r\n unschedule (runner) {\r\n var index = this._order.indexOf(runner.id)\r\n if (index < 0) return this\r\n\r\n delete this._runners[runner.id]\r\n this._order.splice(index, 1)\r\n runner.timeline(null)\r\n return this\r\n }\r\n\r\n play () {\r\n // Now make sure we are not paused and continue the animation\r\n this._paused = false\r\n return this._continue()\r\n }\r\n\r\n pause () {\r\n // Cancel the next animation frame and pause\r\n this._nextFrame = null\r\n this._paused = true\r\n return this\r\n }\r\n\r\n stop () {\r\n // Cancel the next animation frame and go to start\r\n this.seek(-this._time)\r\n return this.pause()\r\n }\r\n\r\n finish () {\r\n this.seek(Infinity)\r\n return this.pause()\r\n }\r\n\r\n speed (speed) {\r\n if (speed == null) return this._speed\r\n this._speed = speed\r\n return this\r\n }\r\n\r\n reverse (yes) {\r\n var currentSpeed = this.speed()\r\n if (yes == null) return this.speed(-currentSpeed)\r\n\r\n var positive = Math.abs(currentSpeed)\r\n return this.speed(yes ? positive : -positive)\r\n }\r\n\r\n seek (dt) {\r\n this._time += dt\r\n return this._continue()\r\n }\r\n\r\n time (time) {\r\n if (time == null) return this._time\r\n this._time = time\r\n return this\r\n }\r\n\r\n persist (dtOrForever) {\r\n if (dtOrForever == null) return this._persist\r\n this._persist = dtOrForever\r\n return this\r\n }\r\n\r\n source (fn) {\r\n if (fn == null) return this._timeSource\r\n this._timeSource = fn\r\n return this\r\n }\r\n\r\n _step () {\r\n // If the timeline is paused, just do nothing\r\n if (this._paused) return\r\n\r\n // Get the time delta from the last time and update the time\r\n // TODO: Deal with window.blur window.focus to pause animations\r\n var time = this._timeSource()\r\n var dtSource = time - this._lastSourceTime\r\n var dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\r\n this._lastSourceTime = time\r\n\r\n // Update the time\r\n this._time += dtTime\r\n this._lastStepTime = this._time\r\n // this.fire('time', this._time)\r\n\r\n // Run all of the runners directly\r\n var runnersLeft = false\r\n for (var i = 0, len = this._order.length; i < len; i++) {\r\n // Get and run the current runner and ignore it if its inactive\r\n var runnerInfo = this._runners[this._order[i]]\r\n var runner = runnerInfo.runner\r\n let dt = dtTime\r\n\r\n // Make sure that we give the actual difference\r\n // between runner start time and now\r\n let dtToStart = this._time - runnerInfo.start\r\n\r\n // Dont run runner if not started yet\r\n if (dtToStart < 0) {\r\n runnersLeft = true\r\n continue\r\n } else if (dtToStart < dt) {\r\n // Adjust dt to make sure that animation is on point\r\n dt = dtToStart\r\n }\r\n\r\n if (!runner.active()) continue\r\n\r\n // If this runner is still going, signal that we need another animation\r\n // frame, otherwise, remove the completed runner\r\n var finished = runner.step(dt).done\r\n if (!finished) {\r\n runnersLeft = true\r\n // continue\r\n } else if (runnerInfo.persist !== true) {\r\n // runner is finished. And runner might get removed\r\n\r\n // TODO: Figure out end time of runner\r\n var endTime = runner.duration() - runner.time() + this._time\r\n\r\n if (endTime + this._persist < this._time) {\r\n // Delete runner and correct index\r\n delete this._runners[this._order[i]]\r\n this._order.splice(i--, 1) && --len\r\n runner.timeline(null)\r\n }\r\n }\r\n }\r\n\r\n // Get the next animation frame to keep the simulation going\r\n if (runnersLeft) {\r\n this._nextFrame = Animator.frame(this._step.bind(this))\r\n } else {\r\n this._nextFrame = null\r\n }\r\n return this\r\n }\r\n\r\n // Checks if we are running and continues the animation\r\n _continue () {\r\n if (this._paused) return this\r\n if (!this._nextFrame) {\r\n this._nextFrame = Animator.frame(this._step.bind(this))\r\n }\r\n return this\r\n }\r\n\r\n active () {\r\n return !!this._nextFrame\r\n }\r\n}\r\n\r\nTimeline.constructors = {\r\n Element: {\r\n timeline: function () {\r\n this._timeline = (this._timeline || new Timeline())\r\n return this._timeline\r\n }\r\n }\r\n}\r\n","import {isMatrixLike, getOrigin} from './helpers.js'\r\nimport Matrix from './Matrix.js'\r\nimport Morphable from './Morphable.js'\r\nimport SVGNumber from './SVGNumber.js'\r\nimport Timeline from './Timeline.js'\r\nimport {Controller, Ease, Stepper} from './Controller.js'\r\nimport {noop, timeline} from './defaults.js'\r\nimport {extend} from './tools.js'\r\nimport Animator from './Animator.js'\r\nimport Point from './Point.js'\r\n\r\n// FIXME: What is this doing here?\r\n// easing = {\r\n// '-': function (pos) { return pos },\r\n// '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r\n// '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r\n// '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }\r\n// }\r\n\r\nexport default class Runner {\r\n constructor (options) {\r\n // Store a unique id on the runner, so that we can identify it later\r\n this.id = Runner.id++\r\n\r\n // Ensure a default value\r\n options = options == null\r\n ? timeline.duration\r\n : options\r\n\r\n // Ensure that we get a controller\r\n options = typeof options === 'function'\r\n ? new Controller(options)\r\n : options\r\n\r\n // Declare all of the variables\r\n this._element = null\r\n this._timeline = null\r\n this.done = false\r\n this._queue = []\r\n\r\n // Work out the stepper and the duration\r\n this._duration = typeof options === 'number' && options\r\n this._isDeclarative = options instanceof Controller\r\n this._stepper = this._isDeclarative ? options : new Ease()\r\n\r\n // We copy the current values from the timeline because they can change\r\n this._history = {}\r\n\r\n // Store the state of the runner\r\n this.enabled = true\r\n this._time = 0\r\n this._last = 0\r\n\r\n // Save transforms applied to this runner\r\n this.transforms = new Matrix()\r\n this.transformId = 1\r\n\r\n // Looping variables\r\n this._haveReversed = false\r\n this._reverse = false\r\n this._loopsDone = 0\r\n this._swing = false\r\n this._wait = 0\r\n this._times = 1\r\n }\r\n\r\n /*\r\n Runner Definitions\r\n ==================\r\n These methods help us define the runtime behaviour of the Runner or they\r\n help us make new runners from the current runner\r\n */\r\n\r\n element (element) {\r\n if (element == null) return this._element\r\n this._element = element\r\n element._prepareRunner()\r\n return this\r\n }\r\n\r\n timeline (timeline) {\r\n // check explicitly for undefined so we can set the timeline to null\r\n if (typeof timeline === 'undefined') return this._timeline\r\n this._timeline = timeline\r\n return this\r\n }\r\n\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var runner = new Runner(o.duration)\r\n if (this._timeline) runner.timeline(this._timeline)\r\n if (this._element) runner.element(this._element)\r\n return runner.loop(o).schedule(delay, when)\r\n }\r\n\r\n schedule (timeline, delay, when) {\r\n // The user doesn't need to pass a timeline if we already have one\r\n if (!(timeline instanceof Timeline)) {\r\n when = delay\r\n delay = timeline\r\n timeline = this.timeline()\r\n }\r\n\r\n // If there is no timeline, yell at the user...\r\n if (!timeline) {\r\n throw Error('Runner cannot be scheduled without timeline')\r\n }\r\n\r\n // Schedule the runner on the timeline provided\r\n timeline.schedule(this, delay, when)\r\n return this\r\n }\r\n\r\n unschedule () {\r\n var timeline = this.timeline()\r\n timeline && timeline.unschedule(this)\r\n return this\r\n }\r\n\r\n loop (times, swing, wait) {\r\n // Deal with the user passing in an object\r\n if (typeof times === 'object') {\r\n swing = times.swing\r\n wait = times.wait\r\n times = times.times\r\n }\r\n\r\n // Sanitise the values and store them\r\n this._times = times || Infinity\r\n this._swing = swing || false\r\n this._wait = wait || 0\r\n return this\r\n }\r\n\r\n delay (delay) {\r\n return this.animate(0, delay)\r\n }\r\n\r\n /*\r\n Basic Functionality\r\n ===================\r\n These methods allow us to attach basic functions to the runner directly\r\n */\r\n\r\n queue (initFn, runFn, isTransform) {\r\n this._queue.push({\r\n initialiser: initFn || noop,\r\n runner: runFn || noop,\r\n isTransform: isTransform,\r\n initialised: false,\r\n finished: false\r\n })\r\n var timeline = this.timeline()\r\n timeline && this.timeline()._continue()\r\n return this\r\n }\r\n\r\n during (fn) {\r\n return this.queue(null, fn)\r\n }\r\n\r\n after (fn) {\r\n return this.on('finish', fn)\r\n }\r\n\r\n /*\r\n Runner animation methods\r\n ========================\r\n Control how the animation plays\r\n */\r\n\r\n time (time) {\r\n if (time == null) {\r\n return this._time\r\n }\r\n let dt = time - this._time\r\n this.step(dt)\r\n return this\r\n }\r\n\r\n duration () {\r\n return this._times * (this._wait + this._duration) - this._wait\r\n }\r\n\r\n loops (p) {\r\n var loopDuration = this._duration + this._wait\r\n if (p == null) {\r\n var loopsDone = Math.floor(this._time / loopDuration)\r\n var relativeTime = (this._time - loopsDone * loopDuration)\r\n var position = relativeTime / this._duration\r\n return Math.min(loopsDone + position, this._times)\r\n }\r\n var whole = Math.floor(p)\r\n var partial = p % 1\r\n var time = loopDuration * whole + this._duration * partial\r\n return this.time(time)\r\n }\r\n\r\n position (p) {\r\n // Get all of the variables we need\r\n var x = this._time\r\n var d = this._duration\r\n var w = this._wait\r\n var t = this._times\r\n var s = this._swing\r\n var r = this._reverse\r\n var position\r\n\r\n if (p == null) {\r\n /*\r\n This function converts a time to a position in the range [0, 1]\r\n The full explanation can be found in this desmos demonstration\r\n https://www.desmos.com/calculator/u4fbavgche\r\n The logic is slightly simplified here because we can use booleans\r\n */\r\n\r\n // Figure out the value without thinking about the start or end time\r\n const f = function (x) {\r\n var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d))\r\n var backwards = (swinging && !r) || (!swinging && r)\r\n var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards\r\n var clipped = Math.max(Math.min(uncliped, 1), 0)\r\n return clipped\r\n }\r\n\r\n // Figure out the value by incorporating the start time\r\n var endTime = t * (w + d) - w\r\n position = x <= 0 ? Math.round(f(1e-5))\r\n : x < endTime ? f(x)\r\n : Math.round(f(endTime - 1e-5))\r\n return position\r\n }\r\n\r\n // Work out the loops done and add the position to the loops done\r\n var loopsDone = Math.floor(this.loops())\r\n var swingForward = s && (loopsDone % 2 === 0)\r\n var forwards = (swingForward && !r) || (r && swingForward)\r\n position = loopsDone + (forwards ? p : 1 - p)\r\n return this.loops(position)\r\n }\r\n\r\n progress (p) {\r\n if (p == null) {\r\n return Math.min(1, this._time / this.duration())\r\n }\r\n return this.time(p * this.duration())\r\n }\r\n\r\n step (dt) {\r\n // If we are inactive, this stepper just gets skipped\r\n if (!this.enabled) return this\r\n\r\n // Update the time and get the new position\r\n dt = dt == null ? 16 : dt\r\n this._time += dt\r\n var position = this.position()\r\n\r\n // Figure out if we need to run the stepper in this frame\r\n var running = this._lastPosition !== position && this._time >= 0\r\n this._lastPosition = position\r\n\r\n // Figure out if we just started\r\n var duration = this.duration()\r\n var justStarted = this._lastTime < 0 && this._time > 0\r\n var justFinished = this._lastTime < this._time && this.time > duration\r\n this._lastTime = this._time\r\n if (justStarted) {\r\n // this.fire('start', this)\r\n }\r\n\r\n // Work out if the runner is finished set the done flag here so animations\r\n // know, that they are running in the last step (this is good for\r\n // transformations which can be merged)\r\n var declarative = this._isDeclarative\r\n this.done = !declarative && !justFinished && this._time >= duration\r\n\r\n // Call initialise and the run function\r\n if (running || declarative) {\r\n this._initialise(running)\r\n\r\n // clear the transforms on this runner so they dont get added again and again\r\n this.transforms = new Matrix()\r\n var converged = this._run(declarative ? dt : position)\r\n // this.fire('step', this)\r\n }\r\n // correct the done flag here\r\n // declaritive animations itself know when they converged\r\n this.done = this.done || (converged && declarative)\r\n // if (this.done) {\r\n // this.fire('finish', this)\r\n // }\r\n return this\r\n }\r\n\r\n finish () {\r\n return this.step(Infinity)\r\n }\r\n\r\n reverse (reverse) {\r\n this._reverse = reverse == null ? !this._reverse : reverse\r\n return this\r\n }\r\n\r\n ease (fn) {\r\n this._stepper = new Ease(fn)\r\n return this\r\n }\r\n\r\n active (enabled) {\r\n if (enabled == null) return this.enabled\r\n this.enabled = enabled\r\n return this\r\n }\r\n\r\n /*\r\n Private Methods\r\n ===============\r\n Methods that shouldn't be used externally\r\n */\r\n\r\n // Save a morpher to the morpher list so that we can retarget it later\r\n _rememberMorpher (method, morpher) {\r\n this._history[method] = {\r\n morpher: morpher,\r\n caller: this._queue[this._queue.length - 1]\r\n }\r\n }\r\n\r\n // Try to set the target for a morpher if the morpher exists, otherwise\r\n // do nothing and return false\r\n _tryRetarget (method, target) {\r\n if (this._history[method]) {\r\n // if the last method wasnt even initialised, throw it away\r\n if (!this._history[method].caller.initialised) {\r\n let index = this._queue.indexOf(this._history[method].caller)\r\n this._queue.splice(index, 1)\r\n return false\r\n }\r\n\r\n // for the case of transformations, we use the special retarget function\r\n // which has access to the outer scope\r\n if (this._history[method].caller.isTransform) {\r\n this._history[method].caller.isTransform(target)\r\n // for everything else a simple morpher change is sufficient\r\n } else {\r\n this._history[method].morpher.to(target)\r\n }\r\n\r\n this._history[method].caller.finished = false\r\n var timeline = this.timeline()\r\n timeline && timeline._continue()\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n // Run each initialise function in the runner if required\r\n _initialise (running) {\r\n // If we aren't running, we shouldn't initialise when not declarative\r\n if (!running && !this._isDeclarative) return\r\n\r\n // Loop through all of the initialisers\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current initialiser\r\n var current = this._queue[i]\r\n\r\n // Determine whether we need to initialise\r\n var needsIt = this._isDeclarative || (!current.initialised && running)\r\n running = !current.finished\r\n\r\n // Call the initialiser if we need to\r\n if (needsIt && running) {\r\n current.initialiser.call(this)\r\n current.initialised = true\r\n }\r\n }\r\n }\r\n\r\n // Run each run function for the position or dt given\r\n _run (positionOrDt) {\r\n // Run all of the _queue directly\r\n var allfinished = true\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current function to run\r\n var current = this._queue[i]\r\n\r\n // Run the function if its not finished, we keep track of the finished\r\n // flag for the sake of declarative _queue\r\n var converged = current.runner.call(this, positionOrDt)\r\n current.finished = current.finished || (converged === true)\r\n allfinished = allfinished && current.finished\r\n }\r\n\r\n // We report when all of the constructors are finished\r\n return allfinished\r\n }\r\n\r\n addTransform (transform, index) {\r\n this.transforms.lmultiplyO(transform)\r\n return this\r\n }\r\n\r\n clearTransform () {\r\n this.transforms = new Matrix()\r\n return this\r\n }\r\n\r\n static sanitise (duration, delay, when) {\r\n // Initialise the default parameters\r\n var times = 1\r\n var swing = false\r\n var wait = 0\r\n duration = duration || timeline.duration\r\n delay = delay || timeline.delay\r\n when = when || 'last'\r\n\r\n // If we have an object, unpack the values\r\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\r\n delay = duration.delay || delay\r\n when = duration.when || when\r\n swing = duration.swing || swing\r\n times = duration.times || times\r\n wait = duration.wait || wait\r\n duration = duration.duration || timeline.duration\r\n }\r\n\r\n return {\r\n duration: duration,\r\n delay: delay,\r\n swing: swing,\r\n times: times,\r\n wait: wait,\r\n when: when\r\n }\r\n }\r\n}\r\n\r\nRunner.id = 0\r\n\r\nclass FakeRunner{\r\n constructor (transforms = new Matrix(), id = -1, done = true) {\r\n this.transforms = transforms\r\n this.id = id\r\n this.done = done\r\n }\r\n}\r\n\r\nextend([Runner, FakeRunner], {\r\n mergeWith (runner) {\r\n return new FakeRunner(\r\n runner.transforms.lmultiply(this.transforms),\r\n runner.id\r\n )\r\n }\r\n})\r\n\r\n// FakeRunner.emptyRunner = new FakeRunner()\r\n\r\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\r\nconst getRunnerTransform = (runner) => runner.transforms\r\n\r\nfunction mergeTransforms () {\r\n // Find the matrix to apply to the element and apply it\r\n let runners = this._transformationRunners.runners\r\n let netTransform = runners\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n\r\n this.transform(netTransform)\r\n\r\n this._transformationRunners.merge()\r\n\r\n if (this._transformationRunners.length() === 1) {\r\n this._frameId = null\r\n }\r\n}\r\n\r\nclass RunnerArray {\r\n constructor () {\r\n this.runners = []\r\n this.ids = []\r\n }\r\n\r\n add (runner) {\r\n if (this.runners.includes(runner)) return\r\n\r\n let id = runner.id + 1\r\n\r\n let leftSibling = this.ids.reduce((last, curr) => {\r\n if (curr > last && curr < id) return curr\r\n return last\r\n }, 0)\r\n\r\n let index = this.ids.indexOf(leftSibling) + 1\r\n\r\n this.ids.splice(index, 0, id)\r\n this.runners.splice(index, 0, runner)\r\n\r\n return this\r\n }\r\n\r\n getByID (id) {\r\n return this.runners[this.ids.indexOf(id + 1)]\r\n }\r\n\r\n remove (id) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1)\r\n this.runners.splice(index, 1)\r\n return this\r\n }\r\n\r\n merge () {\r\n let lastRunner = null\r\n this.runners.forEach((runner, i) => {\r\n if (lastRunner && runner.done && lastRunner.done) {\r\n this.remove(runner.id)\r\n this.edit(lastRunner.id, runner.mergeWith(lastRunner))\r\n }\r\n\r\n lastRunner = runner\r\n })\r\n\r\n return this\r\n }\r\n\r\n edit (id, newRunner) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1, id)\r\n this.runners.splice(index, 1, newRunner)\r\n return this\r\n }\r\n\r\n length () {\r\n return this.ids.length\r\n }\r\n\r\n clearBefore (id) {\r\n let deleteCnt = this.ids.indexOf(id + 1) || 1\r\n this.ids.splice(0, deleteCnt, 0)\r\n this.runners.splice(0, deleteCnt, new FakeRunner())\r\n return this\r\n }\r\n}\r\n\r\nlet frameId = 0\r\nRunner.constructors = {\r\n Element: {\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var timeline = this.timeline()\r\n return new Runner(o.duration)\r\n .loop(o)\r\n .element(this)\r\n .timeline(timeline)\r\n .schedule(delay, when)\r\n },\r\n\r\n delay (by, when) {\r\n return this.animate(0, by, when)\r\n },\r\n\r\n // this function searches for all runners on the element and deletes the ones\r\n // which run before the current one. This is because absolute transformations\r\n // overwfrite anything anyway so there is no need to waste time computing\r\n // other runners\r\n _clearTransformRunnersBefore (currentRunner) {\r\n this._transformationRunners.clearBefore(currentRunner.id)\r\n },\r\n\r\n _currentTransform (current) {\r\n return this._transformationRunners.runners\r\n // we need the equal sign here to make sure, that also transformations\r\n // on the same runner which execute before the current transformation are\r\n // taken into account\r\n .filter((runner) => runner.id <= current.id)\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n },\r\n\r\n addRunner (runner) {\r\n this._transformationRunners.add(runner)\r\n\r\n Animator.transform_frame(\r\n mergeTransforms.bind(this), this._frameId\r\n )\r\n },\r\n\r\n _prepareRunner () {\r\n if (this._frameId == null) {\r\n this._transformationRunners = new RunnerArray()\r\n .add(new FakeRunner(new Matrix(this)))\r\n\r\n this._frameId = frameId++\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nextend(Runner, {\r\n attr (a, v) {\r\n return this.styleAttr('attr', a, v)\r\n },\r\n\r\n // Add animatable styles\r\n css (s, v) {\r\n return this.styleAttr('css', s, v)\r\n },\r\n\r\n styleAttr (type, name, val) {\r\n // apply attributes individually\r\n if (typeof name === 'object') {\r\n for (var key in val) {\r\n this.styleAttr(type, key, val[key])\r\n }\r\n }\r\n\r\n var morpher = new Morphable(this._stepper).to(val)\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.element()[type](name))\r\n }, function (pos) {\r\n this.element()[type](name, morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n zoom (level, point) {\r\n var morpher = new Morphable(this._stepper).to(new SVGNumber(level))\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.zoom())\r\n }, function (pos) {\r\n this.element().zoom(morpher.at(pos), point)\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n /**\r\n ** absolute transformations\r\n **/\r\n\r\n //\r\n // M v -----|-----(D M v = F v)------|-----> T v\r\n //\r\n // 1. define the final state (T) and decompose it (once)\r\n // t = [tx, ty, the, lam, sy, sx]\r\n // 2. on every frame: pull the current state of all previous transforms\r\n // (M - m can change)\r\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\r\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\r\n // - Note F(0) = M\r\n // - Note F(1) = T\r\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\r\n\r\n transform (transforms, relative, affine) {\r\n // If we have a declarative function, we should retarget it if possible\r\n relative = transforms.relative || relative\r\n if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\r\n return this\r\n }\r\n\r\n // Parse the parameters\r\n var isMatrix = isMatrixLike(transforms)\r\n affine = transforms.affine != null\r\n ? transforms.affine\r\n : (affine != null ? affine : !isMatrix)\r\n\r\n // Create a morepher and set its type\r\n const morpher = new Morphable()\r\n .type(affine ? Morphable.TransformBag : Matrix)\r\n .stepper(this._stepper)\r\n\r\n let origin\r\n let element\r\n let current\r\n let currentAngle\r\n let startTransform\r\n\r\n function setup () {\r\n // make sure element and origin is defined\r\n element = element || this.element()\r\n origin = origin || getOrigin(transforms, element)\r\n\r\n startTransform = new Matrix(relative ? undefined : element)\r\n\r\n // add the runner to the element so it can merge transformations\r\n element.addRunner(this)\r\n\r\n // Deactivate all transforms that have run so far if we are absolute\r\n if (!relative) {\r\n element._clearTransformRunnersBefore(this)\r\n }\r\n }\r\n\r\n function run (pos) {\r\n // clear all other transforms before this in case something is saved\r\n // on this runner. We are absolute. We dont need these!\r\n if (!relative) this.clearTransform()\r\n\r\n let {x, y} = new Point(origin).transform(element._currentTransform(this))\r\n\r\n let target = new Matrix({...transforms, origin: [x, y]})\r\n let start = this._isDeclarative && current\r\n ? current\r\n : startTransform\r\n\r\n if (affine) {\r\n target = target.decompose(x, y)\r\n start = start.decompose(x, y)\r\n\r\n // Get the current and target angle as it was set\r\n const rTarget = target.rotate\r\n const rCurrent = start.rotate\r\n\r\n // Figure out the shortest path to rotate directly\r\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\r\n const distances = possibilities.map(a => Math.abs(a - rCurrent))\r\n const shortest = Math.min(...distances)\r\n const index = distances.indexOf(shortest)\r\n target.rotate = possibilities[index]\r\n }\r\n\r\n if (relative) {\r\n // we have to be careful here not to overwrite the rotation\r\n // with the rotate method of Matrix\r\n if (!isMatrix) {\r\n target.rotate = transforms.rotate || 0\r\n }\r\n if (this._isDeclarative && currentAngle) {\r\n start.rotate = currentAngle\r\n }\r\n }\r\n\r\n morpher.from(start)\r\n morpher.to(target)\r\n\r\n let affineParameters = morpher.at(pos)\r\n currentAngle = affineParameters.rotate\r\n current = new Matrix(affineParameters)\r\n\r\n this.addTransform(current)\r\n return morpher.done()\r\n }\r\n\r\n function retarget (newTransforms) {\r\n // only get a new origin if it changed since the last call\r\n if (\r\n (newTransforms.origin || 'center').toString() !==\r\n (transforms.origin || 'center').toString()\r\n ) {\r\n origin = getOrigin(transforms, element)\r\n }\r\n\r\n // overwrite the old transformations with the new ones\r\n transforms = {...newTransforms, origin}\r\n }\r\n\r\n this.queue(setup, run, retarget)\r\n this._isDeclarative && this._rememberMorpher('transform', morpher)\r\n return this\r\n },\r\n\r\n // Animatable x-axis\r\n x (x, relative) {\r\n return this._queueNumber('x', x)\r\n },\r\n\r\n // Animatable y-axis\r\n y (y) {\r\n return this._queueNumber('y', y)\r\n },\r\n\r\n dx (x) {\r\n return this._queueNumberDelta('dx', x)\r\n },\r\n\r\n dy (y) {\r\n return this._queueNumberDelta('dy', y)\r\n },\r\n\r\n _queueNumberDelta (method, to) {\r\n to = new SVGNumber(to)\r\n\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetargetDelta(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n this.queue(function () {\r\n var from = this.element()[method]()\r\n morpher.from(from)\r\n morpher.to(from + to)\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueObject (method, to) {\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n this.queue(function () {\r\n morpher.from(this.element()[method]())\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueNumber (method, value) {\r\n return this._queueObject(method, new SVGNumber(value))\r\n },\r\n\r\n // Animatable center x-axis\r\n cx (x) {\r\n return this._queueNumber('cx', x)\r\n },\r\n\r\n // Animatable center y-axis\r\n cy (y) {\r\n return this._queueNumber('cy', y)\r\n },\r\n\r\n // Add animatable move\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n },\r\n\r\n // Add animatable center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n },\r\n\r\n // Add animatable size\r\n size (width, height) {\r\n // animate bbox based size for all other elements\r\n var box\r\n\r\n if (!width || !height) {\r\n box = this._element.bbox()\r\n }\r\n\r\n if (!width) {\r\n width = box.width / box.height * height\r\n }\r\n\r\n if (!height) {\r\n height = box.height / box.width * width\r\n }\r\n\r\n return this\r\n .width(width)\r\n .height(height)\r\n },\r\n\r\n // Add animatable width\r\n width (width) {\r\n return this._queueNumber('width', width)\r\n },\r\n\r\n // Add animatable height\r\n height (height) {\r\n return this._queueNumber('height', height)\r\n },\r\n\r\n // Add animatable plot\r\n plot (a, b, c, d) {\r\n // Lines can be plotted with 4 arguments\r\n if (arguments.length === 4) {\r\n return this.plot([a, b, c, d])\r\n }\r\n\r\n // FIXME: this needs to be rewritten such that the element is only accesed\r\n // in the init function\r\n return this._queueObject('plot', new this._element.MorphArray(a))\r\n\r\n /*\r\n var morpher = this._element.morphArray().to(a)\r\n\r\n this.queue(function () {\r\n morpher.from(this._element.array())\r\n }, function (pos) {\r\n this._element.plot(morpher.at(pos))\r\n })\r\n\r\n return this\r\n */\r\n },\r\n\r\n // Add leading method\r\n leading (value) {\r\n return this._queueNumber('leading', value)\r\n },\r\n\r\n // Add animatable viewbox\r\n viewbox (x, y, width, height) {\r\n return this._queueObject('viewbox', new Box(x, y, width, height))\r\n },\r\n\r\n update (o) {\r\n if (typeof o !== 'object') {\r\n return this.update({\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n })\r\n }\r\n\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', o.offset)\r\n\r\n return this\r\n }\r\n})\r\n","export {default as HtmlNode} from './HtmlNode.js'\r\nexport {default as Doc} from './Doc.js'\r\nexport {default as Defs} from './Defs.js'\r\nexport {default as G} from './G.js'\r\nexport {default as Animator} from './Animator.js'\r\nexport {default as Bare} from './Bare.js'\r\nexport {default as Circle} from './Circle.js'\r\nexport {default as ClipPath} from './ClipPath.js'\r\nexport {default as A} from './A.js'\r\nexport {default as Ellipse} from './Ellipse.js'\r\nexport {default as Stop} from './Stop.js'\r\nexport {default as Gradient} from './Gradient.js'\r\nexport {default as Image} from './Image.js'\r\nexport {default as Line} from './Line.js'\r\nexport {default as Marker} from './Marker.js'\r\nexport {default as Mask} from './Mask.js'\r\nexport {default as Path} from './Path.js'\r\nexport {default as Pattern} from './Pattern.js'\r\nexport {default as Polygon} from './Polygon.js'\r\nexport {default as Polyline} from './Polyline.js'\r\nexport {default as Rect} from './Rect.js'\r\nexport {default as Symbol} from './Symbol.js'\r\nexport {default as Text} from './Text.js'\r\nexport {default as TextPath} from './TextPath.js'\r\nexport {default as Tspan} from './Tspan.js'\r\nexport {default as Use} from './Use.js'\r\nexport {default as SVGNumber} from './SVGNumber.js'\r\nexport {default as SVGArray} from './SVGArray.js'\r\nexport {default as PathArray} from './PathArray.js'\r\nexport {default as PointArray} from './PointArray.js'\r\nexport {default as Matrix} from './Matrix.js'\r\nexport {default as Point} from './Point.js'\r\nexport {default as Box} from './Box.js'\r\nexport {default as Color} from './Color.js'\r\nexport {default as Morphable} from './Morphable.js'\r\nexport {default as Queue} from './Queue.js'\r\nexport {default as Runner} from './Runner.js'\r\nexport {default as Timeline} from './Timeline.js'\r\nexport {Controller, Ease, PID, Spring} from './Controller.js'\r\n\r\n// export {default as Animator} from './Animator.js'\r\n// export {default as SVGArray} from './SVGArray.js'\r\n// export {default as Bare} from './Bare.js'\r\n// export {default as Box} from './Box.js'\r\n// export {default as Circle} from './Circle.js'\r\n// export {default as ClipPath} from './ClipPath.js'\r\n// export {default as Color} from './Color.js'\r\n// export {default as Container} from './Container.js'\r\n// export {Controller, Ease, PID, Spring} from './Controller.js'\r\n// export {default as Defs} from './Defs.js'\r\n// export {default as Doc} from './Doc.js'\r\n// export {default as Element} from './Element.js'\r\n// export {default as Ellipse} from './Ellipse.js'\r\n// export {default as EventTarget} from './EventTarget.js'\r\n// export {default as Gradient} from './Gradient.js'\r\n// export {default as G} from './G.js'\r\n// export {default as HtmlNode} from './HtmlNode.js'\r\n// export {default as A} from './A.js'\r\n// export {default as Image} from './Image.js'\r\n// export {default as Line} from './Line.js'\r\n// export {default as Marker} from './Marker.js'\r\n// export {default as Mask} from './Mask.js'\r\n// export {default as Matrix} from './Matrix.js'\r\n// export {default as Morphable} from './Morphable.js'\r\n// export {default as SVGNumber} from './SVGNumber.js'\r\n// export {default as Parent} from './Parent.js'\r\n// export {default as Path} from './Path.js'\r\n// export {default as PathArray} from './PathArray.js'\r\n// export {default as Pattern} from './Pattern.js'\r\n// export {default as Point} from './Point.js'\r\n// export {default as PointArray} from './PointArray.js'\r\n// export {default as Polygon} from './Polygon.js'\r\n// export {default as Polyline} from './Polyline.js'\r\n// export {default as Queue} from './Queue.js'\r\n// export {default as Rect} from './Rect.js'\r\n// export {default as Runner} from './Runner.js'\r\n// export {default as Shape} from './Shape.js'\r\n// export {default as Stop} from './Stop.js'\r\n// export {default as Symbol} from './Symbol.js'\r\n// export {default as Text} from './Text.js'\r\n// export {default as TextPath} from './TextPath.js'\r\n// export {default as Timeline} from './Timeline.js'\r\n// export {default as Use} from './Use.js'\r\n","import Doc from './Doc.js'\r\n\r\n// ### This module adds backward / forward functionality to elements.\r\n\r\n// Get all siblings, including myself\r\nexport function siblings () {\r\n return this.parent().children()\r\n}\r\n\r\n// Get the curent position siblings\r\nexport function position () {\r\n return this.parent().index(this)\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function next () {\r\n return this.siblings()[this.position() + 1]\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function prev () {\r\n return this.siblings()[this.position() - 1]\r\n}\r\n\r\n// Send given element one step forward\r\nexport function forward () {\r\n var i = this.position() + 1\r\n var p = this.parent()\r\n\r\n // move node one step forward\r\n p.removeElement(this).add(this, i)\r\n\r\n // make sure defs node is always at the top\r\n if (p instanceof Doc) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element one step backward\r\nexport function backward () {\r\n var i = this.position()\r\n\r\n if (i > 0) {\r\n this.parent().removeElement(this).add(this, i - 1)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the front\r\nexport function front () {\r\n var p = this.parent()\r\n\r\n // Move node forward\r\n p.node.appendChild(this.node)\r\n\r\n // Make sure defs node is always at the top\r\n if (p instanceof Doc) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the back\r\nexport function back () {\r\n if (this.position() > 0) {\r\n this.parent().removeElement(this).add(this, 0)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element before the targeted element\r\nexport function before (element) {\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i)\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element after the targeted element\r\nexport function after (element) {\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i + 1)\r\n\r\n return this\r\n}\r\n","import {idFromReference} from './helpers.js'\r\nimport {map} from './utils.js'\r\nimport {adopt} from './adopter.js'\r\n\r\n// // Method for getting an element by id\r\n// SVG.get = function (id) {\r\n// var node = document.getElementById(idFromReference(id) || id)\r\n// return SVG.adopt(node)\r\n// }\r\n//\r\n// // Select elements by query string\r\n// SVG.select = function (query, parent) {\r\n// return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {\r\n// return SVG.adopt(node)\r\n// })\r\n// }\r\n//\r\n// SVG.$$ = function (query, parent) {\r\n// return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {\r\n// return SVG.adopt(node)\r\n// })\r\n// }\r\n//\r\n// SVG.$ = function (query, parent) {\r\n// return SVG.adopt((parent || document).querySelector(query))\r\n// }\r\n\r\nexport default function baseFind (query, parent) {\r\n return utils.map((parent || document).querySelectorAll(query), function (node) {\r\n return adopt(node)\r\n })\r\n}\r\n\r\n// Scoped find method\r\nexport function find (query) {\r\n return baseFind(query, this.node)\r\n}\r\n","import {camelCase} from './helpers.js'\r\nimport {isBlank} from './regex.js'\r\n\r\n // Dynamic style generator\r\nexport function css (style, val) {\r\n let ret = {}\r\n let i\r\n if (arguments.length === 0) {\r\n // get full style as object\r\n this.node.style.cssText.split(/\\s*;\\s*/)\r\n .filter(function (el) { return !!el.length })\r\n .forEach(function (el) {\r\n let t = el.split(/\\s*:\\s*/)\r\n ret[t[0]] = t[1]\r\n })\r\n return ret\r\n }\r\n\r\n if (arguments.length < 2) {\r\n // get style properties in the array\r\n if (Array.isArray(style)) {\r\n for (let name of style) {\r\n let cased = camelCase(name)\r\n ret[cased] = this.node.style(cased)\r\n }\r\n return ret\r\n }\r\n\r\n // get style for property\r\n if (typeof style === 'string') {\r\n return this.node.style[camelCase(style)]\r\n }\r\n\r\n // set styles in object\r\n if (typeof style === 'object') {\r\n for (name in style) {\r\n // set empty string if null/undefined/'' was given\r\n this.node.style[camelCase(name)] =\r\n (style[name] == null || isBlank.test(style[name])) ? '' : style[name]\r\n }\r\n }\r\n }\r\n\r\n // set style for property\r\n if (arguments.length === 2) {\r\n this.node.style[camelCase(style)] =\r\n (val == null || isBlank.test(val)) ? '' : val\r\n }\r\n\r\n return this\r\n}\r\n\r\n // Show element\r\nexport function show () {\r\n return this.css('display', '')\r\n}\r\n\r\n // Hide element\r\nexport function hide () {\r\n return this.css('display', 'none')\r\n}\r\n\r\n // Is element visible?\r\nexport function visible () {\r\n return this.css('display') !== 'none'\r\n}\r\n","import {arrayToMatrix, getOrigin, isMatrixLike} from './helpers.js'\r\nimport Matrix from './Matrix.js'\r\nimport {delimiter, transforms} from './regex.js'\r\n\r\n// Reset all transformations\r\nexport function untransform () {\r\n return this.attr('transform', null)\r\n}\r\n\r\n// merge the whole transformation chain into one matrix and returns it\r\nexport function matrixify () {\r\n var matrix = (this.attr('transform') || '')\r\n // split transformations\r\n .split(transforms).slice(0, -1).map(function (str) {\r\n // generate key => value pairs\r\n var kv = str.trim().split('(')\r\n return [kv[0],\r\n kv[1].split(delimiter)\r\n .map(function (str) { return parseFloat(str) })\r\n ]\r\n })\r\n .reverse()\r\n // merge every transformation into one matrix\r\n .reduce(function (matrix, transform) {\r\n if (transform[0] === 'matrix') {\r\n return matrix.lmultiply(arrayToMatrix(transform[1]))\r\n }\r\n return matrix[transform[0]].apply(matrix, transform[1])\r\n }, new Matrix())\r\n\r\n return matrix\r\n}\r\n\r\n// add an element to another parent without changing the visual representation on the screen\r\nexport function toParent (parent) {\r\n if (this === parent) return this\r\n var ctm = this.screenCTM()\r\n var pCtm = parent.screenCTM().inverse()\r\n\r\n this.addTo(parent).untransform().transform(pCtm.multiply(ctm))\r\n\r\n return this\r\n}\r\n\r\n// same as above with parent equals root-svg\r\nexport function toDoc () {\r\n return this.toParent(this.doc())\r\n}\r\n\r\n// Add transformations\r\nexport function transform (o, relative) {\r\n // Act as a getter if no object was passed\r\n if (o == null || typeof o === 'string') {\r\n var decomposed = new Matrix(this).decompose()\r\n return decomposed[o] || decomposed\r\n }\r\n\r\n if (!isMatrixLike(o)) {\r\n // Set the origin according to the defined transform\r\n o = {...o, origin: getOrigin(o, this)}\r\n }\r\n\r\n // The user can pass a boolean, an Element or an Matrix or nothing\r\n var cleanRelative = relative === true ? this : (relative || false)\r\n var result = new Matrix(cleanRelative).transform(o)\r\n return this.attr('transform', result)\r\n}\r\n","import {isNumber, isImage} from './regex.js'\r\nimport {attrs as defaults} from './defaults.js'\r\nimport Color from './Color.js'\r\nimport SVGArray from './SVGArray.js'\r\nimport Image from './Image.js'\r\nimport SVGNumber from './SVGNumber.js'\r\n\r\n// Set svg element attribute\r\nexport default function attr (attr, val, ns) {\r\n // act as full getter\r\n if (attr == null) {\r\n // get an object of attributes\r\n attr = {}\r\n val = this.node.attributes\r\n\r\n for (let node of val) {\r\n attr[node.nodeName] = isNumer.test(node.nodeValue)\r\n ? parseFloat(node.nodeValue)\r\n : node.nodeValue\r\n }\r\n\r\n return attr\r\n } else if (Array.isArray(attr)) {\r\n // FIXME: implement\r\n } else if (typeof attr === 'object') {\r\n // apply every attribute individually if an object is passed\r\n for (val in attr) this.attr(val, attr[val])\r\n } else if (val === null) {\r\n // remove value\r\n this.node.removeAttribute(attr)\r\n } else if (val == null) {\r\n // act as a getter if the first and only argument is not an object\r\n val = this.node.getAttribute(attr)\r\n return val == null ? defaults[attr] // FIXME: do we need to return defaults?\r\n : isNumber.test(val) ? parseFloat(val)\r\n : val\r\n } else {\r\n // convert image fill and stroke to patterns\r\n if (attr === 'fill' || attr === 'stroke') {\r\n if (isImage.test(val)) {\r\n val = this.doc().defs().image(val)\r\n }\r\n\r\n if (val instanceof Image) {\r\n val = this.doc().defs().pattern(0, 0, function () {\r\n this.add(val)\r\n })\r\n }\r\n }\r\n\r\n // ensure correct numeric values (also accepts NaN and Infinity)\r\n if (typeof val === 'number') {\r\n val = new SVGNumber(val)\r\n } else if (Color.isColor(val)) {\r\n // ensure full hex color\r\n val = new Color(val)\r\n } else if (Array.isArray(val)) {\r\n // parse array values\r\n val = new SVGArray(val)\r\n }\r\n\r\n // if the passed attribute is leading...\r\n if (attr === 'leading') {\r\n // ... call the leading method instead\r\n if (this.leading) {\r\n this.leading(val)\r\n }\r\n } else {\r\n // set given attribute on node\r\n typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())\r\n : this.node.setAttribute(attr, val.toString())\r\n }\r\n\r\n // rebuild if required\r\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\r\n this.rebuild()\r\n }\r\n }\r\n\r\n return this\r\n}\r\n","import {proportionalSize, matcher} from './helpers.js'\r\nimport {makeInstance, adopt, assignNewId, eid} from './adopter.js'\r\nimport {delimiter} from './regex.js'\r\nimport {ns} from './namespaces.js'\r\nimport Doc from './Doc.js'\r\nimport SVGNumber from './SVGNumber.js'\r\n\r\nexport const name = 'Element'\r\n\r\nexport function setup (node) {\r\n // initialize data object\r\n this.dom = {}\r\n\r\n // create circular reference\r\n this.node = node\r\n\r\n this.type = node.nodeName\r\n this.node.instance = this\r\n\r\n if (node.hasAttribute('svgjs:data')) {\r\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\r\n this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {})\r\n }\r\n}\r\n\r\n // Move over x-axis\r\nexport function x (x) {\r\n return this.attr('x', x)\r\n}\r\n\r\n // Move over y-axis\r\nexport function y (y) {\r\n return this.attr('y', y)\r\n}\r\n\r\n // Move by center over x-axis\r\nexport function cx (x) {\r\n return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)\r\n}\r\n\r\n // Move by center over y-axis\r\nexport function cy (y) {\r\n return y == null\r\n ? this.y() + this.height() / 2\r\n : this.y(y - this.height() / 2)\r\n}\r\n\r\n // Move element to given x and y values\r\nexport function move (x, y) {\r\n return this.x(x).y(y)\r\n}\r\n\r\n // Move element by its center\r\nexport function center (x, y) {\r\n return this.cx(x).cy(y)\r\n}\r\n\r\n // Set width of element\r\nexport function width (width) {\r\n return this.attr('width', width)\r\n}\r\n\r\n // Set height of element\r\nexport function height (height) {\r\n return this.attr('height', height)\r\n}\r\n\r\n // Set element size to given width and height\r\nexport function size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .width(new SVGNumber(p.width))\r\n .height(new SVGNumber(p.height))\r\n}\r\n\r\n // Clone element\r\nexport function clone (parent) {\r\n // write dom data to the dom so the clone can pickup the data\r\n this.writeDataToDom()\r\n\r\n // clone element and assign new id\r\n let clone = assignNewId(this.node.cloneNode(true))\r\n\r\n // insert the clone in the given parent or after myself\r\n if (parent) parent.add(clone)\r\n else this.after(clone)\r\n\r\n return clone\r\n}\r\n\r\n // Remove element\r\nexport function remove () {\r\n if (this.parent()) { this.parent().removeElement(this) }\r\n\r\n return this\r\n}\r\n\r\n // Replace element\r\nexport function replace (element) {\r\n this.after(element).remove()\r\n\r\n return element\r\n}\r\n\r\n // Add element to given container and return self\r\nexport function addTo (parent) {\r\n return makeInstance(parent).put(this)\r\n}\r\n\r\n // Add element to given container and return container\r\nexport function putIn (parent) {\r\n return makeInstance(parent).add(this)\r\n}\r\n\r\n // Get / set id\r\nexport function id (id) {\r\n // generate new id if no id set\r\n if (typeof id === 'undefined' && !this.node.id) {\r\n this.node.id = eid(this.type)\r\n }\r\n\r\n // dont't set directly width this.node.id to make `null` work correctly\r\n return this.attr('id', id)\r\n}\r\n\r\n // Checks whether the given point inside the bounding box of the element\r\nexport function inside (x, y) {\r\n let box = this.bbox()\r\n\r\n return x > box.x &&\r\n y > box.y &&\r\n x < box.x + box.width &&\r\n y < box.y + box.height\r\n}\r\n\r\n // Return id on string conversion\r\nexport function toString () {\r\n return this.id()\r\n}\r\n\r\n // Return array of classes on the node\r\nexport function classes () {\r\n var attr = this.attr('class')\r\n return attr == null ? [] : attr.trim().split(delimiter)\r\n}\r\n\r\n // Return true if class exists on the node, false otherwise\r\nexport function hasClass (name) {\r\n return this.classes().indexOf(name) !== -1\r\n}\r\n\r\n // Add class to the node\r\nexport function addClass (name) {\r\n if (!this.hasClass(name)) {\r\n var array = this.classes()\r\n array.push(name)\r\n this.attr('class', array.join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n // Remove class from the node\r\nexport function removeClass (name) {\r\n if (this.hasClass(name)) {\r\n this.attr('class', this.classes().filter(function (c) {\r\n return c !== name\r\n }).join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n // Toggle the presence of a class on the node\r\nexport function toggleClass (name) {\r\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\r\n}\r\n\r\n// FIXME: getIdFromReference\r\n// Get referenced element form attribute value\r\nexport function reference (attr) {\r\n return get(this.attr(attr))\r\n}\r\n\r\n // Returns the parent element instance\r\nexport function parent (type) {\r\n var parent = this\r\n\r\n // check for parent\r\n if (!parent.node.parentNode) return null\r\n\r\n // get parent element\r\n parent = adopt(parent.node.parentNode)\r\n\r\n if (!type) return parent\r\n\r\n // loop trough ancestors if type is given\r\n while (parent && parent.node instanceof window.SVGElement) {\r\n if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent\r\n parent = adopt(parent.node.parentNode)\r\n }\r\n}\r\n\r\n // Get parent document\r\nexport function doc () {\r\n let p = this.parent(Doc)\r\n return p && p.doc()\r\n}\r\n\r\n // Get defs\r\nexport function defs () {\r\n return this.doc().defs()\r\n}\r\n\r\n // return array of all ancestors of given type up to the root svg\r\nexport function parents (type) {\r\n let parents = []\r\n let parent = this\r\n\r\n do {\r\n parent = parent.parent(type)\r\n if (!parent || !parent.node) break\r\n\r\n parents.push(parent)\r\n } while (parent.parent)\r\n\r\n return parents\r\n}\r\n\r\n // matches the element vs a css selector\r\nexport function matches (selector) {\r\n return matches(this.node, selector)\r\n}\r\n\r\n // Returns the svg node to call native svg methods on it\r\nexport function native () {\r\n return this.node\r\n}\r\n\r\n // Import raw svg\r\nexport function svg () {\r\n // write svgjs data to the dom\r\n this.writeDataToDom()\r\n\r\n return this.node.outerHTML\r\n}\r\n\r\n // write svgjs data to the dom\r\nexport function writeDataToDom () {\r\n // remove previously set data\r\n this.node.removeAttribute('svgjs:data')\r\n\r\n if (Object.keys(this.dom).length) {\r\n this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428\r\n }\r\n return this\r\n}\r\n\r\n // set given data to the elements data property\r\nexport function setData (o) {\r\n this.dom = o\r\n return this\r\n}\r\n\r\nexport function getEventTarget () {\r\n return this.node\r\n}\r\n\r\nexport {default as attr} from './attr.js'\r\n","import {remove, attr} from './Element.js'\r\nimport {find} from './selector.js'\r\nimport {makeInstance} from './adopter.js'\r\n\r\n// Unclip all clipped elements and remove itself\r\nexport function clipPathRemove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unclip()\r\n })\r\n\r\n // remove clipPath from parent\r\n return remove.call(this)\r\n}\r\n\r\nexport function clipPathTargets () {\r\n return find('svg [clip-path*=\"' + this.id() + '\"]')\r\n}\r\n\r\n// Unclip all clipped elements and remove itself\r\nexport function maskRemove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unmask()\r\n })\r\n\r\n // remove clipPath from parent\r\n return remove.call(this)\r\n}\r\n\r\nexport function maskTargets () {\r\n return find('svg [mask*=\"' + this.id() + '\"]')\r\n}\r\n\r\n// Unclip all clipped elements and remove itself\r\nexport function patternGradientRemove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unFill()\r\n })\r\n\r\n // remove clipPath from parent\r\n return remove.call(this)\r\n}\r\n\r\nexport function unFill () {\r\n this.attr('fill', null)\r\n}\r\n\r\nexport function patternGradientTargets () {\r\n return find('svg [fill*=\"' + this.id() + '\"]')\r\n}\r\n\r\n// custom attr to handle transform\r\nexport function patternAttr (a, b, c) {\r\n if (a === 'transform') a = 'patternTransform'\r\n return attr.call(this, a, b, c)\r\n}\r\n\r\n// custom attr to handle transform\r\nexport function gradientAttr (a, b, c) {\r\n if (a === 'transform') a = 'gradientTransform'\r\n return attr.call(this, a, b, c)\r\n}\r\n\r\nexport function pathTargets () {\r\n return find('svg textpath [href*=\"' + this.id() + '\"]')\r\n}\r\n\r\nexport function HtmlNodeAdd (element, i) {\r\n element = makeInstance(element)\r\n\r\n if (element.node !== this.node.children[i]) {\r\n this.node.insertBefore(element.node, this.node.children[i] || null)\r\n }\r\n\r\n return this\r\n}\r\n","import {on as _on, off as _off, dispatch as _dispatch} from './event.js'\r\n\r\nexport const name = 'EventTarget'\r\n\r\nexport function setup (node = {}) {\r\n this.events = node.events || {}\r\n}\r\n\r\n // Bind given event to listener\r\nexport function on (event, listener, binding, options) {\r\n _on(this, event, listener, binding, options)\r\n return this\r\n}\r\n\r\n // Unbind event from listener\r\nexport function off (event, listener) {\r\n _off(this, event, listener)\r\n return this\r\n}\r\n\r\nexport function dispatch (event, data) {\r\n return _dispatch(this, event, data)\r\n}\r\n\r\n // Fire given event\r\nexport function fire (event, data) {\r\n this.dispatch(event, data)\r\n return this\r\n}\r\n","import {makeInstance, adopt} from './adopter.js'\r\nimport {map} from './utils.js'\r\n\r\n\r\n// Returns all child elements\r\nexport function children () {\r\n return map(this.node.children, function (node) {\r\n return adopt(node)\r\n })\r\n}\r\n\r\n// Add given element at a position\r\nexport function add (element, i) {\r\n element = makeInstance(element)\r\n\r\n if (element.node !== this.node.children[i]) {\r\n this.node.insertBefore(element.node, this.node.children[i] || null)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Basically does the same as `add()` but returns the added element instead\r\nexport function put (element, i) {\r\n this.add(element, i)\r\n return element.instance || element\r\n}\r\n\r\n// Checks if the given element is a child\r\nexport function has (element) {\r\n return this.index(element) >= 0\r\n}\r\n\r\n// Gets index of given element\r\nexport function index (element) {\r\n return [].slice.call(this.node.children).indexOf(element.node)\r\n}\r\n\r\n// Get a element at the given index\r\nexport function get (i) {\r\n return adopt(this.node.children[i])\r\n}\r\n\r\n// Get first child\r\nexport function first () {\r\n return this.get(0)\r\n}\r\n\r\n// Get the last child\r\nexport function last () {\r\n return this.get(this.node.children.length - 1)\r\n}\r\n\r\n// Iterates over all children and invokes a given block\r\nexport function each (block, deep) {\r\n var children = this.children()\r\n var i, il\r\n\r\n for (i = 0, il = children.length; i < il; i++) {\r\n if (children[i] instanceof Base) {\r\n block.apply(children[i], [i, children])\r\n }\r\n\r\n if (deep && (children[i] instanceof Base && children[i].is('Parent'))) {\r\n children[i].each(block, deep)\r\n }\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Remove a given child\r\nexport function removeElement (element) {\r\n this.node.removeChild(element.node)\r\n\r\n return this\r\n}\r\n\r\n// Remove all elements in this container\r\nexport function clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n\r\n // remove defs reference\r\n delete this._defs\r\n\r\n return this\r\n}\r\n\r\n// Import raw svg\r\nexport function svg (svg) {\r\n var well, len\r\n\r\n // act as a setter if svg is given\r\n if (svg) {\r\n // create temporary holder\r\n well = document.createElementNS(ns, 'svg')\r\n // dump raw svg\r\n well.innerHTML = svg\r\n\r\n // transplant nodes\r\n for (len = well.children.length; len--;) {\r\n this.node.appendChild(well.firstElementChild)\r\n }\r\n\r\n // otherwise act as a getter\r\n } else {\r\n // write svgjs data to the dom\r\n this.writeDataToDom()\r\n\r\n return this.node.outerHTML\r\n }\r\n\r\n return this\r\n}\r\n\r\n// write svgjs data to the dom\r\nexport function writeDataToDom () {\r\n // dump variables recursively\r\n this.each(function () {\r\n this.writeDataToDom()\r\n })\r\n\r\n // remove previously set data\r\n this.node.removeAttribute('svgjs:data')\r\n\r\n if (Object.keys(this.dom).length) {\r\n this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428\r\n }\r\n return this\r\n}\r\n\r\nexport function flatten (parent) {\r\n this.each(function () {\r\n if (this.is('Parent')) return this.flatten(parent).ungroup(parent)\r\n return this.toParent(parent)\r\n })\r\n\r\n // we need this so that Doc does not get removed\r\n this.node.firstElementChild || this.remove()\r\n\r\n return this\r\n}\r\n\r\nexport function ungroup (parent) {\r\n parent = parent || this.parent()\r\n\r\n this.each(function () {\r\n return this.toParent(parent)\r\n })\r\n\r\n this.remove()\r\n\r\n return this\r\n}\r\n","// import {extend} from './tools.js'\r\n// import * as Element from './Element.js'\r\n// import Defs from './Defs.js'\r\n//\r\n// extend(Defs, [EventTarget, Element, Parent])\r\n\r\nimport {makeInstance} from './adopter.js'\r\nimport * as Classes from './classes.js'\r\nimport * as adopter from './adopter.js'\r\nimport * as tools from './tools.js'\r\nimport * as containers from './containers.js'\r\nimport * as elements from './elements.js'\r\nimport * as arrange from './arrange.js'\r\nimport {find} from './selector.js'\r\nimport * as css from './css.js'\r\nimport * as transform from './transform.js'\r\nimport * as specialNeeds from './specialNeeds.js'\r\nconst extend = tools.extend\r\n\r\nimport * as EventTarget from './EventTarget.js'\r\nimport * as Element from './Element.js'\r\nimport * as Parent from './Parent.js'\r\n\r\nextend([\r\n Classes.Doc,\r\n Classes.Symbol,\r\n Classes.Image,\r\n Classes.Pattern,\r\n Classes.Marker\r\n], {viewbox: Classes.Box.constructors.viewbox})\r\n\r\nextend([Classes.Line, Classes.Polyline, Classes.Polygon, Classes.Path], {\r\n ...Classes.Marker.constructors.marker\r\n})\r\n\r\nextend(Classes.Text, Classes.TextPath.constructors.Text)\r\nextend(Classes.Path, Classes.TextPath.constructors.Path)\r\n\r\nextend(Classes.Defs, {\r\n ...Classes.Gradient.constructors.Defs,\r\n ...Classes.Marker.constructors.Defs,\r\n ...Classes.Pattern.constructors.Defs,\r\n})\r\n\r\nextend([Classes.Text, Classes.Tspan], Classes.Tspan.constructors.Tspan)\r\n\r\nextend([Classes.Gradient, Classes.Pattern], {\r\n remove: specialNeeds.patternGradientRemove,\r\n targets: specialNeeds.patternGradientTargets,\r\n unFill: specialNeeds.unFill,\r\n})\r\n\r\nextend(Classes.Gradient, {attr: specialNeeds.gradientAttr})\r\nextend(Classes.Pattern, {attr: specialNeeds.patternAttr})\r\n\r\nextend(Classes.ClipPath, {\r\n remove: specialNeeds.clipPathRemove,\r\n targets: specialNeeds.clipPathTargets\r\n})\r\n\r\nextend(Classes.Mask, {\r\n remove: specialNeeds.maskRemove,\r\n targets: specialNeeds.maskTargets\r\n})\r\n\r\nextend(Classes.Path, {targets: specialNeeds.pathTargets})\r\n\r\nextend(Classes.HtmlNode, {\r\n add: specialNeeds.HtmlNodeAdd\r\n})\r\n\r\nfor (let i in containers) {\r\n extend(containers[i], {\r\n ...Classes.A.constructors.Container,\r\n ...Classes.ClipPath.constructors.Container,\r\n ...Classes.Doc.constructors.Container,\r\n ...Classes.G.constructors.Container,\r\n ...Classes.Gradient.constructors.Container,\r\n ...Classes.Line.constructors.Container,\r\n ...Classes.Marker.constructors.Container,\r\n ...Classes.Mask.constructors.Container,\r\n ...Classes.Path.constructors.Container,\r\n ...Classes.Pattern.constructors.Container,\r\n ...Classes.Polygon.constructors.Container,\r\n ...Classes.Polyline.constructors.Container,\r\n ...Classes.Rect.constructors.Container,\r\n find,\r\n ...Classes.Symbol.constructors.Container,\r\n ...Classes.Text.constructors.Container,\r\n ...Classes.TextPath.constructors.Container,\r\n ...Classes.Use.constructors.Container,\r\n })\r\n}\r\n\r\nfor (let i in elements) {\r\n extend(elements[i], {\r\n ...EventTarget,\r\n ...Element,\r\n ...Parent,\r\n ...arrange,\r\n ...Classes.A.constructors.Element,\r\n ...Classes.Box.constructors.Element,\r\n ...Classes.Circle.constructors.Element,\r\n ...Classes.ClipPath.constructors.Element,\r\n ...css,\r\n ...Classes.Image.constructors.Element,\r\n ...Classes.Mask.constructors.Element,\r\n ...Classes.Matrix.constructors.Element,\r\n ...Classes.Point.constructors.Element,\r\n ...Classes.Runner.constructors.Element,\r\n ...Classes.Timeline.constructors.Element,\r\n ...transform,\r\n })\r\n}\r\n\r\n\r\n// The main wrapping element\r\nexport default function SVG (element) {\r\n return makeInstance(element)\r\n}\r\n\r\nObject.assign(SVG, Classes)\r\nObject.assign(SVG, tools)\r\nObject.assign(SVG, adopter)\r\n"],"names":["Base","ns","hex","proportionalSize","nodeOrNew","makeNode","extend","rx","ry","size","Doc","ArrayPolyfill","PointArray","x","y","width","height","Text","adopt","elements.HtmlNode","elements.Doc","elements.Gradient","elements.Bare","Box","timeline","defaults","name","cx","cy","move","attr","reference","getEventTarget","setup","on","_on","off","_off","dispatch","_dispatch","get","clear","svg","writeDataToDom","tools.extend","Classes.Doc","Classes.Symbol","Classes.Image","Classes.Pattern","Classes.Marker","Classes.Box","Classes.Line","Classes.Polyline","Classes.Polygon","Classes.Path","Classes.Text","Classes.TextPath","Classes.Defs","Classes.Gradient","Classes.Tspan","specialNeeds.patternGradientRemove","specialNeeds.patternGradientTargets","specialNeeds.unFill","specialNeeds.gradientAttr","specialNeeds.patternAttr","Classes.ClipPath","specialNeeds.clipPathRemove","specialNeeds.clipPathTargets","Classes.Mask","specialNeeds.maskRemove","specialNeeds.maskTargets","specialNeeds.pathTargets","Classes.HtmlNode","specialNeeds.HtmlNodeAdd","Classes.A","Classes.G","Classes.Rect","Classes.Use","Element","Classes.Circle","css","Classes.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