@mozaic-ds/web-components 0.5.0 → 0.6.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/package.json +3 -3
- package/public/ClickOutside-63071e7a.js +1 -15
- package/public/ClickOutside-63071e7a.js.map +1 -1
- package/public/DataTableDefaultAction.nested-4da4dc44.js +1 -759
- package/public/DataTableDefaultAction.nested-4da4dc44.js.map +1 -1
- package/public/DataTableUtilities-60220c78.js +1 -370
- package/public/DataTableUtilities-60220c78.js.map +1 -1
- package/public/EventForward-8492ff62.js +1 -109
- package/public/EventForward-8492ff62.js.map +1 -1
- package/public/EventHandler-02058705.js +1 -15
- package/public/EventHandler-02058705.js.map +1 -1
- package/public/adeo/components/layer/Layer.js +1 -1
- package/public/adeo/components/layer/Layer.js.map +1 -1
- package/public/adeo/components/layer/Layer.svelte +2 -1
- package/public/adeo/components/phonenumber/PhoneNumber.js +1 -1
- package/public/adeo/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/adeo/components/phonenumber/PhoneNumber.svelte +72 -9
- package/public/adeo/components/quantityselector/QuantitySelector.js +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/array-5b770a93.js +1 -13
- package/public/array-5b770a93.js.map +1 -1
- package/public/axis-fbc0f7b5.js +1 -174
- package/public/axis-fbc0f7b5.js.map +1 -1
- package/public/band-d7a07d2c.js +1 -186
- package/public/band-d7a07d2c.js.map +1 -1
- package/public/bricoman/components/chart/Donut.js +1 -1
- package/public/bricoman/components/header/Header.js +1 -1
- package/public/bricoman/components/hero/Hero.js +1 -1
- package/public/bricoman/components/layer/Layer.js +1 -1
- package/public/bricoman/components/layer/Layer.js.map +1 -1
- package/public/bricoman/components/layer/Layer.svelte +2 -1
- package/public/bricoman/components/listbox/Listbox.js +1 -1
- package/public/bricoman/components/listbox/Listbox.nested.js +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.js +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.svelte +72 -9
- package/public/bricoman/components/price/Price.js +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.js +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/components/accordion/Accordion.js +1 -365
- package/public/components/accordion/Accordion.js.map +1 -1
- package/public/components/autocomplete/Autocomplete.js +1 -1515
- package/public/components/autocomplete/Autocomplete.js.map +1 -1
- package/public/components/badge/Badge.js +1 -155
- package/public/components/badge/Badge.js.map +1 -1
- package/public/components/badge/Badge.nested.js +1 -101
- package/public/components/badge/Badge.nested.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.js +1 -372
- package/public/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js +1 -319
- package/public/components/breadcrumb/Breadcrumb.nested.js.map +1 -1
- package/public/components/button/Button.js +1 -1138
- package/public/components/button/Button.js.map +1 -1
- package/public/components/card/Card.js +1 -369
- package/public/components/card/Card.js.map +1 -1
- package/public/components/chart/BarChart.js +1 -582
- package/public/components/chart/BarChart.js.map +1 -1
- package/public/components/chart/Donut.js +1 -1189
- package/public/components/chart/Donut.js.map +1 -1
- package/public/components/chart/GroupedBarChart.js +1 -750
- package/public/components/chart/GroupedBarChart.js.map +1 -1
- package/public/components/chart/LineChart.js +1 -1731
- package/public/components/chart/LineChart.js.map +1 -1
- package/public/components/chart/Radar.js +1 -729
- package/public/components/chart/Radar.js.map +1 -1
- package/public/components/chart/StackedBarChart.js +1 -745
- package/public/components/chart/StackedBarChart.js.map +1 -1
- package/public/components/checkbox/Checkbox.js +1 -307
- package/public/components/checkbox/Checkbox.js.map +1 -1
- package/public/components/checkboxgroup/checkboxGroup.js +1 -404
- package/public/components/checkboxgroup/checkboxGroup.js.map +1 -1
- package/public/components/datatable/DataTable.js +1 -3064
- package/public/components/datatable/DataTable.js.map +1 -1
- package/public/components/datatable/DataTableDefaultAction.nested.js +1 -4
- package/public/components/datatable/DataTableDefaultAction.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js +1 -164
- package/public/components/datatable/DataTableDefaultEdtion.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js +1 -380
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js +1 -424
- package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js +1 -263
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js.map +1 -1
- package/public/components/datatable/DataTableFooter.nested.js +1 -637
- package/public/components/datatable/DataTableFooter.nested.js.map +1 -1
- package/public/components/dropdown/Dropdown.js +1 -1426
- package/public/components/dropdown/Dropdown.js.map +1 -1
- package/public/components/field/Field.js +1 -375
- package/public/components/field/Field.js.map +1 -1
- package/public/components/fileuploader/FileUploader.js +1 -555
- package/public/components/fileuploader/FileUploader.js.map +1 -1
- package/public/components/fileuploader/ResultFile.nested.js +1 -265
- package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/components/flag/Flag.js +1 -174
- package/public/components/flag/Flag.js.map +1 -1
- package/public/components/header/Header.js +1 -903
- package/public/components/header/Header.js.map +1 -1
- package/public/components/hero/Hero.js +1 -271
- package/public/components/hero/Hero.js.map +1 -1
- package/public/components/layer/Layer.js +1 -453
- package/public/components/layer/Layer.js.map +1 -1
- package/public/components/layer/Layer.svelte +2 -1
- package/public/components/link/Link.js +1 -380
- package/public/components/link/Link.js.map +1 -1
- package/public/components/listbox/Listbox.js +1 -595
- package/public/components/listbox/Listbox.js.map +1 -1
- package/public/components/listbox/Listbox.nested.js +1 -629
- package/public/components/listbox/Listbox.nested.js.map +1 -1
- package/public/components/loader/Loader.js +1 -246
- package/public/components/loader/Loader.js.map +1 -1
- package/public/components/loader/Loader.nested.js +1 -176
- package/public/components/loader/Loader.nested.js.map +1 -1
- package/public/components/modal/Modal.js +1 -395
- package/public/components/modal/Modal.js.map +1 -1
- package/public/components/notification/Notification.js +1 -458
- package/public/components/notification/Notification.js.map +1 -1
- package/public/components/optionbutton/OptionButton.js +1 -316
- package/public/components/optionbutton/OptionButton.js.map +1 -1
- package/public/components/overlay/Overlay.js +1 -104
- package/public/components/overlay/Overlay.js.map +1 -1
- package/public/components/overlay/OverlayLoader.js +1 -151
- package/public/components/overlay/OverlayLoader.js.map +1 -1
- package/public/components/pagination/Pagination.js +1 -613
- package/public/components/pagination/Pagination.js.map +1 -1
- package/public/components/passwordinput/PasswordInput.js +1 -291
- package/public/components/passwordinput/PasswordInput.js.map +1 -1
- package/public/components/phonenumber/PhoneNumber.js +1 -6894
- package/public/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/components/price/Price.js +1 -768
- package/public/components/price/Price.js.map +1 -1
- package/public/components/progressbar/ProgressBar.js +1 -278
- package/public/components/progressbar/ProgressBar.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.js +1 -333
- package/public/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/components/radio/Radio.js +1 -273
- package/public/components/radio/Radio.js.map +1 -1
- package/public/components/radiogroup/RadioGroup.js +1 -414
- package/public/components/radiogroup/RadioGroup.js.map +1 -1
- package/public/components/ratings/StarsInput.js +1 -292
- package/public/components/ratings/StarsInput.js.map +1 -1
- package/public/components/ratings/StarsResult.js +1 -246
- package/public/components/ratings/StarsResult.js.map +1 -1
- package/public/components/select/Select.js +1 -451
- package/public/components/select/Select.js.map +1 -1
- package/public/components/sidebar/Sidebar.js +1 -784
- package/public/components/sidebar/Sidebar.js.map +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js +1 -594
- package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-feature.nested.js +1 -402
- package/public/components/sidebar/sidebar-feature.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-section.nested.js +1 -394
- package/public/components/sidebar/sidebar-section.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js +1 -200
- package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-separator.nested.js +1 -49
- package/public/components/sidebar/sidebar-separator.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js +1 -312
- package/public/components/sidebar/sidebar-sub-features.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-user.nested.js +1 -733
- package/public/components/sidebar/sidebar-user.nested.js.map +1 -1
- package/public/components/stepper/Stepper.js +1 -371
- package/public/components/stepper/Stepper.js.map +1 -1
- package/public/components/tabs/Tabs.js +1 -615
- package/public/components/tabs/Tabs.js.map +1 -1
- package/public/components/tabs/Tabs.nested.js +1 -472
- package/public/components/tabs/Tabs.nested.js.map +1 -1
- package/public/components/tag/Tag.js +1 -665
- package/public/components/tag/Tag.js.map +1 -1
- package/public/components/tag/Tag.nested.js +1 -554
- package/public/components/tag/Tag.nested.js.map +1 -1
- package/public/components/taglist/TagList.js +1 -475
- package/public/components/taglist/TagList.js.map +1 -1
- package/public/components/textarea/Textarea.js +1 -303
- package/public/components/textarea/Textarea.js.map +1 -1
- package/public/components/textinput/Textinput.js +1 -497
- package/public/components/textinput/Textinput.js.map +1 -1
- package/public/components/textinput/Textinput.nested.js +1 -320
- package/public/components/textinput/Textinput.nested.js.map +1 -1
- package/public/components/toggle/Toggle.js +1 -278
- package/public/components/toggle/Toggle.js.map +1 -1
- package/public/components/tooltip/Tooltip.js +1 -173
- package/public/components/tooltip/Tooltip.js.map +1 -1
- package/public/index-c33b3772.js +1 -873
- package/public/index-c33b3772.js.map +1 -1
- package/public/linear-f46d7e9e.js +1 -700
- package/public/linear-f46d7e9e.js.map +1 -1
- package/public/path-1b5da959.js +1 -186
- package/public/path-1b5da959.js.map +1 -1
- package/public/sidebar-service-275bf9ef.js +1 -129
- package/public/sidebar-service-275bf9ef.js.map +1 -1
- package/public/symbol-b05a6e2b.js +1 -169
- package/public/symbol-b05a6e2b.js.map +1 -1
- package/public/transform-15d69d5d.js +1 -2743
- package/public/transform-15d69d5d.js.map +1 -1
- package/public/utilities/stories/quantityselector/QuantitySelector.stories.d.ts.map +1 -1
|
@@ -1,701 +1,2 @@
|
|
|
1
|
-
import { i
|
|
2
|
-
|
|
3
|
-
function ascending(a, b) {
|
|
4
|
-
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function descending(a, b) {
|
|
8
|
-
return a == null || b == null ? NaN
|
|
9
|
-
: b < a ? -1
|
|
10
|
-
: b > a ? 1
|
|
11
|
-
: b >= a ? 0
|
|
12
|
-
: NaN;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function bisector(f) {
|
|
16
|
-
let compare1, compare2, delta;
|
|
17
|
-
|
|
18
|
-
// If an accessor is specified, promote it to a comparator. In this case we
|
|
19
|
-
// can test whether the search value is (self-) comparable. We can’t do this
|
|
20
|
-
// for a comparator (except for specific, known comparators) because we can’t
|
|
21
|
-
// tell if the comparator is symmetric, and an asymmetric comparator can’t be
|
|
22
|
-
// used to test whether a single value is comparable.
|
|
23
|
-
if (f.length !== 2) {
|
|
24
|
-
compare1 = ascending;
|
|
25
|
-
compare2 = (d, x) => ascending(f(d), x);
|
|
26
|
-
delta = (d, x) => f(d) - x;
|
|
27
|
-
} else {
|
|
28
|
-
compare1 = f === ascending || f === descending ? f : zero;
|
|
29
|
-
compare2 = f;
|
|
30
|
-
delta = f;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function left(a, x, lo = 0, hi = a.length) {
|
|
34
|
-
if (lo < hi) {
|
|
35
|
-
if (compare1(x, x) !== 0) return hi;
|
|
36
|
-
do {
|
|
37
|
-
const mid = (lo + hi) >>> 1;
|
|
38
|
-
if (compare2(a[mid], x) < 0) lo = mid + 1;
|
|
39
|
-
else hi = mid;
|
|
40
|
-
} while (lo < hi);
|
|
41
|
-
}
|
|
42
|
-
return lo;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function right(a, x, lo = 0, hi = a.length) {
|
|
46
|
-
if (lo < hi) {
|
|
47
|
-
if (compare1(x, x) !== 0) return hi;
|
|
48
|
-
do {
|
|
49
|
-
const mid = (lo + hi) >>> 1;
|
|
50
|
-
if (compare2(a[mid], x) <= 0) lo = mid + 1;
|
|
51
|
-
else hi = mid;
|
|
52
|
-
} while (lo < hi);
|
|
53
|
-
}
|
|
54
|
-
return lo;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function center(a, x, lo = 0, hi = a.length) {
|
|
58
|
-
const i = left(a, x, lo, hi - 1);
|
|
59
|
-
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return {left, center, right};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function zero() {
|
|
66
|
-
return 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function number$1(x) {
|
|
70
|
-
return x === null ? NaN : +x;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const ascendingBisect = bisector(ascending);
|
|
74
|
-
const bisectRight = ascendingBisect.right;
|
|
75
|
-
bisector(number$1).center;
|
|
76
|
-
var bisect = bisectRight;
|
|
77
|
-
|
|
78
|
-
const e10 = Math.sqrt(50),
|
|
79
|
-
e5 = Math.sqrt(10),
|
|
80
|
-
e2 = Math.sqrt(2);
|
|
81
|
-
|
|
82
|
-
function tickSpec(start, stop, count) {
|
|
83
|
-
const step = (stop - start) / Math.max(0, count),
|
|
84
|
-
power = Math.floor(Math.log10(step)),
|
|
85
|
-
error = step / Math.pow(10, power),
|
|
86
|
-
factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
|
|
87
|
-
let i1, i2, inc;
|
|
88
|
-
if (power < 0) {
|
|
89
|
-
inc = Math.pow(10, -power) / factor;
|
|
90
|
-
i1 = Math.round(start * inc);
|
|
91
|
-
i2 = Math.round(stop * inc);
|
|
92
|
-
if (i1 / inc < start) ++i1;
|
|
93
|
-
if (i2 / inc > stop) --i2;
|
|
94
|
-
inc = -inc;
|
|
95
|
-
} else {
|
|
96
|
-
inc = Math.pow(10, power) * factor;
|
|
97
|
-
i1 = Math.round(start / inc);
|
|
98
|
-
i2 = Math.round(stop / inc);
|
|
99
|
-
if (i1 * inc < start) ++i1;
|
|
100
|
-
if (i2 * inc > stop) --i2;
|
|
101
|
-
}
|
|
102
|
-
if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
|
|
103
|
-
return [i1, i2, inc];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function ticks(start, stop, count) {
|
|
107
|
-
stop = +stop, start = +start, count = +count;
|
|
108
|
-
if (!(count > 0)) return [];
|
|
109
|
-
if (start === stop) return [start];
|
|
110
|
-
const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
111
|
-
if (!(i2 >= i1)) return [];
|
|
112
|
-
const n = i2 - i1 + 1, ticks = new Array(n);
|
|
113
|
-
if (reverse) {
|
|
114
|
-
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
|
|
115
|
-
else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
|
|
116
|
-
} else {
|
|
117
|
-
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
|
|
118
|
-
else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
|
|
119
|
-
}
|
|
120
|
-
return ticks;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function tickIncrement(start, stop, count) {
|
|
124
|
-
stop = +stop, start = +start, count = +count;
|
|
125
|
-
return tickSpec(start, stop, count)[2];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function tickStep(start, stop, count) {
|
|
129
|
-
stop = +stop, start = +start, count = +count;
|
|
130
|
-
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
131
|
-
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function interpolateRound(a, b) {
|
|
135
|
-
return a = +a, b = +b, function(t) {
|
|
136
|
-
return Math.round(a * (1 - t) + b * t);
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function formatDecimal(x) {
|
|
141
|
-
return Math.abs(x = Math.round(x)) >= 1e21
|
|
142
|
-
? x.toLocaleString("en").replace(/,/g, "")
|
|
143
|
-
: x.toString(10);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Computes the decimal coefficient and exponent of the specified number x with
|
|
147
|
-
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
|
148
|
-
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
|
149
|
-
function formatDecimalParts(x, p) {
|
|
150
|
-
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
|
|
151
|
-
var i, coefficient = x.slice(0, i);
|
|
152
|
-
|
|
153
|
-
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
|
|
154
|
-
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
|
|
155
|
-
return [
|
|
156
|
-
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
157
|
-
+x.slice(i + 1)
|
|
158
|
-
];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function exponent(x) {
|
|
162
|
-
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function formatGroup(grouping, thousands) {
|
|
166
|
-
return function(value, width) {
|
|
167
|
-
var i = value.length,
|
|
168
|
-
t = [],
|
|
169
|
-
j = 0,
|
|
170
|
-
g = grouping[0],
|
|
171
|
-
length = 0;
|
|
172
|
-
|
|
173
|
-
while (i > 0 && g > 0) {
|
|
174
|
-
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
175
|
-
t.push(value.substring(i -= g, i + g));
|
|
176
|
-
if ((length += g + 1) > width) break;
|
|
177
|
-
g = grouping[j = (j + 1) % grouping.length];
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return t.reverse().join(thousands);
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function formatNumerals(numerals) {
|
|
185
|
-
return function(value) {
|
|
186
|
-
return value.replace(/[0-9]/g, function(i) {
|
|
187
|
-
return numerals[+i];
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
|
|
193
|
-
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
194
|
-
|
|
195
|
-
function formatSpecifier(specifier) {
|
|
196
|
-
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
197
|
-
var match;
|
|
198
|
-
return new FormatSpecifier({
|
|
199
|
-
fill: match[1],
|
|
200
|
-
align: match[2],
|
|
201
|
-
sign: match[3],
|
|
202
|
-
symbol: match[4],
|
|
203
|
-
zero: match[5],
|
|
204
|
-
width: match[6],
|
|
205
|
-
comma: match[7],
|
|
206
|
-
precision: match[8] && match[8].slice(1),
|
|
207
|
-
trim: match[9],
|
|
208
|
-
type: match[10]
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
|
|
213
|
-
|
|
214
|
-
function FormatSpecifier(specifier) {
|
|
215
|
-
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
|
|
216
|
-
this.align = specifier.align === undefined ? ">" : specifier.align + "";
|
|
217
|
-
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
|
|
218
|
-
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
|
|
219
|
-
this.zero = !!specifier.zero;
|
|
220
|
-
this.width = specifier.width === undefined ? undefined : +specifier.width;
|
|
221
|
-
this.comma = !!specifier.comma;
|
|
222
|
-
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
|
|
223
|
-
this.trim = !!specifier.trim;
|
|
224
|
-
this.type = specifier.type === undefined ? "" : specifier.type + "";
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
FormatSpecifier.prototype.toString = function() {
|
|
228
|
-
return this.fill
|
|
229
|
-
+ this.align
|
|
230
|
-
+ this.sign
|
|
231
|
-
+ this.symbol
|
|
232
|
-
+ (this.zero ? "0" : "")
|
|
233
|
-
+ (this.width === undefined ? "" : Math.max(1, this.width | 0))
|
|
234
|
-
+ (this.comma ? "," : "")
|
|
235
|
-
+ (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
|
|
236
|
-
+ (this.trim ? "~" : "")
|
|
237
|
-
+ this.type;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
|
|
241
|
-
function formatTrim(s) {
|
|
242
|
-
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
|
243
|
-
switch (s[i]) {
|
|
244
|
-
case ".": i0 = i1 = i; break;
|
|
245
|
-
case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
|
246
|
-
default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
var prefixExponent;
|
|
253
|
-
|
|
254
|
-
function formatPrefixAuto(x, p) {
|
|
255
|
-
var d = formatDecimalParts(x, p);
|
|
256
|
-
if (!d) return x + "";
|
|
257
|
-
var coefficient = d[0],
|
|
258
|
-
exponent = d[1],
|
|
259
|
-
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
|
260
|
-
n = coefficient.length;
|
|
261
|
-
return i === n ? coefficient
|
|
262
|
-
: i > n ? coefficient + new Array(i - n + 1).join("0")
|
|
263
|
-
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
|
|
264
|
-
: "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function formatRounded(x, p) {
|
|
268
|
-
var d = formatDecimalParts(x, p);
|
|
269
|
-
if (!d) return x + "";
|
|
270
|
-
var coefficient = d[0],
|
|
271
|
-
exponent = d[1];
|
|
272
|
-
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
|
|
273
|
-
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
|
|
274
|
-
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
var formatTypes = {
|
|
278
|
-
"%": (x, p) => (x * 100).toFixed(p),
|
|
279
|
-
"b": (x) => Math.round(x).toString(2),
|
|
280
|
-
"c": (x) => x + "",
|
|
281
|
-
"d": formatDecimal,
|
|
282
|
-
"e": (x, p) => x.toExponential(p),
|
|
283
|
-
"f": (x, p) => x.toFixed(p),
|
|
284
|
-
"g": (x, p) => x.toPrecision(p),
|
|
285
|
-
"o": (x) => Math.round(x).toString(8),
|
|
286
|
-
"p": (x, p) => formatRounded(x * 100, p),
|
|
287
|
-
"r": formatRounded,
|
|
288
|
-
"s": formatPrefixAuto,
|
|
289
|
-
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
290
|
-
"x": (x) => Math.round(x).toString(16)
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
function identity$1(x) {
|
|
294
|
-
return x;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
var map = Array.prototype.map,
|
|
298
|
-
prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
|
299
|
-
|
|
300
|
-
function formatLocale(locale) {
|
|
301
|
-
var group = locale.grouping === undefined || locale.thousands === undefined ? identity$1 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
|
|
302
|
-
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
|
|
303
|
-
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
|
|
304
|
-
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
|
|
305
|
-
numerals = locale.numerals === undefined ? identity$1 : formatNumerals(map.call(locale.numerals, String)),
|
|
306
|
-
percent = locale.percent === undefined ? "%" : locale.percent + "",
|
|
307
|
-
minus = locale.minus === undefined ? "−" : locale.minus + "",
|
|
308
|
-
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
|
309
|
-
|
|
310
|
-
function newFormat(specifier) {
|
|
311
|
-
specifier = formatSpecifier(specifier);
|
|
312
|
-
|
|
313
|
-
var fill = specifier.fill,
|
|
314
|
-
align = specifier.align,
|
|
315
|
-
sign = specifier.sign,
|
|
316
|
-
symbol = specifier.symbol,
|
|
317
|
-
zero = specifier.zero,
|
|
318
|
-
width = specifier.width,
|
|
319
|
-
comma = specifier.comma,
|
|
320
|
-
precision = specifier.precision,
|
|
321
|
-
trim = specifier.trim,
|
|
322
|
-
type = specifier.type;
|
|
323
|
-
|
|
324
|
-
// The "n" type is an alias for ",g".
|
|
325
|
-
if (type === "n") comma = true, type = "g";
|
|
326
|
-
|
|
327
|
-
// The "" type, and any invalid type, is an alias for ".12~g".
|
|
328
|
-
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
|
|
329
|
-
|
|
330
|
-
// If zero fill is specified, padding goes after sign and before digits.
|
|
331
|
-
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
|
332
|
-
|
|
333
|
-
// Compute the prefix and suffix.
|
|
334
|
-
// For SI-prefix, the suffix is lazily computed.
|
|
335
|
-
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
|
336
|
-
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
|
|
337
|
-
|
|
338
|
-
// What format function should we use?
|
|
339
|
-
// Is this an integer type?
|
|
340
|
-
// Can this type generate exponential notation?
|
|
341
|
-
var formatType = formatTypes[type],
|
|
342
|
-
maybeSuffix = /[defgprs%]/.test(type);
|
|
343
|
-
|
|
344
|
-
// Set the default precision if not specified,
|
|
345
|
-
// or clamp the specified precision to the supported range.
|
|
346
|
-
// For significant precision, it must be in [1, 21].
|
|
347
|
-
// For fixed precision, it must be in [0, 20].
|
|
348
|
-
precision = precision === undefined ? 6
|
|
349
|
-
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
|
350
|
-
: Math.max(0, Math.min(20, precision));
|
|
351
|
-
|
|
352
|
-
function format(value) {
|
|
353
|
-
var valuePrefix = prefix,
|
|
354
|
-
valueSuffix = suffix,
|
|
355
|
-
i, n, c;
|
|
356
|
-
|
|
357
|
-
if (type === "c") {
|
|
358
|
-
valueSuffix = formatType(value) + valueSuffix;
|
|
359
|
-
value = "";
|
|
360
|
-
} else {
|
|
361
|
-
value = +value;
|
|
362
|
-
|
|
363
|
-
// Determine the sign. -0 is not less than 0, but 1 / -0 is!
|
|
364
|
-
var valueNegative = value < 0 || 1 / value < 0;
|
|
365
|
-
|
|
366
|
-
// Perform the initial formatting.
|
|
367
|
-
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
368
|
-
|
|
369
|
-
// Trim insignificant zeros.
|
|
370
|
-
if (trim) value = formatTrim(value);
|
|
371
|
-
|
|
372
|
-
// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
|
|
373
|
-
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
374
|
-
|
|
375
|
-
// Compute the prefix and suffix.
|
|
376
|
-
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
377
|
-
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
378
|
-
|
|
379
|
-
// Break the formatted value into the integer “value” part that can be
|
|
380
|
-
// grouped, and fractional or exponential “suffix” part that is not.
|
|
381
|
-
if (maybeSuffix) {
|
|
382
|
-
i = -1, n = value.length;
|
|
383
|
-
while (++i < n) {
|
|
384
|
-
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
385
|
-
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
386
|
-
value = value.slice(0, i);
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// If the fill character is not "0", grouping is applied before padding.
|
|
394
|
-
if (comma && !zero) value = group(value, Infinity);
|
|
395
|
-
|
|
396
|
-
// Compute the padding.
|
|
397
|
-
var length = valuePrefix.length + value.length + valueSuffix.length,
|
|
398
|
-
padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
399
|
-
|
|
400
|
-
// If the fill character is "0", grouping is applied after padding.
|
|
401
|
-
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
402
|
-
|
|
403
|
-
// Reconstruct the final output based on the desired alignment.
|
|
404
|
-
switch (align) {
|
|
405
|
-
case "<": value = valuePrefix + value + valueSuffix + padding; break;
|
|
406
|
-
case "=": value = valuePrefix + padding + value + valueSuffix; break;
|
|
407
|
-
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
|
|
408
|
-
default: value = padding + valuePrefix + value + valueSuffix; break;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return numerals(value);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
format.toString = function() {
|
|
415
|
-
return specifier + "";
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
return format;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function formatPrefix(specifier, value) {
|
|
422
|
-
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
|
423
|
-
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
|
424
|
-
k = Math.pow(10, -e),
|
|
425
|
-
prefix = prefixes[8 + e / 3];
|
|
426
|
-
return function(value) {
|
|
427
|
-
return f(k * value) + prefix;
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
return {
|
|
432
|
-
format: newFormat,
|
|
433
|
-
formatPrefix: formatPrefix
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
var locale;
|
|
438
|
-
var format;
|
|
439
|
-
var formatPrefix;
|
|
440
|
-
|
|
441
|
-
defaultLocale({
|
|
442
|
-
thousands: ",",
|
|
443
|
-
grouping: [3],
|
|
444
|
-
currency: ["$", ""]
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
function defaultLocale(definition) {
|
|
448
|
-
locale = formatLocale(definition);
|
|
449
|
-
format = locale.format;
|
|
450
|
-
formatPrefix = locale.formatPrefix;
|
|
451
|
-
return locale;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function precisionFixed(step) {
|
|
455
|
-
return Math.max(0, -exponent(Math.abs(step)));
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function precisionPrefix(step, value) {
|
|
459
|
-
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
function precisionRound(step, max) {
|
|
463
|
-
step = Math.abs(step), max = Math.abs(max) - step;
|
|
464
|
-
return Math.max(0, exponent(max) - exponent(step)) + 1;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function initRange(domain, range) {
|
|
468
|
-
switch (arguments.length) {
|
|
469
|
-
case 0: break;
|
|
470
|
-
case 1: this.range(domain); break;
|
|
471
|
-
default: this.range(range).domain(domain); break;
|
|
472
|
-
}
|
|
473
|
-
return this;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function constants(x) {
|
|
477
|
-
return function() {
|
|
478
|
-
return x;
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function number(x) {
|
|
483
|
-
return +x;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
var unit = [0, 1];
|
|
487
|
-
|
|
488
|
-
function identity(x) {
|
|
489
|
-
return x;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function normalize(a, b) {
|
|
493
|
-
return (b -= (a = +a))
|
|
494
|
-
? function(x) { return (x - a) / b; }
|
|
495
|
-
: constants(isNaN(b) ? NaN : 0.5);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
function clamper(a, b) {
|
|
499
|
-
var t;
|
|
500
|
-
if (a > b) t = a, a = b, b = t;
|
|
501
|
-
return function(x) { return Math.max(a, Math.min(b, x)); };
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
|
505
|
-
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
|
|
506
|
-
function bimap(domain, range, interpolate) {
|
|
507
|
-
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
|
508
|
-
if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
|
509
|
-
else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
|
510
|
-
return function(x) { return r0(d0(x)); };
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
function polymap(domain, range, interpolate) {
|
|
514
|
-
var j = Math.min(domain.length, range.length) - 1,
|
|
515
|
-
d = new Array(j),
|
|
516
|
-
r = new Array(j),
|
|
517
|
-
i = -1;
|
|
518
|
-
|
|
519
|
-
// Reverse descending domains.
|
|
520
|
-
if (domain[j] < domain[0]) {
|
|
521
|
-
domain = domain.slice().reverse();
|
|
522
|
-
range = range.slice().reverse();
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
while (++i < j) {
|
|
526
|
-
d[i] = normalize(domain[i], domain[i + 1]);
|
|
527
|
-
r[i] = interpolate(range[i], range[i + 1]);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
return function(x) {
|
|
531
|
-
var i = bisect(domain, x, 1, j) - 1;
|
|
532
|
-
return r[i](d[i](x));
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
function copy(source, target) {
|
|
537
|
-
return target
|
|
538
|
-
.domain(source.domain())
|
|
539
|
-
.range(source.range())
|
|
540
|
-
.interpolate(source.interpolate())
|
|
541
|
-
.clamp(source.clamp())
|
|
542
|
-
.unknown(source.unknown());
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function transformer() {
|
|
546
|
-
var domain = unit,
|
|
547
|
-
range = unit,
|
|
548
|
-
interpolate$1 = interpolate,
|
|
549
|
-
transform,
|
|
550
|
-
untransform,
|
|
551
|
-
unknown,
|
|
552
|
-
clamp = identity,
|
|
553
|
-
piecewise,
|
|
554
|
-
output,
|
|
555
|
-
input;
|
|
556
|
-
|
|
557
|
-
function rescale() {
|
|
558
|
-
var n = Math.min(domain.length, range.length);
|
|
559
|
-
if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);
|
|
560
|
-
piecewise = n > 2 ? polymap : bimap;
|
|
561
|
-
output = input = null;
|
|
562
|
-
return scale;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function scale(x) {
|
|
566
|
-
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
scale.invert = function(y) {
|
|
570
|
-
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
scale.domain = function(_) {
|
|
574
|
-
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
scale.range = function(_) {
|
|
578
|
-
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
scale.rangeRound = function(_) {
|
|
582
|
-
return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
scale.clamp = function(_) {
|
|
586
|
-
return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
scale.interpolate = function(_) {
|
|
590
|
-
return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
scale.unknown = function(_) {
|
|
594
|
-
return arguments.length ? (unknown = _, scale) : unknown;
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
return function(t, u) {
|
|
598
|
-
transform = t, untransform = u;
|
|
599
|
-
return rescale();
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function continuous() {
|
|
604
|
-
return transformer()(identity, identity);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
function tickFormat(start, stop, count, specifier) {
|
|
608
|
-
var step = tickStep(start, stop, count),
|
|
609
|
-
precision;
|
|
610
|
-
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
|
611
|
-
switch (specifier.type) {
|
|
612
|
-
case "s": {
|
|
613
|
-
var value = Math.max(Math.abs(start), Math.abs(stop));
|
|
614
|
-
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
|
615
|
-
return formatPrefix(specifier, value);
|
|
616
|
-
}
|
|
617
|
-
case "":
|
|
618
|
-
case "e":
|
|
619
|
-
case "g":
|
|
620
|
-
case "p":
|
|
621
|
-
case "r": {
|
|
622
|
-
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
case "f":
|
|
626
|
-
case "%": {
|
|
627
|
-
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
return format(specifier);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
function linearish(scale) {
|
|
635
|
-
var domain = scale.domain;
|
|
636
|
-
|
|
637
|
-
scale.ticks = function(count) {
|
|
638
|
-
var d = domain();
|
|
639
|
-
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
scale.tickFormat = function(count, specifier) {
|
|
643
|
-
var d = domain();
|
|
644
|
-
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
scale.nice = function(count) {
|
|
648
|
-
if (count == null) count = 10;
|
|
649
|
-
|
|
650
|
-
var d = domain();
|
|
651
|
-
var i0 = 0;
|
|
652
|
-
var i1 = d.length - 1;
|
|
653
|
-
var start = d[i0];
|
|
654
|
-
var stop = d[i1];
|
|
655
|
-
var prestep;
|
|
656
|
-
var step;
|
|
657
|
-
var maxIter = 10;
|
|
658
|
-
|
|
659
|
-
if (stop < start) {
|
|
660
|
-
step = start, start = stop, stop = step;
|
|
661
|
-
step = i0, i0 = i1, i1 = step;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
while (maxIter-- > 0) {
|
|
665
|
-
step = tickIncrement(start, stop, count);
|
|
666
|
-
if (step === prestep) {
|
|
667
|
-
d[i0] = start;
|
|
668
|
-
d[i1] = stop;
|
|
669
|
-
return domain(d);
|
|
670
|
-
} else if (step > 0) {
|
|
671
|
-
start = Math.floor(start / step) * step;
|
|
672
|
-
stop = Math.ceil(stop / step) * step;
|
|
673
|
-
} else if (step < 0) {
|
|
674
|
-
start = Math.ceil(start * step) / step;
|
|
675
|
-
stop = Math.floor(stop * step) / step;
|
|
676
|
-
} else {
|
|
677
|
-
break;
|
|
678
|
-
}
|
|
679
|
-
prestep = step;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
return scale;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
return scale;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
function linear() {
|
|
689
|
-
var scale = continuous();
|
|
690
|
-
|
|
691
|
-
scale.copy = function() {
|
|
692
|
-
return copy(scale, linear());
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
initRange.apply(scale, arguments);
|
|
696
|
-
|
|
697
|
-
return linearish(scale);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
export { copy as a, bisector as b, continuous as c, initRange as i, linear as l, tickStep as t };
|
|
1
|
+
import{i as n,a as t}from"./transform-15d69d5d.js";function r(n,t){return null==n||null==t?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function e(n,t){return null==n||null==t?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function i(n){let t,i,o;function u(n,r,e=0,a=n.length){if(e<a){if(0!==t(r,r))return a;do{const t=e+a>>>1;i(n[t],r)<0?e=t+1:a=t}while(e<a)}return e}return 2!==n.length?(t=r,i=(t,e)=>r(n(t),e),o=(t,r)=>n(t)-r):(t=n===r||n===e?n:a,i=n,o=n),{left:u,center:function(n,t,r=0,e=n.length){const i=u(n,t,r,e-1);return i>r&&o(n[i-1],t)>-o(n[i],t)?i-1:i},right:function(n,r,e=0,a=n.length){if(e<a){if(0!==t(r,r))return a;do{const t=e+a>>>1;i(n[t],r)<=0?e=t+1:a=t}while(e<a)}return e}}}function a(){return 0}const o=i(r).right;i((function(n){return null===n?NaN:+n})).center;var u=o;const c=Math.sqrt(50),s=Math.sqrt(10),l=Math.sqrt(2);function h(n,t,r){const e=(t-n)/Math.max(0,r),i=Math.floor(Math.log10(e)),a=e/Math.pow(10,i),o=a>=c?10:a>=s?5:a>=l?2:1;let u,f,g;return i<0?(g=Math.pow(10,-i)/o,u=Math.round(n*g),f=Math.round(t*g),u/g<n&&++u,f/g>t&&--f,g=-g):(g=Math.pow(10,i)*o,u=Math.round(n/g),f=Math.round(t/g),u*g<n&&++u,f*g>t&&--f),f<u&&.5<=r&&r<2?h(n,t,2*r):[u,f,g]}function f(n,t,r){return h(n=+n,t=+t,r=+r)[2]}function g(n,t,r){r=+r;const e=(t=+t)<(n=+n),i=e?f(t,n,r):f(n,t,r);return(e?-1:1)*(i<0?1/-i:i)}function m(n,t){return n=+n,t=+t,function(r){return Math.round(n*(1-r)+t*r)}}function p(n,t){if((r=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"))<0)return null;var r,e=n.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+n.slice(r+1)]}function d(n){return(n=p(Math.abs(n)))?n[1]:NaN}var M,v=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function y(n){if(!(t=v.exec(n)))throw new Error("invalid format: "+n);var t;return new b({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function b(n){this.fill=void 0===n.fill?" ":n.fill+"",this.align=void 0===n.align?">":n.align+"",this.sign=void 0===n.sign?"-":n.sign+"",this.symbol=void 0===n.symbol?"":n.symbol+"",this.zero=!!n.zero,this.width=void 0===n.width?void 0:+n.width,this.comma=!!n.comma,this.precision=void 0===n.precision?void 0:+n.precision,this.trim=!!n.trim,this.type=void 0===n.type?"":n.type+""}function w(n,t){var r=p(n,t);if(!r)return n+"";var e=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+e:e.length>i+1?e.slice(0,i+1)+"."+e.slice(i+1):e+new Array(i-e.length+2).join("0")}y.prototype=b.prototype,b.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var N={"%":(n,t)=>(100*n).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:function(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)},e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>w(100*n,t),r:w,s:function(n,t){var r=p(n,t);if(!r)return n+"";var e=r[0],i=r[1],a=i-(M=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=e.length;return a===o?e:a>o?e+new Array(a-o+1).join("0"):a>0?e.slice(0,a)+"."+e.slice(a):"0."+new Array(1-a).join("0")+p(n,Math.max(0,t+a-1))[0]},X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function x(n){return n}var k,A,S,j=Array.prototype.map,z=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function E(n){var t,r,e=void 0===n.grouping||void 0===n.thousands?x:(t=j.call(n.grouping,Number),r=n.thousands+"",function(n,e){for(var i=n.length,a=[],o=0,u=t[0],c=0;i>0&&u>0&&(c+u+1>e&&(u=Math.max(1,e-c)),a.push(n.substring(i-=u,i+u)),!((c+=u+1)>e));)u=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===n.currency?"":n.currency[0]+"",a=void 0===n.currency?"":n.currency[1]+"",o=void 0===n.decimal?".":n.decimal+"",u=void 0===n.numerals?x:function(n){return function(t){return t.replace(/[0-9]/g,(function(t){return n[+t]}))}}(j.call(n.numerals,String)),c=void 0===n.percent?"%":n.percent+"",s=void 0===n.minus?"−":n.minus+"",l=void 0===n.nan?"NaN":n.nan+"";function h(n){var t=(n=y(n)).fill,r=n.align,h=n.sign,f=n.symbol,g=n.zero,m=n.width,p=n.comma,d=n.precision,v=n.trim,b=n.type;"n"===b?(p=!0,b="g"):N[b]||(void 0===d&&(d=12),v=!0,b="g"),(g||"0"===t&&"="===r)&&(g=!0,t="0",r="=");var w="$"===f?i:"#"===f&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",x="$"===f?a:/[%p]/.test(b)?c:"",k=N[b],A=/[defgprs%]/.test(b);function S(n){var i,a,c,f=w,y=x;if("c"===b)y=k(n)+y,n="";else{var N=(n=+n)<0||1/n<0;if(n=isNaN(n)?l:k(Math.abs(n),d),v&&(n=function(n){n:for(var t,r=n.length,e=1,i=-1;e<r;++e)switch(n[e]){case".":i=t=e;break;case"0":0===i&&(i=e),t=e;break;default:if(!+n[e])break n;i>0&&(i=0)}return i>0?n.slice(0,i)+n.slice(t+1):n}(n)),N&&0==+n&&"+"!==h&&(N=!1),f=(N?"("===h?h:s:"-"===h||"("===h?"":h)+f,y=("s"===b?z[8+M/3]:"")+y+(N&&"("===h?")":""),A)for(i=-1,a=n.length;++i<a;)if(48>(c=n.charCodeAt(i))||c>57){y=(46===c?o+n.slice(i+1):n.slice(i))+y,n=n.slice(0,i);break}}p&&!g&&(n=e(n,1/0));var S=f.length+n.length+y.length,j=S<m?new Array(m-S+1).join(t):"";switch(p&&g&&(n=e(j+n,j.length?m-y.length:1/0),j=""),r){case"<":n=f+n+y+j;break;case"=":n=f+j+n+y;break;case"^":n=j.slice(0,S=j.length>>1)+f+n+y+j.slice(S);break;default:n=j+f+n+y}return u(n)}return d=void 0===d?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),S.toString=function(){return n+""},S}return{format:h,formatPrefix:function(n,t){var r=h(((n=y(n)).type="f",n)),e=3*Math.max(-8,Math.min(8,Math.floor(d(t)/3))),i=Math.pow(10,-e),a=z[8+e/3];return function(n){return r(i*n)+a}}}}function $(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function P(n){return+n}k=E({thousands:",",grouping:[3],currency:["$",""]}),A=k.format,S=k.formatPrefix;var q=[0,1];function C(n){return n}function F(n,t){return(t-=n=+n)?function(r){return(r-n)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function L(n,t,r){var e=n[0],i=n[1],a=t[0],o=t[1];return i<e?(e=F(i,e),a=r(o,a)):(e=F(e,i),a=r(a,o)),function(n){return a(e(n))}}function X(n,t,r){var e=Math.min(n.length,t.length)-1,i=new Array(e),a=new Array(e),o=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<e;)i[o]=F(n[o],n[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=u(n,t,1,e)-1;return a[r](i[r](t))}}function G(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function O(){var r,e,i,a,o,u,c=q,s=q,l=t,h=C;function f(){var n,t,r,e=Math.min(c.length,s.length);return h!==C&&(n=c[0],t=c[e-1],n>t&&(r=n,n=t,t=r),h=function(r){return Math.max(n,Math.min(t,r))}),a=e>2?X:L,o=u=null,g}function g(n){return null==n||isNaN(n=+n)?i:(o||(o=a(c.map(r),s,l)))(r(h(n)))}return g.invert=function(t){return h(e((u||(u=a(s,c.map(r),n)))(t)))},g.domain=function(n){return arguments.length?(c=Array.from(n,P),f()):c.slice()},g.range=function(n){return arguments.length?(s=Array.from(n),f()):s.slice()},g.rangeRound=function(n){return s=Array.from(n),l=m,f()},g.clamp=function(n){return arguments.length?(h=!!n||C,f()):h!==C},g.interpolate=function(n){return arguments.length?(l=n,f()):l},g.unknown=function(n){return arguments.length?(i=n,g):i},function(n,t){return r=n,e=t,f()}}function R(){return O()(C,C)}function T(n,t,r,e){var i,a=g(n,t,r);switch((e=y(null==e?",f":e)).type){case"s":var o=Math.max(Math.abs(n),Math.abs(t));return null!=e.precision||isNaN(i=function(n,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(d(t)/3)))-d(Math.abs(n)))}(a,o))||(e.precision=i),S(e,o);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(i=function(n,t){return n=Math.abs(n),t=Math.abs(t)-n,Math.max(0,d(t)-d(n))+1}(a,Math.max(Math.abs(n),Math.abs(t))))||(e.precision=i-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(i=function(n){return Math.max(0,-d(Math.abs(n)))}(a))||(e.precision=i-2*("%"===e.type))}return A(e)}function U(n){var t=n.domain;return n.ticks=function(n){var r=t();return function(n,t,r){if(!((r=+r)>0))return[];if((n=+n)==(t=+t))return[n];const e=t<n,[i,a,o]=e?h(t,n,r):h(n,t,r);if(!(a>=i))return[];const u=a-i+1,c=new Array(u);if(e)if(o<0)for(let n=0;n<u;++n)c[n]=(a-n)/-o;else for(let n=0;n<u;++n)c[n]=(a-n)*o;else if(o<0)for(let n=0;n<u;++n)c[n]=(i+n)/-o;else for(let n=0;n<u;++n)c[n]=(i+n)*o;return c}(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,r){var e=t();return T(e[0],e[e.length-1],null==n?10:n,r)},n.nice=function(r){null==r&&(r=10);var e,i,a=t(),o=0,u=a.length-1,c=a[o],s=a[u],l=10;for(s<c&&(i=c,c=s,s=i,i=o,o=u,u=i);l-- >0;){if((i=f(c,s,r))===e)return a[o]=c,a[u]=s,t(a);if(i>0)c=Math.floor(c/i)*i,s=Math.ceil(s/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,s=Math.floor(s*i)/i}e=i}return n},n}function Y(){var n=R();return n.copy=function(){return G(n,Y())},$.apply(n,arguments),U(n)}export{G as a,i as b,R as c,$ as i,Y as l,g as t};
|
|
701
2
|
//# sourceMappingURL=linear-f46d7e9e.js.map
|