@redvars/peacock 3.2.10 → 3.3.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.
- package/dist/{PeacockComponent-CxJc63xj.js → IndividualComponent-tDnXrOLV.js} +3 -3
- package/dist/IndividualComponent-tDnXrOLV.js.map +1 -0
- package/dist/{button-DaL4va7Q.js → button-BGFJfbT2.js} +22 -35
- package/dist/button-BGFJfbT2.js.map +1 -0
- package/dist/button-group.js +8 -8
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +6 -5
- package/dist/button.js.map +1 -1
- package/dist/chart-donut.js +307 -0
- package/dist/chart-donut.js.map +1 -0
- package/dist/chart-doughnut.js +307 -0
- package/dist/chart-doughnut.js.map +1 -0
- package/dist/chart-pie.js +259 -0
- package/dist/chart-pie.js.map +1 -0
- package/dist/{class-map-BvQRv7eW.js → class-map-DpeNtqCn.js} +2 -2
- package/dist/{class-map-BvQRv7eW.js.map → class-map-DpeNtqCn.js.map} +1 -1
- package/dist/clock.js +5 -6
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +37 -24
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +21 -7
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +5377 -3122
- package/dist/custom-elements.json +5527 -3940
- package/dist/{dispatch-event-utils-vbdiOSeC.js → dispatch-event-utils-B4odODQf.js} +2 -15
- package/dist/dispatch-event-utils-B4odODQf.js.map +1 -0
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +12 -10
- package/dist/number-counter.js.map +1 -1
- package/dist/{observe-theme-change-NneLARW8.js → observe-theme-change-BISF-Gl5.js} +2 -2
- package/dist/{observe-theme-change-NneLARW8.js.map → observe-theme-change-BISF-Gl5.js.map} +1 -1
- package/dist/peacock-loader.js +124 -62
- package/dist/peacock-loader.js.map +1 -1
- package/dist/query-QBcUV-L_.js +15 -0
- package/dist/query-QBcUV-L_.js.map +1 -0
- package/dist/{image-v3BujlY5.js → slider-Dk9CFWTG.js} +1606 -327
- package/dist/slider-Dk9CFWTG.js.map +1 -0
- package/dist/src/IndividualComponent.d.ts +1 -0
- package/dist/src/accordion/{accordion-item/accordion-item.d.ts → accordion-item.d.ts} +4 -4
- package/dist/src/accordion/{accordion/accordion.d.ts → accordion.d.ts} +6 -6
- package/dist/src/accordion/{accordion-item/index.d.ts → index.d.ts} +1 -0
- package/dist/src/avatar/avatar.d.ts +2 -2
- package/dist/src/badge/badge.d.ts +2 -2
- package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +7 -8
- package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +3 -3
- package/dist/src/button/button/button.d.ts +2 -2
- package/dist/src/button/button-group/button-group.d.ts +5 -5
- package/dist/src/button/icon-button/icon-button.d.ts +2 -2
- package/dist/src/chart-donut/chart-donut.d.ts +53 -0
- package/dist/src/chart-donut/index.d.ts +1 -0
- package/dist/src/chart-doughnut/chart-doughnut.d.ts +53 -0
- package/dist/src/chart-doughnut/index.d.ts +1 -0
- package/dist/src/chart-pie/chart-pie.d.ts +50 -0
- package/dist/src/chart-pie/index.d.ts +1 -0
- package/dist/src/checkbox/checkbox.d.ts +3 -6
- package/dist/src/chip/chip/chip.d.ts +4 -4
- package/dist/src/chip/tag/tag.d.ts +3 -3
- package/dist/src/clock/clock.d.ts +3 -4
- package/dist/src/code-editor/code-editor.d.ts +11 -9
- package/dist/src/container/container.d.ts +6 -11
- package/dist/src/date-picker/date-picker.d.ts +3 -3
- package/dist/src/divider/divider.d.ts +2 -2
- package/dist/src/elevation/elevation.d.ts +2 -2
- package/dist/src/empty-state/empty-state.d.ts +9 -2
- package/dist/src/field/field.d.ts +17 -0
- package/dist/src/focus-ring/focus-ring.d.ts +1 -1
- package/dist/src/icon/icon.d.ts +2 -2
- package/dist/src/image/image.d.ts +4 -12
- package/dist/src/index.d.ts +5 -1
- package/dist/src/input/input.d.ts +2 -2
- package/dist/src/link/link.d.ts +4 -5
- package/dist/src/menu/menu/menu.d.ts +16 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +12 -0
- package/dist/src/menu/menu-list/menu-list.d.ts +15 -0
- package/dist/src/number-counter/number-counter.d.ts +9 -7
- package/dist/src/number-field/number-field.d.ts +1 -1
- package/dist/src/popover/index.d.ts +1 -1
- package/dist/src/progress/circular-progress/circular-progress.d.ts +3 -3
- package/dist/src/progress/linear-progress/linear-progress.d.ts +3 -3
- package/dist/src/ripple/ripple.d.ts +60 -4
- package/dist/src/skeleton/skeleton.d.ts +6 -5
- package/dist/src/slider/index.d.ts +1 -0
- package/dist/src/slider/slider.d.ts +52 -0
- package/dist/src/spinner/spinner.d.ts +2 -2
- package/dist/src/switch/switch.d.ts +2 -2
- package/dist/src/tabs/index.d.ts +4 -0
- package/dist/src/tabs/tab-group.d.ts +41 -0
- package/dist/src/tabs/tab-panel.d.ts +21 -0
- package/dist/src/tabs/tab.d.ts +58 -0
- package/dist/src/tabs/tabs.d.ts +27 -0
- package/dist/src/textarea/textarea.d.ts +3 -3
- package/dist/src/time-picker/time-picker.d.ts +3 -3
- package/dist/src/{popover/tooltip → tooltip}/tooltip.d.ts +6 -3
- package/dist/{state-B09bP3XH.js → state-8v48Exzh.js} +2 -2
- package/dist/{state-B09bP3XH.js.map → state-8v48Exzh.js.map} +1 -1
- package/dist/{style-map-B8xgVEc9.js → style-map-CfNHEkQp.js} +2 -2
- package/dist/{style-map-B8xgVEc9.js.map → style-map-CfNHEkQp.js.map} +1 -1
- package/dist/transform-DRuHEvar.js +3312 -0
- package/dist/transform-DRuHEvar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-B-dV3Jps.js → unsafe-html-CV6Je6HL.js} +2 -2
- package/dist/{unsafe-html-B-dV3Jps.js.map → unsafe-html-CV6Je6HL.js.map} +1 -1
- package/package.json +3 -1
- package/readme.md +2 -2
- package/src/{PeacockComponent.ts → IndividualComponent.ts} +1 -1
- package/src/accordion/{accordion-item/accordion-item.scss → accordion-item.scss} +1 -1
- package/src/accordion/{accordion-item/accordion-item.ts → accordion-item.ts} +5 -5
- package/src/accordion/{accordion/accordion.scss → accordion.scss} +2 -1
- package/src/accordion/{accordion/accordion.ts → accordion.ts} +6 -6
- package/src/accordion/{accordion-item/index.ts → index.ts} +2 -0
- package/src/avatar/avatar.ts +2 -2
- package/src/badge/badge.ts +2 -2
- package/src/breadcrumb/breadcrumb/breadcrumb.ts +7 -8
- package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +3 -3
- package/src/button/BaseButton.ts +1 -1
- package/src/button/button/button.scss +9 -23
- package/src/button/button/button.ts +8 -8
- package/src/button/button-group/button-group.ts +7 -7
- package/src/button/icon-button/icon-button.ts +8 -8
- package/src/chart-donut/chart-donut.scss +37 -0
- package/src/chart-donut/chart-donut.ts +287 -0
- package/src/chart-donut/demo/index.html +51 -0
- package/src/chart-donut/index.ts +1 -0
- package/src/chart-doughnut/chart-donut.scss +37 -0
- package/src/chart-doughnut/chart-doughnut.ts +287 -0
- package/src/chart-doughnut/demo/index.html +51 -0
- package/src/chart-doughnut/index.ts +1 -0
- package/src/chart-pie/chart-pie.scss +27 -0
- package/src/chart-pie/chart-pie.ts +256 -0
- package/src/chart-pie/demo/index.html +51 -0
- package/src/chart-pie/index.ts +1 -0
- package/src/checkbox/checkbox.ts +3 -6
- package/src/chip/chip/chip.ts +6 -6
- package/src/chip/tag/tag.ts +6 -6
- package/src/clock/clock.ts +5 -6
- package/src/code-editor/code-editor.scss +3 -5
- package/src/code-editor/code-editor.ts +30 -15
- package/src/code-highlighter/code-highlighter.ts +19 -4
- package/src/container/container.ts +6 -11
- package/src/date-picker/date-picker.ts +7 -7
- package/src/divider/divider.ts +2 -2
- package/src/elevation/elevation.ts +2 -2
- package/src/empty-state/empty-state.ts +10 -3
- package/src/field/field.scss +4 -4
- package/src/field/field.ts +19 -2
- package/src/focus-ring/focus-ring.scss +2 -1
- package/src/focus-ring/focus-ring.ts +1 -1
- package/src/icon/icon.ts +2 -2
- package/src/icon/p-icon.ts +1 -1
- package/src/image/image.ts +4 -12
- package/src/index.ts +6 -2
- package/src/input/input.ts +6 -6
- package/src/link/link.ts +4 -5
- package/src/menu/menu/menu.ts +16 -0
- package/src/menu/menu-item/menu-item-colors.scss +2 -2
- package/src/menu/menu-item/menu-item.ts +14 -2
- package/src/menu/menu-list/menu-list.ts +16 -1
- package/src/number-counter/demo/index.html +1 -1
- package/src/number-counter/number-counter.ts +11 -9
- package/src/number-field/number-field.ts +7 -7
- package/src/peacock-loader.ts +71 -44
- package/src/popover/index.ts +1 -1
- package/src/progress/circular-progress/circular-progress.scss +1 -1
- package/src/progress/circular-progress/circular-progress.ts +3 -3
- package/src/progress/linear-progress/linear-progress.ts +3 -3
- package/src/ripple/ripple.ts +478 -94
- package/src/skeleton/skeleton.ts +6 -5
- package/src/slider/index.ts +1 -0
- package/src/slider/slider.scss +130 -0
- package/src/slider/slider.ts +178 -0
- package/src/spinner/spinner.ts +2 -2
- package/src/switch/switch.ts +4 -4
- package/src/tabs/index.ts +4 -0
- package/src/tabs/tab-group.scss +10 -0
- package/src/tabs/tab-group.ts +137 -0
- package/src/tabs/tab-panel.scss +12 -0
- package/src/tabs/tab-panel.ts +28 -0
- package/src/tabs/tab.scss +157 -0
- package/src/tabs/tab.ts +242 -0
- package/src/tabs/tabs.scss +18 -0
- package/src/tabs/tabs.ts +64 -0
- package/src/textarea/textarea.ts +5 -5
- package/src/time-picker/time-picker.ts +7 -7
- package/src/{popover/tooltip → tooltip}/tooltip.scss +1 -1
- package/src/{popover/tooltip → tooltip}/tooltip.ts +10 -6
- package/dist/PeacockComponent-CxJc63xj.js.map +0 -1
- package/dist/button-DaL4va7Q.js.map +0 -1
- package/dist/dispatch-event-utils-vbdiOSeC.js.map +0 -1
- package/dist/image-v3BujlY5.js.map +0 -1
- package/dist/src/PeacockComponent.d.ts +0 -1
- package/dist/src/accordion/accordion/index.d.ts +0 -1
- package/dist/src/avatar/p-avatar.d.ts +0 -3
- package/dist/src/badge/p-badge.d.ts +0 -3
- package/src/accordion/accordion/index.ts +0 -1
- package/src/avatar/p-avatar.ts +0 -5
- package/src/badge/p-badge.ts +0 -5
|
@@ -0,0 +1,3312 @@
|
|
|
1
|
+
class InternMap extends Map {
|
|
2
|
+
constructor(entries, key = keyof) {
|
|
3
|
+
super();
|
|
4
|
+
Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
|
|
5
|
+
if (entries != null) for (const [key, value] of entries) this.set(key, value);
|
|
6
|
+
}
|
|
7
|
+
get(key) {
|
|
8
|
+
return super.get(intern_get(this, key));
|
|
9
|
+
}
|
|
10
|
+
has(key) {
|
|
11
|
+
return super.has(intern_get(this, key));
|
|
12
|
+
}
|
|
13
|
+
set(key, value) {
|
|
14
|
+
return super.set(intern_set(this, key), value);
|
|
15
|
+
}
|
|
16
|
+
delete(key) {
|
|
17
|
+
return super.delete(intern_delete(this, key));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function intern_get({_intern, _key}, value) {
|
|
22
|
+
const key = _key(value);
|
|
23
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function intern_set({_intern, _key}, value) {
|
|
27
|
+
const key = _key(value);
|
|
28
|
+
if (_intern.has(key)) return _intern.get(key);
|
|
29
|
+
_intern.set(key, value);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function intern_delete({_intern, _key}, value) {
|
|
34
|
+
const key = _key(value);
|
|
35
|
+
if (_intern.has(key)) {
|
|
36
|
+
value = _intern.get(key);
|
|
37
|
+
_intern.delete(key);
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function keyof(value) {
|
|
43
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var noop = {value: () => {}};
|
|
47
|
+
|
|
48
|
+
function dispatch() {
|
|
49
|
+
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
|
|
50
|
+
if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
|
|
51
|
+
_[t] = [];
|
|
52
|
+
}
|
|
53
|
+
return new Dispatch(_);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Dispatch(_) {
|
|
57
|
+
this._ = _;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseTypenames$1(typenames, types) {
|
|
61
|
+
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
62
|
+
var name = "", i = t.indexOf(".");
|
|
63
|
+
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
|
64
|
+
if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
|
65
|
+
return {type: t, name: name};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Dispatch.prototype = dispatch.prototype = {
|
|
70
|
+
constructor: Dispatch,
|
|
71
|
+
on: function(typename, callback) {
|
|
72
|
+
var _ = this._,
|
|
73
|
+
T = parseTypenames$1(typename + "", _),
|
|
74
|
+
t,
|
|
75
|
+
i = -1,
|
|
76
|
+
n = T.length;
|
|
77
|
+
|
|
78
|
+
// If no callback was specified, return the callback of the given type and name.
|
|
79
|
+
if (arguments.length < 2) {
|
|
80
|
+
while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// If a type was specified, set the callback for the given type and name.
|
|
85
|
+
// Otherwise, if a null callback was specified, remove callbacks of the given name.
|
|
86
|
+
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
|
87
|
+
while (++i < n) {
|
|
88
|
+
if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
|
|
89
|
+
else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return this;
|
|
93
|
+
},
|
|
94
|
+
copy: function() {
|
|
95
|
+
var copy = {}, _ = this._;
|
|
96
|
+
for (var t in _) copy[t] = _[t].slice();
|
|
97
|
+
return new Dispatch(copy);
|
|
98
|
+
},
|
|
99
|
+
call: function(type, that) {
|
|
100
|
+
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
|
101
|
+
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
102
|
+
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
103
|
+
},
|
|
104
|
+
apply: function(type, that, args) {
|
|
105
|
+
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
106
|
+
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function get$1(type, name) {
|
|
111
|
+
for (var i = 0, n = type.length, c; i < n; ++i) {
|
|
112
|
+
if ((c = type[i]).name === name) {
|
|
113
|
+
return c.value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function set$1(type, name, callback) {
|
|
119
|
+
for (var i = 0, n = type.length; i < n; ++i) {
|
|
120
|
+
if (type[i].name === name) {
|
|
121
|
+
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (callback != null) type.push({name: name, value: callback});
|
|
126
|
+
return type;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var xhtml = "http://www.w3.org/1999/xhtml";
|
|
130
|
+
|
|
131
|
+
var namespaces = {
|
|
132
|
+
svg: "http://www.w3.org/2000/svg",
|
|
133
|
+
xhtml: xhtml,
|
|
134
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
135
|
+
xml: "http://www.w3.org/XML/1998/namespace",
|
|
136
|
+
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
function namespace(name) {
|
|
140
|
+
var prefix = name += "", i = prefix.indexOf(":");
|
|
141
|
+
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
|
142
|
+
return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function creatorInherit(name) {
|
|
146
|
+
return function() {
|
|
147
|
+
var document = this.ownerDocument,
|
|
148
|
+
uri = this.namespaceURI;
|
|
149
|
+
return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
|
150
|
+
? document.createElement(name)
|
|
151
|
+
: document.createElementNS(uri, name);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function creatorFixed(fullname) {
|
|
156
|
+
return function() {
|
|
157
|
+
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function creator(name) {
|
|
162
|
+
var fullname = namespace(name);
|
|
163
|
+
return (fullname.local
|
|
164
|
+
? creatorFixed
|
|
165
|
+
: creatorInherit)(fullname);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function none() {}
|
|
169
|
+
|
|
170
|
+
function selector(selector) {
|
|
171
|
+
return selector == null ? none : function() {
|
|
172
|
+
return this.querySelector(selector);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function selection_select(select) {
|
|
177
|
+
if (typeof select !== "function") select = selector(select);
|
|
178
|
+
|
|
179
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
180
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
181
|
+
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
182
|
+
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
183
|
+
subgroup[i] = subnode;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return new Selection$1(subgroups, this._parents);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Given something array like (or null), returns something that is strictly an
|
|
192
|
+
// array. This is used to ensure that array-like objects passed to d3.selectAll
|
|
193
|
+
// or selection.selectAll are converted into proper arrays when creating a
|
|
194
|
+
// selection; we don’t ever want to create a selection backed by a live
|
|
195
|
+
// HTMLCollection or NodeList. However, note that selection.selectAll will use a
|
|
196
|
+
// static NodeList as a group, since it safely derived from querySelectorAll.
|
|
197
|
+
function array$1(x) {
|
|
198
|
+
return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function empty() {
|
|
202
|
+
return [];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function selectorAll(selector) {
|
|
206
|
+
return selector == null ? empty : function() {
|
|
207
|
+
return this.querySelectorAll(selector);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function arrayAll(select) {
|
|
212
|
+
return function() {
|
|
213
|
+
return array$1(select.apply(this, arguments));
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function selection_selectAll(select) {
|
|
218
|
+
if (typeof select === "function") select = arrayAll(select);
|
|
219
|
+
else select = selectorAll(select);
|
|
220
|
+
|
|
221
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
222
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
223
|
+
if (node = group[i]) {
|
|
224
|
+
subgroups.push(select.call(node, node.__data__, i, group));
|
|
225
|
+
parents.push(node);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return new Selection$1(subgroups, parents);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function matcher(selector) {
|
|
234
|
+
return function() {
|
|
235
|
+
return this.matches(selector);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function childMatcher(selector) {
|
|
240
|
+
return function(node) {
|
|
241
|
+
return node.matches(selector);
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var find = Array.prototype.find;
|
|
246
|
+
|
|
247
|
+
function childFind(match) {
|
|
248
|
+
return function() {
|
|
249
|
+
return find.call(this.children, match);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function childFirst() {
|
|
254
|
+
return this.firstElementChild;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function selection_selectChild(match) {
|
|
258
|
+
return this.select(match == null ? childFirst
|
|
259
|
+
: childFind(typeof match === "function" ? match : childMatcher(match)));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var filter = Array.prototype.filter;
|
|
263
|
+
|
|
264
|
+
function children() {
|
|
265
|
+
return Array.from(this.children);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function childrenFilter(match) {
|
|
269
|
+
return function() {
|
|
270
|
+
return filter.call(this.children, match);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function selection_selectChildren(match) {
|
|
275
|
+
return this.selectAll(match == null ? children
|
|
276
|
+
: childrenFilter(typeof match === "function" ? match : childMatcher(match)));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function selection_filter(match) {
|
|
280
|
+
if (typeof match !== "function") match = matcher(match);
|
|
281
|
+
|
|
282
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
283
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
284
|
+
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
285
|
+
subgroup.push(node);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return new Selection$1(subgroups, this._parents);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function sparse(update) {
|
|
294
|
+
return new Array(update.length);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function selection_enter() {
|
|
298
|
+
return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function EnterNode(parent, datum) {
|
|
302
|
+
this.ownerDocument = parent.ownerDocument;
|
|
303
|
+
this.namespaceURI = parent.namespaceURI;
|
|
304
|
+
this._next = null;
|
|
305
|
+
this._parent = parent;
|
|
306
|
+
this.__data__ = datum;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
EnterNode.prototype = {
|
|
310
|
+
constructor: EnterNode,
|
|
311
|
+
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
|
|
312
|
+
insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
|
|
313
|
+
querySelector: function(selector) { return this._parent.querySelector(selector); },
|
|
314
|
+
querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
function constant$2(x) {
|
|
318
|
+
return function() {
|
|
319
|
+
return x;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function bindIndex(parent, group, enter, update, exit, data) {
|
|
324
|
+
var i = 0,
|
|
325
|
+
node,
|
|
326
|
+
groupLength = group.length,
|
|
327
|
+
dataLength = data.length;
|
|
328
|
+
|
|
329
|
+
// Put any non-null nodes that fit into update.
|
|
330
|
+
// Put any null nodes into enter.
|
|
331
|
+
// Put any remaining data into enter.
|
|
332
|
+
for (; i < dataLength; ++i) {
|
|
333
|
+
if (node = group[i]) {
|
|
334
|
+
node.__data__ = data[i];
|
|
335
|
+
update[i] = node;
|
|
336
|
+
} else {
|
|
337
|
+
enter[i] = new EnterNode(parent, data[i]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Put any non-null nodes that don’t fit into exit.
|
|
342
|
+
for (; i < groupLength; ++i) {
|
|
343
|
+
if (node = group[i]) {
|
|
344
|
+
exit[i] = node;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function bindKey(parent, group, enter, update, exit, data, key) {
|
|
350
|
+
var i,
|
|
351
|
+
node,
|
|
352
|
+
nodeByKeyValue = new Map,
|
|
353
|
+
groupLength = group.length,
|
|
354
|
+
dataLength = data.length,
|
|
355
|
+
keyValues = new Array(groupLength),
|
|
356
|
+
keyValue;
|
|
357
|
+
|
|
358
|
+
// Compute the key for each node.
|
|
359
|
+
// If multiple nodes have the same key, the duplicates are added to exit.
|
|
360
|
+
for (i = 0; i < groupLength; ++i) {
|
|
361
|
+
if (node = group[i]) {
|
|
362
|
+
keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
|
|
363
|
+
if (nodeByKeyValue.has(keyValue)) {
|
|
364
|
+
exit[i] = node;
|
|
365
|
+
} else {
|
|
366
|
+
nodeByKeyValue.set(keyValue, node);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// Compute the key for each datum.
|
|
372
|
+
// If there a node associated with this key, join and add it to update.
|
|
373
|
+
// If there is not (or the key is a duplicate), add it to enter.
|
|
374
|
+
for (i = 0; i < dataLength; ++i) {
|
|
375
|
+
keyValue = key.call(parent, data[i], i, data) + "";
|
|
376
|
+
if (node = nodeByKeyValue.get(keyValue)) {
|
|
377
|
+
update[i] = node;
|
|
378
|
+
node.__data__ = data[i];
|
|
379
|
+
nodeByKeyValue.delete(keyValue);
|
|
380
|
+
} else {
|
|
381
|
+
enter[i] = new EnterNode(parent, data[i]);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Add any remaining nodes that were not bound to data to exit.
|
|
386
|
+
for (i = 0; i < groupLength; ++i) {
|
|
387
|
+
if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {
|
|
388
|
+
exit[i] = node;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function datum(node) {
|
|
394
|
+
return node.__data__;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function selection_data(value, key) {
|
|
398
|
+
if (!arguments.length) return Array.from(this, datum);
|
|
399
|
+
|
|
400
|
+
var bind = key ? bindKey : bindIndex,
|
|
401
|
+
parents = this._parents,
|
|
402
|
+
groups = this._groups;
|
|
403
|
+
|
|
404
|
+
if (typeof value !== "function") value = constant$2(value);
|
|
405
|
+
|
|
406
|
+
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
|
407
|
+
var parent = parents[j],
|
|
408
|
+
group = groups[j],
|
|
409
|
+
groupLength = group.length,
|
|
410
|
+
data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),
|
|
411
|
+
dataLength = data.length,
|
|
412
|
+
enterGroup = enter[j] = new Array(dataLength),
|
|
413
|
+
updateGroup = update[j] = new Array(dataLength),
|
|
414
|
+
exitGroup = exit[j] = new Array(groupLength);
|
|
415
|
+
|
|
416
|
+
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
|
417
|
+
|
|
418
|
+
// Now connect the enter nodes to their following update node, such that
|
|
419
|
+
// appendChild can insert the materialized enter node before this node,
|
|
420
|
+
// rather than at the end of the parent node.
|
|
421
|
+
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
|
422
|
+
if (previous = enterGroup[i0]) {
|
|
423
|
+
if (i0 >= i1) i1 = i0 + 1;
|
|
424
|
+
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
|
425
|
+
previous._next = next || null;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
update = new Selection$1(update, parents);
|
|
431
|
+
update._enter = enter;
|
|
432
|
+
update._exit = exit;
|
|
433
|
+
return update;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Given some data, this returns an array-like view of it: an object that
|
|
437
|
+
// exposes a length property and allows numeric indexing. Note that unlike
|
|
438
|
+
// selectAll, this isn’t worried about “live” collections because the resulting
|
|
439
|
+
// array will only be used briefly while data is being bound. (It is possible to
|
|
440
|
+
// cause the data to change while iterating by using a key function, but please
|
|
441
|
+
// don’t; we’d rather avoid a gratuitous copy.)
|
|
442
|
+
function arraylike(data) {
|
|
443
|
+
return typeof data === "object" && "length" in data
|
|
444
|
+
? data // Array, TypedArray, NodeList, array-like
|
|
445
|
+
: Array.from(data); // Map, Set, iterable, string, or anything else
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function selection_exit() {
|
|
449
|
+
return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function selection_join(onenter, onupdate, onexit) {
|
|
453
|
+
var enter = this.enter(), update = this, exit = this.exit();
|
|
454
|
+
if (typeof onenter === "function") {
|
|
455
|
+
enter = onenter(enter);
|
|
456
|
+
if (enter) enter = enter.selection();
|
|
457
|
+
} else {
|
|
458
|
+
enter = enter.append(onenter + "");
|
|
459
|
+
}
|
|
460
|
+
if (onupdate != null) {
|
|
461
|
+
update = onupdate(update);
|
|
462
|
+
if (update) update = update.selection();
|
|
463
|
+
}
|
|
464
|
+
if (onexit == null) exit.remove(); else onexit(exit);
|
|
465
|
+
return enter && update ? enter.merge(update).order() : update;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function selection_merge(context) {
|
|
469
|
+
var selection = context.selection ? context.selection() : context;
|
|
470
|
+
|
|
471
|
+
for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
|
472
|
+
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
473
|
+
if (node = group0[i] || group1[i]) {
|
|
474
|
+
merge[i] = node;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
for (; j < m0; ++j) {
|
|
480
|
+
merges[j] = groups0[j];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return new Selection$1(merges, this._parents);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function selection_order() {
|
|
487
|
+
|
|
488
|
+
for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
|
|
489
|
+
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
|
490
|
+
if (node = group[i]) {
|
|
491
|
+
if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
|
|
492
|
+
next = node;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return this;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function selection_sort(compare) {
|
|
501
|
+
if (!compare) compare = ascending;
|
|
502
|
+
|
|
503
|
+
function compareNode(a, b) {
|
|
504
|
+
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
|
508
|
+
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
509
|
+
if (node = group[i]) {
|
|
510
|
+
sortgroup[i] = node;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
sortgroup.sort(compareNode);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return new Selection$1(sortgroups, this._parents).order();
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function ascending(a, b) {
|
|
520
|
+
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function selection_call() {
|
|
524
|
+
var callback = arguments[0];
|
|
525
|
+
arguments[0] = this;
|
|
526
|
+
callback.apply(null, arguments);
|
|
527
|
+
return this;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function selection_nodes() {
|
|
531
|
+
return Array.from(this);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function selection_node() {
|
|
535
|
+
|
|
536
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
537
|
+
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
|
538
|
+
var node = group[i];
|
|
539
|
+
if (node) return node;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return null;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function selection_size() {
|
|
547
|
+
let size = 0;
|
|
548
|
+
for (const node of this) ++size; // eslint-disable-line no-unused-vars
|
|
549
|
+
return size;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function selection_empty() {
|
|
553
|
+
return !this.node();
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function selection_each(callback) {
|
|
557
|
+
|
|
558
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
559
|
+
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
560
|
+
if (node = group[i]) callback.call(node, node.__data__, i, group);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return this;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function attrRemove$1(name) {
|
|
568
|
+
return function() {
|
|
569
|
+
this.removeAttribute(name);
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function attrRemoveNS$1(fullname) {
|
|
574
|
+
return function() {
|
|
575
|
+
this.removeAttributeNS(fullname.space, fullname.local);
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function attrConstant$1(name, value) {
|
|
580
|
+
return function() {
|
|
581
|
+
this.setAttribute(name, value);
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function attrConstantNS$1(fullname, value) {
|
|
586
|
+
return function() {
|
|
587
|
+
this.setAttributeNS(fullname.space, fullname.local, value);
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function attrFunction$1(name, value) {
|
|
592
|
+
return function() {
|
|
593
|
+
var v = value.apply(this, arguments);
|
|
594
|
+
if (v == null) this.removeAttribute(name);
|
|
595
|
+
else this.setAttribute(name, v);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function attrFunctionNS$1(fullname, value) {
|
|
600
|
+
return function() {
|
|
601
|
+
var v = value.apply(this, arguments);
|
|
602
|
+
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
|
|
603
|
+
else this.setAttributeNS(fullname.space, fullname.local, v);
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function selection_attr(name, value) {
|
|
608
|
+
var fullname = namespace(name);
|
|
609
|
+
|
|
610
|
+
if (arguments.length < 2) {
|
|
611
|
+
var node = this.node();
|
|
612
|
+
return fullname.local
|
|
613
|
+
? node.getAttributeNS(fullname.space, fullname.local)
|
|
614
|
+
: node.getAttribute(fullname);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return this.each((value == null
|
|
618
|
+
? (fullname.local ? attrRemoveNS$1 : attrRemove$1) : (typeof value === "function"
|
|
619
|
+
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)
|
|
620
|
+
: (fullname.local ? attrConstantNS$1 : attrConstant$1)))(fullname, value));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function defaultView(node) {
|
|
624
|
+
return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|
|
625
|
+
|| (node.document && node) // node is a Window
|
|
626
|
+
|| node.defaultView; // node is a Document
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function styleRemove$1(name) {
|
|
630
|
+
return function() {
|
|
631
|
+
this.style.removeProperty(name);
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function styleConstant$1(name, value, priority) {
|
|
636
|
+
return function() {
|
|
637
|
+
this.style.setProperty(name, value, priority);
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function styleFunction$1(name, value, priority) {
|
|
642
|
+
return function() {
|
|
643
|
+
var v = value.apply(this, arguments);
|
|
644
|
+
if (v == null) this.style.removeProperty(name);
|
|
645
|
+
else this.style.setProperty(name, v, priority);
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function selection_style(name, value, priority) {
|
|
650
|
+
return arguments.length > 1
|
|
651
|
+
? this.each((value == null
|
|
652
|
+
? styleRemove$1 : typeof value === "function"
|
|
653
|
+
? styleFunction$1
|
|
654
|
+
: styleConstant$1)(name, value, priority == null ? "" : priority))
|
|
655
|
+
: styleValue(this.node(), name);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function styleValue(node, name) {
|
|
659
|
+
return node.style.getPropertyValue(name)
|
|
660
|
+
|| defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function propertyRemove(name) {
|
|
664
|
+
return function() {
|
|
665
|
+
delete this[name];
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function propertyConstant(name, value) {
|
|
670
|
+
return function() {
|
|
671
|
+
this[name] = value;
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function propertyFunction(name, value) {
|
|
676
|
+
return function() {
|
|
677
|
+
var v = value.apply(this, arguments);
|
|
678
|
+
if (v == null) delete this[name];
|
|
679
|
+
else this[name] = v;
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
function selection_property(name, value) {
|
|
684
|
+
return arguments.length > 1
|
|
685
|
+
? this.each((value == null
|
|
686
|
+
? propertyRemove : typeof value === "function"
|
|
687
|
+
? propertyFunction
|
|
688
|
+
: propertyConstant)(name, value))
|
|
689
|
+
: this.node()[name];
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function classArray(string) {
|
|
693
|
+
return string.trim().split(/^|\s+/);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function classList(node) {
|
|
697
|
+
return node.classList || new ClassList(node);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function ClassList(node) {
|
|
701
|
+
this._node = node;
|
|
702
|
+
this._names = classArray(node.getAttribute("class") || "");
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
ClassList.prototype = {
|
|
706
|
+
add: function(name) {
|
|
707
|
+
var i = this._names.indexOf(name);
|
|
708
|
+
if (i < 0) {
|
|
709
|
+
this._names.push(name);
|
|
710
|
+
this._node.setAttribute("class", this._names.join(" "));
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
remove: function(name) {
|
|
714
|
+
var i = this._names.indexOf(name);
|
|
715
|
+
if (i >= 0) {
|
|
716
|
+
this._names.splice(i, 1);
|
|
717
|
+
this._node.setAttribute("class", this._names.join(" "));
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
contains: function(name) {
|
|
721
|
+
return this._names.indexOf(name) >= 0;
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
function classedAdd(node, names) {
|
|
726
|
+
var list = classList(node), i = -1, n = names.length;
|
|
727
|
+
while (++i < n) list.add(names[i]);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function classedRemove(node, names) {
|
|
731
|
+
var list = classList(node), i = -1, n = names.length;
|
|
732
|
+
while (++i < n) list.remove(names[i]);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function classedTrue(names) {
|
|
736
|
+
return function() {
|
|
737
|
+
classedAdd(this, names);
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function classedFalse(names) {
|
|
742
|
+
return function() {
|
|
743
|
+
classedRemove(this, names);
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function classedFunction(names, value) {
|
|
748
|
+
return function() {
|
|
749
|
+
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
function selection_classed(name, value) {
|
|
754
|
+
var names = classArray(name + "");
|
|
755
|
+
|
|
756
|
+
if (arguments.length < 2) {
|
|
757
|
+
var list = classList(this.node()), i = -1, n = names.length;
|
|
758
|
+
while (++i < n) if (!list.contains(names[i])) return false;
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return this.each((typeof value === "function"
|
|
763
|
+
? classedFunction : value
|
|
764
|
+
? classedTrue
|
|
765
|
+
: classedFalse)(names, value));
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function textRemove() {
|
|
769
|
+
this.textContent = "";
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function textConstant$1(value) {
|
|
773
|
+
return function() {
|
|
774
|
+
this.textContent = value;
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function textFunction$1(value) {
|
|
779
|
+
return function() {
|
|
780
|
+
var v = value.apply(this, arguments);
|
|
781
|
+
this.textContent = v == null ? "" : v;
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function selection_text(value) {
|
|
786
|
+
return arguments.length
|
|
787
|
+
? this.each(value == null
|
|
788
|
+
? textRemove : (typeof value === "function"
|
|
789
|
+
? textFunction$1
|
|
790
|
+
: textConstant$1)(value))
|
|
791
|
+
: this.node().textContent;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function htmlRemove() {
|
|
795
|
+
this.innerHTML = "";
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function htmlConstant(value) {
|
|
799
|
+
return function() {
|
|
800
|
+
this.innerHTML = value;
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function htmlFunction(value) {
|
|
805
|
+
return function() {
|
|
806
|
+
var v = value.apply(this, arguments);
|
|
807
|
+
this.innerHTML = v == null ? "" : v;
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
function selection_html(value) {
|
|
812
|
+
return arguments.length
|
|
813
|
+
? this.each(value == null
|
|
814
|
+
? htmlRemove : (typeof value === "function"
|
|
815
|
+
? htmlFunction
|
|
816
|
+
: htmlConstant)(value))
|
|
817
|
+
: this.node().innerHTML;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function raise() {
|
|
821
|
+
if (this.nextSibling) this.parentNode.appendChild(this);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function selection_raise() {
|
|
825
|
+
return this.each(raise);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function lower() {
|
|
829
|
+
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function selection_lower() {
|
|
833
|
+
return this.each(lower);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
function selection_append(name) {
|
|
837
|
+
var create = typeof name === "function" ? name : creator(name);
|
|
838
|
+
return this.select(function() {
|
|
839
|
+
return this.appendChild(create.apply(this, arguments));
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function constantNull() {
|
|
844
|
+
return null;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
function selection_insert(name, before) {
|
|
848
|
+
var create = typeof name === "function" ? name : creator(name),
|
|
849
|
+
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
|
850
|
+
return this.select(function() {
|
|
851
|
+
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function remove() {
|
|
856
|
+
var parent = this.parentNode;
|
|
857
|
+
if (parent) parent.removeChild(this);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function selection_remove() {
|
|
861
|
+
return this.each(remove);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function selection_cloneShallow() {
|
|
865
|
+
var clone = this.cloneNode(false), parent = this.parentNode;
|
|
866
|
+
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function selection_cloneDeep() {
|
|
870
|
+
var clone = this.cloneNode(true), parent = this.parentNode;
|
|
871
|
+
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function selection_clone(deep) {
|
|
875
|
+
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
function selection_datum(value) {
|
|
879
|
+
return arguments.length
|
|
880
|
+
? this.property("__data__", value)
|
|
881
|
+
: this.node().__data__;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function contextListener(listener) {
|
|
885
|
+
return function(event) {
|
|
886
|
+
listener.call(this, event, this.__data__);
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
function parseTypenames(typenames) {
|
|
891
|
+
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
892
|
+
var name = "", i = t.indexOf(".");
|
|
893
|
+
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
|
894
|
+
return {type: t, name: name};
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function onRemove(typename) {
|
|
899
|
+
return function() {
|
|
900
|
+
var on = this.__on;
|
|
901
|
+
if (!on) return;
|
|
902
|
+
for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
|
|
903
|
+
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
|
904
|
+
this.removeEventListener(o.type, o.listener, o.options);
|
|
905
|
+
} else {
|
|
906
|
+
on[++i] = o;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (++i) on.length = i;
|
|
910
|
+
else delete this.__on;
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function onAdd(typename, value, options) {
|
|
915
|
+
return function() {
|
|
916
|
+
var on = this.__on, o, listener = contextListener(value);
|
|
917
|
+
if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
|
918
|
+
if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
|
919
|
+
this.removeEventListener(o.type, o.listener, o.options);
|
|
920
|
+
this.addEventListener(o.type, o.listener = listener, o.options = options);
|
|
921
|
+
o.value = value;
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
this.addEventListener(typename.type, listener, options);
|
|
926
|
+
o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};
|
|
927
|
+
if (!on) this.__on = [o];
|
|
928
|
+
else on.push(o);
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
function selection_on(typename, value, options) {
|
|
933
|
+
var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
|
934
|
+
|
|
935
|
+
if (arguments.length < 2) {
|
|
936
|
+
var on = this.node().__on;
|
|
937
|
+
if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
|
|
938
|
+
for (i = 0, o = on[j]; i < n; ++i) {
|
|
939
|
+
if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
|
940
|
+
return o.value;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
on = value ? onAdd : onRemove;
|
|
948
|
+
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));
|
|
949
|
+
return this;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function dispatchEvent(node, type, params) {
|
|
953
|
+
var window = defaultView(node),
|
|
954
|
+
event = window.CustomEvent;
|
|
955
|
+
|
|
956
|
+
if (typeof event === "function") {
|
|
957
|
+
event = new event(type, params);
|
|
958
|
+
} else {
|
|
959
|
+
event = window.document.createEvent("Event");
|
|
960
|
+
if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
|
|
961
|
+
else event.initEvent(type, false, false);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
node.dispatchEvent(event);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
function dispatchConstant(type, params) {
|
|
968
|
+
return function() {
|
|
969
|
+
return dispatchEvent(this, type, params);
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function dispatchFunction(type, params) {
|
|
974
|
+
return function() {
|
|
975
|
+
return dispatchEvent(this, type, params.apply(this, arguments));
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
function selection_dispatch(type, params) {
|
|
980
|
+
return this.each((typeof params === "function"
|
|
981
|
+
? dispatchFunction
|
|
982
|
+
: dispatchConstant)(type, params));
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function* selection_iterator() {
|
|
986
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
987
|
+
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
988
|
+
if (node = group[i]) yield node;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
var root = [null];
|
|
994
|
+
|
|
995
|
+
function Selection$1(groups, parents) {
|
|
996
|
+
this._groups = groups;
|
|
997
|
+
this._parents = parents;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function selection() {
|
|
1001
|
+
return new Selection$1([[document.documentElement]], root);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
function selection_selection() {
|
|
1005
|
+
return this;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
Selection$1.prototype = selection.prototype = {
|
|
1009
|
+
constructor: Selection$1,
|
|
1010
|
+
select: selection_select,
|
|
1011
|
+
selectAll: selection_selectAll,
|
|
1012
|
+
selectChild: selection_selectChild,
|
|
1013
|
+
selectChildren: selection_selectChildren,
|
|
1014
|
+
filter: selection_filter,
|
|
1015
|
+
data: selection_data,
|
|
1016
|
+
enter: selection_enter,
|
|
1017
|
+
exit: selection_exit,
|
|
1018
|
+
join: selection_join,
|
|
1019
|
+
merge: selection_merge,
|
|
1020
|
+
selection: selection_selection,
|
|
1021
|
+
order: selection_order,
|
|
1022
|
+
sort: selection_sort,
|
|
1023
|
+
call: selection_call,
|
|
1024
|
+
nodes: selection_nodes,
|
|
1025
|
+
node: selection_node,
|
|
1026
|
+
size: selection_size,
|
|
1027
|
+
empty: selection_empty,
|
|
1028
|
+
each: selection_each,
|
|
1029
|
+
attr: selection_attr,
|
|
1030
|
+
style: selection_style,
|
|
1031
|
+
property: selection_property,
|
|
1032
|
+
classed: selection_classed,
|
|
1033
|
+
text: selection_text,
|
|
1034
|
+
html: selection_html,
|
|
1035
|
+
raise: selection_raise,
|
|
1036
|
+
lower: selection_lower,
|
|
1037
|
+
append: selection_append,
|
|
1038
|
+
insert: selection_insert,
|
|
1039
|
+
remove: selection_remove,
|
|
1040
|
+
clone: selection_clone,
|
|
1041
|
+
datum: selection_datum,
|
|
1042
|
+
on: selection_on,
|
|
1043
|
+
dispatch: selection_dispatch,
|
|
1044
|
+
[Symbol.iterator]: selection_iterator
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
function select(selector) {
|
|
1048
|
+
return typeof selector === "string"
|
|
1049
|
+
? new Selection$1([[document.querySelector(selector)]], [document.documentElement])
|
|
1050
|
+
: new Selection$1([[selector]], root);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
function define(constructor, factory, prototype) {
|
|
1054
|
+
constructor.prototype = factory.prototype = prototype;
|
|
1055
|
+
prototype.constructor = constructor;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
function extend(parent, definition) {
|
|
1059
|
+
var prototype = Object.create(parent.prototype);
|
|
1060
|
+
for (var key in definition) prototype[key] = definition[key];
|
|
1061
|
+
return prototype;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
function Color() {}
|
|
1065
|
+
|
|
1066
|
+
var darker = 0.7;
|
|
1067
|
+
var brighter = 1 / darker;
|
|
1068
|
+
|
|
1069
|
+
var reI = "\\s*([+-]?\\d+)\\s*",
|
|
1070
|
+
reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
|
1071
|
+
reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
|
1072
|
+
reHex = /^#([0-9a-f]{3,8})$/,
|
|
1073
|
+
reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
|
|
1074
|
+
reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
|
|
1075
|
+
reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
|
|
1076
|
+
reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
|
|
1077
|
+
reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
|
|
1078
|
+
reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
1079
|
+
|
|
1080
|
+
var named = {
|
|
1081
|
+
aliceblue: 0xf0f8ff,
|
|
1082
|
+
antiquewhite: 0xfaebd7,
|
|
1083
|
+
aqua: 0x00ffff,
|
|
1084
|
+
aquamarine: 0x7fffd4,
|
|
1085
|
+
azure: 0xf0ffff,
|
|
1086
|
+
beige: 0xf5f5dc,
|
|
1087
|
+
bisque: 0xffe4c4,
|
|
1088
|
+
black: 0x000000,
|
|
1089
|
+
blanchedalmond: 0xffebcd,
|
|
1090
|
+
blue: 0x0000ff,
|
|
1091
|
+
blueviolet: 0x8a2be2,
|
|
1092
|
+
brown: 0xa52a2a,
|
|
1093
|
+
burlywood: 0xdeb887,
|
|
1094
|
+
cadetblue: 0x5f9ea0,
|
|
1095
|
+
chartreuse: 0x7fff00,
|
|
1096
|
+
chocolate: 0xd2691e,
|
|
1097
|
+
coral: 0xff7f50,
|
|
1098
|
+
cornflowerblue: 0x6495ed,
|
|
1099
|
+
cornsilk: 0xfff8dc,
|
|
1100
|
+
crimson: 0xdc143c,
|
|
1101
|
+
cyan: 0x00ffff,
|
|
1102
|
+
darkblue: 0x00008b,
|
|
1103
|
+
darkcyan: 0x008b8b,
|
|
1104
|
+
darkgoldenrod: 0xb8860b,
|
|
1105
|
+
darkgray: 0xa9a9a9,
|
|
1106
|
+
darkgreen: 0x006400,
|
|
1107
|
+
darkgrey: 0xa9a9a9,
|
|
1108
|
+
darkkhaki: 0xbdb76b,
|
|
1109
|
+
darkmagenta: 0x8b008b,
|
|
1110
|
+
darkolivegreen: 0x556b2f,
|
|
1111
|
+
darkorange: 0xff8c00,
|
|
1112
|
+
darkorchid: 0x9932cc,
|
|
1113
|
+
darkred: 0x8b0000,
|
|
1114
|
+
darksalmon: 0xe9967a,
|
|
1115
|
+
darkseagreen: 0x8fbc8f,
|
|
1116
|
+
darkslateblue: 0x483d8b,
|
|
1117
|
+
darkslategray: 0x2f4f4f,
|
|
1118
|
+
darkslategrey: 0x2f4f4f,
|
|
1119
|
+
darkturquoise: 0x00ced1,
|
|
1120
|
+
darkviolet: 0x9400d3,
|
|
1121
|
+
deeppink: 0xff1493,
|
|
1122
|
+
deepskyblue: 0x00bfff,
|
|
1123
|
+
dimgray: 0x696969,
|
|
1124
|
+
dimgrey: 0x696969,
|
|
1125
|
+
dodgerblue: 0x1e90ff,
|
|
1126
|
+
firebrick: 0xb22222,
|
|
1127
|
+
floralwhite: 0xfffaf0,
|
|
1128
|
+
forestgreen: 0x228b22,
|
|
1129
|
+
fuchsia: 0xff00ff,
|
|
1130
|
+
gainsboro: 0xdcdcdc,
|
|
1131
|
+
ghostwhite: 0xf8f8ff,
|
|
1132
|
+
gold: 0xffd700,
|
|
1133
|
+
goldenrod: 0xdaa520,
|
|
1134
|
+
gray: 0x808080,
|
|
1135
|
+
green: 0x008000,
|
|
1136
|
+
greenyellow: 0xadff2f,
|
|
1137
|
+
grey: 0x808080,
|
|
1138
|
+
honeydew: 0xf0fff0,
|
|
1139
|
+
hotpink: 0xff69b4,
|
|
1140
|
+
indianred: 0xcd5c5c,
|
|
1141
|
+
indigo: 0x4b0082,
|
|
1142
|
+
ivory: 0xfffff0,
|
|
1143
|
+
khaki: 0xf0e68c,
|
|
1144
|
+
lavender: 0xe6e6fa,
|
|
1145
|
+
lavenderblush: 0xfff0f5,
|
|
1146
|
+
lawngreen: 0x7cfc00,
|
|
1147
|
+
lemonchiffon: 0xfffacd,
|
|
1148
|
+
lightblue: 0xadd8e6,
|
|
1149
|
+
lightcoral: 0xf08080,
|
|
1150
|
+
lightcyan: 0xe0ffff,
|
|
1151
|
+
lightgoldenrodyellow: 0xfafad2,
|
|
1152
|
+
lightgray: 0xd3d3d3,
|
|
1153
|
+
lightgreen: 0x90ee90,
|
|
1154
|
+
lightgrey: 0xd3d3d3,
|
|
1155
|
+
lightpink: 0xffb6c1,
|
|
1156
|
+
lightsalmon: 0xffa07a,
|
|
1157
|
+
lightseagreen: 0x20b2aa,
|
|
1158
|
+
lightskyblue: 0x87cefa,
|
|
1159
|
+
lightslategray: 0x778899,
|
|
1160
|
+
lightslategrey: 0x778899,
|
|
1161
|
+
lightsteelblue: 0xb0c4de,
|
|
1162
|
+
lightyellow: 0xffffe0,
|
|
1163
|
+
lime: 0x00ff00,
|
|
1164
|
+
limegreen: 0x32cd32,
|
|
1165
|
+
linen: 0xfaf0e6,
|
|
1166
|
+
magenta: 0xff00ff,
|
|
1167
|
+
maroon: 0x800000,
|
|
1168
|
+
mediumaquamarine: 0x66cdaa,
|
|
1169
|
+
mediumblue: 0x0000cd,
|
|
1170
|
+
mediumorchid: 0xba55d3,
|
|
1171
|
+
mediumpurple: 0x9370db,
|
|
1172
|
+
mediumseagreen: 0x3cb371,
|
|
1173
|
+
mediumslateblue: 0x7b68ee,
|
|
1174
|
+
mediumspringgreen: 0x00fa9a,
|
|
1175
|
+
mediumturquoise: 0x48d1cc,
|
|
1176
|
+
mediumvioletred: 0xc71585,
|
|
1177
|
+
midnightblue: 0x191970,
|
|
1178
|
+
mintcream: 0xf5fffa,
|
|
1179
|
+
mistyrose: 0xffe4e1,
|
|
1180
|
+
moccasin: 0xffe4b5,
|
|
1181
|
+
navajowhite: 0xffdead,
|
|
1182
|
+
navy: 0x000080,
|
|
1183
|
+
oldlace: 0xfdf5e6,
|
|
1184
|
+
olive: 0x808000,
|
|
1185
|
+
olivedrab: 0x6b8e23,
|
|
1186
|
+
orange: 0xffa500,
|
|
1187
|
+
orangered: 0xff4500,
|
|
1188
|
+
orchid: 0xda70d6,
|
|
1189
|
+
palegoldenrod: 0xeee8aa,
|
|
1190
|
+
palegreen: 0x98fb98,
|
|
1191
|
+
paleturquoise: 0xafeeee,
|
|
1192
|
+
palevioletred: 0xdb7093,
|
|
1193
|
+
papayawhip: 0xffefd5,
|
|
1194
|
+
peachpuff: 0xffdab9,
|
|
1195
|
+
peru: 0xcd853f,
|
|
1196
|
+
pink: 0xffc0cb,
|
|
1197
|
+
plum: 0xdda0dd,
|
|
1198
|
+
powderblue: 0xb0e0e6,
|
|
1199
|
+
purple: 0x800080,
|
|
1200
|
+
rebeccapurple: 0x663399,
|
|
1201
|
+
red: 0xff0000,
|
|
1202
|
+
rosybrown: 0xbc8f8f,
|
|
1203
|
+
royalblue: 0x4169e1,
|
|
1204
|
+
saddlebrown: 0x8b4513,
|
|
1205
|
+
salmon: 0xfa8072,
|
|
1206
|
+
sandybrown: 0xf4a460,
|
|
1207
|
+
seagreen: 0x2e8b57,
|
|
1208
|
+
seashell: 0xfff5ee,
|
|
1209
|
+
sienna: 0xa0522d,
|
|
1210
|
+
silver: 0xc0c0c0,
|
|
1211
|
+
skyblue: 0x87ceeb,
|
|
1212
|
+
slateblue: 0x6a5acd,
|
|
1213
|
+
slategray: 0x708090,
|
|
1214
|
+
slategrey: 0x708090,
|
|
1215
|
+
snow: 0xfffafa,
|
|
1216
|
+
springgreen: 0x00ff7f,
|
|
1217
|
+
steelblue: 0x4682b4,
|
|
1218
|
+
tan: 0xd2b48c,
|
|
1219
|
+
teal: 0x008080,
|
|
1220
|
+
thistle: 0xd8bfd8,
|
|
1221
|
+
tomato: 0xff6347,
|
|
1222
|
+
turquoise: 0x40e0d0,
|
|
1223
|
+
violet: 0xee82ee,
|
|
1224
|
+
wheat: 0xf5deb3,
|
|
1225
|
+
white: 0xffffff,
|
|
1226
|
+
whitesmoke: 0xf5f5f5,
|
|
1227
|
+
yellow: 0xffff00,
|
|
1228
|
+
yellowgreen: 0x9acd32
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
define(Color, color, {
|
|
1232
|
+
copy(channels) {
|
|
1233
|
+
return Object.assign(new this.constructor, this, channels);
|
|
1234
|
+
},
|
|
1235
|
+
displayable() {
|
|
1236
|
+
return this.rgb().displayable();
|
|
1237
|
+
},
|
|
1238
|
+
hex: color_formatHex, // Deprecated! Use color.formatHex.
|
|
1239
|
+
formatHex: color_formatHex,
|
|
1240
|
+
formatHex8: color_formatHex8,
|
|
1241
|
+
formatHsl: color_formatHsl,
|
|
1242
|
+
formatRgb: color_formatRgb,
|
|
1243
|
+
toString: color_formatRgb
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
function color_formatHex() {
|
|
1247
|
+
return this.rgb().formatHex();
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
function color_formatHex8() {
|
|
1251
|
+
return this.rgb().formatHex8();
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
function color_formatHsl() {
|
|
1255
|
+
return hslConvert(this).formatHsl();
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
function color_formatRgb() {
|
|
1259
|
+
return this.rgb().formatRgb();
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function color(format) {
|
|
1263
|
+
var m, l;
|
|
1264
|
+
format = (format + "").trim().toLowerCase();
|
|
1265
|
+
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
|
|
1266
|
+
: l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
|
|
1267
|
+
: l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
|
|
1268
|
+
: l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
|
|
1269
|
+
: null) // invalid hex
|
|
1270
|
+
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
|
|
1271
|
+
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
|
|
1272
|
+
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
|
|
1273
|
+
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
|
|
1274
|
+
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
|
|
1275
|
+
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
|
|
1276
|
+
: named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
|
|
1277
|
+
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
|
1278
|
+
: null;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function rgbn(n) {
|
|
1282
|
+
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
function rgba(r, g, b, a) {
|
|
1286
|
+
if (a <= 0) r = g = b = NaN;
|
|
1287
|
+
return new Rgb(r, g, b, a);
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
function rgbConvert(o) {
|
|
1291
|
+
if (!(o instanceof Color)) o = color(o);
|
|
1292
|
+
if (!o) return new Rgb;
|
|
1293
|
+
o = o.rgb();
|
|
1294
|
+
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
function rgb(r, g, b, opacity) {
|
|
1298
|
+
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function Rgb(r, g, b, opacity) {
|
|
1302
|
+
this.r = +r;
|
|
1303
|
+
this.g = +g;
|
|
1304
|
+
this.b = +b;
|
|
1305
|
+
this.opacity = +opacity;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
define(Rgb, rgb, extend(Color, {
|
|
1309
|
+
brighter(k) {
|
|
1310
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
1311
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
1312
|
+
},
|
|
1313
|
+
darker(k) {
|
|
1314
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
1315
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
1316
|
+
},
|
|
1317
|
+
rgb() {
|
|
1318
|
+
return this;
|
|
1319
|
+
},
|
|
1320
|
+
clamp() {
|
|
1321
|
+
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
1322
|
+
},
|
|
1323
|
+
displayable() {
|
|
1324
|
+
return (-0.5 <= this.r && this.r < 255.5)
|
|
1325
|
+
&& (-0.5 <= this.g && this.g < 255.5)
|
|
1326
|
+
&& (-0.5 <= this.b && this.b < 255.5)
|
|
1327
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
1328
|
+
},
|
|
1329
|
+
hex: rgb_formatHex, // Deprecated! Use color.formatHex.
|
|
1330
|
+
formatHex: rgb_formatHex,
|
|
1331
|
+
formatHex8: rgb_formatHex8,
|
|
1332
|
+
formatRgb: rgb_formatRgb,
|
|
1333
|
+
toString: rgb_formatRgb
|
|
1334
|
+
}));
|
|
1335
|
+
|
|
1336
|
+
function rgb_formatHex() {
|
|
1337
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
function rgb_formatHex8() {
|
|
1341
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
function rgb_formatRgb() {
|
|
1345
|
+
const a = clampa(this.opacity);
|
|
1346
|
+
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
function clampa(opacity) {
|
|
1350
|
+
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
function clampi(value) {
|
|
1354
|
+
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
function hex(value) {
|
|
1358
|
+
value = clampi(value);
|
|
1359
|
+
return (value < 16 ? "0" : "") + value.toString(16);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
function hsla(h, s, l, a) {
|
|
1363
|
+
if (a <= 0) h = s = l = NaN;
|
|
1364
|
+
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
1365
|
+
else if (s <= 0) h = NaN;
|
|
1366
|
+
return new Hsl(h, s, l, a);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
function hslConvert(o) {
|
|
1370
|
+
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
1371
|
+
if (!(o instanceof Color)) o = color(o);
|
|
1372
|
+
if (!o) return new Hsl;
|
|
1373
|
+
if (o instanceof Hsl) return o;
|
|
1374
|
+
o = o.rgb();
|
|
1375
|
+
var r = o.r / 255,
|
|
1376
|
+
g = o.g / 255,
|
|
1377
|
+
b = o.b / 255,
|
|
1378
|
+
min = Math.min(r, g, b),
|
|
1379
|
+
max = Math.max(r, g, b),
|
|
1380
|
+
h = NaN,
|
|
1381
|
+
s = max - min,
|
|
1382
|
+
l = (max + min) / 2;
|
|
1383
|
+
if (s) {
|
|
1384
|
+
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
1385
|
+
else if (g === max) h = (b - r) / s + 2;
|
|
1386
|
+
else h = (r - g) / s + 4;
|
|
1387
|
+
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
1388
|
+
h *= 60;
|
|
1389
|
+
} else {
|
|
1390
|
+
s = l > 0 && l < 1 ? 0 : h;
|
|
1391
|
+
}
|
|
1392
|
+
return new Hsl(h, s, l, o.opacity);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
function hsl(h, s, l, opacity) {
|
|
1396
|
+
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
function Hsl(h, s, l, opacity) {
|
|
1400
|
+
this.h = +h;
|
|
1401
|
+
this.s = +s;
|
|
1402
|
+
this.l = +l;
|
|
1403
|
+
this.opacity = +opacity;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
define(Hsl, hsl, extend(Color, {
|
|
1407
|
+
brighter(k) {
|
|
1408
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
1409
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
1410
|
+
},
|
|
1411
|
+
darker(k) {
|
|
1412
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
1413
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
1414
|
+
},
|
|
1415
|
+
rgb() {
|
|
1416
|
+
var h = this.h % 360 + (this.h < 0) * 360,
|
|
1417
|
+
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
1418
|
+
l = this.l,
|
|
1419
|
+
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
1420
|
+
m1 = 2 * l - m2;
|
|
1421
|
+
return new Rgb(
|
|
1422
|
+
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
1423
|
+
hsl2rgb(h, m1, m2),
|
|
1424
|
+
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
1425
|
+
this.opacity
|
|
1426
|
+
);
|
|
1427
|
+
},
|
|
1428
|
+
clamp() {
|
|
1429
|
+
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
1430
|
+
},
|
|
1431
|
+
displayable() {
|
|
1432
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
1433
|
+
&& (0 <= this.l && this.l <= 1)
|
|
1434
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
1435
|
+
},
|
|
1436
|
+
formatHsl() {
|
|
1437
|
+
const a = clampa(this.opacity);
|
|
1438
|
+
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
1439
|
+
}
|
|
1440
|
+
}));
|
|
1441
|
+
|
|
1442
|
+
function clamph(value) {
|
|
1443
|
+
value = (value || 0) % 360;
|
|
1444
|
+
return value < 0 ? value + 360 : value;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
function clampt(value) {
|
|
1448
|
+
return Math.max(0, Math.min(1, value || 0));
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
1452
|
+
function hsl2rgb(h, m1, m2) {
|
|
1453
|
+
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
1454
|
+
: h < 180 ? m2
|
|
1455
|
+
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
1456
|
+
: m1) * 255;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
var constant$1 = x => () => x;
|
|
1460
|
+
|
|
1461
|
+
function linear(a, d) {
|
|
1462
|
+
return function(t) {
|
|
1463
|
+
return a + t * d;
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
function exponential(a, b, y) {
|
|
1468
|
+
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
|
1469
|
+
return Math.pow(a + t * b, y);
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
function gamma(y) {
|
|
1474
|
+
return (y = +y) === 1 ? nogamma : function(a, b) {
|
|
1475
|
+
return b - a ? exponential(a, b, y) : constant$1(isNaN(a) ? b : a);
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
function nogamma(a, b) {
|
|
1480
|
+
var d = b - a;
|
|
1481
|
+
return d ? linear(a, d) : constant$1(isNaN(a) ? b : a);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
var interpolateRgb = (function rgbGamma(y) {
|
|
1485
|
+
var color = gamma(y);
|
|
1486
|
+
|
|
1487
|
+
function rgb$1(start, end) {
|
|
1488
|
+
var r = color((start = rgb(start)).r, (end = rgb(end)).r),
|
|
1489
|
+
g = color(start.g, end.g),
|
|
1490
|
+
b = color(start.b, end.b),
|
|
1491
|
+
opacity = nogamma(start.opacity, end.opacity);
|
|
1492
|
+
return function(t) {
|
|
1493
|
+
start.r = r(t);
|
|
1494
|
+
start.g = g(t);
|
|
1495
|
+
start.b = b(t);
|
|
1496
|
+
start.opacity = opacity(t);
|
|
1497
|
+
return start + "";
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
rgb$1.gamma = rgbGamma;
|
|
1502
|
+
|
|
1503
|
+
return rgb$1;
|
|
1504
|
+
})(1);
|
|
1505
|
+
|
|
1506
|
+
function interpolateNumber(a, b) {
|
|
1507
|
+
return a = +a, b = +b, function(t) {
|
|
1508
|
+
return a * (1 - t) + b * t;
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
|
|
1513
|
+
reB = new RegExp(reA.source, "g");
|
|
1514
|
+
|
|
1515
|
+
function zero(b) {
|
|
1516
|
+
return function() {
|
|
1517
|
+
return b;
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
function one(b) {
|
|
1522
|
+
return function(t) {
|
|
1523
|
+
return b(t) + "";
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
function interpolateString(a, b) {
|
|
1528
|
+
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
|
|
1529
|
+
am, // current match in a
|
|
1530
|
+
bm, // current match in b
|
|
1531
|
+
bs, // string preceding current number in b, if any
|
|
1532
|
+
i = -1, // index in s
|
|
1533
|
+
s = [], // string constants and placeholders
|
|
1534
|
+
q = []; // number interpolators
|
|
1535
|
+
|
|
1536
|
+
// Coerce inputs to strings.
|
|
1537
|
+
a = a + "", b = b + "";
|
|
1538
|
+
|
|
1539
|
+
// Interpolate pairs of numbers in a & b.
|
|
1540
|
+
while ((am = reA.exec(a))
|
|
1541
|
+
&& (bm = reB.exec(b))) {
|
|
1542
|
+
if ((bs = bm.index) > bi) { // a string precedes the next number in b
|
|
1543
|
+
bs = b.slice(bi, bs);
|
|
1544
|
+
if (s[i]) s[i] += bs; // coalesce with previous string
|
|
1545
|
+
else s[++i] = bs;
|
|
1546
|
+
}
|
|
1547
|
+
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
|
|
1548
|
+
if (s[i]) s[i] += bm; // coalesce with previous string
|
|
1549
|
+
else s[++i] = bm;
|
|
1550
|
+
} else { // interpolate non-matching numbers
|
|
1551
|
+
s[++i] = null;
|
|
1552
|
+
q.push({i: i, x: interpolateNumber(am, bm)});
|
|
1553
|
+
}
|
|
1554
|
+
bi = reB.lastIndex;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
// Add remains of b.
|
|
1558
|
+
if (bi < b.length) {
|
|
1559
|
+
bs = b.slice(bi);
|
|
1560
|
+
if (s[i]) s[i] += bs; // coalesce with previous string
|
|
1561
|
+
else s[++i] = bs;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
// Special optimization for only a single match.
|
|
1565
|
+
// Otherwise, interpolate each of the numbers and rejoin the string.
|
|
1566
|
+
return s.length < 2 ? (q[0]
|
|
1567
|
+
? one(q[0].x)
|
|
1568
|
+
: zero(b))
|
|
1569
|
+
: (b = q.length, function(t) {
|
|
1570
|
+
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
|
|
1571
|
+
return s.join("");
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
var degrees = 180 / Math.PI;
|
|
1576
|
+
|
|
1577
|
+
var identity$1 = {
|
|
1578
|
+
translateX: 0,
|
|
1579
|
+
translateY: 0,
|
|
1580
|
+
rotate: 0,
|
|
1581
|
+
skewX: 0,
|
|
1582
|
+
scaleX: 1,
|
|
1583
|
+
scaleY: 1
|
|
1584
|
+
};
|
|
1585
|
+
|
|
1586
|
+
function decompose(a, b, c, d, e, f) {
|
|
1587
|
+
var scaleX, scaleY, skewX;
|
|
1588
|
+
if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
|
|
1589
|
+
if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
|
|
1590
|
+
if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
|
|
1591
|
+
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
|
1592
|
+
return {
|
|
1593
|
+
translateX: e,
|
|
1594
|
+
translateY: f,
|
|
1595
|
+
rotate: Math.atan2(b, a) * degrees,
|
|
1596
|
+
skewX: Math.atan(skewX) * degrees,
|
|
1597
|
+
scaleX: scaleX,
|
|
1598
|
+
scaleY: scaleY
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
var svgNode;
|
|
1603
|
+
|
|
1604
|
+
/* eslint-disable no-undef */
|
|
1605
|
+
function parseCss(value) {
|
|
1606
|
+
const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
|
|
1607
|
+
return m.isIdentity ? identity$1 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
function parseSvg(value) {
|
|
1611
|
+
if (value == null) return identity$1;
|
|
1612
|
+
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1613
|
+
svgNode.setAttribute("transform", value);
|
|
1614
|
+
if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
|
|
1615
|
+
value = value.matrix;
|
|
1616
|
+
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
|
1620
|
+
|
|
1621
|
+
function pop(s) {
|
|
1622
|
+
return s.length ? s.pop() + " " : "";
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
function translate(xa, ya, xb, yb, s, q) {
|
|
1626
|
+
if (xa !== xb || ya !== yb) {
|
|
1627
|
+
var i = s.push("translate(", null, pxComma, null, pxParen);
|
|
1628
|
+
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
|
|
1629
|
+
} else if (xb || yb) {
|
|
1630
|
+
s.push("translate(" + xb + pxComma + yb + pxParen);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
function rotate(a, b, s, q) {
|
|
1635
|
+
if (a !== b) {
|
|
1636
|
+
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
|
|
1637
|
+
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)});
|
|
1638
|
+
} else if (b) {
|
|
1639
|
+
s.push(pop(s) + "rotate(" + b + degParen);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
function skewX(a, b, s, q) {
|
|
1644
|
+
if (a !== b) {
|
|
1645
|
+
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)});
|
|
1646
|
+
} else if (b) {
|
|
1647
|
+
s.push(pop(s) + "skewX(" + b + degParen);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
function scale(xa, ya, xb, yb, s, q) {
|
|
1652
|
+
if (xa !== xb || ya !== yb) {
|
|
1653
|
+
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
|
1654
|
+
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
|
|
1655
|
+
} else if (xb !== 1 || yb !== 1) {
|
|
1656
|
+
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
return function(a, b) {
|
|
1661
|
+
var s = [], // string constants and placeholders
|
|
1662
|
+
q = []; // number interpolators
|
|
1663
|
+
a = parse(a), b = parse(b);
|
|
1664
|
+
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
|
1665
|
+
rotate(a.rotate, b.rotate, s, q);
|
|
1666
|
+
skewX(a.skewX, b.skewX, s, q);
|
|
1667
|
+
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
|
1668
|
+
a = b = null; // gc
|
|
1669
|
+
return function(t) {
|
|
1670
|
+
var i = -1, n = q.length, o;
|
|
1671
|
+
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
|
1672
|
+
return s.join("");
|
|
1673
|
+
};
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
|
1678
|
+
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
|
1679
|
+
|
|
1680
|
+
var frame = 0, // is an animation frame pending?
|
|
1681
|
+
timeout$1 = 0, // is a timeout pending?
|
|
1682
|
+
interval = 0, // are any timers active?
|
|
1683
|
+
pokeDelay = 1000, // how frequently we check for clock skew
|
|
1684
|
+
taskHead,
|
|
1685
|
+
taskTail,
|
|
1686
|
+
clockLast = 0,
|
|
1687
|
+
clockNow = 0,
|
|
1688
|
+
clockSkew = 0,
|
|
1689
|
+
clock = typeof performance === "object" && performance.now ? performance : Date,
|
|
1690
|
+
setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
|
|
1691
|
+
|
|
1692
|
+
function now() {
|
|
1693
|
+
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
function clearNow() {
|
|
1697
|
+
clockNow = 0;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
function Timer() {
|
|
1701
|
+
this._call =
|
|
1702
|
+
this._time =
|
|
1703
|
+
this._next = null;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
Timer.prototype = timer.prototype = {
|
|
1707
|
+
constructor: Timer,
|
|
1708
|
+
restart: function(callback, delay, time) {
|
|
1709
|
+
if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
|
1710
|
+
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
|
1711
|
+
if (!this._next && taskTail !== this) {
|
|
1712
|
+
if (taskTail) taskTail._next = this;
|
|
1713
|
+
else taskHead = this;
|
|
1714
|
+
taskTail = this;
|
|
1715
|
+
}
|
|
1716
|
+
this._call = callback;
|
|
1717
|
+
this._time = time;
|
|
1718
|
+
sleep();
|
|
1719
|
+
},
|
|
1720
|
+
stop: function() {
|
|
1721
|
+
if (this._call) {
|
|
1722
|
+
this._call = null;
|
|
1723
|
+
this._time = Infinity;
|
|
1724
|
+
sleep();
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
function timer(callback, delay, time) {
|
|
1730
|
+
var t = new Timer;
|
|
1731
|
+
t.restart(callback, delay, time);
|
|
1732
|
+
return t;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
function timerFlush() {
|
|
1736
|
+
now(); // Get the current time, if not already set.
|
|
1737
|
+
++frame; // Pretend we’ve set an alarm, if we haven’t already.
|
|
1738
|
+
var t = taskHead, e;
|
|
1739
|
+
while (t) {
|
|
1740
|
+
if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
|
|
1741
|
+
t = t._next;
|
|
1742
|
+
}
|
|
1743
|
+
--frame;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
function wake() {
|
|
1747
|
+
clockNow = (clockLast = clock.now()) + clockSkew;
|
|
1748
|
+
frame = timeout$1 = 0;
|
|
1749
|
+
try {
|
|
1750
|
+
timerFlush();
|
|
1751
|
+
} finally {
|
|
1752
|
+
frame = 0;
|
|
1753
|
+
nap();
|
|
1754
|
+
clockNow = 0;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
function poke() {
|
|
1759
|
+
var now = clock.now(), delay = now - clockLast;
|
|
1760
|
+
if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
function nap() {
|
|
1764
|
+
var t0, t1 = taskHead, t2, time = Infinity;
|
|
1765
|
+
while (t1) {
|
|
1766
|
+
if (t1._call) {
|
|
1767
|
+
if (time > t1._time) time = t1._time;
|
|
1768
|
+
t0 = t1, t1 = t1._next;
|
|
1769
|
+
} else {
|
|
1770
|
+
t2 = t1._next, t1._next = null;
|
|
1771
|
+
t1 = t0 ? t0._next = t2 : taskHead = t2;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
taskTail = t0;
|
|
1775
|
+
sleep(time);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
function sleep(time) {
|
|
1779
|
+
if (frame) return; // Soonest alarm already set, or will be.
|
|
1780
|
+
if (timeout$1) timeout$1 = clearTimeout(timeout$1);
|
|
1781
|
+
var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
|
|
1782
|
+
if (delay > 24) {
|
|
1783
|
+
if (time < Infinity) timeout$1 = setTimeout(wake, time - clock.now() - clockSkew);
|
|
1784
|
+
if (interval) interval = clearInterval(interval);
|
|
1785
|
+
} else {
|
|
1786
|
+
if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
|
1787
|
+
frame = 1, setFrame(wake);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
function timeout(callback, delay, time) {
|
|
1792
|
+
var t = new Timer;
|
|
1793
|
+
delay = delay == null ? 0 : +delay;
|
|
1794
|
+
t.restart(elapsed => {
|
|
1795
|
+
t.stop();
|
|
1796
|
+
callback(elapsed + delay);
|
|
1797
|
+
}, delay, time);
|
|
1798
|
+
return t;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
var emptyOn = dispatch("start", "end", "cancel", "interrupt");
|
|
1802
|
+
var emptyTween = [];
|
|
1803
|
+
|
|
1804
|
+
var CREATED = 0;
|
|
1805
|
+
var SCHEDULED = 1;
|
|
1806
|
+
var STARTING = 2;
|
|
1807
|
+
var STARTED = 3;
|
|
1808
|
+
var RUNNING = 4;
|
|
1809
|
+
var ENDING = 5;
|
|
1810
|
+
var ENDED = 6;
|
|
1811
|
+
|
|
1812
|
+
function schedule(node, name, id, index, group, timing) {
|
|
1813
|
+
var schedules = node.__transition;
|
|
1814
|
+
if (!schedules) node.__transition = {};
|
|
1815
|
+
else if (id in schedules) return;
|
|
1816
|
+
create(node, id, {
|
|
1817
|
+
name: name,
|
|
1818
|
+
index: index, // For context during callback.
|
|
1819
|
+
group: group, // For context during callback.
|
|
1820
|
+
on: emptyOn,
|
|
1821
|
+
tween: emptyTween,
|
|
1822
|
+
time: timing.time,
|
|
1823
|
+
delay: timing.delay,
|
|
1824
|
+
duration: timing.duration,
|
|
1825
|
+
ease: timing.ease,
|
|
1826
|
+
timer: null,
|
|
1827
|
+
state: CREATED
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
function init(node, id) {
|
|
1832
|
+
var schedule = get(node, id);
|
|
1833
|
+
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
|
1834
|
+
return schedule;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
function set(node, id) {
|
|
1838
|
+
var schedule = get(node, id);
|
|
1839
|
+
if (schedule.state > STARTED) throw new Error("too late; already running");
|
|
1840
|
+
return schedule;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function get(node, id) {
|
|
1844
|
+
var schedule = node.__transition;
|
|
1845
|
+
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
|
1846
|
+
return schedule;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
function create(node, id, self) {
|
|
1850
|
+
var schedules = node.__transition,
|
|
1851
|
+
tween;
|
|
1852
|
+
|
|
1853
|
+
// Initialize the self timer when the transition is created.
|
|
1854
|
+
// Note the actual delay is not known until the first callback!
|
|
1855
|
+
schedules[id] = self;
|
|
1856
|
+
self.timer = timer(schedule, 0, self.time);
|
|
1857
|
+
|
|
1858
|
+
function schedule(elapsed) {
|
|
1859
|
+
self.state = SCHEDULED;
|
|
1860
|
+
self.timer.restart(start, self.delay, self.time);
|
|
1861
|
+
|
|
1862
|
+
// If the elapsed delay is less than our first sleep, start immediately.
|
|
1863
|
+
if (self.delay <= elapsed) start(elapsed - self.delay);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
function start(elapsed) {
|
|
1867
|
+
var i, j, n, o;
|
|
1868
|
+
|
|
1869
|
+
// If the state is not SCHEDULED, then we previously errored on start.
|
|
1870
|
+
if (self.state !== SCHEDULED) return stop();
|
|
1871
|
+
|
|
1872
|
+
for (i in schedules) {
|
|
1873
|
+
o = schedules[i];
|
|
1874
|
+
if (o.name !== self.name) continue;
|
|
1875
|
+
|
|
1876
|
+
// While this element already has a starting transition during this frame,
|
|
1877
|
+
// defer starting an interrupting transition until that transition has a
|
|
1878
|
+
// chance to tick (and possibly end); see d3/d3-transition#54!
|
|
1879
|
+
if (o.state === STARTED) return timeout(start);
|
|
1880
|
+
|
|
1881
|
+
// Interrupt the active transition, if any.
|
|
1882
|
+
if (o.state === RUNNING) {
|
|
1883
|
+
o.state = ENDED;
|
|
1884
|
+
o.timer.stop();
|
|
1885
|
+
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
|
1886
|
+
delete schedules[i];
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// Cancel any pre-empted transitions.
|
|
1890
|
+
else if (+i < id) {
|
|
1891
|
+
o.state = ENDED;
|
|
1892
|
+
o.timer.stop();
|
|
1893
|
+
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
|
1894
|
+
delete schedules[i];
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
// Defer the first tick to end of the current frame; see d3/d3#1576.
|
|
1899
|
+
// Note the transition may be canceled after start and before the first tick!
|
|
1900
|
+
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
|
1901
|
+
// Assuming this is successful, subsequent callbacks go straight to tick.
|
|
1902
|
+
timeout(function() {
|
|
1903
|
+
if (self.state === STARTED) {
|
|
1904
|
+
self.state = RUNNING;
|
|
1905
|
+
self.timer.restart(tick, self.delay, self.time);
|
|
1906
|
+
tick(elapsed);
|
|
1907
|
+
}
|
|
1908
|
+
});
|
|
1909
|
+
|
|
1910
|
+
// Dispatch the start event.
|
|
1911
|
+
// Note this must be done before the tween are initialized.
|
|
1912
|
+
self.state = STARTING;
|
|
1913
|
+
self.on.call("start", node, node.__data__, self.index, self.group);
|
|
1914
|
+
if (self.state !== STARTING) return; // interrupted
|
|
1915
|
+
self.state = STARTED;
|
|
1916
|
+
|
|
1917
|
+
// Initialize the tween, deleting null tween.
|
|
1918
|
+
tween = new Array(n = self.tween.length);
|
|
1919
|
+
for (i = 0, j = -1; i < n; ++i) {
|
|
1920
|
+
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
|
1921
|
+
tween[++j] = o;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
tween.length = j + 1;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
function tick(elapsed) {
|
|
1928
|
+
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
|
1929
|
+
i = -1,
|
|
1930
|
+
n = tween.length;
|
|
1931
|
+
|
|
1932
|
+
while (++i < n) {
|
|
1933
|
+
tween[i].call(node, t);
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
// Dispatch the end event.
|
|
1937
|
+
if (self.state === ENDING) {
|
|
1938
|
+
self.on.call("end", node, node.__data__, self.index, self.group);
|
|
1939
|
+
stop();
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
function stop() {
|
|
1944
|
+
self.state = ENDED;
|
|
1945
|
+
self.timer.stop();
|
|
1946
|
+
delete schedules[id];
|
|
1947
|
+
for (var i in schedules) return; // eslint-disable-line no-unused-vars
|
|
1948
|
+
delete node.__transition;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
function interrupt(node, name) {
|
|
1953
|
+
var schedules = node.__transition,
|
|
1954
|
+
schedule,
|
|
1955
|
+
active,
|
|
1956
|
+
empty = true,
|
|
1957
|
+
i;
|
|
1958
|
+
|
|
1959
|
+
if (!schedules) return;
|
|
1960
|
+
|
|
1961
|
+
name = name == null ? null : name + "";
|
|
1962
|
+
|
|
1963
|
+
for (i in schedules) {
|
|
1964
|
+
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
|
1965
|
+
active = schedule.state > STARTING && schedule.state < ENDING;
|
|
1966
|
+
schedule.state = ENDED;
|
|
1967
|
+
schedule.timer.stop();
|
|
1968
|
+
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
|
1969
|
+
delete schedules[i];
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
if (empty) delete node.__transition;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
function selection_interrupt(name) {
|
|
1976
|
+
return this.each(function() {
|
|
1977
|
+
interrupt(this, name);
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
function tweenRemove(id, name) {
|
|
1982
|
+
var tween0, tween1;
|
|
1983
|
+
return function() {
|
|
1984
|
+
var schedule = set(this, id),
|
|
1985
|
+
tween = schedule.tween;
|
|
1986
|
+
|
|
1987
|
+
// If this node shared tween with the previous node,
|
|
1988
|
+
// just assign the updated shared tween and we’re done!
|
|
1989
|
+
// Otherwise, copy-on-write.
|
|
1990
|
+
if (tween !== tween0) {
|
|
1991
|
+
tween1 = tween0 = tween;
|
|
1992
|
+
for (var i = 0, n = tween1.length; i < n; ++i) {
|
|
1993
|
+
if (tween1[i].name === name) {
|
|
1994
|
+
tween1 = tween1.slice();
|
|
1995
|
+
tween1.splice(i, 1);
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
schedule.tween = tween1;
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
function tweenFunction(id, name, value) {
|
|
2006
|
+
var tween0, tween1;
|
|
2007
|
+
if (typeof value !== "function") throw new Error;
|
|
2008
|
+
return function() {
|
|
2009
|
+
var schedule = set(this, id),
|
|
2010
|
+
tween = schedule.tween;
|
|
2011
|
+
|
|
2012
|
+
// If this node shared tween with the previous node,
|
|
2013
|
+
// just assign the updated shared tween and we’re done!
|
|
2014
|
+
// Otherwise, copy-on-write.
|
|
2015
|
+
if (tween !== tween0) {
|
|
2016
|
+
tween1 = (tween0 = tween).slice();
|
|
2017
|
+
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
|
2018
|
+
if (tween1[i].name === name) {
|
|
2019
|
+
tween1[i] = t;
|
|
2020
|
+
break;
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
if (i === n) tween1.push(t);
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
schedule.tween = tween1;
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
function transition_tween(name, value) {
|
|
2031
|
+
var id = this._id;
|
|
2032
|
+
|
|
2033
|
+
name += "";
|
|
2034
|
+
|
|
2035
|
+
if (arguments.length < 2) {
|
|
2036
|
+
var tween = get(this.node(), id).tween;
|
|
2037
|
+
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
|
2038
|
+
if ((t = tween[i]).name === name) {
|
|
2039
|
+
return t.value;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
function tweenValue(transition, name, value) {
|
|
2049
|
+
var id = transition._id;
|
|
2050
|
+
|
|
2051
|
+
transition.each(function() {
|
|
2052
|
+
var schedule = set(this, id);
|
|
2053
|
+
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
|
2054
|
+
});
|
|
2055
|
+
|
|
2056
|
+
return function(node) {
|
|
2057
|
+
return get(node, id).value[name];
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
function interpolate(a, b) {
|
|
2062
|
+
var c;
|
|
2063
|
+
return (typeof b === "number" ? interpolateNumber
|
|
2064
|
+
: b instanceof color ? interpolateRgb
|
|
2065
|
+
: (c = color(b)) ? (b = c, interpolateRgb)
|
|
2066
|
+
: interpolateString)(a, b);
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
function attrRemove(name) {
|
|
2070
|
+
return function() {
|
|
2071
|
+
this.removeAttribute(name);
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
function attrRemoveNS(fullname) {
|
|
2076
|
+
return function() {
|
|
2077
|
+
this.removeAttributeNS(fullname.space, fullname.local);
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
function attrConstant(name, interpolate, value1) {
|
|
2082
|
+
var string00,
|
|
2083
|
+
string1 = value1 + "",
|
|
2084
|
+
interpolate0;
|
|
2085
|
+
return function() {
|
|
2086
|
+
var string0 = this.getAttribute(name);
|
|
2087
|
+
return string0 === string1 ? null
|
|
2088
|
+
: string0 === string00 ? interpolate0
|
|
2089
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
function attrConstantNS(fullname, interpolate, value1) {
|
|
2094
|
+
var string00,
|
|
2095
|
+
string1 = value1 + "",
|
|
2096
|
+
interpolate0;
|
|
2097
|
+
return function() {
|
|
2098
|
+
var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
2099
|
+
return string0 === string1 ? null
|
|
2100
|
+
: string0 === string00 ? interpolate0
|
|
2101
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
function attrFunction(name, interpolate, value) {
|
|
2106
|
+
var string00,
|
|
2107
|
+
string10,
|
|
2108
|
+
interpolate0;
|
|
2109
|
+
return function() {
|
|
2110
|
+
var string0, value1 = value(this), string1;
|
|
2111
|
+
if (value1 == null) return void this.removeAttribute(name);
|
|
2112
|
+
string0 = this.getAttribute(name);
|
|
2113
|
+
string1 = value1 + "";
|
|
2114
|
+
return string0 === string1 ? null
|
|
2115
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
2116
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
function attrFunctionNS(fullname, interpolate, value) {
|
|
2121
|
+
var string00,
|
|
2122
|
+
string10,
|
|
2123
|
+
interpolate0;
|
|
2124
|
+
return function() {
|
|
2125
|
+
var string0, value1 = value(this), string1;
|
|
2126
|
+
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
|
2127
|
+
string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
2128
|
+
string1 = value1 + "";
|
|
2129
|
+
return string0 === string1 ? null
|
|
2130
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
2131
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
function transition_attr(name, value) {
|
|
2136
|
+
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
|
|
2137
|
+
return this.attrTween(name, typeof value === "function"
|
|
2138
|
+
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
|
|
2139
|
+
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
|
|
2140
|
+
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
function attrInterpolate(name, i) {
|
|
2144
|
+
return function(t) {
|
|
2145
|
+
this.setAttribute(name, i.call(this, t));
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
function attrInterpolateNS(fullname, i) {
|
|
2150
|
+
return function(t) {
|
|
2151
|
+
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
function attrTweenNS(fullname, value) {
|
|
2156
|
+
var t0, i0;
|
|
2157
|
+
function tween() {
|
|
2158
|
+
var i = value.apply(this, arguments);
|
|
2159
|
+
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
|
2160
|
+
return t0;
|
|
2161
|
+
}
|
|
2162
|
+
tween._value = value;
|
|
2163
|
+
return tween;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
function attrTween(name, value) {
|
|
2167
|
+
var t0, i0;
|
|
2168
|
+
function tween() {
|
|
2169
|
+
var i = value.apply(this, arguments);
|
|
2170
|
+
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
|
|
2171
|
+
return t0;
|
|
2172
|
+
}
|
|
2173
|
+
tween._value = value;
|
|
2174
|
+
return tween;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
function transition_attrTween(name, value) {
|
|
2178
|
+
var key = "attr." + name;
|
|
2179
|
+
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|
2180
|
+
if (value == null) return this.tween(key, null);
|
|
2181
|
+
if (typeof value !== "function") throw new Error;
|
|
2182
|
+
var fullname = namespace(name);
|
|
2183
|
+
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
function delayFunction(id, value) {
|
|
2187
|
+
return function() {
|
|
2188
|
+
init(this, id).delay = +value.apply(this, arguments);
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
function delayConstant(id, value) {
|
|
2193
|
+
return value = +value, function() {
|
|
2194
|
+
init(this, id).delay = value;
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
function transition_delay(value) {
|
|
2199
|
+
var id = this._id;
|
|
2200
|
+
|
|
2201
|
+
return arguments.length
|
|
2202
|
+
? this.each((typeof value === "function"
|
|
2203
|
+
? delayFunction
|
|
2204
|
+
: delayConstant)(id, value))
|
|
2205
|
+
: get(this.node(), id).delay;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
function durationFunction(id, value) {
|
|
2209
|
+
return function() {
|
|
2210
|
+
set(this, id).duration = +value.apply(this, arguments);
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
function durationConstant(id, value) {
|
|
2215
|
+
return value = +value, function() {
|
|
2216
|
+
set(this, id).duration = value;
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
function transition_duration(value) {
|
|
2221
|
+
var id = this._id;
|
|
2222
|
+
|
|
2223
|
+
return arguments.length
|
|
2224
|
+
? this.each((typeof value === "function"
|
|
2225
|
+
? durationFunction
|
|
2226
|
+
: durationConstant)(id, value))
|
|
2227
|
+
: get(this.node(), id).duration;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
function easeConstant(id, value) {
|
|
2231
|
+
if (typeof value !== "function") throw new Error;
|
|
2232
|
+
return function() {
|
|
2233
|
+
set(this, id).ease = value;
|
|
2234
|
+
};
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
function transition_ease(value) {
|
|
2238
|
+
var id = this._id;
|
|
2239
|
+
|
|
2240
|
+
return arguments.length
|
|
2241
|
+
? this.each(easeConstant(id, value))
|
|
2242
|
+
: get(this.node(), id).ease;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
function easeVarying(id, value) {
|
|
2246
|
+
return function() {
|
|
2247
|
+
var v = value.apply(this, arguments);
|
|
2248
|
+
if (typeof v !== "function") throw new Error;
|
|
2249
|
+
set(this, id).ease = v;
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
function transition_easeVarying(value) {
|
|
2254
|
+
if (typeof value !== "function") throw new Error;
|
|
2255
|
+
return this.each(easeVarying(this._id, value));
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
function transition_filter(match) {
|
|
2259
|
+
if (typeof match !== "function") match = matcher(match);
|
|
2260
|
+
|
|
2261
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
2262
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
2263
|
+
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
2264
|
+
subgroup.push(node);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
return new Transition(subgroups, this._parents, this._name, this._id);
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
function transition_merge(transition) {
|
|
2273
|
+
if (transition._id !== this._id) throw new Error;
|
|
2274
|
+
|
|
2275
|
+
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
|
2276
|
+
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
2277
|
+
if (node = group0[i] || group1[i]) {
|
|
2278
|
+
merge[i] = node;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
for (; j < m0; ++j) {
|
|
2284
|
+
merges[j] = groups0[j];
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
return new Transition(merges, this._parents, this._name, this._id);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
function start(name) {
|
|
2291
|
+
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
|
2292
|
+
var i = t.indexOf(".");
|
|
2293
|
+
if (i >= 0) t = t.slice(0, i);
|
|
2294
|
+
return !t || t === "start";
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
function onFunction(id, name, listener) {
|
|
2299
|
+
var on0, on1, sit = start(name) ? init : set;
|
|
2300
|
+
return function() {
|
|
2301
|
+
var schedule = sit(this, id),
|
|
2302
|
+
on = schedule.on;
|
|
2303
|
+
|
|
2304
|
+
// If this node shared a dispatch with the previous node,
|
|
2305
|
+
// just assign the updated shared dispatch and we’re done!
|
|
2306
|
+
// Otherwise, copy-on-write.
|
|
2307
|
+
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
|
2308
|
+
|
|
2309
|
+
schedule.on = on1;
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
function transition_on(name, listener) {
|
|
2314
|
+
var id = this._id;
|
|
2315
|
+
|
|
2316
|
+
return arguments.length < 2
|
|
2317
|
+
? get(this.node(), id).on.on(name)
|
|
2318
|
+
: this.each(onFunction(id, name, listener));
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
function removeFunction(id) {
|
|
2322
|
+
return function() {
|
|
2323
|
+
var parent = this.parentNode;
|
|
2324
|
+
for (var i in this.__transition) if (+i !== id) return;
|
|
2325
|
+
if (parent) parent.removeChild(this);
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
function transition_remove() {
|
|
2330
|
+
return this.on("end.remove", removeFunction(this._id));
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
function transition_select(select) {
|
|
2334
|
+
var name = this._name,
|
|
2335
|
+
id = this._id;
|
|
2336
|
+
|
|
2337
|
+
if (typeof select !== "function") select = selector(select);
|
|
2338
|
+
|
|
2339
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
2340
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
2341
|
+
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
2342
|
+
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
2343
|
+
subgroup[i] = subnode;
|
|
2344
|
+
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
return new Transition(subgroups, this._parents, name, id);
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
function transition_selectAll(select) {
|
|
2353
|
+
var name = this._name,
|
|
2354
|
+
id = this._id;
|
|
2355
|
+
|
|
2356
|
+
if (typeof select !== "function") select = selectorAll(select);
|
|
2357
|
+
|
|
2358
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
2359
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
2360
|
+
if (node = group[i]) {
|
|
2361
|
+
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
|
2362
|
+
if (child = children[k]) {
|
|
2363
|
+
schedule(child, name, id, k, children, inherit);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
subgroups.push(children);
|
|
2367
|
+
parents.push(node);
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
return new Transition(subgroups, parents, name, id);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
var Selection = selection.prototype.constructor;
|
|
2376
|
+
|
|
2377
|
+
function transition_selection() {
|
|
2378
|
+
return new Selection(this._groups, this._parents);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
function styleNull(name, interpolate) {
|
|
2382
|
+
var string00,
|
|
2383
|
+
string10,
|
|
2384
|
+
interpolate0;
|
|
2385
|
+
return function() {
|
|
2386
|
+
var string0 = styleValue(this, name),
|
|
2387
|
+
string1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
2388
|
+
return string0 === string1 ? null
|
|
2389
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
2390
|
+
: interpolate0 = interpolate(string00 = string0, string10 = string1);
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
function styleRemove(name) {
|
|
2395
|
+
return function() {
|
|
2396
|
+
this.style.removeProperty(name);
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
function styleConstant(name, interpolate, value1) {
|
|
2401
|
+
var string00,
|
|
2402
|
+
string1 = value1 + "",
|
|
2403
|
+
interpolate0;
|
|
2404
|
+
return function() {
|
|
2405
|
+
var string0 = styleValue(this, name);
|
|
2406
|
+
return string0 === string1 ? null
|
|
2407
|
+
: string0 === string00 ? interpolate0
|
|
2408
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
function styleFunction(name, interpolate, value) {
|
|
2413
|
+
var string00,
|
|
2414
|
+
string10,
|
|
2415
|
+
interpolate0;
|
|
2416
|
+
return function() {
|
|
2417
|
+
var string0 = styleValue(this, name),
|
|
2418
|
+
value1 = value(this),
|
|
2419
|
+
string1 = value1 + "";
|
|
2420
|
+
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
2421
|
+
return string0 === string1 ? null
|
|
2422
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
2423
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
2424
|
+
};
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
function styleMaybeRemove(id, name) {
|
|
2428
|
+
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
|
2429
|
+
return function() {
|
|
2430
|
+
var schedule = set(this, id),
|
|
2431
|
+
on = schedule.on,
|
|
2432
|
+
listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
|
|
2433
|
+
|
|
2434
|
+
// If this node shared a dispatch with the previous node,
|
|
2435
|
+
// just assign the updated shared dispatch and we’re done!
|
|
2436
|
+
// Otherwise, copy-on-write.
|
|
2437
|
+
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
|
2438
|
+
|
|
2439
|
+
schedule.on = on1;
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
function transition_style(name, value, priority) {
|
|
2444
|
+
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
|
|
2445
|
+
return value == null ? this
|
|
2446
|
+
.styleTween(name, styleNull(name, i))
|
|
2447
|
+
.on("end.style." + name, styleRemove(name))
|
|
2448
|
+
: typeof value === "function" ? this
|
|
2449
|
+
.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value)))
|
|
2450
|
+
.each(styleMaybeRemove(this._id, name))
|
|
2451
|
+
: this
|
|
2452
|
+
.styleTween(name, styleConstant(name, i, value), priority)
|
|
2453
|
+
.on("end.style." + name, null);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
function styleInterpolate(name, i, priority) {
|
|
2457
|
+
return function(t) {
|
|
2458
|
+
this.style.setProperty(name, i.call(this, t), priority);
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
function styleTween(name, value, priority) {
|
|
2463
|
+
var t, i0;
|
|
2464
|
+
function tween() {
|
|
2465
|
+
var i = value.apply(this, arguments);
|
|
2466
|
+
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
|
2467
|
+
return t;
|
|
2468
|
+
}
|
|
2469
|
+
tween._value = value;
|
|
2470
|
+
return tween;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
function transition_styleTween(name, value, priority) {
|
|
2474
|
+
var key = "style." + (name += "");
|
|
2475
|
+
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|
2476
|
+
if (value == null) return this.tween(key, null);
|
|
2477
|
+
if (typeof value !== "function") throw new Error;
|
|
2478
|
+
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
function textConstant(value) {
|
|
2482
|
+
return function() {
|
|
2483
|
+
this.textContent = value;
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
function textFunction(value) {
|
|
2488
|
+
return function() {
|
|
2489
|
+
var value1 = value(this);
|
|
2490
|
+
this.textContent = value1 == null ? "" : value1;
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
function transition_text(value) {
|
|
2495
|
+
return this.tween("text", typeof value === "function"
|
|
2496
|
+
? textFunction(tweenValue(this, "text", value))
|
|
2497
|
+
: textConstant(value == null ? "" : value + ""));
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
function textInterpolate(i) {
|
|
2501
|
+
return function(t) {
|
|
2502
|
+
this.textContent = i.call(this, t);
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
function textTween(value) {
|
|
2507
|
+
var t0, i0;
|
|
2508
|
+
function tween() {
|
|
2509
|
+
var i = value.apply(this, arguments);
|
|
2510
|
+
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
|
2511
|
+
return t0;
|
|
2512
|
+
}
|
|
2513
|
+
tween._value = value;
|
|
2514
|
+
return tween;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
function transition_textTween(value) {
|
|
2518
|
+
var key = "text";
|
|
2519
|
+
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
|
|
2520
|
+
if (value == null) return this.tween(key, null);
|
|
2521
|
+
if (typeof value !== "function") throw new Error;
|
|
2522
|
+
return this.tween(key, textTween(value));
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
function transition_transition() {
|
|
2526
|
+
var name = this._name,
|
|
2527
|
+
id0 = this._id,
|
|
2528
|
+
id1 = newId();
|
|
2529
|
+
|
|
2530
|
+
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
2531
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
2532
|
+
if (node = group[i]) {
|
|
2533
|
+
var inherit = get(node, id0);
|
|
2534
|
+
schedule(node, name, id1, i, group, {
|
|
2535
|
+
time: inherit.time + inherit.delay + inherit.duration,
|
|
2536
|
+
delay: 0,
|
|
2537
|
+
duration: inherit.duration,
|
|
2538
|
+
ease: inherit.ease
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
return new Transition(groups, this._parents, name, id1);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
function transition_end() {
|
|
2548
|
+
var on0, on1, that = this, id = that._id, size = that.size();
|
|
2549
|
+
return new Promise(function(resolve, reject) {
|
|
2550
|
+
var cancel = {value: reject},
|
|
2551
|
+
end = {value: function() { if (--size === 0) resolve(); }};
|
|
2552
|
+
|
|
2553
|
+
that.each(function() {
|
|
2554
|
+
var schedule = set(this, id),
|
|
2555
|
+
on = schedule.on;
|
|
2556
|
+
|
|
2557
|
+
// If this node shared a dispatch with the previous node,
|
|
2558
|
+
// just assign the updated shared dispatch and we’re done!
|
|
2559
|
+
// Otherwise, copy-on-write.
|
|
2560
|
+
if (on !== on0) {
|
|
2561
|
+
on1 = (on0 = on).copy();
|
|
2562
|
+
on1._.cancel.push(cancel);
|
|
2563
|
+
on1._.interrupt.push(cancel);
|
|
2564
|
+
on1._.end.push(end);
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
schedule.on = on1;
|
|
2568
|
+
});
|
|
2569
|
+
|
|
2570
|
+
// The selection was empty, resolve end immediately
|
|
2571
|
+
if (size === 0) resolve();
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
var id = 0;
|
|
2576
|
+
|
|
2577
|
+
function Transition(groups, parents, name, id) {
|
|
2578
|
+
this._groups = groups;
|
|
2579
|
+
this._parents = parents;
|
|
2580
|
+
this._name = name;
|
|
2581
|
+
this._id = id;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
function newId() {
|
|
2585
|
+
return ++id;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
var selection_prototype = selection.prototype;
|
|
2589
|
+
|
|
2590
|
+
Transition.prototype = {
|
|
2591
|
+
constructor: Transition,
|
|
2592
|
+
select: transition_select,
|
|
2593
|
+
selectAll: transition_selectAll,
|
|
2594
|
+
selectChild: selection_prototype.selectChild,
|
|
2595
|
+
selectChildren: selection_prototype.selectChildren,
|
|
2596
|
+
filter: transition_filter,
|
|
2597
|
+
merge: transition_merge,
|
|
2598
|
+
selection: transition_selection,
|
|
2599
|
+
transition: transition_transition,
|
|
2600
|
+
call: selection_prototype.call,
|
|
2601
|
+
nodes: selection_prototype.nodes,
|
|
2602
|
+
node: selection_prototype.node,
|
|
2603
|
+
size: selection_prototype.size,
|
|
2604
|
+
empty: selection_prototype.empty,
|
|
2605
|
+
each: selection_prototype.each,
|
|
2606
|
+
on: transition_on,
|
|
2607
|
+
attr: transition_attr,
|
|
2608
|
+
attrTween: transition_attrTween,
|
|
2609
|
+
style: transition_style,
|
|
2610
|
+
styleTween: transition_styleTween,
|
|
2611
|
+
text: transition_text,
|
|
2612
|
+
textTween: transition_textTween,
|
|
2613
|
+
remove: transition_remove,
|
|
2614
|
+
tween: transition_tween,
|
|
2615
|
+
delay: transition_delay,
|
|
2616
|
+
duration: transition_duration,
|
|
2617
|
+
ease: transition_ease,
|
|
2618
|
+
easeVarying: transition_easeVarying,
|
|
2619
|
+
end: transition_end,
|
|
2620
|
+
[Symbol.iterator]: selection_prototype[Symbol.iterator]
|
|
2621
|
+
};
|
|
2622
|
+
|
|
2623
|
+
function cubicInOut(t) {
|
|
2624
|
+
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
var defaultTiming = {
|
|
2628
|
+
time: null, // Set on use.
|
|
2629
|
+
delay: 0,
|
|
2630
|
+
duration: 250,
|
|
2631
|
+
ease: cubicInOut
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
function inherit(node, id) {
|
|
2635
|
+
var timing;
|
|
2636
|
+
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
|
2637
|
+
if (!(node = node.parentNode)) {
|
|
2638
|
+
throw new Error(`transition ${id} not found`);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return timing;
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
function selection_transition(name) {
|
|
2645
|
+
var id,
|
|
2646
|
+
timing;
|
|
2647
|
+
|
|
2648
|
+
if (name instanceof Transition) {
|
|
2649
|
+
id = name._id, name = name._name;
|
|
2650
|
+
} else {
|
|
2651
|
+
id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
2655
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
2656
|
+
if (node = group[i]) {
|
|
2657
|
+
schedule(node, name, id, i, group, timing || inherit(node, id));
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
return new Transition(groups, this._parents, name, id);
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
selection.prototype.interrupt = selection_interrupt;
|
|
2666
|
+
selection.prototype.transition = selection_transition;
|
|
2667
|
+
|
|
2668
|
+
const pi$1 = Math.PI,
|
|
2669
|
+
tau$1 = 2 * pi$1,
|
|
2670
|
+
epsilon$1 = 1e-6,
|
|
2671
|
+
tauEpsilon = tau$1 - epsilon$1;
|
|
2672
|
+
|
|
2673
|
+
function append(strings) {
|
|
2674
|
+
this._ += strings[0];
|
|
2675
|
+
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
2676
|
+
this._ += arguments[i] + strings[i];
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
function appendRound(digits) {
|
|
2681
|
+
let d = Math.floor(digits);
|
|
2682
|
+
if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
|
|
2683
|
+
if (d > 15) return append;
|
|
2684
|
+
const k = 10 ** d;
|
|
2685
|
+
return function(strings) {
|
|
2686
|
+
this._ += strings[0];
|
|
2687
|
+
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
2688
|
+
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
class Path {
|
|
2694
|
+
constructor(digits) {
|
|
2695
|
+
this._x0 = this._y0 = // start of current subpath
|
|
2696
|
+
this._x1 = this._y1 = null; // end of current subpath
|
|
2697
|
+
this._ = "";
|
|
2698
|
+
this._append = digits == null ? append : appendRound(digits);
|
|
2699
|
+
}
|
|
2700
|
+
moveTo(x, y) {
|
|
2701
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
|
|
2702
|
+
}
|
|
2703
|
+
closePath() {
|
|
2704
|
+
if (this._x1 !== null) {
|
|
2705
|
+
this._x1 = this._x0, this._y1 = this._y0;
|
|
2706
|
+
this._append`Z`;
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
lineTo(x, y) {
|
|
2710
|
+
this._append`L${this._x1 = +x},${this._y1 = +y}`;
|
|
2711
|
+
}
|
|
2712
|
+
quadraticCurveTo(x1, y1, x, y) {
|
|
2713
|
+
this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
|
|
2714
|
+
}
|
|
2715
|
+
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2716
|
+
this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
|
|
2717
|
+
}
|
|
2718
|
+
arcTo(x1, y1, x2, y2, r) {
|
|
2719
|
+
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
2720
|
+
|
|
2721
|
+
// Is the radius negative? Error.
|
|
2722
|
+
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
2723
|
+
|
|
2724
|
+
let x0 = this._x1,
|
|
2725
|
+
y0 = this._y1,
|
|
2726
|
+
x21 = x2 - x1,
|
|
2727
|
+
y21 = y2 - y1,
|
|
2728
|
+
x01 = x0 - x1,
|
|
2729
|
+
y01 = y0 - y1,
|
|
2730
|
+
l01_2 = x01 * x01 + y01 * y01;
|
|
2731
|
+
|
|
2732
|
+
// Is this path empty? Move to (x1,y1).
|
|
2733
|
+
if (this._x1 === null) {
|
|
2734
|
+
this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
|
2738
|
+
else if (!(l01_2 > epsilon$1));
|
|
2739
|
+
|
|
2740
|
+
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
|
2741
|
+
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
|
2742
|
+
// Or, is the radius zero? Line to (x1,y1).
|
|
2743
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {
|
|
2744
|
+
this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
// Otherwise, draw an arc!
|
|
2748
|
+
else {
|
|
2749
|
+
let x20 = x2 - x0,
|
|
2750
|
+
y20 = y2 - y0,
|
|
2751
|
+
l21_2 = x21 * x21 + y21 * y21,
|
|
2752
|
+
l20_2 = x20 * x20 + y20 * y20,
|
|
2753
|
+
l21 = Math.sqrt(l21_2),
|
|
2754
|
+
l01 = Math.sqrt(l01_2),
|
|
2755
|
+
l = r * Math.tan((pi$1 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
|
2756
|
+
t01 = l / l01,
|
|
2757
|
+
t21 = l / l21;
|
|
2758
|
+
|
|
2759
|
+
// If the start tangent is not coincident with (x0,y0), line to.
|
|
2760
|
+
if (Math.abs(t01 - 1) > epsilon$1) {
|
|
2761
|
+
this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
arc(x, y, r, a0, a1, ccw) {
|
|
2768
|
+
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
2769
|
+
|
|
2770
|
+
// Is the radius negative? Error.
|
|
2771
|
+
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
2772
|
+
|
|
2773
|
+
let dx = r * Math.cos(a0),
|
|
2774
|
+
dy = r * Math.sin(a0),
|
|
2775
|
+
x0 = x + dx,
|
|
2776
|
+
y0 = y + dy,
|
|
2777
|
+
cw = 1 ^ ccw,
|
|
2778
|
+
da = ccw ? a0 - a1 : a1 - a0;
|
|
2779
|
+
|
|
2780
|
+
// Is this path empty? Move to (x0,y0).
|
|
2781
|
+
if (this._x1 === null) {
|
|
2782
|
+
this._append`M${x0},${y0}`;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
|
2786
|
+
else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {
|
|
2787
|
+
this._append`L${x0},${y0}`;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
// Is this arc empty? We’re done.
|
|
2791
|
+
if (!r) return;
|
|
2792
|
+
|
|
2793
|
+
// Does the angle go the wrong way? Flip the direction.
|
|
2794
|
+
if (da < 0) da = da % tau$1 + tau$1;
|
|
2795
|
+
|
|
2796
|
+
// Is this a complete circle? Draw two arcs to complete the circle.
|
|
2797
|
+
if (da > tauEpsilon) {
|
|
2798
|
+
this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
// Is this arc non-empty? Draw an arc!
|
|
2802
|
+
else if (da > epsilon$1) {
|
|
2803
|
+
this._append`A${r},${r},0,${+(da >= pi$1)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
rect(x, y, w, h) {
|
|
2807
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
|
|
2808
|
+
}
|
|
2809
|
+
toString() {
|
|
2810
|
+
return this._;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
function initRange(domain, range) {
|
|
2815
|
+
switch (arguments.length) {
|
|
2816
|
+
case 0: break;
|
|
2817
|
+
case 1: this.range(domain); break;
|
|
2818
|
+
default: this.range(range).domain(domain); break;
|
|
2819
|
+
}
|
|
2820
|
+
return this;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
const implicit = Symbol("implicit");
|
|
2824
|
+
|
|
2825
|
+
function ordinal() {
|
|
2826
|
+
var index = new InternMap(),
|
|
2827
|
+
domain = [],
|
|
2828
|
+
range = [],
|
|
2829
|
+
unknown = implicit;
|
|
2830
|
+
|
|
2831
|
+
function scale(d) {
|
|
2832
|
+
let i = index.get(d);
|
|
2833
|
+
if (i === undefined) {
|
|
2834
|
+
if (unknown !== implicit) return unknown;
|
|
2835
|
+
index.set(d, i = domain.push(d) - 1);
|
|
2836
|
+
}
|
|
2837
|
+
return range[i % range.length];
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
scale.domain = function(_) {
|
|
2841
|
+
if (!arguments.length) return domain.slice();
|
|
2842
|
+
domain = [], index = new InternMap();
|
|
2843
|
+
for (const value of _) {
|
|
2844
|
+
if (index.has(value)) continue;
|
|
2845
|
+
index.set(value, domain.push(value) - 1);
|
|
2846
|
+
}
|
|
2847
|
+
return scale;
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
scale.range = function(_) {
|
|
2851
|
+
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2854
|
+
scale.unknown = function(_) {
|
|
2855
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
2856
|
+
};
|
|
2857
|
+
|
|
2858
|
+
scale.copy = function() {
|
|
2859
|
+
return ordinal(domain, range).unknown(unknown);
|
|
2860
|
+
};
|
|
2861
|
+
|
|
2862
|
+
initRange.apply(scale, arguments);
|
|
2863
|
+
|
|
2864
|
+
return scale;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
function constant(x) {
|
|
2868
|
+
return function constant() {
|
|
2869
|
+
return x;
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
const abs = Math.abs;
|
|
2874
|
+
const atan2 = Math.atan2;
|
|
2875
|
+
const cos = Math.cos;
|
|
2876
|
+
const max = Math.max;
|
|
2877
|
+
const min = Math.min;
|
|
2878
|
+
const sin = Math.sin;
|
|
2879
|
+
const sqrt = Math.sqrt;
|
|
2880
|
+
|
|
2881
|
+
const epsilon = 1e-12;
|
|
2882
|
+
const pi = Math.PI;
|
|
2883
|
+
const halfPi = pi / 2;
|
|
2884
|
+
const tau = 2 * pi;
|
|
2885
|
+
|
|
2886
|
+
function acos(x) {
|
|
2887
|
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
function asin(x) {
|
|
2891
|
+
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
function withPath(shape) {
|
|
2895
|
+
let digits = 3;
|
|
2896
|
+
|
|
2897
|
+
shape.digits = function(_) {
|
|
2898
|
+
if (!arguments.length) return digits;
|
|
2899
|
+
if (_ == null) {
|
|
2900
|
+
digits = null;
|
|
2901
|
+
} else {
|
|
2902
|
+
const d = Math.floor(_);
|
|
2903
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
2904
|
+
digits = d;
|
|
2905
|
+
}
|
|
2906
|
+
return shape;
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2909
|
+
return () => new Path(digits);
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
function arcInnerRadius(d) {
|
|
2913
|
+
return d.innerRadius;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
function arcOuterRadius(d) {
|
|
2917
|
+
return d.outerRadius;
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
function arcStartAngle(d) {
|
|
2921
|
+
return d.startAngle;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
function arcEndAngle(d) {
|
|
2925
|
+
return d.endAngle;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
function arcPadAngle(d) {
|
|
2929
|
+
return d && d.padAngle; // Note: optional!
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
2933
|
+
var x10 = x1 - x0, y10 = y1 - y0,
|
|
2934
|
+
x32 = x3 - x2, y32 = y3 - y2,
|
|
2935
|
+
t = y32 * x10 - x32 * y10;
|
|
2936
|
+
if (t * t < epsilon) return;
|
|
2937
|
+
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
2938
|
+
return [x0 + t * x10, y0 + t * y10];
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
// Compute perpendicular offset line of length rc.
|
|
2942
|
+
// http://mathworld.wolfram.com/Circle-LineIntersection.html
|
|
2943
|
+
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
2944
|
+
var x01 = x0 - x1,
|
|
2945
|
+
y01 = y0 - y1,
|
|
2946
|
+
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
|
|
2947
|
+
ox = lo * y01,
|
|
2948
|
+
oy = -lo * x01,
|
|
2949
|
+
x11 = x0 + ox,
|
|
2950
|
+
y11 = y0 + oy,
|
|
2951
|
+
x10 = x1 + ox,
|
|
2952
|
+
y10 = y1 + oy,
|
|
2953
|
+
x00 = (x11 + x10) / 2,
|
|
2954
|
+
y00 = (y11 + y10) / 2,
|
|
2955
|
+
dx = x10 - x11,
|
|
2956
|
+
dy = y10 - y11,
|
|
2957
|
+
d2 = dx * dx + dy * dy,
|
|
2958
|
+
r = r1 - rc,
|
|
2959
|
+
D = x11 * y10 - x10 * y11,
|
|
2960
|
+
d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
|
|
2961
|
+
cx0 = (D * dy - dx * d) / d2,
|
|
2962
|
+
cy0 = (-D * dx - dy * d) / d2,
|
|
2963
|
+
cx1 = (D * dy + dx * d) / d2,
|
|
2964
|
+
cy1 = (-D * dx + dy * d) / d2,
|
|
2965
|
+
dx0 = cx0 - x00,
|
|
2966
|
+
dy0 = cy0 - y00,
|
|
2967
|
+
dx1 = cx1 - x00,
|
|
2968
|
+
dy1 = cy1 - y00;
|
|
2969
|
+
|
|
2970
|
+
// Pick the closer of the two intersection points.
|
|
2971
|
+
// TODO Is there a faster way to determine which intersection to use?
|
|
2972
|
+
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
|
2973
|
+
|
|
2974
|
+
return {
|
|
2975
|
+
cx: cx0,
|
|
2976
|
+
cy: cy0,
|
|
2977
|
+
x01: -ox,
|
|
2978
|
+
y01: -oy,
|
|
2979
|
+
x11: cx0 * (r1 / r - 1),
|
|
2980
|
+
y11: cy0 * (r1 / r - 1)
|
|
2981
|
+
};
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
function arc() {
|
|
2985
|
+
var innerRadius = arcInnerRadius,
|
|
2986
|
+
outerRadius = arcOuterRadius,
|
|
2987
|
+
cornerRadius = constant(0),
|
|
2988
|
+
padRadius = null,
|
|
2989
|
+
startAngle = arcStartAngle,
|
|
2990
|
+
endAngle = arcEndAngle,
|
|
2991
|
+
padAngle = arcPadAngle,
|
|
2992
|
+
context = null,
|
|
2993
|
+
path = withPath(arc);
|
|
2994
|
+
|
|
2995
|
+
function arc() {
|
|
2996
|
+
var buffer,
|
|
2997
|
+
r,
|
|
2998
|
+
r0 = +innerRadius.apply(this, arguments),
|
|
2999
|
+
r1 = +outerRadius.apply(this, arguments),
|
|
3000
|
+
a0 = startAngle.apply(this, arguments) - halfPi,
|
|
3001
|
+
a1 = endAngle.apply(this, arguments) - halfPi,
|
|
3002
|
+
da = abs(a1 - a0),
|
|
3003
|
+
cw = a1 > a0;
|
|
3004
|
+
|
|
3005
|
+
if (!context) context = buffer = path();
|
|
3006
|
+
|
|
3007
|
+
// Ensure that the outer radius is always larger than the inner radius.
|
|
3008
|
+
if (r1 < r0) r = r1, r1 = r0, r0 = r;
|
|
3009
|
+
|
|
3010
|
+
// Is it a point?
|
|
3011
|
+
if (!(r1 > epsilon)) context.moveTo(0, 0);
|
|
3012
|
+
|
|
3013
|
+
// Or is it a circle or annulus?
|
|
3014
|
+
else if (da > tau - epsilon) {
|
|
3015
|
+
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
3016
|
+
context.arc(0, 0, r1, a0, a1, !cw);
|
|
3017
|
+
if (r0 > epsilon) {
|
|
3018
|
+
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
3019
|
+
context.arc(0, 0, r0, a1, a0, cw);
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
// Or is it a circular or annular sector?
|
|
3024
|
+
else {
|
|
3025
|
+
var a01 = a0,
|
|
3026
|
+
a11 = a1,
|
|
3027
|
+
a00 = a0,
|
|
3028
|
+
a10 = a1,
|
|
3029
|
+
da0 = da,
|
|
3030
|
+
da1 = da,
|
|
3031
|
+
ap = padAngle.apply(this, arguments) / 2,
|
|
3032
|
+
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
|
|
3033
|
+
rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
|
|
3034
|
+
rc0 = rc,
|
|
3035
|
+
rc1 = rc,
|
|
3036
|
+
t0,
|
|
3037
|
+
t1;
|
|
3038
|
+
|
|
3039
|
+
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
|
3040
|
+
if (rp > epsilon) {
|
|
3041
|
+
var p0 = asin(rp / r0 * sin(ap)),
|
|
3042
|
+
p1 = asin(rp / r1 * sin(ap));
|
|
3043
|
+
if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
|
|
3044
|
+
else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
3045
|
+
if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
|
|
3046
|
+
else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
var x01 = r1 * cos(a01),
|
|
3050
|
+
y01 = r1 * sin(a01),
|
|
3051
|
+
x10 = r0 * cos(a10),
|
|
3052
|
+
y10 = r0 * sin(a10);
|
|
3053
|
+
|
|
3054
|
+
// Apply rounded corners?
|
|
3055
|
+
if (rc > epsilon) {
|
|
3056
|
+
var x11 = r1 * cos(a11),
|
|
3057
|
+
y11 = r1 * sin(a11),
|
|
3058
|
+
x00 = r0 * cos(a00),
|
|
3059
|
+
y00 = r0 * sin(a00),
|
|
3060
|
+
oc;
|
|
3061
|
+
|
|
3062
|
+
// Restrict the corner radius according to the sector angle. If this
|
|
3063
|
+
// intersection fails, it’s probably because the arc is too small, so
|
|
3064
|
+
// disable the corner radius entirely.
|
|
3065
|
+
if (da < pi) {
|
|
3066
|
+
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
3067
|
+
var ax = x01 - oc[0],
|
|
3068
|
+
ay = y01 - oc[1],
|
|
3069
|
+
bx = x11 - oc[0],
|
|
3070
|
+
by = y11 - oc[1],
|
|
3071
|
+
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
|
|
3072
|
+
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
3073
|
+
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
3074
|
+
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
3075
|
+
} else {
|
|
3076
|
+
rc0 = rc1 = 0;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
// Is the sector collapsed to a line?
|
|
3082
|
+
if (!(da1 > epsilon)) context.moveTo(x01, y01);
|
|
3083
|
+
|
|
3084
|
+
// Does the sector’s outer ring have rounded corners?
|
|
3085
|
+
else if (rc1 > epsilon) {
|
|
3086
|
+
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
3087
|
+
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
3088
|
+
|
|
3089
|
+
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
3090
|
+
|
|
3091
|
+
// Have the corners merged?
|
|
3092
|
+
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
3093
|
+
|
|
3094
|
+
// Otherwise, draw the two corners and the ring.
|
|
3095
|
+
else {
|
|
3096
|
+
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
3097
|
+
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
3098
|
+
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// Or is the outer ring just a circular arc?
|
|
3103
|
+
else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
3104
|
+
|
|
3105
|
+
// Is there no inner ring, and it’s a circular sector?
|
|
3106
|
+
// Or perhaps it’s an annular sector collapsed due to padding?
|
|
3107
|
+
if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
|
|
3108
|
+
|
|
3109
|
+
// Does the sector’s inner ring (or point) have rounded corners?
|
|
3110
|
+
else if (rc0 > epsilon) {
|
|
3111
|
+
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
3112
|
+
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
3113
|
+
|
|
3114
|
+
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
3115
|
+
|
|
3116
|
+
// Have the corners merged?
|
|
3117
|
+
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
3118
|
+
|
|
3119
|
+
// Otherwise, draw the two corners and the ring.
|
|
3120
|
+
else {
|
|
3121
|
+
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
3122
|
+
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
3123
|
+
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
// Or is the inner ring just a circular arc?
|
|
3128
|
+
else context.arc(0, 0, r0, a10, a00, cw);
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
context.closePath();
|
|
3132
|
+
|
|
3133
|
+
if (buffer) return context = null, buffer + "" || null;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
arc.centroid = function() {
|
|
3137
|
+
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
|
|
3138
|
+
a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
3139
|
+
return [cos(a) * r, sin(a) * r];
|
|
3140
|
+
};
|
|
3141
|
+
|
|
3142
|
+
arc.innerRadius = function(_) {
|
|
3143
|
+
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
arc.outerRadius = function(_) {
|
|
3147
|
+
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
3148
|
+
};
|
|
3149
|
+
|
|
3150
|
+
arc.cornerRadius = function(_) {
|
|
3151
|
+
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
3152
|
+
};
|
|
3153
|
+
|
|
3154
|
+
arc.padRadius = function(_) {
|
|
3155
|
+
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
3156
|
+
};
|
|
3157
|
+
|
|
3158
|
+
arc.startAngle = function(_) {
|
|
3159
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
3160
|
+
};
|
|
3161
|
+
|
|
3162
|
+
arc.endAngle = function(_) {
|
|
3163
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
arc.padAngle = function(_) {
|
|
3167
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
3168
|
+
};
|
|
3169
|
+
|
|
3170
|
+
arc.context = function(_) {
|
|
3171
|
+
return arguments.length ? ((context = _ == null ? null : _), arc) : context;
|
|
3172
|
+
};
|
|
3173
|
+
|
|
3174
|
+
return arc;
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
function array(x) {
|
|
3178
|
+
return typeof x === "object" && "length" in x
|
|
3179
|
+
? x // Array, TypedArray, NodeList, array-like
|
|
3180
|
+
: Array.from(x); // Map, Set, iterable, string, or anything else
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
function descending(a, b) {
|
|
3184
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
3185
|
+
}
|
|
3186
|
+
|
|
3187
|
+
function identity(d) {
|
|
3188
|
+
return d;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
function pie() {
|
|
3192
|
+
var value = identity,
|
|
3193
|
+
sortValues = descending,
|
|
3194
|
+
sort = null,
|
|
3195
|
+
startAngle = constant(0),
|
|
3196
|
+
endAngle = constant(tau),
|
|
3197
|
+
padAngle = constant(0);
|
|
3198
|
+
|
|
3199
|
+
function pie(data) {
|
|
3200
|
+
var i,
|
|
3201
|
+
n = (data = array(data)).length,
|
|
3202
|
+
j,
|
|
3203
|
+
k,
|
|
3204
|
+
sum = 0,
|
|
3205
|
+
index = new Array(n),
|
|
3206
|
+
arcs = new Array(n),
|
|
3207
|
+
a0 = +startAngle.apply(this, arguments),
|
|
3208
|
+
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),
|
|
3209
|
+
a1,
|
|
3210
|
+
p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
|
|
3211
|
+
pa = p * (da < 0 ? -1 : 1),
|
|
3212
|
+
v;
|
|
3213
|
+
|
|
3214
|
+
for (i = 0; i < n; ++i) {
|
|
3215
|
+
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
|
3216
|
+
sum += v;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
// Optionally sort the arcs by previously-computed values or by data.
|
|
3221
|
+
if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
|
|
3222
|
+
else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
|
|
3223
|
+
|
|
3224
|
+
// Compute the arcs! They are stored in the original data's order.
|
|
3225
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
|
3226
|
+
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
3227
|
+
data: data[j],
|
|
3228
|
+
index: i,
|
|
3229
|
+
value: v,
|
|
3230
|
+
startAngle: a0,
|
|
3231
|
+
endAngle: a1,
|
|
3232
|
+
padAngle: p
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
return arcs;
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
pie.value = function(_) {
|
|
3240
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
|
|
3241
|
+
};
|
|
3242
|
+
|
|
3243
|
+
pie.sortValues = function(_) {
|
|
3244
|
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3247
|
+
pie.sort = function(_) {
|
|
3248
|
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
pie.startAngle = function(_) {
|
|
3252
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3255
|
+
pie.endAngle = function(_) {
|
|
3256
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
|
|
3257
|
+
};
|
|
3258
|
+
|
|
3259
|
+
pie.padAngle = function(_) {
|
|
3260
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
|
|
3261
|
+
};
|
|
3262
|
+
|
|
3263
|
+
return pie;
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
function Transform(k, x, y) {
|
|
3267
|
+
this.k = k;
|
|
3268
|
+
this.x = x;
|
|
3269
|
+
this.y = y;
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
Transform.prototype = {
|
|
3273
|
+
constructor: Transform,
|
|
3274
|
+
scale: function(k) {
|
|
3275
|
+
return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
|
3276
|
+
},
|
|
3277
|
+
translate: function(x, y) {
|
|
3278
|
+
return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
|
|
3279
|
+
},
|
|
3280
|
+
apply: function(point) {
|
|
3281
|
+
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
3282
|
+
},
|
|
3283
|
+
applyX: function(x) {
|
|
3284
|
+
return x * this.k + this.x;
|
|
3285
|
+
},
|
|
3286
|
+
applyY: function(y) {
|
|
3287
|
+
return y * this.k + this.y;
|
|
3288
|
+
},
|
|
3289
|
+
invert: function(location) {
|
|
3290
|
+
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
|
3291
|
+
},
|
|
3292
|
+
invertX: function(x) {
|
|
3293
|
+
return (x - this.x) / this.k;
|
|
3294
|
+
},
|
|
3295
|
+
invertY: function(y) {
|
|
3296
|
+
return (y - this.y) / this.k;
|
|
3297
|
+
},
|
|
3298
|
+
rescaleX: function(x) {
|
|
3299
|
+
return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
|
|
3300
|
+
},
|
|
3301
|
+
rescaleY: function(y) {
|
|
3302
|
+
return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
|
3303
|
+
},
|
|
3304
|
+
toString: function() {
|
|
3305
|
+
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
|
3306
|
+
}
|
|
3307
|
+
};
|
|
3308
|
+
|
|
3309
|
+
Transform.prototype;
|
|
3310
|
+
|
|
3311
|
+
export { arc as a, cubicInOut as c, interpolateNumber as i, ordinal as o, pie as p, select as s };
|
|
3312
|
+
//# sourceMappingURL=transform-DRuHEvar.js.map
|