bpmn-js 0.28.3 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v0.28.3
2
+ * bpmn-js - bpmn-navigated-viewer v0.31.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2018-03-05
11
+ * Date: 2018-04-02
12
12
  */
13
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.BpmnJS = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(_dereq_,module,exports){
13
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.BpmnJS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
14
14
  'use strict';
15
15
 
16
16
  var inherits = _dereq_(71);
@@ -56,7 +56,7 @@ var domify = _dereq_(73).domify,
56
56
  domQuery = _dereq_(73).query,
57
57
  domRemove = _dereq_(73).remove;
58
58
 
59
- var innerSVG = _dereq_(98);
59
+ var innerSVG = _dereq_(91).innerSVG;
60
60
 
61
61
  var Diagram = _dereq_(25),
62
62
  BpmnModdle = _dereq_(17);
@@ -549,7 +549,7 @@ function addProjectLogo(container) {
549
549
 
550
550
  /* </project-logo> */
551
551
 
552
- },{"10":10,"16":16,"17":17,"25":25,"3":3,"42":42,"46":46,"47":47,"71":71,"72":72,"73":73,"98":98}],3:[function(_dereq_,module,exports){
552
+ },{"10":10,"16":16,"17":17,"25":25,"3":3,"42":42,"46":46,"47":47,"71":71,"72":72,"73":73,"91":91}],3:[function(_dereq_,module,exports){
553
553
  module.exports = {
554
554
  __depends__: [
555
555
  _dereq_(7),
@@ -752,10 +752,10 @@ var getCirclePath = BpmnRenderUtil.getCirclePath,
752
752
 
753
753
  var domQuery = _dereq_(73).query;
754
754
 
755
- var svgAppend = _dereq_(91),
756
- svgAttr = _dereq_(93),
757
- svgCreate = _dereq_(96),
758
- svgClasses = _dereq_(94);
755
+ var svgAppend = _dereq_(91).append,
756
+ svgAttr = _dereq_(91).attr,
757
+ svgCreate = _dereq_(91).create,
758
+ svgClasses = _dereq_(91).classes;
759
759
 
760
760
  var rotate = _dereq_(66).rotate,
761
761
  transform = _dereq_(66).transform,
@@ -2542,7 +2542,7 @@ BpmnRenderer.prototype.getShapePath = function(element) {
2542
2542
  return getRectPath(element);
2543
2543
  };
2544
2544
 
2545
- },{"13":13,"15":15,"33":33,"4":4,"65":65,"66":66,"67":67,"70":70,"71":71,"72":72,"73":73,"91":91,"93":93,"94":94,"96":96}],6:[function(_dereq_,module,exports){
2545
+ },{"13":13,"15":15,"33":33,"4":4,"65":65,"66":66,"67":67,"70":70,"71":71,"72":72,"73":73,"91":91}],6:[function(_dereq_,module,exports){
2546
2546
  'use strict';
2547
2547
 
2548
2548
  /**
@@ -8074,13 +8074,13 @@ var isNumber = _dereq_(72).isNumber,
8074
8074
  var Collections = _dereq_(56),
8075
8075
  Elements = _dereq_(58);
8076
8076
 
8077
- var svgAppend = _dereq_(91),
8078
- svgAttr = _dereq_(93),
8079
- svgClasses = _dereq_(94),
8080
- svgCreate = _dereq_(96),
8081
- svgTransform = _dereq_(100);
8077
+ var svgAppend = _dereq_(91).append,
8078
+ svgAttr = _dereq_(91).attr,
8079
+ svgClasses = _dereq_(91).classes,
8080
+ svgCreate = _dereq_(91).create,
8081
+ svgTransform = _dereq_(91).transform;
8082
8082
 
8083
- var createMatrix = _dereq_(97).createMatrix;
8083
+ var createMatrix = _dereq_(91).createMatrix;
8084
8084
 
8085
8085
 
8086
8086
  function round(number, resolution) {
@@ -9106,7 +9106,7 @@ Canvas.prototype.resized = function() {
9106
9106
  this._eventBus.fire('canvas.resized');
9107
9107
  };
9108
9108
 
9109
- },{"100":100,"56":56,"58":58,"72":72,"91":91,"93":93,"94":94,"96":96,"97":97}],28:[function(_dereq_,module,exports){
9109
+ },{"56":56,"58":58,"72":72,"91":91}],28:[function(_dereq_,module,exports){
9110
9110
  'use strict';
9111
9111
 
9112
9112
  var Model = _dereq_(49);
@@ -9162,7 +9162,7 @@ ElementFactory.prototype.create = function(type, attrs) {
9162
9162
 
9163
9163
  var ELEMENT_ID = 'data-element-id';
9164
9164
 
9165
- var svgAttr = _dereq_(93);
9165
+ var svgAttr = _dereq_(91).attr;
9166
9166
 
9167
9167
 
9168
9168
  /**
@@ -9368,7 +9368,7 @@ ElementRegistry.prototype._validateId = function(id) {
9368
9368
  }
9369
9369
  };
9370
9370
 
9371
- },{"93":93}],30:[function(_dereq_,module,exports){
9371
+ },{"91":91}],30:[function(_dereq_,module,exports){
9372
9372
  'use strict';
9373
9373
 
9374
9374
  var isFunction = _dereq_(72).isFunction,
@@ -9594,6 +9594,22 @@ EventBus.prototype.off = function(event, callback) {
9594
9594
  };
9595
9595
 
9596
9596
 
9597
+ /**
9598
+ * Create an EventBus event.
9599
+ *
9600
+ * @param {Object} data
9601
+ *
9602
+ * @return {Object} event, recognized by the eventBus
9603
+ */
9604
+ EventBus.prototype.createEvent = function(data) {
9605
+ var event = new InternalEvent();
9606
+
9607
+ event.init(data);
9608
+
9609
+ return event;
9610
+ };
9611
+
9612
+
9597
9613
  /**
9598
9614
  * Fires a named event.
9599
9615
  *
@@ -9650,12 +9666,11 @@ EventBus.prototype.fire = function(type, data) {
9650
9666
 
9651
9667
  // we make sure we fire instances of our home made
9652
9668
  // events here. We wrap them only once, though
9653
- if (data instanceof Event) {
9669
+ if (data instanceof InternalEvent) {
9654
9670
  // we are fine, we alread have an event
9655
9671
  event = data;
9656
9672
  } else {
9657
- event = new Event();
9658
- event.init(data);
9673
+ event = this.createEvent(data);
9659
9674
  }
9660
9675
 
9661
9676
  // ensure we pass the event as the first parameter
@@ -9797,19 +9812,17 @@ EventBus.prototype._getListeners = function(name) {
9797
9812
  /**
9798
9813
  * A event that is emitted via the event bus.
9799
9814
  */
9800
- function Event() { }
9801
-
9802
- module.exports.Event = Event;
9815
+ function InternalEvent() { }
9803
9816
 
9804
- Event.prototype.stopPropagation = function() {
9817
+ InternalEvent.prototype.stopPropagation = function() {
9805
9818
  this.cancelBubble = true;
9806
9819
  };
9807
9820
 
9808
- Event.prototype.preventDefault = function() {
9821
+ InternalEvent.prototype.preventDefault = function() {
9809
9822
  this.defaultPrevented = true;
9810
9823
  };
9811
9824
 
9812
- Event.prototype.init = function(data) {
9825
+ InternalEvent.prototype.init = function(data) {
9813
9826
  assign(this, data || {});
9814
9827
  };
9815
9828
 
@@ -9838,11 +9851,11 @@ var translate = _dereq_(66).translate;
9838
9851
 
9839
9852
  var domClear = _dereq_(73).clear;
9840
9853
 
9841
- var svgAppend = _dereq_(91),
9842
- svgAttr = _dereq_(93),
9843
- svgClasses = _dereq_(94),
9844
- svgCreate = _dereq_(96),
9845
- svgRemove = _dereq_(99);
9854
+ var svgAppend = _dereq_(91).append,
9855
+ svgAttr = _dereq_(91).attr,
9856
+ svgClasses = _dereq_(91).classes,
9857
+ svgCreate = _dereq_(91).create,
9858
+ svgRemove = _dereq_(91).remove;
9846
9859
 
9847
9860
 
9848
9861
  /**
@@ -10051,7 +10064,7 @@ function prependTo(newNode, parentNode, siblingNode) {
10051
10064
  parentNode.insertBefore(newNode, siblingNode || parentNode.firstChild);
10052
10065
  }
10053
10066
 
10054
- },{"60":60,"66":66,"72":72,"73":73,"91":91,"93":93,"94":94,"96":96,"99":99}],32:[function(_dereq_,module,exports){
10067
+ },{"60":60,"66":66,"72":72,"73":73,"91":91}],32:[function(_dereq_,module,exports){
10055
10068
  module.exports = {
10056
10069
  __depends__: [ _dereq_(36) ],
10057
10070
  __init__: [ 'canvas' ],
@@ -10164,9 +10177,9 @@ var renderUtil = _dereq_(65);
10164
10177
  var componentsToPath = renderUtil.componentsToPath,
10165
10178
  createLine = renderUtil.createLine;
10166
10179
 
10167
- var svgAppend = _dereq_(91),
10168
- svgAttr = _dereq_(93),
10169
- svgCreate = _dereq_(96);
10180
+ var svgAppend = _dereq_(91).append,
10181
+ svgAttr = _dereq_(91).attr,
10182
+ svgCreate = _dereq_(91).create;
10170
10183
 
10171
10184
  // apply default renderer with lowest possible priority
10172
10185
  // so that it only kicks in if noone else could render
@@ -10257,7 +10270,7 @@ DefaultRenderer.$inject = [ 'eventBus', 'styles' ];
10257
10270
 
10258
10271
  module.exports = DefaultRenderer;
10259
10272
 
10260
- },{"33":33,"65":65,"71":71,"91":91,"93":93,"96":96}],35:[function(_dereq_,module,exports){
10273
+ },{"33":33,"65":65,"71":71,"91":91}],35:[function(_dereq_,module,exports){
10261
10274
  'use strict';
10262
10275
 
10263
10276
  var isArray = _dereq_(72).isArray,
@@ -10349,9 +10362,9 @@ var forEach = _dereq_(72).forEach,
10349
10362
 
10350
10363
  var isPrimaryButton = _dereq_(63).isPrimaryButton;
10351
10364
 
10352
- var svgAppend = _dereq_(91),
10353
- svgAttr = _dereq_(93),
10354
- svgCreate = _dereq_(96);
10365
+ var svgAppend = _dereq_(91).append,
10366
+ svgAttr = _dereq_(91).attr,
10367
+ svgCreate = _dereq_(91).create;
10355
10368
 
10356
10369
  var domQuery = _dereq_(73).query;
10357
10370
 
@@ -10683,7 +10696,7 @@ module.exports = InteractionEvents;
10683
10696
  * @property {SVGElement} gfx
10684
10697
  * @property {Event} originalEvent
10685
10698
  */
10686
- },{"63":63,"65":65,"72":72,"73":73,"91":91,"93":93,"96":96}],38:[function(_dereq_,module,exports){
10699
+ },{"63":63,"65":65,"72":72,"73":73,"91":91}],38:[function(_dereq_,module,exports){
10687
10700
  module.exports = {
10688
10701
  __init__: [ 'interactionEvents' ],
10689
10702
  interactionEvents: [ 'type', _dereq_(37) ]
@@ -10695,9 +10708,9 @@ var getBBox = _dereq_(58).getBBox;
10695
10708
 
10696
10709
  var LOW_PRIORITY = 500;
10697
10710
 
10698
- var svgAppend = _dereq_(91),
10699
- svgAttr = _dereq_(93),
10700
- svgCreate = _dereq_(96);
10711
+ var svgAppend = _dereq_(91).append,
10712
+ svgAttr = _dereq_(91).attr,
10713
+ svgCreate = _dereq_(91).create;
10701
10714
 
10702
10715
  var domQuery = _dereq_(73).query;
10703
10716
 
@@ -10811,7 +10824,7 @@ Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
10811
10824
 
10812
10825
  module.exports = Outline;
10813
10826
 
10814
- },{"58":58,"72":72,"73":73,"91":91,"93":93,"96":96}],40:[function(_dereq_,module,exports){
10827
+ },{"58":58,"72":72,"73":73,"91":91}],40:[function(_dereq_,module,exports){
10815
10828
  'use strict';
10816
10829
 
10817
10830
  module.exports = {
@@ -12981,8 +12994,8 @@ module.exports.isMac = function isMac() {
12981
12994
  },{}],65:[function(_dereq_,module,exports){
12982
12995
  'use strict';
12983
12996
 
12984
- var svgAttr = _dereq_(93),
12985
- svgCreate = _dereq_(96);
12997
+ var svgAttr = _dereq_(91).attr,
12998
+ svgCreate = _dereq_(91).create;
12986
12999
 
12987
13000
 
12988
13001
  module.exports.componentsToPath = function(elements) {
@@ -13019,12 +13032,12 @@ module.exports.updateLine = function(gfx, points) {
13019
13032
  return gfx;
13020
13033
  };
13021
13034
 
13022
- },{"93":93,"96":96}],66:[function(_dereq_,module,exports){
13035
+ },{"91":91}],66:[function(_dereq_,module,exports){
13023
13036
  'use strict';
13024
13037
 
13025
- var svgTransform = _dereq_(100);
13038
+ var svgTransform = _dereq_(91).transform;
13026
13039
 
13027
- var createTransform = _dereq_(97).createTransform;
13040
+ var createTransform = _dereq_(91).createTransform;
13028
13041
 
13029
13042
 
13030
13043
  /**
@@ -13084,7 +13097,7 @@ module.exports.scale = function(gfx, amount) {
13084
13097
  svgTransform(gfx, scale);
13085
13098
  };
13086
13099
 
13087
- },{"100":100,"97":97}],67:[function(_dereq_,module,exports){
13100
+ },{"91":91}],67:[function(_dereq_,module,exports){
13088
13101
  'use strict';
13089
13102
 
13090
13103
  var isObject = _dereq_(72).isObject,
@@ -13093,10 +13106,10 @@ var isObject = _dereq_(72).isObject,
13093
13106
  forEach = _dereq_(72).forEach,
13094
13107
  reduce = _dereq_(72).reduce;
13095
13108
 
13096
- var svgAppend = _dereq_(91),
13097
- svgAttr = _dereq_(93),
13098
- svgCreate = _dereq_(96),
13099
- svgRemove = _dereq_(99);
13109
+ var svgAppend = _dereq_(91).append,
13110
+ svgAttr = _dereq_(91).attr,
13111
+ svgCreate = _dereq_(91).create,
13112
+ svgRemove = _dereq_(91).remove;
13100
13113
 
13101
13114
  var DEFAULT_BOX_PADDING = 0;
13102
13115
 
@@ -13417,10 +13430,12 @@ Text.prototype.layoutText = function(text, options) {
13417
13430
 
13418
13431
  module.exports = Text;
13419
13432
 
13420
- },{"72":72,"91":91,"93":93,"96":96,"99":99}],68:[function(_dereq_,module,exports){
13421
- 'use strict';
13422
-
13423
- Object.defineProperty(exports, '__esModule', { value: true });
13433
+ },{"72":72,"91":91}],68:[function(_dereq_,module,exports){
13434
+ (function (global, factory) {
13435
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
13436
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
13437
+ (factory((global.didi = {})));
13438
+ }(this, (function (exports) { 'use strict';
13424
13439
 
13425
13440
  var CLASS_PATTERN = /^class /;
13426
13441
 
@@ -13756,6 +13771,10 @@ exports.annotate = annotate;
13756
13771
  exports.Module = Module;
13757
13772
  exports.Injector = Injector;
13758
13773
 
13774
+ Object.defineProperty(exports, '__esModule', { value: true });
13775
+
13776
+ })));
13777
+
13759
13778
  },{}],69:[function(_dereq_,module,exports){
13760
13779
  var hat = module.exports = function (bits, base) {
13761
13780
  if (!base) base = 16;
@@ -13945,9 +13964,11 @@ if (typeof Object.create === 'function') {
13945
13964
  }
13946
13965
 
13947
13966
  },{}],72:[function(_dereq_,module,exports){
13948
- 'use strict';
13949
-
13950
- Object.defineProperty(exports, '__esModule', { value: true });
13967
+ (function (global, factory) {
13968
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
13969
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
13970
+ (factory((global.MinDash = {})));
13971
+ }(this, (function (exports) { 'use strict';
13951
13972
 
13952
13973
  /**
13953
13974
  * Flatten array, one level deep.
@@ -14571,11 +14592,17 @@ exports.pick = pick;
14571
14592
  exports.omit = omit;
14572
14593
  exports.merge = merge;
14573
14594
 
14574
- },{}],73:[function(_dereq_,module,exports){
14575
- 'use strict';
14576
-
14577
14595
  Object.defineProperty(exports, '__esModule', { value: true });
14578
14596
 
14597
+ })));
14598
+
14599
+ },{}],73:[function(_dereq_,module,exports){
14600
+ (function (global, factory) {
14601
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
14602
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
14603
+ (factory((global.MinDom = {})));
14604
+ }(this, (function (exports) { 'use strict';
14605
+
14579
14606
  /**
14580
14607
  * Set attribute `name` to `val`, or get attr `name`.
14581
14608
  *
@@ -15125,6 +15152,10 @@ exports.query = query;
15125
15152
  exports.queryAll = all;
15126
15153
  exports.remove = remove;
15127
15154
 
15155
+ Object.defineProperty(exports, '__esModule', { value: true });
15156
+
15157
+ })));
15158
+
15128
15159
  },{}],74:[function(_dereq_,module,exports){
15129
15160
  'use strict';
15130
15161
 
@@ -16009,7 +16040,8 @@ var Types = _dereq_(85),
16009
16040
  serializeAsProperty = common.serializeAsProperty;
16010
16041
 
16011
16042
  var XML_PREAMBLE = '<?xml version="1.0" encoding="UTF-8"?>\n',
16012
- ESCAPE_CHARS = /(<|>|'|"|&|\n\r|\n)/g,
16043
+ ESCAPE_ATTR_CHARS = /<|>|'|"|&|\n\r|\n/g,
16044
+ ESCAPE_CHARS = /<|>|&/g,
16013
16045
  DEFAULT_NS_MAP = common.DEFAULT_NS_MAP,
16014
16046
  XSI_TYPE = common.XSI_TYPE;
16015
16047
 
@@ -16155,16 +16187,32 @@ function getSerializableProperties(element) {
16155
16187
  });
16156
16188
  }
16157
16189
 
16190
+ var ESCAPE_ATTR_MAP = {
16191
+ '\n': '#10',
16192
+ '\n\r': '#10',
16193
+ '"': '#34',
16194
+ '\'': '#39',
16195
+ '<': '#60',
16196
+ '>': '#62',
16197
+ '&': '#38'
16198
+ };
16199
+
16158
16200
  var ESCAPE_MAP = {
16159
- '\n': '10',
16160
- '\n\r': '10',
16161
- '"': '34',
16162
- '\'': '39',
16163
- '<': '60',
16164
- '>': '62',
16165
- '&': '38'
16201
+ '<': 'lt',
16202
+ '>': 'gt',
16203
+ '&': 'amp'
16166
16204
  };
16167
16205
 
16206
+ function escape(str, charPattern, replaceMap) {
16207
+
16208
+ // ensure we are handling strings here
16209
+ str = isString(str) ? str : '' + str;
16210
+
16211
+ return str.replace(charPattern, function(s) {
16212
+ return '&' + replaceMap[s] + ';';
16213
+ });
16214
+ }
16215
+
16168
16216
  /**
16169
16217
  * Escape a string attribute to not contain any bad values (line breaks, '"', ...)
16170
16218
  *
@@ -16172,13 +16220,11 @@ var ESCAPE_MAP = {
16172
16220
  * @return {String} the escaped string
16173
16221
  */
16174
16222
  function escapeAttr(str) {
16223
+ return escape(str, ESCAPE_ATTR_CHARS, ESCAPE_ATTR_MAP);
16224
+ }
16175
16225
 
16176
- // ensure we are handling strings here
16177
- str = isString(str) ? str : '' + str;
16178
-
16179
- return str.replace(ESCAPE_CHARS, function(str) {
16180
- return '&#' + ESCAPE_MAP[str] + ';';
16181
- });
16226
+ function escapeBody(str) {
16227
+ return escape(str, ESCAPE_CHARS, ESCAPE_MAP);
16182
16228
  }
16183
16229
 
16184
16230
  function filterAttributes(props) {
@@ -16208,18 +16254,13 @@ ReferenceSerializer.prototype.serializeTo = function(writer) {
16208
16254
 
16209
16255
  function BodySerializer() {}
16210
16256
 
16211
- BodySerializer.prototype.serializeValue = BodySerializer.prototype.serializeTo = function(writer) {
16212
- var escape = this.escape;
16213
-
16214
- if (escape) {
16215
- writer.append('<![CDATA[');
16216
- }
16217
-
16218
- writer.append(this.value);
16219
-
16220
- if (escape) {
16221
- writer.append(']]>');
16222
- }
16257
+ BodySerializer.prototype.serializeValue =
16258
+ BodySerializer.prototype.serializeTo = function(writer) {
16259
+ writer.append(
16260
+ this.escape
16261
+ ? escapeBody(this.value)
16262
+ : this.value
16263
+ );
16223
16264
  };
16224
16265
 
16225
16266
  BodySerializer.prototype.build = function(prop, value) {
@@ -18452,7 +18493,14 @@ module.exports = Refs;
18452
18493
  for (j = i + 1; j < l; j++) {
18453
18494
  w = s.charCodeAt(j);
18454
18495
 
18455
- if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95) {
18496
+ if (
18497
+ w > 96 && w < 123 ||
18498
+ w > 64 && w < 91 ||
18499
+ w > 47 && w < 59 ||
18500
+ w === 46 || // '.'
18501
+ w === 45 || // '-'
18502
+ w === 95 // '_'
18503
+ ) {
18456
18504
  continue;
18457
18505
  }
18458
18506
 
@@ -19196,771 +19244,784 @@ else {
19196
19244
  } )( this );
19197
19245
 
19198
19246
  },{}],91:[function(_dereq_,module,exports){
19199
- /**
19200
- * append utility
19201
- */
19247
+ (function (global, factory) {
19248
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
19249
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
19250
+ (factory((global.TinySVG = {})));
19251
+ }(this, (function (exports) { 'use strict';
19202
19252
 
19203
- module.exports = append;
19253
+ function ensureImported(element, target) {
19204
19254
 
19205
- var appendTo = _dereq_(92);
19255
+ if (element.ownerDocument !== target.ownerDocument) {
19256
+ try {
19257
+ // may fail on webkit
19258
+ return target.ownerDocument.importNode(element, true);
19259
+ } catch (e) {
19260
+ // ignore
19261
+ }
19262
+ }
19206
19263
 
19207
- /**
19208
- * Append a node to an element
19209
- *
19210
- * @param {SVGElement} element
19211
- * @param {SVGElement} node
19212
- *
19213
- * @return {SVGElement} the element
19214
- */
19215
- function append(element, node) {
19216
- appendTo(node, element);
19217
- return element;
19218
- }
19219
- },{"92":92}],92:[function(_dereq_,module,exports){
19220
- /**
19221
- * appendTo utility
19222
- */
19223
- module.exports = appendTo;
19264
+ return element;
19265
+ }
19224
19266
 
19225
- var ensureImported = _dereq_(101);
19267
+ /**
19268
+ * appendTo utility
19269
+ */
19226
19270
 
19227
- /**
19228
- * Append a node to a target element and return the appended node.
19229
- *
19230
- * @param {SVGElement} element
19231
- * @param {SVGElement} node
19232
- *
19233
- * @return {SVGElement} the appended node
19234
- */
19235
- function appendTo(element, target) {
19236
- target.appendChild(ensureImported(element, target));
19237
- return element;
19238
- }
19239
- },{"101":101}],93:[function(_dereq_,module,exports){
19240
- /**
19241
- * attribute accessor utility
19242
- */
19243
-
19244
- module.exports = attr;
19245
-
19246
-
19247
- var LENGTH_ATTR = 2;
19248
-
19249
- var CSS_PROPERTIES = {
19250
- 'alignment-baseline': 1,
19251
- 'baseline-shift': 1,
19252
- 'clip': 1,
19253
- 'clip-path': 1,
19254
- 'clip-rule': 1,
19255
- 'color': 1,
19256
- 'color-interpolation': 1,
19257
- 'color-interpolation-filters': 1,
19258
- 'color-profile': 1,
19259
- 'color-rendering': 1,
19260
- 'cursor': 1,
19261
- 'direction': 1,
19262
- 'display': 1,
19263
- 'dominant-baseline': 1,
19264
- 'enable-background': 1,
19265
- 'fill': 1,
19266
- 'fill-opacity': 1,
19267
- 'fill-rule': 1,
19268
- 'filter': 1,
19269
- 'flood-color': 1,
19270
- 'flood-opacity': 1,
19271
- 'font': 1,
19272
- 'font-family': 1,
19273
- 'font-size': LENGTH_ATTR,
19274
- 'font-size-adjust': 1,
19275
- 'font-stretch': 1,
19276
- 'font-style': 1,
19277
- 'font-variant': 1,
19278
- 'font-weight': 1,
19279
- 'glyph-orientation-horizontal': 1,
19280
- 'glyph-orientation-vertical': 1,
19281
- 'image-rendering': 1,
19282
- 'kerning': 1,
19283
- 'letter-spacing': 1,
19284
- 'lighting-color': 1,
19285
- 'marker': 1,
19286
- 'marker-end': 1,
19287
- 'marker-mid': 1,
19288
- 'marker-start': 1,
19289
- 'mask': 1,
19290
- 'opacity': 1,
19291
- 'overflow': 1,
19292
- 'pointer-events': 1,
19293
- 'shape-rendering': 1,
19294
- 'stop-color': 1,
19295
- 'stop-opacity': 1,
19296
- 'stroke': 1,
19297
- 'stroke-dasharray': 1,
19298
- 'stroke-dashoffset': 1,
19299
- 'stroke-linecap': 1,
19300
- 'stroke-linejoin': 1,
19301
- 'stroke-miterlimit': 1,
19302
- 'stroke-opacity': 1,
19303
- 'stroke-width': LENGTH_ATTR,
19304
- 'text-anchor': 1,
19305
- 'text-decoration': 1,
19306
- 'text-rendering': 1,
19307
- 'unicode-bidi': 1,
19308
- 'visibility': 1,
19309
- 'word-spacing': 1,
19310
- 'writing-mode': 1
19311
- };
19312
-
19313
-
19314
- function getAttribute(node, name) {
19315
- if (CSS_PROPERTIES[name]) {
19316
- return node.style[name];
19317
- } else {
19318
- return node.getAttributeNS(null, name);
19271
+ /**
19272
+ * Append a node to a target element and return the appended node.
19273
+ *
19274
+ * @param {SVGElement} element
19275
+ * @param {SVGElement} node
19276
+ *
19277
+ * @return {SVGElement} the appended node
19278
+ */
19279
+ function appendTo(element, target) {
19280
+ target.appendChild(ensureImported(element, target));
19281
+ return element;
19282
+ }
19283
+
19284
+ /**
19285
+ * append utility
19286
+ */
19287
+
19288
+ /**
19289
+ * Append a node to an element
19290
+ *
19291
+ * @param {SVGElement} element
19292
+ * @param {SVGElement} node
19293
+ *
19294
+ * @return {SVGElement} the element
19295
+ */
19296
+ function append(element, node) {
19297
+ appendTo(node, element);
19298
+ return element;
19319
19299
  }
19320
- }
19321
19300
 
19322
- function setAttribute(node, name, value) {
19323
- var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
19301
+ /**
19302
+ * attribute accessor utility
19303
+ */
19304
+
19305
+ var LENGTH_ATTR = 2;
19306
+
19307
+ var CSS_PROPERTIES = {
19308
+ 'alignment-baseline': 1,
19309
+ 'baseline-shift': 1,
19310
+ 'clip': 1,
19311
+ 'clip-path': 1,
19312
+ 'clip-rule': 1,
19313
+ 'color': 1,
19314
+ 'color-interpolation': 1,
19315
+ 'color-interpolation-filters': 1,
19316
+ 'color-profile': 1,
19317
+ 'color-rendering': 1,
19318
+ 'cursor': 1,
19319
+ 'direction': 1,
19320
+ 'display': 1,
19321
+ 'dominant-baseline': 1,
19322
+ 'enable-background': 1,
19323
+ 'fill': 1,
19324
+ 'fill-opacity': 1,
19325
+ 'fill-rule': 1,
19326
+ 'filter': 1,
19327
+ 'flood-color': 1,
19328
+ 'flood-opacity': 1,
19329
+ 'font': 1,
19330
+ 'font-family': 1,
19331
+ 'font-size': LENGTH_ATTR,
19332
+ 'font-size-adjust': 1,
19333
+ 'font-stretch': 1,
19334
+ 'font-style': 1,
19335
+ 'font-variant': 1,
19336
+ 'font-weight': 1,
19337
+ 'glyph-orientation-horizontal': 1,
19338
+ 'glyph-orientation-vertical': 1,
19339
+ 'image-rendering': 1,
19340
+ 'kerning': 1,
19341
+ 'letter-spacing': 1,
19342
+ 'lighting-color': 1,
19343
+ 'marker': 1,
19344
+ 'marker-end': 1,
19345
+ 'marker-mid': 1,
19346
+ 'marker-start': 1,
19347
+ 'mask': 1,
19348
+ 'opacity': 1,
19349
+ 'overflow': 1,
19350
+ 'pointer-events': 1,
19351
+ 'shape-rendering': 1,
19352
+ 'stop-color': 1,
19353
+ 'stop-opacity': 1,
19354
+ 'stroke': 1,
19355
+ 'stroke-dasharray': 1,
19356
+ 'stroke-dashoffset': 1,
19357
+ 'stroke-linecap': 1,
19358
+ 'stroke-linejoin': 1,
19359
+ 'stroke-miterlimit': 1,
19360
+ 'stroke-opacity': 1,
19361
+ 'stroke-width': LENGTH_ATTR,
19362
+ 'text-anchor': 1,
19363
+ 'text-decoration': 1,
19364
+ 'text-rendering': 1,
19365
+ 'unicode-bidi': 1,
19366
+ 'visibility': 1,
19367
+ 'word-spacing': 1,
19368
+ 'writing-mode': 1
19369
+ };
19324
19370
 
19325
- var type = CSS_PROPERTIES[hyphenated];
19326
19371
 
19327
- if (type) {
19328
- // append pixel unit, unless present
19329
- if (type === LENGTH_ATTR && typeof value === 'number') {
19330
- value = String(value) + 'px';
19372
+ function getAttribute(node, name) {
19373
+ if (CSS_PROPERTIES[name]) {
19374
+ return node.style[name];
19375
+ } else {
19376
+ return node.getAttributeNS(null, name);
19331
19377
  }
19378
+ }
19332
19379
 
19333
- node.style[hyphenated] = value;
19334
- } else {
19335
- node.setAttributeNS(null, name, value);
19380
+ function setAttribute(node, name, value) {
19381
+ var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
19382
+
19383
+ var type = CSS_PROPERTIES[hyphenated];
19384
+
19385
+ if (type) {
19386
+ // append pixel unit, unless present
19387
+ if (type === LENGTH_ATTR && typeof value === 'number') {
19388
+ value = String(value) + 'px';
19389
+ }
19390
+
19391
+ node.style[hyphenated] = value;
19392
+ } else {
19393
+ node.setAttributeNS(null, name, value);
19394
+ }
19336
19395
  }
19337
- }
19338
19396
 
19339
- function setAttributes(node, attrs) {
19397
+ function setAttributes(node, attrs) {
19340
19398
 
19341
- var names = Object.keys(attrs), i, name;
19399
+ var names = Object.keys(attrs), i, name;
19342
19400
 
19343
- for (i = 0, name; (name = names[i]); i++) {
19344
- setAttribute(node, name, attrs[name]);
19401
+ for (i = 0, name; (name = names[i]); i++) {
19402
+ setAttribute(node, name, attrs[name]);
19403
+ }
19345
19404
  }
19346
- }
19347
19405
 
19348
- /**
19349
- * Gets or sets raw attributes on a node.
19350
- *
19351
- * @param {SVGElement} node
19352
- * @param {Object} [attrs]
19353
- * @param {String} [name]
19354
- * @param {String} [value]
19355
- *
19356
- * @return {String}
19357
- */
19358
- function attr(node, name, value) {
19359
- if (typeof name === 'string') {
19360
- if (value !== undefined) {
19361
- setAttribute(node, name, value);
19406
+ /**
19407
+ * Gets or sets raw attributes on a node.
19408
+ *
19409
+ * @param {SVGElement} node
19410
+ * @param {Object} [attrs]
19411
+ * @param {String} [name]
19412
+ * @param {String} [value]
19413
+ *
19414
+ * @return {String}
19415
+ */
19416
+ function attr(node, name, value) {
19417
+ if (typeof name === 'string') {
19418
+ if (value !== undefined) {
19419
+ setAttribute(node, name, value);
19420
+ } else {
19421
+ return getAttribute(node, name);
19422
+ }
19362
19423
  } else {
19363
- return getAttribute(node, name);
19424
+ setAttributes(node, name);
19364
19425
  }
19365
- } else {
19366
- setAttributes(node, name);
19367
- }
19368
19426
 
19369
- return node;
19370
- }
19427
+ return node;
19428
+ }
19371
19429
 
19372
- },{}],94:[function(_dereq_,module,exports){
19373
- /**
19374
- * Clear utility
19375
- */
19376
- module.exports = classes;
19377
-
19378
- var index = function(arr, obj) {
19379
- if (arr.indexOf) {
19380
- return arr.indexOf(obj);
19381
- }
19382
-
19383
-
19384
- for (var i = 0; i < arr.length; ++i) {
19385
- if (arr[i] === obj) {
19386
- return i;
19430
+ /**
19431
+ * Clear utility
19432
+ */
19433
+ function index(arr, obj) {
19434
+ if (arr.indexOf) {
19435
+ return arr.indexOf(obj);
19387
19436
  }
19388
- }
19389
19437
 
19390
- return -1;
19391
- };
19392
19438
 
19393
- var re = /\s+/;
19439
+ for (var i = 0; i < arr.length; ++i) {
19440
+ if (arr[i] === obj) {
19441
+ return i;
19442
+ }
19443
+ }
19394
19444
 
19395
- var toString = Object.prototype.toString;
19445
+ return -1;
19446
+ }
19396
19447
 
19397
- function defined(o) {
19398
- return typeof o !== 'undefined';
19399
- }
19448
+ var re = /\s+/;
19400
19449
 
19401
- /**
19402
- * Wrap `el` in a `ClassList`.
19403
- *
19404
- * @param {Element} el
19405
- * @return {ClassList}
19406
- * @api public
19407
- */
19450
+ var toString = Object.prototype.toString;
19408
19451
 
19409
- function classes(el) {
19410
- return new ClassList(el);
19411
- }
19412
-
19413
- function ClassList(el) {
19414
- if (!el || !el.nodeType) {
19415
- throw new Error('A DOM element reference is required');
19452
+ function defined(o) {
19453
+ return typeof o !== 'undefined';
19416
19454
  }
19417
- this.el = el;
19418
- this.list = el.classList;
19419
- }
19420
19455
 
19421
- /**
19422
- * Add class `name` if not already present.
19423
- *
19424
- * @param {String} name
19425
- * @return {ClassList}
19426
- * @api public
19427
- */
19456
+ /**
19457
+ * Wrap `el` in a `ClassList`.
19458
+ *
19459
+ * @param {Element} el
19460
+ * @return {ClassList}
19461
+ * @api public
19462
+ */
19428
19463
 
19429
- ClassList.prototype.add = function(name) {
19430
-
19431
- // classList
19432
- if (this.list) {
19433
- this.list.add(name);
19434
- return this;
19464
+ function classes(el) {
19465
+ return new ClassList(el);
19435
19466
  }
19436
19467
 
19437
- // fallback
19438
- var arr = this.array();
19439
- var i = index(arr, name);
19440
- if (!~i) {
19441
- arr.push(name);
19468
+ function ClassList(el) {
19469
+ if (!el || !el.nodeType) {
19470
+ throw new Error('A DOM element reference is required');
19471
+ }
19472
+ this.el = el;
19473
+ this.list = el.classList;
19442
19474
  }
19443
19475
 
19444
- if (defined(this.el.className.baseVal)) {
19445
- this.el.className.baseVal = arr.join(' ');
19446
- } else {
19447
- this.el.className = arr.join(' ');
19448
- }
19476
+ /**
19477
+ * Add class `name` if not already present.
19478
+ *
19479
+ * @param {String} name
19480
+ * @return {ClassList}
19481
+ * @api public
19482
+ */
19449
19483
 
19450
- return this;
19451
- };
19484
+ ClassList.prototype.add = function(name) {
19452
19485
 
19453
- /**
19454
- * Remove class `name` when present, or
19455
- * pass a regular expression to remove
19456
- * any which match.
19457
- *
19458
- * @param {String|RegExp} name
19459
- * @return {ClassList}
19460
- * @api public
19461
- */
19486
+ // classList
19487
+ if (this.list) {
19488
+ this.list.add(name);
19489
+ return this;
19490
+ }
19462
19491
 
19463
- ClassList.prototype.remove = function(name) {
19464
- if ('[object RegExp]' === toString.call(name)) {
19465
- return this.removeMatching(name);
19466
- }
19492
+ // fallback
19493
+ var arr = this.array();
19494
+ var i = index(arr, name);
19495
+ if (!~i) {
19496
+ arr.push(name);
19497
+ }
19498
+
19499
+ if (defined(this.el.className.baseVal)) {
19500
+ this.el.className.baseVal = arr.join(' ');
19501
+ } else {
19502
+ this.el.className = arr.join(' ');
19503
+ }
19467
19504
 
19468
- // classList
19469
- if (this.list) {
19470
- this.list.remove(name);
19471
19505
  return this;
19472
- }
19506
+ };
19473
19507
 
19474
- // fallback
19475
- var arr = this.array();
19476
- var i = index(arr, name);
19477
- if (~i) {
19478
- arr.splice(i, 1);
19479
- }
19480
- this.el.className.baseVal = arr.join(' ');
19481
- return this;
19482
- };
19508
+ /**
19509
+ * Remove class `name` when present, or
19510
+ * pass a regular expression to remove
19511
+ * any which match.
19512
+ *
19513
+ * @param {String|RegExp} name
19514
+ * @return {ClassList}
19515
+ * @api public
19516
+ */
19483
19517
 
19484
- /**
19485
- * Remove all classes matching `re`.
19486
- *
19487
- * @param {RegExp} re
19488
- * @return {ClassList}
19489
- * @api private
19490
- */
19518
+ ClassList.prototype.remove = function(name) {
19519
+ if ('[object RegExp]' === toString.call(name)) {
19520
+ return this.removeMatching(name);
19521
+ }
19491
19522
 
19492
- ClassList.prototype.removeMatching = function(re) {
19493
- var arr = this.array();
19494
- for (var i = 0; i < arr.length; i++) {
19495
- if (re.test(arr[i])) {
19496
- this.remove(arr[i]);
19523
+ // classList
19524
+ if (this.list) {
19525
+ this.list.remove(name);
19526
+ return this;
19497
19527
  }
19498
- }
19499
- return this;
19500
- };
19501
19528
 
19502
- /**
19503
- * Toggle class `name`, can force state via `force`.
19504
- *
19505
- * For browsers that support classList, but do not support `force` yet,
19506
- * the mistake will be detected and corrected.
19507
- *
19508
- * @param {String} name
19509
- * @param {Boolean} force
19510
- * @return {ClassList}
19511
- * @api public
19512
- */
19529
+ // fallback
19530
+ var arr = this.array();
19531
+ var i = index(arr, name);
19532
+ if (~i) {
19533
+ arr.splice(i, 1);
19534
+ }
19535
+ this.el.className.baseVal = arr.join(' ');
19536
+ return this;
19537
+ };
19513
19538
 
19514
- ClassList.prototype.toggle = function(name, force) {
19515
- // classList
19516
- if (this.list) {
19517
- if (defined(force)) {
19518
- if (force !== this.list.toggle(name, force)) {
19519
- this.list.toggle(name); // toggle again to correct
19539
+ /**
19540
+ * Remove all classes matching `re`.
19541
+ *
19542
+ * @param {RegExp} re
19543
+ * @return {ClassList}
19544
+ * @api private
19545
+ */
19546
+
19547
+ ClassList.prototype.removeMatching = function(re) {
19548
+ var arr = this.array();
19549
+ for (var i = 0; i < arr.length; i++) {
19550
+ if (re.test(arr[i])) {
19551
+ this.remove(arr[i]);
19520
19552
  }
19521
- } else {
19522
- this.list.toggle(name);
19523
19553
  }
19524
19554
  return this;
19525
- }
19555
+ };
19526
19556
 
19527
- // fallback
19528
- if (defined(force)) {
19529
- if (!force) {
19530
- this.remove(name);
19531
- } else {
19532
- this.add(name);
19557
+ /**
19558
+ * Toggle class `name`, can force state via `force`.
19559
+ *
19560
+ * For browsers that support classList, but do not support `force` yet,
19561
+ * the mistake will be detected and corrected.
19562
+ *
19563
+ * @param {String} name
19564
+ * @param {Boolean} force
19565
+ * @return {ClassList}
19566
+ * @api public
19567
+ */
19568
+
19569
+ ClassList.prototype.toggle = function(name, force) {
19570
+ // classList
19571
+ if (this.list) {
19572
+ if (defined(force)) {
19573
+ if (force !== this.list.toggle(name, force)) {
19574
+ this.list.toggle(name); // toggle again to correct
19575
+ }
19576
+ } else {
19577
+ this.list.toggle(name);
19578
+ }
19579
+ return this;
19533
19580
  }
19534
- } else {
19535
- if (this.has(name)) {
19536
- this.remove(name);
19581
+
19582
+ // fallback
19583
+ if (defined(force)) {
19584
+ if (!force) {
19585
+ this.remove(name);
19586
+ } else {
19587
+ this.add(name);
19588
+ }
19537
19589
  } else {
19538
- this.add(name);
19590
+ if (this.has(name)) {
19591
+ this.remove(name);
19592
+ } else {
19593
+ this.add(name);
19594
+ }
19539
19595
  }
19540
- }
19541
19596
 
19542
- return this;
19543
- };
19597
+ return this;
19598
+ };
19544
19599
 
19545
- /**
19546
- * Return an array of classes.
19547
- *
19548
- * @return {Array}
19549
- * @api public
19550
- */
19600
+ /**
19601
+ * Return an array of classes.
19602
+ *
19603
+ * @return {Array}
19604
+ * @api public
19605
+ */
19551
19606
 
19552
- ClassList.prototype.array = function() {
19553
- var className = this.el.getAttribute('class') || '';
19554
- var str = className.replace(/^\s+|\s+$/g, '');
19555
- var arr = str.split(re);
19556
- if ('' === arr[0]) {
19557
- arr.shift();
19558
- }
19559
- return arr;
19560
- };
19607
+ ClassList.prototype.array = function() {
19608
+ var className = this.el.getAttribute('class') || '';
19609
+ var str = className.replace(/^\s+|\s+$/g, '');
19610
+ var arr = str.split(re);
19611
+ if ('' === arr[0]) {
19612
+ arr.shift();
19613
+ }
19614
+ return arr;
19615
+ };
19561
19616
 
19562
- /**
19563
- * Check if class `name` is present.
19564
- *
19565
- * @param {String} name
19566
- * @return {ClassList}
19567
- * @api public
19568
- */
19617
+ /**
19618
+ * Check if class `name` is present.
19619
+ *
19620
+ * @param {String} name
19621
+ * @return {ClassList}
19622
+ * @api public
19623
+ */
19569
19624
 
19570
- ClassList.prototype.has =
19571
- ClassList.prototype.contains = function(name) {
19572
- return (
19573
- this.list ?
19574
- this.list.contains(name) :
19575
- !! ~index(this.array(), name)
19576
- );
19577
- };
19578
-
19579
- },{}],95:[function(_dereq_,module,exports){
19580
- /**
19581
- * Clear utility
19582
- */
19583
-
19584
- module.exports = clear;
19585
-
19625
+ ClassList.prototype.has =
19626
+ ClassList.prototype.contains = function(name) {
19627
+ return (
19628
+ this.list ?
19629
+ this.list.contains(name) :
19630
+ !! ~index(this.array(), name)
19631
+ );
19632
+ };
19586
19633
 
19587
- var remove = _dereq_(99);
19634
+ function remove(element) {
19635
+ var parent = element.parentNode;
19588
19636
 
19589
- /**
19590
- * Removes all children from the given element
19591
- *
19592
- * @param {DOMElement} element
19593
- * @return {DOMElement} the element (for chaining)
19594
- */
19595
- function clear(element) {
19596
- var child;
19637
+ if (parent) {
19638
+ parent.removeChild(element);
19639
+ }
19597
19640
 
19598
- while ((child = element.firstChild)) {
19599
- remove(child);
19641
+ return element;
19600
19642
  }
19601
19643
 
19602
- return element;
19603
- }
19604
- },{"99":99}],96:[function(_dereq_,module,exports){
19605
- /**
19606
- * Create utility for SVG elements
19607
- */
19608
-
19609
- module.exports = create;
19610
-
19611
-
19612
- var attr = _dereq_(93);
19613
- var parse = _dereq_(103);
19614
- var ns = _dereq_(102);
19644
+ /**
19645
+ * Clear utility
19646
+ */
19615
19647
 
19648
+ /**
19649
+ * Removes all children from the given element
19650
+ *
19651
+ * @param {DOMElement} element
19652
+ * @return {DOMElement} the element (for chaining)
19653
+ */
19654
+ function clear(element) {
19655
+ var child;
19616
19656
 
19617
- /**
19618
- * Create a specific type from name or SVG markup.
19619
- *
19620
- * @param {String} name the name or markup of the element
19621
- * @param {Object} [attrs] attributes to set on the element
19622
- *
19623
- * @returns {SVGElement}
19624
- */
19625
- function create(name, attrs) {
19626
- var element;
19657
+ while ((child = element.firstChild)) {
19658
+ remove(child);
19659
+ }
19627
19660
 
19628
- if (name.charAt(0) === '<') {
19629
- element = parse(name).firstChild;
19630
- element = document.importNode(element, true);
19631
- } else {
19632
- element = document.createElementNS(ns.svg, name);
19661
+ return element;
19633
19662
  }
19634
19663
 
19635
- if (attrs) {
19636
- attr(element, attrs);
19664
+ function clone(element) {
19665
+ return element.cloneNode(true);
19637
19666
  }
19638
19667
 
19639
- return element;
19640
- }
19641
- },{"102":102,"103":103,"93":93}],97:[function(_dereq_,module,exports){
19642
- /**
19643
- * Geometry helpers
19644
- */
19668
+ var ns = {
19669
+ svg: 'http://www.w3.org/2000/svg'
19670
+ };
19645
19671
 
19672
+ /**
19673
+ * DOM parsing utility
19674
+ */
19646
19675
 
19647
- var create = _dereq_(96);
19676
+ var SVG_START = '<svg xmlns="' + ns.svg + '"';
19648
19677
 
19649
- // fake node used to instantiate svg geometry elements
19650
- var node = create('svg');
19678
+ function parse(svg) {
19651
19679
 
19652
- function extend(object, props) {
19653
- var i, k, keys = Object.keys(props);
19680
+ // ensure we import a valid svg document
19681
+ if (svg.substring(0, 4) === '<svg') {
19682
+ if (svg.indexOf(ns.svg) === -1) {
19683
+ svg = SVG_START + svg.substring(4);
19684
+ }
19685
+ } else {
19686
+ // namespace svg
19687
+ svg = SVG_START + '>' + svg + '</svg>';
19688
+ }
19654
19689
 
19655
- for (i = 0; (k = keys[i]); i++) {
19656
- object[k] = props[k];
19690
+ return parseDocument(svg);
19657
19691
  }
19658
19692
 
19659
- return object;
19660
- }
19693
+ function parseDocument(svg) {
19661
19694
 
19695
+ var parser;
19662
19696
 
19663
- function createPoint(x, y) {
19664
- var point = node.createSVGPoint();
19697
+ // parse
19698
+ parser = new DOMParser();
19699
+ parser.async = false;
19665
19700
 
19666
- switch (arguments.length) {
19667
- case 0:
19668
- return point;
19669
- case 2:
19670
- x = {
19671
- x: x,
19672
- y: y
19673
- };
19674
- break;
19701
+ return parser.parseFromString(svg, 'text/xml');
19675
19702
  }
19676
19703
 
19677
- return extend(point, x);
19678
- }
19704
+ /**
19705
+ * Create utility for SVG elements
19706
+ */
19679
19707
 
19680
- function createMatrix(a, b, c, d, e, f) {
19681
- var matrix = node.createSVGMatrix();
19682
-
19683
- switch (arguments.length) {
19684
- case 0:
19685
- return matrix;
19686
- case 6:
19687
- a = {
19688
- a: a,
19689
- b: b,
19690
- c: c,
19691
- d: d,
19692
- e: e,
19693
- f: f
19694
- };
19695
- break;
19696
- }
19697
19708
 
19698
- return extend(matrix, a);
19699
- }
19709
+ /**
19710
+ * Create a specific type from name or SVG markup.
19711
+ *
19712
+ * @param {String} name the name or markup of the element
19713
+ * @param {Object} [attrs] attributes to set on the element
19714
+ *
19715
+ * @returns {SVGElement}
19716
+ */
19717
+ function create(name, attrs) {
19718
+ var element;
19700
19719
 
19701
- function createTransform(matrix) {
19702
- if (matrix) {
19703
- return node.createSVGTransformFromMatrix(matrix);
19704
- } else {
19705
- return node.createSVGTransform();
19706
- }
19707
- }
19720
+ if (name.charAt(0) === '<') {
19721
+ element = parse(name).firstChild;
19722
+ element = document.importNode(element, true);
19723
+ } else {
19724
+ element = document.createElementNS(ns.svg, name);
19725
+ }
19708
19726
 
19727
+ if (attrs) {
19728
+ attr(element, attrs);
19729
+ }
19709
19730
 
19710
- module.exports.createTransform = createTransform;
19711
- module.exports.createMatrix = createMatrix;
19712
- module.exports.createPoint = createPoint;
19713
- },{"96":96}],98:[function(_dereq_,module,exports){
19714
- /**
19715
- * innerHTML like functionality for SVG elements.
19716
- * based on innerSVG (https://code.google.com/p/innersvg)
19717
- */
19731
+ return element;
19732
+ }
19718
19733
 
19719
- module.exports = innerSVG;
19734
+ /**
19735
+ * Events handling utility
19736
+ */
19720
19737
 
19738
+ function on(node, event, listener, useCapture) {
19739
+ node.addEventListener(event, listener, useCapture);
19740
+ }
19721
19741
 
19722
- var clear = _dereq_(95);
19723
- var appendTo = _dereq_(92);
19724
- var parse = _dereq_(103);
19725
- var serialize = _dereq_(104);
19742
+ function off(node, event, listener, useCapture) {
19743
+ node.removeEventListener(event, listener, useCapture);
19744
+ }
19726
19745
 
19746
+ /**
19747
+ * Geometry helpers
19748
+ */
19727
19749
 
19728
- function set(element, svg) {
19750
+ // fake node used to instantiate svg geometry elements
19751
+ var node = create('svg');
19729
19752
 
19730
- var node,
19731
- documentElement = parse(svg).documentElement;
19753
+ function extend(object, props) {
19754
+ var i, k, keys = Object.keys(props);
19732
19755
 
19733
- // clear element contents
19734
- clear(element);
19756
+ for (i = 0; (k = keys[i]); i++) {
19757
+ object[k] = props[k];
19758
+ }
19735
19759
 
19736
- if (!svg) {
19737
- return;
19760
+ return object;
19738
19761
  }
19739
19762
 
19740
- // import + append each node
19741
- node = documentElement.firstChild;
19742
19763
 
19743
- while (node) {
19744
- appendTo(node, element);
19745
- node = node.nextSibling;
19746
- }
19747
- }
19764
+ function createPoint(x, y) {
19765
+ var point = node.createSVGPoint();
19748
19766
 
19749
- function get(element) {
19750
- var child = element.firstChild,
19751
- output = [];
19767
+ switch (arguments.length) {
19768
+ case 0:
19769
+ return point;
19770
+ case 2:
19771
+ x = {
19772
+ x: x,
19773
+ y: y
19774
+ };
19775
+ break;
19776
+ }
19752
19777
 
19753
- while (child) {
19754
- serialize(child, output);
19755
- child = child.nextSibling;
19778
+ return extend(point, x);
19756
19779
  }
19757
19780
 
19758
- return output.join('');
19759
- }
19781
+ function createMatrix(a, b, c, d, e, f) {
19782
+ var matrix = node.createSVGMatrix();
19760
19783
 
19761
- function innerSVG(element, svg) {
19784
+ switch (arguments.length) {
19785
+ case 0:
19786
+ return matrix;
19787
+ case 6:
19788
+ a = {
19789
+ a: a,
19790
+ b: b,
19791
+ c: c,
19792
+ d: d,
19793
+ e: e,
19794
+ f: f
19795
+ };
19796
+ break;
19797
+ }
19762
19798
 
19763
- if (svg !== undefined) {
19799
+ return extend(matrix, a);
19800
+ }
19764
19801
 
19765
- try {
19766
- set(element, svg);
19767
- } catch (e) {
19768
- throw new Error('error parsing SVG: ' + e.message);
19802
+ function createTransform(matrix) {
19803
+ if (matrix) {
19804
+ return node.createSVGTransformFromMatrix(matrix);
19805
+ } else {
19806
+ return node.createSVGTransform();
19769
19807
  }
19770
-
19771
- return element;
19772
- } else {
19773
- return get(element);
19774
19808
  }
19775
- }
19776
- },{"103":103,"104":104,"92":92,"95":95}],99:[function(_dereq_,module,exports){
19777
- module.exports = remove;
19778
19809
 
19779
- function remove(element) {
19780
- var parent = element.parentNode;
19810
+ /**
19811
+ * Serialization util
19812
+ */
19781
19813
 
19782
- if (parent) {
19783
- parent.removeChild(element);
19784
- }
19814
+ var TEXT_ENTITIES = /([&<>]{1})/g;
19815
+ var ATTR_ENTITIES = /([\n\r"]{1})/g;
19785
19816
 
19786
- return element;
19787
- }
19788
- },{}],100:[function(_dereq_,module,exports){
19789
- /**
19790
- * transform accessor utility
19791
- */
19817
+ var ENTITY_REPLACEMENT = {
19818
+ '&': '&amp;',
19819
+ '<': '&lt;',
19820
+ '>': '&gt;',
19821
+ '"': '\''
19822
+ };
19792
19823
 
19793
- module.exports = transform;
19824
+ function escape(str, pattern) {
19794
19825
 
19795
- function wrapMatrix(transformList, transform) {
19796
- if (transform instanceof SVGMatrix) {
19797
- return transformList.createSVGTransformFromMatrix(transform);
19798
- } else {
19799
- return transform;
19826
+ function replaceFn(match, entity) {
19827
+ return ENTITY_REPLACEMENT[entity] || entity;
19828
+ }
19829
+
19830
+ return str.replace(pattern, replaceFn);
19800
19831
  }
19801
- }
19802
19832
 
19803
- function setTransforms(transformList, transforms) {
19804
- var i, t;
19833
+ function serialize(node, output) {
19805
19834
 
19806
- transformList.clear();
19835
+ var i, len, attrMap, attrNode, childNodes;
19807
19836
 
19808
- for (i = 0; (t = transforms[i]); i++) {
19809
- transformList.appendItem(wrapMatrix(transformList, t));
19810
- }
19837
+ switch (node.nodeType) {
19838
+ // TEXT
19839
+ case 3:
19840
+ // replace special XML characters
19841
+ output.push(escape(node.textContent, TEXT_ENTITIES));
19842
+ break;
19811
19843
 
19812
- transformList.consolidate();
19813
- }
19844
+ // ELEMENT
19845
+ case 1:
19846
+ output.push('<', node.tagName);
19814
19847
 
19815
- function transform(node, transforms) {
19816
- var transformList = node.transform.baseVal;
19848
+ if (node.hasAttributes()) {
19849
+ attrMap = node.attributes;
19850
+ for (i = 0, len = attrMap.length; i < len; ++i) {
19851
+ attrNode = attrMap.item(i);
19852
+ output.push(' ', attrNode.name, '="', escape(attrNode.value, ATTR_ENTITIES), '"');
19853
+ }
19854
+ }
19817
19855
 
19818
- if (arguments.length === 1) {
19819
- return transformList.consolidate();
19820
- } else {
19821
- if (transforms.length) {
19822
- setTransforms(transformList, transforms);
19823
- } else {
19824
- transformList.initialize(wrapMatrix(transformList, transforms));
19825
- }
19826
- }
19827
- }
19828
- },{}],101:[function(_dereq_,module,exports){
19829
- module.exports = ensureImported;
19856
+ if (node.hasChildNodes()) {
19857
+ output.push('>');
19858
+ childNodes = node.childNodes;
19859
+ for (i = 0, len = childNodes.length; i < len; ++i) {
19860
+ serialize(childNodes.item(i), output);
19861
+ }
19862
+ output.push('</', node.tagName, '>');
19863
+ } else {
19864
+ output.push('/>');
19865
+ }
19866
+ break;
19830
19867
 
19831
- function ensureImported(element, target) {
19868
+ // COMMENT
19869
+ case 8:
19870
+ output.push('<!--', escape(node.nodeValue, TEXT_ENTITIES), '-->');
19871
+ break;
19832
19872
 
19833
- if (element.ownerDocument !== target.ownerDocument) {
19834
- try {
19835
- // may fail on webkit
19836
- return target.ownerDocument.importNode(element, true);
19837
- } catch (e) {
19838
- // ignore
19873
+ // CDATA
19874
+ case 4:
19875
+ output.push('<![CDATA[', node.nodeValue, ']]>');
19876
+ break;
19877
+
19878
+ default:
19879
+ throw new Error('unable to handle node ' + node.nodeType);
19839
19880
  }
19881
+
19882
+ return output;
19840
19883
  }
19841
19884
 
19842
- return element;
19843
- }
19844
- },{}],102:[function(_dereq_,module,exports){
19845
- var ns = {
19846
- svg: 'http://www.w3.org/2000/svg'
19847
- };
19885
+ /**
19886
+ * innerHTML like functionality for SVG elements.
19887
+ * based on innerSVG (https://code.google.com/p/innersvg)
19888
+ */
19848
19889
 
19849
- module.exports = ns;
19850
- },{}],103:[function(_dereq_,module,exports){
19851
- /**
19852
- * DOM parsing utility
19853
- */
19854
19890
 
19855
- module.exports = parse;
19891
+ function set(element, svg) {
19856
19892
 
19893
+ var node,
19894
+ documentElement = parse(svg).documentElement;
19857
19895
 
19858
- var ns = _dereq_(102);
19896
+ // clear element contents
19897
+ clear(element);
19859
19898
 
19860
- var SVG_START = '<svg xmlns="' + ns.svg + '"';
19899
+ if (!svg) {
19900
+ return;
19901
+ }
19861
19902
 
19862
- function parse(svg) {
19903
+ // import + append each node
19904
+ node = documentElement.firstChild;
19863
19905
 
19864
- // ensure we import a valid svg document
19865
- if (svg.substring(0, 4) === '<svg') {
19866
- if (svg.indexOf(ns.svg) === -1) {
19867
- svg = SVG_START + svg.substring(4);
19906
+ while (node) {
19907
+ appendTo(node, element);
19908
+ node = node.nextSibling;
19868
19909
  }
19869
- } else {
19870
- // namespace svg
19871
- svg = SVG_START + '>' + svg + '</svg>';
19872
19910
  }
19873
19911
 
19874
- return parseDocument(svg);
19875
- }
19912
+ function get(element) {
19913
+ var child = element.firstChild,
19914
+ output = [];
19876
19915
 
19877
- function parseDocument(svg) {
19916
+ while (child) {
19917
+ serialize(child, output);
19918
+ child = child.nextSibling;
19919
+ }
19878
19920
 
19879
- var parser;
19921
+ return output.join('');
19922
+ }
19880
19923
 
19881
- // parse
19882
- parser = new DOMParser();
19883
- parser.async = false;
19924
+ function innerSVG(element, svg) {
19884
19925
 
19885
- return parser.parseFromString(svg, 'text/xml');
19886
- }
19887
- },{"102":102}],104:[function(_dereq_,module,exports){
19888
- /**
19889
- * Serialization util
19890
- */
19926
+ if (svg !== undefined) {
19891
19927
 
19892
- module.exports = serialize;
19928
+ try {
19929
+ set(element, svg);
19930
+ } catch (e) {
19931
+ throw new Error('error parsing SVG: ' + e.message);
19932
+ }
19893
19933
 
19934
+ return element;
19935
+ } else {
19936
+ return get(element);
19937
+ }
19938
+ }
19894
19939
 
19895
- var TEXT_ENTITIES = /([&<>]{1})/g;
19896
- var ATTR_ENTITIES = /([\n\r"]{1})/g;
19940
+ /**
19941
+ * Selection utilities
19942
+ */
19897
19943
 
19898
- var ENTITY_REPLACEMENT = {
19899
- '&': '&amp;',
19900
- '<': '&lt;',
19901
- '>': '&gt;',
19902
- '"': '\''
19903
- };
19944
+ function select(node, selector) {
19945
+ return node.querySelector(selector);
19946
+ }
19904
19947
 
19905
- function escape(str, pattern) {
19948
+ function selectAll(node, selector) {
19949
+ var nodes = node.querySelectorAll(selector);
19906
19950
 
19907
- function replaceFn(match, entity) {
19908
- return ENTITY_REPLACEMENT[entity] || entity;
19951
+ return [].map.call(nodes, function(element) {
19952
+ return element;
19953
+ });
19909
19954
  }
19910
19955
 
19911
- return str.replace(pattern, replaceFn);
19912
- }
19956
+ /**
19957
+ * Replace utility
19958
+ */
19913
19959
 
19914
- function serialize(node, output) {
19960
+ function replace(element, replacement) {
19961
+ element.parentNode.replaceChild(ensureImported(replacement, element), element);
19962
+ return replacement;
19963
+ }
19915
19964
 
19916
- var i, len, attrMap, attrNode, childNodes;
19965
+ /**
19966
+ * transform accessor utility
19967
+ */
19917
19968
 
19918
- switch (node.nodeType) {
19919
- // TEXT
19920
- case 3:
19921
- // replace special XML characters
19922
- output.push(escape(node.textContent, TEXT_ENTITIES));
19923
- break;
19969
+ function wrapMatrix(transformList, transform) {
19970
+ if (transform instanceof SVGMatrix) {
19971
+ return transformList.createSVGTransformFromMatrix(transform);
19972
+ } else {
19973
+ return transform;
19974
+ }
19975
+ }
19924
19976
 
19925
- // ELEMENT
19926
- case 1:
19927
- output.push('<', node.tagName);
19977
+ function setTransforms(transformList, transforms) {
19978
+ var i, t;
19928
19979
 
19929
- if (node.hasAttributes()) {
19930
- attrMap = node.attributes;
19931
- for (i = 0, len = attrMap.length; i < len; ++i) {
19932
- attrNode = attrMap.item(i);
19933
- output.push(' ', attrNode.name, '="', escape(attrNode.value, ATTR_ENTITIES), '"');
19934
- }
19980
+ transformList.clear();
19981
+
19982
+ for (i = 0; (t = transforms[i]); i++) {
19983
+ transformList.appendItem(wrapMatrix(transformList, t));
19935
19984
  }
19936
19985
 
19937
- if (node.hasChildNodes()) {
19938
- output.push('>');
19939
- childNodes = node.childNodes;
19940
- for (i = 0, len = childNodes.length; i < len; ++i) {
19941
- serialize(childNodes.item(i), output);
19942
- }
19943
- output.push('</', node.tagName, '>');
19986
+ transformList.consolidate();
19987
+ }
19988
+
19989
+ function transform(node, transforms) {
19990
+ var transformList = node.transform.baseVal;
19991
+
19992
+ if (arguments.length === 1) {
19993
+ return transformList.consolidate();
19944
19994
  } else {
19945
- output.push('/>');
19995
+ if (transforms.length) {
19996
+ setTransforms(transformList, transforms);
19997
+ } else {
19998
+ transformList.initialize(wrapMatrix(transformList, transforms));
19999
+ }
19946
20000
  }
19947
- break;
20001
+ }
19948
20002
 
19949
- // COMMENT
19950
- case 8:
19951
- output.push('<!--', escape(node.nodeValue, TEXT_ENTITIES), '-->');
19952
- break;
20003
+ exports.append = append;
20004
+ exports.appendTo = appendTo;
20005
+ exports.attr = attr;
20006
+ exports.classes = classes;
20007
+ exports.clear = clear;
20008
+ exports.clone = clone;
20009
+ exports.create = create;
20010
+ exports.innerSVG = innerSVG;
20011
+ exports.remove = remove;
20012
+ exports.replace = replace;
20013
+ exports.transform = transform;
20014
+ exports.on = on;
20015
+ exports.off = off;
20016
+ exports.createPoint = createPoint;
20017
+ exports.createMatrix = createMatrix;
20018
+ exports.createTransform = createTransform;
20019
+ exports.select = select;
20020
+ exports.selectAll = selectAll;
19953
20021
 
19954
- // CDATA
19955
- case 4:
19956
- output.push('<![CDATA[', node.nodeValue, ']]>');
19957
- break;
20022
+ Object.defineProperty(exports, '__esModule', { value: true });
19958
20023
 
19959
- default:
19960
- throw new Error('unable to handle node ' + node.nodeType);
19961
- }
20024
+ })));
19962
20025
 
19963
- return output;
19964
- }
19965
20026
  },{}]},{},[1])(1)
19966
20027
  });