var SVG = (function () {
'use strict';
- class Base$1 {\r
- constructor (node, {extensions = []}) {\r
- this.tags = [];\r
-\r
- for (let extension of extensions) {\r
- extension.setup.call(this, node);\r
- this.tags.push(extension.name);\r
- }\r
- }\r
-\r
- is (ability) {\r
- return this.tags.includes(ability)\r
- }\r
+ 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);
}
- // Default namespaces\r
- let ns$1 = 'http://www.w3.org/2000/svg';\r
- let xmlns = 'http://www.w3.org/2000/xmlns/';\r
- let xlink = 'http://www.w3.org/1999/xlink';\r
- let svgjs = 'http://svgjs.com/svgjs';
-
- // Parse unit value\r
- let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i;\r
-\r
- // Parse hex value\r
- let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;\r
-\r
- // Parse rgb value\r
- let rgb = /rgb\((\d+),(\d+),(\d+)\)/;\r
-\r
- // splits a transformation chain\r
- let transforms = /\)\s*,?\s*/;\r
-\r
- // Whitespace\r
- let whitespace = /\s/g;\r
-\r
- // Test hex value\r
- let isHex = /^#[a-f0-9]{3,6}$/i;\r
-\r
- // Test rgb value\r
- let isRgb = /^rgb\(/;\r
-\r
- // Test for blank string\r
- let isBlank = /^(\s+)?$/;\r
-\r
- // Test for numeric string\r
- let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;\r
-\r
- // Test for image url\r
- let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i;\r
-\r
- // split at whitespace and comma\r
- let delimiter = /[\s,]+/;\r
-\r
- // The following regex are used to parse the d attribute of a path\r
-\r
- // Matches all hyphens which are not after an exponent\r
- let hyphen = /([^e])-/gi;\r
-\r
- // Replaces and tests for all path letters\r
- let pathLetters = /[MLHVCSQTAZ]/gi;\r
-\r
- // yes we need this one, too\r
- let isPathLetter = /[MLHVCSQTAZ]/i;\r
-\r
- // matches 0.154.23.45\r
- let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi;\r
-\r
- // matches .\r
- let dots = /\./g;
-
- function isNulledBox (box) {\r
- return !box.w && !box.h && !box.x && !box.y\r
- }\r
-\r
- function domContains (node) {\r
- return (document.documentElement.contains || function (node) {\r
- // This is IE - it does not support contains() for top-level SVGs\r
- while (node.parentNode) {\r
- node = node.parentNode;\r
- }\r
- return node === document\r
- }).call(document.documentElement, node)\r
- }\r
-\r
- function pathRegReplace (a, b, c, d) {\r
- return c + d.replace(dots, ' .')\r
- }\r
-\r
- // Convert dash-separated-string to camelCase\r
- function camelCase (s) {\r
- return s.toLowerCase().replace(/-(.)/g, function (m, g) {\r
- return g.toUpperCase()\r
- })\r
- }\r
-\r
- // Capitalize first letter of a string\r
- function capitalize (s) {\r
- return s.charAt(0).toUpperCase() + s.slice(1)\r
- }\r
-\r
- // Ensure to six-based hex\r
- function fullHex (hex$$1) {\r
- return hex$$1.length === 4\r
- ? [ '#',\r
- hex$$1.substring(1, 2), hex$$1.substring(1, 2),\r
- hex$$1.substring(2, 3), hex$$1.substring(2, 3),\r
- hex$$1.substring(3, 4), hex$$1.substring(3, 4)\r
- ].join('')\r
- : hex$$1\r
- }\r
-\r
- // Component to hex value\r
- function compToHex (comp) {\r
- var hex$$1 = comp.toString(16);\r
- return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1\r
- }\r
-\r
- // Calculate proportional width and height values when necessary\r
- function proportionalSize$1 (element, width, height) {\r
- if (width == null || height == null) {\r
- var box = element.bbox();\r
-\r
- if (width == null) {\r
- width = box.width / box.height * height;\r
- } else if (height == null) {\r
- height = box.height / box.width * width;\r
- }\r
- }\r
-\r
- return {\r
- width: width,\r
- height: height\r
- }\r
- }\r
-\r
- // Map matrix array to object\r
- function arrayToMatrix (a) {\r
- return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\r
- }\r
-\r
- // PathArray Helpers\r
- function arrayToString (a) {\r
- for (var i = 0, il = a.length, s = ''; i < il; i++) {\r
- s += a[i][0];\r
-\r
- if (a[i][1] != null) {\r
- s += a[i][1];\r
-\r
- if (a[i][2] != null) {\r
- s += ' ';\r
- s += a[i][2];\r
-\r
- if (a[i][3] != null) {\r
- s += ' ';\r
- s += a[i][3];\r
- s += ' ';\r
- s += a[i][4];\r
-\r
- if (a[i][5] != null) {\r
- s += ' ';\r
- s += a[i][5];\r
- s += ' ';\r
- s += a[i][6];\r
-\r
- if (a[i][7] != null) {\r
- s += ' ';\r
- s += a[i][7];\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- return s + ' '\r
- }\r
-\r
- // Add more bounding box properties\r
- function fullBox (b) {\r
- if (b.x == null) {\r
- b.x = 0;\r
- b.y = 0;\r
- b.width = 0;\r
- b.height = 0;\r
- }\r
-\r
- b.w = b.width;\r
- b.h = b.height;\r
- b.x2 = b.x + b.width;\r
- b.y2 = b.y + b.height;\r
- b.cx = b.x + b.width / 2;\r
- b.cy = b.y + b.height / 2;\r
-\r
- return b\r
- }\r
-\r
- // Create matrix array for looping\r
- let abcdef = 'abcdef'.split('');\r
-\r
- function closeEnough (a, b, threshold) {\r
- return Math.abs(b - a) < (threshold || 1e-6)\r
- }\r
-\r
- function isMatrixLike (o) {\r
- return (\r
- o.a != null ||\r
- o.b != null ||\r
- o.c != null ||\r
- o.d != null ||\r
- o.e != null ||\r
- o.f != null\r
- )\r
- }\r
-\r
- function getOrigin (o, element) {\r
- // Allow origin or around as the names\r
- let origin = o.origin; // o.around == null ? o.origin : o.around\r
- let ox, oy;\r
-\r
- // Allow the user to pass a string to rotate around a given point\r
- if (typeof origin === 'string' || origin == null) {\r
- // Get the bounding box of the element with no transformations applied\r
- const string = (origin || 'center').toLowerCase().trim();\r
- const { height, width, x, y } = element.bbox();\r
-\r
- // Calculate the transformed x and y coordinates\r
- let bx = string.includes('left') ? x\r
- : string.includes('right') ? x + width\r
- : x + width / 2;\r
- let by = string.includes('top') ? y\r
- : string.includes('bottom') ? y + height\r
- : y + height / 2;\r
-\r
- // Set the bounds eg : "bottom-left", "Top right", "middle" etc...\r
- ox = o.ox != null ? o.ox : bx;\r
- oy = o.oy != null ? o.oy : by;\r
- } else {\r
- ox = origin[0];\r
- oy = origin[1];\r
- }\r
-\r
- // Return the origin as it is if it wasn't a string\r
- return [ ox, oy ]\r
+ function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
}
- function nodeOrNew$1 (name, node) {\r
- return node || makeNode$1(name)\r
- }\r
-\r
- // Method for element creation\r
- function makeNode$1 (name) {\r
- // create element\r
- return document.createElementNS(ns$1, name)\r
- }\r
-\r
- // Method for extending objects\r
- function extend$1 (modules, methods) {\r
- var key, i;\r
-\r
- if (Array.isArray(methods)) {\r
- methods.forEach((method) => {\r
- extend$1(modules, method);\r
- });\r
- return\r
- }\r
-\r
- modules = Array.isArray(modules) ? modules : [modules];\r
-\r
- for (i = modules.length - 1; i >= 0; i--) {\r
- if (methods.name) {\r
- modules[i].extensions = (modules[i].extensions || []).concat(methods);\r
- }\r
- for (key in methods) {\r
- if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue\r
- modules[i].prototype[key] = methods[key];\r
- }\r
- }\r
- }\r
-\r
- // FIXME: enhanced constructors here\r
- function addFactory (modules, methods) {\r
- extend$1(modules, methods);\r
- }\r
-\r
- // Invent new element\r
- function invent (config) {\r
- // Create element initializer\r
- var initializer = typeof config.create === 'function' ? config.create\r
- : function (node) {\r
- config.inherit.call(this, node || makeNode$1(config.create));\r
- };\r
-\r
- // Inherit prototype\r
- if (config.inherit) {\r
- initializer.prototype = new config.inherit();\r
- initializer.prototype.constructor = initializer;\r
- }\r
-\r
- // Extend with methods\r
- if (config.extend) {\r
- extend$1(initializer, config.extend);\r
- }\r
-\r
- // Attach construct method to parent\r
- if (config.construct) { extend$1(config.parent || Container, config.construct); }\r
-\r
- return initializer\r
+ 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);
+ }
}
- var tools = /*#__PURE__*/Object.freeze({
- nodeOrNew: nodeOrNew$1,
- makeNode: makeNode$1,
- extend: extend$1,
- addFactory: addFactory,
- invent: invent
- });
+ function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+ }
- function Bare (element, inherit = {}) {\r
- let custom = class Custom extends inherit {\r
- constructor (node) {\r
- super(nodeOrNew$1(element, node), Custom);\r
- }\r
-\r
- words (text) {\r
- // remove contents\r
- while (this.node.hasChildNodes()) {\r
- this.node.removeChild(this.node.lastChild);\r
- }\r
-\r
- // create text node\r
- this.node.appendChild(document.createTextNode(text));\r
-\r
- return this\r
- }\r
- };\r
-\r
- extend(custom, inherit);\r
- }\r
-\r
- // export let constructors = {\r
- // // Create an element that is not described by SVG.js\r
- // element: function (element, inherit) {\r
- // let custom = createCustom(element, inherit)\r
- // return this.put(new custom())\r
- // }\r
- // }\r
-\r
- // extend(Parent, {\r
- // // Create an element that is not described by SVG.js\r
- // element: function (element, inherit) {\r
- // let custom = createCustom(element, inherit)\r
- // return this.put(new custom())\r
- // }\r
- // })
+ 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;
+ }
- // Module for unit convertions\r
- class SVGNumber {\r
- // Initialize\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (value, unit) {\r
- unit = Array.isArray(value) ? value[1] : unit;\r
- value = Array.isArray(value) ? value[0] : value;\r
-\r
- // initialize defaults\r
- this.value = 0;\r
- this.unit = unit || '';\r
-\r
- // parse value\r
- if (typeof value === 'number') {\r
- // ensure a valid numeric value\r
- this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value;\r
- } else if (typeof value === 'string') {\r
- unit = value.match(numberAndUnit);\r
-\r
- if (unit) {\r
- // make value numeric\r
- this.value = parseFloat(unit[1]);\r
-\r
- // normalize\r
- if (unit[5] === '%') { this.value /= 100; } else if (unit[5] === 's') {\r
- this.value *= 1000;\r
- }\r
-\r
- // store unit\r
- this.unit = unit[5];\r
- }\r
- } else {\r
- if (value instanceof SVGNumber) {\r
- this.value = value.valueOf();\r
- this.unit = value.unit;\r
- }\r
- }\r
- }\r
-\r
- toString () {\r
- return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6\r
- : this.unit === 's' ? this.value / 1e3\r
- : this.value\r
- ) + this.unit\r
- }\r
-\r
- toJSON () {\r
- return this.toString()\r
- }\r
-\r
-\r
- toArray () {\r
- return [this.value, this.unit]\r
- }\r
-\r
- valueOf () {\r
- return this.value\r
- }\r
-\r
- // Add number\r
- plus (number) {\r
- number = new SVGNumber(number);\r
- return new SVGNumber(this + number, this.unit || number.unit)\r
- }\r
-\r
- // Subtract number\r
- minus (number) {\r
- number = new SVGNumber(number);\r
- return new SVGNumber(this - number, this.unit || number.unit)\r
- }\r
-\r
- // Multiply number\r
- times (number) {\r
- number = new SVGNumber(number);\r
- return new SVGNumber(this * number, this.unit || number.unit)\r
- }\r
-\r
- // Divide number\r
- divide (number) {\r
- number = new SVGNumber(number);\r
- return new SVGNumber(this / number, this.unit || number.unit)\r
- }\r
+ return obj;
}
- // FIXME: import this to runner\r
-\r
- // Radius x value\r
- function rx (rx) {\r
- return this.attr('rx', rx)\r
- }\r
-\r
- // Radius y value\r
- function ry (ry) {\r
- return this.attr('ry', ry)\r
- }\r
-\r
- // Move over x-axis\r
- function x (x) {\r
- return x == null\r
- ? this.cx() - this.rx()\r
- : this.cx(x + this.rx())\r
- }\r
-\r
- // Move over y-axis\r
- function y (y) {\r
- return y == null\r
- ? this.cy() - this.ry()\r
- : this.cy(y + this.ry())\r
- }\r
-\r
- // Move by center over x-axis\r
- function cx (x) {\r
- return x == null\r
- ? this.attr('cx')\r
- : this.attr('cx', x)\r
- }\r
-\r
- // Move by center over y-axis\r
- function cy (y) {\r
- return y == null\r
- ? this.attr('cy')\r
- : this.attr('cy', y)\r
- }\r
-\r
- // Set width of element\r
- function width (width) {\r
- return width == null\r
- ? this.rx() * 2\r
- : this.rx(new SVGNumber(width).divide(2))\r
- }\r
-\r
- // Set height of element\r
- function height (height) {\r
- return height == null\r
- ? this.ry() * 2\r
- : this.ry(new SVGNumber(height).divide(2))\r
- }\r
-\r
- // Custom size function\r
- function size (width, height) {\r
- var p = proportionalSize$1(this, width, height);\r
-\r
- return this\r
- .rx(new SVGNumber(p.width).divide(2))\r
- .ry(new SVGNumber(p.height).divide(2))\r
+ 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;
}
- var circled = /*#__PURE__*/Object.freeze({
- rx: rx,
- ry: ry,
- x: x,
- y: y,
- cx: cx,
- cy: cy,
- width: width,
- height: height,
- size: size
- });
+ function _inherits(subClass, superClass) {
+ if (typeof superClass !== "function" && superClass !== null) {
+ throw new TypeError("Super expression must either be null or a function");
+ }
- class Circle extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew$1('circle', node), Circle);\r
- }\r
-\r
- radius (r) {\r
- return this.attr('r', r)\r
- }\r
-\r
- // Radius x value\r
- rx (rx$$1) {\r
- return this.attr('r', rx$$1)\r
- }\r
-\r
- // Alias radius x value\r
- ry (ry$$1) {\r
- return this.rx(ry$$1)\r
- }\r
- }\r
-\r
- extend$1(Circle, {x, y, cx, cy, width, height, size});\r
-\r
- Circle.constructors = {\r
- Element: {\r
- // Create circle element\r
- circle (size$$1) {\r
- return this.put(new Circle())\r
- .radius(new SVGNumber(size$$1).divide(2))\r
- .move(0, 0)\r
- }\r
- }\r
- };
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ writable: true,
+ configurable: true
+ }
+ });
+ if (superClass) _setPrototypeOf(subClass, superClass);
+ }
- //import find from './selector.js'\r
- //import {remove} from './Element.js'\r
-\r
- class ClipPath extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew$1('clipPath', node), ClipPath);\r
- }\r
-\r
- // // Unclip all clipped elements and remove itself\r
- // remove () {\r
- // // unclip all targets\r
- // this.targets().forEach(function (el) {\r
- // el.unclip()\r
- // })\r
- //\r
- // // remove clipPath from parent\r
- // return remove.call(this)\r
- // }\r
- //\r
- // targets () {\r
- // return find('svg [clip-path*="' + this.id() + '"]')\r
- // }\r
- }\r
-\r
-\r
- ClipPath.constructors = {\r
- Container: {\r
- // Create clipping element\r
- clip: function() {\r
- return this.defs().put(new ClipPath)\r
- }\r
- },\r
- Element: {\r
- // Distribute clipPath to svg element\r
- clipWith (element) {\r
- // use given clip or create a new one\r
- let clipper = element instanceof ClipPath\r
- ? element\r
- : this.parent().clip().add(element);\r
-\r
- // apply mask\r
- return this.attr('clip-path', 'url("#' + clipper.id() + '")')\r
- },\r
-\r
- // Unclip element\r
- unclip () {\r
- return this.attr('clip-path', null)\r
- },\r
-\r
- clipper () {\r
- return this.reference('clip-path')\r
- }\r
- }\r
- };
+ 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;
+ };
- class Defs extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew$1('defs', node), Defs);\r
- }\r
-\r
- flatten () { return this }\r
- ungroup () { return this }\r
+ return _setPrototypeOf(o, p);
}
- //import {adopt} from './adopter.js'\r
-\r
- class Doc$1 extends Base$1 {\r
- constructor(node) {\r
- super(nodeOrNew$1('svg', node), Doc$1);\r
- this.namespace();\r
- }\r
-\r
- isRoot() {\r
- return !this.node.parentNode\r
- || !(this.node.parentNode instanceof window.SVGElement)\r
- || this.node.parentNode.nodeName === '#document'\r
- }\r
-\r
- // Check if this is a root svg\r
- // If not, call docs from this element\r
- doc() {\r
- if (this.isRoot()) return this\r
- return Element.doc.call(this)\r
- }\r
-\r
- // Add namespaces\r
- namespace() {\r
- if (!this.isRoot()) return this.doc().namespace()\r
- return this\r
- .attr({ xmlns: ns$1, version: '1.1' })\r
- .attr('xmlns:xlink', xlink, xmlns)\r
- .attr('xmlns:svgjs', svgjs, xmlns)\r
- }\r
-\r
- // Creates and returns defs element\r
- defs() {\r
- if (!this.isRoot()) return this.doc().defs()\r
-\r
- let node = this.node.getElementsByTagName('defs')[0];\r
- return node ? (node.instance || new Defs(node)) : this.put(new Defs())\r
- // \r
- // return adopt(this.node.getElementsByTagName('defs')[0]) ||\r
- // this.put(new Defs())\r
- }\r
-\r
- // custom parent method\r
- parent(type) {\r
- if (this.isRoot()) {\r
- return this.node.parentNode.nodeName === '#document'\r
- ? null\r
- : this.node.parentNode\r
- }\r
-\r
- return Element.parent.call(this, type)\r
- }\r
-\r
- // Removes the doc from the DOM\r
- remove() {\r
- if (!this.isRoot()) {\r
- return Element.remove.call(this)\r
- }\r
-\r
- if (this.parent()) {\r
- this.parent().removeChild(this.node);\r
- }\r
-\r
- return this\r
- }\r
-\r
- clear() {\r
- // remove children\r
- while (this.node.hasChildNodes()) {\r
- this.node.removeChild(this.node.lastChild);\r
- }\r
- return this\r
- }\r
- }\r
-\r
- Doc$1.constructors = {\r
- Container: {\r
- // Create nested svg document\r
- nested() {\r
- return this.put(new Doc$1())\r
- }\r
- }\r
- };
+ function isNativeReflectConstruct() {
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
+ if (Reflect.construct.sham) return false;
+ if (typeof Proxy === "function") return true;
- class Ellipse extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew('ellipse', node), Ellipse);\r
- }\r
- }\r
-\r
- extend$1(Ellipse, circled);\r
-\r
- // addFactory(Container, {\r
- // // Create an ellipse\r
- // ellipse: function (width, height) {\r
- // return this.put(new Ellipse()).size(width, height).move(0, 0)\r
- // }\r
- // })
+ try {
+ Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ function _construct(Parent, args, Class) {
+ if (isNativeReflectConstruct()) {
+ _construct = Reflect.construct;
+ } else {
+ _construct = function _construct(Parent, args, Class) {
+ var a = [null];
+ a.push.apply(a, args);
+ var Constructor = Function.bind.apply(Parent, a);
+ var instance = new Constructor();
+ if (Class) _setPrototypeOf(instance, Class.prototype);
+ return instance;
+ };
+ }
- class Stop extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew$1('stop', node), Stop);\r
- }\r
-\r
- // add color stops\r
- update (o) {\r
- if (typeof o === 'number' || o instanceof SVGNumber) {\r
- o = {\r
- offset: arguments[0],\r
- color: arguments[1],\r
- opacity: arguments[2]\r
- };\r
- }\r
-\r
- // set attributes\r
- if (o.opacity != null) this.attr('stop-opacity', o.opacity);\r
- if (o.color != null) this.attr('stop-color', o.color);\r
- if (o.offset != null) this.attr('offset', new SVGNumber(o.offset));\r
-\r
- return this\r
- }\r
+ return _construct.apply(null, arguments);
}
- // FIXME: add to runner\r
-\r
- function from (x, y) {\r
- return (this._element || this).type === 'radialGradient'\r
- ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\r
- : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\r
- }\r
-\r
- function to (x, y) {\r
- return (this._element || this).type === 'radialGradient'\r
- ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\r
- : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\r
+ function _isNativeFunction(fn) {
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
- var gradiented = /*#__PURE__*/Object.freeze({
- from: from,
- to: to
- });
+ function _wrapNativeSuper(Class) {
+ var _cache = typeof Map === "function" ? new Map() : undefined;
- //import attr from './attr.js'\r
-\r
- class Gradient extends Base$1 {\r
- constructor (type) {\r
- super(\r
- nodeOrNew$1(type + 'Gradient', typeof type === 'string' ? null : type),\r
- Gradient\r
- );\r
- }\r
-\r
- // Add a color stop\r
- stop (offset, color, opacity) {\r
- return this.put(new Stop()).update(offset, color, opacity)\r
- }\r
-\r
- // Update gradient\r
- update (block) {\r
- // remove all stops\r
- this.clear();\r
-\r
- // invoke passed block\r
- if (typeof block === 'function') {\r
- block.call(this, this);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Return the fill id\r
- url () {\r
- return 'url(#' + this.id() + ')'\r
- }\r
-\r
- // Alias string convertion to fill\r
- toString () {\r
- return this.url()\r
- }\r
-\r
- // // custom attr to handle transform\r
- // attr (a, b, c) {\r
- // if (a === 'transform') a = 'gradientTransform'\r
- // return attr.call(this, a, b, c)\r
- // }\r
- }\r
-\r
- extend$1(Gradient, gradiented);\r
-\r
- Gradient.constructors = {\r
- Container: {\r
- // Create gradient element in defs\r
- gradient (type, block) {\r
- return this.defs().gradient(type, block)\r
- }\r
- },\r
- // define gradient\r
- Defs: {\r
- gradient (type, block) {\r
- return this.put(new Gradient(type)).update(block)\r
- }\r
- }\r
- };
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
+ if (Class === null || !_isNativeFunction(Class)) return Class;
- class G extends Base$1 {\r
- constructor (node) {\r
- super(nodeorNew('g', node), G);\r
- }\r
- }\r
-\r
- G.constructors = {\r
- Element: {\r
- // Create a group element\r
- group: function () {\r
- return this.put(new G())\r
- }\r
- }\r
- };
+ if (typeof Class !== "function") {
+ throw new TypeError("Super expression must either be null or a function");
+ }
- //import {makeInstance} from './adopter.js'\r
-\r
- class HtmlNode extends Base$1 {\r
- constructor (element) {\r
- super(element, HtmlNode);\r
- this.node = element;\r
- }\r
-\r
- // add (element, i) {\r
- // element = makeInstance(element)\r
- //\r
- // if (element.node !== this.node.children[i]) {\r
- // this.node.insertBefore(element.node, this.node.children[i] || null)\r
- // }\r
- //\r
- // return this\r
- // }\r
-\r
- put (element, i) {\r
- this.add(element, i);\r
- return element\r
- }\r
-\r
- getEventTarget () {\r
- return this.node\r
- }\r
- }
+ if (typeof _cache !== "undefined") {
+ if (_cache.has(Class)) return _cache.get(Class);
- class A extends Base$1{\r
- constructor (node) {\r
- super(nodeOrNew$1('a', node), A);\r
- }\r
-\r
- // Link url\r
- to (url) {\r
- return this.attr('href', url, xlink)\r
- }\r
-\r
- // Link target attribute\r
- target (target) {\r
- return this.attr('target', target)\r
- }\r
- }\r
-\r
- A.constructors = {\r
- Container: {\r
- // Create a hyperlink element\r
- link: function (url) {\r
- return this.put(new A()).to(url)\r
- }\r
- },\r
- Element: {\r
- // Create a hyperlink element\r
- linkTo: function (url) {\r
- var link = new A();\r
-\r
- if (typeof url === 'function') { url.call(link, link); } else {\r
- link.to(url);\r
- }\r
-\r
- return this.parent().put(link).put(this)\r
- }\r
- }\r
- };
+ _cache.set(Class, Wrapper);
+ }
- //import attr from './attr.js'\r
-\r
- class Pattern extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('pattern', node));\r
- }\r
-\r
- // Return the fill id\r
- url () {\r
- return 'url(#' + this.id() + ')'\r
- }\r
-\r
- // Update pattern by rebuilding\r
- update (block) {\r
- // remove content\r
- this.clear();\r
-\r
- // invoke passed block\r
- if (typeof block === 'function') {\r
- block.call(this, this);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Alias string convertion to fill\r
- toString () {\r
- return this.url()\r
- }\r
-\r
- // // custom attr to handle transform\r
- // attr (a, b, c) {\r
- // if (a === 'transform') a = 'patternTransform'\r
- // return attr.call(this, a, b, c)\r
- // }\r
- }\r
-\r
- Pattern.constructors = {\r
- Container: {\r
- // Create pattern element in defs\r
- pattern (width, height, block) {\r
- return this.defs().pattern(width, height, block)\r
- }\r
- },\r
- Defs: {\r
- pattern (width, height, block) {\r
- return this.put(new Pattern()).update(block).attr({\r
- x: 0,\r
- y: 0,\r
- width: width,\r
- height: height,\r
- patternUnits: 'userSpaceOnUse'\r
- })\r
- }\r
- }\r
- };
+ function Wrapper() {
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
+ }
- // // Add events to elements\r
- // ;[ 'click',\r
- // 'dblclick',\r
- // 'mousedown',\r
- // 'mouseup',\r
- // 'mouseover',\r
- // 'mouseout',\r
- // 'mousemove',\r
- // 'mouseenter',\r
- // 'mouseleave',\r
- // 'touchstart',\r
- // 'touchmove',\r
- // 'touchleave',\r
- // 'touchend',\r
- // 'touchcancel' ].forEach(function (event) {\r
- // // add event to Element\r
- // Element.prototype[event] = function (f) {\r
- // if (f === null) {\r
- // off(this, event)\r
- // } else {\r
- // on(this, event, f)\r
- // }\r
- // return this\r
- // }\r
- // })\r
-\r
- let listenerId = 0;\r
-\r
- function getEventTarget (node) {\r
- return node instanceof Base && node.is('EventTarget')\r
- ? node.getEventTarget()\r
- : node\r
- }\r
-\r
- // Add event binder in the SVG namespace\r
- function on (node, events, listener, binding, options) {\r
- var l = listener.bind(binding || node);\r
- var n = getEventTarget(node);\r
-\r
- // events can be an array of events or a string of events\r
- events = Array.isArray(events) ? events : events.split(delimiter);\r
-\r
- // ensure instance object for nodes which are not adopted\r
- n.instance = n.instance || {events: {}};\r
-\r
- // pull event handlers from the element\r
- var bag = n.instance.events;\r
-\r
- // add id to listener\r
- if (!listener._svgjsListenerId) {\r
- listener._svgjsListenerId = ++listenerId;\r
- }\r
-\r
- events.forEach(function (event) {\r
- var ev = event.split('.')[0];\r
- var ns = event.split('.')[1] || '*';\r
-\r
- // ensure valid object\r
- bag[ev] = bag[ev] || {};\r
- bag[ev][ns] = bag[ev][ns] || {};\r
-\r
- // reference listener\r
- bag[ev][ns][listener._svgjsListenerId] = l;\r
-\r
- // add listener\r
- n.addEventListener(ev, l, options || false);\r
- });\r
- }\r
-\r
- // Add event unbinder in the SVG namespace\r
- function off (node, events, listener, options) {\r
- var n = getEventTarget(node);\r
-\r
- // we cannot remove an event if its not an svg.js instance\r
- if (!n.instance) return\r
-\r
- // listener can be a function or a number\r
- if (typeof listener === 'function') {\r
- listener = listener._svgjsListenerId;\r
- if (!listener) return\r
- }\r
-\r
- // pull event handlers from the element\r
- var bag = n.instance.events;\r
-\r
- // events can be an array of events or a string or undefined\r
- events = Array.isArray(events) ? events : (events || '').split(delimiter);\r
-\r
- events.forEach(function (event) {\r
- var ev = event && event.split('.')[0];\r
- var ns = event && event.split('.')[1];\r
- var namespace, l;\r
-\r
- if (listener) {\r
- // remove listener reference\r
- if (bag[ev] && bag[ev][ns || '*']) {\r
- // removeListener\r
- n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false);\r
-\r
- delete bag[ev][ns || '*'][listener];\r
- }\r
- } else if (ev && ns) {\r
- // remove all listeners for a namespaced event\r
- if (bag[ev] && bag[ev][ns]) {\r
- for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l); }\r
-\r
- delete bag[ev][ns];\r
- }\r
- } else if (ns) {\r
- // remove all listeners for a specific namespace\r
- for (event in bag) {\r
- for (namespace in bag[event]) {\r
- if (ns === namespace) { off(n, [event, ns].join('.')); }\r
- }\r
- }\r
- } else if (ev) {\r
- // remove all listeners for the event\r
- if (bag[ev]) {\r
- for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')); }\r
-\r
- delete bag[ev];\r
- }\r
- } else {\r
- // remove all listeners on a given node\r
- for (event in bag) { off(n, event); }\r
-\r
- n.instance.events = {};\r
- }\r
- });\r
- }\r
-\r
- function dispatch (node, event, data) {\r
- var n = getEventTarget(node);\r
-\r
- // Dispatch event\r
- if (event instanceof window.Event) {\r
- n.dispatchEvent(event);\r
- } else {\r
- event = new window.CustomEvent(event, {detail: data, cancelable: true});\r
- n.dispatchEvent(event);\r
- }\r
- return event\r
+ Wrapper.prototype = Object.create(Class.prototype, {
+ constructor: {
+ value: Wrapper,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ return _setPrototypeOf(Wrapper, Class);
+ };
+
+ return _wrapNativeSuper(Class);
}
- class Image extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew$1('image', node), Image);\r
- }\r
-\r
- // (re)load image\r
- load (url, callback) {\r
- if (!url) return this\r
-\r
- var img = new window.Image();\r
-\r
- on(img, 'load', function (e) {\r
- var p = this.parent(Pattern);\r
-\r
- // ensure image size\r
- if (this.width() === 0 && this.height() === 0) {\r
- this.size(img.width, img.height);\r
- }\r
-\r
- if (p instanceof Pattern) {\r
- // ensure pattern size if not set\r
- if (p.width() === 0 && p.height() === 0) {\r
- p.size(this.width(), this.height());\r
- }\r
- }\r
-\r
- if (typeof callback === 'function') {\r
- callback.call(this, {\r
- width: img.width,\r
- height: img.height,\r
- ratio: img.width / img.height,\r
- url: url\r
- });\r
- }\r
- }, this);\r
-\r
- on(img, 'load error', function () {\r
- // dont forget to unbind memory leaking events\r
- off(img);\r
- });\r
-\r
- return this.attr('href', (img.src = url), xlink)\r
- }\r
- }\r
-\r
- Image.constructors = {\r
- Container: {\r
- // create image element, load image and set its size\r
- image (source, callback) {\r
- return this.put(new Image()).size(0, 0).load(source, callback)\r
- }\r
- }\r
- };
+ function _assertThisInitialized(self) {
+ if (self === void 0) {
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ }
- /* global arrayClone */\r
-\r
- let BaseArray = (function() {\r
- try {\r
- return Array\r
- } catch (e) {\r
- return Array\r
- }\r
- })();\r
-\r
- class SVGArray extends BaseArray {\r
- constructor (...args) {\r
- super();\r
- this.init(...args);\r
- }\r
-\r
- init (array, fallback) {\r
- //this.splice(0, this.length)\r
- this.length = 0;\r
- this.push(...this.parse(array || fallback));\r
- }\r
-\r
- toArray () {\r
- return Array.prototype.slice(this)\r
- }\r
-\r
- toString () {\r
- this.join(' ');\r
- }\r
-\r
- valueOf () {\r
- return this.toArray()\r
- }\r
-\r
- // Parse whitespace separated string\r
- parse (array) {\r
- array = array.valueOf();\r
-\r
- // if already is an array, no need to parse it\r
- if (Array.isArray(array)) return array\r
-\r
- return array.trim().split(delimiter).map(parseFloat)\r
- }\r
-\r
- clone () {\r
- return new this.constructor(this)\r
- }\r
-\r
- toSet () {\r
- return new Set(this)\r
- }\r
+ return self;
}
- class PointArray$1 extends SVGArray {\r
- constructor (array, fallback = [[0, 0]]) {\r
- super(array, fallback);\r
- }\r
-\r
- // Convert array to string\r
- toString () {\r
- // convert to a poly point string\r
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {\r
- array.push(this.value[i].join(','));\r
- }\r
-\r
- return array.join(' ')\r
- }\r
-\r
- toArray () {\r
- return this.value.reduce(function (prev, curr) {\r
- return [].concat.call(prev, curr)\r
- }, [])\r
- }\r
-\r
- // Convert array to line object\r
- toLine () {\r
- return {\r
- x1: this.value[0][0],\r
- y1: this.value[0][1],\r
- x2: this.value[1][0],\r
- y2: this.value[1][1]\r
- }\r
- }\r
-\r
- // Get morphed array at given position\r
- at (pos) {\r
- // make sure a destination is defined\r
- if (!this.destination) return this\r
-\r
- // generate morphed point string\r
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {\r
- array.push([\r
- this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos,\r
- this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos\r
- ]);\r
- }\r
-\r
- return new PointArray$1(array)\r
- }\r
-\r
- // Parse point string and flat array\r
- parse (array) {\r
- var points = [];\r
-\r
- array = array.valueOf();\r
-\r
- // if it is an array\r
- if (Array.isArray(array)) {\r
- // and it is not flat, there is no need to parse it\r
- if (Array.isArray(array[0])) {\r
- return array\r
- }\r
- } else { // Else, it is considered as a string\r
- // parse points\r
- array = array.trim().split(delimiter).map(parseFloat);\r
- }\r
-\r
- // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\r
- // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\r
- if (array.length % 2 !== 0) array.pop();\r
-\r
- // wrap points in two-tuples and parse points as floats\r
- for (var i = 0, len = array.length; i < len; i = i + 2) {\r
- points.push([ array[i], array[i + 1] ]);\r
- }\r
-\r
- return points\r
- }\r
-\r
- // Move point string\r
- move (x, y) {\r
- var box = this.bbox();\r
-\r
- // get relative offset\r
- x -= box.x;\r
- y -= box.y;\r
-\r
- // move every point\r
- if (!isNaN(x) && !isNaN(y)) {\r
- for (var i = this.value.length - 1; i >= 0; i--) {\r
- this.value[i] = [this.value[i][0] + x, this.value[i][1] + y];\r
- }\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Resize poly string\r
- size (width, height) {\r
- var i;\r
- var box = this.bbox();\r
-\r
- // recalculate position of all points according to new size\r
- for (i = this.value.length - 1; i >= 0; i--) {\r
- if (box.width) this.value[i][0] = ((this.value[i][0] - box.x) * width) / box.width + box.x;\r
- if (box.height) this.value[i][1] = ((this.value[i][1] - box.y) * height) / box.height + box.y;\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Get bounding box of points\r
- bbox () {\r
- var maxX = -Infinity;\r
- var maxY = -Infinity;\r
- var minX = Infinity;\r
- var minY = Infinity;\r
- this.value.forEach(function (el) {\r
- maxX = Math.max(el[0], maxX);\r
- maxY = Math.max(el[1], maxY);\r
- minX = Math.min(el[0], minX);\r
- minY = Math.min(el[1], minY);\r
- });\r
- return {x: minX, y: minY, width: maxX - minX, height: maxY - minY}\r
- }\r
- }
+ function _possibleConstructorReturn(self, call) {
+ if (call && (typeof call === "object" || typeof call === "function")) {
+ return call;
+ }
- class Line extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('line', node), Line);\r
- }\r
-\r
- // Get array\r
- array () {\r
- return new PointArray$1([\r
- [ this.attr('x1'), this.attr('y1') ],\r
- [ this.attr('x2'), this.attr('y2') ]\r
- ])\r
- }\r
-\r
- // Overwrite native plot() method\r
- plot (x1, y1, x2, y2) {\r
- if (x1 == null) {\r
- return this.array()\r
- } else if (typeof y1 !== 'undefined') {\r
- x1 = { x1: x1, y1: y1, x2: x2, y2: y2 };\r
- } else {\r
- x1 = new PointArray$1(x1).toLine();\r
- }\r
-\r
- return this.attr(x1)\r
- }\r
-\r
- // Move by left top corner\r
- move (x, y) {\r
- return this.attr(this.array().move(x, y).toLine())\r
- }\r
-\r
- // Set element size to given width and height\r
- size (width, height) {\r
- var p = proportionalSize$1(this, width, height);\r
- return this.attr(this.array().size(p.width, p.height).toLine())\r
- }\r
-\r
- }\r
-\r
- Line.constructors = {\r
- Container: {\r
- // Create a line element\r
- line (...args) {\r
- // make sure plot is called as a setter\r
- // x1 is not necessarily a number, it can also be an array, a string and a PointArray\r
- return Line.prototype.plot.apply(\r
- this.put(new Line())\r
- , args[0] != null ? args : [0, 0, 0, 0]\r
- )\r
- }\r
- }\r
- };
+ return _assertThisInitialized(self);
+ }
- // import Defs from './Defs.js'\r
- // import Line from './Line.js'\r
- // import Polyline from './Polyline.js'\r
- // import Polygon from './Polygon.js'\r
- // import Path from './Path.js'\r
-\r
- class Marker extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew('marker', node), Marker);\r
- }\r
-\r
- // Set width of element\r
- width (width) {\r
- return this.attr('markerWidth', width)\r
- }\r
-\r
- // Set height of element\r
- height (height) {\r
- return this.attr('markerHeight', height)\r
- }\r
-\r
- // Set marker refX and refY\r
- ref (x, y) {\r
- return this.attr('refX', x).attr('refY', y)\r
- }\r
-\r
- // Update marker\r
- update (block) {\r
- // remove all content\r
- this.clear();\r
-\r
- // invoke passed block\r
- if (typeof block === 'function') { block.call(this, this); }\r
-\r
- return this\r
- }\r
-\r
- // Return the fill id\r
- toString () {\r
- return 'url(#' + this.id() + ')'\r
- }\r
- }\r
-\r
- Marker.constructors = {\r
- Container: {\r
- marker (width, height, block) {\r
- // Create marker element in defs\r
- return this.defs().marker(width, height, block)\r
- }\r
- },\r
- Defs: {\r
- // Create marker\r
- marker (width, height, block) {\r
- // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\r
- return this.put(new Marker())\r
- .size(width, height)\r
- .ref(width / 2, height / 2)\r
- .viewbox(0, 0, width, height)\r
- .attr('orient', 'auto')\r
- .update(block)\r
- }\r
- },\r
- marker: {\r
- // Create and attach markers\r
- marker (marker, width, height, block) {\r
- var attr = ['marker'];\r
-\r
- // Build attribute name\r
- if (marker !== 'all') attr.push(marker);\r
- attr = attr.join('-');\r
-\r
- // Set marker attribute\r
- marker = arguments[1] instanceof Marker\r
- ? arguments[1]\r
- : this.defs().marker(width, height, block);\r
-\r
- return this.attr(attr, marker)\r
- }\r
- }\r
- };
+ function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
+ }
- // import find from './selector.js'\r
- // import {remove} from './Element.js'\r
-\r
- class Mask extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('mask', node));\r
- }\r
-\r
- // // Unmask all masked elements and remove itself\r
- // remove () {\r
- // // unmask all targets\r
- // this.targets().forEach(function (el) {\r
- // el.unmask()\r
- // })\r
- //\r
- // // remove mask from parent\r
- // return remove.call(this)\r
- // }\r
- //\r
- // targets () {\r
- // return find('svg [mask*="' + this.id() + '"]')\r
- // }\r
-\r
- }\r
-\r
-\r
- Mask.constructors = {\r
- Container: {\r
- mask () {\r
- return this.defs().put(new Mask())\r
- }\r
- },\r
- Element: {\r
- // Distribute mask to svg element\r
- maskWith (element) {\r
- // use given mask or create a new one\r
- var masker = element instanceof Mask\r
- ? element\r
- : this.parent().mask().add(element);\r
-\r
- // apply mask\r
- return this.attr('mask', 'url("#' + masker.id() + '")')\r
- },\r
-\r
- // Unmask element\r
- unmask () {\r
- return this.attr('mask', null)\r
- },\r
-\r
- masker () {\r
- return this.reference('mask')\r
- }\r
- }\r
- };
+ function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
- function parser () {\r
-\r
- // Reuse cached element if possible\r
- if (!parser.nodes) {\r
- let svg = new Doc$1().size(2, 0).css({\r
- opacity: 0,\r
- position: 'absolute',\r
- left: '-100%',\r
- top: '-100%',\r
- overflow: 'hidden'\r
- });\r
-\r
- let path = svg.path().node;\r
-\r
- parser.nodes = {svg, path};\r
- }\r
-\r
- if (!parser.nodes.svg.node.parentNode) {\r
- let b = document.body || document.documentElement;\r
- parser.nodes.svg.addTo(b);\r
- }\r
-\r
- return parser.nodes\r
+ return arr2;
+ }
}
- class Point {\r
- // Initialize\r
- constructor (x, y, base) {\r
- let source;\r
- base = base || {x: 0, y: 0};\r
-\r
- // ensure source as object\r
- source = Array.isArray(x) ? {x: x[0], y: x[1]}\r
- : typeof x === 'object' ? {x: x.x, y: x.y}\r
- : {x: x, y: y};\r
-\r
- // merge source\r
- this.x = source.x == null ? base.x : source.x;\r
- this.y = source.y == null ? base.y : source.y;\r
- }\r
-\r
- // Clone point\r
- clone () {\r
- return new Point(this)\r
- }\r
-\r
- // Convert to native SVGPoint\r
- native () {\r
- // create new point\r
- var point = parser().svg.createSVGPoint();\r
-\r
- // update with current values\r
- point.x = this.x;\r
- point.y = this.y;\r
- return point\r
- }\r
-\r
- // transform point with matrix\r
- transform (m) {\r
- // Perform the matrix multiplication\r
- var x = m.a * this.x + m.c * this.y + m.e;\r
- var y = m.b * this.x + m.d * this.y + m.f;\r
-\r
- // Return the required point\r
- return new Point(x, y)\r
- }\r
- }\r
-\r
- Point.constructors = {\r
- Element: {\r
- // Get point\r
- point: function (x, y) {\r
- return new Point(x, y).transform(this.screenCTM().inverse())\r
- }\r
- }\r
- };
+ function _iterableToArray(iter) {
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
+ }
- let pathHandlers = {\r
- M: function (c, p, p0) {\r
- p.x = p0.x = c[0];\r
- p.y = p0.y = c[1];\r
-\r
- return ['M', p.x, p.y]\r
- },\r
- L: function (c, p) {\r
- p.x = c[0];\r
- p.y = c[1];\r
- return ['L', c[0], c[1]]\r
- },\r
- H: function (c, p) {\r
- p.x = c[0];\r
- return ['H', c[0]]\r
- },\r
- V: function (c, p) {\r
- p.y = c[0];\r
- return ['V', c[0]]\r
- },\r
- C: function (c, p) {\r
- p.x = c[4];\r
- p.y = c[5];\r
- return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\r
- },\r
- S: function (c, p) {\r
- p.x = c[2];\r
- p.y = c[3];\r
- return ['S', c[0], c[1], c[2], c[3]]\r
- },\r
- Q: function (c, p) {\r
- p.x = c[2];\r
- p.y = c[3];\r
- return ['Q', c[0], c[1], c[2], c[3]]\r
- },\r
- T: function (c, p) {\r
- p.x = c[0];\r
- p.y = c[1];\r
- return ['T', c[0], c[1]]\r
- },\r
- Z: function (c, p, p0) {\r
- p.x = p0.x;\r
- p.y = p0.y;\r
- return ['Z']\r
- },\r
- A: function (c, p) {\r
- p.x = c[5];\r
- p.y = c[6];\r
- return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\r
- }\r
- };\r
-\r
- let mlhvqtcsaz = 'mlhvqtcsaz'.split('');\r
-\r
- for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\r
- pathHandlers[mlhvqtcsaz[i]] = (function (i) {\r
- return function (c, p, p0) {\r
- if (i === 'H') c[0] = c[0] + p.x;\r
- else if (i === 'V') c[0] = c[0] + p.y;\r
- else if (i === 'A') {\r
- c[5] = c[5] + p.x;\r
- c[6] = c[6] + p.y;\r
- } else {\r
- for (var j = 0, jl = c.length; j < jl; ++j) {\r
- c[j] = c[j] + (j % 2 ? p.y : p.x);\r
- }\r
- }\r
-\r
- return pathHandlers[i](c, p, p0)\r
- }\r
- })(mlhvqtcsaz[i].toUpperCase());\r
- }\r
-\r
- class PathArray extends SVGArray {\r
- constructor (array, fallback = [['M', 0, 0]]) {\r
- super(array, fallback);\r
- }\r
-\r
- // Convert array to string\r
- toString () {\r
- return arrayToString(this)\r
- }\r
-\r
- toArray () {\r
- return this.reduce(function (prev, curr) {\r
- return [].concat.call(prev, curr)\r
- }, [])\r
- }\r
-\r
- // Move path string\r
- move (x, y) {\r
- // get bounding box of current situation\r
- var box = this.bbox();\r
-\r
- // get relative offset\r
- x -= box.x;\r
- y -= box.y;\r
-\r
- if (!isNaN(x) && !isNaN(y)) {\r
- // move every point\r
- for (var l, i = this.length - 1; i >= 0; i--) {\r
- l = this[i][0];\r
-\r
- if (l === 'M' || l === 'L' || l === 'T') {\r
- this[i][1] += x;\r
- this[i][2] += y;\r
- } else if (l === 'H') {\r
- this[i][1] += x;\r
- } else if (l === 'V') {\r
- this[i][1] += y;\r
- } else if (l === 'C' || l === 'S' || l === 'Q') {\r
- this[i][1] += x;\r
- this[i][2] += y;\r
- this[i][3] += x;\r
- this[i][4] += y;\r
-\r
- if (l === 'C') {\r
- this[i][5] += x;\r
- this[i][6] += y;\r
- }\r
- } else if (l === 'A') {\r
- this[i][6] += x;\r
- this[i][7] += y;\r
- }\r
- }\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Resize path string\r
- size (width, height) {\r
- // get bounding box of current situation\r
- var box = this.bbox();\r
- var i, l;\r
-\r
- // recalculate position of all points according to new size\r
- for (i = this.length - 1; i >= 0; i--) {\r
- l = this[i][0];\r
-\r
- if (l === 'M' || l === 'L' || l === 'T') {\r
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;\r
- this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y;\r
- } else if (l === 'H') {\r
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;\r
- } else if (l === 'V') {\r
- this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y;\r
- } else if (l === 'C' || l === 'S' || l === 'Q') {\r
- this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x;\r
- this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y;\r
- this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x;\r
- this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y;\r
-\r
- if (l === 'C') {\r
- this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x;\r
- this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y;\r
- }\r
- } else if (l === 'A') {\r
- // resize radii\r
- this[i][1] = (this[i][1] * width) / box.width;\r
- this[i][2] = (this[i][2] * height) / box.height;\r
-\r
- // move position values\r
- this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x;\r
- this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y;\r
- }\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Test if the passed path array use the same path data commands as this path array\r
- equalCommands (pathArray) {\r
- var i, il, equalCommands;\r
-\r
- pathArray = new PathArray(pathArray);\r
-\r
- equalCommands = this.length === pathArray.value.length;\r
- for (i = 0, il = this.length; equalCommands && i < il; i++) {\r
- equalCommands = this[i][0] === pathArray.value[i][0];\r
- }\r
-\r
- return equalCommands\r
- }\r
-\r
- // Make path array morphable\r
- morph (pathArray) {\r
- pathArray = new PathArray(pathArray);\r
-\r
- if (this.equalCommands(pathArray)) {\r
- this.destination = pathArray;\r
- } else {\r
- this.destination = null;\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Get morphed path array at given position\r
- at (pos) {\r
- // make sure a destination is defined\r
- if (!this.destination) return this\r
-\r
- var sourceArray = this;\r
- var destinationArray = this.destination.value;\r
- var array = [];\r
- var pathArray = new PathArray();\r
- var i, il, j, jl;\r
-\r
- // Animate has specified in the SVG spec\r
- // See: https://www.w3.org/TR/SVG11/paths.html#PathElement\r
- for (i = 0, il = sourceArray.length; i < il; i++) {\r
- array[i] = [sourceArray[i][0]];\r
- for (j = 1, jl = sourceArray[i].length; j < jl; j++) {\r
- array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos;\r
- }\r
- // For the two flags of the elliptical arc command, the SVG spec say:\r
- // 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
- // Elliptical arc command as an array followed by corresponding indexes:\r
- // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]\r
- // 0 1 2 3 4 5 6 7\r
- if (array[i][0] === 'A') {\r
- array[i][4] = +(array[i][4] !== 0);\r
- array[i][5] = +(array[i][5] !== 0);\r
- }\r
- }\r
-\r
- // Directly modify the value of a path array, this is done this way for performance\r
- pathArray.value = array;\r
- return pathArray\r
- }\r
-\r
- // Absolutize and parse path to array\r
- parse (array) {\r
- // if it's already a patharray, no need to parse it\r
- if (array instanceof PathArray) return array.valueOf()\r
-\r
- // prepare for parsing\r
- var s;\r
- var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 };\r
-\r
- if (typeof array === 'string') {\r
- array = array\r
- .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123\r
- .replace(pathLetters, ' $& ') // put some room between letters and numbers\r
- .replace(hyphen, '$1 -') // add space before hyphen\r
- .trim() // trim\r
- .split(delimiter); // split into array\r
- } else {\r
- array = array.reduce(function (prev, curr) {\r
- return [].concat.call(prev, curr)\r
- }, []);\r
- }\r
-\r
- // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]\r
- var result = [];\r
- var p = new Point();\r
- var p0 = new Point();\r
- var index = 0;\r
- var len = array.length;\r
-\r
- do {\r
- // Test if we have a path letter\r
- if (isPathLetter.test(array[index])) {\r
- s = array[index];\r
- ++index;\r
- // If last letter was a move command and we got no new, it defaults to [L]ine\r
- } else if (s === 'M') {\r
- s = 'L';\r
- } else if (s === 'm') {\r
- s = 'l';\r
- }\r
-\r
- result.push(pathHandlers[s].call(null,\r
- array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),\r
- p, p0\r
- )\r
- );\r
- } while (len > index)\r
-\r
- return result\r
- }\r
-\r
- // Get bounding box of path\r
- bbox () {\r
- parser().path.setAttribute('d', this.toString());\r
- return parser.nodes.path.getBBox()\r
- }\r
+ function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
}
- class Path extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('path', node), Path);\r
- }\r
-\r
- // Get array\r
- array () {\r
- return this._array || (this._array = new PathArray(this.attr('d')))\r
- }\r
-\r
- // Plot new path\r
- plot (d) {\r
- return (d == null) ? this.array()\r
- : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))\r
- }\r
-\r
- // Clear array cache\r
- clear () {\r
- delete this._array;\r
- return this\r
- }\r
-\r
- // Move by left top corner\r
- move (x, y) {\r
- return this.attr('d', this.array().move(x, y))\r
- }\r
-\r
- // Move by left top corner over x-axis\r
- x (x) {\r
- return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r
- }\r
-\r
- // Move by left top corner over y-axis\r
- y (y) {\r
- return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r
- }\r
-\r
- // Set element size to given width and height\r
- size (width, height) {\r
- var p = proportionalSize$1(this, width, height);\r
- return this.attr('d', this.array().size(p.width, p.height))\r
- }\r
-\r
- // Set width of element\r
- width (width) {\r
- return width == null ? this.bbox().width : this.size(width, this.bbox().height)\r
- }\r
-\r
- // Set height of element\r
- height (height) {\r
- return height == null ? this.bbox().height : this.size(this.bbox().width, height)\r
- }\r
- }\r
-\r
- // Define morphable array\r
- Path.prototype.MorphArray = PathArray;\r
-\r
- // Add parent method\r
- Path.constructors = {\r
- Container: {\r
- // Create a wrapped path element\r
- path (d) {\r
- // make sure plot is called as a setter\r
- return this.put(new Path()).plot(d || new PathArray())\r
- }\r
- }\r
- };
+ 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
- let MorphArray = PointArray$1;\r
-\r
- // Move by left top corner over x-axis\r
- function x$1 (x) {\r
- return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r
- }\r
-\r
- // Move by left top corner over y-axis\r
- function y$1 (y) {\r
- return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r
- }\r
-\r
- // Set width of element\r
- function width$1 (width) {\r
- let b = this.bbox();\r
- return width == null ? b.width : this.size(width, b.height)\r
- }\r
-\r
- // Set height of element\r
- function height$1 (height) {\r
- let b = this.bbox();\r
- return height == null ? b.height : this.size(b.width, height)\r
+ 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;
+ }
- var pointed = /*#__PURE__*/Object.freeze({
- MorphArray: MorphArray,
- x: x$1,
- y: y$1,
- width: width$1,
- height: height$1
- });
+ 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
- // Add polygon-specific functions\r
-\r
- // Get array\r
- function array () {\r
- return this._array || (this._array = new PointArray(this.attr('points')))\r
- }\r
-\r
- // Plot new path\r
- function plot (p) {\r
- return (p == null) ? this.array()\r
- : this.clear().attr('points', typeof p === 'string' ? p\r
- : (this._array = new PointArray(p)))\r
- }\r
-\r
- // Clear array cache\r
- function clear () {\r
- delete this._array;\r
- return this\r
- }\r
-\r
- // Move by left top corner\r
- function move (x, y) {\r
- return this.attr('points', this.array().move(x, y))\r
- }\r
-\r
- // Set element size to given width and height\r
- function size$1 (width, height) {\r
- let p = proportionalSize(this, width, height);\r
- return this.attr('points', this.array().size(p.width, p.height))\r
+ 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 poly = /*#__PURE__*/Object.freeze({
- array: array,
- plot: plot,
- clear: clear,
- move: move,
- size: size$1
- });
+ var ox, oy; // Allow the user to pass a string to rotate around a given point
- class Polygon extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('polygon', node), Polygon);\r
- }\r
- }\r
-\r
- Polygon.constructors = {\r
- Parent: {\r
- // Create a wrapped polygon element\r
- polygon (p) {\r
- // make sure plot is called as a setter\r
- return this.put(new Polygon()).plot(p || new PointArray$1())\r
- }\r
- }\r
- };\r
-\r
- extend$1(Polygon, pointed);\r
- extend$1(Polygon, poly);
+ if (typeof origin === 'string' || origin == null) {
+ // Get the bounding box of the element with no transformations applied
+ var string = (origin || 'center').toLowerCase().trim();
- class Polyline extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('polyline', node), Polyline);\r
- }\r
- }\r
-\r
- Polyline.constructors = {\r
- Parent: {\r
- // Create a wrapped polygon element\r
- polyline (p) {\r
- // make sure plot is called as a setter\r
- return this.put(new Polyline()).plot(p || new PointArray$1())\r
- }\r
- }\r
- };\r
-\r
- extend$1(Polyline, pointed);\r
- extend$1(Polyline, poly);
+ 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
- class Rect extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('rect', node), Rect);\r
- }\r
- }\r
-\r
- Rect.constructors = {\r
- Container: {\r
- // Create a rect element\r
- rect (width, height) {\r
- return this.put(new Rect()).size(width, height)\r
- }\r
- }\r
- };
- class Symbol extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('symbol', node), Symbol);\r
- }\r
- }\r
-\r
- Symbol.constructors = {\r
- Container: {\r
- symbol () {\r
- return this.put(new Symbol())\r
- }\r
- }\r
- };
+ 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
- function noop () {}\r
-\r
- // Default animation values\r
- let timeline = {\r
- duration: 400,\r
- ease: '>',\r
- delay: 0\r
- };\r
-\r
- // Default attribute values\r
- let attrs = {\r
-\r
- // fill and stroke\r
- 'fill-opacity': 1,\r
- 'stroke-opacity': 1,\r
- 'stroke-width': 0,\r
- 'stroke-linejoin': 'miter',\r
- 'stroke-linecap': 'butt',\r
- fill: '#000000',\r
- stroke: '#000000',\r
- opacity: 1,\r
-\r
- // position\r
- x: 0,\r
- y: 0,\r
- cx: 0,\r
- cy: 0,\r
-\r
- // size\r
- width: 0,\r
- height: 0,\r
-\r
- // radius\r
- r: 0,\r
- rx: 0,\r
- ry: 0,\r
-\r
- // gradient\r
- offset: 0,\r
- 'stop-opacity': 1,\r
- 'stop-color': '#000000',\r
-\r
- // text\r
- 'font-size': 16,\r
- 'font-family': 'Helvetica, Arial, sans-serif',\r
- 'text-anchor': 'start'\r
- };
- // Create plain text node\r
- function plain (text) {\r
- // clear if build mode is disabled\r
- if (this._build === false) {\r
- this.clear();\r
- }\r
-\r
- // create text node\r
- this.node.appendChild(document.createTextNode(text));\r
-\r
- return this\r
- }\r
-\r
- // FIXME: Does this also work for textpath?\r
- // Get length of text element\r
- function length () {\r
- return this.node.getComputedTextLength()\r
+ return [ox, oy];
}
- var textable = /*#__PURE__*/Object.freeze({
- plain: plain,
- length: length
- });
+ function nodeOrNew$1(name, node) {
+ return node || makeNode$1(name);
+ } // Method for element creation
- class Text$1 extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('text', node), Text$1);\r
-\r
- this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding\r
- this._rebuild = true; // enable automatic updating of dy values\r
- this._build = false; // disable build mode for adding multiple lines\r
-\r
- // set default font\r
- this.attr('font-family', attrs['font-family']);\r
- }\r
-\r
- // Move over x-axis\r
- x (x) {\r
- // act as getter\r
- if (x == null) {\r
- return this.attr('x')\r
- }\r
-\r
- return this.attr('x', x)\r
- }\r
-\r
- // Move over y-axis\r
- y (y) {\r
- var oy = this.attr('y');\r
- var o = typeof oy === 'number' ? oy - this.bbox().y : 0;\r
-\r
- // act as getter\r
- if (y == null) {\r
- return typeof oy === 'number' ? oy - o : oy\r
- }\r
-\r
- return this.attr('y', typeof y === 'number' ? y + o : y)\r
- }\r
-\r
- // Move center over x-axis\r
- cx (x) {\r
- return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)\r
- }\r
-\r
- // Move center over y-axis\r
- cy (y) {\r
- return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)\r
- }\r
-\r
- // Set the text content\r
- text (text) {\r
- // act as getter\r
- if (text === undefined) {\r
- var children = this.node.childNodes;\r
- var firstLine = 0;\r
- text = '';\r
-\r
- for (var i = 0, len = children.length; i < len; ++i) {\r
- // skip textPaths - they are no lines\r
- if (children[i].nodeName === 'textPath') {\r
- if (i === 0) firstLine = 1;\r
- continue\r
- }\r
-\r
- // add newline if its not the first child and newLined is set to true\r
- if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {\r
- text += '\n';\r
- }\r
-\r
- // add content of this node\r
- text += children[i].textContent;\r
- }\r
-\r
- return text\r
- }\r
-\r
- // remove existing content\r
- this.clear().build(true);\r
-\r
- if (typeof text === 'function') {\r
- // call block\r
- text.call(this, this);\r
- } else {\r
- // store text and make sure text is not blank\r
- text = text.split('\n');\r
-\r
- // build new lines\r
- for (var j = 0, jl = text.length; j < jl; j++) {\r
- this.tspan(text[j]).newLine();\r
- }\r
- }\r
-\r
- // disable build mode and rebuild lines\r
- return this.build(false).rebuild()\r
- }\r
-\r
- // Set / get leading\r
- leading (value) {\r
- // act as getter\r
- if (value == null) {\r
- return this.dom.leading\r
- }\r
-\r
- // act as setter\r
- this.dom.leading = new SVGNumber(value);\r
-\r
- return this.rebuild()\r
- }\r
-\r
- // Rebuild appearance type\r
- rebuild (rebuild) {\r
- // store new rebuild flag if given\r
- if (typeof rebuild === 'boolean') {\r
- this._rebuild = rebuild;\r
- }\r
-\r
- // define position of all lines\r
- if (this._rebuild) {\r
- var self = this;\r
- var blankLineOffset = 0;\r
- var dy = this.dom.leading * new SVGNumber(this.attr('font-size'));\r
-\r
- this.each(function () {\r
- if (this.dom.newLined) {\r
- this.attr('x', self.attr('x'));\r
-\r
- if (this.text() === '\n') {\r
- blankLineOffset += dy;\r
- } else {\r
- this.attr('dy', dy + blankLineOffset);\r
- blankLineOffset = 0;\r
- }\r
- }\r
- });\r
-\r
- this.fire('rebuild');\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Enable / disable build mode\r
- build (build) {\r
- this._build = !!build;\r
- return this\r
- }\r
-\r
- // overwrite method from parent to set data properly\r
- setData (o) {\r
- this.dom = o;\r
- this.dom.leading = new SVGNumber(o.leading || 1.3);\r
- return this\r
- }\r
- }\r
-\r
- extend$1(Text$1, textable);\r
-\r
- Text$1.constructors = {\r
- Container: {\r
- // Create text element\r
- text (text) {\r
- return this.put(new Text$1()).text(text)\r
- },\r
-\r
- // Create plain text element\r
- plain (text) {\r
- return this.put(new Text$1()).plain(text)\r
- }\r
- }\r
- };
+ function makeNode$1(name) {
+ // create element
+ return document.createElementNS(ns$1, name);
+ } // Method for extending objects
- class TextPath extends Text$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('textPath', node));\r
- }\r
-\r
- // return the array of the path track element\r
- array () {\r
- var track = this.track();\r
-\r
- return track ? track.array() : null\r
- }\r
-\r
- // Plot path if any\r
- plot (d) {\r
- var track = this.track();\r
- var pathArray = null;\r
-\r
- if (track) {\r
- pathArray = track.plot(d);\r
- }\r
-\r
- return (d == null) ? pathArray : this\r
- }\r
-\r
- // Get the path element\r
- track () {\r
- return this.reference('href')\r
- }\r
- }\r
-\r
- TextPath.constructors = {\r
- Container: {\r
- textPath (text, path) {\r
- return this.defs().path(path).text(text).addTo(this)\r
- }\r
- },\r
- Text: {\r
- // Create path for text to run on\r
- path: function (track) {\r
- var path = new TextPath();\r
-\r
- // if d is a path, reuse it\r
- if (!(track instanceof Path)) {\r
- // create path element\r
- track = this.doc().defs().path(track);\r
- }\r
-\r
- // link textPath to path and add content\r
- path.attr('href', '#' + track, xlink);\r
-\r
- // add textPath element as child node and return textPath\r
- return this.put(path)\r
- },\r
-\r
- // FIXME: make this plural?\r
- // Get the textPath children\r
- textPath: function () {\r
- return this.select('textPath')\r
- }\r
- },\r
- Path: {\r
- // creates a textPath from this path\r
- text: function (text) {\r
- if (text instanceof Text$1) {\r
- var txt = text.text();\r
- return text.clear().path(this).text(txt)\r
- }\r
- return this.parent().put(new Text$1()).path(this).text(text)\r
- }\r
- // FIXME: Maybe add `targets` to get all textPaths associated with this path\r
- }\r
- };\r
-\r
- TextPath.prototype.MorphArray = PathArray;
+ function extend$1(modules, methods) {
+ var key, i;
- class Use extends Base$1 {\r
- constructor (node) {\r
- super(nodeOrNew('use', node), Use);\r
- }\r
-\r
- // Use element as a reference\r
- element (element, file) {\r
- // Set lined element\r
- return this.attr('href', (file || '') + '#' + element, xlink)\r
- }\r
- }\r
-\r
- Use.constructors = {\r
- Container: {\r
- // Create a use element\r
- use: function (element, file) {\r
- return this.put(new Use()).element(element, file)\r
- }\r
- }\r
- };
+ 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
- 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) {\r
- if (element instanceof Base$1) return element\r
-\r
- if (typeof element === 'object') {\r
- return adopt$1(element)\r
- }\r
-\r
- if (element == null) {\r
- return new Doc()\r
- }\r
-\r
- if (typeof element === 'string' && element.charAt(0) !== '<') {\r
- return adopt$1(document.querySelector(element))\r
- }\r
-\r
- var node = makeNode('svg');\r
- node.innerHTML = element;\r
-\r
- element = adopt$1(node.firstElementChild);\r
-\r
- return element\r
- }\r
-\r
- // Adopt existing svg elements\r
- function adopt$1 (node) {\r
- // check for presence of node\r
- if (!node) return null\r
-\r
- // make sure a node isn't already adopted\r
- if (node.instance instanceof Element) return node.instance\r
-\r
- if (!(node instanceof window.SVGElement)) {\r
- return new HtmlNode(node)\r
- }\r
-\r
- // initialize variables\r
- var element;\r
-\r
- // adopt with element-specific settings\r
- if (node.nodeName === 'svg') {\r
- element = new Doc$1(node);\r
- } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') {\r
- element = new Gradient(node);\r
- } else if (elements[capitalize(node.nodeName)]) {\r
- element = new elements[capitalize(node.nodeName)](node);\r
- } else {\r
- element = new Bare(node);\r
- }\r
-\r
- return element\r
- }\r
-\r
- // Element id sequence\r
- let did = 1000;\r
-\r
- // Get next named element id\r
- function eid (name) {\r
- return 'Svgjs' + capitalize(name) + (did++)\r
- }\r
-\r
- // Deep new id assignment\r
- function assignNewId (node) {\r
- // do the same for SVG child nodes as well\r
- for (var i = node.children.length - 1; i >= 0; i--) {\r
- assignNewId(node.children[i]);\r
- }\r
-\r
- if (node.id) {\r
- return adopt$1(node).id(eid(node.nodeName))\r
- }\r
-\r
- return adopt$1(node)\r
+ 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 adopter = /*#__PURE__*/Object.freeze({
- makeInstance: makeInstance,
- adopt: adopt$1,
- eid: eid,
- assignNewId: assignNewId
+ var tools = /*#__PURE__*/Object.freeze({
+ nodeOrNew: nodeOrNew$1,
+ makeNode: makeNode$1,
+ extend: extend$1,
+ addFactory: addFactory,
+ invent: invent
});
- class Queue {\r
- constructor () {\r
- this._first = null;\r
- this._last = null;\r
- }\r
-\r
- push (value) {\r
- // An item stores an id and the provided value\r
- var item = value.next ? value : { value: value, next: null, prev: null };\r
-\r
- // Deal with the queue being empty or populated\r
- if (this._last) {\r
- item.prev = this._last;\r
- this._last.next = item;\r
- this._last = item;\r
- } else {\r
- this._last = item;\r
- this._first = item;\r
- }\r
-\r
- // Update the length and return the current item\r
- return item\r
- }\r
-\r
- shift () {\r
- // Check if we have a value\r
- var remove = this._first;\r
- if (!remove) return null\r
-\r
- // If we do, remove it and relink things\r
- this._first = remove.next;\r
- if (this._first) this._first.prev = null;\r
- this._last = this._first ? this._last : null;\r
- return remove.value\r
- }\r
-\r
- // Shows us the first item in the list\r
- first () {\r
- return this._first && this._first.value\r
- }\r
-\r
- // Shows us the last item in the list\r
- last () {\r
- return this._last && this._last.value\r
- }\r
-\r
- // Removes the item that was returned from the push\r
- remove (item) {\r
- // Relink the previous item\r
- if (item.prev) item.prev.next = item.next;\r
- if (item.next) item.next.prev = item.prev;\r
- if (item === this._last) this._last = item.prev;\r
- if (item === this._first) this._first = item.next;\r
-\r
- // Invalidate item\r
- item.prev = null;\r
- item.next = null;\r
- }\r
- }
+ function Bare(element) {
+ var inherit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- const Animator = {
- nextDraw: null,
- frames: new Queue(),
- timeouts: new Queue(),
- timer: window.performance || window.Date,
- transforms: [],
+ var custom =
+ /*#__PURE__*/
+ function (_inherit) {
+ _inherits(Custom, _inherit);
- frame (fn) {
- // Store the node
- var node = Animator.frames.push({ run: fn });
+ function Custom(node) {
+ _classCallCheck(this, Custom);
- // Request an animation frame if we don't have one
- if (Animator.nextDraw === null) {
- Animator.nextDraw = window.requestAnimationFrame(Animator._draw);
+ return _possibleConstructorReturn(this, _getPrototypeOf(Custom).call(this, nodeOrNew$1(element, node), Custom));
}
- // Return the node so we can remove it easily
- return node
- },
+ _createClass(Custom, [{
+ key: "words",
+ value: function words(text) {
+ // remove contents
+ while (this.node.hasChildNodes()) {
+ this.node.removeChild(this.node.lastChild);
+ } // create text node
- transform_frame (fn, id) {
- Animator.transforms[id] = fn;
- },
- timeout (fn, delay) {
- delay = delay || 0;
+ this.node.appendChild(document.createTextNode(text));
+ return this;
+ }
+ }]);
- // Work out when the event should fire
- var time = Animator.timer.now() + delay;
+ return Custom;
+ }(inherit);
- // Add the timeout to the end of the queue
- var node = Animator.timeouts.push({ run: fn, time: time });
+ 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())
+ // }
+ // })
- // Request another animation frame if we need one
- if (Animator.nextDraw === null) {
- Animator.nextDraw = window.requestAnimationFrame(Animator._draw);
- }
+ var SVGNumber =
+ /*#__PURE__*/
+ function () {
+ // Initialize
+ function SVGNumber() {
+ _classCallCheck(this, SVGNumber);
- return node
- },
+ this.init.apply(this, arguments);
+ }
- cancelFrame (node) {
- Animator.frames.remove(node);
- },
+ _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
- clearTimeout (node) {
- Animator.timeouts.remove(node);
- },
+ this.value = 0;
+ this.unit = unit || ''; // parse value
- _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;\r
- 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();
+ 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 {
- Animator.timeouts.push(nextTimeout);
+ if (value instanceof SVGNumber) {
+ this.value = value.valueOf();
+ this.unit = value.unit;
+ }
}
-
- // If we hit the last item, we should stop shifting out more items
- if (nextTimeout === lastTimeout) break
}
+ }, {
+ 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
- // Run all of the animation frames
- var nextFrame = null;
- var lastFrame = Animator.frames.last();
- while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) {
- nextFrame.run();
+ }, {
+ 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);
}
+ }]);
- Animator.transforms.forEach(function (el) { el(); });
+ return SVGNumber;
+ }();
- // 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;
- }
- };
+ // FIXME: import this to runner
- class Tspan extends Base$1 {\r
- // Initialize node\r
- constructor (node) {\r
- super(nodeOrNew$1('tspan', node), Tspan);\r
- }\r
-\r
- // Set text content\r
- text (text) {\r
- if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '')\r
-\r
- typeof text === 'function' ? text.call(this, this) : this.plain(text);\r
-\r
- return this\r
- }\r
-\r
- // Shortcut dx\r
- dx (dx) {\r
- return this.attr('dx', dx)\r
- }\r
-\r
- // Shortcut dy\r
- dy (dy) {\r
- return this.attr('dy', dy)\r
- }\r
-\r
- // Create new line\r
- newLine () {\r
- // fetch text parent\r
- var t = this.parent(Text);\r
-\r
- // mark new line\r
- this.dom.newLined = true;\r
-\r
- // apply new position\r
- return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())\r
- }\r
- }\r
-\r
- extend$1(Tspan, textable);\r
-\r
- Tspan.constructors = {\r
- Tspan: {\r
- tspan (text) {\r
- var tspan = new Tspan();\r
-\r
- // clear if build mode is disabled\r
- if (!this._build) {\r
- this.clear();\r
- }\r
-\r
- // add new tspan\r
- this.node.appendChild(tspan.node);\r
-\r
- return tspan.text(text)\r
- }\r
- }\r
- };
+ 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
+ });
+
+ 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 {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');
+ }
+ }
+ };
+
+ 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);
+
+ 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());
+ }
+ }
+ };
+
+ 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)
+ // }
+ // })
+
+ 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;
+ }
+ }]);
+
+ 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({
+ from: from,
+ to: to
+ });
+
+ 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
+
+ }, {
+ 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);
+ }
+ }
+ };
+
+ var G =
+ /*#__PURE__*/
+ function (_Base) {
+ _inherits(G, _Base);
+
+ function G(node) {
+ _classCallCheck(this, G);
+
+ 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());
+ }
+ }
+ };
+
+ 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);
+ }
+ }
+ };
+
+ 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)
+ // }
+
+ }]);
+
+ 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'
+ });
+ }
+ }
+ };
+
+ // ;[ '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);
+ }
+
+ return event;
+ }
+
+ 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);
+ }
+ }
+ };
+
+ 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 {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) {
+ 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;
+ }
+
+ 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());
+ }
+ }
+ };
+
+ 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());
+ }
+
+ 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());
+ }
+ }
+ };
+
+ 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({
+ 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) {
+ var 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
+ });
+
+ 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);
+
+ 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);
+
+ 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);
+ }
+ }
+ };
+
+ 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
+
+ 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();
+ }
+
+ var textable = /*#__PURE__*/Object.freeze({
+ plain: plain,
+ length: length
+ });
+
+ 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);
+ }
+ }
+ };
+
+ 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;
+
+ 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);
+ }
+ }
+ };
+
+
+
+ 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
+
+ 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({
+ makeInstance: makeInstance,
+ adopt: adopt$1,
+ eid: eid,
+ assignNewId: assignNewId
+ });
+
+ var Queue =
+ /*#__PURE__*/
+ function () {
+ function Queue() {
+ _classCallCheck(this, Queue);
+
+ this._first = null;
+ this._last = null;
+ }
+
+ _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: function 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: function transform_frame(fn, id) {
+ Animator.transforms[id] = fn;
+ },
+ timeout: function 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: function cancelFrame(node) {
+ Animator.frames.remove(node);
+ },
+ clearTimeout: function clearTimeout(node) {
+ Animator.timeouts.remove(node);
+ },
+ _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 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;
+ }
+ };
+
+ 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;
+ } // 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
+
+ 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\r
+ This is needed because FF does not return the transformation matrix\r
+ for the inner coordinate system when getScreenCTM() is called on nested svgs.\r
+ 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());
+ }
+ }
+ };
+
+ 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;
+ }();
+
+ /***\r
+ Base Class\r
+ ==========\r
+ The base stepper class that will be\r
+ ***/
+
+ 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;
+ }();
+ /***\r
+ Easing Functions\r
+ ================\r
+ ***/
+
+ 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);
+ /***\r
+ Controller Types\r
+ ================\r
+ ***/
+
+ 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);
+ }
+ }]);
+
+ return PID;
+ }(Controller);
+ extend$1(PID, {
+ windup: makeSetterGetter('windup'),
+ p: makeSetterGetter('P'),
+ i: makeSetterGetter('I'),
+ d: makeSetterGetter('D')
+ });
+
+ 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;
+ }
+ /**\r
+ *\r
+ */
+ // 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;
+ }
+ }
+ };
+
+ // 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;
+ }
+ /*\r
+ Runner Definitions\r
+ ==================\r
+ These methods help us define the runtime behaviour of the Runner or they\r
+ help us make new runners from the current runner\r
+ */
+
+
+ _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);
+ }
+ /*\r
+ Basic Functionality\r
+ ===================\r
+ These methods allow us to attach basic functions to the runner directly\r
+ */
+
+ }, {
+ 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);
+ }
+ /*\r
+ Runner animation methods\r
+ ========================\r
+ Control how the animation plays\r
+ */
+
+ }, {
+ 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) {
+ /*\r
+ This function converts a time to a position in the range [0, 1]\r
+ The full explanation can be found in this desmos demonstration\r
+ https://www.desmos.com/calculator/u4fbavgche\r
+ The logic is slightly simplified here because we can use booleans\r
+ */
+ // 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;
+ }
+ /*\r
+ Private Methods\r
+ ===============\r
+ Methods that shouldn't be used externally\r
+ */
+ // 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;
+ },
+
+ /**\r
+ ** absolute transformations\r
+ **/
+ //
+ // 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
- // Map function\r
- function map (array, block) {\r
- var i;\r
- var il = array.length;\r
- var result = [];\r
-\r
- for (i = 0; i < il; i++) {\r
- result.push(block(array[i]));\r
- }\r
-\r
- return result\r
- }\r
-\r
- // Degrees to radians\r
- function radians (d) {\r
- return d % 360 * Math.PI / 180\r
- }
+ this._rememberMorpher(method, morpher);
- class Matrix {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- // Initialize\r
- init (source) {\r
- var base = arrayToMatrix([1, 0, 0, 1, 0, 0]);\r
-\r
- // ensure source as object\r
- source = source instanceof Base$1 && source.is('Element') ? source.matrixify()\r
- : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat))\r
- : Array.isArray(source) ? arrayToMatrix(source)\r
- : (typeof source === 'object' && isMatrixLike(source)) ? source\r
- : (typeof source === 'object') ? new Matrix().transform(source)\r
- : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments))\r
- : base;\r
-\r
- // Merge the source matrix with the base matrix\r
- this.a = source.a != null ? source.a : base.a;\r
- this.b = source.b != null ? source.b : base.b;\r
- this.c = source.c != null ? source.c : base.c;\r
- this.d = source.d != null ? source.d : base.d;\r
- this.e = source.e != null ? source.e : base.e;\r
- this.f = source.f != null ? source.f : base.f;\r
- }\r
-\r
-\r
- // Clones this matrix\r
- clone () {\r
- return new Matrix(this)\r
- }\r
-\r
- // Transform a matrix into another matrix by manipulating the space\r
- transform (o) {\r
- // Check if o is a matrix and then left multiply it directly\r
- if (isMatrixLike(o)) {\r
- var matrix = new Matrix(o);\r
- return matrix.multiplyO(this)\r
- }\r
-\r
- // Get the proposed transformations and the current transformations\r
- var t = Matrix.formatTransforms(o);\r
- var current = this;\r
- let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current);\r
-\r
- // Construct the resulting matrix\r
- var transformer = new Matrix()\r
- .translateO(t.rx, t.ry)\r
- .lmultiplyO(current)\r
- .translateO(-ox, -oy)\r
- .scaleO(t.scaleX, t.scaleY)\r
- .skewO(t.skewX, t.skewY)\r
- .shearO(t.shear)\r
- .rotateO(t.theta)\r
- .translateO(ox, oy);\r
-\r
- // If we want the origin at a particular place, we force it there\r
- if (isFinite(t.px) || isFinite(t.py)) {\r
- const origin = new Point(ox, oy).transform(transformer);\r
- // TODO: Replace t.px with isFinite(t.px)\r
- const dx = t.px ? t.px - origin.x : 0;\r
- const dy = t.py ? t.py - origin.y : 0;\r
- transformer.translateO(dx, dy);\r
- }\r
-\r
- // Translate now after positioning\r
- transformer.translateO(t.tx, t.ty);\r
- return transformer\r
- }\r
-\r
- // Applies a matrix defined by its affine parameters\r
- compose (o) {\r
- if (o.origin) {\r
- o.originX = o.origin[0];\r
- o.originY = o.origin[1];\r
- }\r
- // Get the parameters\r
- var ox = o.originX || 0;\r
- var oy = o.originY || 0;\r
- var sx = o.scaleX || 1;\r
- var sy = o.scaleY || 1;\r
- var lam = o.shear || 0;\r
- var theta = o.rotate || 0;\r
- var tx = o.translateX || 0;\r
- var ty = o.translateY || 0;\r
-\r
- // Apply the standard matrix\r
- var result = new Matrix()\r
- .translateO(-ox, -oy)\r
- .scaleO(sx, sy)\r
- .shearO(lam)\r
- .rotateO(theta)\r
- .translateO(tx, ty)\r
- .lmultiplyO(this)\r
- .translateO(ox, oy);\r
- return result\r
- }\r
-\r
- // Decomposes this matrix into its affine parameters\r
- decompose (cx = 0, cy = 0) {\r
- // Get the parameters from the matrix\r
- var a = this.a;\r
- var b = this.b;\r
- var c = this.c;\r
- var d = this.d;\r
- var e = this.e;\r
- var f = this.f;\r
-\r
- // Figure out if the winding direction is clockwise or counterclockwise\r
- var determinant = a * d - b * c;\r
- var ccw = determinant > 0 ? 1 : -1;\r
-\r
- // Since we only shear in x, we can use the x basis to get the x scale\r
- // and the rotation of the resulting matrix\r
- var sx = ccw * Math.sqrt(a * a + b * b);\r
- var thetaRad = Math.atan2(ccw * b, ccw * a);\r
- var theta = 180 / Math.PI * thetaRad;\r
- var ct = Math.cos(thetaRad);\r
- var st = Math.sin(thetaRad);\r
-\r
- // We can then solve the y basis vector simultaneously to get the other\r
- // two affine parameters directly from these parameters\r
- var lam = (a * c + b * d) / determinant;\r
- var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a));\r
-\r
- // Use the translations\r
- let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy);\r
- let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy);\r
-\r
- // Construct the decomposition and return it\r
- return {\r
- // Return the affine parameters\r
- scaleX: sx,\r
- scaleY: sy,\r
- shear: lam,\r
- rotate: theta,\r
- translateX: tx,\r
- translateY: ty,\r
- originX: cx,\r
- originY: cy,\r
-\r
- // Return the matrix parameters\r
- a: this.a,\r
- b: this.b,\r
- c: this.c,\r
- d: this.d,\r
- e: this.e,\r
- f: this.f\r
- }\r
- }\r
-\r
- // Left multiplies by the given matrix\r
- multiply (matrix) {\r
- return this.clone().multiplyO(matrix)\r
- }\r
-\r
- multiplyO (matrix) {\r
- // Get the matrices\r
- var l = this;\r
- var r = matrix instanceof Matrix\r
- ? matrix\r
- : new Matrix(matrix);\r
-\r
- return Matrix.matrixMultiply(l, r, this)\r
- }\r
-\r
- lmultiply (matrix) {\r
- return this.clone().lmultiplyO(matrix)\r
- }\r
-\r
- lmultiplyO (matrix) {\r
- var r = this;\r
- var l = matrix instanceof Matrix\r
- ? matrix\r
- : new Matrix(matrix);\r
-\r
- return Matrix.matrixMultiply(l, r, this)\r
- }\r
-\r
- // Inverses matrix\r
- inverseO () {\r
- // Get the current parameters out of the matrix\r
- var a = this.a;\r
- var b = this.b;\r
- var c = this.c;\r
- var d = this.d;\r
- var e = this.e;\r
- var f = this.f;\r
-\r
- // Invert the 2x2 matrix in the top left\r
- var det = a * d - b * c;\r
- if (!det) throw new Error('Cannot invert ' + this)\r
-\r
- // Calculate the top 2x2 matrix\r
- var na = d / det;\r
- var nb = -b / det;\r
- var nc = -c / det;\r
- var nd = a / det;\r
-\r
- // Apply the inverted matrix to the top right\r
- var ne = -(na * e + nc * f);\r
- var nf = -(nb * e + nd * f);\r
-\r
- // Construct the inverted matrix\r
- this.a = na;\r
- this.b = nb;\r
- this.c = nc;\r
- this.d = nd;\r
- this.e = ne;\r
- this.f = nf;\r
-\r
- return this\r
- }\r
-\r
- inverse () {\r
- return this.clone().inverseO()\r
- }\r
-\r
- // Translate matrix\r
- translate (x, y) {\r
- return this.clone().translateO(x, y)\r
- }\r
-\r
- translateO (x, y) {\r
- this.e += x || 0;\r
- this.f += y || 0;\r
- return this\r
- }\r
-\r
- // Scale matrix\r
- scale (x, y, cx, cy) {\r
- return this.clone().scaleO(...arguments)\r
- }\r
-\r
- scaleO (x, y = x, cx = 0, cy = 0) {\r
- // Support uniform scaling\r
- if (arguments.length === 3) {\r
- cy = cx;\r
- cx = y;\r
- y = x;\r
- }\r
-\r
- let {a, b, c, d, e, f} = this;\r
-\r
- this.a = a * x;\r
- this.b = b * y;\r
- this.c = c * x;\r
- this.d = d * y;\r
- this.e = e * x - cx * x + cx;\r
- this.f = f * y - cy * y + cy;\r
-\r
- return this\r
- }\r
-\r
- // Rotate matrix\r
- rotate (r, cx, cy) {\r
- return this.clone().rotateO(r, cx, cy)\r
- }\r
-\r
- rotateO (r, cx = 0, cy = 0) {\r
- // Convert degrees to radians\r
- r = radians(r);\r
-\r
- let cos = Math.cos(r);\r
- let sin = Math.sin(r);\r
-\r
- let {a, b, c, d, e, f} = this;\r
-\r
- this.a = a * cos - b * sin;\r
- this.b = b * cos + a * sin;\r
- this.c = c * cos - d * sin;\r
- this.d = d * cos + c * sin;\r
- this.e = e * cos - f * sin + cy * sin - cx * cos + cx;\r
- this.f = f * cos + e * sin - cx * sin - cy * cos + cy;\r
-\r
- return this\r
- }\r
-\r
- // Flip matrix on x or y, at a given offset\r
- flip (axis, around) {\r
- return this.clone().flipO(axis, around)\r
- }\r
-\r
- flipO (axis, around) {\r
- return axis === 'x' ? this.scaleO(-1, 1, around, 0)\r
- : axis === 'y' ? this.scaleO(1, -1, 0, around)\r
- : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\r
- }\r
-\r
- // Shear matrix\r
- shear (a, cx, cy) {\r
- return this.clone().shearO(a, cx, cy)\r
- }\r
-\r
- shearO (lx, cx = 0, cy = 0) {\r
- let {a, b, c, d, e, f} = this;\r
-\r
- this.a = a + b * lx;\r
- this.c = c + d * lx;\r
- this.e = e + f * lx - cy * lx;\r
-\r
- return this\r
- }\r
-\r
- // Skew Matrix\r
- skew (x, y, cx, cy) {\r
- return this.clone().skewO(...arguments)\r
- }\r
-\r
- skewO (x, y = x, cx = 0, cy = 0) {\r
- // support uniformal skew\r
- if (arguments.length === 3) {\r
- cy = cx;\r
- cx = y;\r
- y = x;\r
- }\r
-\r
- // Convert degrees to radians\r
- x = radians(x);\r
- y = radians(y);\r
-\r
- let lx = Math.tan(x);\r
- let ly = Math.tan(y);\r
-\r
- let {a, b, c, d, e, f} = this;\r
-\r
- this.a = a + b * lx;\r
- this.b = b + a * ly;\r
- this.c = c + d * lx;\r
- this.d = d + c * ly;\r
- this.e = e + f * lx - cy * lx;\r
- this.f = f + e * ly - cx * ly;\r
-\r
- return this\r
- }\r
-\r
- // SkewX\r
- skewX (x, cx, cy) {\r
- return this.skew(x, 0, cx, cy)\r
- }\r
-\r
- skewXO (x, cx, cy) {\r
- return this.skewO(x, 0, cx, cy)\r
- }\r
-\r
- // SkewY\r
- skewY (y, cx, cy) {\r
- return this.skew(0, y, cx, cy)\r
- }\r
-\r
- skewYO (y, cx, cy) {\r
- return this.skewO(0, y, cx, cy)\r
- }\r
-\r
- // Transform around a center point\r
- aroundO (cx, cy, matrix) {\r
- var dx = cx || 0;\r
- var dy = cy || 0;\r
- return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\r
- }\r
-\r
- around (cx, cy, matrix) {\r
- return this.clone().aroundO(cx, cy, matrix)\r
- }\r
-\r
- // Convert to native SVGMatrix\r
- native () {\r
- // create new matrix\r
- var matrix = parser().node.createSVGMatrix();\r
-\r
- // update with current values\r
- for (var i = abcdef.length - 1; i >= 0; i--) {\r
- matrix[abcdef[i]] = this[abcdef[i]];\r
- }\r
-\r
- return matrix\r
- }\r
-\r
- // Check if two matrices are equal\r
- equals (other) {\r
- var comp = new Matrix(other);\r
- return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&\r
- closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&\r
- closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)\r
- }\r
-\r
- // Convert matrix to string\r
- toString () {\r
- return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'\r
- }\r
-\r
- toArray () {\r
- return [this.a, this.b, this.c, this.d, this.e, this.f]\r
- }\r
-\r
- valueOf () {\r
- return {\r
- a: this.a,\r
- b: this.b,\r
- c: this.c,\r
- d: this.d,\r
- e: this.e,\r
- f: this.f\r
- }\r
- }\r
-\r
-\r
- // TODO: Refactor this to a static function of matrix.js\r
- static formatTransforms (o) {\r
- // Get all of the parameters required to form the matrix\r
- var flipBoth = o.flip === 'both' || o.flip === true;\r
- var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1;\r
- var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1;\r
- var skewX = o.skew && o.skew.length ? o.skew[0]\r
- : isFinite(o.skew) ? o.skew\r
- : isFinite(o.skewX) ? o.skewX\r
- : 0;\r
- var skewY = o.skew && o.skew.length ? o.skew[1]\r
- : isFinite(o.skew) ? o.skew\r
- : isFinite(o.skewY) ? o.skewY\r
- : 0;\r
- var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX\r
- : isFinite(o.scale) ? o.scale * flipX\r
- : isFinite(o.scaleX) ? o.scaleX * flipX\r
- : flipX;\r
- var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY\r
- : isFinite(o.scale) ? o.scale * flipY\r
- : isFinite(o.scaleY) ? o.scaleY * flipY\r
- : flipY;\r
- var shear = o.shear || 0;\r
- var theta = o.rotate || o.theta || 0;\r
- var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY);\r
- var ox = origin.x;\r
- var oy = origin.y;\r
- var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY);\r
- var px = position.x;\r
- var py = position.y;\r
- var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY);\r
- var tx = translate.x;\r
- var ty = translate.y;\r
- var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY);\r
- var rx = relative.x;\r
- var ry = relative.y;\r
-\r
- // Populate all of the values\r
- return {\r
- scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py\r
- }\r
- }\r
-\r
- // left matrix, right matrix, target matrix which is overwritten\r
- static matrixMultiply (l, r, o) {\r
- // Work out the product directly\r
- var a = l.a * r.a + l.c * r.b;\r
- var b = l.b * r.a + l.d * r.b;\r
- var c = l.a * r.c + l.c * r.d;\r
- var d = l.b * r.c + l.d * r.d;\r
- var e = l.e + l.a * r.e + l.c * r.f;\r
- var f = l.f + l.b * r.e + l.d * r.f;\r
-\r
- // make sure to use local variables because l/r and o could be the same\r
- o.a = a;\r
- o.b = b;\r
- o.c = c;\r
- o.d = d;\r
- o.e = e;\r
- o.f = f;\r
-\r
- return o\r
- }\r
- }\r
-\r
- Matrix.constructors = {\r
- Element: {\r
- // Get current matrix\r
- ctm () {\r
- return new Matrix(this.node.getCTM())\r
- },\r
-\r
- // Get current screen matrix\r
- screenCTM () {\r
- /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\r
- This is needed because FF does not return the transformation matrix\r
- for the inner coordinate system when getScreenCTM() is called on nested svgs.\r
- However all other Browsers do that */\r
- if (this instanceof Doc && !this.isRoot()) {\r
- var rect = this.rect(1, 1);\r
- var m = rect.node.getScreenCTM();\r
- rect.remove();\r
- return new Matrix(m)\r
- }\r
- return new Matrix(this.node.getScreenCTM())\r
- }\r
- }\r
- };
+ 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;
- //import {Parent, Doc, Symbol, Image, Pattern, Marker, Point} from './classes.js'\r
-\r
- class Box$1 {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (source) {\r
- var base = [0, 0, 0, 0];\r
- source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)\r
- : Array.isArray(source) ? source\r
- : typeof source === 'object' ? [source.left != null ? source.left\r
- : source.x, source.top != null ? source.top : source.y, source.width, source.height]\r
- : arguments.length === 4 ? [].slice.call(arguments)\r
- : base;\r
-\r
- this.x = source[0];\r
- this.y = source[1];\r
- this.width = source[2];\r
- this.height = source[3];\r
-\r
- // add center, right, bottom...\r
- fullBox(this);\r
- }\r
-\r
- // Merge rect box with another, return a new instance\r
- merge (box) {\r
- let x = Math.min(this.x, box.x);\r
- let y = Math.min(this.y, box.y);\r
- let width = Math.max(this.x + this.width, box.x + box.width) - x;\r
- let height = Math.max(this.y + this.height, box.y + box.height) - y;\r
-\r
- return new Box$1(x, y, width, height)\r
- }\r
-\r
- transform (m) {\r
- let xMin = Infinity;\r
- let xMax = -Infinity;\r
- let yMin = Infinity;\r
- let yMax = -Infinity;\r
-\r
- let pts = [\r
- new Point(this.x, this.y),\r
- new Point(this.x2, this.y),\r
- new Point(this.x, this.y2),\r
- new Point(this.x2, this.y2)\r
- ];\r
-\r
- pts.forEach(function (p) {\r
- p = p.transform(m);\r
- xMin = Math.min(xMin, p.x);\r
- xMax = Math.max(xMax, p.x);\r
- yMin = Math.min(yMin, p.y);\r
- yMax = Math.max(yMax, p.y);\r
- });\r
-\r
- return new Box$1(\r
- xMin, yMin,\r
- xMax - xMin,\r
- yMax - yMin\r
- )\r
- }\r
-\r
- addOffset () {\r
- // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\r
- this.x += window.pageXOffset;\r
- this.y += window.pageYOffset;\r
- return this\r
- }\r
-\r
- toString () {\r
- return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\r
- }\r
-\r
- toArray () {\r
- return [this.x, this.y, this.width, this.height]\r
- }\r
- }\r
-\r
- function getBox(cb) {\r
- let box;\r
-\r
- try {\r
- box = cb(this.node);\r
-\r
- if (isNulledBox(box) && !domContains(this.node)) {\r
- throw new Error('Element not in the dom')\r
- }\r
- } catch (e) {\r
- try {\r
- let clone = this.clone(parser().svg).show();\r
- box = cb(clone.node);\r
- clone.remove();\r
- } catch (e) {\r
- throw (e)\r
- console.warn('Getting a bounding box of this element is not possible');\r
- }\r
- }\r
- return box\r
- }\r
-\r
- Box$1.constructors = {\r
- Element: {\r
- // Get bounding box\r
- bbox () {\r
- return new Box$1(getBox.call(this, (node) => node.getBBox()))\r
- },\r
-\r
- rbox (el) {\r
- let box = new Box$1(getBox.call(this, (node) => node.getBoundingClientRect()));\r
- if (el) return box.transform(el.screenCTM().inverse())\r
- return box.addOffset()\r
- }\r
- },\r
- viewbox: function (x, y, width, height) {\r
- // act as getter\r
- if (x == null) return new Box$1(this.attr('viewBox'))\r
-\r
- // act as setter\r
- return this.attr('viewBox', new Box$1(x, y, width, height))\r
- }\r
- };
+ if (!width || !height) {
+ box = this._element.bbox();
+ }
- /* globals fullHex, compToHex */\r
-\r
- class Color {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (color, g, b) {\r
- let match;\r
-\r
- // initialize defaults\r
- this.r = 0;\r
- this.g = 0;\r
- this.b = 0;\r
-\r
- if (!color) return\r
-\r
- // parse color\r
- if (typeof color === 'string') {\r
- if (isRgb.test(color)) {\r
- // get rgb values\r
- match = rgb.exec(color.replace(whitespace, ''));\r
-\r
- // parse numeric values\r
- this.r = parseInt(match[1]);\r
- this.g = parseInt(match[2]);\r
- this.b = parseInt(match[3]);\r
- } else if (isHex.test(color)) {\r
- // get hex values\r
- match = hex.exec(fullHex(color));\r
-\r
- // parse numeric values\r
- this.r = parseInt(match[1], 16);\r
- this.g = parseInt(match[2], 16);\r
- this.b = parseInt(match[3], 16);\r
- }\r
- } else if (Array.isArray(color)) {\r
- this.r = color[0];\r
- this.g = color[1];\r
- this.b = color[2];\r
- } else if (typeof color === 'object') {\r
- this.r = color.r;\r
- this.g = color.g;\r
- this.b = color.b;\r
- } else if (arguments.length === 3) {\r
- this.r = color;\r
- this.g = g;\r
- this.b = b;\r
- }\r
- }\r
-\r
- // Default to hex conversion\r
- toString () {\r
- return this.toHex()\r
- }\r
-\r
- toArray () {\r
- return [this.r, this.g, this.b]\r
- }\r
-\r
- // Build hex value\r
- toHex () {\r
- return '#' +\r
- compToHex(Math.round(this.r)) +\r
- compToHex(Math.round(this.g)) +\r
- compToHex(Math.round(this.b))\r
- }\r
-\r
- // Build rgb value\r
- toRgb () {\r
- return 'rgb(' + [this.r, this.g, this.b].join() + ')'\r
- }\r
-\r
- // Calculate true brightness\r
- brightness () {\r
- return (this.r / 255 * 0.30) +\r
- (this.g / 255 * 0.59) +\r
- (this.b / 255 * 0.11)\r
- }\r
-\r
- // Testers\r
-\r
- // Test if given value is a color string\r
- static test (color) {\r
- color += '';\r
- return isHex.test(color) || isRgb.test(color)\r
- }\r
-\r
- // Test if given value is a rgb object\r
- static isRgb (color) {\r
- return color && typeof color.r === 'number' &&\r
- typeof color.g === 'number' &&\r
- typeof color.b === 'number'\r
- }\r
-\r
- // Test if given value is a color\r
- static isColor (color) {\r
- return this.isRgb(color) || this.test(color)\r
- }\r
- }
+ if (!width) {
+ width = box.width / box.height * height;
+ }
- /***\r
- Base Class\r
- ==========\r
- The base stepper class that will be\r
- ***/\r
-\r
- function makeSetterGetter (k, f) {\r
- return function (v) {\r
- if (v == null) return this[v]\r
- this[k] = v;\r
- if (f) f.call(this);\r
- return this\r
- }\r
- }\r
-\r
- let easing = {\r
- '-': function (pos) { return pos },\r
- '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r
- '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r
- '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },\r
- bezier: function (t0, x0, t1, x1) {\r
- return function (t) {\r
- // TODO: FINISH\r
- }\r
- }\r
- };\r
-\r
-\r
- class Stepper {\r
- done () { return false }\r
- }\r
-\r
- /***\r
- Easing Functions\r
- ================\r
- ***/\r
-\r
- class Ease extends Stepper {\r
- constructor (fn) {\r
- super();\r
- this.ease = easing[fn || timeline.ease] || fn;\r
- }\r
-\r
- step (from, to, pos) {\r
- if (typeof from !== 'number') {\r
- return pos < 1 ? from : to\r
- }\r
- return from + (to - from) * this.ease(pos)\r
- }\r
- }\r
-\r
-\r
- /***\r
- Controller Types\r
- ================\r
- ***/\r
-\r
- class Controller extends Stepper {\r
- constructor (fn) {\r
- super();\r
- this.stepper = fn;\r
- }\r
-\r
- step (current, target, dt, c) {\r
- return this.stepper(current, target, dt, c)\r
- }\r
-\r
- done (c) {\r
- return c.done\r
- }\r
- }\r
-\r
- function recalculate () {\r
- // Apply the default parameters\r
- var duration = (this._duration || 500) / 1000;\r
- var overshoot = this._overshoot || 0;\r
-\r
- // Calculate the PID natural response\r
- var eps = 1e-10;\r
- var pi = Math.PI;\r
- var os = Math.log(overshoot / 100 + eps);\r
- var zeta = -os / Math.sqrt(pi * pi + os * os);\r
- var wn = 3.9 / (zeta * duration);\r
-\r
- // Calculate the Spring values\r
- this.d = 2 * zeta * wn;\r
- this.k = wn * wn;\r
- }\r
-\r
- class Spring extends Controller {\r
- constructor (duration, overshoot) {\r
- super();\r
- this.duration(duration || 500)\r
- .overshoot(overshoot || 0);\r
- }\r
-\r
- step (current, target, dt, c) {\r
- if (typeof current === 'string') return current\r
- c.done = dt === Infinity;\r
- if (dt === Infinity) return target\r
- if (dt === 0) return current\r
-\r
- if (dt > 100) dt = 16;\r
-\r
- dt /= 1000;\r
-\r
- // Get the previous velocity\r
- var velocity = c.velocity || 0;\r
-\r
- // Apply the control to get the new position and store it\r
- var acceleration = -this.d * velocity - this.k * (current - target);\r
- var newPosition = current +\r
- velocity * dt +\r
- acceleration * dt * dt / 2;\r
-\r
- // Store the velocity\r
- c.velocity = velocity + acceleration * dt;\r
-\r
- // Figure out if we have converged, and if so, pass the value\r
- c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002;\r
- return c.done ? target : newPosition\r
- }\r
- }\r
-\r
- extend$1(Spring, {\r
- duration: makeSetterGetter('_duration', recalculate),\r
- overshoot: makeSetterGetter('_overshoot', recalculate)\r
- });\r
-\r
- class PID extends Controller {\r
- constructor (p, i, d, windup) {\r
- super();\r
-\r
- p = p == null ? 0.1 : p;\r
- i = i == null ? 0.01 : i;\r
- d = d == null ? 0 : d;\r
- windup = windup == null ? 1000 : windup;\r
- this.p(p).i(i).d(d).windup(windup);\r
- }\r
-\r
- step (current, target, dt, c) {\r
- if (typeof current === 'string') return current\r
- c.done = dt === Infinity;\r
-\r
- if (dt === Infinity) return target\r
- if (dt === 0) return current\r
-\r
- var p = target - current;\r
- var i = (c.integral || 0) + p * dt;\r
- var d = (p - (c.error || 0)) / dt;\r
- var windup = this.windup;\r
-\r
- // antiwindup\r
- if (windup !== false) {\r
- i = Math.max(-windup, Math.min(i, windup));\r
- }\r
-\r
- c.error = p;\r
- c.integral = i;\r
-\r
- c.done = Math.abs(p) < 0.001;\r
-\r
- return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\r
- }\r
- }\r
-\r
- extend$1(PID, {\r
- windup: makeSetterGetter('windup'),\r
- p: makeSetterGetter('P'),\r
- i: makeSetterGetter('I'),\r
- d: makeSetterGetter('D')\r
- });
+ if (!height) {
+ height = box.height / box.width * width;
+ }
- class Morphable {\r
- constructor (stepper) {\r
- // FIXME: the default stepper does not know about easing\r
- this._stepper = stepper || new Ease('-');\r
-\r
- this._from = null;\r
- this._to = null;\r
- this._type = null;\r
- this._context = null;\r
- this._morphObj = null;\r
- }\r
-\r
- from (val) {\r
- if (val == null) {\r
- return this._from\r
- }\r
-\r
- this._from = this._set(val);\r
- return this\r
- }\r
-\r
- to (val) {\r
- if (val == null) {\r
- return this._to\r
- }\r
-\r
- this._to = this._set(val);\r
- return this\r
- }\r
-\r
- type (type) {\r
- // getter\r
- if (type == null) {\r
- return this._type\r
- }\r
-\r
- // setter\r
- this._type = type;\r
- return this\r
- }\r
-\r
- _set (value) {\r
- if (!this._type) {\r
- var type = typeof value;\r
-\r
- if (type === 'number') {\r
- this.type(SVGNumber);\r
- } else if (type === 'string') {\r
- if (Color.isColor(value)) {\r
- this.type(Color);\r
- } else if (regex.delimiter.test(value)) {\r
- this.type(regex.pathLetters.test(value)\r
- ? PathArray\r
- : SVGArray\r
- );\r
- } else if (regex.numberAndUnit.test(value)) {\r
- this.type(SVGNumber);\r
- } else {\r
- this.type(Morphable.NonMorphable);\r
- }\r
- } else if (MorphableTypes.indexOf(value.constructor) > -1) {\r
- this.type(value.constructor);\r
- } else if (Array.isArray(value)) {\r
- this.type(SVGArray);\r
- } else if (type === 'object') {\r
- this.type(Morphable.ObjectBag);\r
- } else {\r
- this.type(Morphable.NonMorphable);\r
- }\r
- }\r
-\r
- var result = (new this._type(value)).toArray();\r
- this._morphObj = this._morphObj || new this._type();\r
- this._context = this._context ||\r
- Array.apply(null, Array(result.length)).map(Object);\r
- return result\r
- }\r
-\r
- stepper (stepper) {\r
- if (stepper == null) return this._stepper\r
- this._stepper = stepper;\r
- return this\r
- }\r
-\r
- done () {\r
- var complete = this._context\r
- .map(this._stepper.done)\r
- .reduce(function (last, curr) {\r
- return last && curr\r
- }, true);\r
- return complete\r
- }\r
-\r
- at (pos) {\r
- var _this = this;\r
-\r
- return this._morphObj.fromArray(\r
- this._from.map(function (i, index) {\r
- return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)\r
- })\r
- )\r
- }\r
- }\r
-\r
- Morphable.NonMorphable = class {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (val) {\r
- val = Array.isArray(val) ? val[0] : val;\r
- this.value = val;\r
- }\r
-\r
- valueOf () {\r
- return this.value\r
- }\r
-\r
- toArray () {\r
- return [this.value]\r
- }\r
- };\r
-\r
- Morphable.TransformBag = class {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (obj) {\r
- if (Array.isArray(obj)) {\r
- obj = {\r
- scaleX: obj[0],\r
- scaleY: obj[1],\r
- shear: obj[2],\r
- rotate: obj[3],\r
- translateX: obj[4],\r
- translateY: obj[5],\r
- originX: obj[6],\r
- originY: obj[7]\r
- };\r
- }\r
-\r
- Object.assign(this, Morphable.TransformBag.defaults, obj);\r
- }\r
-\r
- toArray () {\r
- var v = this;\r
-\r
- return [\r
- v.scaleX,\r
- v.scaleY,\r
- v.shear,\r
- v.rotate,\r
- v.translateX,\r
- v.translateY,\r
- v.originX,\r
- v.originY\r
- ]\r
- }\r
- };\r
-\r
- Morphable.TransformBag.defaults = {\r
- scaleX: 1,\r
- scaleY: 1,\r
- shear: 0,\r
- rotate: 0,\r
- translateX: 0,\r
- translateY: 0,\r
- originX: 0,\r
- originY: 0\r
- };\r
-\r
- Morphable.ObjectBag = class {\r
- constructor (...args) {\r
- this.init(...args);\r
- }\r
-\r
- init (objOrArr) {\r
- this.values = [];\r
-\r
- if (Array.isArray(objOrArr)) {\r
- this.values = objOrArr;\r
- return\r
- }\r
-\r
- var entries = Object.entries(objOrArr || {}).sort((a, b) => {\r
- return a[0] - b[0]\r
- });\r
-\r
- this.values = entries.reduce((last, curr) => last.concat(curr), []);\r
- }\r
-\r
- valueOf () {\r
- var obj = {};\r
- var arr = this.values;\r
-\r
- for (var i = 0, len = arr.length; i < len; i += 2) {\r
- obj[arr[i]] = arr[i + 1];\r
- }\r
-\r
- return obj\r
- }\r
-\r
- toArray () {\r
- return this.values\r
- }\r
- };\r
-\r
- let morphableTypes = [\r
- SVGNumber,\r
- Color,\r
- Box$1,\r
- Matrix,\r
- SVGArray,\r
- PointArray$1,\r
- PathArray,\r
- Morphable.NonMorphable,\r
- Morphable.TransformBag,\r
- Morphable.ObjectBag\r
- ];\r
-\r
- extend$1(morphableTypes, {\r
- to (val, args) {\r
- return new Morphable()\r
- .type(this.constructor)\r
- .from(this.valueOf())\r
- .to(val, args)\r
- },\r
- fromArray (arr) {\r
- this.init(arr);\r
- return this\r
- }\r
- });
+ 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
- var time = window.performance || Date;\r
-\r
- var makeSchedule = function (runnerInfo) {\r
- var start = runnerInfo.start;\r
- var duration = runnerInfo.runner.duration();\r
- var end = start + duration;\r
- return {start: start, duration: duration, end: end, runner: runnerInfo.runner}\r
- };\r
-\r
- class Timeline {\r
- // Construct a new timeline on the given element\r
- constructor () {\r
- this._timeSource = function () {\r
- return time.now()\r
- };\r
-\r
- this._dispatcher = document.createElement('div');\r
-\r
- // Store the timing variables\r
- this._startTime = 0;\r
- this._speed = 1.0;\r
-\r
- // Play control variables control how the animation proceeds\r
- this._reverse = false;\r
- this._persist = 0;\r
-\r
- // Keep track of the running animations and their starting parameters\r
- this._nextFrame = null;\r
- this._paused = false;\r
- this._runners = [];\r
- this._order = [];\r
- this._time = 0;\r
- this._lastSourceTime = 0;\r
- this._lastStepTime = 0;\r
- }\r
-\r
- getEventTarget () {\r
- return this._dispatcher\r
- }\r
-\r
- /**\r
- *\r
- */\r
-\r
- // schedules a runner on the timeline\r
- schedule (runner, delay, when) {\r
- if (runner == null) {\r
- return this._runners.map(makeSchedule).sort(function (a, b) {\r
- return (a.start - b.start) || (a.duration - b.duration)\r
- })\r
- }\r
-\r
- if (!this.active()) {\r
- this._step();\r
- if (when == null) {\r
- when = 'now';\r
- }\r
- }\r
-\r
- // The start time for the next animation can either be given explicitly,\r
- // derived from the current timeline time or it can be relative to the\r
- // last start time to chain animations direclty\r
- var absoluteStartTime = 0;\r
- delay = delay || 0;\r
-\r
- // Work out when to start the animation\r
- if (when == null || when === 'last' || when === 'after') {\r
- // Take the last time and increment\r
- absoluteStartTime = this._startTime;\r
- } else if (when === 'absolute' || when === 'start') {\r
- absoluteStartTime = delay;\r
- delay = 0;\r
- } else if (when === 'now') {\r
- absoluteStartTime = this._time;\r
- } else if (when === 'relative') {\r
- let runnerInfo = this._runners[runner.id];\r
- if (runnerInfo) {\r
- absoluteStartTime = runnerInfo.start + delay;\r
- delay = 0;\r
- }\r
- } else {\r
- throw new Error('Invalid value for the "when" parameter')\r
- }\r
-\r
- // Manage runner\r
- runner.unschedule();\r
- runner.timeline(this);\r
- runner.time(-delay);\r
-\r
- // Save startTime for next runner\r
- this._startTime = absoluteStartTime + runner.duration() + delay;\r
-\r
- // Save runnerInfo\r
- this._runners[runner.id] = {\r
- persist: this.persist(),\r
- runner: runner,\r
- start: absoluteStartTime\r
- };\r
-\r
- // Save order and continue\r
- this._order.push(runner.id);\r
- this._continue();\r
- return this\r
- }\r
-\r
- // Remove the runner from this timeline\r
- unschedule (runner) {\r
- var index = this._order.indexOf(runner.id);\r
- if (index < 0) return this\r
-\r
- delete this._runners[runner.id];\r
- this._order.splice(index, 1);\r
- runner.timeline(null);\r
- return this\r
- }\r
-\r
- play () {\r
- // Now make sure we are not paused and continue the animation\r
- this._paused = false;\r
- return this._continue()\r
- }\r
-\r
- pause () {\r
- // Cancel the next animation frame and pause\r
- this._nextFrame = null;\r
- this._paused = true;\r
- return this\r
- }\r
-\r
- stop () {\r
- // Cancel the next animation frame and go to start\r
- this.seek(-this._time);\r
- return this.pause()\r
- }\r
-\r
- finish () {\r
- this.seek(Infinity);\r
- return this.pause()\r
- }\r
-\r
- speed (speed) {\r
- if (speed == null) return this._speed\r
- this._speed = speed;\r
- return this\r
- }\r
-\r
- reverse (yes) {\r
- var currentSpeed = this.speed();\r
- if (yes == null) return this.speed(-currentSpeed)\r
-\r
- var positive = Math.abs(currentSpeed);\r
- return this.speed(yes ? positive : -positive)\r
- }\r
-\r
- seek (dt) {\r
- this._time += dt;\r
- return this._continue()\r
- }\r
-\r
- time (time) {\r
- if (time == null) return this._time\r
- this._time = time;\r
- return this\r
- }\r
-\r
- persist (dtOrForever) {\r
- if (dtOrForever == null) return this._persist\r
- this._persist = dtOrForever;\r
- return this\r
- }\r
-\r
- source (fn) {\r
- if (fn == null) return this._timeSource\r
- this._timeSource = fn;\r
- return this\r
- }\r
-\r
- _step () {\r
- // If the timeline is paused, just do nothing\r
- if (this._paused) return\r
-\r
- // Get the time delta from the last time and update the time\r
- // TODO: Deal with window.blur window.focus to pause animations\r
- var time = this._timeSource();\r
- var dtSource = time - this._lastSourceTime;\r
- var dtTime = this._speed * dtSource + (this._time - this._lastStepTime);\r
- this._lastSourceTime = time;\r
-\r
- // Update the time\r
- this._time += dtTime;\r
- this._lastStepTime = this._time;\r
- // this.fire('time', this._time)\r
-\r
- // Run all of the runners directly\r
- var runnersLeft = false;\r
- for (var i = 0, len = this._order.length; i < len; i++) {\r
- // Get and run the current runner and ignore it if its inactive\r
- var runnerInfo = this._runners[this._order[i]];\r
- var runner = runnerInfo.runner;\r
- let dt = dtTime;\r
-\r
- // Make sure that we give the actual difference\r
- // between runner start time and now\r
- let dtToStart = this._time - runnerInfo.start;\r
-\r
- // Dont run runner if not started yet\r
- if (dtToStart < 0) {\r
- runnersLeft = true;\r
- continue\r
- } else if (dtToStart < dt) {\r
- // Adjust dt to make sure that animation is on point\r
- dt = dtToStart;\r
- }\r
-\r
- if (!runner.active()) continue\r
-\r
- // If this runner is still going, signal that we need another animation\r
- // frame, otherwise, remove the completed runner\r
- var finished = runner.step(dt).done;\r
- if (!finished) {\r
- runnersLeft = true;\r
- // continue\r
- } else if (runnerInfo.persist !== true) {\r
- // runner is finished. And runner might get removed\r
-\r
- // TODO: Figure out end time of runner\r
- var endTime = runner.duration() - runner.time() + this._time;\r
-\r
- if (endTime + this._persist < this._time) {\r
- // Delete runner and correct index\r
- delete this._runners[this._order[i]];\r
- this._order.splice(i--, 1) && --len;\r
- runner.timeline(null);\r
- }\r
- }\r
- }\r
-\r
- // Get the next animation frame to keep the simulation going\r
- if (runnersLeft) {\r
- this._nextFrame = Animator.frame(this._step.bind(this));\r
- } else {\r
- this._nextFrame = null;\r
- }\r
- return this\r
- }\r
-\r
- // Checks if we are running and continues the animation\r
- _continue () {\r
- if (this._paused) return this\r
- if (!this._nextFrame) {\r
- this._nextFrame = Animator.frame(this._step.bind(this));\r
- }\r
- return this\r
- }\r
-\r
- active () {\r
- return !!this._nextFrame\r
- }\r
- }\r
-\r
- Timeline.constructors = {\r
- Element: {\r
- timeline: function () {\r
- this._timeline = (this._timeline || new Timeline());\r
- return this._timeline\r
- }\r
- }\r
- };
- // FIXME: What is this doing here?\r
- // easing = {\r
- // '-': function (pos) { return pos },\r
- // '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r
- // '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r
- // '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }\r
- // }\r
-\r
- class Runner {\r
- constructor (options) {\r
- // Store a unique id on the runner, so that we can identify it later\r
- this.id = Runner.id++;\r
-\r
- // Ensure a default value\r
- options = options == null\r
- ? timeline.duration\r
- : options;\r
-\r
- // Ensure that we get a controller\r
- options = typeof options === 'function'\r
- ? new Controller(options)\r
- : options;\r
-\r
- // Declare all of the variables\r
- this._element = null;\r
- this._timeline = null;\r
- this.done = false;\r
- this._queue = [];\r
-\r
- // Work out the stepper and the duration\r
- this._duration = typeof options === 'number' && options;\r
- this._isDeclarative = options instanceof Controller;\r
- this._stepper = this._isDeclarative ? options : new Ease();\r
-\r
- // We copy the current values from the timeline because they can change\r
- this._history = {};\r
-\r
- // Store the state of the runner\r
- this.enabled = true;\r
- this._time = 0;\r
- this._last = 0;\r
-\r
- // Save transforms applied to this runner\r
- this.transforms = new Matrix();\r
- this.transformId = 1;\r
-\r
- // Looping variables\r
- this._haveReversed = false;\r
- this._reverse = false;\r
- this._loopsDone = 0;\r
- this._swing = false;\r
- this._wait = 0;\r
- this._times = 1;\r
- }\r
-\r
- /*\r
- Runner Definitions\r
- ==================\r
- These methods help us define the runtime behaviour of the Runner or they\r
- help us make new runners from the current runner\r
- */\r
-\r
- element (element) {\r
- if (element == null) return this._element\r
- this._element = element;\r
- element._prepareRunner();\r
- return this\r
- }\r
-\r
- timeline (timeline$$1) {\r
- // check explicitly for undefined so we can set the timeline to null\r
- if (typeof timeline$$1 === 'undefined') return this._timeline\r
- this._timeline = timeline$$1;\r
- return this\r
- }\r
-\r
- animate (duration, delay, when) {\r
- var o = Runner.sanitise(duration, delay, when);\r
- var runner = new Runner(o.duration);\r
- if (this._timeline) runner.timeline(this._timeline);\r
- if (this._element) runner.element(this._element);\r
- return runner.loop(o).schedule(delay, when)\r
- }\r
-\r
- schedule (timeline$$1, delay, when) {\r
- // The user doesn't need to pass a timeline if we already have one\r
- if (!(timeline$$1 instanceof Timeline)) {\r
- when = delay;\r
- delay = timeline$$1;\r
- timeline$$1 = this.timeline();\r
- }\r
-\r
- // If there is no timeline, yell at the user...\r
- if (!timeline$$1) {\r
- throw Error('Runner cannot be scheduled without timeline')\r
- }\r
-\r
- // Schedule the runner on the timeline provided\r
- timeline$$1.schedule(this, delay, when);\r
- return this\r
- }\r
-\r
- unschedule () {\r
- var timeline$$1 = this.timeline();\r
- timeline$$1 && timeline$$1.unschedule(this);\r
- return this\r
- }\r
-\r
- loop (times, swing, wait) {\r
- // Deal with the user passing in an object\r
- if (typeof times === 'object') {\r
- swing = times.swing;\r
- wait = times.wait;\r
- times = times.times;\r
- }\r
-\r
- // Sanitise the values and store them\r
- this._times = times || Infinity;\r
- this._swing = swing || false;\r
- this._wait = wait || 0;\r
- return this\r
- }\r
-\r
- delay (delay) {\r
- return this.animate(0, delay)\r
- }\r
-\r
- /*\r
- Basic Functionality\r
- ===================\r
- These methods allow us to attach basic functions to the runner directly\r
- */\r
-\r
- queue (initFn, runFn, isTransform) {\r
- this._queue.push({\r
- initialiser: initFn || noop,\r
- runner: runFn || noop,\r
- isTransform: isTransform,\r
- initialised: false,\r
- finished: false\r
- });\r
- var timeline$$1 = this.timeline();\r
- timeline$$1 && this.timeline()._continue();\r
- return this\r
- }\r
-\r
- during (fn) {\r
- return this.queue(null, fn)\r
- }\r
-\r
- after (fn) {\r
- return this.on('finish', fn)\r
- }\r
-\r
- /*\r
- Runner animation methods\r
- ========================\r
- Control how the animation plays\r
- */\r
-\r
- time (time) {\r
- if (time == null) {\r
- return this._time\r
- }\r
- let dt = time - this._time;\r
- this.step(dt);\r
- return this\r
- }\r
-\r
- duration () {\r
- return this._times * (this._wait + this._duration) - this._wait\r
- }\r
-\r
- loops (p) {\r
- var loopDuration = this._duration + this._wait;\r
- if (p == null) {\r
- var loopsDone = Math.floor(this._time / loopDuration);\r
- var relativeTime = (this._time - loopsDone * loopDuration);\r
- var position = relativeTime / this._duration;\r
- return Math.min(loopsDone + position, this._times)\r
- }\r
- var whole = Math.floor(p);\r
- var partial = p % 1;\r
- var time = loopDuration * whole + this._duration * partial;\r
- return this.time(time)\r
- }\r
-\r
- position (p) {\r
- // Get all of the variables we need\r
- var x = this._time;\r
- var d = this._duration;\r
- var w = this._wait;\r
- var t = this._times;\r
- var s = this._swing;\r
- var r = this._reverse;\r
- var position;\r
-\r
- if (p == null) {\r
- /*\r
- This function converts a time to a position in the range [0, 1]\r
- The full explanation can be found in this desmos demonstration\r
- https://www.desmos.com/calculator/u4fbavgche\r
- The logic is slightly simplified here because we can use booleans\r
- */\r
-\r
- // Figure out the value without thinking about the start or end time\r
- const f = function (x) {\r
- var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d));\r
- var backwards = (swinging && !r) || (!swinging && r);\r
- var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards;\r
- var clipped = Math.max(Math.min(uncliped, 1), 0);\r
- return clipped\r
- };\r
-\r
- // Figure out the value by incorporating the start time\r
- var endTime = t * (w + d) - w;\r
- position = x <= 0 ? Math.round(f(1e-5))\r
- : x < endTime ? f(x)\r
- : Math.round(f(endTime - 1e-5));\r
- return position\r
- }\r
-\r
- // Work out the loops done and add the position to the loops done\r
- var loopsDone = Math.floor(this.loops());\r
- var swingForward = s && (loopsDone % 2 === 0);\r
- var forwards = (swingForward && !r) || (r && swingForward);\r
- position = loopsDone + (forwards ? p : 1 - p);\r
- return this.loops(position)\r
- }\r
-\r
- progress (p) {\r
- if (p == null) {\r
- return Math.min(1, this._time / this.duration())\r
- }\r
- return this.time(p * this.duration())\r
- }\r
-\r
- step (dt) {\r
- // If we are inactive, this stepper just gets skipped\r
- if (!this.enabled) return this\r
-\r
- // Update the time and get the new position\r
- dt = dt == null ? 16 : dt;\r
- this._time += dt;\r
- var position = this.position();\r
-\r
- // Figure out if we need to run the stepper in this frame\r
- var running = this._lastPosition !== position && this._time >= 0;\r
- this._lastPosition = position;\r
-\r
- // Figure out if we just started\r
- var duration = this.duration();\r
- var justStarted = this._lastTime < 0 && this._time > 0;\r
- var justFinished = this._lastTime < this._time && this.time > duration;\r
- this._lastTime = this._time;\r
-\r
- // Work out if the runner is finished set the done flag here so animations\r
- // know, that they are running in the last step (this is good for\r
- // transformations which can be merged)\r
- var declarative = this._isDeclarative;\r
- this.done = !declarative && !justFinished && this._time >= duration;\r
-\r
- // Call initialise and the run function\r
- if (running || declarative) {\r
- this._initialise(running);\r
-\r
- // clear the transforms on this runner so they dont get added again and again\r
- this.transforms = new Matrix();\r
- var converged = this._run(declarative ? dt : position);\r
- // this.fire('step', this)\r
- }\r
- // correct the done flag here\r
- // declaritive animations itself know when they converged\r
- this.done = this.done || (converged && declarative);\r
- // if (this.done) {\r
- // this.fire('finish', this)\r
- // }\r
- return this\r
- }\r
-\r
- finish () {\r
- return this.step(Infinity)\r
- }\r
-\r
- reverse (reverse) {\r
- this._reverse = reverse == null ? !this._reverse : reverse;\r
- return this\r
- }\r
-\r
- ease (fn) {\r
- this._stepper = new Ease(fn);\r
- return this\r
- }\r
-\r
- active (enabled) {\r
- if (enabled == null) return this.enabled\r
- this.enabled = enabled;\r
- return this\r
- }\r
-\r
- /*\r
- Private Methods\r
- ===============\r
- Methods that shouldn't be used externally\r
- */\r
-\r
- // Save a morpher to the morpher list so that we can retarget it later\r
- _rememberMorpher (method, morpher) {\r
- this._history[method] = {\r
- morpher: morpher,\r
- caller: this._queue[this._queue.length - 1]\r
- };\r
- }\r
-\r
- // Try to set the target for a morpher if the morpher exists, otherwise\r
- // do nothing and return false\r
- _tryRetarget (method, target) {\r
- if (this._history[method]) {\r
- // if the last method wasnt even initialised, throw it away\r
- if (!this._history[method].caller.initialised) {\r
- let index = this._queue.indexOf(this._history[method].caller);\r
- this._queue.splice(index, 1);\r
- return false\r
- }\r
-\r
- // for the case of transformations, we use the special retarget function\r
- // which has access to the outer scope\r
- if (this._history[method].caller.isTransform) {\r
- this._history[method].caller.isTransform(target);\r
- // for everything else a simple morpher change is sufficient\r
- } else {\r
- this._history[method].morpher.to(target);\r
- }\r
-\r
- this._history[method].caller.finished = false;\r
- var timeline$$1 = this.timeline();\r
- timeline$$1 && timeline$$1._continue();\r
- return true\r
- }\r
- return false\r
- }\r
-\r
- // Run each initialise function in the runner if required\r
- _initialise (running) {\r
- // If we aren't running, we shouldn't initialise when not declarative\r
- if (!running && !this._isDeclarative) return\r
-\r
- // Loop through all of the initialisers\r
- for (var i = 0, len = this._queue.length; i < len; ++i) {\r
- // Get the current initialiser\r
- var current = this._queue[i];\r
-\r
- // Determine whether we need to initialise\r
- var needsIt = this._isDeclarative || (!current.initialised && running);\r
- running = !current.finished;\r
-\r
- // Call the initialiser if we need to\r
- if (needsIt && running) {\r
- current.initialiser.call(this);\r
- current.initialised = true;\r
- }\r
- }\r
- }\r
-\r
- // Run each run function for the position or dt given\r
- _run (positionOrDt) {\r
- // Run all of the _queue directly\r
- var allfinished = true;\r
- for (var i = 0, len = this._queue.length; i < len; ++i) {\r
- // Get the current function to run\r
- var current = this._queue[i];\r
-\r
- // Run the function if its not finished, we keep track of the finished\r
- // flag for the sake of declarative _queue\r
- var converged = current.runner.call(this, positionOrDt);\r
- current.finished = current.finished || (converged === true);\r
- allfinished = allfinished && current.finished;\r
- }\r
-\r
- // We report when all of the constructors are finished\r
- return allfinished\r
- }\r
-\r
- addTransform (transform, index) {\r
- this.transforms.lmultiplyO(transform);\r
- return this\r
- }\r
-\r
- clearTransform () {\r
- this.transforms = new Matrix();\r
- return this\r
- }\r
-\r
- static sanitise (duration, delay, when) {\r
- // Initialise the default parameters\r
- var times = 1;\r
- var swing = false;\r
- var wait = 0;\r
- duration = duration || timeline.duration;\r
- delay = delay || timeline.delay;\r
- when = when || 'last';\r
-\r
- // If we have an object, unpack the values\r
- if (typeof duration === 'object' && !(duration instanceof Stepper)) {\r
- delay = duration.delay || delay;\r
- when = duration.when || when;\r
- swing = duration.swing || swing;\r
- times = duration.times || times;\r
- wait = duration.wait || wait;\r
- duration = duration.duration || timeline.duration;\r
- }\r
-\r
- return {\r
- duration: duration,\r
- delay: delay,\r
- swing: swing,\r
- times: times,\r
- wait: wait,\r
- when: when\r
- }\r
- }\r
- }\r
-\r
- Runner.id = 0;\r
-\r
- class FakeRunner{\r
- constructor (transforms = new Matrix(), id = -1, done = true) {\r
- this.transforms = transforms;\r
- this.id = id;\r
- this.done = done;\r
- }\r
- }\r
-\r
- extend$1([Runner, FakeRunner], {\r
- mergeWith (runner) {\r
- return new FakeRunner(\r
- runner.transforms.lmultiply(this.transforms),\r
- runner.id\r
- )\r
- }\r
- });\r
-\r
- // FakeRunner.emptyRunner = new FakeRunner()\r
-\r
- const lmultiply = (last, curr) => last.lmultiplyO(curr);\r
- const getRunnerTransform = (runner) => runner.transforms;\r
-\r
- function mergeTransforms () {\r
- // Find the matrix to apply to the element and apply it\r
- let runners = this._transformationRunners.runners;\r
- let netTransform = runners\r
- .map(getRunnerTransform)\r
- .reduce(lmultiply, new Matrix());\r
-\r
- this.transform(netTransform);\r
-\r
- this._transformationRunners.merge();\r
-\r
- if (this._transformationRunners.length() === 1) {\r
- this._frameId = null;\r
- }\r
- }\r
-\r
- class RunnerArray {\r
- constructor () {\r
- this.runners = [];\r
- this.ids = [];\r
- }\r
-\r
- add (runner) {\r
- if (this.runners.includes(runner)) return\r
-\r
- let id = runner.id + 1;\r
-\r
- let leftSibling = this.ids.reduce((last, curr) => {\r
- if (curr > last && curr < id) return curr\r
- return last\r
- }, 0);\r
-\r
- let index = this.ids.indexOf(leftSibling) + 1;\r
-\r
- this.ids.splice(index, 0, id);\r
- this.runners.splice(index, 0, runner);\r
-\r
- return this\r
- }\r
-\r
- getByID (id) {\r
- return this.runners[this.ids.indexOf(id + 1)]\r
- }\r
-\r
- remove (id) {\r
- let index = this.ids.indexOf(id + 1);\r
- this.ids.splice(index, 1);\r
- this.runners.splice(index, 1);\r
- return this\r
- }\r
-\r
- merge () {\r
- let lastRunner = null;\r
- this.runners.forEach((runner, i) => {\r
- if (lastRunner && runner.done && lastRunner.done) {\r
- this.remove(runner.id);\r
- this.edit(lastRunner.id, runner.mergeWith(lastRunner));\r
- }\r
-\r
- lastRunner = runner;\r
- });\r
-\r
- return this\r
- }\r
-\r
- edit (id, newRunner) {\r
- let index = this.ids.indexOf(id + 1);\r
- this.ids.splice(index, 1, id);\r
- this.runners.splice(index, 1, newRunner);\r
- return this\r
- }\r
-\r
- length () {\r
- return this.ids.length\r
- }\r
-\r
- clearBefore (id) {\r
- let deleteCnt = this.ids.indexOf(id + 1) || 1;\r
- this.ids.splice(0, deleteCnt, 0);\r
- this.runners.splice(0, deleteCnt, new FakeRunner());\r
- return this\r
- }\r
- }\r
-\r
- let frameId = 0;\r
- Runner.constructors = {\r
- Element: {\r
- animate (duration, delay, when) {\r
- var o = Runner.sanitise(duration, delay, when);\r
- var timeline$$1 = this.timeline();\r
- return new Runner(o.duration)\r
- .loop(o)\r
- .element(this)\r
- .timeline(timeline$$1)\r
- .schedule(delay, when)\r
- },\r
-\r
- delay (by, when) {\r
- return this.animate(0, by, when)\r
- },\r
-\r
- // this function searches for all runners on the element and deletes the ones\r
- // which run before the current one. This is because absolute transformations\r
- // overwfrite anything anyway so there is no need to waste time computing\r
- // other runners\r
- _clearTransformRunnersBefore (currentRunner) {\r
- this._transformationRunners.clearBefore(currentRunner.id);\r
- },\r
-\r
- _currentTransform (current) {\r
- return this._transformationRunners.runners\r
- // we need the equal sign here to make sure, that also transformations\r
- // on the same runner which execute before the current transformation are\r
- // taken into account\r
- .filter((runner) => runner.id <= current.id)\r
- .map(getRunnerTransform)\r
- .reduce(lmultiply, new Matrix())\r
- },\r
-\r
- addRunner (runner) {\r
- this._transformationRunners.add(runner);\r
-\r
- Animator.transform_frame(\r
- mergeTransforms.bind(this), this._frameId\r
- );\r
- },\r
-\r
- _prepareRunner () {\r
- if (this._frameId == null) {\r
- this._transformationRunners = new RunnerArray()\r
- .add(new FakeRunner(new Matrix(this)));\r
-\r
- this._frameId = frameId++;\r
- }\r
- }\r
- }\r
- };\r
-\r
-\r
- extend$1(Runner, {\r
- attr (a, v) {\r
- return this.styleAttr('attr', a, v)\r
- },\r
-\r
- // Add animatable styles\r
- css (s, v) {\r
- return this.styleAttr('css', s, v)\r
- },\r
-\r
- styleAttr (type, name, val) {\r
- // apply attributes individually\r
- if (typeof name === 'object') {\r
- for (var key in val) {\r
- this.styleAttr(type, key, val[key]);\r
- }\r
- }\r
-\r
- var morpher = new Morphable(this._stepper).to(val);\r
-\r
- this.queue(function () {\r
- morpher = morpher.from(this.element()[type](name));\r
- }, function (pos) {\r
- this.element()[type](name, morpher.at(pos));\r
- return morpher.done()\r
- });\r
-\r
- return this\r
- },\r
-\r
- zoom (level, point) {\r
- var morpher = new Morphable(this._stepper).to(new SVGNumber(level));\r
-\r
- this.queue(function () {\r
- morpher = morpher.from(this.zoom());\r
- }, function (pos) {\r
- this.element().zoom(morpher.at(pos), point);\r
- return morpher.done()\r
- });\r
-\r
- return this\r
- },\r
-\r
- /**\r
- ** absolute transformations\r
- **/\r
-\r
- //\r
- // M v -----|-----(D M v = F v)------|-----> T v\r
- //\r
- // 1. define the final state (T) and decompose it (once)\r
- // t = [tx, ty, the, lam, sy, sx]\r
- // 2. on every frame: pull the current state of all previous transforms\r
- // (M - m can change)\r
- // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\r
- // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\r
- // - Note F(0) = M\r
- // - Note F(1) = T\r
- // 4. Now you get the delta matrix as a result: D = F * inv(M)\r
-\r
- transform (transforms, relative, affine) {\r
- // If we have a declarative function, we should retarget it if possible\r
- relative = transforms.relative || relative;\r
- if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\r
- return this\r
- }\r
-\r
- // Parse the parameters\r
- var isMatrix = isMatrixLike(transforms);\r
- affine = transforms.affine != null\r
- ? transforms.affine\r
- : (affine != null ? affine : !isMatrix);\r
-\r
- // Create a morepher and set its type\r
- const morpher = new Morphable()\r
- .type(affine ? Morphable.TransformBag : Matrix)\r
- .stepper(this._stepper);\r
-\r
- let origin;\r
- let element;\r
- let current;\r
- let currentAngle;\r
- let startTransform;\r
-\r
- function setup () {\r
- // make sure element and origin is defined\r
- element = element || this.element();\r
- origin = origin || getOrigin(transforms, element);\r
-\r
- startTransform = new Matrix(relative ? undefined : element);\r
-\r
- // add the runner to the element so it can merge transformations\r
- element.addRunner(this);\r
-\r
- // Deactivate all transforms that have run so far if we are absolute\r
- if (!relative) {\r
- element._clearTransformRunnersBefore(this);\r
- }\r
- }\r
-\r
- function run (pos) {\r
- // clear all other transforms before this in case something is saved\r
- // on this runner. We are absolute. We dont need these!\r
- if (!relative) this.clearTransform();\r
-\r
- let {x, y} = new Point(origin).transform(element._currentTransform(this));\r
-\r
- let target = new Matrix({...transforms, origin: [x, y]});\r
- let start = this._isDeclarative && current\r
- ? current\r
- : startTransform;\r
-\r
- if (affine) {\r
- target = target.decompose(x, y);\r
- start = start.decompose(x, y);\r
-\r
- // Get the current and target angle as it was set\r
- const rTarget = target.rotate;\r
- const rCurrent = start.rotate;\r
-\r
- // Figure out the shortest path to rotate directly\r
- const possibilities = [rTarget - 360, rTarget, rTarget + 360];\r
- const distances = possibilities.map(a => Math.abs(a - rCurrent));\r
- const shortest = Math.min(...distances);\r
- const index = distances.indexOf(shortest);\r
- target.rotate = possibilities[index];\r
- }\r
-\r
- if (relative) {\r
- // we have to be careful here not to overwrite the rotation\r
- // with the rotate method of Matrix\r
- if (!isMatrix) {\r
- target.rotate = transforms.rotate || 0;\r
- }\r
- if (this._isDeclarative && currentAngle) {\r
- start.rotate = currentAngle;\r
- }\r
- }\r
-\r
- morpher.from(start);\r
- morpher.to(target);\r
-\r
- let affineParameters = morpher.at(pos);\r
- currentAngle = affineParameters.rotate;\r
- current = new Matrix(affineParameters);\r
-\r
- this.addTransform(current);\r
- return morpher.done()\r
- }\r
-\r
- function retarget (newTransforms) {\r
- // only get a new origin if it changed since the last call\r
- if (\r
- (newTransforms.origin || 'center').toString() !==\r
- (transforms.origin || 'center').toString()\r
- ) {\r
- origin = getOrigin(transforms, element);\r
- }\r
-\r
- // overwrite the old transformations with the new ones\r
- transforms = {...newTransforms, origin};\r
- }\r
-\r
- this.queue(setup, run, retarget);\r
- this._isDeclarative && this._rememberMorpher('transform', morpher);\r
- return this\r
- },\r
-\r
- // Animatable x-axis\r
- x (x, relative) {\r
- return this._queueNumber('x', x)\r
- },\r
-\r
- // Animatable y-axis\r
- y (y) {\r
- return this._queueNumber('y', y)\r
- },\r
-\r
- dx (x) {\r
- return this._queueNumberDelta('dx', x)\r
- },\r
-\r
- dy (y) {\r
- return this._queueNumberDelta('dy', y)\r
- },\r
-\r
- _queueNumberDelta (method, to) {\r
- to = new SVGNumber(to);\r
-\r
- // Try to change the target if we have this method already registerd\r
- if (this._tryRetargetDelta(method, to)) return this\r
-\r
- // Make a morpher and queue the animation\r
- var morpher = new Morphable(this._stepper).to(to);\r
- this.queue(function () {\r
- var from = this.element()[method]();\r
- morpher.from(from);\r
- morpher.to(from + to);\r
- }, function (pos) {\r
- this.element()[method](morpher.at(pos));\r
- return morpher.done()\r
- });\r
-\r
- // Register the morpher so that if it is changed again, we can retarget it\r
- this._rememberMorpher(method, morpher);\r
- return this\r
- },\r
-\r
- _queueObject (method, to) {\r
- // Try to change the target if we have this method already registerd\r
- if (this._tryRetarget(method, to)) return this\r
-\r
- // Make a morpher and queue the animation\r
- var morpher = new Morphable(this._stepper).to(to);\r
- this.queue(function () {\r
- morpher.from(this.element()[method]());\r
- }, function (pos) {\r
- this.element()[method](morpher.at(pos));\r
- return morpher.done()\r
- });\r
-\r
- // Register the morpher so that if it is changed again, we can retarget it\r
- this._rememberMorpher(method, morpher);\r
- return this\r
- },\r
-\r
- _queueNumber (method, value) {\r
- return this._queueObject(method, new SVGNumber(value))\r
- },\r
-\r
- // Animatable center x-axis\r
- cx (x) {\r
- return this._queueNumber('cx', x)\r
- },\r
-\r
- // Animatable center y-axis\r
- cy (y) {\r
- return this._queueNumber('cy', y)\r
- },\r
-\r
- // Add animatable move\r
- move (x, y) {\r
- return this.x(x).y(y)\r
- },\r
-\r
- // Add animatable center\r
- center (x, y) {\r
- return this.cx(x).cy(y)\r
- },\r
-\r
- // Add animatable size\r
- size (width, height) {\r
- // animate bbox based size for all other elements\r
- var box;\r
-\r
- if (!width || !height) {\r
- box = this._element.bbox();\r
- }\r
-\r
- if (!width) {\r
- width = box.width / box.height * height;\r
- }\r
-\r
- if (!height) {\r
- height = box.height / box.width * width;\r
- }\r
-\r
- return this\r
- .width(width)\r
- .height(height)\r
- },\r
-\r
- // Add animatable width\r
- width (width) {\r
- return this._queueNumber('width', width)\r
- },\r
-\r
- // Add animatable height\r
- height (height) {\r
- return this._queueNumber('height', height)\r
- },\r
-\r
- // Add animatable plot\r
- plot (a, b, c, d) {\r
- // Lines can be plotted with 4 arguments\r
- if (arguments.length === 4) {\r
- return this.plot([a, b, c, d])\r
- }\r
-\r
- // FIXME: this needs to be rewritten such that the element is only accesed\r
- // in the init function\r
- return this._queueObject('plot', new this._element.MorphArray(a))\r
-\r
+ return this._queueObject('plot', new this._element.MorphArray(a));
/*\r
var morpher = this._element.morphArray().to(a)\r
-\r
- this.queue(function () {\r
+ this.queue(function () {\r
morpher.from(this._element.array())\r
}, function (pos) {\r
this._element.plot(morpher.at(pos))\r
})\r
-\r
- return this\r
- */\r
- },\r
-\r
- // Add leading method\r
- leading (value) {\r
- return this._queueNumber('leading', value)\r
- },\r
-\r
- // Add animatable viewbox\r
- viewbox (x, y, width, height) {\r
- return this._queueObject('viewbox', new Box(x, y, width, height))\r
- },\r
-\r
- update (o) {\r
- if (typeof o !== 'object') {\r
- return this.update({\r
- offset: arguments[0],\r
- color: arguments[1],\r
- opacity: arguments[2]\r
- })\r
- }\r
-\r
- if (o.opacity != null) this.attr('stop-opacity', o.opacity);\r
- if (o.color != null) this.attr('stop-color', o.color);\r
- if (o.offset != null) this.attr('offset', o.offset);\r
-\r
- return this\r
- }\r
+ return this\r
+ */
+ },
+ // 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'\r
- // export {default as SVGArray} from './SVGArray.js'\r
- // export {default as Bare} from './Bare.js'\r
- // export {default as Box} from './Box.js'\r
- // export {default as Circle} from './Circle.js'\r
- // export {default as ClipPath} from './ClipPath.js'\r
- // export {default as Color} from './Color.js'\r
- // export {default as Container} from './Container.js'\r
- // export {Controller, Ease, PID, Spring} from './Controller.js'\r
- // export {default as Defs} from './Defs.js'\r
- // export {default as Doc} from './Doc.js'\r
- // export {default as Element} from './Element.js'\r
- // export {default as Ellipse} from './Ellipse.js'\r
- // export {default as EventTarget} from './EventTarget.js'\r
- // export {default as Gradient} from './Gradient.js'\r
- // export {default as G} from './G.js'\r
- // export {default as HtmlNode} from './HtmlNode.js'\r
- // export {default as A} from './A.js'\r
- // export {default as Image} from './Image.js'\r
- // export {default as Line} from './Line.js'\r
- // export {default as Marker} from './Marker.js'\r
- // export {default as Mask} from './Mask.js'\r
- // export {default as Matrix} from './Matrix.js'\r
- // export {default as Morphable} from './Morphable.js'\r
- // export {default as SVGNumber} from './SVGNumber.js'\r
- // export {default as Parent} from './Parent.js'\r
- // export {default as Path} from './Path.js'\r
- // export {default as PathArray} from './PathArray.js'\r
- // export {default as Pattern} from './Pattern.js'\r
- // export {default as Point} from './Point.js'\r
- // export {default as PointArray} from './PointArray.js'\r
- // export {default as Polygon} from './Polygon.js'\r
- // export {default as Polyline} from './Polyline.js'\r
- // export {default as Queue} from './Queue.js'\r
- // export {default as Rect} from './Rect.js'\r
- // export {default as Runner} from './Runner.js'\r
- // export {default as Shape} from './Shape.js'\r
- // export {default as Stop} from './Stop.js'\r
- // export {default as Symbol} from './Symbol.js'\r
- // export {default as Text} from './Text.js'\r
- // export {default as TextPath} from './TextPath.js'\r
- // export {default as Timeline} from './Timeline.js'\r
+ // 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({
Polygon: Polygon,
Polyline: Polyline,
Rect: Rect,
- Symbol: Symbol,
+ Symbol: _Symbol,
Text: Text$1,
TextPath: TextPath,
Tspan: Tspan,
Marker: Marker,
Mask: Mask,
Pattern: Pattern,
- Symbol: Symbol
+ Symbol: _Symbol
});
- // ### This module adds backward / forward functionality to elements.\r
-\r
- // Get all siblings, including myself\r
- function siblings () {\r
- return this.parent().children()\r
- }\r
-\r
- // Get the curent position siblings\r
- function position () {\r
- return this.parent().index(this)\r
- }\r
-\r
- // Get the next element (will return null if there is none)\r
- function next () {\r
- return this.siblings()[this.position() + 1]\r
- }\r
-\r
- // Get the next element (will return null if there is none)\r
- function prev () {\r
- return this.siblings()[this.position() - 1]\r
- }\r
-\r
- // Send given element one step forward\r
- function forward () {\r
- var i = this.position() + 1;\r
- var p = this.parent();\r
-\r
- // move node one step forward\r
- p.removeElement(this).add(this, i);\r
-\r
- // make sure defs node is always at the top\r
- if (p instanceof Doc$1) {\r
- p.node.appendChild(p.defs().node);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Send given element one step backward\r
- function backward () {\r
- var i = this.position();\r
-\r
- if (i > 0) {\r
- this.parent().removeElement(this).add(this, i - 1);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Send given element all the way to the front\r
- function front () {\r
- var p = this.parent();\r
-\r
- // Move node forward\r
- p.node.appendChild(this.node);\r
-\r
- // Make sure defs node is always at the top\r
- if (p instanceof Doc$1) {\r
- p.node.appendChild(p.defs().node);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Send given element all the way to the back\r
- function back () {\r
- if (this.position() > 0) {\r
- this.parent().removeElement(this).add(this, 0);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Inserts a given element before the targeted element\r
- function before (element) {\r
- element.remove();\r
-\r
- var i = this.position();\r
-\r
- this.parent().add(element, i);\r
-\r
- return this\r
- }\r
-\r
- // Inserts a given element after the targeted element\r
- function after (element) {\r
- element.remove();\r
-\r
- var i = this.position();\r
-\r
- this.parent().add(element, i + 1);\r
-\r
- return this\r
+ // 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({
after: after
});
- // // Method for getting an element by id\r
- // SVG.get = function (id) {\r
- // var node = document.getElementById(idFromReference(id) || id)\r
- // return SVG.adopt(node)\r
- // }\r
- //\r
- // // Select elements by query string\r
- // SVG.select = function (query, parent) {\r
- // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {\r
- // return SVG.adopt(node)\r
- // })\r
- // }\r
- //\r
- // SVG.$$ = function (query, parent) {\r
- // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) {\r
- // return SVG.adopt(node)\r
- // })\r
- // }\r
- //\r
- // SVG.$ = function (query, parent) {\r
- // return SVG.adopt((parent || document).querySelector(query))\r
- // }\r
-\r
- function baseFind (query, parent) {\r
- return utils.map((parent || document).querySelectorAll(query), function (node) {\r
- return adopt$1(node)\r
- })\r
- }\r
-\r
- // Scoped find method\r
- function find (query) {\r
- return baseFind(query, this.node)\r
+ // 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\r
- function css (style, val) {\r
- let ret = {};\r
- if (arguments.length === 0) {\r
- // get full style as object\r
- this.node.style.cssText.split(/\s*;\s*/)\r
- .filter(function (el) { return !!el.length })\r
- .forEach(function (el) {\r
- let t = el.split(/\s*:\s*/);\r
- ret[t[0]] = t[1];\r
- });\r
- return ret\r
- }\r
-\r
- if (arguments.length < 2) {\r
- // get style properties in the array\r
- if (Array.isArray(style)) {\r
- for (let name of style) {\r
- let cased = camelCase(name);\r
- ret[cased] = this.node.style(cased);\r
- }\r
- return ret\r
- }\r
-\r
- // get style for property\r
- if (typeof style === 'string') {\r
- return this.node.style[camelCase(style)]\r
- }\r
-\r
- // set styles in object\r
- if (typeof style === 'object') {\r
- for (name in style) {\r
- // set empty string if null/undefined/'' was given\r
- this.node.style[camelCase(name)] =\r
- (style[name] == null || isBlank.test(style[name])) ? '' : style[name];\r
- }\r
- }\r
- }\r
-\r
- // set style for property\r
- if (arguments.length === 2) {\r
- this.node.style[camelCase(style)] =\r
- (val == null || isBlank.test(val)) ? '' : val;\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Show element\r
- function show () {\r
- return this.css('display', '')\r
- }\r
-\r
- // Hide element\r
- function hide () {\r
- return this.css('display', 'none')\r
- }\r
-\r
- // Is element visible?\r
- function visible () {\r
- return this.css('display') !== 'none'\r
+ 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({
visible: visible
});
- // Reset all transformations\r
- function untransform () {\r
- return this.attr('transform', null)\r
- }\r
-\r
- // merge the whole transformation chain into one matrix and returns it\r
- function matrixify () {\r
- var matrix = (this.attr('transform') || '')\r
- // split transformations\r
- .split(transforms).slice(0, -1).map(function (str) {\r
- // generate key => value pairs\r
- var kv = str.trim().split('(');\r
- return [kv[0],\r
- kv[1].split(delimiter)\r
- .map(function (str) { return parseFloat(str) })\r
- ]\r
- })\r
- .reverse()\r
- // merge every transformation into one matrix\r
- .reduce(function (matrix, transform) {\r
- if (transform[0] === 'matrix') {\r
- return matrix.lmultiply(arrayToMatrix(transform[1]))\r
- }\r
- return matrix[transform[0]].apply(matrix, transform[1])\r
- }, new Matrix());\r
-\r
- return matrix\r
- }\r
-\r
- // add an element to another parent without changing the visual representation on the screen\r
- function toParent (parent) {\r
- if (this === parent) return this\r
- var ctm = this.screenCTM();\r
- var pCtm = parent.screenCTM().inverse();\r
-\r
- this.addTo(parent).untransform().transform(pCtm.multiply(ctm));\r
-\r
- return this\r
- }\r
-\r
- // same as above with parent equals root-svg\r
- function toDoc () {\r
- return this.toParent(this.doc())\r
- }\r
-\r
- // Add transformations\r
- function transform (o, relative) {\r
- // Act as a getter if no object was passed\r
- if (o == null || typeof o === 'string') {\r
- var decomposed = new Matrix(this).decompose();\r
- return decomposed[o] || decomposed\r
- }\r
-\r
- if (!isMatrixLike(o)) {\r
- // Set the origin according to the defined transform\r
- o = {...o, origin: getOrigin(o, this)};\r
- }\r
-\r
- // The user can pass a boolean, an Element or an Matrix or nothing\r
- var cleanRelative = relative === true ? this : (relative || false);\r
- var result = new Matrix(cleanRelative).transform(o);\r
- return this.attr('transform', result)\r
+ 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({
transform: transform
});
- // Set svg element attribute\r
- function attr (attr, val, ns) {\r
- // act as full getter\r
- if (attr == null) {\r
- // get an object of attributes\r
- attr = {};\r
- val = this.node.attributes;\r
-\r
- for (let node of val) {\r
- attr[node.nodeName] = isNumer.test(node.nodeValue)\r
- ? parseFloat(node.nodeValue)\r
- : node.nodeValue;\r
- }\r
-\r
- return attr\r
- } else if (Array.isArray(attr)) ; else if (typeof attr === 'object') {\r
- // apply every attribute individually if an object is passed\r
- for (val in attr) this.attr(val, attr[val]);\r
- } else if (val === null) {\r
- // remove value\r
- this.node.removeAttribute(attr);\r
- } else if (val == null) {\r
- // act as a getter if the first and only argument is not an object\r
- val = this.node.getAttribute(attr);\r
- return val == null ? attrs[attr] // FIXME: do we need to return defaults?\r
- : isNumber.test(val) ? parseFloat(val)\r
- : val\r
- } else {\r
- // convert image fill and stroke to patterns\r
- if (attr === 'fill' || attr === 'stroke') {\r
- if (isImage.test(val)) {\r
- val = this.doc().defs().image(val);\r
- }\r
-\r
- if (val instanceof Image) {\r
- val = this.doc().defs().pattern(0, 0, function () {\r
- this.add(val);\r
- });\r
- }\r
- }\r
-\r
- // ensure correct numeric values (also accepts NaN and Infinity)\r
- if (typeof val === 'number') {\r
- val = new SVGNumber(val);\r
- } else if (Color.isColor(val)) {\r
- // ensure full hex color\r
- val = new Color(val);\r
- } else if (Array.isArray(val)) {\r
- // parse array values\r
- val = new SVGArray(val);\r
- }\r
-\r
- // if the passed attribute is leading...\r
- if (attr === 'leading') {\r
- // ... call the leading method instead\r
- if (this.leading) {\r
- this.leading(val);\r
- }\r
- } else {\r
- // set given attribute on node\r
- typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())\r
- : this.node.setAttribute(attr, val.toString());\r
- }\r
-\r
- // rebuild if required\r
- if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\r
- this.rebuild();\r
- }\r
- }\r
-\r
- return this\r
+ 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';\r
-\r
- function setup (node) {\r
- // initialize data object\r
- this.dom = {};\r
-\r
- // create circular reference\r
- this.node = node;\r
-\r
- this.type = node.nodeName;\r
- this.node.instance = this;\r
-\r
- if (node.hasAttribute('svgjs:data')) {\r
- // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\r
- this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {});\r
- }\r
- }\r
-\r
- // Move over x-axis\r
- function x$2 (x) {\r
- return this.attr('x', x)\r
- }\r
-\r
- // Move over y-axis\r
- function y$2 (y) {\r
- return this.attr('y', y)\r
- }\r
-\r
- // Move by center over x-axis\r
- function cx$1 (x) {\r
- return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)\r
- }\r
-\r
- // Move by center over y-axis\r
- function cy$1 (y) {\r
- return y == null\r
- ? this.y() + this.height() / 2\r
- : this.y(y - this.height() / 2)\r
- }\r
-\r
- // Move element to given x and y values\r
- function move$1 (x, y) {\r
- return this.x(x).y(y)\r
- }\r
-\r
- // Move element by its center\r
- function center (x, y) {\r
- return this.cx(x).cy(y)\r
- }\r
-\r
- // Set width of element\r
- function width$2 (width) {\r
- return this.attr('width', width)\r
- }\r
-\r
- // Set height of element\r
- function height$2 (height) {\r
- return this.attr('height', height)\r
- }\r
-\r
- // Set element size to given width and height\r
- function size$2 (width, height) {\r
- let p = proportionalSize$1(this, width, height);\r
-\r
- return this\r
- .width(new SVGNumber(p.width))\r
- .height(new SVGNumber(p.height))\r
- }\r
-\r
- // Clone element\r
- function clone (parent) {\r
- // write dom data to the dom so the clone can pickup the data\r
- this.writeDataToDom();\r
-\r
- // clone element and assign new id\r
- let clone = assignNewId(this.node.cloneNode(true));\r
-\r
- // insert the clone in the given parent or after myself\r
- if (parent) parent.add(clone);\r
- else this.after(clone);\r
-\r
- return clone\r
- }\r
-\r
- // Remove element\r
- function remove () {\r
- if (this.parent()) { this.parent().removeElement(this); }\r
-\r
- return this\r
- }\r
-\r
- // Replace element\r
- function replace (element) {\r
- this.after(element).remove();\r
-\r
- return element\r
- }\r
-\r
- // Add element to given container and return self\r
- function addTo (parent) {\r
- return makeInstance(parent).put(this)\r
- }\r
-\r
- // Add element to given container and return container\r
- function putIn (parent) {\r
- return makeInstance(parent).add(this)\r
- }\r
-\r
- // Get / set id\r
- function id (id) {\r
- // generate new id if no id set\r
- if (typeof id === 'undefined' && !this.node.id) {\r
- this.node.id = eid(this.type);\r
- }\r
-\r
- // dont't set directly width this.node.id to make `null` work correctly\r
- return this.attr('id', id)\r
- }\r
-\r
- // Checks whether the given point inside the bounding box of the element\r
- function inside (x, y) {\r
- let box = this.bbox();\r
-\r
- return x > box.x &&\r
- y > box.y &&\r
- x < box.x + box.width &&\r
- y < box.y + box.height\r
- }\r
-\r
- // Return id on string conversion\r
- function toString () {\r
- return this.id()\r
- }\r
-\r
- // Return array of classes on the node\r
- function classes () {\r
- var attr$$1 = this.attr('class');\r
- return attr$$1 == null ? [] : attr$$1.trim().split(delimiter)\r
- }\r
-\r
- // Return true if class exists on the node, false otherwise\r
- function hasClass (name) {\r
- return this.classes().indexOf(name) !== -1\r
- }\r
-\r
- // Add class to the node\r
- function addClass (name) {\r
- if (!this.hasClass(name)) {\r
- var array = this.classes();\r
- array.push(name);\r
- this.attr('class', array.join(' '));\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Remove class from the node\r
- function removeClass (name) {\r
- if (this.hasClass(name)) {\r
- this.attr('class', this.classes().filter(function (c) {\r
- return c !== name\r
- }).join(' '));\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Toggle the presence of a class on the node\r
- function toggleClass (name) {\r
- return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\r
- }\r
-\r
- // FIXME: getIdFromReference\r
- // Get referenced element form attribute value\r
- function reference$1 (attr$$1) {\r
- return get(this.attr(attr$$1))\r
- }\r
-\r
- // Returns the parent element instance\r
- function parent (type) {\r
- var parent = this;\r
-\r
- // check for parent\r
- if (!parent.node.parentNode) return null\r
-\r
- // get parent element\r
- parent = adopt$1(parent.node.parentNode);\r
-\r
- if (!type) return parent\r
-\r
- // loop trough ancestors if type is given\r
- while (parent && parent.node instanceof window.SVGElement) {\r
- if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent\r
- parent = adopt$1(parent.node.parentNode);\r
- }\r
- }\r
-\r
- // Get parent document\r
- function doc () {\r
- let p = this.parent(Doc$1);\r
- return p && p.doc()\r
- }\r
-\r
- // Get defs\r
- function defs () {\r
- return this.doc().defs()\r
- }\r
-\r
- // return array of all ancestors of given type up to the root svg\r
- function parents (type) {\r
- let parents = [];\r
- let parent = this;\r
-\r
- do {\r
- parent = parent.parent(type);\r
- if (!parent || !parent.node) break\r
-\r
- parents.push(parent);\r
- } while (parent.parent)\r
-\r
- return parents\r
- }\r
-\r
- // matches the element vs a css selector\r
- function matches (selector) {\r
- return matches(this.node, selector)\r
- }\r
-\r
- // Returns the svg node to call native svg methods on it\r
- function native () {\r
- return this.node\r
- }\r
-\r
- // Import raw svg\r
- function svg () {\r
- // write svgjs data to the dom\r
- this.writeDataToDom();\r
-\r
- return this.node.outerHTML\r
- }\r
-\r
- // write svgjs data to the dom\r
- function writeDataToDom () {\r
- // remove previously set data\r
- this.node.removeAttribute('svgjs:data');\r
-\r
- if (Object.keys(this.dom).length) {\r
- this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428\r
- }\r
- return this\r
- }\r
-\r
- // set given data to the elements data property\r
- function setData (o) {\r
- this.dom = o;\r
- return this\r
- }\r
-\r
- function getEventTarget$1 () {\r
- return this.node\r
+ 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({
replace: replace,
addTo: addTo,
putIn: putIn,
- id: id,
+ id: id$1,
inside: inside,
toString: toString,
classes: classes,
attr: attr
});
- // Unclip all clipped elements and remove itself\r
- function clipPathRemove () {\r
- // unclip all targets\r
- this.targets().forEach(function (el) {\r
- el.unclip();\r
- });\r
-\r
- // remove clipPath from parent\r
- return remove.call(this)\r
- }\r
-\r
- function clipPathTargets () {\r
- return find('svg [clip-path*="' + this.id() + '"]')\r
- }\r
-\r
- // Unclip all clipped elements and remove itself\r
- function maskRemove () {\r
- // unclip all targets\r
- this.targets().forEach(function (el) {\r
- el.unmask();\r
- });\r
-\r
- // remove clipPath from parent\r
- return remove.call(this)\r
- }\r
-\r
- function maskTargets () {\r
- return find('svg [mask*="' + this.id() + '"]')\r
- }\r
-\r
- // Unclip all clipped elements and remove itself\r
- function patternGradientRemove () {\r
- // unclip all targets\r
- this.targets().forEach(function (el) {\r
- el.unFill();\r
- });\r
-\r
- // remove clipPath from parent\r
- return remove.call(this)\r
- }\r
-\r
- function unFill () {\r
- this.attr('fill', null);\r
- }\r
-\r
- function patternGradientTargets () {\r
- return find('svg [fill*="' + this.id() + '"]')\r
- }\r
-\r
- // custom attr to handle transform\r
- function patternAttr (a, b, c) {\r
- if (a === 'transform') a = 'patternTransform';\r
- return attr.call(this, a, b, c)\r
- }\r
-\r
- // custom attr to handle transform\r
- function gradientAttr (a, b, c) {\r
- if (a === 'transform') a = 'gradientTransform';\r
- return attr.call(this, a, b, c)\r
- }\r
-\r
- function pathTargets () {\r
- return find('svg textpath [href*="' + this.id() + '"]')\r
- }\r
-\r
- function HtmlNodeAdd (element, i) {\r
- element = makeInstance(element);\r
-\r
- if (element.node !== this.node.children[i]) {\r
- this.node.insertBefore(element.node, this.node.children[i] || null);\r
- }\r
-\r
- return this\r
+ 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';\r
-\r
- function setup$1 (node = {}) {\r
- this.events = node.events || {};\r
- }\r
-\r
- // Bind given event to listener\r
- function on$1 (event, listener, binding, options) {\r
- on(this, event, listener, binding, options);\r
- return this\r
- }\r
-\r
- // Unbind event from listener\r
- function off$1 (event, listener) {\r
- off(this, event, listener);\r
- return this\r
- }\r
-\r
- function dispatch$1 (event, data) {\r
- return dispatch(this, event, data)\r
- }\r
-\r
- // Fire given event\r
- function fire (event, data) {\r
- this.dispatch(event, data);\r
- return this\r
+ 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({
fire: fire
});
- // Returns all child elements\r
- function children () {\r
- return map(this.node.children, function (node) {\r
- return adopt$1(node)\r
- })\r
- }\r
-\r
- // Add given element at a position\r
- function add (element, i) {\r
- element = makeInstance(element);\r
-\r
- if (element.node !== this.node.children[i]) {\r
- this.node.insertBefore(element.node, this.node.children[i] || null);\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Basically does the same as `add()` but returns the added element instead\r
- function put (element, i) {\r
- this.add(element, i);\r
- return element.instance || element\r
- }\r
-\r
- // Checks if the given element is a child\r
- function has (element) {\r
- return this.index(element) >= 0\r
- }\r
-\r
- // Gets index of given element\r
- function index (element) {\r
- return [].slice.call(this.node.children).indexOf(element.node)\r
- }\r
-\r
- // Get a element at the given index\r
- function get$1 (i) {\r
- return adopt$1(this.node.children[i])\r
- }\r
-\r
- // Get first child\r
- function first () {\r
- return this.get(0)\r
- }\r
-\r
- // Get the last child\r
- function last () {\r
- return this.get(this.node.children.length - 1)\r
- }\r
-\r
- // Iterates over all children and invokes a given block\r
- function each (block, deep) {\r
- var children = this.children();\r
- var i, il;\r
-\r
- for (i = 0, il = children.length; i < il; i++) {\r
- if (children[i] instanceof Base) {\r
- block.apply(children[i], [i, children]);\r
- }\r
-\r
- if (deep && (children[i] instanceof Base && children[i].is('Parent'))) {\r
- children[i].each(block, deep);\r
- }\r
- }\r
-\r
- return this\r
- }\r
-\r
- // Remove a given child\r
- function removeElement (element) {\r
- this.node.removeChild(element.node);\r
-\r
- return this\r
- }\r
-\r
- // Remove all elements in this container\r
- function clear$1 () {\r
- // remove children\r
- while (this.node.hasChildNodes()) {\r
- this.node.removeChild(this.node.lastChild);\r
- }\r
-\r
- // remove defs reference\r
- delete this._defs;\r
-\r
- return this\r
- }\r
-\r
- // Import raw svg\r
- function svg$1 (svg) {\r
- var well, len;\r
-\r
- // act as a setter if svg is given\r
- if (svg) {\r
- // create temporary holder\r
- well = document.createElementNS(ns, 'svg');\r
- // dump raw svg\r
- well.innerHTML = svg;\r
-\r
- // transplant nodes\r
- for (len = well.children.length; len--;) {\r
- this.node.appendChild(well.firstElementChild);\r
- }\r
-\r
- // otherwise act as a getter\r
- } else {\r
- // write svgjs data to the dom\r
- this.writeDataToDom();\r
-\r
- return this.node.outerHTML\r
- }\r
-\r
- return this\r
- }\r
-\r
- // write svgjs data to the dom\r
- function writeDataToDom$1 () {\r
- // dump variables recursively\r
- this.each(function () {\r
- this.writeDataToDom();\r
- });\r
-\r
- // remove previously set data\r
- this.node.removeAttribute('svgjs:data');\r
-\r
- if (Object.keys(this.dom).length) {\r
- this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428\r
- }\r
- return this\r
- }\r
-\r
- function flatten (parent) {\r
- this.each(function () {\r
- if (this.is('Parent')) return this.flatten(parent).ungroup(parent)\r
- return this.toParent(parent)\r
- });\r
-\r
- // we need this so that Doc does not get removed\r
- this.node.firstElementChild || this.remove();\r
-\r
- return this\r
- }\r
-\r
- function ungroup (parent) {\r
- parent = parent || this.parent();\r
-\r
- this.each(function () {\r
- return this.toParent(parent)\r
- });\r
-\r
- this.remove();\r
-\r
- return this\r
+ 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({
ungroup: ungroup
});
- // import {extend} from './tools.js'\r
- const extend$2 = extend$1;\r
-\r
- extend$2([\r
- Doc$1,\r
- Symbol,\r
- Image,\r
- Pattern,\r
- Marker\r
- ], {viewbox: Box$1.constructors.viewbox});\r
-\r
- extend$2([Line, Polyline, Polygon, Path], {\r
- ...Marker.constructors.marker\r
- });\r
-\r
- extend$2(Text$1, TextPath.constructors.Text);\r
- extend$2(Path, TextPath.constructors.Path);\r
-\r
- extend$2(Defs, {\r
- ...Gradient.constructors.Defs,\r
- ...Marker.constructors.Defs,\r
- ...Pattern.constructors.Defs,\r
- });\r
-\r
- extend$2([Text$1, Tspan], Tspan.constructors.Tspan);\r
-\r
- extend$2([Gradient, Pattern], {\r
- remove: patternGradientRemove,\r
- targets: patternGradientTargets,\r
- unFill: unFill,\r
- });\r
-\r
- extend$2(Gradient, {attr: gradientAttr});\r
- extend$2(Pattern, {attr: patternAttr});\r
-\r
- extend$2(ClipPath, {\r
- remove: clipPathRemove,\r
- targets: clipPathTargets\r
- });\r
-\r
- extend$2(Mask, {\r
- remove: maskRemove,\r
- targets: maskTargets\r
- });\r
-\r
- extend$2(Path, {targets: pathTargets});\r
-\r
- extend$2(HtmlNode, {\r
- add: HtmlNodeAdd\r
- });\r
-\r
- for (let i in containers) {\r
- extend$2(containers[i], {\r
- ...A.constructors.Container,\r
- ...ClipPath.constructors.Container,\r
- ...Doc$1.constructors.Container,\r
- ...G.constructors.Container,\r
- ...Gradient.constructors.Container,\r
- ...Line.constructors.Container,\r
- ...Marker.constructors.Container,\r
- ...Mask.constructors.Container,\r
- ...Path.constructors.Container,\r
- ...Pattern.constructors.Container,\r
- ...Polygon.constructors.Container,\r
- ...Polyline.constructors.Container,\r
- ...Rect.constructors.Container,\r
- find,\r
- ...Symbol.constructors.Container,\r
- ...Text$1.constructors.Container,\r
- ...TextPath.constructors.Container,\r
- ...Use.constructors.Container,\r
- });\r
- }\r
-\r
- for (let i in elements) {\r
- extend$2(elements[i], {\r
- ...EventTarget,\r
- ...Element$1,\r
- ...Parent,\r
- ...arrange,\r
- ...A.constructors.Element,\r
- ...Box$1.constructors.Element,\r
- ...Circle.constructors.Element,\r
- ...ClipPath.constructors.Element,\r
- ...css$1,\r
- ...Image.constructors.Element,\r
- ...Mask.constructors.Element,\r
- ...Matrix.constructors.Element,\r
- ...Point.constructors.Element,\r
- ...Runner.constructors.Element,\r
- ...Timeline.constructors.Element,\r
- ...transform$1,\r
- });\r
- }\r
-\r
-\r
- // The main wrapping element\r
- function SVG (element) {\r
- return makeInstance(element)\r
- }\r
-\r
- Object.assign(SVG, Classes);\r
- Object.assign(SVG, tools);\r
+ 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;
+++ /dev/null
-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;
-
-}());
+++ /dev/null
-{"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.Matrix","Classes.Point","Classes.Runner","Classes.Timeline","transform"],"mappings":";;;EAAe,MAAMA,MAAI,CAAC;EAC1B,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,EAAE;EACxC,IAAI,IAAI,CAAC,IAAI,GAAG,GAAE;;EAElB,IAAI,KAAK,IAAI,SAAS,IAAI,UAAU,EAAE;EACtC,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAC;EACtC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAC;EACpC,KAAK;EACL,GAAG;;EAEH,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;EACf,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;EACtC,GAAG;EACH,CAAC;;ECbD;AACA,EAAO,IAAIC,IAAE,GAAG,6BAA4B;AAC5C,EAAO,IAAI,KAAK,GAAG,gCAA+B;AAClD,EAAO,IAAI,KAAK,GAAG,+BAA8B;AACjD,EAAO,IAAI,KAAK,GAAG,wBAAwB;;ECJ3C;AACA,EAAO,IAAI,aAAa,GAA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