diff options
Diffstat (limited to 'dist')
-rw-r--r-- | dist/svg.js | 11631 | ||||
-rw-r--r-- | dist/svg.min.js | 3 | ||||
-rw-r--r-- | dist/svg.new.js | 6240 | ||||
-rw-r--r-- | dist/svg.new.js.map | 1 |
4 files changed, 12313 insertions, 5562 deletions
diff --git a/dist/svg.js b/dist/svg.js index f78ec03..028e4f0 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,5727 +1,6240 @@ -/*! -* svg.js - A lightweight library for manipulating and animating SVG. -* @version 3.0.0 -* https://svgdotjs.github.io/ -* -* @copyright Wout Fierens <wout@mick-wout.com> -* @license MIT -* -* BUILT: Thu Oct 18 2018 11:49:16 GMT+0200 (GMT+02:00) -*/; -
-(function(root, factory) {
- /* istanbul ignore next */
- if (typeof define === 'function' && define.amd) {
- define(function(){
- return factory(root, root.document)
- })
- } else if (typeof exports === 'object') {
- module.exports = root.document ? factory(root, root.document) : function(w){ return factory(w, w.document) }
- } else {
- root.SVG = factory(root, root.document)
- }
-}(typeof window !== "undefined" ? window : this, function(window, document) {
-
-// Check that our browser supports svg
-var supported = !! document.createElementNS &&
- !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect
+var SVG = (function () { + 'use strict'; + + class Base$1 {
+ constructor (node, {extensions = []}) {
+ this.tags = [];
-// If we don't support svg, just exit without doing anything
-if (!supported)
- return {supported: false}
+ for (let extension of extensions) {
+ extension.setup.call(this, node);
+ this.tags.push(extension.name);
+ }
+ }
-// Otherwise, the library will be here
-"use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/* global createElement, capitalize */ - -/* eslint-disable new-cap */ -// The main wrapping element -var SVG = window.SVG = function (element) { - if (SVG.supported) { - element = createElement(element); - return element; - } -}; // Svg must be supported if we reached this stage - - -SVG.supported = true; // Default namespaces - -SVG.ns = 'http://www.w3.org/2000/svg'; -SVG.xmlns = 'http://www.w3.org/2000/xmlns/'; -SVG.xlink = 'http://www.w3.org/1999/xlink'; -SVG.svgjs = 'http://svgjs.com/svgjs'; // Element id sequence - -SVG.did = 1000; // Get next named element id - -SVG.eid = function (name) { - return 'Svgjs' + capitalize(name) + SVG.did++; -}; // Method for element creation - - -SVG.create = function (name) { - // create element - return document.createElementNS(this.ns, name); -}; // Method for extending objects - - -SVG.extend = function (modules, methods) { - var key, i; - modules = Array.isArray(modules) ? modules : [modules]; - - for (i = modules.length - 1; i >= 0; i--) { - if (modules[i]) { - for (key in methods) { - modules[i].prototype[key] = methods[key]; - } - } + is (ability) {
+ return this.tags.includes(ability)
+ }
} -}; // Invent new element - - -SVG.invent = function (config) { - // Create element initializer - var initializer = typeof config.create === 'function' ? config.create : function (node) { - config.inherit.call(this, node || SVG.create(config.create)); - }; // Inherit prototype - - if (config.inherit) { - initializer.prototype = new config.inherit(); - initializer.prototype.constructor = initializer; - } // Extend with methods - - - if (config.extend) { - SVG.extend(initializer, config.extend); - } // Attach construct method to parent - - - if (config.construct) { - SVG.extend(config.parent || SVG.Container, config.construct); - } - - return initializer; -}; // Adopt existing svg elements - - -SVG.adopt = function (node) { - // check for presence of node - if (!node) return null; // make sure a node isn't already adopted - - if (node.instance instanceof SVG.Element) return node.instance; - - if (!(node instanceof window.SVGElement)) { - return new SVG.HtmlNode(node); - } // initialize variables - - - var element; // adopt with element-specific settings - - if (node.nodeName === 'svg') { - element = new SVG.Doc(node); - } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') { - element = new SVG.Gradient(node); - } else if (SVG[capitalize(node.nodeName)]) { - element = new SVG[capitalize(node.nodeName)](node); - } else { - element = new SVG.Parent(node); - } - - return element; -}; // Storage for regular expressions - - -SVG.regex = { - // Parse unit value - numberAndUnit: /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i, - // Parse hex value - hex: /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, - // Parse rgb value - rgb: /rgb\((\d+),(\d+),(\d+)\)/, - // Parse reference id - reference: /#([a-z0-9\-_]+)/i, - // splits a transformation chain - transforms: /\)\s*,?\s*/, - // Whitespace - whitespace: /\s/g, - // Test hex value - isHex: /^#[a-f0-9]{3,6}$/i, - // Test rgb value - isRgb: /^rgb\(/, - // Test css declaration - isCss: /[^:]+:[^;]+;?/, - // Test for blank string - isBlank: /^(\s+)?$/, - // Test for numeric string - isNumber: /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, - // Test for percent value - isPercent: /^-?[\d.]+%$/, - // Test for image url - isImage: /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i, - // split at whitespace and comma - delimiter: /[\s,]+/, - // The following regex are used to parse the d attribute of a path - // Matches all hyphens which are not after an exponent - hyphen: /([^e])-/gi, - // Replaces and tests for all path letters - pathLetters: /[MLHVCSQTAZ]/gi, - // yes we need this one, too - isPathLetter: /[MLHVCSQTAZ]/i, - // matches 0.154.23.45 - numbersWithDots: /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi, - // matches . - dots: /\./g -}; -SVG.utils = { - // Map function - map: 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 - filter: function filter(array, block) { - var i; - var il = array.length; - var result = []; - - for (i = 0; i < il; i++) { - if (block(array[i])) { - result.push(array[i]); - } - } - - return result; - }, - // Degrees to radians - radians: function radians(d) { - return d % 360 * Math.PI / 180; - }, - // Radians to degrees - degrees: function degrees(r) { - return r * 180 / Math.PI % 360; - }, - filterSVGElements: function filterSVGElements(nodes) { - return this.filter(nodes, function (el) { - return el instanceof window.SVGElement; - }); - } -}; - -SVG.void = function () {}; - -SVG.defaults = { - // Default animation values - timeline: { - duration: 400, - ease: '>', - delay: 0 - }, - // Default attribute values - 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' - } -}; -SVG.Queue = SVG.invent({ - create: function create() { - this._first = null; - this._last = null; - }, - extend: { - push: 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; - }, - shift: 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 - first: function first() { - return this._first && this._first.value; - }, - // Shows us the last item in the list - last: function last() { - return this._last && this._last.value; - }, - // Removes the item that was returned from the push - remove: 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; - } - } -}); -/* globals fullHex, compToHex */ - -/*
-
-Color {
- constructor (a, b, c, space) {
- space: 'hsl'
- a: 30
- b: 20
- c: 10
- },
-
- toRgb () { return new Color in rgb space }
- toHsl () { return new Color in hsl space }
- toLab () { return new Color in lab space }
-
- toArray () { [space, a, b, c] }
- fromArray () { convert it back }
-}
-
-// Conversions aren't always exact because of monitor profiles etc...
-new Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()
-new Color(100, 100, 100, [space])
-new Color('hsl(30, 20, 10)')
-
-// Sugar
-SVG.rgb(30, 20, 50).lab()
-SVG.hsl()
-SVG.lab('rgb(100, 100, 100)')
-*/ -// Module for color convertions - -SVG.Color = function (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 (SVG.regex.isRgb.test(color)) { - // get rgb values - match = SVG.regex.rgb.exec(color.replace(SVG.regex.whitespace, '')); // parse numeric values + // 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'; - this.r = parseInt(match[1]); - this.g = parseInt(match[2]); - this.b = parseInt(match[3]); - } else if (SVG.regex.isHex.test(color)) { - // get hex values - match = SVG.regex.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; - } -}; - -SVG.extend(SVG.Color, { - // Default to hex conversion - toString: function toString() { - return this.toHex(); - }, - toArray: function toArray() { - return [this.r, this.g, this.b]; - }, - fromArray: function fromArray(a) { - return new SVG.Color(a); - }, - // Build hex value - toHex: function toHex() { - return '#' + compToHex(Math.round(this.r)) + compToHex(Math.round(this.g)) + compToHex(Math.round(this.b)); - }, - // Build rgb value - toRgb: function toRgb() { - return 'rgb(' + [this.r, this.g, this.b].join() + ')'; - }, - // Calculate true brightness - brightness: function brightness() { - return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11; - }, - // Make color morphable - morph: function morph(color) { - this.destination = new SVG.Color(color); - return this; - }, - // Get morphed color at given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; // normalise pos - - pos = pos < 0 ? 0 : pos > 1 ? 1 : pos; // generate morphed color + // 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; - return new SVG.Color({ - r: ~~(this.r + (this.destination.r - this.r) * pos), - g: ~~(this.g + (this.destination.g - this.g) * pos), - b: ~~(this.b + (this.destination.b - this.b) * pos) - }); + 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 ]
} -}); // Testers -// Test if given value is a color string - -SVG.Color.test = function (color) { - color += ''; - return SVG.regex.isHex.test(color) || SVG.regex.isRgb.test(color); -}; // Test if given value is a rgb object - - -SVG.Color.isRgb = function (color) { - return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; -}; // Test if given value is a color - - -SVG.Color.isColor = function (color) { - return SVG.Color.isRgb(color) || SVG.Color.test(color); -}; -/* global arrayClone */ -// Module for array conversion - - -SVG.Array = function (array, fallback) { - array = (array || []).valueOf(); // if array is empty and fallback is provided, use fallback - - if (array.length === 0 && fallback) { - array = fallback.valueOf(); - } // parse array - - - this.value = this.parse(array); -}; - -SVG.extend(SVG.Array, { - // Make array morphable - morph: function morph(array) { - this.destination = this.parse(array); // normalize length of arrays - if (this.value.length !== this.destination.length) { - var lastValue = this.value[this.value.length - 1]; - var lastDestination = this.destination[this.destination.length - 1]; - - while (this.value.length > this.destination.length) { - this.destination.push(lastDestination); - } - - while (this.value.length < this.destination.length) { - this.value.push(lastValue); - } - } - - return this; - }, - // Clean up any duplicate points - settle: function settle() { - // find all unique values - for (var i = 0, il = this.value.length, seen = []; i < il; i++) { - if (seen.indexOf(this.value[i]) === -1) { - seen.push(this.value[i]); - } - } // set new value - - - this.value = seen; - return seen; - }, - // Get morphed array at given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; // generate morphed array - - for (var i = 0, il = this.value.length, array = []; i < il; i++) { - array.push(this.value[i] + (this.destination[i] - this.value[i]) * pos); - } - - return new SVG.Array(array); - }, - toArray: function toArray() { - return this.value; - }, - // Convert array to string - toString: function toString() { - return this.value.join(' '); - }, - // Real value - valueOf: function valueOf() { - return this.value; - }, - // Parse whitespace separated string - parse: 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(SVG.regex.delimiter).map(parseFloat); - }, - // Reverse array - reverse: function reverse() { - this.value.reverse(); - return this; - }, - clone: function clone() { - var clone = new this.constructor(); - clone.value = arrayClone(this.value); - return clone; + 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
} -}); // Poly points array - -SVG.PointArray = function (array, fallback) { - SVG.Array.call(this, array, fallback || [[0, 0]]); -}; // Inherit from SVG.Array - - -SVG.PointArray.prototype = new SVG.Array(); -SVG.PointArray.prototype.constructor = SVG.PointArray; -SVG.extend(SVG.PointArray, { - // Convert array to string - toString: 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(' '); - }, - toArray: function toArray() { - return this.value.reduce(function (prev, curr) { - return [].concat.call(prev, curr); - }, []); - }, - // Convert array to line object - toLine: 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 - at: 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 SVG.PointArray(array); - }, - // Parse point string and flat array - parse: 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(SVG.regex.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: 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 - size: 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; - } + var tools = /*#__PURE__*/Object.freeze({ + nodeOrNew: nodeOrNew$1, + makeNode: makeNode$1, + extend: extend$1, + addFactory: addFactory, + invent: invent + }); - return this; - }, - // Get bounding box of points - bbox: 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 - }; + 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)
+ }
} -}); -/* globals arrayToString, pathRegReplace */ -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]]; + // 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 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()); -} // Path points array - - -SVG.PathArray = function (array, fallback) { - SVG.Array.call(this, array, fallback || [['M', 0, 0]]); -}; // Inherit from SVG.Array - - -SVG.PathArray.prototype = new SVG.Array(); -SVG.PathArray.prototype.constructor = SVG.PathArray; -SVG.extend(SVG.PathArray, { - // Convert array to string - toString: function toString() { - return arrayToString(this.value); - }, - toArray: function toArray() { - return this.value.reduce(function (prev, curr) { - return [].concat.call(prev, curr); - }, []); - }, - // Move path string - move: 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.value.length - 1; i >= 0; i--) { - l = this.value[i][0]; - - if (l === 'M' || l === 'L' || l === 'T') { - this.value[i][1] += x; - this.value[i][2] += y; - } else if (l === 'H') { - this.value[i][1] += x; - } else if (l === 'V') { - this.value[i][1] += y; - } else if (l === 'C' || l === 'S' || l === 'Q') { - this.value[i][1] += x; - this.value[i][2] += y; - this.value[i][3] += x; - this.value[i][4] += y; - - if (l === 'C') { - this.value[i][5] += x; - this.value[i][6] += y; - } - } else if (l === 'A') { - this.value[i][6] += x; - this.value[i][7] += y; - } - } - } - - return this; - }, - // Resize path string - size: 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.value.length - 1; i >= 0; i--) { - l = this.value[i][0]; - - if (l === 'M' || l === 'L' || l === 'T') { - this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x; - this.value[i][2] = (this.value[i][2] - box.y) * height / box.height + box.y; - } else if (l === 'H') { - this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x; - } else if (l === 'V') { - this.value[i][1] = (this.value[i][1] - box.y) * height / box.height + box.y; - } else if (l === 'C' || l === 'S' || l === 'Q') { - this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x; - this.value[i][2] = (this.value[i][2] - box.y) * height / box.height + box.y; - this.value[i][3] = (this.value[i][3] - box.x) * width / box.width + box.x; - this.value[i][4] = (this.value[i][4] - box.y) * height / box.height + box.y; - - if (l === 'C') { - this.value[i][5] = (this.value[i][5] - box.x) * width / box.width + box.x; - this.value[i][6] = (this.value[i][6] - box.y) * height / box.height + box.y; - } - } else if (l === 'A') { - // resize radii - this.value[i][1] = this.value[i][1] * width / box.width; - this.value[i][2] = this.value[i][2] * height / box.height; // move position values - - this.value[i][6] = (this.value[i][6] - box.x) * width / box.width + box.x; - this.value[i][7] = (this.value[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: function equalCommands(pathArray) { - var i, il, equalCommands; - pathArray = new SVG.PathArray(pathArray); - equalCommands = this.value.length === pathArray.value.length; - - for (i = 0, il = this.value.length; equalCommands && i < il; i++) { - equalCommands = this.value[i][0] === pathArray.value[i][0]; - } - - return equalCommands; - }, - // Make path array morphable - morph: function morph(pathArray) { - pathArray = new SVG.PathArray(pathArray); - - if (this.equalCommands(pathArray)) { - this.destination = pathArray; - } else { - this.destination = null; - } - - return this; - }, - // Get morphed path array at given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; - var sourceArray = this.value; - var destinationArray = this.destination.value; - var array = []; - var pathArray = new SVG.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 + var circled = /*#__PURE__*/Object.freeze({ + rx: rx, + ry: ry, + x: x, + y: y, + cx: cx, + cy: cy, + width: width, + height: height, + size: size + }); - 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: function parse(array) { - // if it's already a patharray, no need to parse it - if (array instanceof SVG.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(SVG.regex.numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 - .replace(SVG.regex.pathLetters, ' $& ') // put some room between letters and numbers - .replace(SVG.regex.hyphen, '$1 -') // add space before hyphen - .trim() // trim - .split(SVG.regex.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 SVG.Point(); - var p0 = new SVG.Point(); - var index = 0; - var len = array.length; - - do { - // Test if we have a path letter - if (SVG.regex.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'; - } + 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)
+ }
+ }
+ }; - result.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0)); - } while (len > index); + //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')
+ }
+ }
+ }; - return result; - }, - // Get bounding box of path - bbox: function bbox() { - SVG.parser().path.setAttribute('d', this.toString()); - return SVG.parser.nodes.path.getBBox(); + class Defs extends Base$1 {
+ constructor (node) {
+ super(nodeOrNew$1('defs', node), Defs);
+ }
+
+ flatten () { return this }
+ ungroup () { return this }
} -}); // Module for unit convertions - -SVG.Number = SVG.invent({ - // Initialize - create: function create(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(SVG.regex.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 SVG.Number) { - this.value = value.valueOf(); - this.unit = value.unit; - } - } - }, - // Add methods - extend: { - // Stringalize - toString: function toString() { - return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; - }, - toJSON: function toJSON() { - return this.toString(); - }, - // Convert to primitive - toArray: function toArray() { - return [this.value, this.unit]; - }, - valueOf: function valueOf() { - return this.value; - }, - // Add number - plus: function plus(number) { - number = new SVG.Number(number); - return new SVG.Number(this + number, this.unit || number.unit); - }, - // Subtract number - minus: function minus(number) { - number = new SVG.Number(number); - return new SVG.Number(this - number, this.unit || number.unit); - }, - // Multiply number - times: function times(number) { - number = new SVG.Number(number); - return new SVG.Number(this * number, this.unit || number.unit); - }, - // Divide number - divide: function divide(number) { - number = new SVG.Number(number); - return new SVG.Number(this / number, this.unit || number.unit); - }, - // Convert to different unit - to: function to(unit) { - var number = new SVG.Number(this); - - if (typeof unit === 'string') { - number.unit = unit; - } - - return number; - }, - // Make number morphable - morph: function morph(number) { - this.destination = new SVG.Number(number); - - if (number.relative) { - this.destination.value += this.value; - } - return this; - }, - // Get morphed number at given position - at: function at(pos) { - // Make sure a destination is defined - if (!this.destination) return this; // Generate new morphed number + //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())
+ }
+ }
+ }; - return new SVG.Number(this.destination).minus(this).times(pos).plus(this); - } - } -}); -SVG.EventTarget = SVG.invent({ - create: function create() {}, - extend: { - // Bind given event to listener - on: function on(event, listener, binding, options) { - SVG.on(this, event, listener, binding, options); - return this; - }, - // Unbind event from listener - off: function off(event, listener) { - SVG.off(this, event, listener); - return this; - }, - dispatch: function dispatch(event, data) { - return SVG.dispatch(this, event, data); - }, - // Fire given event - fire: function fire(event, data) { - this.dispatch(event, data); - return this; - } + 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
+ }
} -}); -/* global createElement */ - -SVG.HtmlNode = SVG.invent({ - inherit: SVG.EventTarget, - create: function create(element) { - this.node = element; - }, - extend: { - add: function add(element, i) { - element = createElement(element); - - if (element.node !== this.node.children[i]) { - this.node.insertBefore(element.node, this.node.children[i] || null); - } - return this; - }, - put: function put(element, i) { - this.add(element, i); - return element; - }, - getEventTarget: function getEventTarget() { - return this.node; - } + // 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) })
} -}); -/* global proportionalSize, assignNewId, createElement, matches, is */ - -SVG.Element = SVG.invent({ - inherit: SVG.EventTarget, - // Initialize node - create: function create(node) { - // event listener - this.events = {}; // initialize data object - - this.dom = {}; // create circular reference - - this.node = node; - if (this.node) { - this.type = node.nodeName; - this.node.instance = this; - this.events = node.events || {}; - - 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')) || {}); - } - } - }, - // Add class methods - extend: { - // Move over x-axis - x: function x(_x) { - return this.attr('x', _x); - }, - // Move over y-axis - y: function y(_y) { - return this.attr('y', _y); - }, - // Move by center over x-axis - cx: function cx(x) { - return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); - }, - // Move by center over y-axis - cy: function cy(y) { - return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); - }, - // Move element to given x and y values - move: function move(x, y) { - return this.x(x).y(y); - }, - // Move element by its center - center: function center(x, y) { - return this.cx(x).cy(y); - }, - // Set width of element - width: function width(_width) { - return this.attr('width', _width); - }, - // Set height of element - height: function height(_height) { - return this.attr('height', _height); - }, - // Set element size to given width and height - size: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.width(new SVG.Number(p.width)).height(new SVG.Number(p.height)); - }, - // Clone element - clone: 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 - remove: function remove() { - if (this.parent()) { - this.parent().removeElement(this); - } - - return this; - }, - // Replace element - replace: function replace(element) { - this.after(element).remove(); - return element; - }, - // Add element to given container and return self - addTo: function addTo(parent) { - return createElement(parent).put(this); - }, - // Add element to given container and return container - putIn: function putIn(parent) { - return createElement(parent).add(this); - }, - // Get / set id - id: function id(_id) { - // generate new id if no id set - if (typeof _id === 'undefined' && !this.node.id) { - this.node.id = SVG.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 - inside: 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; - }, - // Show element - show: function show() { - return this.css('display', ''); - }, - // Hide element - hide: function hide() { - return this.css('display', 'none'); - }, - // Is element visible? - visible: function visible() { - return this.css('display') !== 'none'; - }, - // Return id on string conversion - toString: function toString() { - return this.id(); - }, - // Return array of classes on the node - classes: function classes() { - var attr = this.attr('class'); - return attr == null ? [] : attr.trim().split(SVG.regex.delimiter); - }, - // Return true if class exists on the node, false otherwise - hasClass: function hasClass(name) { - return this.classes().indexOf(name) !== -1; - }, - // Add class to the node - addClass: 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 - removeClass: 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 - toggleClass: function toggleClass(name) { - return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); - }, - // Get referenced element form attribute value - reference: function reference(attr) { - return SVG.get(this.attr(attr)); - }, - // Returns the parent element instance - parent: function parent(type) { - var parent = this; // check for parent - - if (!parent.node.parentNode) return null; // get parent element - - parent = SVG.adopt(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 = SVG.adopt(parent.node.parentNode); - } - }, - // Get parent document - doc: function doc() { - var p = this.parent(SVG.Doc); - return p && p.doc(); - }, - // Get defs - defs: function defs() { - return this.doc().defs(); - }, - // return array of all ancestors of given type up to the root svg - parents: 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 - matches: function matches(selector) { - return _matches(this.node, selector); - }, - // Returns the svg node to call native svg methods on it - native: function native() { - return this.node; - }, - // Import raw svg - svg: function svg(_svg) { - var well, len; // act as a setter if svg is given - - if (_svg && this instanceof SVG.Parent) { - // create temporary holder - well = document.createElementNS(SVG.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 - writeDataToDom: function writeDataToDom() { - // dump variables recursively - if (this.is(SVG.Parent)) { - 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; - }, - // set given data to the elements data property - setData: function setData(o) { - this.dom = o; - return this; - }, - is: function is(obj) { - return _is(this, obj); - }, - getEventTarget: function getEventTarget() { - return this.node; - } - } -}) // Add events to elements -; -['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel'].forEach(function (event) { - // add event to SVG.Element - SVG.Element.prototype[event] = function (f) { - if (f === null) { - SVG.off(this, event); - } else { - SVG.on(this, event, f); - } + var gradiented = /*#__PURE__*/Object.freeze({ + from: from, + to: to + }); - return this; + //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)
+ }
+ }
}; -}); -SVG.listenerId = 0; // Add event binder in the SVG namespace - -SVG.on = function (node, events, listener, binding, options) { - var l = listener.bind(binding || node); - var n = node instanceof SVG.EventTarget ? node.getEventTarget() : node; // events can be an array of events or a string of events - - events = Array.isArray(events) ? events : events.split(SVG.regex.delimiter); // ensure instance object for nodes which are not adopted - - n.instance = n.instance || { - events: {} // pull event handlers from the element + 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())
+ }
+ }
}; - var bag = n.instance.events; // add id to listener - - if (!listener._svgjsListenerId) { - listener._svgjsListenerId = ++SVG.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 - - -SVG.off = function (node, events, listener, options) { - var n = node instanceof SVG.EventTarget ? node.getEventTarget() : node; - 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(SVG.regex.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]) { - SVG.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) { - SVG.off(n, [event, ns].join('.')); - } - } - } - } else if (ev) { - // remove all listeners for the event - if (bag[ev]) { - for (namespace in bag[ev]) { - SVG.off(n, [ev, namespace].join('.')); - } - - delete bag[ev]; - } - } else { - // remove all listeners on a given node - for (event in bag) { - SVG.off(n, event); - } - - n.instance.events = {}; - } - }); -}; - -SVG.dispatch = function (node, event, data) { - var n = node instanceof SVG.EventTarget ? node.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); + //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
+ }
} - return event; -}; -/* global abcdef arrayToMatrix closeEnough formatTransforms isMatrixLike matrixMultiply */ - - -SVG.Matrix = SVG.invent({ - // Initialize - create: function create(source) { - var base = arrayToMatrix([1, 0, 0, 1, 0, 0]); // ensure source as object - - source = source instanceof SVG.Element ? source.matrixify() : typeof source === 'string' ? arrayToMatrix(source.split(SVG.regex.delimiter).map(parseFloat)) : Array.isArray(source) ? arrayToMatrix(source) : _typeof(source) === 'object' && isMatrixLike(source) ? source : _typeof(source) === 'object' ? new SVG.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; - }, - // Add methods - extend: { - // Clones this matrix - clone: function clone() { - return new SVG.Matrix(this); - }, - // Transform a matrix into another matrix by manipulating the space - transform: function transform(o) { - // Check if o is a matrix and then left multiply it directly - if (isMatrixLike(o)) { - var matrix = new SVG.Matrix(o); - return matrix.multiplyO(this); - } // Get the proposed transformations and the current transformations - - - var t = formatTransforms(o); - var current = this; - - var _transform = new SVG.Point(t.ox, t.oy).transform(current), - ox = _transform.x, - oy = _transform.y; // Construct the resulting matrix - - - var transformer = new SVG.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 SVG.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 - compose: 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 SVG.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: 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 - }; - }, - // Morph one matrix into another - morph: function morph(matrix) { - // Store new destination - this.destination = new SVG.Matrix(matrix); - return this; - }, - // Get morphed matrix at a given position - at: function at(pos) { - // Make sure a destination is defined - if (!this.destination) return this; // Calculate morphed matrix at a given position - - var matrix = new SVG.Matrix({ - a: this.a + (this.destination.a - this.a) * pos, - b: this.b + (this.destination.b - this.b) * pos, - c: this.c + (this.destination.c - this.c) * pos, - d: this.d + (this.destination.d - this.d) * pos, - e: this.e + (this.destination.e - this.e) * pos, - f: this.f + (this.destination.f - this.f) * pos - }); - return matrix; - }, - // Left multiplies by the given matrix - multiply: function multiply(matrix) { - return this.clone().multiplyO(matrix); - }, - multiplyO: function multiplyO(matrix) { - // Get the matrices - var l = this; - var r = matrix instanceof SVG.Matrix ? matrix : new SVG.Matrix(matrix); - return matrixMultiply(l, r, this); - }, - lmultiply: function lmultiply(matrix) { - return this.clone().lmultiplyO(matrix); - }, - lmultiplyO: function lmultiplyO(matrix) { - var r = this; - var l = matrix instanceof SVG.Matrix ? matrix : new SVG.Matrix(matrix); - return matrixMultiply(l, r, this); - }, - // Inverses matrix - inverseO: 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; - }, - inverse: function inverse() { - return this.clone().inverseO(); - }, - // Translate matrix - translate: function translate(x, y) { - return this.clone().translateO(x, y); - }, - translateO: function translateO(x, y) { - this.e += x || 0; - this.f += y || 0; - return this; - }, - // Scale matrix - scale: function scale(x, y, cx, cy) { - var _this$clone; - - return (_this$clone = this.clone()).scaleO.apply(_this$clone, arguments); - }, - scaleO: 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 - rotate: function rotate(r, cx, cy) { - return this.clone().rotateO(r, cx, cy); - }, - rotateO: 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 = SVG.utils.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 - flip: function flip(axis, around) { - return this.clone().flipO(axis, around); - }, - flipO: 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 - shear: function shear(a, cx, cy) { - return this.clone().shearO(a, cx, cy); - }, - shearO: function shearO(lx) { - var cx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - 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 - skew: function skew(x, y, cx, cy) { - var _this$clone2; - - return (_this$clone2 = this.clone()).skewO.apply(_this$clone2, arguments); - }, - skewO: 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 = SVG.utils.radians(x); - y = SVG.utils.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 - skewX: function skewX(x, cx, cy) { - return this.skew(x, 0, cx, cy); - }, - skewXO: function skewXO(x, cx, cy) { - return this.skewO(x, 0, cx, cy); - }, - // SkewY - skewY: function skewY(y, cx, cy) { - return this.skew(0, y, cx, cy); - }, - skewYO: function skewYO(y, cx, cy) { - return this.skewO(0, y, cx, cy); - }, - // Transform around a center point - aroundO: function aroundO(cx, cy, matrix) { - var dx = cx || 0; - var dy = cy || 0; - return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); - }, - around: function around(cx, cy, matrix) { - return this.clone().aroundO(cx, cy, matrix); - }, - // Convert to native SVGMatrix - native: function native() { - // create new matrix - var matrix = SVG.parser.nodes.svg.node.createSVGMatrix(); // update with current values - - for (var i = abcdef.length - 1; i >= 0; i--) { - matrix[abcdef[i]] = this[abcdef[i]]; - } + class A extends Base$1{
+ constructor (node) {
+ super(nodeOrNew$1('a', node), A);
+ }
+
+ // Link url
+ to (url) {
+ return this.attr('href', url, xlink)
+ }
+
+ // Link target attribute
+ target (target) {
+ return this.attr('target', target)
+ }
+ }
+
+ A.constructors = {
+ Container: {
+ // Create a hyperlink element
+ link: function (url) {
+ return this.put(new A()).to(url)
+ }
+ },
+ Element: {
+ // Create a hyperlink element
+ linkTo: function (url) {
+ var link = new A();
+
+ if (typeof url === 'function') { url.call(link, link); } else {
+ link.to(url);
+ }
+
+ return this.parent().put(link).put(this)
+ }
+ }
+ }; - return matrix; - }, - // Check if two matrices are equal - equals: function equals(other) { - var comp = new SVG.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: function toString() { - return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; - }, - toArray: function toArray() { - return [this.a, this.b, this.c, this.d, this.e, this.f]; - }, - valueOf: function valueOf() { - return { - a: this.a, - b: this.b, - c: this.c, - d: this.d, - e: this.e, - f: this.f - }; - } - }, - // Define parent - parent: SVG.Element, - // Add parent method - construct: { - // Get current matrix - ctm: function ctm() { - return new SVG.Matrix(this.node.getCTM()); - }, - // Get current screen matrix - screenCTM: function screenCTM() { - /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537
- This is needed because FF does not return the transformation matrix
- for the inner coordinate system when getScreenCTM() is called on nested svgs.
- However all other Browsers do that */ - if (this instanceof SVG.Doc && !this.isRoot()) { - var rect = this.rect(1, 1); - var m = rect.node.getScreenCTM(); - rect.remove(); - return new SVG.Matrix(m); - } + //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'
+ })
+ }
+ }
+ }; - return new SVG.Matrix(this.node.getScreenCTM()); - } + // // 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
} -}); // let extensions = {} -// ['rotate'].forEach((method) => { -// let methodO = method + 'O' -// extensions[method] = function (...args) { -// return new SVG.Matrix(this)[methodO](...args) -// } -// }) -// -// SVG.extend(SVG.Matrix, extensions) -// function matrixMultiplyParams (matrix, a, b, c, d, e, f) { -// return matrixMultiply({a, b, c, d, e, f}, matrix, matrix) -// } - -SVG.Point = SVG.invent({ - // Initialize - create: function create(x, y, base) { - 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; - }, - // Add methods - extend: { - // Clone point - clone: function clone() { - return new SVG.Point(this); - }, - // Morph one point into another - morph: function morph(x, y) { - // store new destination - this.destination = new SVG.Point(x, y); - return this; - }, - // Get morphed point at a given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; // calculate morphed matrix at a given position - - var point = new SVG.Point({ - x: this.x + (this.destination.x - this.x) * pos, - y: this.y + (this.destination.y - this.y) * pos - }); - return point; - }, - // Convert to native SVGPoint - native: function native() { - // create new point - var point = SVG.parser.nodes.svg.node.createSVGPoint(); // update with current values - point.x = this.x; - point.y = this.y; - return point; - }, - // transform point with matrix - transform: 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 + class Image extends Base$1 {
+ constructor (node) {
+ super(nodeOrNew$1('image', node), Image);
+ }
+
+ // (re)load image
+ load (url, callback) {
+ if (!url) return this
+
+ var img = new window.Image();
+
+ on(img, 'load', function (e) {
+ var p = this.parent(Pattern);
+
+ // ensure image size
+ if (this.width() === 0 && this.height() === 0) {
+ this.size(img.width, img.height);
+ }
+
+ if (p instanceof Pattern) {
+ // ensure pattern size if not set
+ if (p.width() === 0 && p.height() === 0) {
+ p.size(this.width(), this.height());
+ }
+ }
+
+ if (typeof callback === 'function') {
+ callback.call(this, {
+ width: img.width,
+ height: img.height,
+ ratio: img.width / img.height,
+ url: url
+ });
+ }
+ }, this);
+
+ on(img, 'load error', function () {
+ // dont forget to unbind memory leaking events
+ off(img);
+ });
+
+ return this.attr('href', (img.src = url), xlink)
+ }
+ }
+
+ Image.constructors = {
+ Container: {
+ // create image element, load image and set its size
+ image (source, callback) {
+ return this.put(new Image()).size(0, 0).load(source, callback)
+ }
+ }
+ }; - return new SVG.Point(x, y); - } - } -}); -SVG.extend(SVG.Element, { - // Get point - point: function point(x, y) { - return new SVG.Point(x, y).transform(this.screenCTM().inverse()); + /* 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)
+ }
} -}); -SVG.extend(SVG.Element, { - // Set svg element attribute - attr: function attr(a, v, n) { - // act as full getter - if (a == null) { - // get an object of attributes - a = {}; - v = this.node.attributes; - - for (n = v.length - 1; n >= 0; n--) { - a[v[n].nodeName] = SVG.regex.isNumber.test(v[n].nodeValue) ? parseFloat(v[n].nodeValue) : v[n].nodeValue; - } - - return a; - } else if (_typeof(a) === 'object') { - // apply every attribute individually if an object is passed - for (v in a) { - this.attr(v, a[v]); - } - } else if (v === null) { - // remove value - this.node.removeAttribute(a); - } else if (v == null) { - // act as a getter if the first and only argument is not an object - v = this.node.getAttribute(a); - return v == null ? SVG.defaults.attrs[a] : SVG.regex.isNumber.test(v) ? parseFloat(v) : v; - } else { - // convert image fill and stroke to patterns - if (a === 'fill' || a === 'stroke') { - if (SVG.regex.isImage.test(v)) { - v = this.doc().defs().image(v); - } - - if (v instanceof SVG.Image) { - v = this.doc().defs().pattern(0, 0, function () { - this.add(v); - }); - } - } // ensure correct numeric values (also accepts NaN and Infinity) - - - if (typeof v === 'number') { - v = new SVG.Number(v); - } else if (SVG.Color.isColor(v)) { - // ensure full hex color - v = new SVG.Color(v); - } else if (Array.isArray(v)) { - // parse array values - v = new SVG.Array(v); - } // if the passed attribute is leading... - - - if (a === 'leading') { - // ... call the leading method instead - if (this.leading) { - this.leading(v); - } - } else { - // set given attribute on node - typeof n === 'string' ? this.node.setAttributeNS(n, a, v.toString()) : this.node.setAttribute(a, v.toString()); - } // rebuild if required - - if (this.rebuild && (a === 'font-size' || a === 'x')) { - this.rebuild(a, v); - } - } - - return 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}
+ }
} -}); -/* global arrayToMatrix getOrigin isMatrixLike */ - -SVG.extend(SVG.Element, { - // Reset all transformations - untransform: function untransform() { - return this.attr('transform', null); - }, - // merge the whole transformation chain into one matrix and returns it - matrixify: function matrixify() { - var matrix = (this.attr('transform') || ''). // split transformations - split(SVG.regex.transforms).slice(0, -1).map(function (str) { - // generate key => value pairs - var kv = str.trim().split('('); - return [kv[0], kv[1].split(SVG.regex.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 SVG.Matrix()); - return matrix; - }, - // add an element to another parent without changing the visual representation on the screen - toParent: 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 - toDoc: function toDoc() { - return this.toParent(this.doc()); - } -}); -SVG.extend(SVG.Element, { - // Add transformations - transform: function transform(o, relative) { - // Act as a getter if no object was passed - if (o == null || typeof o === 'string') { - var decomposed = new SVG.Matrix(this).decompose(); - return decomposed[o] || decomposed; - } + 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]
+ )
+ }
+ }
+ }; - 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 SVG.Element or an SVG.Matrix or nothing + // 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')
+ }
+ }
+ }; - var cleanRelative = relative === true ? this : relative || false; - var result = new SVG.Matrix(cleanRelative).transform(o); - return this.attr('transform', result); + 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
} -}); -/* global camelCase */ - -SVG.extend(SVG.Element, { - // Dynamic style generator - css: function css(s, v) { - var ret = {}; - var t, i; - - 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) { - 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(s)) { - for (i = s.length; i--;) { - ret[camelCase(s[i])] = this.node.style[camelCase(s[i])]; - } - return ret; - } // get style for property - - - if (typeof s === 'string') { - return this.node.style[camelCase(s)]; - } // set styles in object - - - if (_typeof(s) === 'object') { - for (i in s) { - // set empty string if null/undefined/'' was given - this.node.style[camelCase(i)] = s[i] == null || SVG.regex.isBlank.test(s[i]) ? '' : s[i]; - } - } - } // set style for property - - - if (arguments.length === 2) { - this.node.style[camelCase(s)] = v == null || SVG.regex.isBlank.test(v) ? '' : v; - } + 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())
+ }
+ }
+ }; - return this; + 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()
+ }
} -}); -/* global createElement */ - -SVG.Parent = SVG.invent({ - // Initialize node - create: function create(node) { - SVG.Element.call(this, node); - }, - // Inherit from - inherit: SVG.Element, - // Add class methods - extend: { - // Returns all child elements - children: function children() { - return SVG.utils.map(this.node.children, function (node) { - return SVG.adopt(node); - }); - }, - // Add given element at a position - add: function add(element, i) { - element = createElement(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 - put: function put(element, i) { - this.add(element, i); - return element.instance || element; - }, - // Checks if the given element is a child - has: function has(element) { - return this.index(element) >= 0; - }, - // Gets index of given element - index: function index(element) { - return [].slice.call(this.node.children).indexOf(element.node); - }, - // Get a element at the given index - get: function get(i) { - return SVG.adopt(this.node.children[i]); - }, - // Get first child - first: function first() { - return this.get(0); - }, - // Get the last child - last: function last() { - return this.get(this.node.children.length - 1); - }, - // Iterates over all children and invokes a given block - each: function each(block, deep) { - var children = this.children(); - var i, il; - - for (i = 0, il = children.length; i < il; i++) { - if (children[i] instanceof SVG.Element) { - block.apply(children[i], [i, children]); - } - - if (deep && children[i] instanceof SVG.Parent) { - children[i].each(block, deep); - } - } - - return this; - }, - // Remove a given child - removeElement: function removeElement(element) { - this.node.removeChild(element.node); - return this; - }, - // Remove all elements in this container - clear: function clear() { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } // remove defs reference + 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())
+ }
+ }
+ }; - delete this._defs; - return this; - } + 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)
} -}); -SVG.extend(SVG.Parent, { - flatten: function flatten(parent) { - // flattens is only possible for nested svgs and groups - if (!(this instanceof SVG.G || this instanceof SVG.Doc)) { - return this; - } - - parent = parent || (this instanceof SVG.Doc && this.isRoot() ? this : this.parent(SVG.Parent)); - this.each(function () { - if (this instanceof SVG.Defs) return this; - if (this instanceof SVG.Parent) return this.flatten(parent); - return this.toParent(parent); - }); // we need this so that SVG.Doc does not get removed - - this.node.firstElementChild || this.remove(); - return this; - }, - ungroup: function ungroup(parent) { - // ungroup is only possible for nested svgs and groups - if (!(this instanceof SVG.G || this instanceof SVG.Doc && !this.isRoot())) { - return this; - } - parent = parent || this.parent(SVG.Parent); - this.each(function () { - return this.toParent(parent); - }); // we need this so that SVG.Doc does not get removed + var pointed = /*#__PURE__*/Object.freeze({ + MorphArray: MorphArray, + x: x$1, + y: y$1, + width: width$1, + height: height$1 + }); - this.remove(); - return this; - } -}); -SVG.Container = SVG.invent({ - // Initialize node - create: function create(node) { - SVG.Element.call(this, node); - }, - // Inherit from - inherit: SVG.Parent -}); -SVG.Defs = SVG.invent({ - // Initialize node - create: 'defs', - // Inherit from - inherit: SVG.Container -}); -SVG.G = SVG.invent({ - // Initialize node - create: 'g', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: {}, - // Add parent method - construct: { - // Create a group element - group: function group() { - return this.put(new SVG.G()); - } + // 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))
} -}); // ### This module adds backward / forward functionality to elements. -// - -SVG.extend(SVG.Element, { - // Get all siblings, including myself - siblings: function siblings() { - return this.parent().children(); - }, - // Get the curent position siblings - position: function position() { - return this.parent().index(this); - }, - // Get the next element (will return null if there is none) - next: function next() { - return this.siblings()[this.position() + 1]; - }, - // Get the next element (will return null if there is none) - prev: function prev() { - return this.siblings()[this.position() - 1]; - }, - // Send given element one step forward - 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 SVG.Doc) { - p.node.appendChild(p.defs().node); - } - - return this; - }, - // Send given element one step backward - 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 - front: function front() { - var p = this.parent(); // Move node forward - - p.node.appendChild(this.node); // Make sure defs node is always at the top + var poly = /*#__PURE__*/Object.freeze({ + array: array, + plot: plot, + clear: clear, + move: move, + size: size$1 + }); - if (p instanceof SVG.Doc) { - p.node.appendChild(p.defs().node); - } + 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)
+ }
+ }
+ }; - return this; - }, - // Send given element all the way to the back - back: function back() { - if (this.position() > 0) { - this.parent().removeElement(this).add(this, 0); - } + class Symbol extends Base$1 {
+ // Initialize node
+ constructor (node) {
+ super(nodeOrNew$1('symbol', node), Symbol);
+ }
+ }
+
+ Symbol.constructors = {
+ Container: {
+ symbol () {
+ return this.put(new Symbol())
+ }
+ }
+ }; - return this; - }, - // Inserts a given element before the targeted element - before: function before(element) { - element.remove(); - var i = this.position(); - this.parent().add(element, i); - return this; - }, - // Insters a given element after the targeted element - after: function after(element) { - element.remove(); - var i = this.position(); - this.parent().add(element, i + 1); - return this; - } -}); -SVG.Mask = SVG.invent({ - // Initialize node - create: 'mask', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Unmask all masked elements and remove itself - remove: function remove() { - // unmask all targets - this.targets().forEach(function (el) { - el.unmask(); - }); // remove mask from parent + 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'
+ }; - return SVG.Element.prototype.remove.call(this); - }, - targets: function targets() { - return SVG.select('svg [mask*="' + this.id() + '"]'); - } - }, - // Add parent method - construct: { - // Create masking element - mask: function mask() { - return this.defs().put(new SVG.Mask()); - } + // 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()
} -}); -SVG.extend(SVG.Element, { - // Distribute mask to svg element - maskWith: function maskWith(element) { - // use given mask or create a new one - var masker = element instanceof SVG.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'); - } -}); -SVG.ClipPath = SVG.invent({ - // Initialize node - create: 'clipPath', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Unclip all clipped elements and remove itself - remove: function remove() { - // unclip all targets - this.targets().forEach(function (el) { - el.unclip(); - }); // remove clipPath from parent + var textable = /*#__PURE__*/Object.freeze({ + plain: plain, + length: length + }); - return SVG.Element.prototype.remove.call(this); - }, - targets: function targets() { - return SVG.select('svg [clip-path*="' + this.id() + '"]'); - } - }, - // Add parent method - construct: { - // Create clipping element - clip: function clip() { - return this.defs().put(new SVG.ClipPath()); - } - } -}); // + 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)
+ }
+ }
+ }; -SVG.extend(SVG.Element, { - // Distribute clipPath to svg element - clipWith: function clipWith(element) { - // use given clip or create a new one - var clipper = element instanceof SVG.ClipPath ? element : this.parent().clip().add(element); // apply mask + 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; - 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'); - } -}); -SVG.Gradient = SVG.invent({ - // Initialize node - create: function create(type) { - SVG.Element.call(this, _typeof(type) === 'object' ? type : SVG.create(type + 'Gradient')); - }, - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Add a color stop - stop: function stop(offset, color, opacity) { - return this.put(new SVG.Stop()).update(offset, color, opacity); - }, - // Update gradient - update: function update(block) { - // remove all stops - this.clear(); // invoke passed block + 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)
+ }
+ }
+ }; - if (typeof block === 'function') { - block.call(this, this); - } - return this; - }, - // Return the fill id - url: function url() { - return 'url(#' + this.id() + ')'; - }, - // Alias string convertion to fill - toString: function toString() { - return this.url(); - }, - // custom attr to handle transform - attr: function attr(a, b, c) { - if (a === 'transform') a = 'gradientTransform'; - return SVG.Container.prototype.attr.call(this, a, b, c); - } - }, - // Add parent method - construct: { - // Create gradient element in defs - gradient: function gradient(type, block) { - return this.defs().gradient(type, block); - } - } -}); // Add animatable methods to both gradient and fx module -SVG.extend([SVG.Gradient, SVG.Timeline], { - // From position - from: function from(x, y) { - return (this._target || this).type === 'radialGradient' ? this.attr({ - fx: new SVG.Number(x), - fy: new SVG.Number(y) - }) : this.attr({ - x1: new SVG.Number(x), - y1: new SVG.Number(y) - }); - }, - // To position - to: function to(x, y) { - return (this._target || this).type === 'radialGradient' ? this.attr({ - cx: new SVG.Number(x), - cy: new SVG.Number(y) - }) : this.attr({ - x2: new SVG.Number(x), - y2: new SVG.Number(y) - }); - } -}); // Base gradient generation + 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 + }); -SVG.extend(SVG.Defs, { - // define gradient - gradient: function gradient(type, block) { - return this.put(new SVG.Gradient(type)).update(block); + 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)
} -}); -SVG.Stop = SVG.invent({ - // Initialize node - create: 'stop', - // Inherit from - inherit: SVG.Element, - // Add class methods - extend: { - // add color stops - update: function update(o) { - if (typeof o === 'number' || o instanceof SVG.Number) { - o = { - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - }; - } // set attributes + var adopter = /*#__PURE__*/Object.freeze({ + makeInstance: makeInstance, + adopt: adopt$1, + eid: eid, + assignNewId: assignNewId + }); - 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 SVG.Number(o.offset)); - return this; - } + 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;
+ }
} -}); -SVG.Pattern = SVG.invent({ - // Initialize node - create: 'pattern', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Return the fill id - url: function url() { - return 'url(#' + this.id() + ')'; - }, - // Update pattern by rebuilding - update: function update(block) { - // remove content - this.clear(); // invoke passed block - if (typeof block === 'function') { - block.call(this, this); - } + const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + timer: window.performance || window.Date, + transforms: [], - return this; - }, - // Alias string convertion to fill - toString: function toString() { - return this.url(); - }, - // custom attr to handle transform - attr: function attr(a, b, c) { - if (a === 'transform') a = 'patternTransform'; - return SVG.Container.prototype.attr.call(this, a, b, c); - } - }, - // Add parent method - construct: { - // Create pattern element in defs - pattern: function pattern(width, height, block) { - return this.defs().pattern(width, height, block); - } - } -}); -SVG.extend(SVG.Defs, { - // Define gradient - pattern: function pattern(width, height, block) { - return this.put(new SVG.Pattern()).update(block).attr({ - x: 0, - y: 0, - width: width, - height: height, - patternUnits: 'userSpaceOnUse' - }); - } -}); -SVG.Doc = SVG.invent({ - // Initialize node - create: function create(node) { - SVG.Element.call(this, node || SVG.create('svg')); // set svg element attributes and ensure defs node + frame (fn) { + // Store the node + var node = Animator.frames.push({ run: fn }); - this.namespace(); - }, - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - isRoot: 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 - doc: function doc() { - if (this.isRoot()) return this; - return SVG.Element.prototype.doc.call(this); - }, - // Add namespaces - namespace: function namespace() { - if (!this.isRoot()) return this.doc().namespace(); - return this.attr({ - xmlns: SVG.ns, - version: '1.1' - }).attr('xmlns:xlink', SVG.xlink, SVG.xmlns).attr('xmlns:svgjs', SVG.svgjs, SVG.xmlns); - }, - // Creates and returns defs element - defs: function defs() { - if (!this.isRoot()) return this.doc().defs(); - return SVG.adopt(this.node.getElementsByTagName('defs')[0]) || this.put(new SVG.Defs()); - }, - // custom parent method - parent: function parent(type) { - if (this.isRoot()) { - return this.node.parentNode.nodeName === '#document' ? null : this.node.parentNode; + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = window.requestAnimationFrame(Animator._draw); } - return SVG.Element.prototype.parent.call(this, type); + // Return the node so we can remove it easily + return node }, - // Removes the doc from the DOM - remove: function remove() { - if (!this.isRoot()) { - return SVG.Element.prototype.remove.call(this); - } - if (this.parent()) { - this.parent().removeChild(this.node); - } - - return this; + transform_frame (fn, id) { + Animator.transforms[id] = fn; }, - clear: function clear() { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } - - return this; - } - }, - construct: { - // Create nested svg document - nested: function nested() { - return this.put(new SVG.Doc()); - } - } -}); -SVG.Shape = SVG.invent({ - // Initialize node - create: function create(node) { - SVG.Element.call(this, node); - }, - // Inherit from - inherit: SVG.Element -}); -SVG.Bare = SVG.invent({ - // Initialize - create: function create(element, inherit) { - // construct element - SVG.Element.call(this, SVG.create(element)); // inherit custom methods - if (inherit) { - for (var method in inherit.prototype) { - if (typeof inherit.prototype[method] === 'function') { - this[method] = inherit.prototype[method]; - } - } - } - }, - // Inherit from - inherit: SVG.Element, - // Add methods - extend: { - // Insert some plain text - words: function words(text) { - // remove contents - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } // create text node + timeout (fn, delay) { + delay = delay || 0; + // Work out when the event should fire + var time = Animator.timer.now() + delay; - this.node.appendChild(document.createTextNode(text)); - return this; - } - } -}); -SVG.extend(SVG.Parent, { - // Create an element that is not described by SVG.js - element: function element(_element, inherit) { - return this.put(new SVG.Bare(_element, inherit)); - } -}); -SVG.Symbol = SVG.invent({ - // Initialize node - create: 'symbol', - // Inherit from - inherit: SVG.Container, - construct: { - // create symbol - symbol: function symbol() { - return this.put(new SVG.Symbol()); - } - } -}); -SVG.Use = SVG.invent({ - // Initialize node - create: 'use', - // Inherit from - inherit: SVG.Shape, - // Add class methods - extend: { - // Use element as a reference - element: function element(_element2, file) { - // Set lined element - return this.attr('href', (file || '') + '#' + _element2, SVG.xlink); - } - }, - // Add parent method - construct: { - // Create a use element - use: function use(element, file) { - return this.put(new SVG.Use()).element(element, file); - } - } -}); -SVG.Rect = SVG.invent({ - // Initialize node - create: 'rect', - // Inherit from - inherit: SVG.Shape, - // Add parent method - construct: { - // Create a rect element - rect: function rect(width, height) { - return this.put(new SVG.Rect()).size(width, height); - } - } -}); -/* global proportionalSize */ + // Add the timeout to the end of the queue + var node = Animator.timeouts.push({ run: fn, time: time }); -SVG.Circle = SVG.invent({ - // Initialize node - create: 'circle', - // Inherit from - inherit: SVG.Shape, - // Add parent method - construct: { - // Create circle element, based on ellipse - circle: function circle(size) { - return this.put(new SVG.Circle()).rx(new SVG.Number(size).divide(2)).move(0, 0); - } - } -}); -SVG.extend([SVG.Circle, SVG.Timeline], { - // Radius x value - rx: function rx(_rx) { - return this.attr('r', _rx); - }, - // Alias radius x value - ry: function ry(_ry) { - return this.rx(_ry); - } -}); -SVG.Ellipse = SVG.invent({ - // Initialize node - create: 'ellipse', - // Inherit from - inherit: SVG.Shape, - // Add parent method - construct: { - // Create an ellipse - ellipse: function ellipse(width, height) { - return this.put(new SVG.Ellipse()).size(width, height).move(0, 0); - } - } -}); -SVG.extend([SVG.Ellipse, SVG.Rect, SVG.Timeline], { - // Radius x value - rx: function rx(_rx2) { - return this.attr('rx', _rx2); - }, - // Radius y value - ry: function ry(_ry2) { - return this.attr('ry', _ry2); - } -}); // Add common method - -SVG.extend([SVG.Circle, SVG.Ellipse], { - // Move over x-axis - x: function x(_x2) { - return _x2 == null ? this.cx() - this.rx() : this.cx(_x2 + this.rx()); - }, - // Move over y-axis - y: function y(_y2) { - return _y2 == null ? this.cy() - this.ry() : this.cy(_y2 + this.ry()); - }, - // Move by center over x-axis - cx: function cx(x) { - return x == null ? this.attr('cx') : this.attr('cx', x); - }, - // Move by center over y-axis - cy: function cy(y) { - return y == null ? this.attr('cy') : this.attr('cy', y); - }, - // Set width of element - width: function width(_width2) { - return _width2 == null ? this.rx() * 2 : this.rx(new SVG.Number(_width2).divide(2)); - }, - // Set height of element - height: function height(_height2) { - return _height2 == null ? this.ry() * 2 : this.ry(new SVG.Number(_height2).divide(2)); - }, - // Custom size function - size: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.rx(new SVG.Number(p.width).divide(2)).ry(new SVG.Number(p.height).divide(2)); - } -}); -/* global proportionalSize */ - -SVG.Line = SVG.invent({ - // Initialize node - create: 'line', - // Inherit from - inherit: SVG.Shape, - // Add class methods - extend: { - // Get array - array: function array() { - return new SVG.PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); - }, - // Overwrite native plot() method - plot: 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 SVG.PointArray(x1).toLine(); + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = window.requestAnimationFrame(Animator._draw); } - return this.attr(x1); + return node }, - // Move by left top corner - move: function move(x, y) { - return this.attr(this.array().move(x, y).toLine()); - }, - // Set element size to given width and height - size: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.attr(this.array().size(p.width, p.height).toLine()); - } - }, - // Add parent method - construct: { - // Create a line element - line: function line(x1, y1, x2, y2) { - // make sure plot is called as a setter - // x1 is not necessarily a number, it can also be an array, a string and a SVG.PointArray - return SVG.Line.prototype.plot.apply(this.put(new SVG.Line()), x1 != null ? [x1, y1, x2, y2] : [0, 0, 0, 0]); - } - } -}); -/* global proportionalSize */ - -SVG.Polyline = SVG.invent({ - // Initialize node - create: 'polyline', - // Inherit from - inherit: SVG.Shape, - // Add parent method - construct: { - // Create a wrapped polyline element - polyline: function polyline(p) { - // make sure plot is called as a setter - return this.put(new SVG.Polyline()).plot(p || new SVG.PointArray()); - } - } -}); -SVG.Polygon = SVG.invent({ - // Initialize node - create: 'polygon', - // Inherit from - inherit: SVG.Shape, - // Add parent method - construct: { - // Create a wrapped polygon element - polygon: function polygon(p) { - // make sure plot is called as a setter - return this.put(new SVG.Polygon()).plot(p || new SVG.PointArray()); - } - } -}); // Add polygon-specific functions - -SVG.extend([SVG.Polyline, SVG.Polygon], { - // Get array - array: function array() { - return this._array || (this._array = new SVG.PointArray(this.attr('points'))); - }, - // Plot new path - plot: function plot(p) { - return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new SVG.PointArray(p)); - }, - // Clear array cache - clear: function clear() { - delete this._array; - return this; - }, - // Move by left top corner - move: function move(x, y) { - return this.attr('points', this.array().move(x, y)); - }, - // Set element size to given width and height - size: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.attr('points', this.array().size(p.width, p.height)); - } -}); // unify all point to point elements -SVG.extend([SVG.Line, SVG.Polyline, SVG.Polygon], { - // Define morphable array - MorphArray: SVG.PointArray, - // Move by left top corner over x-axis - x: function x(_x3) { - return _x3 == null ? this.bbox().x : this.move(_x3, this.bbox().y); - }, - // Move by left top corner over y-axis - y: function y(_y3) { - return _y3 == null ? this.bbox().y : this.move(this.bbox().x, _y3); - }, - // Set width of element - width: function width(_width3) { - var b = this.bbox(); - return _width3 == null ? b.width : this.size(_width3, b.height); - }, - // Set height of element - height: function height(_height3) { - var b = this.bbox(); - return _height3 == null ? b.height : this.size(b.width, _height3); - } -}); -/* global proportionalSize */ - -SVG.Path = SVG.invent({ - // Initialize node - create: 'path', - // Inherit from - inherit: SVG.Shape, - // Add class methods - extend: { - // Define morphable array - MorphArray: SVG.PathArray, - // Get array - array: function array() { - return this._array || (this._array = new SVG.PathArray(this.attr('d'))); - }, - // Plot new path - plot: function plot(d) { - return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new SVG.PathArray(d)); - }, - // Clear array cache - clear: function clear() { - delete this._array; - return this; - }, - // Move by left top corner - move: function move(x, y) { - return this.attr('d', this.array().move(x, y)); + cancelFrame (node) { + Animator.frames.remove(node); }, - // Move by left top corner over x-axis - x: function x(_x4) { - return _x4 == null ? this.bbox().x : this.move(_x4, this.bbox().y); - }, - // Move by left top corner over y-axis - y: function y(_y4) { - return _y4 == null ? this.bbox().y : this.move(this.bbox().x, _y4); - }, - // Set element size to given width and height - size: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.attr('d', this.array().size(p.width, p.height)); - }, - // Set width of element - width: function width(_width4) { - return _width4 == null ? this.bbox().width : this.size(_width4, this.bbox().height); - }, - // Set height of element - height: function height(_height4) { - return _height4 == null ? this.bbox().height : this.size(this.bbox().width, _height4); - } - }, - // Add parent method - construct: { - // Create a wrapped path element - path: function path(d) { - // make sure plot is called as a setter - return this.put(new SVG.Path()).plot(d || new SVG.PathArray()); - } - } -}); -SVG.Image = SVG.invent({ - // Initialize node - create: 'image', - // Inherit from - inherit: SVG.Shape, - // Add class methods - extend: { - // (re)load image - load: function load(url, callback) { - if (!url) return this; - var img = new window.Image(); - SVG.on(img, 'load', function (e) { - var p = this.parent(SVG.Pattern); // ensure image size - if (this.width() === 0 && this.height() === 0) { - this.size(img.width, img.height); - } - - if (p instanceof SVG.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); - SVG.on(img, 'load error', function () { - // dont forget to unbind memory leaking events - SVG.off(img); - }); - return this.attr('href', img.src = url, SVG.xlink); - } - }, - // Add parent method - construct: { - // create image element, load image and set its size - image: function image(source, callback) { - return this.put(new SVG.Image()).size(0, 0).load(source, callback); - } - } -}); -SVG.Text = SVG.invent({ - // Initialize node - create: function create(node) { - SVG.Element.call(this, node || SVG.create('text')); - this.dom.leading = new SVG.Number(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', SVG.defaults.attrs['font-family']); - }, - // Inherit from - inherit: SVG.Parent, - // Add class methods - extend: { - // Move over x-axis - x: function x(_x5) { - // act as getter - if (_x5 == null) { - return this.attr('x'); - } - - return this.attr('x', _x5); - }, - // Move over y-axis - y: function y(_y5) { - var oy = this.attr('y'); - var o = typeof oy === 'number' ? oy - this.bbox().y : 0; // act as getter - - if (_y5 == null) { - return typeof oy === 'number' ? oy - o : oy; - } - - return this.attr('y', typeof _y5 === 'number' ? _y5 + o : _y5); - }, - // Move center over x-axis - cx: function cx(x) { - return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2); - }, - // Move center over y-axis - cy: function cy(y) { - return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2); + clearTimeout (node) { + Animator.timeouts.remove(node); }, - // Set the text content - text: 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 && SVG.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(); + _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); } - } // disable build mode and rebuild lines - - return this.build(false).rebuild(); - }, - // Set / get leading - leading: function leading(value) { - // act as getter - if (value == null) { - return this.dom.leading; - } // act as setter - - - this.dom.leading = new SVG.Number(value); - return this.rebuild(); - }, - // Rebuild appearance type - rebuild: 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 SVG.Number(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'); + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break } - return this; - }, - // Enable / disable build mode - build: function build(_build) { - this._build = !!_build; - return this; - }, - // overwrite method from parent to set data properly - setData: function setData(o) { - this.dom = o; - this.dom.leading = new SVG.Number(o.leading || 1.3); - return this; - } - }, - // Add parent method - construct: { - // Create text element - text: function text(_text2) { - return this.put(new SVG.Text()).text(_text2); - }, - // Create plain text element - plain: function plain(text) { - return this.put(new SVG.Text()).plain(text); - } - } -}); -SVG.Tspan = SVG.invent({ - // Initialize node - create: 'tspan', - // Inherit from - inherit: SVG.Parent, - // Add class methods - extend: { - // Set text content - text: function text(_text3) { - if (_text3 == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); - typeof _text3 === 'function' ? _text3.call(this, this) : this.plain(_text3); - return this; - }, - // Shortcut dx - dx: function dx(_dx) { - return this.attr('dx', _dx); - }, - // Shortcut dy - dy: function dy(_dy) { - return this.attr('dy', _dy); - }, - // Create new line - newLine: function newLine() { - // fetch text parent - var t = this.parent(SVG.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()); - } - } -}); -SVG.extend([SVG.Text, SVG.Tspan], { - // Create plain text node - plain: 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; - }, - // Create a tspan - tspan: function tspan(text) { - var tspan = new SVG.Tspan(); // clear if build mode is disabled - - if (!this._build) { - this.clear(); - } // add new tspan - - - this.node.appendChild(tspan.node); - return tspan.text(text); - }, - // FIXME: Does this also work for textpath? - // Get length of text element - length: function length() { - return this.node.getComputedTextLength(); - } -}); -SVG.TextPath = SVG.invent({ - // Initialize node - create: 'textPath', - // Inherit from - inherit: SVG.Text, - // Define parent class - parent: SVG.Parent, - // Add parent method - extend: { - MorphArray: SVG.PathArray, - // return the array of the path track element - array: function array() { - var track = this.track(); - return track ? track.array() : null; - }, - // Plot path if any - plot: 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 - track: function track() { - return this.reference('href'); - } - }, - construct: { - textPath: function textPath(text, path) { - return this.defs().path(path).text(text).addTo(this); - } - } -}); -SVG.extend([SVG.Text], { - // Create path for text to run on - path: function path(track) { - var path = new SVG.TextPath(); // if d is a path, reuse it - - if (!(track instanceof SVG.Path)) { - // create path element - track = this.doc().defs().path(track); - } // link textPath to path and add content - - - path.attr('href', '#' + track, SVG.xlink); // add textPath element as child node and return textPath - - return this.put(path); - }, - // Todo: make this plural? - // Get the textPath children - textPath: function textPath() { - return this.select('textPath'); - } -}); -SVG.extend([SVG.Path], { - // creates a textPath from this path - text: function text(_text4) { - if (_text4 instanceof SVG.Text) { - var txt = _text4.text(); - - return _text4.clear().path(this).text(txt); - } - - return this.parent().put(new SVG.Text()).path(this).text(_text4); - } // TODO: Maybe add `targets` to get all textPaths associated with this path - -}); -SVG.A = SVG.invent({ - // Initialize node - create: 'a', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Link url - to: function to(url) { - return this.attr('href', url, SVG.xlink); - }, - // Link target attribute - target: function target(_target) { - return this.attr('target', _target); - } - }, - // Add parent method - construct: { - // Create a hyperlink element - link: function link(url) { - return this.put(new SVG.A()).to(url); - } - } -}); -SVG.extend(SVG.Element, { - // Create a hyperlink element - linkTo: function linkTo(url) { - var link = new SVG.A(); - - if (typeof url === 'function') { - url.call(link, link); - } else { - link.to(url); - } - - return this.parent().put(link).put(this); - } -}); -SVG.Marker = SVG.invent({ - // Initialize node - create: 'marker', - // Inherit from - inherit: SVG.Container, - // Add class methods - extend: { - // Set width of element - width: function width(_width5) { - return this.attr('markerWidth', _width5); - }, - // Set height of element - height: function height(_height5) { - return this.attr('markerHeight', _height5); - }, - // Set marker refX and refY - ref: function ref(x, y) { - return this.attr('refX', x).attr('refY', y); - }, - // Update marker - update: function update(block) { - // remove all content - this.clear(); // invoke passed block - - if (typeof block === 'function') { - block.call(this, this); + // Run all of the animation frames + var nextFrame = null; + var lastFrame = Animator.frames.last(); + while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) { + nextFrame.run(); } - return this; - }, - // Return the fill id - toString: function toString() { - return 'url(#' + this.id() + ')'; - } - }, - // Add parent method - construct: { - marker: function marker(width, height, block) { - // Create marker element in defs - return this.defs().marker(width, height, block); - } - } -}); -SVG.extend(SVG.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 SVG.Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); - } -}); -SVG.extend([SVG.Line, SVG.Polyline, SVG.Polygon, SVG.Path], { - // 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 SVG.Marker ? arguments[1] : this.doc().marker(width, height, block); - return this.attr(attr, _marker); - } -}); // Define list of available attributes for stroke and fill - -var sugar = { - stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], - fill: ['color', 'opacity', 'rule'], - prefix: function prefix(t, a) { - return a === 'color' ? t : t + '-' + a; - } // Add sugar for fill and stroke + Animator.transforms.forEach(function (el) { el(); }); -}; -['fill', 'stroke'].forEach(function (m) { - var extension = {}; - var i; - - extension[m] = function (o) { - if (typeof o === 'undefined') { - return this; - } - - if (typeof o === 'string' || SVG.Color.isRgb(o) || o && typeof o.fill === 'function') { - this.attr(m, o); - } else { - // set all attributes from sugar.fill and sugar.stroke list - for (i = sugar[m].length - 1; i >= 0; i--) { - if (o[sugar[m][i]] != null) { - this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); - } - } + // 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; } - - return this; }; - SVG.extend([SVG.Element, SVG.Timeline], extension); -}); -SVG.extend([SVG.Element, SVG.Timeline], { - // Let the user set the matrix directly - matrix: function matrix(mat, b, c, d, e, f) { - // Act as a getter - if (mat == null) { - return new SVG.Matrix(this); - } // Act as a setter, the user can pass a matrix or a set of numbers - - - return this.attr('transform', new SVG.Matrix(mat, b, c, d, e, f)); - }, - // Map rotation to transform - rotate: function rotate(angle, cx, cy) { - return this.transform({ - rotate: angle, - ox: cx, - oy: cy - }, true); - }, - // Map skew to transform - skew: function skew(x, y, cx, cy) { - return arguments.length === 1 || arguments.length === 3 ? this.transform({ - skew: x, - ox: y, - oy: cx - }, true) : this.transform({ - skew: [x, y], - ox: cx, - oy: cy - }, true); - }, - shear: function shear(lam, cx, cy) { - return this.transform({ - shear: lam, - ox: cx, - oy: cy - }, true); - }, - // Map scale to transform - scale: function scale(x, y, cx, cy) { - return arguments.length === 1 || arguments.length === 3 ? this.transform({ - scale: x, - ox: y, - oy: cx - }, true) : this.transform({ - scale: [x, y], - ox: cx, - oy: cy - }, true); - }, - // Map translate to transform - translate: function translate(x, y) { - return this.transform({ - translate: [x, y] - }, true); - }, - // Map relative translations to transform - relative: function relative(x, y) { - return this.transform({ - relative: [x, y] - }, true); - }, - // Map flip to transform - flip: function flip(direction, around) { - var directionString = typeof direction === 'string' ? direction : isFinite(direction) ? 'both' : 'both'; - var origin = direction === 'both' && isFinite(around) ? [around, around] : direction === 'x' ? [around, 0] : direction === 'y' ? [0, around] : isFinite(direction) ? [direction, direction] : [0, 0]; - this.transform({ - flip: directionString, - origin: origin - }, true); - }, - // Opacity - opacity: function opacity(value) { - return this.attr('opacity', value); - }, - // Relative move over x axis - dx: function dx(x) { - return this.x(new SVG.Number(x).plus(this instanceof SVG.Timeline ? 0 : this.x()), true); - }, - // Relative move over y axis - dy: function dy(y) { - return this.y(new SVG.Number(y).plus(this instanceof SVG.Timeline ? 0 : this.y()), true); - }, - // Relative move over x and y axes - dmove: function dmove(x, y) { - return this.dx(x).dy(y); - } -}); -SVG.extend([SVG.Rect, SVG.Ellipse, SVG.Circle, SVG.Gradient, SVG.Timeline], { - // Add x and y radius - radius: function radius(x, y) { - var type = (this._target || this).type; - return type === 'radialGradient' || type === 'radialGradient' ? this.attr('r', new SVG.Number(x)) : this.rx(x).ry(y == null ? x : y); - } -}); -SVG.extend(SVG.Path, { - // Get path length - length: function length() { - return this.node.getTotalLength(); - }, - // Get point at length - pointAt: function pointAt(length) { - return new SVG.Point(this.node.getPointAtLength(length)); - } -}); -SVG.extend([SVG.Parent, SVG.Text, SVG.Tspan, SVG.Timeline], { - // Set font - font: function font(a, v) { - if (_typeof(a) === 'object') { - for (v in a) { - this.font(v, a[v]); - } - } - - return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); - } -}); -SVG.extend(SVG.Element, { - // Store data values on svg nodes - data: function data(a, v, r) { - if (_typeof(a) === 'object') { - for (v in a) { - this.data(v, a[v]); - } - } else if (arguments.length < 2) { - try { - return JSON.parse(this.attr('data-' + a)); - } catch (e) { - return this.attr('data-' + a); - } - } else { - this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); - } - - return this; - } -}); -SVG.extend(SVG.Element, { - // Remember arbitrary data - remember: function remember(k, v) { - // remember every item in an object individually - if (_typeof(arguments[0]) === 'object') { - for (var key in k) { - this.remember(key, k[key]); - } - } else if (arguments.length === 1) { - // retrieve memory - return this.memory()[k]; - } else { - // store memory - this.memory()[k] = v; - } - - return this; - }, - // Erase a given memory - forget: function forget() { - if (arguments.length === 0) { - this._memory = {}; - } else { - for (var i = arguments.length - 1; i >= 0; i--) { - delete this.memory()[arguments[i]]; - } - } - - return this; - }, - // Initialize or return local memory object - memory: function memory() { - return this._memory || (this._memory = {}); - } -}); -/* global idFromReference */ -// 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)); -}; - -SVG.extend(SVG.Parent, { - // Scoped select method - select: function select(query) { - return SVG.select(query, this.node); - } -}); -/* eslint no-unused-vars: 0 */ - -function createElement(element, makeNested) { - if (element instanceof SVG.Element) return element; - - if (_typeof(element) === 'object') { - return SVG.adopt(element); - } - - if (element == null) { - return new SVG.Doc(); - } - - if (typeof element === 'string' && element.charAt(0) !== '<') { - return SVG.adopt(document.querySelector(element)); - } - - var node = SVG.create('svg'); - node.innerHTML = element; - element = SVG.adopt(node.firstElementChild); - return element; -} - -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(SVG.regex.dots, ' .'); -} // creates deep clone of array - - -function arrayClone(arr) { - var clone = arr.slice(0); - - for (var i = clone.length; i--;) { - if (Array.isArray(clone[i])) { - clone[i] = arrayClone(clone[i]); - } - } - - return clone; -} // tests if a given element is instance of an object - - -function _is(el, obj) { - return el instanceof obj; -} // tests if a given selector matches an element - - -function _matches(el, selector) { - return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector); -} // 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) { - return hex.length === 4 ? ['#', hex.substring(1, 2), hex.substring(1, 2), hex.substring(2, 3), hex.substring(2, 3), hex.substring(3, 4), hex.substring(3, 4)].join('') : hex; -} // Component to hex value - - -function compToHex(comp) { - var hex = comp.toString(16); - return hex.length === 1 ? '0' + hex : hex; -} // Calculate proportional width and height values when necessary - - -function proportionalSize(element, width, height) { - if (width == null || height == null) { - var box = element.bbox(); + 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)
+ }
+ }
+ }; - if (width == null) { - width = box.width / box.height * height; - } else if (height == null) { - height = box.height / box.width * width; - } + // 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
} - return { - width: width, - height: height + 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())
+ }
+ }
}; -} // 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] + //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))
+ }
}; -} // Add centre point to transform object - - -function ensureCentre(o, target) { - o.cx = o.cx == null ? target.bbox().cx : o.cx; - o.cy = o.cy == null ? target.bbox().cy : o.cy; -} // 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 + ' '; -} // 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 SVG.adopt(node).id(SVG.eid(node.nodeName)); - } - - return SVG.adopt(node); -} // Add more bounding box properties - - -function fullBox(b) { - if (b.x == null) { - b.x = 0; - b.y = 0; - b.width = 0; - b.height = 0; + /* 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)
+ }
} - 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 - - -function idFromReference(url) { - var m = (url || '').toString().match(SVG.regex.reference); - if (m) return m[1]; -} // Create matrix array for looping - - -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; -} // TODO: Refactor this to a static function of matrix.js - + /***
+ 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')
+ }); -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 SVG.Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); - var ox = origin.x; - var oy = origin.y; - var position = new SVG.Point(o.position || o.px || o.positionX, o.py || o.positionY); - var px = position.x; - var py = position.y; - var translate = new SVG.Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); - var tx = translate.x; - var ty = translate.y; - var relative = new SVG.Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); - var rx = relative.x; - var ry = relative.y; // Populate all of the values + class Morphable {
+ constructor (stepper) {
+ // FIXME: the default stepper does not know about easing
+ this._stepper = stepper || new Ease('-');
+
+ this._from = null;
+ this._to = null;
+ this._type = null;
+ this._context = null;
+ this._morphObj = null;
+ }
+
+ from (val) {
+ if (val == null) {
+ return this._from
+ }
+
+ this._from = this._set(val);
+ return this
+ }
+
+ to (val) {
+ if (val == null) {
+ return this._to
+ }
+
+ this._to = this._set(val);
+ return this
+ }
+
+ type (type) {
+ // getter
+ if (type == null) {
+ return this._type
+ }
+
+ // setter
+ this._type = type;
+ return this
+ }
+
+ _set (value) {
+ if (!this._type) {
+ var type = typeof value;
+
+ if (type === 'number') {
+ this.type(SVGNumber);
+ } else if (type === 'string') {
+ if (Color.isColor(value)) {
+ this.type(Color);
+ } else if (regex.delimiter.test(value)) {
+ this.type(regex.pathLetters.test(value)
+ ? PathArray
+ : SVGArray
+ );
+ } else if (regex.numberAndUnit.test(value)) {
+ this.type(SVGNumber);
+ } else {
+ this.type(Morphable.NonMorphable);
+ }
+ } else if (MorphableTypes.indexOf(value.constructor) > -1) {
+ this.type(value.constructor);
+ } else if (Array.isArray(value)) {
+ this.type(SVGArray);
+ } else if (type === 'object') {
+ this.type(Morphable.ObjectBag);
+ } else {
+ this.type(Morphable.NonMorphable);
+ }
+ }
+
+ var result = (new this._type(value)).toArray();
+ this._morphObj = this._morphObj || new this._type();
+ this._context = this._context ||
+ Array.apply(null, Array(result.length)).map(Object);
+ return result
+ }
+
+ stepper (stepper) {
+ if (stepper == null) return this._stepper
+ this._stepper = stepper;
+ return this
+ }
+
+ done () {
+ var complete = this._context
+ .map(this._stepper.done)
+ .reduce(function (last, curr) {
+ return last && curr
+ }, true);
+ return complete
+ }
+
+ at (pos) {
+ var _this = this;
+
+ return this._morphObj.fromArray(
+ this._from.map(function (i, index) {
+ return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)
+ })
+ )
+ }
+ }
+
+ Morphable.NonMorphable = class {
+ constructor (...args) {
+ this.init(...args);
+ }
+
+ init (val) {
+ val = Array.isArray(val) ? val[0] : val;
+ this.value = val;
+ }
+
+ valueOf () {
+ return this.value
+ }
+
+ toArray () {
+ return [this.value]
+ }
+ };
+
+ Morphable.TransformBag = class {
+ constructor (...args) {
+ this.init(...args);
+ }
+
+ init (obj) {
+ if (Array.isArray(obj)) {
+ obj = {
+ scaleX: obj[0],
+ scaleY: obj[1],
+ shear: obj[2],
+ rotate: obj[3],
+ translateX: obj[4],
+ translateY: obj[5],
+ originX: obj[6],
+ originY: obj[7]
+ };
+ }
+
+ Object.assign(this, Morphable.TransformBag.defaults, obj);
+ }
+
+ toArray () {
+ var v = this;
+
+ return [
+ v.scaleX,
+ v.scaleY,
+ v.shear,
+ v.rotate,
+ v.translateX,
+ v.translateY,
+ v.originX,
+ v.originY
+ ]
+ }
+ };
+
+ Morphable.TransformBag.defaults = {
+ scaleX: 1,
+ scaleY: 1,
+ shear: 0,
+ rotate: 0,
+ translateX: 0,
+ translateY: 0,
+ originX: 0,
+ originY: 0
+ };
+
+ Morphable.ObjectBag = class {
+ constructor (...args) {
+ this.init(...args);
+ }
+
+ init (objOrArr) {
+ this.values = [];
+
+ if (Array.isArray(objOrArr)) {
+ this.values = objOrArr;
+ return
+ }
+
+ var entries = Object.entries(objOrArr || {}).sort((a, b) => {
+ return a[0] - b[0]
+ });
+
+ this.values = entries.reduce((last, curr) => last.concat(curr), []);
+ }
+
+ valueOf () {
+ var obj = {};
+ var arr = this.values;
+
+ for (var i = 0, len = arr.length; i < len; i += 2) {
+ obj[arr[i]] = arr[i + 1];
+ }
+
+ return obj
+ }
+
+ toArray () {
+ return this.values
+ }
+ };
+
+ let morphableTypes = [
+ SVGNumber,
+ Color,
+ Box$1,
+ Matrix,
+ SVGArray,
+ PointArray$1,
+ PathArray,
+ Morphable.NonMorphable,
+ Morphable.TransformBag,
+ Morphable.ObjectBag
+ ];
+
+ extend$1(morphableTypes, {
+ to (val, args) {
+ return new Morphable()
+ .type(this.constructor)
+ .from(this.valueOf())
+ .to(val, args)
+ },
+ fromArray (arr) {
+ this.init(arr);
+ return this
+ }
+ }); - return { - 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 + 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
+ }
+ }
}; -} // left matrix, right matrix, target matrix which is overwritten - - -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; -} - -function getOrigin(o, element) { - // Allow origin or around as the names - var origin = o.origin; // o.around == null ? o.origin : o.around - - var ox, oy; // Allow the user to pass a string to rotate around a given point - - if (typeof origin === 'string' || origin == null) { - // Get the bounding box of the element with no transformations applied - var string = (origin || 'center').toLowerCase().trim(); - - var _element$bbox = element.bbox(), - height = _element$bbox.height, - width = _element$bbox.width, - x = _element$bbox.x, - y = _element$bbox.y; // Calculate the transformed x and y coordinates - - - var bx = string.includes('left') ? x : string.includes('right') ? x + width : x + width / 2; - var by = string.includes('top') ? y : string.includes('bottom') ? y + height : y + height / 2; // Set the bounds eg : "bottom-left", "Top right", "middle" etc... - - ox = o.ox != null ? o.ox : bx; - oy = o.oy != null ? o.oy : by; - } else { - ox = origin[0]; - oy = origin[1]; - } // Return the origin as it is if it wasn't a string - - - return [ox, oy]; -} -/* globals fullBox, domContains, isNulledBox, Exception */ - - -SVG.Box = SVG.invent({ - create: function create(source) { - var base = [0, 0, 0, 0]; - source = typeof source === 'string' ? source.split(SVG.regex.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); - }, - extend: { - // Merge rect box with another, return a new instance - merge: function merge(box) { - var x = Math.min(this.x, box.x); - var y = Math.min(this.y, box.y); - return new SVG.Box(x, y, Math.max(this.x + this.width, box.x + box.width) - x, Math.max(this.y + this.height, box.y + box.height) - y); - }, - transform: function transform(m) { - var xMin = Infinity; - var xMax = -Infinity; - var yMin = Infinity; - var yMax = -Infinity; - var pts = [new SVG.Point(this.x, this.y), new SVG.Point(this.x2, this.y), new SVG.Point(this.x, this.y2), new SVG.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 SVG.Box(xMin, yMin, xMax - xMin, yMax - yMin); - }, - addOffset: function addOffset() { - // offset by window scroll position, because getBoundingClientRect changes when window is scrolled - this.x += window.pageXOffset; - this.y += window.pageYOffset; - return this; - }, - toString: function toString() { - return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; - }, - toArray: function toArray() { - return [this.x, this.y, this.width, this.height]; - }, - morph: function morph(x, y, width, height) { - this.destination = new SVG.Box(x, y, width, height); - return this; - }, - at: function at(pos) { - if (!this.destination) return this; - return new SVG.Box(this.x + (this.destination.x - this.x) * pos, this.y + (this.destination.y - this.y) * pos, this.width + (this.destination.width - this.width) * pos, this.height + (this.destination.height - this.height) * pos); - } - }, - // Define Parent - parent: SVG.Element, - // Constructor - construct: { - // Get bounding box - bbox: function bbox() { - var box; - - try { - // find native bbox - box = this.node.getBBox(); - - if (isNulledBox(box) && !domContains(this.node)) { - throw new Exception('Element not in the dom'); - } - } catch (e) { - try { - var clone = this.clone(SVG.parser().svg).show(); - box = clone.node.getBBox(); - clone.remove(); - } catch (e) { - console.warn('Getting a bounding box of this element is not possible'); - } - } - - return new SVG.Box(box); - }, - rbox: function rbox(el) { - // IE11 throws an error when element not in dom - try { - var box = new SVG.Box(this.node.getBoundingClientRect()); - if (el) return box.transform(el.screenCTM().inverse()); - return box.addOffset(); - } catch (e) { - return new SVG.Box(); - } - } - } -}); -SVG.extend([SVG.Doc, SVG.Symbol, SVG.Image, SVG.Pattern, SVG.Marker, SVG.ForeignObject, SVG.View], { - viewbox: function viewbox(x, y, width, height) { - // act as getter - if (x == null) return new SVG.Box(this.attr('viewBox')); // act as setter - - return this.attr('viewBox', new SVG.Box(x, y, width, height)); - } -}); - -SVG.parser = function () { - var b; - - if (!SVG.parser.nodes.svg.node.parentNode) { - b = document.body || document.documentElement; - SVG.parser.nodes.svg.addTo(b); - } - - return SVG.parser.nodes; -}; - -SVG.parser.nodes = { - svg: SVG().size(2, 0).css({ - opacity: 0, - position: 'absolute', - left: '-100%', - top: '-100%', - overflow: 'hidden' - }) -}; -SVG.parser.nodes.path = SVG.parser.nodes.svg.path().node; -/* global requestAnimationFrame */ - -SVG.Animator = { - nextDraw: null, - frames: new SVG.Queue(), - timeouts: new SVG.Queue(), - timer: window.performance || window.Date, - transforms: [], - frame: function frame(fn) { - // Store the node - var node = SVG.Animator.frames.push({ - run: fn - }); // Request an animation frame if we don't have one - - if (SVG.Animator.nextDraw === null) { - SVG.Animator.nextDraw = requestAnimationFrame(SVG.Animator._draw); - } // Return the node so we can remove it easily - - - return node; - }, - transform_frame: function transform_frame(fn, id) { - SVG.Animator.transforms[id] = fn; - }, - timeout: function timeout(fn, delay) { - delay = delay || 0; // Work out when the event should fire - - var time = SVG.Animator.timer.now() + delay; // Add the timeout to the end of the queue - - var node = SVG.Animator.timeouts.push({ - run: fn, - time: time - }); // Request another animation frame if we need one - - if (SVG.Animator.nextDraw === null) { - SVG.Animator.nextDraw = requestAnimationFrame(SVG.Animator._draw); - } - - return node; - }, - cancelFrame: function cancelFrame(node) { - SVG.Animator.frames.remove(node); - }, - clearTimeout: function clearTimeout(node) { - SVG.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 = SVG.Animator.timeouts.last(); - - while (nextTimeout = SVG.Animator.timeouts.shift()) { - // Run the timeout if its time, or push it to the end - if (now >= nextTimeout.time) { - nextTimeout.run(); - } else { - SVG.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 = SVG.Animator.frames.last(); - - while (nextFrame !== lastFrame && (nextFrame = SVG.Animator.frames.shift())) { - nextFrame.run(); - } - - SVG.Animator.transforms.forEach(function (el) { - el(); - }); // If we have remaining timeouts or frames, draw until we don't anymore - - SVG.Animator.nextDraw = SVG.Animator.timeouts.first() || SVG.Animator.frames.first() ? requestAnimationFrame(SVG.Animator._draw) : null; - } -}; -SVG.Morphable = SVG.invent({ - create: function create(stepper) { - // FIXME: the default stepper does not know about easing - this._stepper = stepper || new SVG.Ease('-'); - this._from = null; - this._to = null; - this._type = null; - this._context = null; - this._morphObj = null; - }, - extend: { - from: function from(val) { - if (val == null) { - return this._from; - } - - this._from = this._set(val); - return this; - }, - to: function to(val) { - if (val == null) { - return this._to; - } - - this._to = this._set(val); - return this; - }, - type: function type(_type) { - // getter - if (_type == null) { - return this._type; - } // setter - - - this._type = _type; - return this; - }, - _set: function _set(value) { - if (!this._type) { - var type = _typeof(value); - - if (type === 'number') { - this.type(SVG.Number); - } else if (type === 'string') { - if (SVG.Color.isColor(value)) { - this.type(SVG.Color); - } else if (SVG.regex.delimiter.test(value)) { - this.type(SVG.regex.pathLetters.test(value) ? SVG.PathArray : SVG.Array); - } else if (SVG.regex.numberAndUnit.test(value)) { - this.type(SVG.Number); - } else { - this.type(SVG.Morphable.NonMorphable); - } - } else if (SVG.MorphableTypes.indexOf(value.constructor) > -1) { - this.type(value.constructor); - } else if (Array.isArray(value)) { - this.type(SVG.Array); - } else if (type === 'object') { - this.type(SVG.Morphable.ObjectBag); - } else { - this.type(SVG.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: function stepper(_stepper) { - if (_stepper == null) return this._stepper; - this._stepper = _stepper; - return this; - }, - done: function done() { - var complete = this._context.map(this._stepper.done).reduce(function (last, curr) { - return last && curr; - }, true); - - return complete; - }, - at: 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); - })); - } - } -}); -SVG.Morphable.NonMorphable = SVG.invent({ - create: function create(val) { - val = Array.isArray(val) ? val[0] : val; - this.value = val; - }, - extend: { - valueOf: function valueOf() { - return this.value; - }, - toArray: function toArray() { - return [this.value]; - } - } -}); -SVG.Morphable.TransformBag = SVG.invent({ - create: function create(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, SVG.Morphable.TransformBag.defaults, obj); - }, - extend: { - toArray: function toArray() { - var v = this; - return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; - } - } -}); -SVG.Morphable.TransformBag.defaults = { - scaleX: 1, - scaleY: 1, - shear: 0, - rotate: 0, - translateX: 0, - translateY: 0, - originX: 0, - originY: 0 -}; -SVG.Morphable.ObjectBag = SVG.invent({ - create: function create(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); - }, []); - }, - extend: { - valueOf: 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; - }, - toArray: function toArray() { - return this.values; - } - } -}); -SVG.MorphableTypes = [SVG.Number, SVG.Color, SVG.Box, SVG.Matrix, SVG.Array, SVG.PointArray, SVG.PathArray, SVG.Morphable.NonMorphable, SVG.Morphable.TransformBag, SVG.Morphable.ObjectBag]; -SVG.extend(SVG.MorphableTypes, { - to: function to(val, args) { - return new SVG.Morphable().type(this.constructor).from(this.valueOf()).to(val, args); - }, - fromArray: function fromArray(arr) { - this.constructor(arr); - return this; - } -}); -/* global isMatrixLike getOrigin */ - -SVG.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; - } -}; -SVG.Runner = SVG.invent({ - parent: SVG.Element, - create: function create(options) { - // Store a unique id on the runner, so that we can identify it later - this.id = SVG.Runner.id++; // Ensure a default value - - options = options == null ? SVG.defaults.timeline.duration : options; // Ensure that we get a controller - - options = typeof options === 'function' ? new SVG.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 SVG.Controller; - this._stepper = this._isDeclarative ? options : new SVG.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; - this.tags = {}; // Save transforms applied to this runner - - this.transforms = new SVG.Matrix(); - this.transformId = 1; // Looping variables - - this._haveReversed = false; - this._reverse = false; - this._loopsDone = 0; - this._swing = false; - this._wait = 0; - this._times = 1; - }, - construct: { - animate: function animate(duration, delay, when) { - var o = SVG.Runner.sanitise(duration, delay, when); - var timeline = this.timeline(); - return new SVG.Runner(o.duration).loop(o).element(this).timeline(timeline).schedule(delay, when); - }, - delay: function delay(by, when) { - return this.animate(0, by, when); - } - }, - extend: { + // 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: function element(_element3) { - if (_element3 == null) return this._element; - this._element = _element3; - - _element3._prepareRunner(); - - return this; - }, - timeline: function timeline(_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; - }, - animate: function animate(duration, delay, when) { - var o = SVG.Runner.sanitise(duration, delay, when); - var runner = new SVG.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: function schedule(timeline, delay, when) { - // The user doesn't need to pass a timeline if we already have one - if (!(timeline instanceof SVG.Timeline)) { - when = delay; - delay = timeline; - timeline = this.timeline(); - } // If there is no timeline, yell at the user... - - - if (!timeline) { - throw Error('Runner cannot be scheduled without timeline'); - } // Schedule the runner on the timeline provided - - - timeline.schedule(this, delay, when); - return this; - }, - unschedule: function unschedule() { - var timeline = this.timeline(); - timeline && timeline.unschedule(this); - return this; - }, - loop: 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; - }, - delay: function delay(_delay) { - return this.animate(0, _delay); - }, - + */
+
+ 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: function queue(initFn, runFn, isTransform) { - this._queue.push({ - initialiser: initFn || SVG.void, - runner: runFn || SVG.void, - isTransform: isTransform, - initialised: false, - finished: false - }); - - var timeline = this.timeline(); - timeline && this.timeline()._continue(); - return this; - }, - during: function during(fn) { - return this.queue(null, fn); - }, - after: function after(fn) { - return this.on('finish', fn); - }, - + */
+
+ 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: function time(_time) { - if (_time == null) { - return this._time; - } - - var dt = _time - this._time; - this.step(dt); - return this; - }, - duration: function duration() { - return this._times * (this._wait + this._duration) - this._wait; - }, - loops: 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); - }, - position: 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) { + */
+
+ 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 - 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); - }, - progress: function progress(p) { - if (p == null) { - return Math.min(1, this._time / this.duration()); - } - - return this.time(p * this.duration()); - }, - step: 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; - - if (justStarted) {} // this.fire('start', this) - // 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 SVG.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: function finish() { - return this.step(Infinity); - }, - reverse: function reverse(_reverse) { - this._reverse = _reverse == null ? !this._reverse : _reverse; - return this; - }, - ease: function ease(fn) { - this._stepper = new SVG.Ease(fn); - return this; - }, - active: function active(enabled) { - if (enabled == null) return this.enabled; - this.enabled = enabled; - return this; - }, - - /*
- Runner Management
- =================
- Functions that are used to help index the runner
- */ - tag: function tag(name) { - // Act as a getter to get all of the tags on this object - if (name == null) return Object.keys(this.tags); // Add all of the tags to the object directly - - name = Array.isArray(name) ? name : [name]; - - for (var i = name.length; i--;) { - this.tags[name[i]] = true; - } - - return this; - }, - untag: function untag(name) { - name = Array.isArray(name) ? name : [name]; - - for (var i = name.length; i--;) { - delete this.tags[name[i]]; - } - - return this; - }, - getEventTarget: function getEventTarget() { - return this._dispatcher; - }, - + */
+
+ // 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: 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 - _tryRetarget: 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 = this.timeline(); - timeline && timeline._continue(); - return true; - } - - return false; - }, - // Run each initialise function in the runner if required - _initialise: 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 - _run: 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; - }, - addTransform: function addTransform(transform, index) { - this.transforms.lmultiplyO(transform); - return this; - }, - clearTransform: function clearTransform() { - this.transforms = new SVG.Matrix(); - return this; - } - } -}); -SVG.Runner.id = 0; - -SVG.Runner.sanitise = function (duration, delay, when) { - // Initialise the default parameters - var times = 1; - var swing = false; - var wait = 0; - duration = duration || SVG.defaults.timeline.duration; - delay = delay || SVG.defaults.timeline.delay; - when = when || 'last'; // If we have an object, unpack the values - - if (_typeof(duration) === 'object' && !(duration instanceof SVG.Stepper)) { - delay = duration.delay || delay; - when = duration.when || when; - swing = duration.swing || swing; - times = duration.times || times; - wait = duration.wait || wait; - duration = duration.duration || SVG.defaults.timeline.duration; - } - - return { - duration: duration, - delay: delay, - swing: swing, - times: times, - wait: wait, - when: when - }; -}; + */
+
+ // 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
+ }
+ }); -SVG.FakeRunner = -/*#__PURE__*/ -function () { - function _class() { - var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new SVG.Matrix(); - var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; - var done = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + // 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 + }); - _classCallCheck(this, _class); - this.transforms = transforms; - this.id = id; - this.done = done; - } - return _class; -}(); + 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 + }); -SVG.extend([SVG.Runner, SVG.FakeRunner], { - mergeWith: function mergeWith(runner) { - return new SVG.FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + // ### 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
} -}); // SVG.FakeRunner.emptyRunner = new SVG.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 SVG.Matrix()); - this.transform(netTransform); - - this._transformationRunners.merge(); + 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 + }); - if (this._transformationRunners.length() === 1) { - this._frameId = null; + // // 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)
} -} -var RunnerArray = -/*#__PURE__*/ -function () { - function RunnerArray() { - _classCallCheck(this, RunnerArray); - - this.runners = []; - this.ids = []; + // 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'
} - _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 _this2 = this; - - var lastRunner = null; - this.runners.forEach(function (runner, i) { - if (lastRunner && runner.done && lastRunner.done) { - _this2.remove(runner.id); - - _this2.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 SVG.FakeRunner()); - return this; - } - }]); - - return RunnerArray; -}(); - -SVG.extend(SVG.Element, { - // 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 SVG.Matrix()); - }, - addRunner: function addRunner(runner) { - this._transformationRunners.add(runner); + var css$1 = /*#__PURE__*/Object.freeze({ + css: css, + show: show, + hide: hide, + visible: visible + }); - SVG.Animator.transform_frame(mergeTransforms.bind(this), this._frameId); - }, - _prepareRunner: function _prepareRunner() { - if (this._frameId == null) { - this._transformationRunners = new RunnerArray().add(new SVG.FakeRunner(new SVG.Matrix(this))); - this._frameId = SVG.Element.frameId++; - } + // 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)
} -}); -SVG.Element.frameId = 0; -SVG.extend(SVG.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 SVG.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 SVG.Morphable(this._stepper).to(new SVG.Number(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: 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 SVG.Morphable().type(affine ? SVG.Morphable.TransformBag : SVG.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 SVG.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 _transform2 = new SVG.Point(origin).transform(element._currentTransform(this)), - x = _transform2.x, - y = _transform2.y; - - var target = new SVG.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 SVG.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 SVG.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(_x6, relative) { - return this._queueNumber('x', _x6); - }, - // Animatable y-axis - y: function y(_y6) { - return this._queueNumber('y', _y6); - }, - 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 SVG.Number(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 SVG.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 SVG.Morphable(this._stepper).to(to); - this.queue(function () { - morpher.from(this.element()[method]()); - }, function (pos) { - this.element()[method](morpher.at(pos)); - return morpher.done(); - }); // Register the morpher so that if it is changed again, we can retarget it - - this._rememberMorpher(method, morpher); - - return this; - }, - _queueNumber: function _queueNumber(method, value) { - return this._queueObject(method, new SVG.Number(value)); - }, - // Animatable center x-axis - cx: function cx(x) { - return this._queueNumber('cx', x); - }, - // Animatable center y-axis - cy: function cy(y) { - return this._queueNumber('cy', y); - }, - // Add animatable move - move: function move(x, y) { - return this.x(x).y(y); - }, - // Add animatable center - center: function center(x, y) { - return this.cx(x).cy(y); - }, - // Add animatable size - size: function size(width, height) { - // animate bbox based size for all other elements - var box; - - if (!width || !height) { - box = this._element.bbox(); - } - - if (!width) { - width = box.width / box.height * height; - } - - if (!height) { - height = box.height / box.width * width; - } - - return this.width(width).height(height); - }, - // Add animatable width - width: function width(_width6) { - return this._queueNumber('width', _width6); - }, - // Add animatable height - height: function height(_height6) { - return this._queueNumber('height', _height6); - }, - // Add animatable plot - plot: function plot(a, b, c, d) { - // Lines can be plotted with 4 arguments - if (arguments.length === 4) { - return this.plot([a, b, c, d]); - } // FIXME: this needs to be rewritten such that the element is only accesed - // in the init function - - - return this._queueObject('plot', new this._element.MorphArray(a)); - /*
- var morpher = this._element.morphArray().to(a)
- this.queue(function () {
- morpher.from(this._element.array())
- }, function (pos) {
- this._element.plot(morpher.at(pos))
- })
- return this
- */ - }, - // Add leading method - leading: function leading(value) { - return this._queueNumber('leading', value); - }, - // Add animatable viewbox - viewbox: function viewbox(x, y, width, height) { - return this._queueObject('viewbox', new SVG.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; - } -}); // Must Change .... + var transform$1 = /*#__PURE__*/Object.freeze({ + untransform: untransform, + matrixify: matrixify, + toParent: toParent, + toDoc: toDoc, + transform: transform + }); -SVG.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; + // 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
} -}; -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 - }; -}; - -SVG.Timeline = SVG.invent({ - inherit: SVG.EventTarget, - // Construct a new timeline on the given element - create: function create() { - 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; - }, - extend: { - getEventTarget: function getEventTarget() { - return this._dispatcher; - }, - - /**
- *
- */ - // schedules a runner on the timeline - schedule: 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 - unschedule: 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; - }, - play: function play() { - // Now make sure we are not paused and continue the animation - this._paused = false; - return this._continue(); - }, - pause: function pause() { - // Cancel the next animation frame and pause - this._nextFrame = null; - this._paused = true; - return this; - }, - stop: function stop() { - // Cancel the next animation frame and go to start - this.seek(-this._time); - return this.pause(); - }, - finish: function finish() { - this.seek(Infinity); - return this.pause(); - }, - speed: function speed(_speed) { - if (_speed == null) return this._speed; - this._speed = _speed; - return this; - }, - reverse: 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); - }, - seek: function seek(dt) { - this._time += dt; - return this._continue(); - }, - time: function time(_time2) { - if (_time2 == null) return this._time; - this._time = _time2; - return this; - }, - persist: function persist(dtOrForever) { - if (dtOrForever == null) return this._persist; - this._persist = dtOrForever; - return this; - }, - source: function source(fn) { - if (fn == null) return this._timeSource; - this._timeSource = fn; - return this; - }, - _step: 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 = SVG.Animator.frame(this._step.bind(this)); - } else { - this._nextFrame = null; - } - - return this; - }, - // Checks if we are running and continues the animation - _continue: function _continue() { - if (this._paused) return this; - if (!this._nextFrame) { - this._nextFrame = SVG.Animator.frame(this._step.bind(this)); - } - - return this; - }, - active: function active() { - return !!this._nextFrame; - } - }, - // These methods will be added to all SVG.Element objects - parent: SVG.Element, - construct: { - timeline: function timeline() { - this._timeline = this._timeline || new SVG.Timeline(); - return this._timeline; - } + 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
} -}); // c = { -// finished: Whether or not we are finished -// } - -/***
-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; - }; -} - -SVG.Stepper = SVG.invent({ - create: function create() {} -}); -/***
-Easing Functions
-================
-***/ -SVG.Ease = SVG.invent({ - inherit: SVG.Stepper, - create: function create(fn) { - SVG.Stepper.call(this, fn); - this.ease = SVG.easing[fn || SVG.defaults.timeline.ease] || fn; - }, - extend: { - step: function step(from, to, pos) { - if (typeof from !== 'number') { - return pos < 1 ? from : to; - } + 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 + }); - return from + (to - from) * this.ease(pos); - }, - done: function done(dt, c) { - return false; - } - } -}); -SVG.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 - }; + // 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
} - /***
- Controller Types
- ================
- ***/ -}; -SVG.Controller = SVG.invent({ - inherit: SVG.Stepper, - create: function create(fn) { - SVG.Stepper.call(this, fn); - this.stepper = fn; - }, - extend: { - step: function step(current, target, dt, c) { - return this.stepper(current, target, dt, c); - }, - done: function done(c) { - return c.done; - } + 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
} -}); - -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; -} - -SVG.Spring = SVG.invent({ - inherit: SVG.Controller, - create: function create(duration, overshoot) { - this.duration(duration || 500).overshoot(overshoot || 0); - }, - extend: { - step: 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 + var EventTarget = /*#__PURE__*/Object.freeze({ + name: name$2, + setup: setup$1, + on: on$1, + off: off$1, + dispatch: dispatch$1, + fire: fire + }); - c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; - return c.done ? target : newPosition; - }, - duration: makeSetterGetter('_duration', recalculate), - overshoot: makeSetterGetter('_overshoot', recalculate) + // 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
} -}); -SVG.PID = SVG.invent({ - inherit: SVG.Controller, - create: function create(p, i, d, windup) { - SVG.Controller.call(this); - 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); - }, - extend: { - step: 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)); - } + 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 + }); - 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); - }, - windup: makeSetterGetter('windup'), - p: makeSetterGetter('P'), - i: makeSetterGetter('I'), - d: makeSetterGetter('D') - } -});
+ // import {extend} from './tools.js'
+ const extend$2 = extend$1;
+
+ extend$2([
+ Doc$1,
+ Symbol,
+ Image,
+ Pattern,
+ Marker
+ ], {viewbox: Box$1.constructors.viewbox});
-return SVG
+ extend$2([Line, Polyline, Polygon, Path], {
+ ...Marker.constructors.marker
+ });
-}));
-//# sourceMappingURL=svg.js.map + extend$2(Text$1, TextPath.constructors.Text);
+ extend$2(Path, TextPath.constructors.Path);
+
+ extend$2(Defs, {
+ ...Gradient.constructors.Defs,
+ ...Marker.constructors.Defs,
+ ...Pattern.constructors.Defs,
+ });
+
+ extend$2([Text$1, Tspan], Tspan.constructors.Tspan);
+
+ extend$2([Gradient, Pattern], {
+ remove: patternGradientRemove,
+ targets: patternGradientTargets,
+ unFill: unFill,
+ });
+
+ extend$2(Gradient, {attr: gradientAttr});
+ extend$2(Pattern, {attr: patternAttr});
+
+ extend$2(ClipPath, {
+ remove: clipPathRemove,
+ targets: clipPathTargets
+ });
+
+ extend$2(Mask, {
+ remove: maskRemove,
+ targets: maskTargets
+ });
+
+ extend$2(Path, {targets: pathTargets});
+
+ extend$2(HtmlNode, {
+ add: HtmlNodeAdd
+ });
+
+ for (let i in containers) {
+ extend$2(containers[i], {
+ ...A.constructors.Container,
+ ...ClipPath.constructors.Container,
+ ...Doc$1.constructors.Container,
+ ...G.constructors.Container,
+ ...Gradient.constructors.Container,
+ ...Line.constructors.Container,
+ ...Marker.constructors.Container,
+ ...Mask.constructors.Container,
+ ...Path.constructors.Container,
+ ...Pattern.constructors.Container,
+ ...Polygon.constructors.Container,
+ ...Polyline.constructors.Container,
+ ...Rect.constructors.Container,
+ find,
+ ...Symbol.constructors.Container,
+ ...Text$1.constructors.Container,
+ ...TextPath.constructors.Container,
+ ...Use.constructors.Container,
+ });
+ }
+
+ for (let i in elements) {
+ extend$2(elements[i], {
+ ...EventTarget,
+ ...Element$1,
+ ...Parent,
+ ...arrange,
+ ...A.constructors.Element,
+ ...Box$1.constructors.Element,
+ ...Circle.constructors.Element,
+ ...ClipPath.constructors.Element,
+ ...css$1,
+ ...Image.constructors.Element,
+ ...Mask.constructors.Element,
+ ...Matrix.constructors.Element,
+ ...Point.constructors.Element,
+ ...Runner.constructors.Element,
+ ...Timeline.constructors.Element,
+ ...transform$1,
+ });
+ }
+
+
+ // The main wrapping element
+ function SVG (element) {
+ return makeInstance(element)
+ }
+
+ Object.assign(SVG, Classes);
+ Object.assign(SVG, tools);
+ Object.assign(SVG, adopter); + + return SVG; + +}()); diff --git a/dist/svg.min.js b/dist/svg.min.js deleted file mode 100644 index 0b5e35c..0000000 --- a/dist/svg.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! svg.js v3.0.0 MIT*/;!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t,t.document)}):"object"==typeof exports?module.exports=t.document?e(t,t.document):function(t){return e(t,t.document)}:t.SVG=e(t,t.document)}("undefined"!=typeof window?window:this,function(t,e){function n(t){return s(t)||r(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function r(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function s(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){l(t,e,n[e])})}return t}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,n){if(t instanceof q.Element)return t;if("object"===c(t))return q.adopt(t);if(null==t)return new q.Doc;if("string"==typeof t&&"<"!==t.charAt(0))return q.adopt(e.querySelector(t));var i=q.create("svg");return i.innerHTML=t,t=q.adopt(i.firstElementChild)}function d(t){return!(t.w||t.h||t.x||t.y)}function p(t){return(e.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===e}).call(e.documentElement,t)}function m(t,e,n,i){return n+i.replace(q.regex.dots," .")}function v(t){for(var e=t.slice(0),n=e.length;n--;)Array.isArray(e[n])&&(e[n]=v(e[n]));return e}function y(t,e){return t instanceof e}function x(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector).call(t,e)}function g(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}function _(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function A(t,e,n){if(null==e||null==n){var i=t.bbox();null==e?e=i.width/i.height*n:null==n&&(n=i.height/i.width*e)}return{width:e,height:n}}function M(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}function P(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}function N(t){for(var e=t.children.length-1;e>=0;e--)N(t.children[e]);return t.id?q.adopt(t).id(q.eid(t.nodeName)):q.adopt(t)}function E(t){return null==t.x&&(t.x=0,t.y=0,t.width=0,t.height=0),t.w=t.width,t.h=t.height,t.x2=t.x+t.width,t.y2=t.y+t.height,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}function O(t){var e=(t||"").toString().match(q.regex.reference);if(e)return e[1]}function T(t,e,n){return Math.abs(e-t)<(n||1e-6)}function k(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}function C(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,o=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,a=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,h=t.shear||0,u=t.rotate||t.theta||0,l=new q.Point(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new q.Point(t.position||t.px||t.positionX,t.py||t.positionY),p=d.x,m=d.y,v=new q.Point(t.translate||t.tx||t.translateX,t.ty||t.translateY),y=v.x,x=v.y,g=new q.Point(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:o,scaleY:a,skewX:r,skewY:s,shear:h,theta:u,rx:g.x,ry:g.y,tx:y,ty:x,ox:c,oy:f,px:p,py:m}}function S(t,e,n){var i=t.a*e.a+t.c*e.b,r=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,o=t.b*e.c+t.d*e.d,a=t.e+t.a*e.e+t.c*e.f,h=t.f+t.b*e.e+t.d*e.f;return n.a=i,n.b=r,n.c=s,n.d=o,n.e=a,n.f=h,n}function j(t,e){var n,i,r=t.origin;if("string"==typeof r||null==r){var s=(r||"center").toLowerCase().trim(),o=e.bbox(),a=o.height,h=o.width,u=o.x,l=o.y,c=s.includes("left")?u:s.includes("right")?u+h:u+h/2,f=s.includes("top")?l:s.includes("bottom")?l+a:l+a/2;n=null!=t.ox?t.ox:c,i=null!=t.oy?t.oy:f}else n=r[0],i=r[1];return[n,i]}function D(){var t=this._transformationRunners.runners,e=t.map(V).reduce(G,new q.Matrix);this.transform(e),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}function R(t,e){return function(n){return null==n?this[n]:(this[t]=n,e&&e.call(this),this)}}function I(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,i=Math.log(e/100+1e-10),r=-i/Math.sqrt(n*n+i*i),s=3.9/(r*t);this.d=2*r*s,this.k=s*s}if(!e.createElementNS||!e.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)return{supported:!1};var q=t.SVG=function(t){if(q.supported)return t=f(t)};q.supported=!0,q.ns="http://www.w3.org/2000/svg",q.xmlns="http://www.w3.org/2000/xmlns/",q.xlink="http://www.w3.org/1999/xlink",q.svgjs="http://svgjs.com/svgjs",q.did=1e3,q.eid=function(t){return"Svgjs"+w(t)+q.did++},q.create=function(t){return e.createElementNS(this.ns,t)},q.extend=function(t,e){var n,i;for(t=Array.isArray(t)?t:[t],i=t.length-1;i>=0;i--)if(t[i])for(n in e)t[i].prototype[n]=e[n]},q.invent=function(t){var e="function"==typeof t.create?t.create:function(e){t.inherit.call(this,e||q.create(t.create))};return t.inherit&&(e.prototype=new t.inherit,e.prototype.constructor=e),t.extend&&q.extend(e,t.extend),t.construct&&q.extend(t.parent||q.Container,t.construct),e},q.adopt=function(e){if(!e)return null;if(e.instance instanceof q.Element)return e.instance;if(!(e instanceof t.SVGElement))return new q.HtmlNode(e);return"svg"===e.nodeName?new q.Doc(e):"linearGradient"===e.nodeName||"radialGradient"===e.nodeName?new q.Gradient(e):q[w(e.nodeName)]?new(q[w(e.nodeName)])(e):new q.Parent(e)},q.regex={numberAndUnit:/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,transforms:/\)\s*,?\s*/,whitespace:/\s/g,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,isPercent:/^-?[\d.]+%$/,isImage:/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,delimiter:/[\s,]+/,hyphen:/([^e])-/gi,pathLetters:/[MLHVCSQTAZ]/gi,isPathLetter:/[MLHVCSQTAZ]/i,numbersWithDots:/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,dots:/\./g},q.utils={map:function(t,e){var n,i=t.length,r=[];for(n=0;n<i;n++)r.push(e(t[n]));return r},filter:function(t,e){var n,i=t.length,r=[];for(n=0;n<i;n++)e(t[n])&&r.push(t[n]);return r},radians:function(t){return t%360*Math.PI/180},degrees:function(t){return 180*t/Math.PI%360},filterSVGElements:function(e){return this.filter(e,function(e){return e instanceof t.SVGElement})}},q.void=function(){},q.defaults={timeline:{duration:400,ease:">",delay:0},attrs:{"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"}},q.Queue=q.invent({create:function(){this._first=null,this._last=null},extend:{push:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e},shift:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null},first:function(){return this._first&&this._first.value},last:function(){return this._last&&this._last.value},remove:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}}),q.Color=function(t,e,n){var i;this.r=0,this.g=0,this.b=0,t&&("string"==typeof t?q.regex.isRgb.test(t)?(i=q.regex.rgb.exec(t.replace(q.regex.whitespace,"")),this.r=parseInt(i[1]),this.g=parseInt(i[2]),this.b=parseInt(i[3])):q.regex.isHex.test(t)&&(i=q.regex.hex.exec(b(t)),this.r=parseInt(i[1],16),this.g=parseInt(i[2],16),this.b=parseInt(i[3],16)):Array.isArray(t)?(this.r=t[0],this.g=t[1],this.b=t[2]):"object"===c(t)?(this.r=t.r,this.g=t.g,this.b=t.b):3===arguments.length&&(this.r=t,this.g=e,this.b=n))},q.extend(q.Color,{toString:function(){return this.toHex()},toArray:function(){return[this.r,this.g,this.b]},fromArray:function(t){return new q.Color(t)},toHex:function(){return"#"+_(Math.round(this.r))+_(Math.round(this.g))+_(Math.round(this.b))},toRgb:function(){return"rgb("+[this.r,this.g,this.b].join()+")"},brightness:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11},morph:function(t){return this.destination=new q.Color(t),this},at:function(t){return this.destination?(t=t<0?0:t>1?1:t,new q.Color({r:~~(this.r+(this.destination.r-this.r)*t),g:~~(this.g+(this.destination.g-this.g)*t),b:~~(this.b+(this.destination.b-this.b)*t)})):this}}),q.Color.test=function(t){return t+="",q.regex.isHex.test(t)||q.regex.isRgb.test(t)},q.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},q.Color.isColor=function(t){return q.Color.isRgb(t)||q.Color.test(t)},q.Array=function(t,e){t=(t||[]).valueOf(),0===t.length&&e&&(t=e.valueOf()),this.value=this.parse(t)},q.extend(q.Array,{morph:function(t){if(this.destination=this.parse(t),this.value.length!==this.destination.length){for(var e=this.value[this.value.length-1],n=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(n);for(;this.value.length<this.destination.length;)this.value.push(e)}return this},settle:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)-1===n.indexOf(this.value[t])&&n.push(this.value[t]);return this.value=n,n},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];e<n;e++)i.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new q.Array(i)},toArray:function(){return this.value},toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(t){return t=t.valueOf(),Array.isArray(t)?t:t.trim().split(q.regex.delimiter).map(parseFloat)},reverse:function(){return this.value.reverse(),this},clone:function(){var t=new this.constructor;return t.value=v(this.value),t}}),q.PointArray=function(t,e){q.Array.call(this,t,e||[[0,0]])},q.PointArray.prototype=new q.Array,q.PointArray.prototype.constructor=q.PointArray,q.extend(q.PointArray,{toString:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)n.push(this.value[t].join(","));return n.join(" ")},toArray:function(){return this.value.reduce(function(t,e){return[].concat.call(t,e)},[])},toLine:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];e<n;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new q.PointArray(i)},parse:function(t){var e=[];if(t=t.valueOf(),Array.isArray(t)){if(Array.isArray(t[0]))return t}else t=t.trim().split(q.regex.delimiter).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,i=t.length;n<i;n+=2)e.push([t[n],t[n+1]]);return e},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;i>=0;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this},size:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;n>=0;n--)i.width&&(this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x),i.height&&(this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y);return this},bbox:function(){var t=-1/0,e=-1/0,n=1/0,i=1/0;return this.value.forEach(function(r){t=Math.max(r[0],t),e=Math.max(r[1],e),n=Math.min(r[0],n),i=Math.min(r[1],i)}),{x:n,y:i,width:t-n,height:e-i}}});for(var B={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},L="mlhvqtcsaz".split(""),F=0,z=L.length;F<z;++F)B[L[F]]=function(t){return function(e,n,i){if("H"===t)e[0]=e[0]+n.x;else if("V"===t)e[0]=e[0]+n.y;else if("A"===t)e[5]=e[5]+n.x,e[6]=e[6]+n.y;else for(var r=0,s=e.length;r<s;++r)e[r]=e[r]+(r%2?n.y:n.x);return B[t](e,n,i)}}(L[F].toUpperCase());q.PathArray=function(t,e){q.Array.call(this,t,e||[["M",0,0]])},q.PathArray.prototype=new q.Array,q.PathArray.prototype.constructor=q.PathArray,q.extend(q.PathArray,{toString:function(){return P(this.value)},toArray:function(){return this.value.reduce(function(t,e){return[].concat.call(t,e)},[])},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.value.length-1;r>=0;r--)i=this.value[r][0],"M"===i||"L"===i||"T"===i?(this.value[r][1]+=t,this.value[r][2]+=e):"H"===i?this.value[r][1]+=t:"V"===i?this.value[r][1]+=e:"C"===i||"S"===i||"Q"===i?(this.value[r][1]+=t,this.value[r][2]+=e,this.value[r][3]+=t,this.value[r][4]+=e,"C"===i&&(this.value[r][5]+=t,this.value[r][6]+=e)):"A"===i&&(this.value[r][6]+=t,this.value[r][7]+=e);return this},size:function(t,e){var n,i,r=this.bbox();for(n=this.value.length-1;n>=0;n--)i=this.value[n][0],"M"===i||"L"===i||"T"===i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y):"H"===i?this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x:"V"===i?this.value[n][1]=(this.value[n][1]-r.y)*e/r.height+r.y:"C"===i||"S"===i||"Q"===i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y,this.value[n][3]=(this.value[n][3]-r.x)*t/r.width+r.x,this.value[n][4]=(this.value[n][4]-r.y)*e/r.height+r.y,"C"===i&&(this.value[n][5]=(this.value[n][5]-r.x)*t/r.width+r.x,this.value[n][6]=(this.value[n][6]-r.y)*e/r.height+r.y)):"A"===i&&(this.value[n][1]=this.value[n][1]*t/r.width,this.value[n][2]=this.value[n][2]*e/r.height,this.value[n][6]=(this.value[n][6]-r.x)*t/r.width+r.x,this.value[n][7]=(this.value[n][7]-r.y)*e/r.height+r.y);return this},equalCommands:function(t){var e,n,i;for(t=new q.PathArray(t),i=this.value.length===t.value.length,e=0,n=this.value.length;i&&e<n;e++)i=this.value[e][0]===t.value[e][0];return i},morph:function(t){return t=new q.PathArray(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at:function(t){if(!this.destination)return this;var e,n,i,r,s=this.value,o=this.destination.value,a=[],h=new q.PathArray;for(e=0,n=s.length;e<n;e++){for(a[e]=[s[e][0]],i=1,r=s[e].length;i<r;i++)a[e][i]=s[e][i]+(o[e][i]-s[e][i])*t;"A"===a[e][0]&&(a[e][4]=+(0!==a[e][4]),a[e][5]=+(0!==a[e][5]))}return h.value=a,h},parse:function(t){if(t instanceof q.PathArray)return t.valueOf();var e,n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(q.regex.numbersWithDots,m).replace(q.regex.pathLetters," $& ").replace(q.regex.hyphen,"$1 -").trim().split(q.regex.delimiter):t.reduce(function(t,e){return[].concat.call(t,e)},[]);var i=[],r=new q.Point,s=new q.Point,o=0,a=t.length;do{q.regex.isPathLetter.test(t[o])?(e=t[o],++o):"M"===e?e="L":"m"===e&&(e="l"),i.push(B[e].call(null,t.slice(o,o+=n[e.toUpperCase()]).map(parseFloat),r,s))}while(a>o);return i},bbox:function(){return q.parser().path.setAttribute("d",this.toString()),q.parser.nodes.path.getBBox()}}),q.Number=q.invent({create:function(t,e){e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-3.4e38:3.4e38:"string"==typeof t?(e=t.match(q.regex.numberAndUnit))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof q.Number&&(this.value=t.valueOf(),this.unit=t.unit)},extend:{toString:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit},toJSON:function(){return this.toString()},toArray:function(){return[this.value,this.unit]},valueOf:function(){return this.value},plus:function(t){return t=new q.Number(t),new q.Number(this+t,this.unit||t.unit)},minus:function(t){return t=new q.Number(t),new q.Number(this-t,this.unit||t.unit)},times:function(t){return t=new q.Number(t),new q.Number(this*t,this.unit||t.unit)},divide:function(t){return t=new q.Number(t),new q.Number(this/t,this.unit||t.unit)},to:function(t){var e=new q.Number(this);return"string"==typeof t&&(e.unit=t),e},morph:function(t){return this.destination=new q.Number(t),t.relative&&(this.destination.value+=this.value),this},at:function(t){return this.destination?new q.Number(this.destination).minus(this).times(t).plus(this):this}}}),q.EventTarget=q.invent({create:function(){},extend:{on:function(t,e,n,i){return q.on(this,t,e,n,i),this},off:function(t,e){return q.off(this,t,e),this},dispatch:function(t,e){return q.dispatch(this,t,e)},fire:function(t,e){return this.dispatch(t,e),this}}}),q.HtmlNode=q.invent({inherit:q.EventTarget,create:function(t){this.node=t},extend:{add:function(t,e){return t=f(t),t.node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this},put:function(t,e){return this.add(t,e),t},getEventTarget:function(){return this.node}}}),q.Element=q.invent({inherit:q.EventTarget,create:function(t){this.events={},this.dom={},this.node=t,this.node&&(this.type=t.nodeName,this.node.instance=this,this.events=t.events||{},t.hasAttribute("svgjs:data")&&this.setData(JSON.parse(t.getAttribute("svgjs:data"))||{}))},extend:{x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=A(this,t,e);return this.width(new q.Number(n.width)).height(new q.Number(n.height))},clone:function(t){this.writeDataToDom();var e=N(this.node.cloneNode(!0));return t?t.add(e):this.after(e),e},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(t){return this.after(t).remove(),t},addTo:function(t){return f(t).put(this)},putIn:function(t){return f(t).add(this)},id:function(t){return void 0!==t||this.node.id||(this.node.id=q.eid(this.type)),this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")},toString:function(){return this.id()},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(q.regex.delimiter)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter(function(e){return e!==t}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return q.get(this.attr(t))},parent:function(e){var n=this;if(!n.node.parentNode)return null;if(n=q.adopt(n.node.parentNode),!e)return n;for(;n&&n.node instanceof t.SVGElement;){if("string"==typeof e?n.matches(e):n instanceof e)return n;n=q.adopt(n.node.parentNode)}},doc:function(){var t=this.parent(q.Doc);return t&&t.doc()},defs:function(){return this.doc().defs()},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function(t){return x(this.node,t)},native:function(){return this.node},svg:function(t){var n,i;if(!(t&&this instanceof q.Parent))return this.writeDataToDom(),this.node.outerHTML;for(n=e.createElementNS(q.ns,"svg"),n.innerHTML=t,i=n.children.length;i--;)this.node.appendChild(n.firstElementChild);return this},writeDataToDom:function(){return this.is(q.Parent)&&this.each(function(){this.writeDataToDom()}),this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(t){return this.dom=t,this},is:function(t){return y(this,t)},getEventTarget:function(){return this.node}}}),["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){q.Element.prototype[t]=function(e){return null===e?q.off(this,t):q.on(this,t,e),this}}),q.listenerId=0,q.on=function(t,e,n,i,r){var s=n.bind(i||t),o=t instanceof q.EventTarget?t.getEventTarget():t;e=Array.isArray(e)?e:e.split(q.regex.delimiter),o.instance=o.instance||{events:{}};var a=o.instance.events;n._svgjsListenerId||(n._svgjsListenerId=++q.listenerId),e.forEach(function(t){var e=t.split(".")[0],i=t.split(".")[1]||"*";a[e]=a[e]||{},a[e][i]=a[e][i]||{},a[e][i][n._svgjsListenerId]=s,o.addEventListener(e,s,r||!1)})},q.off=function(t,e,n,i){var r=t instanceof q.EventTarget?t.getEventTarget():t;if(r.instance&&("function"!=typeof n||(n=n._svgjsListenerId))){var s=r.instance.events;e=Array.isArray(e)?e:(e||"").split(q.regex.delimiter),e.forEach(function(t){var e,o,a=t&&t.split(".")[0],h=t&&t.split(".")[1];if(n)s[a]&&s[a][h||"*"]&&(r.removeEventListener(a,s[a][h||"*"][n],i||!1),delete s[a][h||"*"][n]);else if(a&&h){if(s[a]&&s[a][h]){for(o in s[a][h])q.off(r,[a,h].join("."),o);delete s[a][h]}}else if(h)for(t in s)for(e in s[t])h===e&&q.off(r,[t,h].join("."));else if(a){if(s[a]){for(e in s[a])q.off(r,[a,e].join("."));delete s[a]}}else{for(t in s)q.off(r,t);r.instance.events={}}})}},q.dispatch=function(e,n,i){var r=e instanceof q.EventTarget?e.getEventTarget():e;return n instanceof t.Event?r.dispatchEvent(n):(n=new t.CustomEvent(n,{detail:i,cancelable:!0}),r.dispatchEvent(n)),n},q.Matrix=q.invent({create:function(t){var e=M([1,0,0,1,0,0]);t=t instanceof q.Element?t.matrixify():"string"==typeof t?M(t.split(q.regex.delimiter).map(parseFloat)):Array.isArray(t)?M(t):"object"===c(t)&&k(t)?t:"object"===c(t)?(new q.Matrix).transform(t):6===arguments.length?M([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f},extend:{clone:function(){return new q.Matrix(this)},transform:function(t){if(k(t)){return new q.Matrix(t).multiplyO(this)}var e=C(t),n=this,i=new q.Point(e.ox,e.oy).transform(n),r=i.x,s=i.y,o=(new q.Matrix).translateO(e.rx,e.ry).lmultiplyO(n).translateO(-r,-s).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(r,s);if(isFinite(e.px)||isFinite(e.py)){var a=new q.Point(r,s).transform(o),h=e.px?e.px-a.x:0,u=e.py?e.py-a.y:0;o.translateO(h,u)}return o.translateO(e.tx,e.ty),o},compose:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,i=t.scaleX||1,r=t.scaleY||1,s=t.shear||0,o=t.rotate||0,a=t.translateX||0,h=t.translateY||0;return(new q.Matrix).translateO(-e,-n).scaleO(i,r).shearO(s).rotateO(o).translateO(a,h).lmultiplyO(this).translateO(e,n)},decompose:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.a,i=this.b,r=this.c,s=this.d,o=this.e,a=this.f,h=n*s-i*r,u=h>0?1:-1,l=u*Math.sqrt(n*n+i*i),c=Math.atan2(u*i,u*n),f=180/Math.PI*c,d=Math.cos(c),p=Math.sin(c),m=(n*r+i*s)/h,v=r*l/(m*n-i)||s*l/(m*i+n);return{scaleX:l,scaleY:v,shear:m,rotate:f,translateX:o-t+t*d*l+e*(m*d*l-p*v),translateY:a-e+t*p*l+e*(m*p*l+d*v),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}},morph:function(t){return this.destination=new q.Matrix(t),this},at:function(t){return this.destination?new q.Matrix({a:this.a+(this.destination.a-this.a)*t,b:this.b+(this.destination.b-this.b)*t,c:this.c+(this.destination.c-this.c)*t,d:this.d+(this.destination.d-this.d)*t,e:this.e+(this.destination.e-this.e)*t,f:this.f+(this.destination.f-this.f)*t}):this},multiply:function(t){return this.clone().multiplyO(t)},multiplyO:function(t){return S(this,t instanceof q.Matrix?t:new q.Matrix(t),this)},lmultiply:function(t){return this.clone().lmultiplyO(t)},lmultiplyO:function(t){var e=this;return S(t instanceof q.Matrix?t:new q.Matrix(t),e,this)},inverseO:function(){var t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,o=t*i-e*n;if(!o)throw new Error("Cannot invert "+this);var a=i/o,h=-e/o,u=-n/o,l=t/o,c=-(a*r+u*s),f=-(h*r+l*s);return this.a=a,this.b=h,this.c=u,this.d=l,this.e=c,this.f=f,this},inverse:function(){return this.clone().inverseO()},translate:function(t,e){return this.clone().translateO(t,e)},translateO:function(t,e){return this.e+=t||0,this.f+=e||0,this},scale:function(t,e,n,i){var r;return(r=this.clone()).scaleO.apply(r,arguments)},scaleO:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t);var r=this.a,s=this.b,o=this.c,a=this.d,h=this.e,u=this.f;return this.a=r*t,this.b=s*e,this.c=o*t,this.d=a*e,this.e=h*t-n*t+n,this.f=u*e-i*e+i,this},rotate:function(t,e,n){return this.clone().rotateO(t,e,n)},rotateO:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=q.utils.radians(t);var i=Math.cos(t),r=Math.sin(t),s=this.a,o=this.b,a=this.c,h=this.d,u=this.e,l=this.f;return this.a=s*i-o*r,this.b=o*i+s*r,this.c=a*i-h*r,this.d=h*i+a*r,this.e=u*i-l*r+n*r-e*i+e,this.f=l*i+u*r-e*r-n*i+n,this},flip:function(t,e){return this.clone().flipO(t,e)},flipO:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)},shear:function(t,e,n){return this.clone().shearO(t,e,n)},shearO:function(t){var e=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:0),n=this.a,i=this.b,r=this.c,s=this.d,o=this.e,a=this.f;return this.a=n+i*t,this.c=r+s*t,this.e=o+a*t-e*t,this},skew:function(t,e,n,i){var r;return(r=this.clone()).skewO.apply(r,arguments)},skewO:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t),t=q.utils.radians(t),e=q.utils.radians(e);var r=Math.tan(t),s=Math.tan(e),o=this.a,a=this.b,h=this.c,u=this.d,l=this.e,c=this.f;return this.a=o+a*r,this.b=a+o*s,this.c=h+u*r,this.d=u+h*s,this.e=l+c*r-i*r,this.f=c+l*s-n*s,this},skewX:function(t,e,n){return this.skew(t,0,e,n)},skewXO:function(t,e,n){return this.skewO(t,0,e,n)},skewY:function(t,e,n){return this.skew(0,t,e,n)},skewYO:function(t,e,n){return this.skewO(0,t,e,n)},aroundO:function(t,e,n){var i=t||0,r=e||0;return this.translateO(-i,-r).lmultiplyO(n).translateO(i,r)},around:function(t,e,n){return this.clone().aroundO(t,e,n)},native:function(){for(var t=q.parser.nodes.svg.node.createSVGMatrix(),e=Y.length-1;e>=0;e--)t[Y[e]]=this[Y[e]];return t},equals:function(t){var e=new q.Matrix(t);return T(this.a,e.a)&&T(this.b,e.b)&&T(this.c,e.c)&&T(this.d,e.d)&&T(this.e,e.e)&&T(this.f,e.f)},toString:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"},toArray:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]},valueOf:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},parent:q.Element,construct:{ctm:function(){return new q.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof q.Doc&&!this.isRoot()){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new q.Matrix(e)}return new q.Matrix(this.node.getScreenCTM())}}}),q.Point=q.invent({create:function(t,e,n){var i;n=n||{x:0,y:0},i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===c(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==i.x?n.x:i.x,this.y=null==i.y?n.y:i.y},extend:{clone:function(){return new q.Point(this)},morph:function(t,e){return this.destination=new q.Point(t,e),this},at:function(t){return this.destination?new q.Point({x:this.x+(this.destination.x-this.x)*t,y:this.y+(this.destination.y-this.y)*t}):this},native:function(){var t=q.parser.nodes.svg.node.createSVGPoint();return t.x=this.x,t.y=this.y,t},transform:function(t){var e=t.a*this.x+t.c*this.y+t.e,n=t.b*this.x+t.d*this.y+t.f;return new q.Point(e,n)}}}),q.extend(q.Element,{point:function(t,e){return new q.Point(t,e).transform(this.screenCTM().inverse())}}),q.extend(q.Element,{attr:function(t,e,n){if(null==t){for(t={},e=this.node.attributes,n=e.length-1;n>=0;n--)t[e[n].nodeName]=q.regex.isNumber.test(e[n].nodeValue)?parseFloat(e[n].nodeValue):e[n].nodeValue;return t}if("object"===c(t))for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return e=this.node.getAttribute(t),null==e?q.defaults.attrs[t]:q.regex.isNumber.test(e)?parseFloat(e):e;"fill"!==t&&"stroke"!==t||(q.regex.isImage.test(e)&&(e=this.doc().defs().image(e)),e instanceof q.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new q.Number(e):q.Color.isColor(e)?e=new q.Color(e):Array.isArray(e)&&(e=new q.Array(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild(t,e)}return this}}),q.extend(q.Element,{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(q.regex.transforms).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(q.regex.delimiter).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(M(e[1])):t[e[0]].apply(t,e[1])},new q.Matrix)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())}}),q.extend(q.Element,{transform:function(t,e){if(null==t||"string"==typeof t){var n=new q.Matrix(this).decompose();return n[t]||n}k(t)||(t=u({},t,{ -origin:j(t,this)}));var i=!0===e?this:e||!1,r=new q.Matrix(i).transform(t);return this.attr("transform",r)}}),q.extend(q.Element,{css:function(t,e){var n,i,r={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){n=t.split(/\s*:\s*/),r[n[0]]=n[1]}),r;if(arguments.length<2){if(Array.isArray(t)){for(i=t.length;i--;)r[g(t[i])]=this.node.style[g(t[i])];return r}if("string"==typeof t)return this.node.style[g(t)];if("object"===c(t))for(i in t)this.node.style[g(i)]=null==t[i]||q.regex.isBlank.test(t[i])?"":t[i]}return 2===arguments.length&&(this.node.style[g(t)]=null==e||q.regex.isBlank.test(e)?"":e),this}}),q.Parent=q.invent({create:function(t){q.Element.call(this,t)},inherit:q.Element,extend:{children:function(){return q.utils.map(this.node.children,function(t){return q.adopt(t)})},add:function(t,e){return t=f(t),t.node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this},put:function(t,e){return this.add(t,e),t.instance||t},has:function(t){return this.index(t)>=0},index:function(t){return[].slice.call(this.node.children).indexOf(t.node)},get:function(t){return q.adopt(this.node.children[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.children.length-1)},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;n<i;n++)r[n]instanceof q.Element&&t.apply(r[n],[n,r]),e&&r[n]instanceof q.Parent&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this}}}),q.extend(q.Parent,{flatten:function(t){return this instanceof q.G||this instanceof q.Doc?(t=t||(this instanceof q.Doc&&this.isRoot()?this:this.parent(q.Parent)),this.each(function(){return this instanceof q.Defs?this:this instanceof q.Parent?this.flatten(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this):this},ungroup:function(t){return this instanceof q.G||this instanceof q.Doc&&!this.isRoot()?(t=t||this.parent(q.Parent),this.each(function(){return this.toParent(t)}),this.remove(),this):this}}),q.Container=q.invent({create:function(t){q.Element.call(this,t)},inherit:q.Parent}),q.Defs=q.invent({create:"defs",inherit:q.Container}),q.G=q.invent({create:"g",inherit:q.Container,extend:{},construct:{group:function(){return this.put(new q.G)}}}),q.extend(q.Element,{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),e instanceof q.Doc&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return t>0&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),t instanceof q.Doc&&t.node.appendChild(t.defs().node),this},back:function(){return this.position()>0&&this.parent().removeElement(this).add(this,0),this},before:function(t){t.remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){t.remove();var e=this.position();return this.parent().add(t,e+1),this}}),q.Mask=q.invent({create:"mask",inherit:q.Container,extend:{remove:function(){return this.targets().forEach(function(t){t.unmask()}),q.Element.prototype.remove.call(this)},targets:function(){return q.select('svg [mask*="'+this.id()+'"]')}},construct:{mask:function(){return this.defs().put(new q.Mask)}}}),q.extend(q.Element,{maskWith:function(t){var e=t instanceof q.Mask?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}),q.ClipPath=q.invent({create:"clipPath",inherit:q.Container,extend:{remove:function(){return this.targets().forEach(function(t){t.unclip()}),q.Element.prototype.remove.call(this)},targets:function(){return q.select('svg [clip-path*="'+this.id()+'"]')}},construct:{clip:function(){return this.defs().put(new q.ClipPath)}}}),q.extend(q.Element,{clipWith:function(t){var e=t instanceof q.ClipPath?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}),q.Gradient=q.invent({create:function(t){q.Element.call(this,"object"===c(t)?t:q.create(t+"Gradient"))},inherit:q.Container,extend:{stop:function(t,e,n){return this.put(new q.Stop).update(t,e,n)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},url:function(){return"url(#"+this.id()+")"},toString:function(){return this.url()},attr:function(t,e,n){return"transform"===t&&(t="gradientTransform"),q.Container.prototype.attr.call(this,t,e,n)}},construct:{gradient:function(t,e){return this.defs().gradient(t,e)}}}),q.extend([q.Gradient,q.Timeline],{from:function(t,e){return"radialGradient"===(this._target||this).type?this.attr({fx:new q.Number(t),fy:new q.Number(e)}):this.attr({x1:new q.Number(t),y1:new q.Number(e)})},to:function(t,e){return"radialGradient"===(this._target||this).type?this.attr({cx:new q.Number(t),cy:new q.Number(e)}):this.attr({x2:new q.Number(t),y2:new q.Number(e)})}}),q.extend(q.Defs,{gradient:function(t,e){return this.put(new q.Gradient(t)).update(e)}}),q.Stop=q.invent({create:"stop",inherit:q.Element,extend:{update:function(t){return("number"==typeof t||t instanceof q.Number)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new q.Number(t.offset)),this}}}),q.Pattern=q.invent({create:"pattern",inherit:q.Container,extend:{url:function(){return"url(#"+this.id()+")"},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return this.url()},attr:function(t,e,n){return"transform"===t&&(t="patternTransform"),q.Container.prototype.attr.call(this,t,e,n)}},construct:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}}}),q.extend(q.Defs,{pattern:function(t,e,n){return this.put(new q.Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}),q.Doc=q.invent({create:function(t){q.Element.call(this,t||q.create("svg")),this.namespace()},inherit:q.Container,extend:{isRoot:function(){return!(this.node.parentNode&&this.node.parentNode instanceof t.SVGElement&&"#document"!==this.node.parentNode.nodeName)},doc:function(){return this.isRoot()?this:q.Element.prototype.doc.call(this)},namespace:function(){return this.isRoot()?this.attr({xmlns:q.ns,version:"1.1"}).attr("xmlns:xlink",q.xlink,q.xmlns).attr("xmlns:svgjs",q.svgjs,q.xmlns):this.doc().namespace()},defs:function(){return this.isRoot()?q.adopt(this.node.getElementsByTagName("defs")[0])||this.put(new q.Defs):this.doc().defs()},parent:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:this.node.parentNode:q.Element.prototype.parent.call(this,t)},remove:function(){return this.isRoot()?(this.parent()&&this.parent().removeChild(this.node),this):q.Element.prototype.remove.call(this)},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}},construct:{nested:function(){return this.put(new q.Doc)}}}),q.Shape=q.invent({create:function(t){q.Element.call(this,t)},inherit:q.Element}),q.Bare=q.invent({create:function(t,e){if(q.Element.call(this,q.create(t)),e)for(var n in e.prototype)"function"==typeof e.prototype[n]&&(this[n]=e.prototype[n])},inherit:q.Element,extend:{words:function(t){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this.node.appendChild(e.createTextNode(t)),this}}}),q.extend(q.Parent,{element:function(t,e){return this.put(new q.Bare(t,e))}}),q.Symbol=q.invent({create:"symbol",inherit:q.Container,construct:{symbol:function(){return this.put(new q.Symbol)}}}),q.Use=q.invent({create:"use",inherit:q.Shape,extend:{element:function(t,e){return this.attr("href",(e||"")+"#"+t,q.xlink)}},construct:{use:function(t,e){return this.put(new q.Use).element(t,e)}}}),q.Rect=q.invent({create:"rect",inherit:q.Shape,construct:{rect:function(t,e){return this.put(new q.Rect).size(t,e)}}}),q.Circle=q.invent({create:"circle",inherit:q.Shape,construct:{circle:function(t){return this.put(new q.Circle).rx(new q.Number(t).divide(2)).move(0,0)}}}),q.extend([q.Circle,q.Timeline],{rx:function(t){return this.attr("r",t)},ry:function(t){return this.rx(t)}}),q.Ellipse=q.invent({create:"ellipse",inherit:q.Shape,construct:{ellipse:function(t,e){return this.put(new q.Ellipse).size(t,e).move(0,0)}}}),q.extend([q.Ellipse,q.Rect,q.Timeline],{rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)}}),q.extend([q.Circle,q.Ellipse],{x:function(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())},y:function(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",t)},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",t)},width:function(t){return null==t?2*this.rx():this.rx(new q.Number(t).divide(2))},height:function(t){return null==t?2*this.ry():this.ry(new q.Number(t).divide(2))},size:function(t,e){var n=A(this,t,e);return this.rx(new q.Number(n.width).divide(2)).ry(new q.Number(n.height).divide(2))}}),q.Line=q.invent({create:"line",inherit:q.Shape,extend:{array:function(){return new q.PointArray([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])},plot:function(t,e,n,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:i}:new q.PointArray(t).toLine(),this.attr(t))},move:function(t,e){return this.attr(this.array().move(t,e).toLine())},size:function(t,e){var n=A(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}},construct:{line:function(t,e,n,i){return q.Line.prototype.plot.apply(this.put(new q.Line),null!=t?[t,e,n,i]:[0,0,0,0])}}}),q.Polyline=q.invent({create:"polyline",inherit:q.Shape,construct:{polyline:function(t){return this.put(new q.Polyline).plot(t||new q.PointArray)}}}),q.Polygon=q.invent({create:"polygon",inherit:q.Shape,construct:{polygon:function(t){return this.put(new q.Polygon).plot(t||new q.PointArray)}}}),q.extend([q.Polyline,q.Polygon],{array:function(){return this._array||(this._array=new q.PointArray(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new q.PointArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=A(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),q.extend([q.Line,q.Polyline,q.Polygon],{MorphArray:q.PointArray,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}}),q.Path=q.invent({create:"path",inherit:q.Shape,extend:{MorphArray:q.PathArray,array:function(){return this._array||(this._array=new q.PathArray(this.attr("d")))},plot:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new q.PathArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("d",this.array().move(t,e))},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},size:function(t,e){var n=A(this,t,e);return this.attr("d",this.array().size(n.width,n.height))},width:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)},height:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},construct:{path:function(t){return this.put(new q.Path).plot(t||new q.PathArray)}}}),q.Image=q.invent({create:"image",inherit:q.Shape,extend:{load:function(e,n){if(!e)return this;var i=new t.Image;return q.on(i,"load",function(t){var r=this.parent(q.Pattern);0===this.width()&&0===this.height()&&this.size(i.width,i.height),r instanceof q.Pattern&&0===r.width()&&0===r.height()&&r.size(this.width(),this.height()),"function"==typeof n&&n.call(this,{width:i.width,height:i.height,ratio:i.width/i.height,url:e})},this),q.on(i,"load error",function(){q.off(i)}),this.attr("href",i.src=e,q.xlink)}},construct:{image:function(t,e){return this.put(new q.Image).size(0,0).load(t,e)}}}),q.Text=q.invent({create:function(t){q.Element.call(this,t||q.create("text")),this.dom.leading=new q.Number(1.3),this._rebuild=!0,this._build=!1,this.attr("font-family",q.defaults.attrs["font-family"])},inherit:q.Parent,extend:{x:function(t){return null==t?this.attr("x"):this.attr("x",t)},y:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)},text:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var i=0,r=e.length;i<r;++i)"textPath"!==e[i].nodeName?(i!==n&&3!==e[i].nodeType&&!0===q.adopt(e[i]).dom.newLined&&(t+="\n"),t+=e[i].textContent):0===i&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else{t=t.split("\n");for(var s=0,o=t.length;s<o;s++)this.tspan(t[s]).newLine()}return this.build(!1).rebuild()},leading:function(t){return null==t?this.dom.leading:(this.dom.leading=new q.Number(t),this.rebuild())},rebuild:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,n=0,i=this.dom.leading*new q.Number(this.attr("font-size"));this.each(function(){this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?n+=i:(this.attr("dy",i+n),n=0))}),this.fire("rebuild")}return this},build:function(t){return this._build=!!t,this},setData:function(t){return this.dom=t,this.dom.leading=new q.Number(t.leading||1.3),this}},construct:{text:function(t){return this.put(new q.Text).text(t)},plain:function(t){return this.put(new q.Text).plain(t)}}}),q.Tspan=q.invent({create:"tspan",inherit:q.Parent,extend:{text:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)},dx:function(t){return this.attr("dx",t)},dy:function(t){return this.attr("dy",t)},newLine:function(){var t=this.parent(q.Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}}),q.extend([q.Text,q.Tspan],{plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(e.createTextNode(t)),this},tspan:function(t){var e=new q.Tspan;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)},length:function(){return this.node.getComputedTextLength()}}),q.TextPath=q.invent({create:"textPath",inherit:q.Text,parent:q.Parent,extend:{MorphArray:q.PathArray,array:function(){var t=this.track();return t?t.array():null},plot:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this},track:function(){return this.reference("href")}},construct:{textPath:function(t,e){return this.defs().path(e).text(t).addTo(this)}}}),q.extend([q.Text],{path:function(t){var e=new q.TextPath;return t instanceof q.Path||(t=this.doc().defs().path(t)),e.attr("href","#"+t,q.xlink),this.put(e)},textPath:function(){return this.select("textPath")}}),q.extend([q.Path],{text:function(t){if(t instanceof q.Text){var e=t.text();return t.clear().path(this).text(e)}return this.parent().put(new q.Text).path(this).text(t)}}),q.A=q.invent({create:"a",inherit:q.Container,extend:{to:function(t){return this.attr("href",t,q.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new q.A).to(t)}}}),q.extend(q.Element,{linkTo:function(t){var e=new q.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}),q.Marker=q.invent({create:"marker",inherit:q.Container,extend:{width:function(t){return this.attr("markerWidth",t)},height:function(t){return this.attr("markerHeight",t)},ref:function(t,e){return this.attr("refX",t).attr("refY",e)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return"url(#"+this.id()+")"}},construct:{marker:function(t,e,n){return this.defs().marker(t,e,n)}}}),q.extend(q.Defs,{marker:function(t,e,n){return this.put(new q.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}}),q.extend([q.Line,q.Polyline,q.Polygon,q.Path],{marker:function(t,e,n,i){var r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof q.Marker?arguments[1]:this.doc().marker(e,n,i),this.attr(r,t)}});var X={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};["fill","stroke"].forEach(function(t){var e,n={};n[t]=function(n){if(void 0===n)return this;if("string"==typeof n||q.Color.isRgb(n)||n&&"function"==typeof n.fill)this.attr(t,n);else for(e=X[t].length-1;e>=0;e--)null!=n[X[t][e]]&&this.attr(X.prefix(t,X[t][e]),n[X[t][e]]);return this},q.extend([q.Element,q.Timeline],n)}),q.extend([q.Element,q.Timeline],{matrix:function(t,e,n,i,r,s){return null==t?new q.Matrix(this):this.attr("transform",new q.Matrix(t,e,n,i,r,s))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},!0)},skew:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},!0):this.transform({skew:[t,e],ox:n,oy:i},!0)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},!0)},scale:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},!0):this.transform({scale:[t,e],ox:n,oy:i},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t,e){var n="string"==typeof t?t:(isFinite(t),"both"),i="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];this.transform({flip:n,origin:i},!0)},opacity:function(t){return this.attr("opacity",t)},dx:function(t){return this.x(new q.Number(t).plus(this instanceof q.Timeline?0:this.x()),!0)},dy:function(t){return this.y(new q.Number(t).plus(this instanceof q.Timeline?0:this.y()),!0)},dmove:function(t,e){return this.dx(t).dy(e)}}),q.extend([q.Rect,q.Ellipse,q.Circle,q.Gradient,q.Timeline],{radius:function(t,e){var n=(this._target||this).type;return"radialGradient"===n||"radialGradient"===n?this.attr("r",new q.Number(t)):this.rx(t).ry(null==e?t:e)}}),q.extend(q.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new q.Point(this.node.getPointAtLength(t))}}),q.extend([q.Parent,q.Text,q.Tspan,q.Timeline],{font:function(t,e){if("object"===c(t))for(e in t)this.font(e,t[e]);return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),q.extend(q.Element,{data:function(t,e,n){if("object"===c(t))for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===n||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),q.extend(q.Element,{remember:function(t,e){if("object"===c(arguments[0]))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory||(this._memory={})}}),q.get=function(t){var n=e.getElementById(O(t)||t);return q.adopt(n)},q.select=function(t,n){return q.utils.map((n||e).querySelectorAll(t),function(t){return q.adopt(t)})},q.$$=function(t,n){return q.utils.map((n||e).querySelectorAll(t),function(t){return q.adopt(t)})},q.$=function(t,n){return q.adopt((n||e).querySelector(t))},q.extend(q.Parent,{select:function(t){return q.select(t,this.node)}});var Y="abcdef".split("");q.Box=q.invent({create:function(t){var e=[0,0,0,0];t="string"==typeof t?t.split(q.regex.delimiter).map(parseFloat):Array.isArray(t)?t:"object"===c(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):e,this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3],E(this)},extend:{merge:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new q.Box(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)},transform:function(t){var e=1/0,n=-1/0,i=1/0,r=-1/0;return[new q.Point(this.x,this.y),new q.Point(this.x2,this.y),new q.Point(this.x,this.y2),new q.Point(this.x2,this.y2)].forEach(function(s){s=s.transform(t),e=Math.min(e,s.x),n=Math.max(n,s.x),i=Math.min(i,s.y),r=Math.max(r,s.y)}),new q.Box(e,i,n-e,r-i)},addOffset:function(){return this.x+=t.pageXOffset,this.y+=t.pageYOffset,this},toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height},toArray:function(){return[this.x,this.y,this.width,this.height]},morph:function(t,e,n,i){return this.destination=new q.Box(t,e,n,i),this},at:function(t){return this.destination?new q.Box(this.x+(this.destination.x-this.x)*t,this.y+(this.destination.y-this.y)*t,this.width+(this.destination.width-this.width)*t,this.height+(this.destination.height-this.height)*t):this}},parent:q.Element,construct:{bbox:function(){var t;try{if(t=this.node.getBBox(),d(t)&&!p(this.node))throw new Exception("Element not in the dom")}catch(n){try{var e=this.clone(q.parser().svg).show();t=e.node.getBBox(),e.remove()}catch(t){console.warn("Getting a bounding box of this element is not possible")}}return new q.Box(t)},rbox:function(t){try{var e=new q.Box(this.node.getBoundingClientRect());return t?e.transform(t.screenCTM().inverse()):e.addOffset()}catch(t){return new q.Box}}}}),q.extend([q.Doc,q.Symbol,q.Image,q.Pattern,q.Marker,q.ForeignObject,q.View],{viewbox:function(t,e,n,i){return null==t?new q.Box(this.attr("viewBox")):this.attr("viewBox",new q.Box(t,e,n,i))}}),q.parser=function(){var t;return q.parser.nodes.svg.node.parentNode||(t=e.body||e.documentElement,q.parser.nodes.svg.addTo(t)),q.parser.nodes},q.parser.nodes={svg:q().size(2,0).css({opacity:0,position:"absolute",left:"-100%",top:"-100%",overflow:"hidden"})},q.parser.nodes.path=q.parser.nodes.svg.path().node,q.Animator={nextDraw:null,frames:new q.Queue,timeouts:new q.Queue,timer:t.performance||t.Date,transforms:[],frame:function(t){var e=q.Animator.frames.push({run:t});return null===q.Animator.nextDraw&&(q.Animator.nextDraw=requestAnimationFrame(q.Animator._draw)),e},transform_frame:function(t,e){q.Animator.transforms[e]=t},timeout:function(t,e){e=e||0;var n=q.Animator.timer.now()+e,i=q.Animator.timeouts.push({run:t,time:n});return null===q.Animator.nextDraw&&(q.Animator.nextDraw=requestAnimationFrame(q.Animator._draw)),i},cancelFrame:function(t){q.Animator.frames.remove(t)},clearTimeout:function(t){q.Animator.timeouts.remove(t)},_draw:function(t){for(var e=null,n=q.Animator.timeouts.last();(e=q.Animator.timeouts.shift())&&(t>=e.time?e.run():q.Animator.timeouts.push(e),e!==n););for(var i=null,r=q.Animator.frames.last();i!==r&&(i=q.Animator.frames.shift());)i.run();q.Animator.transforms.forEach(function(t){t()}),q.Animator.nextDraw=q.Animator.timeouts.first()||q.Animator.frames.first()?requestAnimationFrame(q.Animator._draw):null}},q.Morphable=q.invent({create:function(t){this._stepper=t||new q.Ease("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null},extend:{from:function(t){return null==t?this._from:(this._from=this._set(t),this)},to:function(t){return null==t?this._to:(this._to=this._set(t),this)},type:function(t){return null==t?this._type:(this._type=t,this)},_set:function(t){if(!this._type){var e=c(t);"number"===e?this.type(q.Number):"string"===e?q.Color.isColor(t)?this.type(q.Color):q.regex.delimiter.test(t)?this.type(q.regex.pathLetters.test(t)?q.PathArray:q.Array):q.regex.numberAndUnit.test(t)?this.type(q.Number):this.type(q.Morphable.NonMorphable):q.MorphableTypes.indexOf(t.constructor)>-1?this.type(t.constructor):Array.isArray(t)?this.type(q.Array):"object"===e?this.type(q.Morphable.ObjectBag):this.type(q.Morphable.NonMorphable)}var n=new this._type(t).toArray();return this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object),n},stepper:function(t){return null==t?this._stepper:(this._stepper=t,this)},done:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)},at:function(t){var e=this;return this._morphObj.fromArray(this._from.map(function(n,i){return e._stepper.step(n,e._to[i],t,e._context[i],e._context)}))}}}),q.Morphable.NonMorphable=q.invent({create:function(t){t=Array.isArray(t)?t[0]:t,this.value=t},extend:{valueOf:function(){return this.value},toArray:function(){return[this.value]}}}),q.Morphable.TransformBag=q.invent({create:function(t){Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,q.Morphable.TransformBag.defaults,t)},extend:{toArray:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}}),q.Morphable.TransformBag.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0},q.Morphable.ObjectBag=q.invent({create:function(t){if(this.values=[],Array.isArray(t))return void(this.values=t);var e=Object.entries(t||{}).sort(function(t,e){return t[0]-e[0]});this.values=e.reduce(function(t,e){return t.concat(e)},[])},extend:{valueOf:function(){for(var t={},e=this.values,n=0,i=e.length;n<i;n+=2)t[e[n]]=e[n+1];return t},toArray:function(){return this.values}}}),q.MorphableTypes=[q.Number,q.Color,q.Box,q.Matrix,q.Array,q.PointArray,q.PathArray,q.Morphable.NonMorphable,q.Morphable.TransformBag,q.Morphable.ObjectBag],q.extend(q.MorphableTypes,{to:function(t,e){return(new q.Morphable).type(this.constructor).from(this.valueOf()).to(t,e)},fromArray:function(t){return this.constructor(t),this}}),q.easing={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)}},q.Runner=q.invent({parent:q.Element,create:function(t){this.id=q.Runner.id++,t=null==t?q.defaults.timeline.duration:t,t="function"==typeof t?new q.Controller(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof q.Controller,this._stepper=this._isDeclarative?t:new q.Ease,this._history={},this.enabled=!0,this._time=0,this._last=0,this.tags={},this.transforms=new q.Matrix,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1},construct:{animate:function(t,e,n){var i=q.Runner.sanitise(t,e,n),r=this.timeline();return new q.Runner(i.duration).loop(i).element(this).timeline(r).schedule(e,n)},delay:function(t,e){return this.animate(0,t,e)}},extend:{element:function(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)},timeline:function(t){return void 0===t?this._timeline:(this._timeline=t,this)},animate:function(t,e,n){var i=q.Runner.sanitise(t,e,n),r=new q.Runner(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(e,n)},schedule:function(t,e,n){if(t instanceof q.Timeline||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this},unschedule:function(){var t=this.timeline();return t&&t.unschedule(this),this},loop:function(t,e,n){return"object"===c(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,this},delay:function(t){return this.animate(0,t)},queue:function(t,e,n){return this._queue.push({initialiser:t||q.void,runner:e||q.void,isTransform:n,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this},during:function(t){return this.queue(null,t)},after:function(t){return this.on("finish",t)},time:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this},duration:function(){return this._times*(this._wait+this._duration)-this._wait},loops:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),i=this._time-n*e,r=i/this._duration;return Math.min(n+r,this._times)}var s=Math.floor(t),o=t%1,a=e*s+this._duration*o;return this.time(a)},position:function(t){var e,n=this._time,i=this._duration,r=this._wait,s=this._times,o=this._swing,a=this._reverse;if(null==t){var h=function(t){var e=o*Math.floor(t%(2*(r+i))/(r+i)),n=e&&!a||!e&&a,s=Math.pow(-1,n)*(t%(r+i))/i+n;return Math.max(Math.min(s,1),0)},u=s*(r+i)-r;return e=n<=0?Math.round(h(1e-5)):n<u?h(n):Math.round(h(u-1e-5)),e}var l=Math.floor(this.loops()),c=o&&l%2==0;return e=l+(c&&!a||a&&c?t:1-t),this.loops(e)},progress:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())},step:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&this._time>=0;this._lastPosition=e;var i=this.duration(),r=(this._lastTime<0&&this._time,this._lastTime<this._time&&this.time>i);this._lastTime=this._time;var s=this._isDeclarative;if(this.done=!s&&!r&&this._time>=i,n||s){this._initialise(n),this.transforms=new q.Matrix;var o=this._run(s?t:e)}return this.done=this.done||o&&s,this},finish:function(){return this.step(1/0)},reverse:function(t){return this._reverse=null==t?!this._reverse:t,this},ease:function(t){return this._stepper=new q.Ease(t),this},active:function(t){return null==t?this.enabled:(this.enabled=t,this)},tag:function(t){if(null==t)return Object.keys(this.tags);t=Array.isArray(t)?t:[t];for(var e=t.length;e--;)this.tags[t[e]]=!0;return this},untag:function(t){t=Array.isArray(t)?t:[t];for(var e=t.length;e--;)delete this.tags[t[e]];return this},getEventTarget:function(){return this._dispatcher},_rememberMorpher:function(t,e){this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]}},_tryRetarget:function(t,e){if(this._history[t]){if(!this._history[t].caller.initialised){var n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.isTransform?this._history[t].caller.isTransform(e):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i._continue(),!0}return!1},_initialise:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var i=this._queue[e],r=this._isDeclarative||!i.initialised&&t;t=!i.finished,r&&t&&(i.initialiser.call(this),i.initialised=!0)}},_run:function(t){for(var e=!0,n=0,i=this._queue.length;n<i;++n){var r=this._queue[n],s=r.runner.call(this,t);r.finished=r.finished||!0===s,e=e&&r.finished}return e},addTransform:function(t,e){return this.transforms.lmultiplyO(t),this},clearTransform:function(){return this.transforms=new q.Matrix,this}}}),q.Runner.id=0,q.Runner.sanitise=function(t,e,n){var i=1,r=!1,s=0;return t=t||q.defaults.timeline.duration,e=e||q.defaults.timeline.delay,n=n||"last","object"!==c(t)||t instanceof q.Stepper||(e=t.delay||e, -n=t.when||n,r=t.swing||r,i=t.times||i,s=t.wait||s,t=t.duration||q.defaults.timeline.duration),{duration:t,delay:e,swing:r,times:i,wait:s,when:n}},q.FakeRunner=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new q.Matrix,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];h(this,t),this.transforms=e,this.id=n,this.done=i}return t}(),q.extend([q.Runner,q.FakeRunner],{mergeWith:function(t){return new q.FakeRunner(t.transforms.lmultiply(this.transforms),t.id)}});var G=function(t,e){return t.lmultiplyO(e)},V=function(t){return t.transforms},H=function(){function t(){h(this,t),this.runners=[],this.ids=[]}return a(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var e=t.id+1,n=this.ids.reduce(function(t,n){return n>t&&n<e?n:t},0),i=this.ids.indexOf(n)+1;return this.ids.splice(i,0,e),this.runners.splice(i,0,t),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var t=this,e=null;return this.runners.forEach(function(n,i){e&&n.done&&e.done&&(t.remove(n.id),t.edit(e.id,n.mergeWith(e))),e=n}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new q.FakeRunner),this}}]),t}();q.extend(q.Element,{_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(t){return this._transformationRunners.runners.filter(function(e){return e.id<=t.id}).map(V).reduce(G,new q.Matrix)},addRunner:function(t){this._transformationRunners.add(t),q.Animator.transform_frame(D.bind(this),this._frameId)},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new H).add(new q.FakeRunner(new q.Matrix(this))),this._frameId=q.Element.frameId++)}}),q.Element.frameId=0,q.extend(q.Runner,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(t,e,n){if("object"===c(e))for(var i in n)this.styleAttr(t,i,n[i]);var r=new q.Morphable(this._stepper).to(n);return this.queue(function(){r=r.from(this.element()[t](e))},function(n){return this.element()[t](e,r.at(n)),r.done()}),this},zoom:function(t,e){var n=new q.Morphable(this._stepper).to(new q.Number(t));return this.queue(function(){n=n.from(this.zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()}),this},transform:function(t,e,i){function r(){l=l||this.element(),h=h||j(t,l),d=new q.Matrix(e?void 0:l),l.addRunner(this),e||l._clearTransformRunnersBefore(this)}function s(r){e||this.clearTransform();var s=new q.Point(h).transform(l._currentTransform(this)),o=s.x,m=s.y,v=new q.Matrix(u({},t,{origin:[o,m]})),y=this._isDeclarative&&c?c:d;if(i){v=v.decompose(o,m),y=y.decompose(o,m);var x=v.rotate,g=y.rotate,w=[x-360,x,x+360],b=w.map(function(t){return Math.abs(t-g)}),_=Math.min.apply(Math,n(b)),A=b.indexOf(_);v.rotate=w[A]}e&&(a||(v.rotate=t.rotate||0),this._isDeclarative&&f&&(y.rotate=f)),p.from(y),p.to(v);var M=p.at(r);return f=M.rotate,c=new q.Matrix(M),this.addTransform(c),p.done()}function o(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(h=j(t,l)),t=u({},e,{origin:h})}if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;var a=k(t);i=null!=t.affine?t.affine:null!=i?i:!a;var h,l,c,f,d,p=(new q.Morphable).type(i?q.Morphable.TransformBag:q.Matrix).stepper(this._stepper);return this.queue(r,s,o),this._isDeclarative&&this._rememberMorpher("transform",p),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(t){return this._queueNumberDelta("dx",t)},dy:function(t){return this._queueNumberDelta("dy",t)},_queueNumberDelta:function(t,e){if(e=new q.Number(e),this._tryRetargetDelta(t,e))return this;var n=new q.Morphable(this._stepper).to(e);return this.queue(function(){var i=this.element()[t]();n.from(i),n.to(i+e)},function(e){return this.element()[t](n.at(e)),n.done()}),this._rememberMorpher(t,n),this},_queueObject:function(t,e){if(this._tryRetarget(t,e))return this;var n=new q.Morphable(this._stepper).to(e);return this.queue(function(){n.from(this.element()[t]())},function(e){return this.element()[t](n.at(e)),n.done()}),this._rememberMorpher(t,n),this},_queueNumber:function(t,e){return this._queueObject(t,new q.Number(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,i){return 4===arguments.length?this.plot([t,e,n,i]):this._queueObject("plot",new this._element.MorphArray(t))},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,i){return this._queueObject("viewbox",new q.Box(t,e,n,i))},update:function(t){return"object"!==c(t)?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),q.easing={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)}};var U=t.performance||Date,$=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}};return q.Timeline=q.invent({inherit:q.EventTarget,create:function(){this._timeSource=function(){return U.now()},this._dispatcher=e.createElement("div"),this._startTime=0,this._speed=1,this._reverse=!1,this._persist=0,this._nextFrame=null,this._paused=!1,this._runners=[],this._order=[],this._time=0,this._lastSourceTime=0,this._lastStepTime=0},extend:{getEventTarget:function(){return this._dispatcher},schedule:function(t,e,n){if(null==t)return this._runners.map($).sort(function(t,e){return t.start-e.start||t.duration-e.duration});this.active()||(this._step(),null==n&&(n="now"));var i=0;if(e=e||0,null==n||"last"===n||"after"===n)i=this._startTime;else if("absolute"===n||"start"===n)i=e,e=0;else if("now"===n)i=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var r=this._runners[t.id];r&&(i=r.start+e,e=0)}return t.unschedule(),t.timeline(this),t.time(-e),this._startTime=i+t.duration()+e,this._runners[t.id]={persist:this.persist(),runner:t,start:i},this._order.push(t.id),this._continue(),this},unschedule:function(t){var e=this._order.indexOf(t.id);return e<0?this:(delete this._runners[t.id],this._order.splice(e,1),t.timeline(null),this)},play:function(){return this._paused=!1,this._continue()},pause:function(){return this._nextFrame=null,this._paused=!0,this},stop:function(){return this.seek(-this._time),this.pause()},finish:function(){return this.seek(1/0),this.pause()},speed:function(t){return null==t?this._speed:(this._speed=t,this)},reverse:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)},seek:function(t){return this._time+=t,this._continue()},time:function(t){return null==t?this._time:(this._time=t,this)},persist:function(t){return null==t?this._persist:(this._persist=t,this)},source:function(t){return null==t?this._timeSource:(this._timeSource=t,this)},_step:function(){if(!this._paused){var t=this._timeSource(),e=t-this._lastSourceTime,n=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=t,this._time+=n,this._lastStepTime=this._time;for(var i=!1,r=0,s=this._order.length;r<s;r++){var o=this._runners[this._order[r]],a=o.runner,h=n,u=this._time-o.start;if(u<0)i=!0;else if(u<h&&(h=u),a.active()){var l=a.step(h).done;if(l){if(!0!==o.persist){var c=a.duration()-a.time()+this._time;c+this._persist<this._time&&(delete this._runners[this._order[r]],this._order.splice(r--,1)&&--s,a.timeline(null))}}else i=!0}}return this._nextFrame=i?q.Animator.frame(this._step.bind(this)):null,this}},_continue:function(){return this._paused?this:(this._nextFrame||(this._nextFrame=q.Animator.frame(this._step.bind(this))),this)},active:function(){return!!this._nextFrame}},parent:q.Element,construct:{timeline:function(){return this._timeline=this._timeline||new q.Timeline,this._timeline}}}),q.Stepper=q.invent({create:function(){}}),q.Ease=q.invent({inherit:q.Stepper,create:function(t){q.Stepper.call(this,t),this.ease=q.easing[t||q.defaults.timeline.ease]||t},extend:{step:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)},done:function(t,e){return!1}}}),q.easing={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,i){return function(t){}}},q.Controller=q.invent({inherit:q.Stepper,create:function(t){q.Stepper.call(this,t),this.stepper=t},extend:{step:function(t,e,n,i){return this.stepper(t,e,n,i)},done:function(t){return t.done}}}),q.Spring=q.invent({inherit:q.Controller,create:function(t,e){this.duration(t||500).overshoot(e||0)},extend:{step:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;n>100&&(n=16),n/=1e3;var r=i.velocity||0,s=-this.d*r-this.k*(t-e),o=t+r*n+s*n*n/2;return i.velocity=r+s*n,i.done=Math.abs(e-o)+Math.abs(r)<.002,i.done?e:o},duration:R("_duration",I),overshoot:R("_overshoot",I)}}),q.PID=q.invent({inherit:q.Controller,create:function(t,e,n,i){q.Controller.call(this),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,i=null==i?1e3:i,this.p(t).i(e).d(n).windup(i)},extend:{step:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;var r=e-t,s=(i.integral||0)+r*n,o=(r-(i.error||0))/n,a=this.windup;return!1!==a&&(s=Math.max(-a,Math.min(s,a))),i.error=r,i.integral=s,i.done=Math.abs(r)<.001,i.done?e:t+(this.P*r+this.I*s+this.D*o)},windup:R("windup"),p:R("P"),i:R("I"),d:R("D")}}),q});
\ No newline at end of file diff --git a/dist/svg.new.js b/dist/svg.new.js new file mode 100644 index 0000000..1151feb --- /dev/null +++ b/dist/svg.new.js @@ -0,0 +1,6240 @@ +var SVG = (function () { + 'use strict'; + + class Base$1 { + constructor (node, {extensions = []}) { + this.tags = []; + + for (let extension of extensions) { + extension.setup.call(this, node); + this.tags.push(extension.name); + } + } + + is (ability) { + return this.tags.includes(ability) + } + } + + // Default namespaces + let ns$1 = 'http://www.w3.org/2000/svg'; + let xmlns = 'http://www.w3.org/2000/xmlns/'; + let xlink = 'http://www.w3.org/1999/xlink'; + let svgjs = 'http://svgjs.com/svgjs'; + + // Parse unit value + let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; + + // Parse hex value + let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + + // Parse rgb value + let rgb = /rgb\((\d+),(\d+),(\d+)\)/; + + // splits a transformation chain + let transforms = /\)\s*,?\s*/; + + // Whitespace + let whitespace = /\s/g; + + // Test hex value + let isHex = /^#[a-f0-9]{3,6}$/i; + + // Test rgb value + let isRgb = /^rgb\(/; + + // Test for blank string + let isBlank = /^(\s+)?$/; + + // Test for numeric string + let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + + // Test for image url + let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; + + // split at whitespace and comma + let delimiter = /[\s,]+/; + + // The following regex are used to parse the d attribute of a path + + // Matches all hyphens which are not after an exponent + let hyphen = /([^e])-/gi; + + // Replaces and tests for all path letters + let pathLetters = /[MLHVCSQTAZ]/gi; + + // yes we need this one, too + let isPathLetter = /[MLHVCSQTAZ]/i; + + // matches 0.154.23.45 + let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; + + // matches . + let dots = /\./g; + + function isNulledBox (box) { + return !box.w && !box.h && !box.x && !box.y + } + + function domContains (node) { + return (document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + return node === document + }).call(document.documentElement, node) + } + + function pathRegReplace (a, b, c, d) { + return c + d.replace(dots, ' .') + } + + // Convert dash-separated-string to camelCase + function camelCase (s) { + return s.toLowerCase().replace(/-(.)/g, function (m, g) { + return g.toUpperCase() + }) + } + + // Capitalize first letter of a string + function capitalize (s) { + return s.charAt(0).toUpperCase() + s.slice(1) + } + + // Ensure to six-based hex + function fullHex (hex$$1) { + return hex$$1.length === 4 + ? [ '#', + hex$$1.substring(1, 2), hex$$1.substring(1, 2), + hex$$1.substring(2, 3), hex$$1.substring(2, 3), + hex$$1.substring(3, 4), hex$$1.substring(3, 4) + ].join('') + : hex$$1 + } + + // Component to hex value + function compToHex (comp) { + var hex$$1 = comp.toString(16); + return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1 + } + + // Calculate proportional width and height values when necessary + function proportionalSize$1 (element, width, height) { + if (width == null || height == null) { + var box = element.bbox(); + + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + + return { + width: width, + height: height + } + } + + // Map matrix array to object + function arrayToMatrix (a) { + return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] } + } + + // PathArray Helpers + function arrayToString (a) { + for (var i = 0, il = a.length, s = ''; i < il; i++) { + s += a[i][0]; + + if (a[i][1] != null) { + s += a[i][1]; + + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + + return s + ' ' + } + + // Add more bounding box properties + function fullBox (b) { + if (b.x == null) { + b.x = 0; + b.y = 0; + b.width = 0; + b.height = 0; + } + + b.w = b.width; + b.h = b.height; + b.x2 = b.x + b.width; + b.y2 = b.y + b.height; + b.cx = b.x + b.width / 2; + b.cy = b.y + b.height / 2; + + return b + } + + // Create matrix array for looping + let abcdef = 'abcdef'.split(''); + + function closeEnough (a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6) + } + + function isMatrixLike (o) { + return ( + o.a != null || + o.b != null || + o.c != null || + o.d != null || + o.e != null || + o.f != null + ) + } + + function getOrigin (o, element) { + // Allow origin or around as the names + let origin = o.origin; // o.around == null ? o.origin : o.around + let ox, oy; + + // Allow the user to pass a string to rotate around a given point + if (typeof origin === 'string' || origin == null) { + // Get the bounding box of the element with no transformations applied + const string = (origin || 'center').toLowerCase().trim(); + const { height, width, x, y } = element.bbox(); + + // Calculate the transformed x and y coordinates + let bx = string.includes('left') ? x + : string.includes('right') ? x + width + : x + width / 2; + let by = string.includes('top') ? y + : string.includes('bottom') ? y + height + : y + height / 2; + + // Set the bounds eg : "bottom-left", "Top right", "middle" etc... + ox = o.ox != null ? o.ox : bx; + oy = o.oy != null ? o.oy : by; + } else { + ox = origin[0]; + oy = origin[1]; + } + + // Return the origin as it is if it wasn't a string + return [ ox, oy ] + } + + function nodeOrNew$1 (name, node) { + return node || makeNode$1(name) + } + + // Method for element creation + function makeNode$1 (name) { + // create element + return document.createElementNS(ns$1, name) + } + + // Method for extending objects + function extend$1 (modules, methods) { + var key, i; + + if (Array.isArray(methods)) { + methods.forEach((method) => { + extend$1(modules, method); + }); + return + } + + modules = Array.isArray(modules) ? modules : [modules]; + + for (i = modules.length - 1; i >= 0; i--) { + if (methods.name) { + modules[i].extensions = (modules[i].extensions || []).concat(methods); + } + for (key in methods) { + if (modules[i].prototype[key] || key == 'name' || key == 'setup') continue + modules[i].prototype[key] = methods[key]; + } + } + } + + // FIXME: enhanced constructors here + function addFactory (modules, methods) { + extend$1(modules, methods); + } + + // Invent new element + function invent (config) { + // Create element initializer + var initializer = typeof config.create === 'function' ? config.create + : function (node) { + config.inherit.call(this, node || makeNode$1(config.create)); + }; + + // Inherit prototype + if (config.inherit) { + initializer.prototype = new config.inherit(); + initializer.prototype.constructor = initializer; + } + + // Extend with methods + if (config.extend) { + extend$1(initializer, config.extend); + } + + // Attach construct method to parent + if (config.construct) { extend$1(config.parent || Container, config.construct); } + + return initializer + } + + var tools = /*#__PURE__*/Object.freeze({ + nodeOrNew: nodeOrNew$1, + makeNode: makeNode$1, + extend: extend$1, + addFactory: addFactory, + invent: invent + }); + + function Bare (element, inherit = {}) { + let custom = class Custom extends inherit { + constructor (node) { + super(nodeOrNew$1(element, node), Custom); + } + + words (text) { + // remove contents + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + + // create text node + this.node.appendChild(document.createTextNode(text)); + + return this + } + }; + + extend(custom, inherit); + } + + // export let constructors = { + // // Create an element that is not described by SVG.js + // element: function (element, inherit) { + // let custom = createCustom(element, inherit) + // return this.put(new custom()) + // } + // } + + // extend(Parent, { + // // Create an element that is not described by SVG.js + // element: function (element, inherit) { + // let custom = createCustom(element, inherit) + // return this.put(new custom()) + // } + // }) + + // Module for unit convertions + class SVGNumber { + // Initialize + constructor (...args) { + this.init(...args); + } + + init (value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; + + // initialize defaults + this.value = 0; + this.unit = unit || ''; + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); + + // normalize + if (unit[5] === '%') { this.value /= 100; } else if (unit[5] === 's') { + this.value *= 1000; + } + + // store unit + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + } + + toString () { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 + : this.unit === 's' ? this.value / 1e3 + : this.value + ) + this.unit + } + + toJSON () { + return this.toString() + } + + + toArray () { + return [this.value, this.unit] + } + + valueOf () { + return this.value + } + + // Add number + plus (number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit) + } + + // Subtract number + minus (number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit) + } + + // Multiply number + times (number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit) + } + + // Divide number + divide (number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit) + } + } + + // FIXME: import this to runner + + // Radius x value + function rx (rx) { + return this.attr('rx', rx) + } + + // Radius y value + function ry (ry) { + return this.attr('ry', ry) + } + + // Move over x-axis + function x (x) { + return x == null + ? this.cx() - this.rx() + : this.cx(x + this.rx()) + } + + // Move over y-axis + function y (y) { + return y == null + ? this.cy() - this.ry() + : this.cy(y + this.ry()) + } + + // Move by center over x-axis + function cx (x) { + return x == null + ? this.attr('cx') + : this.attr('cx', x) + } + + // Move by center over y-axis + function cy (y) { + return y == null + ? this.attr('cy') + : this.attr('cy', y) + } + + // Set width of element + function width (width) { + return width == null + ? this.rx() * 2 + : this.rx(new SVGNumber(width).divide(2)) + } + + // Set height of element + function height (height) { + return height == null + ? this.ry() * 2 + : this.ry(new SVGNumber(height).divide(2)) + } + + // Custom size function + function size (width, height) { + var p = proportionalSize$1(this, width, height); + + return this + .rx(new SVGNumber(p.width).divide(2)) + .ry(new SVGNumber(p.height).divide(2)) + } + + var circled = /*#__PURE__*/Object.freeze({ + rx: rx, + ry: ry, + x: x, + y: y, + cx: cx, + cy: cy, + width: width, + height: height, + size: size + }); + + class Circle extends Base$1 { + constructor (node) { + super(nodeOrNew$1('circle', node), Circle); + } + + radius (r) { + return this.attr('r', r) + } + + // Radius x value + rx (rx$$1) { + return this.attr('r', rx$$1) + } + + // Alias radius x value + ry (ry$$1) { + return this.rx(ry$$1) + } + } + + extend$1(Circle, {x, y, cx, cy, width, height, size}); + + Circle.constructors = { + Element: { + // Create circle element + circle (size$$1) { + return this.put(new Circle()) + .radius(new SVGNumber(size$$1).divide(2)) + .move(0, 0) + } + } + }; + + //import find from './selector.js' + //import {remove} from './Element.js' + + class ClipPath extends Base$1 { + constructor (node) { + super(nodeOrNew$1('clipPath', node), ClipPath); + } + + // // Unclip all clipped elements and remove itself + // remove () { + // // unclip all targets + // this.targets().forEach(function (el) { + // el.unclip() + // }) + // + // // remove clipPath from parent + // return remove.call(this) + // } + // + // targets () { + // return find('svg [clip-path*="' + this.id() + '"]') + // } + } + + + ClipPath.constructors = { + Container: { + // Create clipping element + clip: function() { + return this.defs().put(new ClipPath) + } + }, + Element: { + // Distribute clipPath to svg element + clipWith (element) { + // use given clip or create a new one + let clipper = element instanceof ClipPath + ? element + : this.parent().clip().add(element); + + // apply mask + return this.attr('clip-path', 'url("#' + clipper.id() + '")') + }, + + // Unclip element + unclip () { + return this.attr('clip-path', null) + }, + + clipper () { + return this.reference('clip-path') + } + } + }; + + class Defs extends Base$1 { + constructor (node) { + super(nodeOrNew$1('defs', node), Defs); + } + + flatten () { return this } + ungroup () { return this } + } + + //import {adopt} from './adopter.js' + + class Doc$1 extends Base$1 { + constructor(node) { + super(nodeOrNew$1('svg', node), Doc$1); + this.namespace(); + } + + isRoot() { + return !this.node.parentNode + || !(this.node.parentNode instanceof window.SVGElement) + || this.node.parentNode.nodeName === '#document' + } + + // Check if this is a root svg + // If not, call docs from this element + doc() { + if (this.isRoot()) return this + return Element.doc.call(this) + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.doc().namespace() + return this + .attr({ xmlns: ns$1, version: '1.1' }) + .attr('xmlns:xlink', xlink, xmlns) + .attr('xmlns:svgjs', svgjs, xmlns) + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.doc().defs() + + let node = this.node.getElementsByTagName('defs')[0]; + return node ? (node.instance || new Defs(node)) : this.put(new Defs()) + // + // return adopt(this.node.getElementsByTagName('defs')[0]) || + // this.put(new Defs()) + } + + // custom parent method + parent(type) { + if (this.isRoot()) { + return this.node.parentNode.nodeName === '#document' + ? null + : this.node.parentNode + } + + return Element.parent.call(this, type) + } + + // Removes the doc from the DOM + remove() { + if (!this.isRoot()) { + return Element.remove.call(this) + } + + if (this.parent()) { + this.parent().removeChild(this.node); + } + + return this + } + + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + return this + } + } + + Doc$1.constructors = { + Container: { + // Create nested svg document + nested() { + return this.put(new Doc$1()) + } + } + }; + + class Ellipse extends Base$1 { + constructor (node) { + super(nodeOrNew('ellipse', node), Ellipse); + } + } + + extend$1(Ellipse, circled); + + // addFactory(Container, { + // // Create an ellipse + // ellipse: function (width, height) { + // return this.put(new Ellipse()).size(width, height).move(0, 0) + // } + // }) + + class Stop extends Base$1 { + constructor (node) { + super(nodeOrNew$1('stop', node), Stop); + } + + // add color stops + update (o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + + return this + } + } + + // FIXME: add to runner + + function from (x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) }) + : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) }) + } + + function to (x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) }) + : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) }) + } + + var gradiented = /*#__PURE__*/Object.freeze({ + from: from, + to: to + }); + + //import attr from './attr.js' + + class Gradient extends Base$1 { + constructor (type) { + super( + nodeOrNew$1(type + 'Gradient', typeof type === 'string' ? null : type), + Gradient + ); + } + + // Add a color stop + stop (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity) + } + + // Update gradient + update (block) { + // remove all stops + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + + return this + } + + // Return the fill id + url () { + return 'url(#' + this.id() + ')' + } + + // Alias string convertion to fill + toString () { + return this.url() + } + + // // custom attr to handle transform + // attr (a, b, c) { + // if (a === 'transform') a = 'gradientTransform' + // return attr.call(this, a, b, c) + // } + } + + extend$1(Gradient, gradiented); + + Gradient.constructors = { + Container: { + // Create gradient element in defs + gradient (type, block) { + return this.defs().gradient(type, block) + } + }, + // define gradient + Defs: { + gradient (type, block) { + return this.put(new Gradient(type)).update(block) + } + } + }; + + class G extends Base$1 { + constructor (node) { + super(nodeorNew('g', node), G); + } + } + + G.constructors = { + Element: { + // Create a group element + group: function () { + return this.put(new G()) + } + } + }; + + //import {makeInstance} from './adopter.js' + + class HtmlNode extends Base$1 { + constructor (element) { + super(element, HtmlNode); + this.node = element; + } + + // add (element, i) { + // element = makeInstance(element) + // + // if (element.node !== this.node.children[i]) { + // this.node.insertBefore(element.node, this.node.children[i] || null) + // } + // + // return this + // } + + put (element, i) { + this.add(element, i); + return element + } + + getEventTarget () { + return this.node + } + } + + class A extends Base$1{ + constructor (node) { + super(nodeOrNew$1('a', node), A); + } + + // Link url + to (url) { + return this.attr('href', url, xlink) + } + + // Link target attribute + target (target) { + return this.attr('target', target) + } + } + + A.constructors = { + Container: { + // Create a hyperlink element + link: function (url) { + return this.put(new A()).to(url) + } + }, + Element: { + // Create a hyperlink element + linkTo: function (url) { + var link = new A(); + + if (typeof url === 'function') { url.call(link, link); } else { + link.to(url); + } + + return this.parent().put(link).put(this) + } + } + }; + + //import attr from './attr.js' + + class Pattern extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('pattern', node)); + } + + // Return the fill id + url () { + return 'url(#' + this.id() + ')' + } + + // Update pattern by rebuilding + update (block) { + // remove content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + + return this + } + + // Alias string convertion to fill + toString () { + return this.url() + } + + // // custom attr to handle transform + // attr (a, b, c) { + // if (a === 'transform') a = 'patternTransform' + // return attr.call(this, a, b, c) + // } + } + + Pattern.constructors = { + Container: { + // Create pattern element in defs + pattern (width, height, block) { + return this.defs().pattern(width, height, block) + } + }, + Defs: { + pattern (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }) + } + } + }; + + // // Add events to elements + // ;[ 'click', + // 'dblclick', + // 'mousedown', + // 'mouseup', + // 'mouseover', + // 'mouseout', + // 'mousemove', + // 'mouseenter', + // 'mouseleave', + // 'touchstart', + // 'touchmove', + // 'touchleave', + // 'touchend', + // 'touchcancel' ].forEach(function (event) { + // // add event to Element + // Element.prototype[event] = function (f) { + // if (f === null) { + // off(this, event) + // } else { + // on(this, event, f) + // } + // return this + // } + // }) + + let listenerId = 0; + + function getEventTarget (node) { + return node instanceof Base && node.is('EventTarget') + ? node.getEventTarget() + : node + } + + // Add event binder in the SVG namespace + function on (node, events, listener, binding, options) { + var l = listener.bind(binding || node); + var n = getEventTarget(node); + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter); + + // ensure instance object for nodes which are not adopted + n.instance = n.instance || {events: {}}; + + // pull event handlers from the element + var bag = n.instance.events; + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + + events.forEach(function (event) { + var ev = event.split('.')[0]; + var ns = event.split('.')[1] || '*'; + + // ensure valid object + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l; + + // add listener + n.addEventListener(ev, l, options || false); + }); + } + + // Add event unbinder in the SVG namespace + function off (node, events, listener, options) { + var n = getEventTarget(node); + + // we cannot remove an event if its not an svg.js instance + if (!n.instance) return + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return + } + + // pull event handlers from the element + var bag = n.instance.events; + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter); + + events.forEach(function (event) { + var ev = event && event.split('.')[0]; + var ns = event && event.split('.')[1]; + var namespace, l; + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l); } + + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { off(n, [event, ns].join('.')); } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')); } + + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { off(n, event); } + + n.instance.events = {}; + } + }); + } + + function dispatch (node, event, data) { + var n = getEventTarget(node); + + // Dispatch event + if (event instanceof window.Event) { + n.dispatchEvent(event); + } else { + event = new window.CustomEvent(event, {detail: data, cancelable: true}); + n.dispatchEvent(event); + } + return event + } + + class Image extends Base$1 { + constructor (node) { + super(nodeOrNew$1('image', node), Image); + } + + // (re)load image + load (url, callback) { + if (!url) return this + + var img = new window.Image(); + + on(img, 'load', function (e) { + var p = this.parent(Pattern); + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + + if (typeof callback === 'function') { + callback.call(this, { + width: img.width, + height: img.height, + ratio: img.width / img.height, + url: url + }); + } + }, this); + + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + + return this.attr('href', (img.src = url), xlink) + } + } + + Image.constructors = { + Container: { + // create image element, load image and set its size + image (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback) + } + } + }; + + /* global arrayClone */ + + let BaseArray = (function() { + try { + return Array + } catch (e) { + return Array + } + })(); + + class SVGArray extends BaseArray { + constructor (...args) { + super(); + this.init(...args); + } + + init (array, fallback) { + //this.splice(0, this.length) + this.length = 0; + this.push(...this.parse(array || fallback)); + } + + toArray () { + return Array.prototype.slice(this) + } + + toString () { + this.join(' '); + } + + valueOf () { + return this.toArray() + } + + // Parse whitespace separated string + parse (array) { + array = array.valueOf(); + + // if already is an array, no need to parse it + if (Array.isArray(array)) return array + + return array.trim().split(delimiter).map(parseFloat) + } + + clone () { + return new this.constructor(this) + } + + toSet () { + return new Set(this) + } + } + + class PointArray$1 extends SVGArray { + constructor (array, fallback = [[0, 0]]) { + super(array, fallback); + } + + // Convert array to string + toString () { + // convert to a poly point string + for (var i = 0, il = this.value.length, array = []; i < il; i++) { + array.push(this.value[i].join(',')); + } + + return array.join(' ') + } + + toArray () { + return this.value.reduce(function (prev, curr) { + return [].concat.call(prev, curr) + }, []) + } + + // Convert array to line object + toLine () { + return { + x1: this.value[0][0], + y1: this.value[0][1], + x2: this.value[1][0], + y2: this.value[1][1] + } + } + + // Get morphed array at given position + at (pos) { + // make sure a destination is defined + if (!this.destination) return this + + // generate morphed point string + for (var i = 0, il = this.value.length, array = []; i < il; i++) { + array.push([ + this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos, + this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos + ]); + } + + return new PointArray$1(array) + } + + // Parse point string and flat array + parse (array) { + var points = []; + + array = array.valueOf(); + + // if it is an array + if (Array.isArray(array)) { + // and it is not flat, there is no need to parse it + if (Array.isArray(array[0])) { + return array + } + } else { // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop(); + + // wrap points in two-tuples and parse points as floats + for (var i = 0, len = array.length; i < len; i = i + 2) { + points.push([ array[i], array[i + 1] ]); + } + + return points + } + + // Move point string + move (x, y) { + var box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (var i = this.value.length - 1; i >= 0; i--) { + this.value[i] = [this.value[i][0] + x, this.value[i][1] + y]; + } + } + + return this + } + + // Resize poly string + size (width, height) { + var i; + var box = this.bbox(); + + // recalculate position of all points according to new size + for (i = this.value.length - 1; i >= 0; i--) { + if (box.width) this.value[i][0] = ((this.value[i][0] - box.x) * width) / box.width + box.x; + if (box.height) this.value[i][1] = ((this.value[i][1] - box.y) * height) / box.height + box.y; + } + + return this + } + + // Get bounding box of points + bbox () { + var maxX = -Infinity; + var maxY = -Infinity; + var minX = Infinity; + var minY = Infinity; + this.value.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return {x: minX, y: minY, width: maxX - minX, height: maxY - minY} + } + } + + class Line extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('line', node), Line); + } + + // Get array + array () { + return new PointArray$1([ + [ this.attr('x1'), this.attr('y1') ], + [ this.attr('x2'), this.attr('y2') ] + ]) + } + + // Overwrite native plot() method + plot (x1, y1, x2, y2) { + if (x1 == null) { + return this.array() + } else if (typeof y1 !== 'undefined') { + x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }; + } else { + x1 = new PointArray$1(x1).toLine(); + } + + return this.attr(x1) + } + + // Move by left top corner + move (x, y) { + return this.attr(this.array().move(x, y).toLine()) + } + + // Set element size to given width and height + size (width, height) { + var p = proportionalSize$1(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()) + } + + } + + Line.constructors = { + Container: { + // Create a line element + line (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply( + this.put(new Line()) + , args[0] != null ? args : [0, 0, 0, 0] + ) + } + } + }; + + // import Defs from './Defs.js' + // import Line from './Line.js' + // import Polyline from './Polyline.js' + // import Polygon from './Polygon.js' + // import Path from './Path.js' + + class Marker extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew('marker', node), Marker); + } + + // Set width of element + width (width) { + return this.attr('markerWidth', width) + } + + // Set height of element + height (height) { + return this.attr('markerHeight', height) + } + + // Set marker refX and refY + ref (x, y) { + return this.attr('refX', x).attr('refY', y) + } + + // Update marker + update (block) { + // remove all content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { block.call(this, this); } + + return this + } + + // Return the fill id + toString () { + return 'url(#' + this.id() + ')' + } + } + + Marker.constructors = { + Container: { + marker (width, height, block) { + // Create marker element in defs + return this.defs().marker(width, height, block) + } + }, + Defs: { + // Create marker + marker (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()) + .size(width, height) + .ref(width / 2, height / 2) + .viewbox(0, 0, width, height) + .attr('orient', 'auto') + .update(block) + } + }, + marker: { + // Create and attach markers + marker (marker, width, height, block) { + var attr = ['marker']; + + // Build attribute name + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); + + // Set marker attribute + marker = arguments[1] instanceof Marker + ? arguments[1] + : this.defs().marker(width, height, block); + + return this.attr(attr, marker) + } + } + }; + + // import find from './selector.js' + // import {remove} from './Element.js' + + class Mask extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('mask', node)); + } + + // // Unmask all masked elements and remove itself + // remove () { + // // unmask all targets + // this.targets().forEach(function (el) { + // el.unmask() + // }) + // + // // remove mask from parent + // return remove.call(this) + // } + // + // targets () { + // return find('svg [mask*="' + this.id() + '"]') + // } + + } + + + Mask.constructors = { + Container: { + mask () { + return this.defs().put(new Mask()) + } + }, + Element: { + // Distribute mask to svg element + maskWith (element) { + // use given mask or create a new one + var masker = element instanceof Mask + ? element + : this.parent().mask().add(element); + + // apply mask + return this.attr('mask', 'url("#' + masker.id() + '")') + }, + + // Unmask element + unmask () { + return this.attr('mask', null) + }, + + masker () { + return this.reference('mask') + } + } + }; + + function parser () { + + // Reuse cached element if possible + if (!parser.nodes) { + let svg = new Doc$1().size(2, 0).css({ + opacity: 0, + position: 'absolute', + left: '-100%', + top: '-100%', + overflow: 'hidden' + }); + + let path = svg.path().node; + + parser.nodes = {svg, path}; + } + + if (!parser.nodes.svg.node.parentNode) { + let b = document.body || document.documentElement; + parser.nodes.svg.addTo(b); + } + + return parser.nodes + } + + class Point { + // Initialize + constructor (x, y, base) { + let source; + base = base || {x: 0, y: 0}; + + // ensure source as object + source = Array.isArray(x) ? {x: x[0], y: x[1]} + : typeof x === 'object' ? {x: x.x, y: x.y} + : {x: x, y: y}; + + // merge source + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + } + + // Clone point + clone () { + return new Point(this) + } + + // Convert to native SVGPoint + native () { + // create new point + var point = parser().svg.createSVGPoint(); + + // update with current values + point.x = this.x; + point.y = this.y; + return point + } + + // transform point with matrix + transform (m) { + // Perform the matrix multiplication + var x = m.a * this.x + m.c * this.y + m.e; + var y = m.b * this.x + m.d * this.y + m.f; + + // Return the required point + return new Point(x, y) + } + } + + Point.constructors = { + Element: { + // Get point + point: function (x, y) { + return new Point(x, y).transform(this.screenCTM().inverse()) + } + } + }; + + let pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + + return ['M', p.x, p.y] + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]] + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]] + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]] + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]] + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]] + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]] + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]] + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z'] + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]] + } + }; + + let mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + + for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = (function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x; + else if (i === 'V') c[0] = c[0] + p.y; + else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (var j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + + return pathHandlers[i](c, p, p0) + } + })(mlhvqtcsaz[i].toUpperCase()); + } + + class PathArray extends SVGArray { + constructor (array, fallback = [['M', 0, 0]]) { + super(array, fallback); + } + + // Convert array to string + toString () { + return arrayToString(this) + } + + toArray () { + return this.reduce(function (prev, curr) { + return [].concat.call(prev, curr) + }, []) + } + + // Move path string + move (x, y) { + // get bounding box of current situation + var box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (var l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + + return this + } + + // Resize path string + size (width, height) { + // get bounding box of current situation + var box = this.bbox(); + var i, l; + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; + } else if (l === 'H') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + } else if (l === 'V') { + this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; + this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x; + this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y; + + if (l === 'C') { + this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x; + this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = (this[i][1] * width) / box.width; + this[i][2] = (this[i][2] * height) / box.height; + + // move position values + this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x; + this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y; + } + } + + return this + } + + // Test if the passed path array use the same path data commands as this path array + equalCommands (pathArray) { + var i, il, equalCommands; + + pathArray = new PathArray(pathArray); + + equalCommands = this.length === pathArray.value.length; + for (i = 0, il = this.length; equalCommands && i < il; i++) { + equalCommands = this[i][0] === pathArray.value[i][0]; + } + + return equalCommands + } + + // Make path array morphable + morph (pathArray) { + pathArray = new PathArray(pathArray); + + if (this.equalCommands(pathArray)) { + this.destination = pathArray; + } else { + this.destination = null; + } + + return this + } + + // Get morphed path array at given position + at (pos) { + // make sure a destination is defined + if (!this.destination) return this + + var sourceArray = this; + var destinationArray = this.destination.value; + var array = []; + var pathArray = new PathArray(); + var i, il, j, jl; + + // Animate has specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/paths.html#PathElement + for (i = 0, il = sourceArray.length; i < il; i++) { + array[i] = [sourceArray[i][0]]; + for (j = 1, jl = sourceArray[i].length; j < jl; j++) { + array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; + } + // For the two flags of the elliptical arc command, the SVG spec say: + // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true + // Elliptical arc command as an array followed by corresponding indexes: + // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] + // 0 1 2 3 4 5 6 7 + if (array[i][0] === 'A') { + array[i][4] = +(array[i][4] !== 0); + array[i][5] = +(array[i][5] !== 0); + } + } + + // Directly modify the value of a path array, this is done this way for performance + pathArray.value = array; + return pathArray + } + + // Absolutize and parse path to array + parse (array) { + // if it's already a patharray, no need to parse it + if (array instanceof PathArray) return array.valueOf() + + // prepare for parsing + var s; + var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }; + + if (typeof array === 'string') { + array = array + .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 + .replace(pathLetters, ' $& ') // put some room between letters and numbers + .replace(hyphen, '$1 -') // add space before hyphen + .trim() // trim + .split(delimiter); // split into array + } else { + array = array.reduce(function (prev, curr) { + return [].concat.call(prev, curr) + }, []); + } + + // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] + var result = []; + var p = new Point(); + var p0 = new Point(); + var index = 0; + var len = array.length; + + do { + // Test if we have a path letter + if (isPathLetter.test(array[index])) { + s = array[index]; + ++index; + // If last letter was a move command and we got no new, it defaults to [L]ine + } else if (s === 'M') { + s = 'L'; + } else if (s === 'm') { + s = 'l'; + } + + result.push(pathHandlers[s].call(null, + array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat), + p, p0 + ) + ); + } while (len > index) + + return result + } + + // Get bounding box of path + bbox () { + parser().path.setAttribute('d', this.toString()); + return parser.nodes.path.getBBox() + } + } + + class Path extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('path', node), Path); + } + + // Get array + array () { + return this._array || (this._array = new PathArray(this.attr('d'))) + } + + // Plot new path + plot (d) { + return (d == null) ? this.array() + : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d))) + } + + // Clear array cache + clear () { + delete this._array; + return this + } + + // Move by left top corner + move (x, y) { + return this.attr('d', this.array().move(x, y)) + } + + // Move by left top corner over x-axis + x (x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) + } + + // Move by left top corner over y-axis + y (y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) + } + + // Set element size to given width and height + size (width, height) { + var p = proportionalSize$1(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)) + } + + // Set width of element + width (width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height) + } + + // Set height of element + height (height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height) + } + } + + // Define morphable array + Path.prototype.MorphArray = PathArray; + + // Add parent method + Path.constructors = { + Container: { + // Create a wrapped path element + path (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()) + } + } + }; + + let MorphArray = PointArray$1; + + // Move by left top corner over x-axis + function x$1 (x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) + } + + // Move by left top corner over y-axis + function y$1 (y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) + } + + // Set width of element + function width$1 (width) { + let b = this.bbox(); + return width == null ? b.width : this.size(width, b.height) + } + + // Set height of element + function height$1 (height) { + let b = this.bbox(); + return height == null ? b.height : this.size(b.width, height) + } + + var pointed = /*#__PURE__*/Object.freeze({ + MorphArray: MorphArray, + x: x$1, + y: y$1, + width: width$1, + height: height$1 + }); + + // Add polygon-specific functions + + // Get array + function array () { + return this._array || (this._array = new PointArray(this.attr('points'))) + } + + // Plot new path + function plot (p) { + return (p == null) ? this.array() + : this.clear().attr('points', typeof p === 'string' ? p + : (this._array = new PointArray(p))) + } + + // Clear array cache + function clear () { + delete this._array; + return this + } + + // Move by left top corner + function move (x, y) { + return this.attr('points', this.array().move(x, y)) + } + + // Set element size to given width and height + function size$1 (width, height) { + let p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)) + } + + var poly = /*#__PURE__*/Object.freeze({ + array: array, + plot: plot, + clear: clear, + move: move, + size: size$1 + }); + + class Polygon extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('polygon', node), Polygon); + } + } + + Polygon.constructors = { + Parent: { + // Create a wrapped polygon element + polygon (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray$1()) + } + } + }; + + extend$1(Polygon, pointed); + extend$1(Polygon, poly); + + class Polyline extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('polyline', node), Polyline); + } + } + + Polyline.constructors = { + Parent: { + // Create a wrapped polygon element + polyline (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray$1()) + } + } + }; + + extend$1(Polyline, pointed); + extend$1(Polyline, poly); + + class Rect extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('rect', node), Rect); + } + } + + Rect.constructors = { + Container: { + // Create a rect element + rect (width, height) { + return this.put(new Rect()).size(width, height) + } + } + }; + + class Symbol extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('symbol', node), Symbol); + } + } + + Symbol.constructors = { + Container: { + symbol () { + return this.put(new Symbol()) + } + } + }; + + function noop () {} + + // Default animation values + let timeline = { + duration: 400, + ease: '>', + delay: 0 + }; + + // Default attribute values + let attrs = { + + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + + // size + width: 0, + height: 0, + + // radius + r: 0, + rx: 0, + ry: 0, + + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + + // text + 'font-size': 16, + 'font-family': 'Helvetica, Arial, sans-serif', + 'text-anchor': 'start' + }; + + // Create plain text node + function plain (text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } + + // create text node + this.node.appendChild(document.createTextNode(text)); + + return this + } + + // FIXME: Does this also work for textpath? + // Get length of text element + function length () { + return this.node.getComputedTextLength() + } + + var textable = /*#__PURE__*/Object.freeze({ + plain: plain, + length: length + }); + + class Text$1 extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('text', node), Text$1); + + this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values + this._build = false; // disable build mode for adding multiple lines + + // set default font + this.attr('font-family', attrs['font-family']); + } + + // Move over x-axis + x (x) { + // act as getter + if (x == null) { + return this.attr('x') + } + + return this.attr('x', x) + } + + // Move over y-axis + y (y) { + var oy = this.attr('y'); + var o = typeof oy === 'number' ? oy - this.bbox().y : 0; + + // act as getter + if (y == null) { + return typeof oy === 'number' ? oy - o : oy + } + + return this.attr('y', typeof y === 'number' ? y + o : y) + } + + // Move center over x-axis + cx (x) { + return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2) + } + + // Move center over y-axis + cy (y) { + return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2) + } + + // Set the text content + text (text) { + // act as getter + if (text === undefined) { + var children = this.node.childNodes; + var firstLine = 0; + text = ''; + + for (var i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath') { + if (i === 0) firstLine = 1; + continue + } + + // add newline if its not the first child and newLined is set to true + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } + + // add content of this node + text += children[i].textContent; + } + + return text + } + + // remove existing content + this.clear().build(true); + + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = text.split('\n'); + + // build new lines + for (var j = 0, jl = text.length; j < jl; j++) { + this.tspan(text[j]).newLine(); + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild() + } + + // Set / get leading + leading (value) { + // act as getter + if (value == null) { + return this.dom.leading + } + + // act as setter + this.dom.leading = new SVGNumber(value); + + return this.rebuild() + } + + // Rebuild appearance type + rebuild (rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } + + // define position of all lines + if (this._rebuild) { + var self = this; + var blankLineOffset = 0; + var dy = this.dom.leading * new SVGNumber(this.attr('font-size')); + + this.each(function () { + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', dy + blankLineOffset); + blankLineOffset = 0; + } + } + }); + + this.fire('rebuild'); + } + + return this + } + + // Enable / disable build mode + build (build) { + this._build = !!build; + return this + } + + // overwrite method from parent to set data properly + setData (o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this + } + } + + extend$1(Text$1, textable); + + Text$1.constructors = { + Container: { + // Create text element + text (text) { + return this.put(new Text$1()).text(text) + }, + + // Create plain text element + plain (text) { + return this.put(new Text$1()).plain(text) + } + } + }; + + class TextPath extends Text$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('textPath', node)); + } + + // return the array of the path track element + array () { + var track = this.track(); + + return track ? track.array() : null + } + + // Plot path if any + plot (d) { + var track = this.track(); + var pathArray = null; + + if (track) { + pathArray = track.plot(d); + } + + return (d == null) ? pathArray : this + } + + // Get the path element + track () { + return this.reference('href') + } + } + + TextPath.constructors = { + Container: { + textPath (text, path) { + return this.defs().path(path).text(text).addTo(this) + } + }, + Text: { + // Create path for text to run on + path: function (track) { + var path = new TextPath(); + + // if d is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.doc().defs().path(track); + } + + // link textPath to path and add content + path.attr('href', '#' + track, xlink); + + // add textPath element as child node and return textPath + return this.put(path) + }, + + // FIXME: make this plural? + // Get the textPath children + textPath: function () { + return this.select('textPath') + } + }, + Path: { + // creates a textPath from this path + text: function (text) { + if (text instanceof Text$1) { + var txt = text.text(); + return text.clear().path(this).text(txt) + } + return this.parent().put(new Text$1()).path(this).text(text) + } + // FIXME: Maybe add `targets` to get all textPaths associated with this path + } + }; + + TextPath.prototype.MorphArray = PathArray; + + class Use extends Base$1 { + constructor (node) { + super(nodeOrNew('use', node), Use); + } + + // Use element as a reference + element (element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink) + } + } + + Use.constructors = { + Container: { + // Create a use element + use: function (element, file) { + return this.put(new Use()).element(element, file) + } + } + }; + + + + var elements = /*#__PURE__*/Object.freeze({ + Bare: Bare, + Circle: Circle, + ClipPath: ClipPath, + Defs: Defs, + Doc: Doc$1, + Ellipse: Ellipse, + Gradient: Gradient, + G: G, + HtmlNode: HtmlNode, + A: A, + Image: Image, + Line: Line, + Marker: Marker, + Mask: Mask, + Path: Path, + Pattern: Pattern, + Polygon: Polygon, + Polyline: Polyline, + Rect: Rect, + Stop: Stop, + Symbol: Symbol, + Text: Text$1, + TextPath: TextPath, + Use: Use + }); + + function makeInstance (element) { + if (element instanceof Base$1) return element + + if (typeof element === 'object') { + return adopt$1(element) + } + + if (element == null) { + return new Doc() + } + + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopt$1(document.querySelector(element)) + } + + var node = makeNode('svg'); + node.innerHTML = element; + + element = adopt$1(node.firstElementChild); + + return element + } + + // Adopt existing svg elements + function adopt$1 (node) { + // check for presence of node + if (!node) return null + + // make sure a node isn't already adopted + if (node.instance instanceof Element) return node.instance + + if (!(node instanceof window.SVGElement)) { + return new HtmlNode(node) + } + + // initialize variables + var element; + + // adopt with element-specific settings + if (node.nodeName === 'svg') { + element = new Doc$1(node); + } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') { + element = new Gradient(node); + } else if (elements[capitalize(node.nodeName)]) { + element = new elements[capitalize(node.nodeName)](node); + } else { + element = new Bare(node); + } + + return element + } + + // Element id sequence + let did = 1000; + + // Get next named element id + function eid (name) { + return 'Svgjs' + capitalize(name) + (did++) + } + + // Deep new id assignment + function assignNewId (node) { + // do the same for SVG child nodes as well + for (var i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + + if (node.id) { + return adopt$1(node).id(eid(node.nodeName)) + } + + return adopt$1(node) + } + + var adopter = /*#__PURE__*/Object.freeze({ + makeInstance: makeInstance, + adopt: adopt$1, + eid: eid, + assignNewId: assignNewId + }); + + class Queue { + constructor () { + this._first = null; + this._last = null; + } + + push (value) { + // An item stores an id and the provided value + var item = value.next ? value : { value: value, next: null, prev: null }; + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } + + // Update the length and return the current item + return item + } + + shift () { + // Check if we have a value + var remove = this._first; + if (!remove) return null + + // If we do, remove it and relink things + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value + } + + // Shows us the first item in the list + first () { + return this._first && this._first.value + } + + // Shows us the last item in the list + last () { + return this._last && this._last.value + } + + // Removes the item that was returned from the push + remove (item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; + + // Invalidate item + item.prev = null; + item.next = null; + } + } + + const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + timer: window.performance || window.Date, + transforms: [], + + frame (fn) { + // Store the node + var node = Animator.frames.push({ run: fn }); + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = window.requestAnimationFrame(Animator._draw); + } + + // Return the node so we can remove it easily + return node + }, + + transform_frame (fn, id) { + Animator.transforms[id] = fn; + }, + + timeout (fn, delay) { + delay = delay || 0; + + // Work out when the event should fire + var time = Animator.timer.now() + delay; + + // Add the timeout to the end of the queue + var node = Animator.timeouts.push({ run: fn, time: time }); + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = window.requestAnimationFrame(Animator._draw); + } + + return node + }, + + cancelFrame (node) { + Animator.frames.remove(node); + }, + + clearTimeout (node) { + Animator.timeouts.remove(node); + }, + + _draw (now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + var nextTimeout = null; + var lastTimeout = Animator.timeouts.last(); + while ((nextTimeout = Animator.timeouts.shift())) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break + } + + // Run all of the animation frames + var nextFrame = null; + var lastFrame = Animator.frames.last(); + while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) { + nextFrame.run(); + } + + Animator.transforms.forEach(function (el) { el(); }); + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() + ? window.requestAnimationFrame(Animator._draw) + : null; + } + }; + + class Tspan extends Base$1 { + // Initialize node + constructor (node) { + super(nodeOrNew$1('tspan', node), Tspan); + } + + // Set text content + text (text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '') + + typeof text === 'function' ? text.call(this, this) : this.plain(text); + + return this + } + + // Shortcut dx + dx (dx) { + return this.attr('dx', dx) + } + + // Shortcut dy + dy (dy) { + return this.attr('dy', dy) + } + + // Create new line + newLine () { + // fetch text parent + var t = this.parent(Text); + + // mark new line + this.dom.newLined = true; + + // apply new position + return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()) + } + } + + extend$1(Tspan, textable); + + Tspan.constructors = { + Tspan: { + tspan (text) { + var tspan = new Tspan(); + + // clear if build mode is disabled + if (!this._build) { + this.clear(); + } + + // add new tspan + this.node.appendChild(tspan.node); + + return tspan.text(text) + } + } + }; + + // Map function + function map (array, block) { + var i; + var il = array.length; + var result = []; + + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + + return result + } + + // Degrees to radians + function radians (d) { + return d % 360 * Math.PI / 180 + } + + class Matrix { + constructor (...args) { + this.init(...args); + } + + // Initialize + init (source) { + var base = arrayToMatrix([1, 0, 0, 1, 0, 0]); + + // ensure source as object + source = source instanceof Base$1 && source.is('Element') ? source.matrixify() + : typeof source === 'string' ? arrayToMatrix(source.split(delimiter).map(parseFloat)) + : Array.isArray(source) ? arrayToMatrix(source) + : (typeof source === 'object' && isMatrixLike(source)) ? source + : (typeof source === 'object') ? new Matrix().transform(source) + : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments)) + : base; + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + } + + + // Clones this matrix + clone () { + return new Matrix(this) + } + + // Transform a matrix into another matrix by manipulating the space + transform (o) { + // Check if o is a matrix and then left multiply it directly + if (isMatrixLike(o)) { + var matrix = new Matrix(o); + return matrix.multiplyO(this) + } + + // Get the proposed transformations and the current transformations + var t = Matrix.formatTransforms(o); + var current = this; + let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current); + + // Construct the resulting matrix + var transformer = new Matrix() + .translateO(t.rx, t.ry) + .lmultiplyO(current) + .translateO(-ox, -oy) + .scaleO(t.scaleX, t.scaleY) + .skewO(t.skewX, t.skewY) + .shearO(t.shear) + .rotateO(t.theta) + .translateO(ox, oy); + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); + // TODO: Replace t.px with isFinite(t.px) + const dx = t.px ? t.px - origin.x : 0; + const dy = t.py ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty); + return transformer + } + + // Applies a matrix defined by its affine parameters + compose (o) { + if (o.origin) { + o.originX = o.origin[0]; + o.originY = o.origin[1]; + } + // Get the parameters + var ox = o.originX || 0; + var oy = o.originY || 0; + var sx = o.scaleX || 1; + var sy = o.scaleY || 1; + var lam = o.shear || 0; + var theta = o.rotate || 0; + var tx = o.translateX || 0; + var ty = o.translateY || 0; + + // Apply the standard matrix + var result = new Matrix() + .translateO(-ox, -oy) + .scaleO(sx, sy) + .shearO(lam) + .rotateO(theta) + .translateO(tx, ty) + .lmultiplyO(this) + .translateO(ox, oy); + return result + } + + // Decomposes this matrix into its affine parameters + decompose (cx = 0, cy = 0) { + // Get the parameters from the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; + + // Figure out if the winding direction is clockwise or counterclockwise + var determinant = a * d - b * c; + var ccw = determinant > 0 ? 1 : -1; + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + var sx = ccw * Math.sqrt(a * a + b * b); + var thetaRad = Math.atan2(ccw * b, ccw * a); + var theta = 180 / Math.PI * thetaRad; + var ct = Math.cos(thetaRad); + var st = Math.sin(thetaRad); + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + var lam = (a * c + b * d) / determinant; + var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a)); + + // Use the translations + let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } + + // Left multiplies by the given matrix + multiply (matrix) { + return this.clone().multiplyO(matrix) + } + + multiplyO (matrix) { + // Get the matrices + var l = this; + var r = matrix instanceof Matrix + ? matrix + : new Matrix(matrix); + + return Matrix.matrixMultiply(l, r, this) + } + + lmultiply (matrix) { + return this.clone().lmultiplyO(matrix) + } + + lmultiplyO (matrix) { + var r = this; + var l = matrix instanceof Matrix + ? matrix + : new Matrix(matrix); + + return Matrix.matrixMultiply(l, r, this) + } + + // Inverses matrix + inverseO () { + // Get the current parameters out of the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; + + // Invert the 2x2 matrix in the top left + var det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this) + + // Calculate the top 2x2 matrix + var na = d / det; + var nb = -b / det; + var nc = -c / det; + var nd = a / det; + + // Apply the inverted matrix to the top right + var ne = -(na * e + nc * f); + var nf = -(nb * e + nd * f); + + // Construct the inverted matrix + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + + return this + } + + inverse () { + return this.clone().inverseO() + } + + // Translate matrix + translate (x, y) { + return this.clone().translateO(x, y) + } + + translateO (x, y) { + this.e += x || 0; + this.f += y || 0; + return this + } + + // Scale matrix + scale (x, y, cx, cy) { + return this.clone().scaleO(...arguments) + } + + scaleO (x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + let {a, b, c, d, e, f} = this; + + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + + return this + } + + // Rotate matrix + rotate (r, cx, cy) { + return this.clone().rotateO(r, cx, cy) + } + + rotateO (r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + + let cos = Math.cos(r); + let sin = Math.sin(r); + + let {a, b, c, d, e, f} = this; + + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + + return this + } + + // Flip matrix on x or y, at a given offset + flip (axis, around) { + return this.clone().flipO(axis, around) + } + + flipO (axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) + : axis === 'y' ? this.scaleO(1, -1, 0, around) + : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point + } + + // Shear matrix + shear (a, cx, cy) { + return this.clone().shearO(a, cx, cy) + } + + shearO (lx, cx = 0, cy = 0) { + let {a, b, c, d, e, f} = this; + + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + + return this + } + + // Skew Matrix + skew (x, y, cx, cy) { + return this.clone().skewO(...arguments) + } + + skewO (x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + // Convert degrees to radians + x = radians(x); + y = radians(y); + + let lx = Math.tan(x); + let ly = Math.tan(y); + + let {a, b, c, d, e, f} = this; + + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + + return this + } + + // SkewX + skewX (x, cx, cy) { + return this.skew(x, 0, cx, cy) + } + + skewXO (x, cx, cy) { + return this.skewO(x, 0, cx, cy) + } + + // SkewY + skewY (y, cx, cy) { + return this.skew(0, y, cx, cy) + } + + skewYO (y, cx, cy) { + return this.skewO(0, y, cx, cy) + } + + // Transform around a center point + aroundO (cx, cy, matrix) { + var dx = cx || 0; + var dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy) + } + + around (cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix) + } + + // Convert to native SVGMatrix + native () { + // create new matrix + var matrix = parser().node.createSVGMatrix(); + + // update with current values + for (var i = abcdef.length - 1; i >= 0; i--) { + matrix[abcdef[i]] = this[abcdef[i]]; + } + + return matrix + } + + // Check if two matrices are equal + equals (other) { + var comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && + closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && + closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f) + } + + // Convert matrix to string + toString () { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')' + } + + toArray () { + return [this.a, this.b, this.c, this.d, this.e, this.f] + } + + valueOf () { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } + + + // TODO: Refactor this to a static function of matrix.js + static formatTransforms (o) { + // Get all of the parameters required to form the matrix + var flipBoth = o.flip === 'both' || o.flip === true; + var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + var skewX = o.skew && o.skew.length ? o.skew[0] + : isFinite(o.skew) ? o.skew + : isFinite(o.skewX) ? o.skewX + : 0; + var skewY = o.skew && o.skew.length ? o.skew[1] + : isFinite(o.skew) ? o.skew + : isFinite(o.skewY) ? o.skewY + : 0; + var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX + : isFinite(o.scale) ? o.scale * flipX + : isFinite(o.scaleX) ? o.scaleX * flipX + : flipX; + var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY + : isFinite(o.scale) ? o.scale * flipY + : isFinite(o.scaleY) ? o.scaleY * flipY + : flipY; + var shear = o.shear || 0; + var theta = o.rotate || o.theta || 0; + var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + var ox = origin.x; + var oy = origin.y; + var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); + var px = position.x; + var py = position.y; + var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + var tx = translate.x; + var ty = translate.y; + var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + var rx = relative.x; + var ry = relative.y; + + // Populate all of the values + return { + scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py + } + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply (l, r, o) { + // Work out the product directly + var a = l.a * r.a + l.c * r.b; + var b = l.b * r.a + l.d * r.b; + var c = l.a * r.c + l.c * r.d; + var d = l.b * r.c + l.d * r.d; + var e = l.e + l.a * r.e + l.c * r.f; + var f = l.f + l.b * r.e + l.d * r.f; + + // make sure to use local variables because l/r and o could be the same + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + + return o + } + } + + Matrix.constructors = { + Element: { + // Get current matrix + ctm () { + return new Matrix(this.node.getCTM()) + }, + + // Get current screen matrix + screenCTM () { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (this instanceof Doc && !this.isRoot()) { + var rect = this.rect(1, 1); + var m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m) + } + return new Matrix(this.node.getScreenCTM()) + } + } + }; + + //import {Parent, Doc, Symbol, Image, Pattern, Marker, Point} from './classes.js' + + class Box$1 { + constructor (...args) { + this.init(...args); + } + + init (source) { + var base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) + : Array.isArray(source) ? source + : typeof source === 'object' ? [source.left != null ? source.left + : source.x, source.top != null ? source.top : source.y, source.width, source.height] + : arguments.length === 4 ? [].slice.call(arguments) + : base; + + this.x = source[0]; + this.y = source[1]; + this.width = source[2]; + this.height = source[3]; + + // add center, right, bottom... + fullBox(this); + } + + // Merge rect box with another, return a new instance + merge (box) { + let x = Math.min(this.x, box.x); + let y = Math.min(this.y, box.y); + let width = Math.max(this.x + this.width, box.x + box.width) - x; + let height = Math.max(this.y + this.height, box.y + box.height) - y; + + return new Box$1(x, y, width, height) + } + + transform (m) { + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + + let pts = [ + new Point(this.x, this.y), + new Point(this.x2, this.y), + new Point(this.x, this.y2), + new Point(this.x2, this.y2) + ]; + + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + + return new Box$1( + xMin, yMin, + xMax - xMin, + yMax - yMin + ) + } + + addOffset () { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += window.pageXOffset; + this.y += window.pageYOffset; + return this + } + + toString () { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height + } + + toArray () { + return [this.x, this.y, this.width, this.height] + } + } + + function getBox(cb) { + let box; + + try { + box = cb(this.node); + + if (isNulledBox(box) && !domContains(this.node)) { + throw new Error('Element not in the dom') + } + } catch (e) { + try { + let clone = this.clone(parser().svg).show(); + box = cb(clone.node); + clone.remove(); + } catch (e) { + throw (e) + console.warn('Getting a bounding box of this element is not possible'); + } + } + return box + } + + Box$1.constructors = { + Element: { + // Get bounding box + bbox () { + return new Box$1(getBox.call(this, (node) => node.getBBox())) + }, + + rbox (el) { + let box = new Box$1(getBox.call(this, (node) => node.getBoundingClientRect())); + if (el) return box.transform(el.screenCTM().inverse()) + return box.addOffset() + } + }, + viewbox: function (x, y, width, height) { + // act as getter + if (x == null) return new Box$1(this.attr('viewBox')) + + // act as setter + return this.attr('viewBox', new Box$1(x, y, width, height)) + } + }; + + /* globals fullHex, compToHex */ + + class Color { + constructor (...args) { + this.init(...args); + } + + init (color, g, b) { + let match; + + // initialize defaults + this.r = 0; + this.g = 0; + this.b = 0; + + if (!color) return + + // parse color + if (typeof color === 'string') { + if (isRgb.test(color)) { + // get rgb values + match = rgb.exec(color.replace(whitespace, '')); + + // parse numeric values + this.r = parseInt(match[1]); + this.g = parseInt(match[2]); + this.b = parseInt(match[3]); + } else if (isHex.test(color)) { + // get hex values + match = hex.exec(fullHex(color)); + + // parse numeric values + this.r = parseInt(match[1], 16); + this.g = parseInt(match[2], 16); + this.b = parseInt(match[3], 16); + } + } else if (Array.isArray(color)) { + this.r = color[0]; + this.g = color[1]; + this.b = color[2]; + } else if (typeof color === 'object') { + this.r = color.r; + this.g = color.g; + this.b = color.b; + } else if (arguments.length === 3) { + this.r = color; + this.g = g; + this.b = b; + } + } + + // Default to hex conversion + toString () { + return this.toHex() + } + + toArray () { + return [this.r, this.g, this.b] + } + + // Build hex value + toHex () { + return '#' + + compToHex(Math.round(this.r)) + + compToHex(Math.round(this.g)) + + compToHex(Math.round(this.b)) + } + + // Build rgb value + toRgb () { + return 'rgb(' + [this.r, this.g, this.b].join() + ')' + } + + // Calculate true brightness + brightness () { + return (this.r / 255 * 0.30) + + (this.g / 255 * 0.59) + + (this.b / 255 * 0.11) + } + + // Testers + + // Test if given value is a color string + static test (color) { + color += ''; + return isHex.test(color) || isRgb.test(color) + } + + // Test if given value is a rgb object + static isRgb (color) { + return color && typeof color.r === 'number' && + typeof color.g === 'number' && + typeof color.b === 'number' + } + + // Test if given value is a color + static isColor (color) { + return this.isRgb(color) || this.test(color) + } + } + + /*** + Base Class + ========== + The base stepper class that will be + ***/ + + function makeSetterGetter (k, f) { + return function (v) { + if (v == null) return this[v] + this[k] = v; + if (f) f.call(this); + return this + } + } + + let easing = { + '-': function (pos) { return pos }, + '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 }, + '>': function (pos) { return Math.sin(pos * Math.PI / 2) }, + '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }, + bezier: function (t0, x0, t1, x1) { + return function (t) { + // TODO: FINISH + } + } + }; + + + class Stepper { + done () { return false } + } + + /*** + Easing Functions + ================ + ***/ + + class Ease extends Stepper { + constructor (fn) { + super(); + this.ease = easing[fn || timeline.ease] || fn; + } + + step (from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to + } + return from + (to - from) * this.ease(pos) + } + } + + + /*** + Controller Types + ================ + ***/ + + class Controller extends Stepper { + constructor (fn) { + super(); + this.stepper = fn; + } + + step (current, target, dt, c) { + return this.stepper(current, target, dt, c) + } + + done (c) { + return c.done + } + } + + function recalculate () { + // Apply the default parameters + var duration = (this._duration || 500) / 1000; + var overshoot = this._overshoot || 0; + + // Calculate the PID natural response + var eps = 1e-10; + var pi = Math.PI; + var os = Math.log(overshoot / 100 + eps); + var zeta = -os / Math.sqrt(pi * pi + os * os); + var wn = 3.9 / (zeta * duration); + + // Calculate the Spring values + this.d = 2 * zeta * wn; + this.k = wn * wn; + } + + class Spring extends Controller { + constructor (duration, overshoot) { + super(); + this.duration(duration || 500) + .overshoot(overshoot || 0); + } + + step (current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity; + if (dt === Infinity) return target + if (dt === 0) return current + + if (dt > 100) dt = 16; + + dt /= 1000; + + // Get the previous velocity + var velocity = c.velocity || 0; + + // Apply the control to get the new position and store it + var acceleration = -this.d * velocity - this.k * (current - target); + var newPosition = current + + velocity * dt + + acceleration * dt * dt / 2; + + // Store the velocity + c.velocity = velocity + acceleration * dt; + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition + } + } + + extend$1(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) + }); + + class PID extends Controller { + constructor (p, i, d, windup) { + super(); + + p = p == null ? 0.1 : p; + i = i == null ? 0.01 : i; + d = d == null ? 0 : d; + windup = windup == null ? 1000 : windup; + this.p(p).i(i).d(d).windup(windup); + } + + step (current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity; + + if (dt === Infinity) return target + if (dt === 0) return current + + var p = target - current; + var i = (c.integral || 0) + p * dt; + var d = (p - (c.error || 0)) / dt; + var windup = this.windup; + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + + c.error = p; + c.integral = i; + + c.done = Math.abs(p) < 0.001; + + return c.done ? target : current + (this.P * p + this.I * i + this.D * d) + } + } + + extend$1(PID, { + windup: makeSetterGetter('windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') + }); + + class Morphable { + constructor (stepper) { + // FIXME: the default stepper does not know about easing + this._stepper = stepper || new Ease('-'); + + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + + from (val) { + if (val == null) { + return this._from + } + + this._from = this._set(val); + return this + } + + to (val) { + if (val == null) { + return this._to + } + + this._to = this._set(val); + return this + } + + type (type) { + // getter + if (type == null) { + return this._type + } + + // setter + this._type = type; + return this + } + + _set (value) { + if (!this._type) { + var type = typeof value; + + if (type === 'number') { + this.type(SVGNumber); + } else if (type === 'string') { + if (Color.isColor(value)) { + this.type(Color); + } else if (regex.delimiter.test(value)) { + this.type(regex.pathLetters.test(value) + ? PathArray + : SVGArray + ); + } else if (regex.numberAndUnit.test(value)) { + this.type(SVGNumber); + } else { + this.type(Morphable.NonMorphable); + } + } else if (MorphableTypes.indexOf(value.constructor) > -1) { + this.type(value.constructor); + } else if (Array.isArray(value)) { + this.type(SVGArray); + } else if (type === 'object') { + this.type(Morphable.ObjectBag); + } else { + this.type(Morphable.NonMorphable); + } + } + + var result = (new this._type(value)).toArray(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || + Array.apply(null, Array(result.length)).map(Object); + return result + } + + stepper (stepper) { + if (stepper == null) return this._stepper + this._stepper = stepper; + return this + } + + done () { + var complete = this._context + .map(this._stepper.done) + .reduce(function (last, curr) { + return last && curr + }, true); + return complete + } + + at (pos) { + var _this = this; + + return this._morphObj.fromArray( + this._from.map(function (i, index) { + return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context) + }) + ) + } + } + + Morphable.NonMorphable = class { + constructor (...args) { + this.init(...args); + } + + init (val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + } + + valueOf () { + return this.value + } + + toArray () { + return [this.value] + } + }; + + Morphable.TransformBag = class { + constructor (...args) { + this.init(...args); + } + + init (obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + + Object.assign(this, Morphable.TransformBag.defaults, obj); + } + + toArray () { + var v = this; + + return [ + v.scaleX, + v.scaleY, + v.shear, + v.rotate, + v.translateX, + v.translateY, + v.originX, + v.originY + ] + } + }; + + Morphable.TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 + }; + + Morphable.ObjectBag = class { + constructor (...args) { + this.init(...args); + } + + init (objOrArr) { + this.values = []; + + if (Array.isArray(objOrArr)) { + this.values = objOrArr; + return + } + + var entries = Object.entries(objOrArr || {}).sort((a, b) => { + return a[0] - b[0] + }); + + this.values = entries.reduce((last, curr) => last.concat(curr), []); + } + + valueOf () { + var obj = {}; + var arr = this.values; + + for (var i = 0, len = arr.length; i < len; i += 2) { + obj[arr[i]] = arr[i + 1]; + } + + return obj + } + + toArray () { + return this.values + } + }; + + let morphableTypes = [ + SVGNumber, + Color, + Box$1, + Matrix, + SVGArray, + PointArray$1, + PathArray, + Morphable.NonMorphable, + Morphable.TransformBag, + Morphable.ObjectBag + ]; + + extend$1(morphableTypes, { + to (val, args) { + return new Morphable() + .type(this.constructor) + .from(this.valueOf()) + .to(val, args) + }, + fromArray (arr) { + this.init(arr); + return this + } + }); + + var time = window.performance || Date; + + var makeSchedule = function (runnerInfo) { + var start = runnerInfo.start; + var duration = runnerInfo.runner.duration(); + var end = start + duration; + return {start: start, duration: duration, end: end, runner: runnerInfo.runner} + }; + + class Timeline { + // Construct a new timeline on the given element + constructor () { + this._timeSource = function () { + return time.now() + }; + + this._dispatcher = document.createElement('div'); + + // Store the timing variables + this._startTime = 0; + this._speed = 1.0; + + // Play control variables control how the animation proceeds + this._reverse = false; + this._persist = 0; + + // Keep track of the running animations and their starting parameters + this._nextFrame = null; + this._paused = false; + this._runners = []; + this._order = []; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + } + + getEventTarget () { + return this._dispatcher + } + + /** + * + */ + + // schedules a runner on the timeline + schedule (runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule).sort(function (a, b) { + return (a.start - b.start) || (a.duration - b.duration) + }) + } + + if (!this.active()) { + this._step(); + if (when == null) { + when = 'now'; + } + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations direclty + var absoluteStartTime = 0; + delay = delay || 0; + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = this._startTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + let runnerInfo = this._runners[runner.id]; + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else { + throw new Error('Invalid value for the "when" parameter') + } + + // Manage runner + runner.unschedule(); + runner.timeline(this); + runner.time(-delay); + + // Save startTime for next runner + this._startTime = absoluteStartTime + runner.duration() + delay; + + // Save runnerInfo + this._runners[runner.id] = { + persist: this.persist(), + runner: runner, + start: absoluteStartTime + }; + + // Save order and continue + this._order.push(runner.id); + this._continue(); + return this + } + + // Remove the runner from this timeline + unschedule (runner) { + var index = this._order.indexOf(runner.id); + if (index < 0) return this + + delete this._runners[runner.id]; + this._order.splice(index, 1); + runner.timeline(null); + return this + } + + play () { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this._continue() + } + + pause () { + // Cancel the next animation frame and pause + this._nextFrame = null; + this._paused = true; + return this + } + + stop () { + // Cancel the next animation frame and go to start + this.seek(-this._time); + return this.pause() + } + + finish () { + this.seek(Infinity); + return this.pause() + } + + speed (speed) { + if (speed == null) return this._speed + this._speed = speed; + return this + } + + reverse (yes) { + var currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed) + + var positive = Math.abs(currentSpeed); + return this.speed(yes ? positive : -positive) + } + + seek (dt) { + this._time += dt; + return this._continue() + } + + time (time) { + if (time == null) return this._time + this._time = time; + return this + } + + persist (dtOrForever) { + if (dtOrForever == null) return this._persist + this._persist = dtOrForever; + return this + } + + source (fn) { + if (fn == null) return this._timeSource + this._timeSource = fn; + return this + } + + _step () { + // If the timeline is paused, just do nothing + if (this._paused) return + + // Get the time delta from the last time and update the time + // TODO: Deal with window.blur window.focus to pause animations + var time = this._timeSource(); + var dtSource = time - this._lastSourceTime; + var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; + + // Update the time + this._time += dtTime; + this._lastStepTime = this._time; + // this.fire('time', this._time) + + // Run all of the runners directly + var runnersLeft = false; + for (var i = 0, len = this._order.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + var runnerInfo = this._runners[this._order[i]]; + var runner = runnerInfo.runner; + let dt = dtTime; + + // Make sure that we give the actual difference + // between runner start time and now + let dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + if (dtToStart < 0) { + runnersLeft = true; + continue + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + + if (!runner.active()) continue + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + var finished = runner.step(dt).done; + if (!finished) { + runnersLeft = true; + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + + // TODO: Figure out end time of runner + var endTime = runner.duration() - runner.time() + this._time; + + if (endTime + this._persist < this._time) { + // Delete runner and correct index + delete this._runners[this._order[i]]; + this._order.splice(i--, 1) && --len; + runner.timeline(null); + } + } + } + + // Get the next animation frame to keep the simulation going + if (runnersLeft) { + this._nextFrame = Animator.frame(this._step.bind(this)); + } else { + this._nextFrame = null; + } + return this + } + + // Checks if we are running and continues the animation + _continue () { + if (this._paused) return this + if (!this._nextFrame) { + this._nextFrame = Animator.frame(this._step.bind(this)); + } + return this + } + + active () { + return !!this._nextFrame + } + } + + Timeline.constructors = { + Element: { + timeline: function () { + this._timeline = (this._timeline || new Timeline()); + return this._timeline + } + } + }; + + // FIXME: What is this doing here? + // easing = { + // '-': function (pos) { return pos }, + // '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 }, + // '>': function (pos) { return Math.sin(pos * Math.PI / 2) }, + // '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 } + // } + + class Runner { + constructor (options) { + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; + + // Ensure a default value + options = options == null + ? timeline.duration + : options; + + // Ensure that we get a controller + options = typeof options === 'function' + ? new Controller(options) + : options; + + // Declare all of the variables + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); + + // We copy the current values from the timeline because they can change + this._history = {}; + + // Store the state of the runner + this.enabled = true; + this._time = 0; + this._last = 0; + + // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; + + // Looping variables + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + } + + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element (element) { + if (element == null) return this._element + this._element = element; + element._prepareRunner(); + return this + } + + timeline (timeline$$1) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline$$1 === 'undefined') return this._timeline + this._timeline = timeline$$1; + return this + } + + animate (duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(delay, when) + } + + schedule (timeline$$1, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline$$1 instanceof Timeline)) { + when = delay; + delay = timeline$$1; + timeline$$1 = this.timeline(); + } + + // If there is no timeline, yell at the user... + if (!timeline$$1) { + throw Error('Runner cannot be scheduled without timeline') + } + + // Schedule the runner on the timeline provided + timeline$$1.schedule(this, delay, when); + return this + } + + unschedule () { + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1.unschedule(this); + return this + } + + loop (times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } + + // Sanitise the values and store them + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + return this + } + + delay (delay) { + return this.animate(0, delay) + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + + queue (initFn, runFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + isTransform: isTransform, + initialised: false, + finished: false + }); + var timeline$$1 = this.timeline(); + timeline$$1 && this.timeline()._continue(); + return this + } + + during (fn) { + return this.queue(null, fn) + } + + after (fn) { + return this.on('finish', fn) + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + + time (time) { + if (time == null) { + return this._time + } + let dt = time - this._time; + this.step(dt); + return this + } + + duration () { + return this._times * (this._wait + this._duration) - this._wait + } + + loops (p) { + var loopDuration = this._duration + this._wait; + if (p == null) { + var loopsDone = Math.floor(this._time / loopDuration); + var relativeTime = (this._time - loopsDone * loopDuration); + var position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times) + } + var whole = Math.floor(p); + var partial = p % 1; + var time = loopDuration * whole + this._duration * partial; + return this.time(time) + } + + position (p) { + // Get all of the variables we need + var x = this._time; + var d = this._duration; + var w = this._wait; + var t = this._times; + var s = this._swing; + var r = this._reverse; + var position; + + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); + var backwards = (swinging && !r) || (!swinging && r); + var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; + var clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped + }; + + // Figure out the value by incorporating the start time + var endTime = t * (w + d) - w; + position = x <= 0 ? Math.round(f(1e-5)) + : x < endTime ? f(x) + : Math.round(f(endTime - 1e-5)); + return position + } + + // Work out the loops done and add the position to the loops done + var loopsDone = Math.floor(this.loops()); + var swingForward = s && (loopsDone % 2 === 0); + var forwards = (swingForward && !r) || (r && swingForward); + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position) + } + + progress (p) { + if (p == null) { + return Math.min(1, this._time / this.duration()) + } + return this.time(p * this.duration()) + } + + step (dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this + + // Update the time and get the new position + dt = dt == null ? 16 : dt; + this._time += dt; + var position = this.position(); + + // Figure out if we need to run the stepper in this frame + var running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; + + // Figure out if we just started + var duration = this.duration(); + var justStarted = this._lastTime < 0 && this._time > 0; + var justFinished = this._lastTime < this._time && this.time > duration; + this._lastTime = this._time; + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + var declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; + + // Call initialise and the run function + if (running || declarative) { + this._initialise(running); + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix(); + var converged = this._run(declarative ? dt : position); + // this.fire('step', this) + } + // correct the done flag here + // declaritive animations itself know when they converged + this.done = this.done || (converged && declarative); + // if (this.done) { + // this.fire('finish', this) + // } + return this + } + + finish () { + return this.step(Infinity) + } + + reverse (reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this + } + + ease (fn) { + this._stepper = new Ease(fn); + return this + } + + active (enabled) { + if (enabled == null) return this.enabled + this.enabled = enabled; + return this + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher (method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // do nothing and return false + _tryRetarget (method, target) { + if (this._history[method]) { + // if the last method wasnt even initialised, throw it away + if (!this._history[method].caller.initialised) { + let index = this._queue.indexOf(this._history[method].caller); + this._queue.splice(index, 1); + return false + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.isTransform) { + this._history[method].caller.isTransform(target); + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target); + } + + this._history[method].caller.finished = false; + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1._continue(); + return true + } + return false + } + + // Run each initialise function in the runner if required + _initialise (running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return + + // Loop through all of the initialisers + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + var current = this._queue[i]; + + // Determine whether we need to initialise + var needsIt = this._isDeclarative || (!current.initialised && running); + running = !current.finished; + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } + + // Run each run function for the position or dt given + _run (positionOrDt) { + // Run all of the _queue directly + var allfinished = true; + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + var current = this._queue[i]; + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + var converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || (converged === true); + allfinished = allfinished && current.finished; + } + + // We report when all of the constructors are finished + return allfinished + } + + addTransform (transform, index) { + this.transforms.lmultiplyO(transform); + return this + } + + clearTransform () { + this.transforms = new Matrix(); + return this + } + + static sanitise (duration, delay, when) { + // Initialise the default parameters + var times = 1; + var swing = false; + var wait = 0; + duration = duration || timeline.duration; + delay = delay || timeline.delay; + when = when || 'last'; + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay || delay; + when = duration.when || when; + swing = duration.swing || swing; + times = duration.times || times; + wait = duration.wait || wait; + duration = duration.duration || timeline.duration; + } + + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + } + } + } + + Runner.id = 0; + + class FakeRunner{ + constructor (transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + } + + extend$1([Runner, FakeRunner], { + mergeWith (runner) { + return new FakeRunner( + runner.transforms.lmultiply(this.transforms), + runner.id + ) + } + }); + + // FakeRunner.emptyRunner = new FakeRunner() + + const lmultiply = (last, curr) => last.lmultiplyO(curr); + const getRunnerTransform = (runner) => runner.transforms; + + function mergeTransforms () { + // Find the matrix to apply to the element and apply it + let runners = this._transformationRunners.runners; + let netTransform = runners + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()); + + this.transform(netTransform); + + this._transformationRunners.merge(); + + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } + } + + class RunnerArray { + constructor () { + this.runners = []; + this.ids = []; + } + + add (runner) { + if (this.runners.includes(runner)) return + + let id = runner.id + 1; + + let leftSibling = this.ids.reduce((last, curr) => { + if (curr > last && curr < id) return curr + return last + }, 0); + + let index = this.ids.indexOf(leftSibling) + 1; + + this.ids.splice(index, 0, id); + this.runners.splice(index, 0, runner); + + return this + } + + getByID (id) { + return this.runners[this.ids.indexOf(id + 1)] + } + + remove (id) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this + } + + merge () { + let lastRunner = null; + this.runners.forEach((runner, i) => { + if (lastRunner && runner.done && lastRunner.done) { + this.remove(runner.id); + this.edit(lastRunner.id, runner.mergeWith(lastRunner)); + } + + lastRunner = runner; + }); + + return this + } + + edit (id, newRunner) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id); + this.runners.splice(index, 1, newRunner); + return this + } + + length () { + return this.ids.length + } + + clearBefore (id) { + let deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()); + return this + } + } + + let frameId = 0; + Runner.constructors = { + Element: { + animate (duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var timeline$$1 = this.timeline(); + return new Runner(o.duration) + .loop(o) + .element(this) + .timeline(timeline$$1) + .schedule(delay, when) + }, + + delay (by, when) { + return this.animate(0, by, when) + }, + + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwfrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore (currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + + _currentTransform (current) { + return this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter((runner) => runner.id <= current.id) + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()) + }, + + addRunner (runner) { + this._transformationRunners.add(runner); + + Animator.transform_frame( + mergeTransforms.bind(this), this._frameId + ); + }, + + _prepareRunner () { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray() + .add(new FakeRunner(new Matrix(this))); + + this._frameId = frameId++; + } + } + } + }; + + + extend$1(Runner, { + attr (a, v) { + return this.styleAttr('attr', a, v) + }, + + // Add animatable styles + css (s, v) { + return this.styleAttr('css', s, v) + }, + + styleAttr (type, name, val) { + // apply attributes individually + if (typeof name === 'object') { + for (var key in val) { + this.styleAttr(type, key, val[key]); + } + } + + var morpher = new Morphable(this._stepper).to(val); + + this.queue(function () { + morpher = morpher.from(this.element()[type](name)); + }, function (pos) { + this.element()[type](name, morpher.at(pos)); + return morpher.done() + }); + + return this + }, + + zoom (level, point) { + var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + + this.queue(function () { + morpher = morpher.from(this.zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done() + }); + + return this + }, + + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform (transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this + } + + // Parse the parameters + var isMatrix = isMatrixLike(transforms); + affine = transforms.affine != null + ? transforms.affine + : (affine != null ? affine : !isMatrix); + + // Create a morepher and set its type + const morpher = new Morphable() + .type(affine ? Morphable.TransformBag : Matrix) + .stepper(this._stepper); + + let origin; + let element; + let current; + let currentAngle; + let startTransform; + + function setup () { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + + startTransform = new Matrix(relative ? undefined : element); + + // add the runner to the element so it can merge transformations + element.addRunner(this); + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + + function run (pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + + let {x, y} = new Point(origin).transform(element._currentTransform(this)); + + let target = new Matrix({...transforms, origin: [x, y]}); + let start = this._isDeclarative && current + ? current + : startTransform; + + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); + + // Get the current and target angle as it was set + const rTarget = target.rotate; + const rCurrent = start.rotate; + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + + morpher.from(start); + morpher.to(target); + + let affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + + this.addTransform(current); + return morpher.done() + } + + function retarget (newTransforms) { + // only get a new origin if it changed since the last call + if ( + (newTransforms.origin || 'center').toString() !== + (transforms.origin || 'center').toString() + ) { + origin = getOrigin(transforms, element); + } + + // overwrite the old transformations with the new ones + transforms = {...newTransforms, origin}; + } + + this.queue(setup, run, retarget); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this + }, + + // Animatable x-axis + x (x, relative) { + return this._queueNumber('x', x) + }, + + // Animatable y-axis + y (y) { + return this._queueNumber('y', y) + }, + + dx (x) { + return this._queueNumberDelta('dx', x) + }, + + dy (y) { + return this._queueNumberDelta('dy', y) + }, + + _queueNumberDelta (method, to) { + to = new SVGNumber(to); + + // Try to change the target if we have this method already registerd + if (this._tryRetargetDelta(method, to)) return this + + // Make a morpher and queue the animation + var morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + var from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done() + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this + }, + + _queueObject (method, to) { + // Try to change the target if we have this method already registerd + if (this._tryRetarget(method, to)) return this + + // Make a morpher and queue the animation + var morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done() + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this + }, + + _queueNumber (method, value) { + return this._queueObject(method, new SVGNumber(value)) + }, + + // Animatable center x-axis + cx (x) { + return this._queueNumber('cx', x) + }, + + // Animatable center y-axis + cy (y) { + return this._queueNumber('cy', y) + }, + + // Add animatable move + move (x, y) { + return this.x(x).y(y) + }, + + // Add animatable center + center (x, y) { + return this.cx(x).cy(y) + }, + + // Add animatable size + size (width, height) { + // animate bbox based size for all other elements + var box; + + if (!width || !height) { + box = this._element.bbox(); + } + + if (!width) { + width = box.width / box.height * height; + } + + if (!height) { + height = box.height / box.width * width; + } + + return this + .width(width) + .height(height) + }, + + // Add animatable width + width (width) { + return this._queueNumber('width', width) + }, + + // Add animatable height + height (height) { + return this._queueNumber('height', height) + }, + + // Add animatable plot + plot (a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]) + } + + // FIXME: this needs to be rewritten such that the element is only accesed + // in the init function + return this._queueObject('plot', new this._element.MorphArray(a)) + + /* + var morpher = this._element.morphArray().to(a) + + this.queue(function () { + morpher.from(this._element.array()) + }, function (pos) { + this._element.plot(morpher.at(pos)) + }) + + return this + */ + }, + + // Add leading method + leading (value) { + return this._queueNumber('leading', value) + }, + + // Add animatable viewbox + viewbox (x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)) + }, + + update (o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }) + } + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + + return this + } + }); + + // export {default as Animator} from './Animator.js' + // export {default as SVGArray} from './SVGArray.js' + // export {default as Bare} from './Bare.js' + // export {default as Box} from './Box.js' + // export {default as Circle} from './Circle.js' + // export {default as ClipPath} from './ClipPath.js' + // export {default as Color} from './Color.js' + // export {default as Container} from './Container.js' + // export {Controller, Ease, PID, Spring} from './Controller.js' + // export {default as Defs} from './Defs.js' + // export {default as Doc} from './Doc.js' + // export {default as Element} from './Element.js' + // export {default as Ellipse} from './Ellipse.js' + // export {default as EventTarget} from './EventTarget.js' + // export {default as Gradient} from './Gradient.js' + // export {default as G} from './G.js' + // export {default as HtmlNode} from './HtmlNode.js' + // export {default as A} from './A.js' + // export {default as Image} from './Image.js' + // export {default as Line} from './Line.js' + // export {default as Marker} from './Marker.js' + // export {default as Mask} from './Mask.js' + // export {default as Matrix} from './Matrix.js' + // export {default as Morphable} from './Morphable.js' + // export {default as SVGNumber} from './SVGNumber.js' + // export {default as Parent} from './Parent.js' + // export {default as Path} from './Path.js' + // export {default as PathArray} from './PathArray.js' + // export {default as Pattern} from './Pattern.js' + // export {default as Point} from './Point.js' + // export {default as PointArray} from './PointArray.js' + // export {default as Polygon} from './Polygon.js' + // export {default as Polyline} from './Polyline.js' + // export {default as Queue} from './Queue.js' + // export {default as Rect} from './Rect.js' + // export {default as Runner} from './Runner.js' + // export {default as Shape} from './Shape.js' + // export {default as Stop} from './Stop.js' + // export {default as Symbol} from './Symbol.js' + // export {default as Text} from './Text.js' + // export {default as TextPath} from './TextPath.js' + // export {default as Timeline} from './Timeline.js' + // export {default as Use} from './Use.js' + + var Classes = /*#__PURE__*/Object.freeze({ + HtmlNode: HtmlNode, + Doc: Doc$1, + Defs: Defs, + G: G, + Animator: Animator, + Bare: Bare, + Circle: Circle, + ClipPath: ClipPath, + A: A, + Ellipse: Ellipse, + Stop: Stop, + Gradient: Gradient, + Image: Image, + Line: Line, + Marker: Marker, + Mask: Mask, + Path: Path, + Pattern: Pattern, + Polygon: Polygon, + Polyline: Polyline, + Rect: Rect, + Symbol: Symbol, + Text: Text$1, + TextPath: TextPath, + Tspan: Tspan, + Use: Use, + SVGNumber: SVGNumber, + SVGArray: SVGArray, + PathArray: PathArray, + PointArray: PointArray$1, + Matrix: Matrix, + Point: Point, + Box: Box$1, + Color: Color, + Morphable: Morphable, + Queue: Queue, + Runner: Runner, + Timeline: Timeline, + Controller: Controller, + Ease: Ease, + PID: PID, + Spring: Spring + }); + + + + var containers = /*#__PURE__*/Object.freeze({ + Bare: Bare, + ClipPath: ClipPath, + Defs: Defs, + Doc: Doc$1, + Gradient: Gradient, + G: G, + A: A, + Marker: Marker, + Mask: Mask, + Pattern: Pattern, + Symbol: Symbol + }); + + // ### This module adds backward / forward functionality to elements. + + // Get all siblings, including myself + function siblings () { + return this.parent().children() + } + + // Get the curent position siblings + function position () { + return this.parent().index(this) + } + + // Get the next element (will return null if there is none) + function next () { + return this.siblings()[this.position() + 1] + } + + // Get the next element (will return null if there is none) + function prev () { + return this.siblings()[this.position() - 1] + } + + // Send given element one step forward + function forward () { + var i = this.position() + 1; + var p = this.parent(); + + // move node one step forward + p.removeElement(this).add(this, i); + + // make sure defs node is always at the top + if (p instanceof Doc$1) { + p.node.appendChild(p.defs().node); + } + + return this + } + + // Send given element one step backward + function backward () { + var i = this.position(); + + if (i > 0) { + this.parent().removeElement(this).add(this, i - 1); + } + + return this + } + + // Send given element all the way to the front + function front () { + var p = this.parent(); + + // Move node forward + p.node.appendChild(this.node); + + // Make sure defs node is always at the top + if (p instanceof Doc$1) { + p.node.appendChild(p.defs().node); + } + + return this + } + + // Send given element all the way to the back + function back () { + if (this.position() > 0) { + this.parent().removeElement(this).add(this, 0); + } + + return this + } + + // Inserts a given element before the targeted element + function before (element) { + element.remove(); + + var i = this.position(); + + this.parent().add(element, i); + + return this + } + + // Inserts a given element after the targeted element + function after (element) { + element.remove(); + + var i = this.position(); + + this.parent().add(element, i + 1); + + return this + } + + var arrange = /*#__PURE__*/Object.freeze({ + siblings: siblings, + position: position, + next: next, + prev: prev, + forward: forward, + backward: backward, + front: front, + back: back, + before: before, + after: after + }); + + // // Method for getting an element by id + // SVG.get = function (id) { + // var node = document.getElementById(idFromReference(id) || id) + // return SVG.adopt(node) + // } + // + // // Select elements by query string + // SVG.select = function (query, parent) { + // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { + // return SVG.adopt(node) + // }) + // } + // + // SVG.$$ = function (query, parent) { + // return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { + // return SVG.adopt(node) + // }) + // } + // + // SVG.$ = function (query, parent) { + // return SVG.adopt((parent || document).querySelector(query)) + // } + + function baseFind (query, parent) { + return utils.map((parent || document).querySelectorAll(query), function (node) { + return adopt$1(node) + }) + } + + // Scoped find method + function find (query) { + return baseFind(query, this.node) + } + + // Dynamic style generator + function css (style, val) { + let ret = {}; + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/) + .filter(function (el) { return !!el.length }) + .forEach(function (el) { + let t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret + } + + if (arguments.length < 2) { + // get style properties in the array + if (Array.isArray(style)) { + for (let name of style) { + let cased = camelCase(name); + ret[cased] = this.node.style(cased); + } + return ret + } + + // get style for property + if (typeof style === 'string') { + return this.node.style[camelCase(style)] + } + + // set styles in object + if (typeof style === 'object') { + for (name in style) { + // set empty string if null/undefined/'' was given + this.node.style[camelCase(name)] = + (style[name] == null || isBlank.test(style[name])) ? '' : style[name]; + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style[camelCase(style)] = + (val == null || isBlank.test(val)) ? '' : val; + } + + return this + } + + // Show element + function show () { + return this.css('display', '') + } + + // Hide element + function hide () { + return this.css('display', 'none') + } + + // Is element visible? + function visible () { + return this.css('display') !== 'none' + } + + var css$1 = /*#__PURE__*/Object.freeze({ + css: css, + show: show, + hide: hide, + visible: visible + }); + + // Reset all transformations + function untransform () { + return this.attr('transform', null) + } + + // merge the whole transformation chain into one matrix and returns it + function matrixify () { + var matrix = (this.attr('transform') || '') + // split transformations + .split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + var kv = str.trim().split('('); + return [kv[0], + kv[1].split(delimiter) + .map(function (str) { return parseFloat(str) }) + ] + }) + .reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(arrayToMatrix(transform[1])) + } + return matrix[transform[0]].apply(matrix, transform[1]) + }, new Matrix()); + + return matrix + } + + // add an element to another parent without changing the visual representation on the screen + function toParent (parent) { + if (this === parent) return this + var ctm = this.screenCTM(); + var pCtm = parent.screenCTM().inverse(); + + this.addTo(parent).untransform().transform(pCtm.multiply(ctm)); + + return this + } + + // same as above with parent equals root-svg + function toDoc () { + return this.toParent(this.doc()) + } + + // Add transformations + function transform (o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + var decomposed = new Matrix(this).decompose(); + return decomposed[o] || decomposed + } + + if (!isMatrixLike(o)) { + // Set the origin according to the defined transform + o = {...o, origin: getOrigin(o, this)}; + } + + // The user can pass a boolean, an Element or an Matrix or nothing + var cleanRelative = relative === true ? this : (relative || false); + var result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result) + } + + var transform$1 = /*#__PURE__*/Object.freeze({ + untransform: untransform, + matrixify: matrixify, + toParent: toParent, + toDoc: toDoc, + transform: transform + }); + + // Set svg element attribute + function attr (attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + + for (let node of val) { + attr[node.nodeName] = isNumer.test(node.nodeValue) + ? parseFloat(node.nodeValue) + : node.nodeValue; + } + + return attr + } else if (Array.isArray(attr)) ; else if (typeof attr === 'object') { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] // FIXME: do we need to return defaults? + : isNumber.test(val) ? parseFloat(val) + : val + } else { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = this.doc().defs().image(val); + } + + if (val instanceof Image) { + val = this.doc().defs().pattern(0, 0, function () { + this.add(val); + }); + } + } + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (Array.isArray(val)) { + // parse array values + val = new SVGArray(val); + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) + : this.node.setAttribute(attr, val.toString()); + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + + return this + } + + const name$1 = 'Element'; + + function setup (node) { + // initialize data object + this.dom = {}; + + // create circular reference + this.node = node; + + this.type = node.nodeName; + this.node.instance = this; + + if (node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); + } + } + + // Move over x-axis + function x$2 (x) { + return this.attr('x', x) + } + + // Move over y-axis + function y$2 (y) { + return this.attr('y', y) + } + + // Move by center over x-axis + function cx$1 (x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2) + } + + // Move by center over y-axis + function cy$1 (y) { + return y == null + ? this.y() + this.height() / 2 + : this.y(y - this.height() / 2) + } + + // Move element to given x and y values + function move$1 (x, y) { + return this.x(x).y(y) + } + + // Move element by its center + function center (x, y) { + return this.cx(x).cy(y) + } + + // Set width of element + function width$2 (width) { + return this.attr('width', width) + } + + // Set height of element + function height$2 (height) { + return this.attr('height', height) + } + + // Set element size to given width and height + function size$2 (width, height) { + let p = proportionalSize$1(this, width, height); + + return this + .width(new SVGNumber(p.width)) + .height(new SVGNumber(p.height)) + } + + // Clone element + function clone (parent) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); + + // clone element and assign new id + let clone = assignNewId(this.node.cloneNode(true)); + + // insert the clone in the given parent or after myself + if (parent) parent.add(clone); + else this.after(clone); + + return clone + } + + // Remove element + function remove () { + if (this.parent()) { this.parent().removeElement(this); } + + return this + } + + // Replace element + function replace (element) { + this.after(element).remove(); + + return element + } + + // Add element to given container and return self + function addTo (parent) { + return makeInstance(parent).put(this) + } + + // Add element to given container and return container + function putIn (parent) { + return makeInstance(parent).add(this) + } + + // Get / set id + function id (id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } + + // dont't set directly width this.node.id to make `null` work correctly + return this.attr('id', id) + } + + // Checks whether the given point inside the bounding box of the element + function inside (x, y) { + let box = this.bbox(); + + return x > box.x && + y > box.y && + x < box.x + box.width && + y < box.y + box.height + } + + // Return id on string conversion + function toString () { + return this.id() + } + + // Return array of classes on the node + function classes () { + var attr$$1 = this.attr('class'); + return attr$$1 == null ? [] : attr$$1.trim().split(delimiter) + } + + // Return true if class exists on the node, false otherwise + function hasClass (name) { + return this.classes().indexOf(name) !== -1 + } + + // Add class to the node + function addClass (name) { + if (!this.hasClass(name)) { + var array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + + return this + } + + // Remove class from the node + function removeClass (name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name + }).join(' ')); + } + + return this + } + + // Toggle the presence of a class on the node + function toggleClass (name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name) + } + + // FIXME: getIdFromReference + // Get referenced element form attribute value + function reference$1 (attr$$1) { + return get(this.attr(attr$$1)) + } + + // Returns the parent element instance + function parent (type) { + var parent = this; + + // check for parent + if (!parent.node.parentNode) return null + + // get parent element + parent = adopt$1(parent.node.parentNode); + + if (!type) return parent + + // loop trough ancestors if type is given + while (parent && parent.node instanceof window.SVGElement) { + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent + parent = adopt$1(parent.node.parentNode); + } + } + + // Get parent document + function doc () { + let p = this.parent(Doc$1); + return p && p.doc() + } + + // Get defs + function defs () { + return this.doc().defs() + } + + // return array of all ancestors of given type up to the root svg + function parents (type) { + let parents = []; + let parent = this; + + do { + parent = parent.parent(type); + if (!parent || !parent.node) break + + parents.push(parent); + } while (parent.parent) + + return parents + } + + // matches the element vs a css selector + function matches (selector) { + return matches(this.node, selector) + } + + // Returns the svg node to call native svg methods on it + function native () { + return this.node + } + + // Import raw svg + function svg () { + // write svgjs data to the dom + this.writeDataToDom(); + + return this.node.outerHTML + } + + // write svgjs data to the dom + function writeDataToDom () { + // remove previously set data + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 + } + return this + } + + // set given data to the elements data property + function setData (o) { + this.dom = o; + return this + } + + function getEventTarget$1 () { + return this.node + } + + var Element$1 = /*#__PURE__*/Object.freeze({ + name: name$1, + setup: setup, + x: x$2, + y: y$2, + cx: cx$1, + cy: cy$1, + move: move$1, + center: center, + width: width$2, + height: height$2, + size: size$2, + clone: clone, + remove: remove, + replace: replace, + addTo: addTo, + putIn: putIn, + id: id, + inside: inside, + toString: toString, + classes: classes, + hasClass: hasClass, + addClass: addClass, + removeClass: removeClass, + toggleClass: toggleClass, + reference: reference$1, + parent: parent, + doc: doc, + defs: defs, + parents: parents, + matches: matches, + native: native, + svg: svg, + writeDataToDom: writeDataToDom, + setData: setData, + getEventTarget: getEventTarget$1, + attr: attr + }); + + // Unclip all clipped elements and remove itself + function clipPathRemove () { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); + + // remove clipPath from parent + return remove.call(this) + } + + function clipPathTargets () { + return find('svg [clip-path*="' + this.id() + '"]') + } + + // Unclip all clipped elements and remove itself + function maskRemove () { + // unclip all targets + this.targets().forEach(function (el) { + el.unmask(); + }); + + // remove clipPath from parent + return remove.call(this) + } + + function maskTargets () { + return find('svg [mask*="' + this.id() + '"]') + } + + // Unclip all clipped elements and remove itself + function patternGradientRemove () { + // unclip all targets + this.targets().forEach(function (el) { + el.unFill(); + }); + + // remove clipPath from parent + return remove.call(this) + } + + function unFill () { + this.attr('fill', null); + } + + function patternGradientTargets () { + return find('svg [fill*="' + this.id() + '"]') + } + + // custom attr to handle transform + function patternAttr (a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return attr.call(this, a, b, c) + } + + // custom attr to handle transform + function gradientAttr (a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return attr.call(this, a, b, c) + } + + function pathTargets () { + return find('svg textpath [href*="' + this.id() + '"]') + } + + function HtmlNodeAdd (element, i) { + element = makeInstance(element); + + if (element.node !== this.node.children[i]) { + this.node.insertBefore(element.node, this.node.children[i] || null); + } + + return this + } + + const name$2 = 'EventTarget'; + + function setup$1 (node = {}) { + this.events = node.events || {}; + } + + // Bind given event to listener + function on$1 (event, listener, binding, options) { + on(this, event, listener, binding, options); + return this + } + + // Unbind event from listener + function off$1 (event, listener) { + off(this, event, listener); + return this + } + + function dispatch$1 (event, data) { + return dispatch(this, event, data) + } + + // Fire given event + function fire (event, data) { + this.dispatch(event, data); + return this + } + + var EventTarget = /*#__PURE__*/Object.freeze({ + name: name$2, + setup: setup$1, + on: on$1, + off: off$1, + dispatch: dispatch$1, + fire: fire + }); + + // Returns all child elements + function children () { + return map(this.node.children, function (node) { + return adopt$1(node) + }) + } + + // Add given element at a position + function add (element, i) { + element = makeInstance(element); + + if (element.node !== this.node.children[i]) { + this.node.insertBefore(element.node, this.node.children[i] || null); + } + + return this + } + + // Basically does the same as `add()` but returns the added element instead + function put (element, i) { + this.add(element, i); + return element.instance || element + } + + // Checks if the given element is a child + function has (element) { + return this.index(element) >= 0 + } + + // Gets index of given element + function index (element) { + return [].slice.call(this.node.children).indexOf(element.node) + } + + // Get a element at the given index + function get$1 (i) { + return adopt$1(this.node.children[i]) + } + + // Get first child + function first () { + return this.get(0) + } + + // Get the last child + function last () { + return this.get(this.node.children.length - 1) + } + + // Iterates over all children and invokes a given block + function each (block, deep) { + var children = this.children(); + var i, il; + + for (i = 0, il = children.length; i < il; i++) { + if (children[i] instanceof Base) { + block.apply(children[i], [i, children]); + } + + if (deep && (children[i] instanceof Base && children[i].is('Parent'))) { + children[i].each(block, deep); + } + } + + return this + } + + // Remove a given child + function removeElement (element) { + this.node.removeChild(element.node); + + return this + } + + // Remove all elements in this container + function clear$1 () { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + + // remove defs reference + delete this._defs; + + return this + } + + // Import raw svg + function svg$1 (svg) { + var well, len; + + // act as a setter if svg is given + if (svg) { + // create temporary holder + well = document.createElementNS(ns, 'svg'); + // dump raw svg + well.innerHTML = svg; + + // transplant nodes + for (len = well.children.length; len--;) { + this.node.appendChild(well.firstElementChild); + } + + // otherwise act as a getter + } else { + // write svgjs data to the dom + this.writeDataToDom(); + + return this.node.outerHTML + } + + return this + } + + // write svgjs data to the dom + function writeDataToDom$1 () { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + + // remove previously set data + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 + } + return this + } + + function flatten (parent) { + this.each(function () { + if (this.is('Parent')) return this.flatten(parent).ungroup(parent) + return this.toParent(parent) + }); + + // we need this so that Doc does not get removed + this.node.firstElementChild || this.remove(); + + return this + } + + function ungroup (parent) { + parent = parent || this.parent(); + + this.each(function () { + return this.toParent(parent) + }); + + this.remove(); + + return this + } + + var Parent = /*#__PURE__*/Object.freeze({ + children: children, + add: add, + put: put, + has: has, + index: index, + get: get$1, + first: first, + last: last, + each: each, + removeElement: removeElement, + clear: clear$1, + svg: svg$1, + writeDataToDom: writeDataToDom$1, + flatten: flatten, + ungroup: ungroup + }); + + // import {extend} from './tools.js' + const extend$2 = extend$1; + + extend$2([ + Doc$1, + Symbol, + Image, + Pattern, + Marker + ], {viewbox: Box$1.constructors.viewbox}); + + extend$2([Line, Polyline, Polygon, Path], { + ...Marker.constructors.marker + }); + + extend$2(Text$1, TextPath.constructors.Text); + extend$2(Path, TextPath.constructors.Path); + + extend$2(Defs, { + ...Gradient.constructors.Defs, + ...Marker.constructors.Defs, + ...Pattern.constructors.Defs, + }); + + extend$2([Text$1, Tspan], Tspan.constructors.Tspan); + + extend$2([Gradient, Pattern], { + remove: patternGradientRemove, + targets: patternGradientTargets, + unFill: unFill, + }); + + extend$2(Gradient, {attr: gradientAttr}); + extend$2(Pattern, {attr: patternAttr}); + + extend$2(ClipPath, { + remove: clipPathRemove, + targets: clipPathTargets + }); + + extend$2(Mask, { + remove: maskRemove, + targets: maskTargets + }); + + extend$2(Path, {targets: pathTargets}); + + extend$2(HtmlNode, { + add: HtmlNodeAdd + }); + + for (let i in containers) { + extend$2(containers[i], { + ...A.constructors.Container, + ...ClipPath.constructors.Container, + ...Doc$1.constructors.Container, + ...G.constructors.Container, + ...Gradient.constructors.Container, + ...Line.constructors.Container, + ...Marker.constructors.Container, + ...Mask.constructors.Container, + ...Path.constructors.Container, + ...Pattern.constructors.Container, + ...Polygon.constructors.Container, + ...Polyline.constructors.Container, + ...Rect.constructors.Container, + find, + ...Symbol.constructors.Container, + ...Text$1.constructors.Container, + ...TextPath.constructors.Container, + ...Use.constructors.Container, + }); + } + + for (let i in elements) { + extend$2(elements[i], { + ...EventTarget, + ...Element$1, + ...Parent, + ...arrange, + ...A.constructors.Element, + ...Box$1.constructors.Element, + ...Circle.constructors.Element, + ...ClipPath.constructors.Element, + ...css$1, + ...Image.constructors.Element, + ...Mask.constructors.Element, + ...Matrix.constructors.Element, + ...Point.constructors.Element, + ...Runner.constructors.Element, + ...Timeline.constructors.Element, + ...transform$1, + }); + } + + + // The main wrapping element + function SVG (element) { + return makeInstance(element) + } + + Object.assign(SVG, Classes); + Object.assign(SVG, tools); + Object.assign(SVG, adopter); + + return SVG; + +}()); diff --git a/dist/svg.new.js.map b/dist/svg.new.js.map new file mode 100644 index 0000000..1c6decf --- /dev/null +++ b/dist/svg.new.js.map @@ -0,0 +1 @@ +{"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,GAAG,qDAAoD;;EAE/E;AACA,EAAO,IAAI,GAAG,G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