@ni/nimble-components 17.0.0 → 17.0.2
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/all-components-bundle.js +3062 -119
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2904 -2633
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/table/index.d.ts +12 -1
- package/dist/esm/table/index.js +49 -2
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/table-validator.d.ts +13 -0
- package/dist/esm/table/models/table-validator.js +48 -0
- package/dist/esm/table/models/table-validator.js.map +1 -0
- package/dist/esm/table/models/table-validator.spec.d.ts +1 -0
- package/dist/esm/table/models/table-validator.spec.js +218 -0
- package/dist/esm/table/models/table-validator.spec.js.map +1 -0
- package/dist/esm/table/template.d.ts +1 -2
- package/dist/esm/table/template.js +2 -2
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table/types.d.ts +8 -0
- package/dist/esm/wafer-map/index.d.ts +13 -5
- package/dist/esm/wafer-map/index.js +9 -4
- package/dist/esm/wafer-map/index.js.map +1 -1
- package/dist/esm/wafer-map/modules/zoom-handler.d.ts +24 -0
- package/dist/esm/wafer-map/modules/zoom-handler.js +87 -0
- package/dist/esm/wafer-map/modules/zoom-handler.js.map +1 -0
- package/dist/esm/wafer-map/styles.js +15 -4
- package/dist/esm/wafer-map/styles.js.map +1 -1
- package/dist/esm/wafer-map/template.js +16 -14
- package/dist/esm/wafer-map/template.js.map +1 -1
- package/package.json +5 -1
|
@@ -3594,7 +3594,7 @@
|
|
|
3594
3594
|
* @param propertyOrOptions - The options used to configure child node observation.
|
|
3595
3595
|
* @public
|
|
3596
3596
|
*/
|
|
3597
|
-
function children(propertyOrOptions) {
|
|
3597
|
+
function children$1(propertyOrOptions) {
|
|
3598
3598
|
if (typeof propertyOrOptions === "string") {
|
|
3599
3599
|
propertyOrOptions = {
|
|
3600
3600
|
property: propertyOrOptions,
|
|
@@ -9791,7 +9791,7 @@
|
|
|
9791
9791
|
__decorate([
|
|
9792
9792
|
observable
|
|
9793
9793
|
], DesignTokenNode.prototype, "children", void 0);
|
|
9794
|
-
function create(nameOrConfig) {
|
|
9794
|
+
function create$1(nameOrConfig) {
|
|
9795
9795
|
return DesignTokenImpl.from(nameOrConfig);
|
|
9796
9796
|
}
|
|
9797
9797
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
@@ -9800,7 +9800,7 @@
|
|
|
9800
9800
|
* @public
|
|
9801
9801
|
*/
|
|
9802
9802
|
const DesignToken = Object.freeze({
|
|
9803
|
-
create,
|
|
9803
|
+
create: create$1,
|
|
9804
9804
|
/**
|
|
9805
9805
|
* Informs DesignToken that an HTMLElement for which tokens have
|
|
9806
9806
|
* been set has been connected to the document.
|
|
@@ -13969,7 +13969,7 @@
|
|
|
13969
13969
|
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
13970
13970
|
@focusin="${(x, c) => x.focusinHandler(c.event)}"
|
|
13971
13971
|
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
13972
|
-
${children({
|
|
13972
|
+
${children$1({
|
|
13973
13973
|
property: "childItems",
|
|
13974
13974
|
attributeFilter: ["disabled", "hidden"],
|
|
13975
13975
|
filter: elements(),
|
|
@@ -14834,7 +14834,7 @@
|
|
|
14834
14834
|
aria-disabled="${x => x.disabled}"
|
|
14835
14835
|
@focusin="${(x, c) => x.handleFocus(c.event)}"
|
|
14836
14836
|
@focusout="${(x, c) => x.handleBlur(c.event)}"
|
|
14837
|
-
${children({
|
|
14837
|
+
${children$1({
|
|
14838
14838
|
property: "childItems",
|
|
14839
14839
|
filter: elements(),
|
|
14840
14840
|
})}
|
|
@@ -25080,6 +25080,54 @@
|
|
|
25080
25080
|
});
|
|
25081
25081
|
}
|
|
25082
25082
|
|
|
25083
|
+
/**
|
|
25084
|
+
* Helper class for the nimble-table to validate that the table's configuration
|
|
25085
|
+
* is valid and report which aspects of the configuration are valid or invalid.
|
|
25086
|
+
*/
|
|
25087
|
+
class TableValidator {
|
|
25088
|
+
constructor() {
|
|
25089
|
+
this.duplicateRowId = false;
|
|
25090
|
+
this.missingRowId = false;
|
|
25091
|
+
this.invalidRowId = false;
|
|
25092
|
+
}
|
|
25093
|
+
getValidity() {
|
|
25094
|
+
return {
|
|
25095
|
+
duplicateRowId: this.duplicateRowId,
|
|
25096
|
+
missingRowId: this.missingRowId,
|
|
25097
|
+
invalidRowId: this.invalidRowId
|
|
25098
|
+
};
|
|
25099
|
+
}
|
|
25100
|
+
isValid() {
|
|
25101
|
+
return Object.values(this.getValidity()).every(x => x === false);
|
|
25102
|
+
}
|
|
25103
|
+
validateDataIds(data, idFieldName) {
|
|
25104
|
+
// Start off by assuming all IDs are valid.
|
|
25105
|
+
this.duplicateRowId = false;
|
|
25106
|
+
this.missingRowId = false;
|
|
25107
|
+
this.invalidRowId = false;
|
|
25108
|
+
if (idFieldName == null) {
|
|
25109
|
+
return true;
|
|
25110
|
+
}
|
|
25111
|
+
const ids = new Set();
|
|
25112
|
+
for (const record of data) {
|
|
25113
|
+
if (!Object.prototype.hasOwnProperty.call(record, idFieldName)) {
|
|
25114
|
+
this.missingRowId = true;
|
|
25115
|
+
continue;
|
|
25116
|
+
}
|
|
25117
|
+
const id = record[idFieldName];
|
|
25118
|
+
if (typeof id !== 'string' || id === '') {
|
|
25119
|
+
this.invalidRowId = true;
|
|
25120
|
+
continue;
|
|
25121
|
+
}
|
|
25122
|
+
if (ids.has(id)) {
|
|
25123
|
+
this.duplicateRowId = true;
|
|
25124
|
+
}
|
|
25125
|
+
ids.add(id);
|
|
25126
|
+
}
|
|
25127
|
+
return !this.missingRowId && !this.invalidRowId && !this.duplicateRowId;
|
|
25128
|
+
}
|
|
25129
|
+
}
|
|
25130
|
+
|
|
25083
25131
|
const styles$c = css `
|
|
25084
25132
|
${display('flex')}
|
|
25085
25133
|
|
|
@@ -25245,9 +25293,9 @@
|
|
|
25245
25293
|
</div>
|
|
25246
25294
|
</div>
|
|
25247
25295
|
<div class="table-viewport" role="rowgroup">
|
|
25248
|
-
${repeat(x => x.
|
|
25296
|
+
${repeat(x => x.tableData, html `
|
|
25249
25297
|
<${DesignSystem.tagFor(TableRow)}
|
|
25250
|
-
:data="${x => x}"
|
|
25298
|
+
:data="${x => x.data}"
|
|
25251
25299
|
:columns="${(_, c) => c.parent.columns}"
|
|
25252
25300
|
>
|
|
25253
25301
|
</${DesignSystem.tagFor(TableRow)}>
|
|
@@ -25264,12 +25312,17 @@
|
|
|
25264
25312
|
constructor() {
|
|
25265
25313
|
super();
|
|
25266
25314
|
this.data = [];
|
|
25315
|
+
/**
|
|
25316
|
+
* @internal
|
|
25317
|
+
*/
|
|
25318
|
+
this.tableData = [];
|
|
25267
25319
|
// TODO: Temporarily expose the columns as a string array. This will ultimately be
|
|
25268
25320
|
// column definitions provided by slotted elements.
|
|
25269
25321
|
this.columns = [];
|
|
25270
25322
|
// TODO: Temporarily expose the column headers as a string array.
|
|
25271
25323
|
this.columnHeaders = [];
|
|
25272
25324
|
this.tableInitialized = false;
|
|
25325
|
+
this.tableValidator = new TableValidator();
|
|
25273
25326
|
this.update = (state) => {
|
|
25274
25327
|
this.table.setOptions(prev => ({
|
|
25275
25328
|
...prev,
|
|
@@ -25287,6 +25340,13 @@
|
|
|
25287
25340
|
data: [],
|
|
25288
25341
|
onStateChange: (_) => { },
|
|
25289
25342
|
getCoreRowModel: getCoreRowModel(),
|
|
25343
|
+
getRowId: record => {
|
|
25344
|
+
if (this.idFieldName) {
|
|
25345
|
+
return record[this.idFieldName];
|
|
25346
|
+
}
|
|
25347
|
+
// Return a falsey value to use the default ID from TanStack.
|
|
25348
|
+
return '';
|
|
25349
|
+
},
|
|
25290
25350
|
columns: [],
|
|
25291
25351
|
state: {},
|
|
25292
25352
|
renderFallbackValue: null,
|
|
@@ -25295,18 +25355,46 @@
|
|
|
25295
25355
|
this.table = createTable(this.options);
|
|
25296
25356
|
this.tableInitialized = true;
|
|
25297
25357
|
}
|
|
25358
|
+
get validity() {
|
|
25359
|
+
return this.tableValidator.getValidity();
|
|
25360
|
+
}
|
|
25361
|
+
idFieldNameChanged(_prev, _next) {
|
|
25362
|
+
// Force TanStack to detect a data update because a row's ID is only
|
|
25363
|
+
// generated when creating a new row model.
|
|
25364
|
+
this.trySetData([...this.data]);
|
|
25365
|
+
}
|
|
25298
25366
|
dataChanged(prev, next) {
|
|
25299
25367
|
if ((!prev || prev.length === 0) && next && next.length > 0) {
|
|
25300
25368
|
this.generateColumns();
|
|
25301
25369
|
}
|
|
25302
25370
|
// Ignore any updates that occur prior to the TanStack table being initialized.
|
|
25303
25371
|
if (this.tableInitialized) {
|
|
25304
|
-
this.
|
|
25372
|
+
this.trySetData(this.data);
|
|
25373
|
+
}
|
|
25374
|
+
}
|
|
25375
|
+
checkValidity() {
|
|
25376
|
+
return this.tableValidator.isValid();
|
|
25377
|
+
}
|
|
25378
|
+
trySetData(newData) {
|
|
25379
|
+
const areIdsValid = this.tableValidator.validateDataIds(newData, this.idFieldName);
|
|
25380
|
+
if (areIdsValid) {
|
|
25381
|
+
this.updateTableOptions({ data: newData });
|
|
25382
|
+
}
|
|
25383
|
+
else {
|
|
25384
|
+
this.updateTableOptions({ data: [] });
|
|
25305
25385
|
}
|
|
25306
25386
|
}
|
|
25387
|
+
refreshRows() {
|
|
25388
|
+
const rows = this.table.getRowModel().rows;
|
|
25389
|
+
this.tableData = rows.map(row => {
|
|
25390
|
+
const rowState = { data: row.original };
|
|
25391
|
+
return rowState;
|
|
25392
|
+
});
|
|
25393
|
+
}
|
|
25307
25394
|
updateTableOptions(updatedOptions) {
|
|
25308
25395
|
this.options = { ...this.options, ...updatedOptions };
|
|
25309
25396
|
this.update(this.table.initialState);
|
|
25397
|
+
this.refreshRows();
|
|
25310
25398
|
}
|
|
25311
25399
|
// Temporarily auto-detect the keys in TData to make columns.
|
|
25312
25400
|
// TODO: Remove this logic when another way to specify columns is provided.
|
|
@@ -25329,9 +25417,15 @@
|
|
|
25329
25417
|
this.columns = this.columnHeaders;
|
|
25330
25418
|
}
|
|
25331
25419
|
}
|
|
25420
|
+
__decorate$1([
|
|
25421
|
+
attr({ attribute: 'id-field-name' })
|
|
25422
|
+
], Table.prototype, "idFieldName", void 0);
|
|
25332
25423
|
__decorate$1([
|
|
25333
25424
|
observable
|
|
25334
25425
|
], Table.prototype, "data", void 0);
|
|
25426
|
+
__decorate$1([
|
|
25427
|
+
observable
|
|
25428
|
+
], Table.prototype, "tableData", void 0);
|
|
25335
25429
|
__decorate$1([
|
|
25336
25430
|
observable
|
|
25337
25431
|
], Table.prototype, "columns", void 0);
|
|
@@ -26481,20 +26575,22 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
26481
26575
|
|
|
26482
26576
|
const template = html `
|
|
26483
26577
|
<div class="wafer-map-container">
|
|
26484
|
-
<svg class="svg-root
|
|
26485
|
-
<g class="zoom-container">
|
|
26486
|
-
<
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26578
|
+
<svg class="svg-root">
|
|
26579
|
+
<g class="zoom-container" ${ref('zoomContainer')}>
|
|
26580
|
+
<g class="notch ${x => x.orientation}">
|
|
26581
|
+
<svg
|
|
26582
|
+
class="circle-base"
|
|
26583
|
+
version="1.1"
|
|
26584
|
+
x="0px"
|
|
26585
|
+
y="0px"
|
|
26586
|
+
viewBox="1 .45 20 21"
|
|
26587
|
+
>
|
|
26588
|
+
<path
|
|
26589
|
+
class="circle-drawing-path"
|
|
26590
|
+
d="m 21 12 a 10 10 330 1 1 0 -1.98 a 1 1 0 0 0 0 2"
|
|
26591
|
+
/>
|
|
26592
|
+
</svg>
|
|
26593
|
+
</g>
|
|
26498
26594
|
</g>
|
|
26499
26595
|
</svg>
|
|
26500
26596
|
<div class="wafer-map-area">
|
|
@@ -26525,19 +26621,30 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
26525
26621
|
position: absolute;
|
|
26526
26622
|
}
|
|
26527
26623
|
|
|
26528
|
-
.
|
|
26624
|
+
.circle-base {
|
|
26625
|
+
width: 100%;
|
|
26626
|
+
height: 100%;
|
|
26627
|
+
position: absolute;
|
|
26628
|
+
fill: white;
|
|
26629
|
+
}
|
|
26630
|
+
|
|
26631
|
+
.notch {
|
|
26632
|
+
transform-origin: center center;
|
|
26633
|
+
}
|
|
26634
|
+
|
|
26635
|
+
.notch.top {
|
|
26529
26636
|
transform: rotate(-90deg);
|
|
26530
26637
|
}
|
|
26531
26638
|
|
|
26532
|
-
.
|
|
26639
|
+
.notch.right {
|
|
26533
26640
|
transform: rotate(0deg);
|
|
26534
26641
|
}
|
|
26535
26642
|
|
|
26536
|
-
.
|
|
26643
|
+
.notch.left {
|
|
26537
26644
|
transform: rotate(180deg);
|
|
26538
26645
|
}
|
|
26539
26646
|
|
|
26540
|
-
.
|
|
26647
|
+
.notch.bottom {
|
|
26541
26648
|
transform: rotate(90deg);
|
|
26542
26649
|
}
|
|
26543
26650
|
|
|
@@ -26593,7 +26700,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
26593
26700
|
ordinal: 'ordinal'
|
|
26594
26701
|
};
|
|
26595
26702
|
|
|
26596
|
-
function ascending(a, b) {
|
|
26703
|
+
function ascending$1(a, b) {
|
|
26597
26704
|
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
26598
26705
|
}
|
|
26599
26706
|
|
|
@@ -26614,11 +26721,11 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
26614
26721
|
// tell if the comparator is symmetric, and an asymmetric comparator can’t be
|
|
26615
26722
|
// used to test whether a single value is comparable.
|
|
26616
26723
|
if (f.length !== 2) {
|
|
26617
|
-
compare1 = ascending;
|
|
26618
|
-
compare2 = (d, x) => ascending(f(d), x);
|
|
26724
|
+
compare1 = ascending$1;
|
|
26725
|
+
compare2 = (d, x) => ascending$1(f(d), x);
|
|
26619
26726
|
delta = (d, x) => f(d) - x;
|
|
26620
26727
|
} else {
|
|
26621
|
-
compare1 = f === ascending || f === descending ? f : zero$1;
|
|
26728
|
+
compare1 = f === ascending$1 || f === descending ? f : zero$1;
|
|
26622
26729
|
compare2 = f;
|
|
26623
26730
|
delta = f;
|
|
26624
26731
|
}
|
|
@@ -26663,7 +26770,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
26663
26770
|
return x === null ? NaN : +x;
|
|
26664
26771
|
}
|
|
26665
26772
|
|
|
26666
|
-
const ascendingBisect = bisector(ascending);
|
|
26773
|
+
const ascendingBisect = bisector(ascending$1);
|
|
26667
26774
|
const bisectRight = ascendingBisect.right;
|
|
26668
26775
|
bisector(number$1).center;
|
|
26669
26776
|
var bisect = bisectRight;
|
|
@@ -27159,7 +27266,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27159
27266
|
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
27160
27267
|
}
|
|
27161
27268
|
|
|
27162
|
-
function rgb
|
|
27269
|
+
function rgb(r, g, b, opacity) {
|
|
27163
27270
|
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
27164
27271
|
}
|
|
27165
27272
|
|
|
@@ -27170,7 +27277,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27170
27277
|
this.opacity = +opacity;
|
|
27171
27278
|
}
|
|
27172
27279
|
|
|
27173
|
-
define(Rgb, rgb
|
|
27280
|
+
define(Rgb, rgb, extend(Color, {
|
|
27174
27281
|
brighter(k) {
|
|
27175
27282
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
27176
27283
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
@@ -27321,7 +27428,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27321
27428
|
: m1) * 255;
|
|
27322
27429
|
}
|
|
27323
27430
|
|
|
27324
|
-
var constant = x => () => x;
|
|
27431
|
+
var constant$2 = x => () => x;
|
|
27325
27432
|
|
|
27326
27433
|
function linear$1(a, d) {
|
|
27327
27434
|
return function(t) {
|
|
@@ -27337,20 +27444,20 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27337
27444
|
|
|
27338
27445
|
function gamma(y) {
|
|
27339
27446
|
return (y = +y) === 1 ? nogamma : function(a, b) {
|
|
27340
|
-
return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
|
|
27447
|
+
return b - a ? exponential(a, b, y) : constant$2(isNaN(a) ? b : a);
|
|
27341
27448
|
};
|
|
27342
27449
|
}
|
|
27343
27450
|
|
|
27344
27451
|
function nogamma(a, b) {
|
|
27345
27452
|
var d = b - a;
|
|
27346
|
-
return d ? linear$1(a, d) : constant(isNaN(a) ? b : a);
|
|
27453
|
+
return d ? linear$1(a, d) : constant$2(isNaN(a) ? b : a);
|
|
27347
27454
|
}
|
|
27348
27455
|
|
|
27349
|
-
var
|
|
27456
|
+
var interpolateRgb = (function rgbGamma(y) {
|
|
27350
27457
|
var color = gamma(y);
|
|
27351
27458
|
|
|
27352
|
-
function rgb(start, end) {
|
|
27353
|
-
var r = color((start = rgb
|
|
27459
|
+
function rgb$1(start, end) {
|
|
27460
|
+
var r = color((start = rgb(start)).r, (end = rgb(end)).r),
|
|
27354
27461
|
g = color(start.g, end.g),
|
|
27355
27462
|
b = color(start.b, end.b),
|
|
27356
27463
|
opacity = nogamma(start.opacity, end.opacity);
|
|
@@ -27363,9 +27470,9 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27363
27470
|
};
|
|
27364
27471
|
}
|
|
27365
27472
|
|
|
27366
|
-
rgb.gamma = rgbGamma;
|
|
27473
|
+
rgb$1.gamma = rgbGamma;
|
|
27367
27474
|
|
|
27368
|
-
return rgb;
|
|
27475
|
+
return rgb$1;
|
|
27369
27476
|
})(1);
|
|
27370
27477
|
|
|
27371
27478
|
function numberArray(a, b) {
|
|
@@ -27390,7 +27497,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27390
27497
|
c = new Array(nb),
|
|
27391
27498
|
i;
|
|
27392
27499
|
|
|
27393
|
-
for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
|
|
27500
|
+
for (i = 0; i < na; ++i) x[i] = interpolate$1(a[i], b[i]);
|
|
27394
27501
|
for (; i < nb; ++i) c[i] = b[i];
|
|
27395
27502
|
|
|
27396
27503
|
return function(t) {
|
|
@@ -27422,7 +27529,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27422
27529
|
|
|
27423
27530
|
for (k in b) {
|
|
27424
27531
|
if (k in a) {
|
|
27425
|
-
i[k] = interpolate(a[k], b[k]);
|
|
27532
|
+
i[k] = interpolate$1(a[k], b[k]);
|
|
27426
27533
|
} else {
|
|
27427
27534
|
c[k] = b[k];
|
|
27428
27535
|
}
|
|
@@ -27449,7 +27556,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27449
27556
|
};
|
|
27450
27557
|
}
|
|
27451
27558
|
|
|
27452
|
-
function
|
|
27559
|
+
function interpolateString(a, b) {
|
|
27453
27560
|
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
|
|
27454
27561
|
am, // current match in a
|
|
27455
27562
|
bm, // current match in b
|
|
@@ -27497,12 +27604,12 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27497
27604
|
});
|
|
27498
27605
|
}
|
|
27499
27606
|
|
|
27500
|
-
function interpolate(a, b) {
|
|
27607
|
+
function interpolate$1(a, b) {
|
|
27501
27608
|
var t = typeof b, c;
|
|
27502
|
-
return b == null || t === "boolean" ? constant(b)
|
|
27609
|
+
return b == null || t === "boolean" ? constant$2(b)
|
|
27503
27610
|
: (t === "number" ? interpolateNumber
|
|
27504
|
-
: t === "string" ? ((c = color(b)) ? (b = c,
|
|
27505
|
-
: b instanceof color ?
|
|
27611
|
+
: t === "string" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)
|
|
27612
|
+
: b instanceof color ? interpolateRgb
|
|
27506
27613
|
: b instanceof Date ? date
|
|
27507
27614
|
: isNumberArray(b) ? numberArray
|
|
27508
27615
|
: Array.isArray(b) ? genericArray
|
|
@@ -27516,6 +27623,183 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27516
27623
|
};
|
|
27517
27624
|
}
|
|
27518
27625
|
|
|
27626
|
+
var degrees = 180 / Math.PI;
|
|
27627
|
+
|
|
27628
|
+
var identity$3 = {
|
|
27629
|
+
translateX: 0,
|
|
27630
|
+
translateY: 0,
|
|
27631
|
+
rotate: 0,
|
|
27632
|
+
skewX: 0,
|
|
27633
|
+
scaleX: 1,
|
|
27634
|
+
scaleY: 1
|
|
27635
|
+
};
|
|
27636
|
+
|
|
27637
|
+
function decompose(a, b, c, d, e, f) {
|
|
27638
|
+
var scaleX, scaleY, skewX;
|
|
27639
|
+
if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
|
|
27640
|
+
if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
|
|
27641
|
+
if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
|
|
27642
|
+
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
|
27643
|
+
return {
|
|
27644
|
+
translateX: e,
|
|
27645
|
+
translateY: f,
|
|
27646
|
+
rotate: Math.atan2(b, a) * degrees,
|
|
27647
|
+
skewX: Math.atan(skewX) * degrees,
|
|
27648
|
+
scaleX: scaleX,
|
|
27649
|
+
scaleY: scaleY
|
|
27650
|
+
};
|
|
27651
|
+
}
|
|
27652
|
+
|
|
27653
|
+
var svgNode;
|
|
27654
|
+
|
|
27655
|
+
/* eslint-disable no-undef */
|
|
27656
|
+
function parseCss(value) {
|
|
27657
|
+
const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
|
|
27658
|
+
return m.isIdentity ? identity$3 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
27659
|
+
}
|
|
27660
|
+
|
|
27661
|
+
function parseSvg(value) {
|
|
27662
|
+
if (value == null) return identity$3;
|
|
27663
|
+
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
27664
|
+
svgNode.setAttribute("transform", value);
|
|
27665
|
+
if (!(value = svgNode.transform.baseVal.consolidate())) return identity$3;
|
|
27666
|
+
value = value.matrix;
|
|
27667
|
+
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
|
27668
|
+
}
|
|
27669
|
+
|
|
27670
|
+
function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
|
27671
|
+
|
|
27672
|
+
function pop(s) {
|
|
27673
|
+
return s.length ? s.pop() + " " : "";
|
|
27674
|
+
}
|
|
27675
|
+
|
|
27676
|
+
function translate(xa, ya, xb, yb, s, q) {
|
|
27677
|
+
if (xa !== xb || ya !== yb) {
|
|
27678
|
+
var i = s.push("translate(", null, pxComma, null, pxParen);
|
|
27679
|
+
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
|
|
27680
|
+
} else if (xb || yb) {
|
|
27681
|
+
s.push("translate(" + xb + pxComma + yb + pxParen);
|
|
27682
|
+
}
|
|
27683
|
+
}
|
|
27684
|
+
|
|
27685
|
+
function rotate(a, b, s, q) {
|
|
27686
|
+
if (a !== b) {
|
|
27687
|
+
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
|
|
27688
|
+
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)});
|
|
27689
|
+
} else if (b) {
|
|
27690
|
+
s.push(pop(s) + "rotate(" + b + degParen);
|
|
27691
|
+
}
|
|
27692
|
+
}
|
|
27693
|
+
|
|
27694
|
+
function skewX(a, b, s, q) {
|
|
27695
|
+
if (a !== b) {
|
|
27696
|
+
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)});
|
|
27697
|
+
} else if (b) {
|
|
27698
|
+
s.push(pop(s) + "skewX(" + b + degParen);
|
|
27699
|
+
}
|
|
27700
|
+
}
|
|
27701
|
+
|
|
27702
|
+
function scale(xa, ya, xb, yb, s, q) {
|
|
27703
|
+
if (xa !== xb || ya !== yb) {
|
|
27704
|
+
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
|
27705
|
+
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
|
|
27706
|
+
} else if (xb !== 1 || yb !== 1) {
|
|
27707
|
+
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
|
27708
|
+
}
|
|
27709
|
+
}
|
|
27710
|
+
|
|
27711
|
+
return function(a, b) {
|
|
27712
|
+
var s = [], // string constants and placeholders
|
|
27713
|
+
q = []; // number interpolators
|
|
27714
|
+
a = parse(a), b = parse(b);
|
|
27715
|
+
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
|
27716
|
+
rotate(a.rotate, b.rotate, s, q);
|
|
27717
|
+
skewX(a.skewX, b.skewX, s, q);
|
|
27718
|
+
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
|
27719
|
+
a = b = null; // gc
|
|
27720
|
+
return function(t) {
|
|
27721
|
+
var i = -1, n = q.length, o;
|
|
27722
|
+
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
|
27723
|
+
return s.join("");
|
|
27724
|
+
};
|
|
27725
|
+
};
|
|
27726
|
+
}
|
|
27727
|
+
|
|
27728
|
+
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
|
27729
|
+
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
|
27730
|
+
|
|
27731
|
+
var epsilon2 = 1e-12;
|
|
27732
|
+
|
|
27733
|
+
function cosh(x) {
|
|
27734
|
+
return ((x = Math.exp(x)) + 1 / x) / 2;
|
|
27735
|
+
}
|
|
27736
|
+
|
|
27737
|
+
function sinh(x) {
|
|
27738
|
+
return ((x = Math.exp(x)) - 1 / x) / 2;
|
|
27739
|
+
}
|
|
27740
|
+
|
|
27741
|
+
function tanh(x) {
|
|
27742
|
+
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
|
|
27743
|
+
}
|
|
27744
|
+
|
|
27745
|
+
var interpolateZoom = (function zoomRho(rho, rho2, rho4) {
|
|
27746
|
+
|
|
27747
|
+
// p0 = [ux0, uy0, w0]
|
|
27748
|
+
// p1 = [ux1, uy1, w1]
|
|
27749
|
+
function zoom(p0, p1) {
|
|
27750
|
+
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
|
|
27751
|
+
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
|
|
27752
|
+
dx = ux1 - ux0,
|
|
27753
|
+
dy = uy1 - uy0,
|
|
27754
|
+
d2 = dx * dx + dy * dy,
|
|
27755
|
+
i,
|
|
27756
|
+
S;
|
|
27757
|
+
|
|
27758
|
+
// Special case for u0 ≅ u1.
|
|
27759
|
+
if (d2 < epsilon2) {
|
|
27760
|
+
S = Math.log(w1 / w0) / rho;
|
|
27761
|
+
i = function(t) {
|
|
27762
|
+
return [
|
|
27763
|
+
ux0 + t * dx,
|
|
27764
|
+
uy0 + t * dy,
|
|
27765
|
+
w0 * Math.exp(rho * t * S)
|
|
27766
|
+
];
|
|
27767
|
+
};
|
|
27768
|
+
}
|
|
27769
|
+
|
|
27770
|
+
// General case.
|
|
27771
|
+
else {
|
|
27772
|
+
var d1 = Math.sqrt(d2),
|
|
27773
|
+
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
|
|
27774
|
+
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
|
|
27775
|
+
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
|
|
27776
|
+
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
27777
|
+
S = (r1 - r0) / rho;
|
|
27778
|
+
i = function(t) {
|
|
27779
|
+
var s = t * S,
|
|
27780
|
+
coshr0 = cosh(r0),
|
|
27781
|
+
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
|
27782
|
+
return [
|
|
27783
|
+
ux0 + u * dx,
|
|
27784
|
+
uy0 + u * dy,
|
|
27785
|
+
w0 * coshr0 / cosh(rho * s + r0)
|
|
27786
|
+
];
|
|
27787
|
+
};
|
|
27788
|
+
}
|
|
27789
|
+
|
|
27790
|
+
i.duration = S * 1000 * rho / Math.SQRT2;
|
|
27791
|
+
|
|
27792
|
+
return i;
|
|
27793
|
+
}
|
|
27794
|
+
|
|
27795
|
+
zoom.rho = function(_) {
|
|
27796
|
+
var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
|
|
27797
|
+
return zoomRho(_1, _2, _4);
|
|
27798
|
+
};
|
|
27799
|
+
|
|
27800
|
+
return zoom;
|
|
27801
|
+
})(Math.SQRT2, 2, 4);
|
|
27802
|
+
|
|
27519
27803
|
function constants(x) {
|
|
27520
27804
|
return function() {
|
|
27521
27805
|
return x;
|
|
@@ -27528,7 +27812,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27528
27812
|
|
|
27529
27813
|
var unit = [0, 1];
|
|
27530
27814
|
|
|
27531
|
-
function identity$
|
|
27815
|
+
function identity$2(x) {
|
|
27532
27816
|
return x;
|
|
27533
27817
|
}
|
|
27534
27818
|
|
|
@@ -27588,25 +27872,25 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27588
27872
|
function transformer() {
|
|
27589
27873
|
var domain = unit,
|
|
27590
27874
|
range = unit,
|
|
27591
|
-
interpolate
|
|
27875
|
+
interpolate = interpolate$1,
|
|
27592
27876
|
transform,
|
|
27593
27877
|
untransform,
|
|
27594
27878
|
unknown,
|
|
27595
|
-
clamp = identity$
|
|
27879
|
+
clamp = identity$2,
|
|
27596
27880
|
piecewise,
|
|
27597
27881
|
output,
|
|
27598
27882
|
input;
|
|
27599
27883
|
|
|
27600
27884
|
function rescale() {
|
|
27601
27885
|
var n = Math.min(domain.length, range.length);
|
|
27602
|
-
if (clamp !== identity$
|
|
27886
|
+
if (clamp !== identity$2) clamp = clamper(domain[0], domain[n - 1]);
|
|
27603
27887
|
piecewise = n > 2 ? polymap : bimap;
|
|
27604
27888
|
output = input = null;
|
|
27605
27889
|
return scale;
|
|
27606
27890
|
}
|
|
27607
27891
|
|
|
27608
27892
|
function scale(x) {
|
|
27609
|
-
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate
|
|
27893
|
+
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
|
|
27610
27894
|
}
|
|
27611
27895
|
|
|
27612
27896
|
scale.invert = function(y) {
|
|
@@ -27622,15 +27906,15 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27622
27906
|
};
|
|
27623
27907
|
|
|
27624
27908
|
scale.rangeRound = function(_) {
|
|
27625
|
-
return range = Array.from(_), interpolate
|
|
27909
|
+
return range = Array.from(_), interpolate = interpolateRound, rescale();
|
|
27626
27910
|
};
|
|
27627
27911
|
|
|
27628
27912
|
scale.clamp = function(_) {
|
|
27629
|
-
return arguments.length ? (clamp = _ ? true : identity$
|
|
27913
|
+
return arguments.length ? (clamp = _ ? true : identity$2, rescale()) : clamp !== identity$2;
|
|
27630
27914
|
};
|
|
27631
27915
|
|
|
27632
27916
|
scale.interpolate = function(_) {
|
|
27633
|
-
return arguments.length ? (interpolate
|
|
27917
|
+
return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
|
27634
27918
|
};
|
|
27635
27919
|
|
|
27636
27920
|
scale.unknown = function(_) {
|
|
@@ -27644,7 +27928,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27644
27928
|
}
|
|
27645
27929
|
|
|
27646
27930
|
function continuous() {
|
|
27647
|
-
return transformer()(identity$
|
|
27931
|
+
return transformer()(identity$2, identity$2);
|
|
27648
27932
|
}
|
|
27649
27933
|
|
|
27650
27934
|
function formatDecimal(x) {
|
|
@@ -27800,7 +28084,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27800
28084
|
"x": (x) => Math.round(x).toString(16)
|
|
27801
28085
|
};
|
|
27802
28086
|
|
|
27803
|
-
function identity(x) {
|
|
28087
|
+
function identity$1(x) {
|
|
27804
28088
|
return x;
|
|
27805
28089
|
}
|
|
27806
28090
|
|
|
@@ -27808,11 +28092,11 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
27808
28092
|
prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
|
27809
28093
|
|
|
27810
28094
|
function formatLocale(locale) {
|
|
27811
|
-
var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
|
|
28095
|
+
var group = locale.grouping === undefined || locale.thousands === undefined ? identity$1 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
|
|
27812
28096
|
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
|
|
27813
28097
|
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
|
|
27814
28098
|
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
|
|
27815
|
-
numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
|
|
28099
|
+
numerals = locale.numerals === undefined ? identity$1 : formatNumerals(map.call(locale.numerals, String)),
|
|
27816
28100
|
percent = locale.percent === undefined ? "%" : locale.percent + "",
|
|
27817
28101
|
minus = locale.minus === undefined ? "−" : locale.minus + "",
|
|
27818
28102
|
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
|
@@ -29437,65 +29721,2726 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
29437
29721
|
}
|
|
29438
29722
|
}
|
|
29439
29723
|
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
|
|
29448
|
-
|
|
29449
|
-
|
|
29450
|
-
|
|
29451
|
-
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
|
|
29455
|
-
|
|
29456
|
-
|
|
29457
|
-
|
|
29458
|
-
|
|
29459
|
-
|
|
29460
|
-
|
|
29461
|
-
|
|
29462
|
-
|
|
29463
|
-
|
|
29464
|
-
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
|
|
29468
|
-
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29724
|
+
var xhtml = "http://www.w3.org/1999/xhtml";
|
|
29725
|
+
|
|
29726
|
+
var namespaces = {
|
|
29727
|
+
svg: "http://www.w3.org/2000/svg",
|
|
29728
|
+
xhtml: xhtml,
|
|
29729
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
29730
|
+
xml: "http://www.w3.org/XML/1998/namespace",
|
|
29731
|
+
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
29732
|
+
};
|
|
29733
|
+
|
|
29734
|
+
function namespace(name) {
|
|
29735
|
+
var prefix = name += "", i = prefix.indexOf(":");
|
|
29736
|
+
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
|
29737
|
+
return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins
|
|
29738
|
+
}
|
|
29739
|
+
|
|
29740
|
+
function creatorInherit(name) {
|
|
29741
|
+
return function() {
|
|
29742
|
+
var document = this.ownerDocument,
|
|
29743
|
+
uri = this.namespaceURI;
|
|
29744
|
+
return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
|
29745
|
+
? document.createElement(name)
|
|
29746
|
+
: document.createElementNS(uri, name);
|
|
29747
|
+
};
|
|
29748
|
+
}
|
|
29749
|
+
|
|
29750
|
+
function creatorFixed(fullname) {
|
|
29751
|
+
return function() {
|
|
29752
|
+
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
|
29753
|
+
};
|
|
29754
|
+
}
|
|
29755
|
+
|
|
29756
|
+
function creator(name) {
|
|
29757
|
+
var fullname = namespace(name);
|
|
29758
|
+
return (fullname.local
|
|
29759
|
+
? creatorFixed
|
|
29760
|
+
: creatorInherit)(fullname);
|
|
29761
|
+
}
|
|
29762
|
+
|
|
29763
|
+
function none() {}
|
|
29764
|
+
|
|
29765
|
+
function selector(selector) {
|
|
29766
|
+
return selector == null ? none : function() {
|
|
29767
|
+
return this.querySelector(selector);
|
|
29768
|
+
};
|
|
29769
|
+
}
|
|
29770
|
+
|
|
29771
|
+
function selection_select(select) {
|
|
29772
|
+
if (typeof select !== "function") select = selector(select);
|
|
29773
|
+
|
|
29774
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
29775
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
29776
|
+
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
29777
|
+
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
29778
|
+
subgroup[i] = subnode;
|
|
29779
|
+
}
|
|
29476
29780
|
}
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29482
|
-
|
|
29483
|
-
|
|
29484
|
-
|
|
29485
|
-
|
|
29486
|
-
|
|
29487
|
-
|
|
29488
|
-
|
|
29489
|
-
|
|
29781
|
+
}
|
|
29782
|
+
|
|
29783
|
+
return new Selection$1(subgroups, this._parents);
|
|
29784
|
+
}
|
|
29785
|
+
|
|
29786
|
+
// Given something array like (or null), returns something that is strictly an
|
|
29787
|
+
// array. This is used to ensure that array-like objects passed to d3.selectAll
|
|
29788
|
+
// or selection.selectAll are converted into proper arrays when creating a
|
|
29789
|
+
// selection; we don’t ever want to create a selection backed by a live
|
|
29790
|
+
// HTMLCollection or NodeList. However, note that selection.selectAll will use a
|
|
29791
|
+
// static NodeList as a group, since it safely derived from querySelectorAll.
|
|
29792
|
+
function array(x) {
|
|
29793
|
+
return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
|
|
29794
|
+
}
|
|
29795
|
+
|
|
29796
|
+
function empty() {
|
|
29797
|
+
return [];
|
|
29798
|
+
}
|
|
29799
|
+
|
|
29800
|
+
function selectorAll(selector) {
|
|
29801
|
+
return selector == null ? empty : function() {
|
|
29802
|
+
return this.querySelectorAll(selector);
|
|
29803
|
+
};
|
|
29804
|
+
}
|
|
29805
|
+
|
|
29806
|
+
function arrayAll(select) {
|
|
29807
|
+
return function() {
|
|
29808
|
+
return array(select.apply(this, arguments));
|
|
29809
|
+
};
|
|
29810
|
+
}
|
|
29811
|
+
|
|
29812
|
+
function selection_selectAll(select) {
|
|
29813
|
+
if (typeof select === "function") select = arrayAll(select);
|
|
29814
|
+
else select = selectorAll(select);
|
|
29815
|
+
|
|
29816
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
29817
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
29818
|
+
if (node = group[i]) {
|
|
29819
|
+
subgroups.push(select.call(node, node.__data__, i, group));
|
|
29820
|
+
parents.push(node);
|
|
29821
|
+
}
|
|
29490
29822
|
}
|
|
29491
|
-
|
|
29492
|
-
|
|
29823
|
+
}
|
|
29824
|
+
|
|
29825
|
+
return new Selection$1(subgroups, parents);
|
|
29826
|
+
}
|
|
29827
|
+
|
|
29828
|
+
function matcher(selector) {
|
|
29829
|
+
return function() {
|
|
29830
|
+
return this.matches(selector);
|
|
29831
|
+
};
|
|
29832
|
+
}
|
|
29833
|
+
|
|
29834
|
+
function childMatcher(selector) {
|
|
29835
|
+
return function(node) {
|
|
29836
|
+
return node.matches(selector);
|
|
29837
|
+
};
|
|
29838
|
+
}
|
|
29839
|
+
|
|
29840
|
+
var find = Array.prototype.find;
|
|
29841
|
+
|
|
29842
|
+
function childFind(match) {
|
|
29843
|
+
return function() {
|
|
29844
|
+
return find.call(this.children, match);
|
|
29845
|
+
};
|
|
29846
|
+
}
|
|
29847
|
+
|
|
29848
|
+
function childFirst() {
|
|
29849
|
+
return this.firstElementChild;
|
|
29850
|
+
}
|
|
29851
|
+
|
|
29852
|
+
function selection_selectChild(match) {
|
|
29853
|
+
return this.select(match == null ? childFirst
|
|
29854
|
+
: childFind(typeof match === "function" ? match : childMatcher(match)));
|
|
29855
|
+
}
|
|
29856
|
+
|
|
29857
|
+
var filter = Array.prototype.filter;
|
|
29858
|
+
|
|
29859
|
+
function children() {
|
|
29860
|
+
return Array.from(this.children);
|
|
29861
|
+
}
|
|
29862
|
+
|
|
29863
|
+
function childrenFilter(match) {
|
|
29864
|
+
return function() {
|
|
29865
|
+
return filter.call(this.children, match);
|
|
29866
|
+
};
|
|
29867
|
+
}
|
|
29868
|
+
|
|
29869
|
+
function selection_selectChildren(match) {
|
|
29870
|
+
return this.selectAll(match == null ? children
|
|
29871
|
+
: childrenFilter(typeof match === "function" ? match : childMatcher(match)));
|
|
29872
|
+
}
|
|
29873
|
+
|
|
29874
|
+
function selection_filter(match) {
|
|
29875
|
+
if (typeof match !== "function") match = matcher(match);
|
|
29876
|
+
|
|
29877
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
29878
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
29879
|
+
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
29880
|
+
subgroup.push(node);
|
|
29881
|
+
}
|
|
29493
29882
|
}
|
|
29494
|
-
|
|
29495
|
-
|
|
29883
|
+
}
|
|
29884
|
+
|
|
29885
|
+
return new Selection$1(subgroups, this._parents);
|
|
29886
|
+
}
|
|
29887
|
+
|
|
29888
|
+
function sparse(update) {
|
|
29889
|
+
return new Array(update.length);
|
|
29890
|
+
}
|
|
29891
|
+
|
|
29892
|
+
function selection_enter() {
|
|
29893
|
+
return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
|
|
29894
|
+
}
|
|
29895
|
+
|
|
29896
|
+
function EnterNode(parent, datum) {
|
|
29897
|
+
this.ownerDocument = parent.ownerDocument;
|
|
29898
|
+
this.namespaceURI = parent.namespaceURI;
|
|
29899
|
+
this._next = null;
|
|
29900
|
+
this._parent = parent;
|
|
29901
|
+
this.__data__ = datum;
|
|
29902
|
+
}
|
|
29903
|
+
|
|
29904
|
+
EnterNode.prototype = {
|
|
29905
|
+
constructor: EnterNode,
|
|
29906
|
+
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
|
|
29907
|
+
insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
|
|
29908
|
+
querySelector: function(selector) { return this._parent.querySelector(selector); },
|
|
29909
|
+
querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
|
|
29910
|
+
};
|
|
29911
|
+
|
|
29912
|
+
function constant$1(x) {
|
|
29913
|
+
return function() {
|
|
29914
|
+
return x;
|
|
29915
|
+
};
|
|
29916
|
+
}
|
|
29917
|
+
|
|
29918
|
+
function bindIndex(parent, group, enter, update, exit, data) {
|
|
29919
|
+
var i = 0,
|
|
29920
|
+
node,
|
|
29921
|
+
groupLength = group.length,
|
|
29922
|
+
dataLength = data.length;
|
|
29923
|
+
|
|
29924
|
+
// Put any non-null nodes that fit into update.
|
|
29925
|
+
// Put any null nodes into enter.
|
|
29926
|
+
// Put any remaining data into enter.
|
|
29927
|
+
for (; i < dataLength; ++i) {
|
|
29928
|
+
if (node = group[i]) {
|
|
29929
|
+
node.__data__ = data[i];
|
|
29930
|
+
update[i] = node;
|
|
29931
|
+
} else {
|
|
29932
|
+
enter[i] = new EnterNode(parent, data[i]);
|
|
29496
29933
|
}
|
|
29497
|
-
|
|
29498
|
-
|
|
29934
|
+
}
|
|
29935
|
+
|
|
29936
|
+
// Put any non-null nodes that don’t fit into exit.
|
|
29937
|
+
for (; i < groupLength; ++i) {
|
|
29938
|
+
if (node = group[i]) {
|
|
29939
|
+
exit[i] = node;
|
|
29940
|
+
}
|
|
29941
|
+
}
|
|
29942
|
+
}
|
|
29943
|
+
|
|
29944
|
+
function bindKey(parent, group, enter, update, exit, data, key) {
|
|
29945
|
+
var i,
|
|
29946
|
+
node,
|
|
29947
|
+
nodeByKeyValue = new Map,
|
|
29948
|
+
groupLength = group.length,
|
|
29949
|
+
dataLength = data.length,
|
|
29950
|
+
keyValues = new Array(groupLength),
|
|
29951
|
+
keyValue;
|
|
29952
|
+
|
|
29953
|
+
// Compute the key for each node.
|
|
29954
|
+
// If multiple nodes have the same key, the duplicates are added to exit.
|
|
29955
|
+
for (i = 0; i < groupLength; ++i) {
|
|
29956
|
+
if (node = group[i]) {
|
|
29957
|
+
keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
|
|
29958
|
+
if (nodeByKeyValue.has(keyValue)) {
|
|
29959
|
+
exit[i] = node;
|
|
29960
|
+
} else {
|
|
29961
|
+
nodeByKeyValue.set(keyValue, node);
|
|
29962
|
+
}
|
|
29963
|
+
}
|
|
29964
|
+
}
|
|
29965
|
+
|
|
29966
|
+
// Compute the key for each datum.
|
|
29967
|
+
// If there a node associated with this key, join and add it to update.
|
|
29968
|
+
// If there is not (or the key is a duplicate), add it to enter.
|
|
29969
|
+
for (i = 0; i < dataLength; ++i) {
|
|
29970
|
+
keyValue = key.call(parent, data[i], i, data) + "";
|
|
29971
|
+
if (node = nodeByKeyValue.get(keyValue)) {
|
|
29972
|
+
update[i] = node;
|
|
29973
|
+
node.__data__ = data[i];
|
|
29974
|
+
nodeByKeyValue.delete(keyValue);
|
|
29975
|
+
} else {
|
|
29976
|
+
enter[i] = new EnterNode(parent, data[i]);
|
|
29977
|
+
}
|
|
29978
|
+
}
|
|
29979
|
+
|
|
29980
|
+
// Add any remaining nodes that were not bound to data to exit.
|
|
29981
|
+
for (i = 0; i < groupLength; ++i) {
|
|
29982
|
+
if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {
|
|
29983
|
+
exit[i] = node;
|
|
29984
|
+
}
|
|
29985
|
+
}
|
|
29986
|
+
}
|
|
29987
|
+
|
|
29988
|
+
function datum(node) {
|
|
29989
|
+
return node.__data__;
|
|
29990
|
+
}
|
|
29991
|
+
|
|
29992
|
+
function selection_data(value, key) {
|
|
29993
|
+
if (!arguments.length) return Array.from(this, datum);
|
|
29994
|
+
|
|
29995
|
+
var bind = key ? bindKey : bindIndex,
|
|
29996
|
+
parents = this._parents,
|
|
29997
|
+
groups = this._groups;
|
|
29998
|
+
|
|
29999
|
+
if (typeof value !== "function") value = constant$1(value);
|
|
30000
|
+
|
|
30001
|
+
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
|
30002
|
+
var parent = parents[j],
|
|
30003
|
+
group = groups[j],
|
|
30004
|
+
groupLength = group.length,
|
|
30005
|
+
data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),
|
|
30006
|
+
dataLength = data.length,
|
|
30007
|
+
enterGroup = enter[j] = new Array(dataLength),
|
|
30008
|
+
updateGroup = update[j] = new Array(dataLength),
|
|
30009
|
+
exitGroup = exit[j] = new Array(groupLength);
|
|
30010
|
+
|
|
30011
|
+
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
|
30012
|
+
|
|
30013
|
+
// Now connect the enter nodes to their following update node, such that
|
|
30014
|
+
// appendChild can insert the materialized enter node before this node,
|
|
30015
|
+
// rather than at the end of the parent node.
|
|
30016
|
+
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
|
30017
|
+
if (previous = enterGroup[i0]) {
|
|
30018
|
+
if (i0 >= i1) i1 = i0 + 1;
|
|
30019
|
+
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
|
30020
|
+
previous._next = next || null;
|
|
30021
|
+
}
|
|
30022
|
+
}
|
|
30023
|
+
}
|
|
30024
|
+
|
|
30025
|
+
update = new Selection$1(update, parents);
|
|
30026
|
+
update._enter = enter;
|
|
30027
|
+
update._exit = exit;
|
|
30028
|
+
return update;
|
|
30029
|
+
}
|
|
30030
|
+
|
|
30031
|
+
// Given some data, this returns an array-like view of it: an object that
|
|
30032
|
+
// exposes a length property and allows numeric indexing. Note that unlike
|
|
30033
|
+
// selectAll, this isn’t worried about “live” collections because the resulting
|
|
30034
|
+
// array will only be used briefly while data is being bound. (It is possible to
|
|
30035
|
+
// cause the data to change while iterating by using a key function, but please
|
|
30036
|
+
// don’t; we’d rather avoid a gratuitous copy.)
|
|
30037
|
+
function arraylike(data) {
|
|
30038
|
+
return typeof data === "object" && "length" in data
|
|
30039
|
+
? data // Array, TypedArray, NodeList, array-like
|
|
30040
|
+
: Array.from(data); // Map, Set, iterable, string, or anything else
|
|
30041
|
+
}
|
|
30042
|
+
|
|
30043
|
+
function selection_exit() {
|
|
30044
|
+
return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
|
|
30045
|
+
}
|
|
30046
|
+
|
|
30047
|
+
function selection_join(onenter, onupdate, onexit) {
|
|
30048
|
+
var enter = this.enter(), update = this, exit = this.exit();
|
|
30049
|
+
if (typeof onenter === "function") {
|
|
30050
|
+
enter = onenter(enter);
|
|
30051
|
+
if (enter) enter = enter.selection();
|
|
30052
|
+
} else {
|
|
30053
|
+
enter = enter.append(onenter + "");
|
|
30054
|
+
}
|
|
30055
|
+
if (onupdate != null) {
|
|
30056
|
+
update = onupdate(update);
|
|
30057
|
+
if (update) update = update.selection();
|
|
30058
|
+
}
|
|
30059
|
+
if (onexit == null) exit.remove(); else onexit(exit);
|
|
30060
|
+
return enter && update ? enter.merge(update).order() : update;
|
|
30061
|
+
}
|
|
30062
|
+
|
|
30063
|
+
function selection_merge(context) {
|
|
30064
|
+
var selection = context.selection ? context.selection() : context;
|
|
30065
|
+
|
|
30066
|
+
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) {
|
|
30067
|
+
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
30068
|
+
if (node = group0[i] || group1[i]) {
|
|
30069
|
+
merge[i] = node;
|
|
30070
|
+
}
|
|
30071
|
+
}
|
|
30072
|
+
}
|
|
30073
|
+
|
|
30074
|
+
for (; j < m0; ++j) {
|
|
30075
|
+
merges[j] = groups0[j];
|
|
30076
|
+
}
|
|
30077
|
+
|
|
30078
|
+
return new Selection$1(merges, this._parents);
|
|
30079
|
+
}
|
|
30080
|
+
|
|
30081
|
+
function selection_order() {
|
|
30082
|
+
|
|
30083
|
+
for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
|
|
30084
|
+
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
|
30085
|
+
if (node = group[i]) {
|
|
30086
|
+
if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
|
|
30087
|
+
next = node;
|
|
30088
|
+
}
|
|
30089
|
+
}
|
|
30090
|
+
}
|
|
30091
|
+
|
|
30092
|
+
return this;
|
|
30093
|
+
}
|
|
30094
|
+
|
|
30095
|
+
function selection_sort(compare) {
|
|
30096
|
+
if (!compare) compare = ascending;
|
|
30097
|
+
|
|
30098
|
+
function compareNode(a, b) {
|
|
30099
|
+
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
|
30100
|
+
}
|
|
30101
|
+
|
|
30102
|
+
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
|
30103
|
+
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
30104
|
+
if (node = group[i]) {
|
|
30105
|
+
sortgroup[i] = node;
|
|
30106
|
+
}
|
|
30107
|
+
}
|
|
30108
|
+
sortgroup.sort(compareNode);
|
|
30109
|
+
}
|
|
30110
|
+
|
|
30111
|
+
return new Selection$1(sortgroups, this._parents).order();
|
|
30112
|
+
}
|
|
30113
|
+
|
|
30114
|
+
function ascending(a, b) {
|
|
30115
|
+
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
30116
|
+
}
|
|
30117
|
+
|
|
30118
|
+
function selection_call() {
|
|
30119
|
+
var callback = arguments[0];
|
|
30120
|
+
arguments[0] = this;
|
|
30121
|
+
callback.apply(null, arguments);
|
|
30122
|
+
return this;
|
|
30123
|
+
}
|
|
30124
|
+
|
|
30125
|
+
function selection_nodes() {
|
|
30126
|
+
return Array.from(this);
|
|
30127
|
+
}
|
|
30128
|
+
|
|
30129
|
+
function selection_node() {
|
|
30130
|
+
|
|
30131
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
30132
|
+
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
|
30133
|
+
var node = group[i];
|
|
30134
|
+
if (node) return node;
|
|
30135
|
+
}
|
|
30136
|
+
}
|
|
30137
|
+
|
|
30138
|
+
return null;
|
|
30139
|
+
}
|
|
30140
|
+
|
|
30141
|
+
function selection_size() {
|
|
30142
|
+
let size = 0;
|
|
30143
|
+
for (const node of this) ++size; // eslint-disable-line no-unused-vars
|
|
30144
|
+
return size;
|
|
30145
|
+
}
|
|
30146
|
+
|
|
30147
|
+
function selection_empty() {
|
|
30148
|
+
return !this.node();
|
|
30149
|
+
}
|
|
30150
|
+
|
|
30151
|
+
function selection_each(callback) {
|
|
30152
|
+
|
|
30153
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
30154
|
+
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
30155
|
+
if (node = group[i]) callback.call(node, node.__data__, i, group);
|
|
30156
|
+
}
|
|
30157
|
+
}
|
|
30158
|
+
|
|
30159
|
+
return this;
|
|
30160
|
+
}
|
|
30161
|
+
|
|
30162
|
+
function attrRemove$1(name) {
|
|
30163
|
+
return function() {
|
|
30164
|
+
this.removeAttribute(name);
|
|
30165
|
+
};
|
|
30166
|
+
}
|
|
30167
|
+
|
|
30168
|
+
function attrRemoveNS$1(fullname) {
|
|
30169
|
+
return function() {
|
|
30170
|
+
this.removeAttributeNS(fullname.space, fullname.local);
|
|
30171
|
+
};
|
|
30172
|
+
}
|
|
30173
|
+
|
|
30174
|
+
function attrConstant$1(name, value) {
|
|
30175
|
+
return function() {
|
|
30176
|
+
this.setAttribute(name, value);
|
|
30177
|
+
};
|
|
30178
|
+
}
|
|
30179
|
+
|
|
30180
|
+
function attrConstantNS$1(fullname, value) {
|
|
30181
|
+
return function() {
|
|
30182
|
+
this.setAttributeNS(fullname.space, fullname.local, value);
|
|
30183
|
+
};
|
|
30184
|
+
}
|
|
30185
|
+
|
|
30186
|
+
function attrFunction$1(name, value) {
|
|
30187
|
+
return function() {
|
|
30188
|
+
var v = value.apply(this, arguments);
|
|
30189
|
+
if (v == null) this.removeAttribute(name);
|
|
30190
|
+
else this.setAttribute(name, v);
|
|
30191
|
+
};
|
|
30192
|
+
}
|
|
30193
|
+
|
|
30194
|
+
function attrFunctionNS$1(fullname, value) {
|
|
30195
|
+
return function() {
|
|
30196
|
+
var v = value.apply(this, arguments);
|
|
30197
|
+
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
|
|
30198
|
+
else this.setAttributeNS(fullname.space, fullname.local, v);
|
|
30199
|
+
};
|
|
30200
|
+
}
|
|
30201
|
+
|
|
30202
|
+
function selection_attr(name, value) {
|
|
30203
|
+
var fullname = namespace(name);
|
|
30204
|
+
|
|
30205
|
+
if (arguments.length < 2) {
|
|
30206
|
+
var node = this.node();
|
|
30207
|
+
return fullname.local
|
|
30208
|
+
? node.getAttributeNS(fullname.space, fullname.local)
|
|
30209
|
+
: node.getAttribute(fullname);
|
|
30210
|
+
}
|
|
30211
|
+
|
|
30212
|
+
return this.each((value == null
|
|
30213
|
+
? (fullname.local ? attrRemoveNS$1 : attrRemove$1) : (typeof value === "function"
|
|
30214
|
+
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)
|
|
30215
|
+
: (fullname.local ? attrConstantNS$1 : attrConstant$1)))(fullname, value));
|
|
30216
|
+
}
|
|
30217
|
+
|
|
30218
|
+
function defaultView(node) {
|
|
30219
|
+
return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|
|
30220
|
+
|| (node.document && node) // node is a Window
|
|
30221
|
+
|| node.defaultView; // node is a Document
|
|
30222
|
+
}
|
|
30223
|
+
|
|
30224
|
+
function styleRemove$1(name) {
|
|
30225
|
+
return function() {
|
|
30226
|
+
this.style.removeProperty(name);
|
|
30227
|
+
};
|
|
30228
|
+
}
|
|
30229
|
+
|
|
30230
|
+
function styleConstant$1(name, value, priority) {
|
|
30231
|
+
return function() {
|
|
30232
|
+
this.style.setProperty(name, value, priority);
|
|
30233
|
+
};
|
|
30234
|
+
}
|
|
30235
|
+
|
|
30236
|
+
function styleFunction$1(name, value, priority) {
|
|
30237
|
+
return function() {
|
|
30238
|
+
var v = value.apply(this, arguments);
|
|
30239
|
+
if (v == null) this.style.removeProperty(name);
|
|
30240
|
+
else this.style.setProperty(name, v, priority);
|
|
30241
|
+
};
|
|
30242
|
+
}
|
|
30243
|
+
|
|
30244
|
+
function selection_style(name, value, priority) {
|
|
30245
|
+
return arguments.length > 1
|
|
30246
|
+
? this.each((value == null
|
|
30247
|
+
? styleRemove$1 : typeof value === "function"
|
|
30248
|
+
? styleFunction$1
|
|
30249
|
+
: styleConstant$1)(name, value, priority == null ? "" : priority))
|
|
30250
|
+
: styleValue(this.node(), name);
|
|
30251
|
+
}
|
|
30252
|
+
|
|
30253
|
+
function styleValue(node, name) {
|
|
30254
|
+
return node.style.getPropertyValue(name)
|
|
30255
|
+
|| defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
|
|
30256
|
+
}
|
|
30257
|
+
|
|
30258
|
+
function propertyRemove(name) {
|
|
30259
|
+
return function() {
|
|
30260
|
+
delete this[name];
|
|
30261
|
+
};
|
|
30262
|
+
}
|
|
30263
|
+
|
|
30264
|
+
function propertyConstant(name, value) {
|
|
30265
|
+
return function() {
|
|
30266
|
+
this[name] = value;
|
|
30267
|
+
};
|
|
30268
|
+
}
|
|
30269
|
+
|
|
30270
|
+
function propertyFunction(name, value) {
|
|
30271
|
+
return function() {
|
|
30272
|
+
var v = value.apply(this, arguments);
|
|
30273
|
+
if (v == null) delete this[name];
|
|
30274
|
+
else this[name] = v;
|
|
30275
|
+
};
|
|
30276
|
+
}
|
|
30277
|
+
|
|
30278
|
+
function selection_property(name, value) {
|
|
30279
|
+
return arguments.length > 1
|
|
30280
|
+
? this.each((value == null
|
|
30281
|
+
? propertyRemove : typeof value === "function"
|
|
30282
|
+
? propertyFunction
|
|
30283
|
+
: propertyConstant)(name, value))
|
|
30284
|
+
: this.node()[name];
|
|
30285
|
+
}
|
|
30286
|
+
|
|
30287
|
+
function classArray(string) {
|
|
30288
|
+
return string.trim().split(/^|\s+/);
|
|
30289
|
+
}
|
|
30290
|
+
|
|
30291
|
+
function classList(node) {
|
|
30292
|
+
return node.classList || new ClassList(node);
|
|
30293
|
+
}
|
|
30294
|
+
|
|
30295
|
+
function ClassList(node) {
|
|
30296
|
+
this._node = node;
|
|
30297
|
+
this._names = classArray(node.getAttribute("class") || "");
|
|
30298
|
+
}
|
|
30299
|
+
|
|
30300
|
+
ClassList.prototype = {
|
|
30301
|
+
add: function(name) {
|
|
30302
|
+
var i = this._names.indexOf(name);
|
|
30303
|
+
if (i < 0) {
|
|
30304
|
+
this._names.push(name);
|
|
30305
|
+
this._node.setAttribute("class", this._names.join(" "));
|
|
30306
|
+
}
|
|
30307
|
+
},
|
|
30308
|
+
remove: function(name) {
|
|
30309
|
+
var i = this._names.indexOf(name);
|
|
30310
|
+
if (i >= 0) {
|
|
30311
|
+
this._names.splice(i, 1);
|
|
30312
|
+
this._node.setAttribute("class", this._names.join(" "));
|
|
30313
|
+
}
|
|
30314
|
+
},
|
|
30315
|
+
contains: function(name) {
|
|
30316
|
+
return this._names.indexOf(name) >= 0;
|
|
30317
|
+
}
|
|
30318
|
+
};
|
|
30319
|
+
|
|
30320
|
+
function classedAdd(node, names) {
|
|
30321
|
+
var list = classList(node), i = -1, n = names.length;
|
|
30322
|
+
while (++i < n) list.add(names[i]);
|
|
30323
|
+
}
|
|
30324
|
+
|
|
30325
|
+
function classedRemove(node, names) {
|
|
30326
|
+
var list = classList(node), i = -1, n = names.length;
|
|
30327
|
+
while (++i < n) list.remove(names[i]);
|
|
30328
|
+
}
|
|
30329
|
+
|
|
30330
|
+
function classedTrue(names) {
|
|
30331
|
+
return function() {
|
|
30332
|
+
classedAdd(this, names);
|
|
30333
|
+
};
|
|
30334
|
+
}
|
|
30335
|
+
|
|
30336
|
+
function classedFalse(names) {
|
|
30337
|
+
return function() {
|
|
30338
|
+
classedRemove(this, names);
|
|
30339
|
+
};
|
|
30340
|
+
}
|
|
30341
|
+
|
|
30342
|
+
function classedFunction(names, value) {
|
|
30343
|
+
return function() {
|
|
30344
|
+
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
|
30345
|
+
};
|
|
30346
|
+
}
|
|
30347
|
+
|
|
30348
|
+
function selection_classed(name, value) {
|
|
30349
|
+
var names = classArray(name + "");
|
|
30350
|
+
|
|
30351
|
+
if (arguments.length < 2) {
|
|
30352
|
+
var list = classList(this.node()), i = -1, n = names.length;
|
|
30353
|
+
while (++i < n) if (!list.contains(names[i])) return false;
|
|
30354
|
+
return true;
|
|
30355
|
+
}
|
|
30356
|
+
|
|
30357
|
+
return this.each((typeof value === "function"
|
|
30358
|
+
? classedFunction : value
|
|
30359
|
+
? classedTrue
|
|
30360
|
+
: classedFalse)(names, value));
|
|
30361
|
+
}
|
|
30362
|
+
|
|
30363
|
+
function textRemove() {
|
|
30364
|
+
this.textContent = "";
|
|
30365
|
+
}
|
|
30366
|
+
|
|
30367
|
+
function textConstant$1(value) {
|
|
30368
|
+
return function() {
|
|
30369
|
+
this.textContent = value;
|
|
30370
|
+
};
|
|
30371
|
+
}
|
|
30372
|
+
|
|
30373
|
+
function textFunction$1(value) {
|
|
30374
|
+
return function() {
|
|
30375
|
+
var v = value.apply(this, arguments);
|
|
30376
|
+
this.textContent = v == null ? "" : v;
|
|
30377
|
+
};
|
|
30378
|
+
}
|
|
30379
|
+
|
|
30380
|
+
function selection_text(value) {
|
|
30381
|
+
return arguments.length
|
|
30382
|
+
? this.each(value == null
|
|
30383
|
+
? textRemove : (typeof value === "function"
|
|
30384
|
+
? textFunction$1
|
|
30385
|
+
: textConstant$1)(value))
|
|
30386
|
+
: this.node().textContent;
|
|
30387
|
+
}
|
|
30388
|
+
|
|
30389
|
+
function htmlRemove() {
|
|
30390
|
+
this.innerHTML = "";
|
|
30391
|
+
}
|
|
30392
|
+
|
|
30393
|
+
function htmlConstant(value) {
|
|
30394
|
+
return function() {
|
|
30395
|
+
this.innerHTML = value;
|
|
30396
|
+
};
|
|
30397
|
+
}
|
|
30398
|
+
|
|
30399
|
+
function htmlFunction(value) {
|
|
30400
|
+
return function() {
|
|
30401
|
+
var v = value.apply(this, arguments);
|
|
30402
|
+
this.innerHTML = v == null ? "" : v;
|
|
30403
|
+
};
|
|
30404
|
+
}
|
|
30405
|
+
|
|
30406
|
+
function selection_html(value) {
|
|
30407
|
+
return arguments.length
|
|
30408
|
+
? this.each(value == null
|
|
30409
|
+
? htmlRemove : (typeof value === "function"
|
|
30410
|
+
? htmlFunction
|
|
30411
|
+
: htmlConstant)(value))
|
|
30412
|
+
: this.node().innerHTML;
|
|
30413
|
+
}
|
|
30414
|
+
|
|
30415
|
+
function raise() {
|
|
30416
|
+
if (this.nextSibling) this.parentNode.appendChild(this);
|
|
30417
|
+
}
|
|
30418
|
+
|
|
30419
|
+
function selection_raise() {
|
|
30420
|
+
return this.each(raise);
|
|
30421
|
+
}
|
|
30422
|
+
|
|
30423
|
+
function lower() {
|
|
30424
|
+
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
|
30425
|
+
}
|
|
30426
|
+
|
|
30427
|
+
function selection_lower() {
|
|
30428
|
+
return this.each(lower);
|
|
30429
|
+
}
|
|
30430
|
+
|
|
30431
|
+
function selection_append(name) {
|
|
30432
|
+
var create = typeof name === "function" ? name : creator(name);
|
|
30433
|
+
return this.select(function() {
|
|
30434
|
+
return this.appendChild(create.apply(this, arguments));
|
|
30435
|
+
});
|
|
30436
|
+
}
|
|
30437
|
+
|
|
30438
|
+
function constantNull() {
|
|
30439
|
+
return null;
|
|
30440
|
+
}
|
|
30441
|
+
|
|
30442
|
+
function selection_insert(name, before) {
|
|
30443
|
+
var create = typeof name === "function" ? name : creator(name),
|
|
30444
|
+
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
|
30445
|
+
return this.select(function() {
|
|
30446
|
+
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
|
30447
|
+
});
|
|
30448
|
+
}
|
|
30449
|
+
|
|
30450
|
+
function remove() {
|
|
30451
|
+
var parent = this.parentNode;
|
|
30452
|
+
if (parent) parent.removeChild(this);
|
|
30453
|
+
}
|
|
30454
|
+
|
|
30455
|
+
function selection_remove() {
|
|
30456
|
+
return this.each(remove);
|
|
30457
|
+
}
|
|
30458
|
+
|
|
30459
|
+
function selection_cloneShallow() {
|
|
30460
|
+
var clone = this.cloneNode(false), parent = this.parentNode;
|
|
30461
|
+
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
30462
|
+
}
|
|
30463
|
+
|
|
30464
|
+
function selection_cloneDeep() {
|
|
30465
|
+
var clone = this.cloneNode(true), parent = this.parentNode;
|
|
30466
|
+
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
30467
|
+
}
|
|
30468
|
+
|
|
30469
|
+
function selection_clone(deep) {
|
|
30470
|
+
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
|
|
30471
|
+
}
|
|
30472
|
+
|
|
30473
|
+
function selection_datum(value) {
|
|
30474
|
+
return arguments.length
|
|
30475
|
+
? this.property("__data__", value)
|
|
30476
|
+
: this.node().__data__;
|
|
30477
|
+
}
|
|
30478
|
+
|
|
30479
|
+
function contextListener(listener) {
|
|
30480
|
+
return function(event) {
|
|
30481
|
+
listener.call(this, event, this.__data__);
|
|
30482
|
+
};
|
|
30483
|
+
}
|
|
30484
|
+
|
|
30485
|
+
function parseTypenames$1(typenames) {
|
|
30486
|
+
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
30487
|
+
var name = "", i = t.indexOf(".");
|
|
30488
|
+
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
|
30489
|
+
return {type: t, name: name};
|
|
30490
|
+
});
|
|
30491
|
+
}
|
|
30492
|
+
|
|
30493
|
+
function onRemove(typename) {
|
|
30494
|
+
return function() {
|
|
30495
|
+
var on = this.__on;
|
|
30496
|
+
if (!on) return;
|
|
30497
|
+
for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
|
|
30498
|
+
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
|
30499
|
+
this.removeEventListener(o.type, o.listener, o.options);
|
|
30500
|
+
} else {
|
|
30501
|
+
on[++i] = o;
|
|
30502
|
+
}
|
|
30503
|
+
}
|
|
30504
|
+
if (++i) on.length = i;
|
|
30505
|
+
else delete this.__on;
|
|
30506
|
+
};
|
|
30507
|
+
}
|
|
30508
|
+
|
|
30509
|
+
function onAdd(typename, value, options) {
|
|
30510
|
+
return function() {
|
|
30511
|
+
var on = this.__on, o, listener = contextListener(value);
|
|
30512
|
+
if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
|
30513
|
+
if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
|
30514
|
+
this.removeEventListener(o.type, o.listener, o.options);
|
|
30515
|
+
this.addEventListener(o.type, o.listener = listener, o.options = options);
|
|
30516
|
+
o.value = value;
|
|
30517
|
+
return;
|
|
30518
|
+
}
|
|
30519
|
+
}
|
|
30520
|
+
this.addEventListener(typename.type, listener, options);
|
|
30521
|
+
o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};
|
|
30522
|
+
if (!on) this.__on = [o];
|
|
30523
|
+
else on.push(o);
|
|
30524
|
+
};
|
|
30525
|
+
}
|
|
30526
|
+
|
|
30527
|
+
function selection_on(typename, value, options) {
|
|
30528
|
+
var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
|
|
30529
|
+
|
|
30530
|
+
if (arguments.length < 2) {
|
|
30531
|
+
var on = this.node().__on;
|
|
30532
|
+
if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
|
|
30533
|
+
for (i = 0, o = on[j]; i < n; ++i) {
|
|
30534
|
+
if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
|
30535
|
+
return o.value;
|
|
30536
|
+
}
|
|
30537
|
+
}
|
|
30538
|
+
}
|
|
30539
|
+
return;
|
|
30540
|
+
}
|
|
30541
|
+
|
|
30542
|
+
on = value ? onAdd : onRemove;
|
|
30543
|
+
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));
|
|
30544
|
+
return this;
|
|
30545
|
+
}
|
|
30546
|
+
|
|
30547
|
+
function dispatchEvent(node, type, params) {
|
|
30548
|
+
var window = defaultView(node),
|
|
30549
|
+
event = window.CustomEvent;
|
|
30550
|
+
|
|
30551
|
+
if (typeof event === "function") {
|
|
30552
|
+
event = new event(type, params);
|
|
30553
|
+
} else {
|
|
30554
|
+
event = window.document.createEvent("Event");
|
|
30555
|
+
if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
|
|
30556
|
+
else event.initEvent(type, false, false);
|
|
30557
|
+
}
|
|
30558
|
+
|
|
30559
|
+
node.dispatchEvent(event);
|
|
30560
|
+
}
|
|
30561
|
+
|
|
30562
|
+
function dispatchConstant(type, params) {
|
|
30563
|
+
return function() {
|
|
30564
|
+
return dispatchEvent(this, type, params);
|
|
30565
|
+
};
|
|
30566
|
+
}
|
|
30567
|
+
|
|
30568
|
+
function dispatchFunction(type, params) {
|
|
30569
|
+
return function() {
|
|
30570
|
+
return dispatchEvent(this, type, params.apply(this, arguments));
|
|
30571
|
+
};
|
|
30572
|
+
}
|
|
30573
|
+
|
|
30574
|
+
function selection_dispatch(type, params) {
|
|
30575
|
+
return this.each((typeof params === "function"
|
|
30576
|
+
? dispatchFunction
|
|
30577
|
+
: dispatchConstant)(type, params));
|
|
30578
|
+
}
|
|
30579
|
+
|
|
30580
|
+
function* selection_iterator() {
|
|
30581
|
+
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
30582
|
+
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
30583
|
+
if (node = group[i]) yield node;
|
|
30584
|
+
}
|
|
30585
|
+
}
|
|
30586
|
+
}
|
|
30587
|
+
|
|
30588
|
+
var root = [null];
|
|
30589
|
+
|
|
30590
|
+
function Selection$1(groups, parents) {
|
|
30591
|
+
this._groups = groups;
|
|
30592
|
+
this._parents = parents;
|
|
30593
|
+
}
|
|
30594
|
+
|
|
30595
|
+
function selection() {
|
|
30596
|
+
return new Selection$1([[document.documentElement]], root);
|
|
30597
|
+
}
|
|
30598
|
+
|
|
30599
|
+
function selection_selection() {
|
|
30600
|
+
return this;
|
|
30601
|
+
}
|
|
30602
|
+
|
|
30603
|
+
Selection$1.prototype = selection.prototype = {
|
|
30604
|
+
constructor: Selection$1,
|
|
30605
|
+
select: selection_select,
|
|
30606
|
+
selectAll: selection_selectAll,
|
|
30607
|
+
selectChild: selection_selectChild,
|
|
30608
|
+
selectChildren: selection_selectChildren,
|
|
30609
|
+
filter: selection_filter,
|
|
30610
|
+
data: selection_data,
|
|
30611
|
+
enter: selection_enter,
|
|
30612
|
+
exit: selection_exit,
|
|
30613
|
+
join: selection_join,
|
|
30614
|
+
merge: selection_merge,
|
|
30615
|
+
selection: selection_selection,
|
|
30616
|
+
order: selection_order,
|
|
30617
|
+
sort: selection_sort,
|
|
30618
|
+
call: selection_call,
|
|
30619
|
+
nodes: selection_nodes,
|
|
30620
|
+
node: selection_node,
|
|
30621
|
+
size: selection_size,
|
|
30622
|
+
empty: selection_empty,
|
|
30623
|
+
each: selection_each,
|
|
30624
|
+
attr: selection_attr,
|
|
30625
|
+
style: selection_style,
|
|
30626
|
+
property: selection_property,
|
|
30627
|
+
classed: selection_classed,
|
|
30628
|
+
text: selection_text,
|
|
30629
|
+
html: selection_html,
|
|
30630
|
+
raise: selection_raise,
|
|
30631
|
+
lower: selection_lower,
|
|
30632
|
+
append: selection_append,
|
|
30633
|
+
insert: selection_insert,
|
|
30634
|
+
remove: selection_remove,
|
|
30635
|
+
clone: selection_clone,
|
|
30636
|
+
datum: selection_datum,
|
|
30637
|
+
on: selection_on,
|
|
30638
|
+
dispatch: selection_dispatch,
|
|
30639
|
+
[Symbol.iterator]: selection_iterator
|
|
30640
|
+
};
|
|
30641
|
+
|
|
30642
|
+
function select(selector) {
|
|
30643
|
+
return typeof selector === "string"
|
|
30644
|
+
? new Selection$1([[document.querySelector(selector)]], [document.documentElement])
|
|
30645
|
+
: new Selection$1([[selector]], root);
|
|
30646
|
+
}
|
|
30647
|
+
|
|
30648
|
+
function sourceEvent(event) {
|
|
30649
|
+
let sourceEvent;
|
|
30650
|
+
while (sourceEvent = event.sourceEvent) event = sourceEvent;
|
|
30651
|
+
return event;
|
|
30652
|
+
}
|
|
30653
|
+
|
|
30654
|
+
function pointer(event, node) {
|
|
30655
|
+
event = sourceEvent(event);
|
|
30656
|
+
if (node === undefined) node = event.currentTarget;
|
|
30657
|
+
if (node) {
|
|
30658
|
+
var svg = node.ownerSVGElement || node;
|
|
30659
|
+
if (svg.createSVGPoint) {
|
|
30660
|
+
var point = svg.createSVGPoint();
|
|
30661
|
+
point.x = event.clientX, point.y = event.clientY;
|
|
30662
|
+
point = point.matrixTransform(node.getScreenCTM().inverse());
|
|
30663
|
+
return [point.x, point.y];
|
|
30664
|
+
}
|
|
30665
|
+
if (node.getBoundingClientRect) {
|
|
30666
|
+
var rect = node.getBoundingClientRect();
|
|
30667
|
+
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
|
30668
|
+
}
|
|
30669
|
+
}
|
|
30670
|
+
return [event.pageX, event.pageY];
|
|
30671
|
+
}
|
|
30672
|
+
|
|
30673
|
+
var noop = {value: () => {}};
|
|
30674
|
+
|
|
30675
|
+
function dispatch() {
|
|
30676
|
+
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
|
|
30677
|
+
if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
|
|
30678
|
+
_[t] = [];
|
|
30679
|
+
}
|
|
30680
|
+
return new Dispatch(_);
|
|
30681
|
+
}
|
|
30682
|
+
|
|
30683
|
+
function Dispatch(_) {
|
|
30684
|
+
this._ = _;
|
|
30685
|
+
}
|
|
30686
|
+
|
|
30687
|
+
function parseTypenames(typenames, types) {
|
|
30688
|
+
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
30689
|
+
var name = "", i = t.indexOf(".");
|
|
30690
|
+
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
|
30691
|
+
if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
|
30692
|
+
return {type: t, name: name};
|
|
30693
|
+
});
|
|
30694
|
+
}
|
|
30695
|
+
|
|
30696
|
+
Dispatch.prototype = dispatch.prototype = {
|
|
30697
|
+
constructor: Dispatch,
|
|
30698
|
+
on: function(typename, callback) {
|
|
30699
|
+
var _ = this._,
|
|
30700
|
+
T = parseTypenames(typename + "", _),
|
|
30701
|
+
t,
|
|
30702
|
+
i = -1,
|
|
30703
|
+
n = T.length;
|
|
30704
|
+
|
|
30705
|
+
// If no callback was specified, return the callback of the given type and name.
|
|
30706
|
+
if (arguments.length < 2) {
|
|
30707
|
+
while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
|
|
30708
|
+
return;
|
|
30709
|
+
}
|
|
30710
|
+
|
|
30711
|
+
// If a type was specified, set the callback for the given type and name.
|
|
30712
|
+
// Otherwise, if a null callback was specified, remove callbacks of the given name.
|
|
30713
|
+
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
|
30714
|
+
while (++i < n) {
|
|
30715
|
+
if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
|
|
30716
|
+
else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
|
|
30717
|
+
}
|
|
30718
|
+
|
|
30719
|
+
return this;
|
|
30720
|
+
},
|
|
30721
|
+
copy: function() {
|
|
30722
|
+
var copy = {}, _ = this._;
|
|
30723
|
+
for (var t in _) copy[t] = _[t].slice();
|
|
30724
|
+
return new Dispatch(copy);
|
|
30725
|
+
},
|
|
30726
|
+
call: function(type, that) {
|
|
30727
|
+
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
|
30728
|
+
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
30729
|
+
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
30730
|
+
},
|
|
30731
|
+
apply: function(type, that, args) {
|
|
30732
|
+
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
30733
|
+
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
30734
|
+
}
|
|
30735
|
+
};
|
|
30736
|
+
|
|
30737
|
+
function get$1(type, name) {
|
|
30738
|
+
for (var i = 0, n = type.length, c; i < n; ++i) {
|
|
30739
|
+
if ((c = type[i]).name === name) {
|
|
30740
|
+
return c.value;
|
|
30741
|
+
}
|
|
30742
|
+
}
|
|
30743
|
+
}
|
|
30744
|
+
|
|
30745
|
+
function set$1(type, name, callback) {
|
|
30746
|
+
for (var i = 0, n = type.length; i < n; ++i) {
|
|
30747
|
+
if (type[i].name === name) {
|
|
30748
|
+
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
|
30749
|
+
break;
|
|
30750
|
+
}
|
|
30751
|
+
}
|
|
30752
|
+
if (callback != null) type.push({name: name, value: callback});
|
|
30753
|
+
return type;
|
|
30754
|
+
}
|
|
30755
|
+
|
|
30756
|
+
// These are typically used in conjunction with noevent to ensure that we can
|
|
30757
|
+
const nonpassivecapture = {capture: true, passive: false};
|
|
30758
|
+
|
|
30759
|
+
function noevent$1(event) {
|
|
30760
|
+
event.preventDefault();
|
|
30761
|
+
event.stopImmediatePropagation();
|
|
30762
|
+
}
|
|
30763
|
+
|
|
30764
|
+
function dragDisable(view) {
|
|
30765
|
+
var root = view.document.documentElement,
|
|
30766
|
+
selection = select(view).on("dragstart.drag", noevent$1, nonpassivecapture);
|
|
30767
|
+
if ("onselectstart" in root) {
|
|
30768
|
+
selection.on("selectstart.drag", noevent$1, nonpassivecapture);
|
|
30769
|
+
} else {
|
|
30770
|
+
root.__noselect = root.style.MozUserSelect;
|
|
30771
|
+
root.style.MozUserSelect = "none";
|
|
30772
|
+
}
|
|
30773
|
+
}
|
|
30774
|
+
|
|
30775
|
+
function yesdrag(view, noclick) {
|
|
30776
|
+
var root = view.document.documentElement,
|
|
30777
|
+
selection = select(view).on("dragstart.drag", null);
|
|
30778
|
+
if (noclick) {
|
|
30779
|
+
selection.on("click.drag", noevent$1, nonpassivecapture);
|
|
30780
|
+
setTimeout(function() { selection.on("click.drag", null); }, 0);
|
|
30781
|
+
}
|
|
30782
|
+
if ("onselectstart" in root) {
|
|
30783
|
+
selection.on("selectstart.drag", null);
|
|
30784
|
+
} else {
|
|
30785
|
+
root.style.MozUserSelect = root.__noselect;
|
|
30786
|
+
delete root.__noselect;
|
|
30787
|
+
}
|
|
30788
|
+
}
|
|
30789
|
+
|
|
30790
|
+
var frame = 0, // is an animation frame pending?
|
|
30791
|
+
timeout$1 = 0, // is a timeout pending?
|
|
30792
|
+
interval = 0, // are any timers active?
|
|
30793
|
+
pokeDelay = 1000, // how frequently we check for clock skew
|
|
30794
|
+
taskHead,
|
|
30795
|
+
taskTail,
|
|
30796
|
+
clockLast = 0,
|
|
30797
|
+
clockNow = 0,
|
|
30798
|
+
clockSkew = 0,
|
|
30799
|
+
clock = typeof performance === "object" && performance.now ? performance : Date,
|
|
30800
|
+
setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
|
|
30801
|
+
|
|
30802
|
+
function now() {
|
|
30803
|
+
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
|
30804
|
+
}
|
|
30805
|
+
|
|
30806
|
+
function clearNow() {
|
|
30807
|
+
clockNow = 0;
|
|
30808
|
+
}
|
|
30809
|
+
|
|
30810
|
+
function Timer() {
|
|
30811
|
+
this._call =
|
|
30812
|
+
this._time =
|
|
30813
|
+
this._next = null;
|
|
30814
|
+
}
|
|
30815
|
+
|
|
30816
|
+
Timer.prototype = timer.prototype = {
|
|
30817
|
+
constructor: Timer,
|
|
30818
|
+
restart: function(callback, delay, time) {
|
|
30819
|
+
if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
|
30820
|
+
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
|
30821
|
+
if (!this._next && taskTail !== this) {
|
|
30822
|
+
if (taskTail) taskTail._next = this;
|
|
30823
|
+
else taskHead = this;
|
|
30824
|
+
taskTail = this;
|
|
30825
|
+
}
|
|
30826
|
+
this._call = callback;
|
|
30827
|
+
this._time = time;
|
|
30828
|
+
sleep();
|
|
30829
|
+
},
|
|
30830
|
+
stop: function() {
|
|
30831
|
+
if (this._call) {
|
|
30832
|
+
this._call = null;
|
|
30833
|
+
this._time = Infinity;
|
|
30834
|
+
sleep();
|
|
30835
|
+
}
|
|
30836
|
+
}
|
|
30837
|
+
};
|
|
30838
|
+
|
|
30839
|
+
function timer(callback, delay, time) {
|
|
30840
|
+
var t = new Timer;
|
|
30841
|
+
t.restart(callback, delay, time);
|
|
30842
|
+
return t;
|
|
30843
|
+
}
|
|
30844
|
+
|
|
30845
|
+
function timerFlush() {
|
|
30846
|
+
now(); // Get the current time, if not already set.
|
|
30847
|
+
++frame; // Pretend we’ve set an alarm, if we haven’t already.
|
|
30848
|
+
var t = taskHead, e;
|
|
30849
|
+
while (t) {
|
|
30850
|
+
if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
|
|
30851
|
+
t = t._next;
|
|
30852
|
+
}
|
|
30853
|
+
--frame;
|
|
30854
|
+
}
|
|
30855
|
+
|
|
30856
|
+
function wake() {
|
|
30857
|
+
clockNow = (clockLast = clock.now()) + clockSkew;
|
|
30858
|
+
frame = timeout$1 = 0;
|
|
30859
|
+
try {
|
|
30860
|
+
timerFlush();
|
|
30861
|
+
} finally {
|
|
30862
|
+
frame = 0;
|
|
30863
|
+
nap();
|
|
30864
|
+
clockNow = 0;
|
|
30865
|
+
}
|
|
30866
|
+
}
|
|
30867
|
+
|
|
30868
|
+
function poke() {
|
|
30869
|
+
var now = clock.now(), delay = now - clockLast;
|
|
30870
|
+
if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
|
|
30871
|
+
}
|
|
30872
|
+
|
|
30873
|
+
function nap() {
|
|
30874
|
+
var t0, t1 = taskHead, t2, time = Infinity;
|
|
30875
|
+
while (t1) {
|
|
30876
|
+
if (t1._call) {
|
|
30877
|
+
if (time > t1._time) time = t1._time;
|
|
30878
|
+
t0 = t1, t1 = t1._next;
|
|
30879
|
+
} else {
|
|
30880
|
+
t2 = t1._next, t1._next = null;
|
|
30881
|
+
t1 = t0 ? t0._next = t2 : taskHead = t2;
|
|
30882
|
+
}
|
|
30883
|
+
}
|
|
30884
|
+
taskTail = t0;
|
|
30885
|
+
sleep(time);
|
|
30886
|
+
}
|
|
30887
|
+
|
|
30888
|
+
function sleep(time) {
|
|
30889
|
+
if (frame) return; // Soonest alarm already set, or will be.
|
|
30890
|
+
if (timeout$1) timeout$1 = clearTimeout(timeout$1);
|
|
30891
|
+
var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
|
|
30892
|
+
if (delay > 24) {
|
|
30893
|
+
if (time < Infinity) timeout$1 = setTimeout(wake, time - clock.now() - clockSkew);
|
|
30894
|
+
if (interval) interval = clearInterval(interval);
|
|
30895
|
+
} else {
|
|
30896
|
+
if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
|
30897
|
+
frame = 1, setFrame(wake);
|
|
30898
|
+
}
|
|
30899
|
+
}
|
|
30900
|
+
|
|
30901
|
+
function timeout(callback, delay, time) {
|
|
30902
|
+
var t = new Timer;
|
|
30903
|
+
delay = delay == null ? 0 : +delay;
|
|
30904
|
+
t.restart(elapsed => {
|
|
30905
|
+
t.stop();
|
|
30906
|
+
callback(elapsed + delay);
|
|
30907
|
+
}, delay, time);
|
|
30908
|
+
return t;
|
|
30909
|
+
}
|
|
30910
|
+
|
|
30911
|
+
var emptyOn = dispatch("start", "end", "cancel", "interrupt");
|
|
30912
|
+
var emptyTween = [];
|
|
30913
|
+
|
|
30914
|
+
var CREATED = 0;
|
|
30915
|
+
var SCHEDULED = 1;
|
|
30916
|
+
var STARTING = 2;
|
|
30917
|
+
var STARTED = 3;
|
|
30918
|
+
var RUNNING = 4;
|
|
30919
|
+
var ENDING = 5;
|
|
30920
|
+
var ENDED = 6;
|
|
30921
|
+
|
|
30922
|
+
function schedule(node, name, id, index, group, timing) {
|
|
30923
|
+
var schedules = node.__transition;
|
|
30924
|
+
if (!schedules) node.__transition = {};
|
|
30925
|
+
else if (id in schedules) return;
|
|
30926
|
+
create(node, id, {
|
|
30927
|
+
name: name,
|
|
30928
|
+
index: index, // For context during callback.
|
|
30929
|
+
group: group, // For context during callback.
|
|
30930
|
+
on: emptyOn,
|
|
30931
|
+
tween: emptyTween,
|
|
30932
|
+
time: timing.time,
|
|
30933
|
+
delay: timing.delay,
|
|
30934
|
+
duration: timing.duration,
|
|
30935
|
+
ease: timing.ease,
|
|
30936
|
+
timer: null,
|
|
30937
|
+
state: CREATED
|
|
30938
|
+
});
|
|
30939
|
+
}
|
|
30940
|
+
|
|
30941
|
+
function init(node, id) {
|
|
30942
|
+
var schedule = get(node, id);
|
|
30943
|
+
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
|
30944
|
+
return schedule;
|
|
30945
|
+
}
|
|
30946
|
+
|
|
30947
|
+
function set(node, id) {
|
|
30948
|
+
var schedule = get(node, id);
|
|
30949
|
+
if (schedule.state > STARTED) throw new Error("too late; already running");
|
|
30950
|
+
return schedule;
|
|
30951
|
+
}
|
|
30952
|
+
|
|
30953
|
+
function get(node, id) {
|
|
30954
|
+
var schedule = node.__transition;
|
|
30955
|
+
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
|
30956
|
+
return schedule;
|
|
30957
|
+
}
|
|
30958
|
+
|
|
30959
|
+
function create(node, id, self) {
|
|
30960
|
+
var schedules = node.__transition,
|
|
30961
|
+
tween;
|
|
30962
|
+
|
|
30963
|
+
// Initialize the self timer when the transition is created.
|
|
30964
|
+
// Note the actual delay is not known until the first callback!
|
|
30965
|
+
schedules[id] = self;
|
|
30966
|
+
self.timer = timer(schedule, 0, self.time);
|
|
30967
|
+
|
|
30968
|
+
function schedule(elapsed) {
|
|
30969
|
+
self.state = SCHEDULED;
|
|
30970
|
+
self.timer.restart(start, self.delay, self.time);
|
|
30971
|
+
|
|
30972
|
+
// If the elapsed delay is less than our first sleep, start immediately.
|
|
30973
|
+
if (self.delay <= elapsed) start(elapsed - self.delay);
|
|
30974
|
+
}
|
|
30975
|
+
|
|
30976
|
+
function start(elapsed) {
|
|
30977
|
+
var i, j, n, o;
|
|
30978
|
+
|
|
30979
|
+
// If the state is not SCHEDULED, then we previously errored on start.
|
|
30980
|
+
if (self.state !== SCHEDULED) return stop();
|
|
30981
|
+
|
|
30982
|
+
for (i in schedules) {
|
|
30983
|
+
o = schedules[i];
|
|
30984
|
+
if (o.name !== self.name) continue;
|
|
30985
|
+
|
|
30986
|
+
// While this element already has a starting transition during this frame,
|
|
30987
|
+
// defer starting an interrupting transition until that transition has a
|
|
30988
|
+
// chance to tick (and possibly end); see d3/d3-transition#54!
|
|
30989
|
+
if (o.state === STARTED) return timeout(start);
|
|
30990
|
+
|
|
30991
|
+
// Interrupt the active transition, if any.
|
|
30992
|
+
if (o.state === RUNNING) {
|
|
30993
|
+
o.state = ENDED;
|
|
30994
|
+
o.timer.stop();
|
|
30995
|
+
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
|
30996
|
+
delete schedules[i];
|
|
30997
|
+
}
|
|
30998
|
+
|
|
30999
|
+
// Cancel any pre-empted transitions.
|
|
31000
|
+
else if (+i < id) {
|
|
31001
|
+
o.state = ENDED;
|
|
31002
|
+
o.timer.stop();
|
|
31003
|
+
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
|
31004
|
+
delete schedules[i];
|
|
31005
|
+
}
|
|
31006
|
+
}
|
|
31007
|
+
|
|
31008
|
+
// Defer the first tick to end of the current frame; see d3/d3#1576.
|
|
31009
|
+
// Note the transition may be canceled after start and before the first tick!
|
|
31010
|
+
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
|
31011
|
+
// Assuming this is successful, subsequent callbacks go straight to tick.
|
|
31012
|
+
timeout(function() {
|
|
31013
|
+
if (self.state === STARTED) {
|
|
31014
|
+
self.state = RUNNING;
|
|
31015
|
+
self.timer.restart(tick, self.delay, self.time);
|
|
31016
|
+
tick(elapsed);
|
|
31017
|
+
}
|
|
31018
|
+
});
|
|
31019
|
+
|
|
31020
|
+
// Dispatch the start event.
|
|
31021
|
+
// Note this must be done before the tween are initialized.
|
|
31022
|
+
self.state = STARTING;
|
|
31023
|
+
self.on.call("start", node, node.__data__, self.index, self.group);
|
|
31024
|
+
if (self.state !== STARTING) return; // interrupted
|
|
31025
|
+
self.state = STARTED;
|
|
31026
|
+
|
|
31027
|
+
// Initialize the tween, deleting null tween.
|
|
31028
|
+
tween = new Array(n = self.tween.length);
|
|
31029
|
+
for (i = 0, j = -1; i < n; ++i) {
|
|
31030
|
+
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
|
31031
|
+
tween[++j] = o;
|
|
31032
|
+
}
|
|
31033
|
+
}
|
|
31034
|
+
tween.length = j + 1;
|
|
31035
|
+
}
|
|
31036
|
+
|
|
31037
|
+
function tick(elapsed) {
|
|
31038
|
+
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
|
31039
|
+
i = -1,
|
|
31040
|
+
n = tween.length;
|
|
31041
|
+
|
|
31042
|
+
while (++i < n) {
|
|
31043
|
+
tween[i].call(node, t);
|
|
31044
|
+
}
|
|
31045
|
+
|
|
31046
|
+
// Dispatch the end event.
|
|
31047
|
+
if (self.state === ENDING) {
|
|
31048
|
+
self.on.call("end", node, node.__data__, self.index, self.group);
|
|
31049
|
+
stop();
|
|
31050
|
+
}
|
|
31051
|
+
}
|
|
31052
|
+
|
|
31053
|
+
function stop() {
|
|
31054
|
+
self.state = ENDED;
|
|
31055
|
+
self.timer.stop();
|
|
31056
|
+
delete schedules[id];
|
|
31057
|
+
for (var i in schedules) return; // eslint-disable-line no-unused-vars
|
|
31058
|
+
delete node.__transition;
|
|
31059
|
+
}
|
|
31060
|
+
}
|
|
31061
|
+
|
|
31062
|
+
function interrupt(node, name) {
|
|
31063
|
+
var schedules = node.__transition,
|
|
31064
|
+
schedule,
|
|
31065
|
+
active,
|
|
31066
|
+
empty = true,
|
|
31067
|
+
i;
|
|
31068
|
+
|
|
31069
|
+
if (!schedules) return;
|
|
31070
|
+
|
|
31071
|
+
name = name == null ? null : name + "";
|
|
31072
|
+
|
|
31073
|
+
for (i in schedules) {
|
|
31074
|
+
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
|
31075
|
+
active = schedule.state > STARTING && schedule.state < ENDING;
|
|
31076
|
+
schedule.state = ENDED;
|
|
31077
|
+
schedule.timer.stop();
|
|
31078
|
+
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
|
31079
|
+
delete schedules[i];
|
|
31080
|
+
}
|
|
31081
|
+
|
|
31082
|
+
if (empty) delete node.__transition;
|
|
31083
|
+
}
|
|
31084
|
+
|
|
31085
|
+
function selection_interrupt(name) {
|
|
31086
|
+
return this.each(function() {
|
|
31087
|
+
interrupt(this, name);
|
|
31088
|
+
});
|
|
31089
|
+
}
|
|
31090
|
+
|
|
31091
|
+
function tweenRemove(id, name) {
|
|
31092
|
+
var tween0, tween1;
|
|
31093
|
+
return function() {
|
|
31094
|
+
var schedule = set(this, id),
|
|
31095
|
+
tween = schedule.tween;
|
|
31096
|
+
|
|
31097
|
+
// If this node shared tween with the previous node,
|
|
31098
|
+
// just assign the updated shared tween and we’re done!
|
|
31099
|
+
// Otherwise, copy-on-write.
|
|
31100
|
+
if (tween !== tween0) {
|
|
31101
|
+
tween1 = tween0 = tween;
|
|
31102
|
+
for (var i = 0, n = tween1.length; i < n; ++i) {
|
|
31103
|
+
if (tween1[i].name === name) {
|
|
31104
|
+
tween1 = tween1.slice();
|
|
31105
|
+
tween1.splice(i, 1);
|
|
31106
|
+
break;
|
|
31107
|
+
}
|
|
31108
|
+
}
|
|
31109
|
+
}
|
|
31110
|
+
|
|
31111
|
+
schedule.tween = tween1;
|
|
31112
|
+
};
|
|
31113
|
+
}
|
|
31114
|
+
|
|
31115
|
+
function tweenFunction(id, name, value) {
|
|
31116
|
+
var tween0, tween1;
|
|
31117
|
+
if (typeof value !== "function") throw new Error;
|
|
31118
|
+
return function() {
|
|
31119
|
+
var schedule = set(this, id),
|
|
31120
|
+
tween = schedule.tween;
|
|
31121
|
+
|
|
31122
|
+
// If this node shared tween with the previous node,
|
|
31123
|
+
// just assign the updated shared tween and we’re done!
|
|
31124
|
+
// Otherwise, copy-on-write.
|
|
31125
|
+
if (tween !== tween0) {
|
|
31126
|
+
tween1 = (tween0 = tween).slice();
|
|
31127
|
+
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
|
31128
|
+
if (tween1[i].name === name) {
|
|
31129
|
+
tween1[i] = t;
|
|
31130
|
+
break;
|
|
31131
|
+
}
|
|
31132
|
+
}
|
|
31133
|
+
if (i === n) tween1.push(t);
|
|
31134
|
+
}
|
|
31135
|
+
|
|
31136
|
+
schedule.tween = tween1;
|
|
31137
|
+
};
|
|
31138
|
+
}
|
|
31139
|
+
|
|
31140
|
+
function transition_tween(name, value) {
|
|
31141
|
+
var id = this._id;
|
|
31142
|
+
|
|
31143
|
+
name += "";
|
|
31144
|
+
|
|
31145
|
+
if (arguments.length < 2) {
|
|
31146
|
+
var tween = get(this.node(), id).tween;
|
|
31147
|
+
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
|
31148
|
+
if ((t = tween[i]).name === name) {
|
|
31149
|
+
return t.value;
|
|
31150
|
+
}
|
|
31151
|
+
}
|
|
31152
|
+
return null;
|
|
31153
|
+
}
|
|
31154
|
+
|
|
31155
|
+
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
|
31156
|
+
}
|
|
31157
|
+
|
|
31158
|
+
function tweenValue(transition, name, value) {
|
|
31159
|
+
var id = transition._id;
|
|
31160
|
+
|
|
31161
|
+
transition.each(function() {
|
|
31162
|
+
var schedule = set(this, id);
|
|
31163
|
+
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
|
31164
|
+
});
|
|
31165
|
+
|
|
31166
|
+
return function(node) {
|
|
31167
|
+
return get(node, id).value[name];
|
|
31168
|
+
};
|
|
31169
|
+
}
|
|
31170
|
+
|
|
31171
|
+
function interpolate(a, b) {
|
|
31172
|
+
var c;
|
|
31173
|
+
return (typeof b === "number" ? interpolateNumber
|
|
31174
|
+
: b instanceof color ? interpolateRgb
|
|
31175
|
+
: (c = color(b)) ? (b = c, interpolateRgb)
|
|
31176
|
+
: interpolateString)(a, b);
|
|
31177
|
+
}
|
|
31178
|
+
|
|
31179
|
+
function attrRemove(name) {
|
|
31180
|
+
return function() {
|
|
31181
|
+
this.removeAttribute(name);
|
|
31182
|
+
};
|
|
31183
|
+
}
|
|
31184
|
+
|
|
31185
|
+
function attrRemoveNS(fullname) {
|
|
31186
|
+
return function() {
|
|
31187
|
+
this.removeAttributeNS(fullname.space, fullname.local);
|
|
31188
|
+
};
|
|
31189
|
+
}
|
|
31190
|
+
|
|
31191
|
+
function attrConstant(name, interpolate, value1) {
|
|
31192
|
+
var string00,
|
|
31193
|
+
string1 = value1 + "",
|
|
31194
|
+
interpolate0;
|
|
31195
|
+
return function() {
|
|
31196
|
+
var string0 = this.getAttribute(name);
|
|
31197
|
+
return string0 === string1 ? null
|
|
31198
|
+
: string0 === string00 ? interpolate0
|
|
31199
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
31200
|
+
};
|
|
31201
|
+
}
|
|
31202
|
+
|
|
31203
|
+
function attrConstantNS(fullname, interpolate, value1) {
|
|
31204
|
+
var string00,
|
|
31205
|
+
string1 = value1 + "",
|
|
31206
|
+
interpolate0;
|
|
31207
|
+
return function() {
|
|
31208
|
+
var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
31209
|
+
return string0 === string1 ? null
|
|
31210
|
+
: string0 === string00 ? interpolate0
|
|
31211
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
31212
|
+
};
|
|
31213
|
+
}
|
|
31214
|
+
|
|
31215
|
+
function attrFunction(name, interpolate, value) {
|
|
31216
|
+
var string00,
|
|
31217
|
+
string10,
|
|
31218
|
+
interpolate0;
|
|
31219
|
+
return function() {
|
|
31220
|
+
var string0, value1 = value(this), string1;
|
|
31221
|
+
if (value1 == null) return void this.removeAttribute(name);
|
|
31222
|
+
string0 = this.getAttribute(name);
|
|
31223
|
+
string1 = value1 + "";
|
|
31224
|
+
return string0 === string1 ? null
|
|
31225
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
31226
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
31227
|
+
};
|
|
31228
|
+
}
|
|
31229
|
+
|
|
31230
|
+
function attrFunctionNS(fullname, interpolate, value) {
|
|
31231
|
+
var string00,
|
|
31232
|
+
string10,
|
|
31233
|
+
interpolate0;
|
|
31234
|
+
return function() {
|
|
31235
|
+
var string0, value1 = value(this), string1;
|
|
31236
|
+
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
|
31237
|
+
string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
31238
|
+
string1 = value1 + "";
|
|
31239
|
+
return string0 === string1 ? null
|
|
31240
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
31241
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
31242
|
+
};
|
|
31243
|
+
}
|
|
31244
|
+
|
|
31245
|
+
function transition_attr(name, value) {
|
|
31246
|
+
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
|
|
31247
|
+
return this.attrTween(name, typeof value === "function"
|
|
31248
|
+
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
|
|
31249
|
+
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
|
|
31250
|
+
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
|
31251
|
+
}
|
|
31252
|
+
|
|
31253
|
+
function attrInterpolate(name, i) {
|
|
31254
|
+
return function(t) {
|
|
31255
|
+
this.setAttribute(name, i.call(this, t));
|
|
31256
|
+
};
|
|
31257
|
+
}
|
|
31258
|
+
|
|
31259
|
+
function attrInterpolateNS(fullname, i) {
|
|
31260
|
+
return function(t) {
|
|
31261
|
+
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
|
31262
|
+
};
|
|
31263
|
+
}
|
|
31264
|
+
|
|
31265
|
+
function attrTweenNS(fullname, value) {
|
|
31266
|
+
var t0, i0;
|
|
31267
|
+
function tween() {
|
|
31268
|
+
var i = value.apply(this, arguments);
|
|
31269
|
+
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
|
31270
|
+
return t0;
|
|
31271
|
+
}
|
|
31272
|
+
tween._value = value;
|
|
31273
|
+
return tween;
|
|
31274
|
+
}
|
|
31275
|
+
|
|
31276
|
+
function attrTween(name, value) {
|
|
31277
|
+
var t0, i0;
|
|
31278
|
+
function tween() {
|
|
31279
|
+
var i = value.apply(this, arguments);
|
|
31280
|
+
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
|
|
31281
|
+
return t0;
|
|
31282
|
+
}
|
|
31283
|
+
tween._value = value;
|
|
31284
|
+
return tween;
|
|
31285
|
+
}
|
|
31286
|
+
|
|
31287
|
+
function transition_attrTween(name, value) {
|
|
31288
|
+
var key = "attr." + name;
|
|
31289
|
+
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|
31290
|
+
if (value == null) return this.tween(key, null);
|
|
31291
|
+
if (typeof value !== "function") throw new Error;
|
|
31292
|
+
var fullname = namespace(name);
|
|
31293
|
+
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
|
31294
|
+
}
|
|
31295
|
+
|
|
31296
|
+
function delayFunction(id, value) {
|
|
31297
|
+
return function() {
|
|
31298
|
+
init(this, id).delay = +value.apply(this, arguments);
|
|
31299
|
+
};
|
|
31300
|
+
}
|
|
31301
|
+
|
|
31302
|
+
function delayConstant(id, value) {
|
|
31303
|
+
return value = +value, function() {
|
|
31304
|
+
init(this, id).delay = value;
|
|
31305
|
+
};
|
|
31306
|
+
}
|
|
31307
|
+
|
|
31308
|
+
function transition_delay(value) {
|
|
31309
|
+
var id = this._id;
|
|
31310
|
+
|
|
31311
|
+
return arguments.length
|
|
31312
|
+
? this.each((typeof value === "function"
|
|
31313
|
+
? delayFunction
|
|
31314
|
+
: delayConstant)(id, value))
|
|
31315
|
+
: get(this.node(), id).delay;
|
|
31316
|
+
}
|
|
31317
|
+
|
|
31318
|
+
function durationFunction(id, value) {
|
|
31319
|
+
return function() {
|
|
31320
|
+
set(this, id).duration = +value.apply(this, arguments);
|
|
31321
|
+
};
|
|
31322
|
+
}
|
|
31323
|
+
|
|
31324
|
+
function durationConstant(id, value) {
|
|
31325
|
+
return value = +value, function() {
|
|
31326
|
+
set(this, id).duration = value;
|
|
31327
|
+
};
|
|
31328
|
+
}
|
|
31329
|
+
|
|
31330
|
+
function transition_duration(value) {
|
|
31331
|
+
var id = this._id;
|
|
31332
|
+
|
|
31333
|
+
return arguments.length
|
|
31334
|
+
? this.each((typeof value === "function"
|
|
31335
|
+
? durationFunction
|
|
31336
|
+
: durationConstant)(id, value))
|
|
31337
|
+
: get(this.node(), id).duration;
|
|
31338
|
+
}
|
|
31339
|
+
|
|
31340
|
+
function easeConstant(id, value) {
|
|
31341
|
+
if (typeof value !== "function") throw new Error;
|
|
31342
|
+
return function() {
|
|
31343
|
+
set(this, id).ease = value;
|
|
31344
|
+
};
|
|
31345
|
+
}
|
|
31346
|
+
|
|
31347
|
+
function transition_ease(value) {
|
|
31348
|
+
var id = this._id;
|
|
31349
|
+
|
|
31350
|
+
return arguments.length
|
|
31351
|
+
? this.each(easeConstant(id, value))
|
|
31352
|
+
: get(this.node(), id).ease;
|
|
31353
|
+
}
|
|
31354
|
+
|
|
31355
|
+
function easeVarying(id, value) {
|
|
31356
|
+
return function() {
|
|
31357
|
+
var v = value.apply(this, arguments);
|
|
31358
|
+
if (typeof v !== "function") throw new Error;
|
|
31359
|
+
set(this, id).ease = v;
|
|
31360
|
+
};
|
|
31361
|
+
}
|
|
31362
|
+
|
|
31363
|
+
function transition_easeVarying(value) {
|
|
31364
|
+
if (typeof value !== "function") throw new Error;
|
|
31365
|
+
return this.each(easeVarying(this._id, value));
|
|
31366
|
+
}
|
|
31367
|
+
|
|
31368
|
+
function transition_filter(match) {
|
|
31369
|
+
if (typeof match !== "function") match = matcher(match);
|
|
31370
|
+
|
|
31371
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
31372
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
31373
|
+
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
31374
|
+
subgroup.push(node);
|
|
31375
|
+
}
|
|
31376
|
+
}
|
|
31377
|
+
}
|
|
31378
|
+
|
|
31379
|
+
return new Transition(subgroups, this._parents, this._name, this._id);
|
|
31380
|
+
}
|
|
31381
|
+
|
|
31382
|
+
function transition_merge(transition) {
|
|
31383
|
+
if (transition._id !== this._id) throw new Error;
|
|
31384
|
+
|
|
31385
|
+
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) {
|
|
31386
|
+
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
31387
|
+
if (node = group0[i] || group1[i]) {
|
|
31388
|
+
merge[i] = node;
|
|
31389
|
+
}
|
|
31390
|
+
}
|
|
31391
|
+
}
|
|
31392
|
+
|
|
31393
|
+
for (; j < m0; ++j) {
|
|
31394
|
+
merges[j] = groups0[j];
|
|
31395
|
+
}
|
|
31396
|
+
|
|
31397
|
+
return new Transition(merges, this._parents, this._name, this._id);
|
|
31398
|
+
}
|
|
31399
|
+
|
|
31400
|
+
function start(name) {
|
|
31401
|
+
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
|
31402
|
+
var i = t.indexOf(".");
|
|
31403
|
+
if (i >= 0) t = t.slice(0, i);
|
|
31404
|
+
return !t || t === "start";
|
|
31405
|
+
});
|
|
31406
|
+
}
|
|
31407
|
+
|
|
31408
|
+
function onFunction(id, name, listener) {
|
|
31409
|
+
var on0, on1, sit = start(name) ? init : set;
|
|
31410
|
+
return function() {
|
|
31411
|
+
var schedule = sit(this, id),
|
|
31412
|
+
on = schedule.on;
|
|
31413
|
+
|
|
31414
|
+
// If this node shared a dispatch with the previous node,
|
|
31415
|
+
// just assign the updated shared dispatch and we’re done!
|
|
31416
|
+
// Otherwise, copy-on-write.
|
|
31417
|
+
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
|
31418
|
+
|
|
31419
|
+
schedule.on = on1;
|
|
31420
|
+
};
|
|
31421
|
+
}
|
|
31422
|
+
|
|
31423
|
+
function transition_on(name, listener) {
|
|
31424
|
+
var id = this._id;
|
|
31425
|
+
|
|
31426
|
+
return arguments.length < 2
|
|
31427
|
+
? get(this.node(), id).on.on(name)
|
|
31428
|
+
: this.each(onFunction(id, name, listener));
|
|
31429
|
+
}
|
|
31430
|
+
|
|
31431
|
+
function removeFunction(id) {
|
|
31432
|
+
return function() {
|
|
31433
|
+
var parent = this.parentNode;
|
|
31434
|
+
for (var i in this.__transition) if (+i !== id) return;
|
|
31435
|
+
if (parent) parent.removeChild(this);
|
|
31436
|
+
};
|
|
31437
|
+
}
|
|
31438
|
+
|
|
31439
|
+
function transition_remove() {
|
|
31440
|
+
return this.on("end.remove", removeFunction(this._id));
|
|
31441
|
+
}
|
|
31442
|
+
|
|
31443
|
+
function transition_select(select) {
|
|
31444
|
+
var name = this._name,
|
|
31445
|
+
id = this._id;
|
|
31446
|
+
|
|
31447
|
+
if (typeof select !== "function") select = selector(select);
|
|
31448
|
+
|
|
31449
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
31450
|
+
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
31451
|
+
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
31452
|
+
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
31453
|
+
subgroup[i] = subnode;
|
|
31454
|
+
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
|
31455
|
+
}
|
|
31456
|
+
}
|
|
31457
|
+
}
|
|
31458
|
+
|
|
31459
|
+
return new Transition(subgroups, this._parents, name, id);
|
|
31460
|
+
}
|
|
31461
|
+
|
|
31462
|
+
function transition_selectAll(select) {
|
|
31463
|
+
var name = this._name,
|
|
31464
|
+
id = this._id;
|
|
31465
|
+
|
|
31466
|
+
if (typeof select !== "function") select = selectorAll(select);
|
|
31467
|
+
|
|
31468
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
31469
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
31470
|
+
if (node = group[i]) {
|
|
31471
|
+
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
|
31472
|
+
if (child = children[k]) {
|
|
31473
|
+
schedule(child, name, id, k, children, inherit);
|
|
31474
|
+
}
|
|
31475
|
+
}
|
|
31476
|
+
subgroups.push(children);
|
|
31477
|
+
parents.push(node);
|
|
31478
|
+
}
|
|
31479
|
+
}
|
|
31480
|
+
}
|
|
31481
|
+
|
|
31482
|
+
return new Transition(subgroups, parents, name, id);
|
|
31483
|
+
}
|
|
31484
|
+
|
|
31485
|
+
var Selection = selection.prototype.constructor;
|
|
31486
|
+
|
|
31487
|
+
function transition_selection() {
|
|
31488
|
+
return new Selection(this._groups, this._parents);
|
|
31489
|
+
}
|
|
31490
|
+
|
|
31491
|
+
function styleNull(name, interpolate) {
|
|
31492
|
+
var string00,
|
|
31493
|
+
string10,
|
|
31494
|
+
interpolate0;
|
|
31495
|
+
return function() {
|
|
31496
|
+
var string0 = styleValue(this, name),
|
|
31497
|
+
string1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
31498
|
+
return string0 === string1 ? null
|
|
31499
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
31500
|
+
: interpolate0 = interpolate(string00 = string0, string10 = string1);
|
|
31501
|
+
};
|
|
31502
|
+
}
|
|
31503
|
+
|
|
31504
|
+
function styleRemove(name) {
|
|
31505
|
+
return function() {
|
|
31506
|
+
this.style.removeProperty(name);
|
|
31507
|
+
};
|
|
31508
|
+
}
|
|
31509
|
+
|
|
31510
|
+
function styleConstant(name, interpolate, value1) {
|
|
31511
|
+
var string00,
|
|
31512
|
+
string1 = value1 + "",
|
|
31513
|
+
interpolate0;
|
|
31514
|
+
return function() {
|
|
31515
|
+
var string0 = styleValue(this, name);
|
|
31516
|
+
return string0 === string1 ? null
|
|
31517
|
+
: string0 === string00 ? interpolate0
|
|
31518
|
+
: interpolate0 = interpolate(string00 = string0, value1);
|
|
31519
|
+
};
|
|
31520
|
+
}
|
|
31521
|
+
|
|
31522
|
+
function styleFunction(name, interpolate, value) {
|
|
31523
|
+
var string00,
|
|
31524
|
+
string10,
|
|
31525
|
+
interpolate0;
|
|
31526
|
+
return function() {
|
|
31527
|
+
var string0 = styleValue(this, name),
|
|
31528
|
+
value1 = value(this),
|
|
31529
|
+
string1 = value1 + "";
|
|
31530
|
+
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
31531
|
+
return string0 === string1 ? null
|
|
31532
|
+
: string0 === string00 && string1 === string10 ? interpolate0
|
|
31533
|
+
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
31534
|
+
};
|
|
31535
|
+
}
|
|
31536
|
+
|
|
31537
|
+
function styleMaybeRemove(id, name) {
|
|
31538
|
+
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
|
31539
|
+
return function() {
|
|
31540
|
+
var schedule = set(this, id),
|
|
31541
|
+
on = schedule.on,
|
|
31542
|
+
listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
|
|
31543
|
+
|
|
31544
|
+
// If this node shared a dispatch with the previous node,
|
|
31545
|
+
// just assign the updated shared dispatch and we’re done!
|
|
31546
|
+
// Otherwise, copy-on-write.
|
|
31547
|
+
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
|
31548
|
+
|
|
31549
|
+
schedule.on = on1;
|
|
31550
|
+
};
|
|
31551
|
+
}
|
|
31552
|
+
|
|
31553
|
+
function transition_style(name, value, priority) {
|
|
31554
|
+
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
|
|
31555
|
+
return value == null ? this
|
|
31556
|
+
.styleTween(name, styleNull(name, i))
|
|
31557
|
+
.on("end.style." + name, styleRemove(name))
|
|
31558
|
+
: typeof value === "function" ? this
|
|
31559
|
+
.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value)))
|
|
31560
|
+
.each(styleMaybeRemove(this._id, name))
|
|
31561
|
+
: this
|
|
31562
|
+
.styleTween(name, styleConstant(name, i, value), priority)
|
|
31563
|
+
.on("end.style." + name, null);
|
|
31564
|
+
}
|
|
31565
|
+
|
|
31566
|
+
function styleInterpolate(name, i, priority) {
|
|
31567
|
+
return function(t) {
|
|
31568
|
+
this.style.setProperty(name, i.call(this, t), priority);
|
|
31569
|
+
};
|
|
31570
|
+
}
|
|
31571
|
+
|
|
31572
|
+
function styleTween(name, value, priority) {
|
|
31573
|
+
var t, i0;
|
|
31574
|
+
function tween() {
|
|
31575
|
+
var i = value.apply(this, arguments);
|
|
31576
|
+
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
|
31577
|
+
return t;
|
|
31578
|
+
}
|
|
31579
|
+
tween._value = value;
|
|
31580
|
+
return tween;
|
|
31581
|
+
}
|
|
31582
|
+
|
|
31583
|
+
function transition_styleTween(name, value, priority) {
|
|
31584
|
+
var key = "style." + (name += "");
|
|
31585
|
+
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|
31586
|
+
if (value == null) return this.tween(key, null);
|
|
31587
|
+
if (typeof value !== "function") throw new Error;
|
|
31588
|
+
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|
31589
|
+
}
|
|
31590
|
+
|
|
31591
|
+
function textConstant(value) {
|
|
31592
|
+
return function() {
|
|
31593
|
+
this.textContent = value;
|
|
31594
|
+
};
|
|
31595
|
+
}
|
|
31596
|
+
|
|
31597
|
+
function textFunction(value) {
|
|
31598
|
+
return function() {
|
|
31599
|
+
var value1 = value(this);
|
|
31600
|
+
this.textContent = value1 == null ? "" : value1;
|
|
31601
|
+
};
|
|
31602
|
+
}
|
|
31603
|
+
|
|
31604
|
+
function transition_text(value) {
|
|
31605
|
+
return this.tween("text", typeof value === "function"
|
|
31606
|
+
? textFunction(tweenValue(this, "text", value))
|
|
31607
|
+
: textConstant(value == null ? "" : value + ""));
|
|
31608
|
+
}
|
|
31609
|
+
|
|
31610
|
+
function textInterpolate(i) {
|
|
31611
|
+
return function(t) {
|
|
31612
|
+
this.textContent = i.call(this, t);
|
|
31613
|
+
};
|
|
31614
|
+
}
|
|
31615
|
+
|
|
31616
|
+
function textTween(value) {
|
|
31617
|
+
var t0, i0;
|
|
31618
|
+
function tween() {
|
|
31619
|
+
var i = value.apply(this, arguments);
|
|
31620
|
+
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
|
31621
|
+
return t0;
|
|
31622
|
+
}
|
|
31623
|
+
tween._value = value;
|
|
31624
|
+
return tween;
|
|
31625
|
+
}
|
|
31626
|
+
|
|
31627
|
+
function transition_textTween(value) {
|
|
31628
|
+
var key = "text";
|
|
31629
|
+
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
|
|
31630
|
+
if (value == null) return this.tween(key, null);
|
|
31631
|
+
if (typeof value !== "function") throw new Error;
|
|
31632
|
+
return this.tween(key, textTween(value));
|
|
31633
|
+
}
|
|
31634
|
+
|
|
31635
|
+
function transition_transition() {
|
|
31636
|
+
var name = this._name,
|
|
31637
|
+
id0 = this._id,
|
|
31638
|
+
id1 = newId();
|
|
31639
|
+
|
|
31640
|
+
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
31641
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
31642
|
+
if (node = group[i]) {
|
|
31643
|
+
var inherit = get(node, id0);
|
|
31644
|
+
schedule(node, name, id1, i, group, {
|
|
31645
|
+
time: inherit.time + inherit.delay + inherit.duration,
|
|
31646
|
+
delay: 0,
|
|
31647
|
+
duration: inherit.duration,
|
|
31648
|
+
ease: inherit.ease
|
|
31649
|
+
});
|
|
31650
|
+
}
|
|
31651
|
+
}
|
|
31652
|
+
}
|
|
31653
|
+
|
|
31654
|
+
return new Transition(groups, this._parents, name, id1);
|
|
31655
|
+
}
|
|
31656
|
+
|
|
31657
|
+
function transition_end() {
|
|
31658
|
+
var on0, on1, that = this, id = that._id, size = that.size();
|
|
31659
|
+
return new Promise(function(resolve, reject) {
|
|
31660
|
+
var cancel = {value: reject},
|
|
31661
|
+
end = {value: function() { if (--size === 0) resolve(); }};
|
|
31662
|
+
|
|
31663
|
+
that.each(function() {
|
|
31664
|
+
var schedule = set(this, id),
|
|
31665
|
+
on = schedule.on;
|
|
31666
|
+
|
|
31667
|
+
// If this node shared a dispatch with the previous node,
|
|
31668
|
+
// just assign the updated shared dispatch and we’re done!
|
|
31669
|
+
// Otherwise, copy-on-write.
|
|
31670
|
+
if (on !== on0) {
|
|
31671
|
+
on1 = (on0 = on).copy();
|
|
31672
|
+
on1._.cancel.push(cancel);
|
|
31673
|
+
on1._.interrupt.push(cancel);
|
|
31674
|
+
on1._.end.push(end);
|
|
31675
|
+
}
|
|
31676
|
+
|
|
31677
|
+
schedule.on = on1;
|
|
31678
|
+
});
|
|
31679
|
+
|
|
31680
|
+
// The selection was empty, resolve end immediately
|
|
31681
|
+
if (size === 0) resolve();
|
|
31682
|
+
});
|
|
31683
|
+
}
|
|
31684
|
+
|
|
31685
|
+
var id = 0;
|
|
31686
|
+
|
|
31687
|
+
function Transition(groups, parents, name, id) {
|
|
31688
|
+
this._groups = groups;
|
|
31689
|
+
this._parents = parents;
|
|
31690
|
+
this._name = name;
|
|
31691
|
+
this._id = id;
|
|
31692
|
+
}
|
|
31693
|
+
|
|
31694
|
+
function newId() {
|
|
31695
|
+
return ++id;
|
|
31696
|
+
}
|
|
31697
|
+
|
|
31698
|
+
var selection_prototype = selection.prototype;
|
|
31699
|
+
|
|
31700
|
+
Transition.prototype = {
|
|
31701
|
+
constructor: Transition,
|
|
31702
|
+
select: transition_select,
|
|
31703
|
+
selectAll: transition_selectAll,
|
|
31704
|
+
selectChild: selection_prototype.selectChild,
|
|
31705
|
+
selectChildren: selection_prototype.selectChildren,
|
|
31706
|
+
filter: transition_filter,
|
|
31707
|
+
merge: transition_merge,
|
|
31708
|
+
selection: transition_selection,
|
|
31709
|
+
transition: transition_transition,
|
|
31710
|
+
call: selection_prototype.call,
|
|
31711
|
+
nodes: selection_prototype.nodes,
|
|
31712
|
+
node: selection_prototype.node,
|
|
31713
|
+
size: selection_prototype.size,
|
|
31714
|
+
empty: selection_prototype.empty,
|
|
31715
|
+
each: selection_prototype.each,
|
|
31716
|
+
on: transition_on,
|
|
31717
|
+
attr: transition_attr,
|
|
31718
|
+
attrTween: transition_attrTween,
|
|
31719
|
+
style: transition_style,
|
|
31720
|
+
styleTween: transition_styleTween,
|
|
31721
|
+
text: transition_text,
|
|
31722
|
+
textTween: transition_textTween,
|
|
31723
|
+
remove: transition_remove,
|
|
31724
|
+
tween: transition_tween,
|
|
31725
|
+
delay: transition_delay,
|
|
31726
|
+
duration: transition_duration,
|
|
31727
|
+
ease: transition_ease,
|
|
31728
|
+
easeVarying: transition_easeVarying,
|
|
31729
|
+
end: transition_end,
|
|
31730
|
+
[Symbol.iterator]: selection_prototype[Symbol.iterator]
|
|
31731
|
+
};
|
|
31732
|
+
|
|
31733
|
+
function cubicInOut(t) {
|
|
31734
|
+
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
|
31735
|
+
}
|
|
31736
|
+
|
|
31737
|
+
var defaultTiming = {
|
|
31738
|
+
time: null, // Set on use.
|
|
31739
|
+
delay: 0,
|
|
31740
|
+
duration: 250,
|
|
31741
|
+
ease: cubicInOut
|
|
31742
|
+
};
|
|
31743
|
+
|
|
31744
|
+
function inherit(node, id) {
|
|
31745
|
+
var timing;
|
|
31746
|
+
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
|
31747
|
+
if (!(node = node.parentNode)) {
|
|
31748
|
+
throw new Error(`transition ${id} not found`);
|
|
31749
|
+
}
|
|
31750
|
+
}
|
|
31751
|
+
return timing;
|
|
31752
|
+
}
|
|
31753
|
+
|
|
31754
|
+
function selection_transition(name) {
|
|
31755
|
+
var id,
|
|
31756
|
+
timing;
|
|
31757
|
+
|
|
31758
|
+
if (name instanceof Transition) {
|
|
31759
|
+
id = name._id, name = name._name;
|
|
31760
|
+
} else {
|
|
31761
|
+
id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
|
31762
|
+
}
|
|
31763
|
+
|
|
31764
|
+
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
31765
|
+
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
31766
|
+
if (node = group[i]) {
|
|
31767
|
+
schedule(node, name, id, i, group, timing || inherit(node, id));
|
|
31768
|
+
}
|
|
31769
|
+
}
|
|
31770
|
+
}
|
|
31771
|
+
|
|
31772
|
+
return new Transition(groups, this._parents, name, id);
|
|
31773
|
+
}
|
|
31774
|
+
|
|
31775
|
+
selection.prototype.interrupt = selection_interrupt;
|
|
31776
|
+
selection.prototype.transition = selection_transition;
|
|
31777
|
+
|
|
31778
|
+
var constant = x => () => x;
|
|
31779
|
+
|
|
31780
|
+
function ZoomEvent(type, {
|
|
31781
|
+
sourceEvent,
|
|
31782
|
+
target,
|
|
31783
|
+
transform,
|
|
31784
|
+
dispatch
|
|
31785
|
+
}) {
|
|
31786
|
+
Object.defineProperties(this, {
|
|
31787
|
+
type: {value: type, enumerable: true, configurable: true},
|
|
31788
|
+
sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},
|
|
31789
|
+
target: {value: target, enumerable: true, configurable: true},
|
|
31790
|
+
transform: {value: transform, enumerable: true, configurable: true},
|
|
31791
|
+
_: {value: dispatch}
|
|
31792
|
+
});
|
|
31793
|
+
}
|
|
31794
|
+
|
|
31795
|
+
function Transform(k, x, y) {
|
|
31796
|
+
this.k = k;
|
|
31797
|
+
this.x = x;
|
|
31798
|
+
this.y = y;
|
|
31799
|
+
}
|
|
31800
|
+
|
|
31801
|
+
Transform.prototype = {
|
|
31802
|
+
constructor: Transform,
|
|
31803
|
+
scale: function(k) {
|
|
31804
|
+
return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
|
31805
|
+
},
|
|
31806
|
+
translate: function(x, y) {
|
|
31807
|
+
return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
|
|
31808
|
+
},
|
|
31809
|
+
apply: function(point) {
|
|
31810
|
+
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
31811
|
+
},
|
|
31812
|
+
applyX: function(x) {
|
|
31813
|
+
return x * this.k + this.x;
|
|
31814
|
+
},
|
|
31815
|
+
applyY: function(y) {
|
|
31816
|
+
return y * this.k + this.y;
|
|
31817
|
+
},
|
|
31818
|
+
invert: function(location) {
|
|
31819
|
+
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
|
31820
|
+
},
|
|
31821
|
+
invertX: function(x) {
|
|
31822
|
+
return (x - this.x) / this.k;
|
|
31823
|
+
},
|
|
31824
|
+
invertY: function(y) {
|
|
31825
|
+
return (y - this.y) / this.k;
|
|
31826
|
+
},
|
|
31827
|
+
rescaleX: function(x) {
|
|
31828
|
+
return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
|
|
31829
|
+
},
|
|
31830
|
+
rescaleY: function(y) {
|
|
31831
|
+
return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
|
31832
|
+
},
|
|
31833
|
+
toString: function() {
|
|
31834
|
+
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
|
31835
|
+
}
|
|
31836
|
+
};
|
|
31837
|
+
|
|
31838
|
+
var identity = new Transform(1, 0, 0);
|
|
31839
|
+
|
|
31840
|
+
transform.prototype = Transform.prototype;
|
|
31841
|
+
|
|
31842
|
+
function transform(node) {
|
|
31843
|
+
while (!node.__zoom) if (!(node = node.parentNode)) return identity;
|
|
31844
|
+
return node.__zoom;
|
|
31845
|
+
}
|
|
31846
|
+
|
|
31847
|
+
function nopropagation(event) {
|
|
31848
|
+
event.stopImmediatePropagation();
|
|
31849
|
+
}
|
|
31850
|
+
|
|
31851
|
+
function noevent(event) {
|
|
31852
|
+
event.preventDefault();
|
|
31853
|
+
event.stopImmediatePropagation();
|
|
31854
|
+
}
|
|
31855
|
+
|
|
31856
|
+
// Ignore right-click, since that should open the context menu.
|
|
31857
|
+
// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event
|
|
31858
|
+
function defaultFilter(event) {
|
|
31859
|
+
return (!event.ctrlKey || event.type === 'wheel') && !event.button;
|
|
31860
|
+
}
|
|
31861
|
+
|
|
31862
|
+
function defaultExtent() {
|
|
31863
|
+
var e = this;
|
|
31864
|
+
if (e instanceof SVGElement) {
|
|
31865
|
+
e = e.ownerSVGElement || e;
|
|
31866
|
+
if (e.hasAttribute("viewBox")) {
|
|
31867
|
+
e = e.viewBox.baseVal;
|
|
31868
|
+
return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
|
|
31869
|
+
}
|
|
31870
|
+
return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
|
|
31871
|
+
}
|
|
31872
|
+
return [[0, 0], [e.clientWidth, e.clientHeight]];
|
|
31873
|
+
}
|
|
31874
|
+
|
|
31875
|
+
function defaultTransform() {
|
|
31876
|
+
return this.__zoom || identity;
|
|
31877
|
+
}
|
|
31878
|
+
|
|
31879
|
+
function defaultWheelDelta(event) {
|
|
31880
|
+
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);
|
|
31881
|
+
}
|
|
31882
|
+
|
|
31883
|
+
function defaultTouchable() {
|
|
31884
|
+
return navigator.maxTouchPoints || ("ontouchstart" in this);
|
|
31885
|
+
}
|
|
31886
|
+
|
|
31887
|
+
function defaultConstrain(transform, extent, translateExtent) {
|
|
31888
|
+
var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
|
|
31889
|
+
dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
|
|
31890
|
+
dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
|
|
31891
|
+
dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
|
|
31892
|
+
return transform.translate(
|
|
31893
|
+
dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
|
|
31894
|
+
dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
|
|
31895
|
+
);
|
|
31896
|
+
}
|
|
31897
|
+
|
|
31898
|
+
function zoom() {
|
|
31899
|
+
var filter = defaultFilter,
|
|
31900
|
+
extent = defaultExtent,
|
|
31901
|
+
constrain = defaultConstrain,
|
|
31902
|
+
wheelDelta = defaultWheelDelta,
|
|
31903
|
+
touchable = defaultTouchable,
|
|
31904
|
+
scaleExtent = [0, Infinity],
|
|
31905
|
+
translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
|
|
31906
|
+
duration = 250,
|
|
31907
|
+
interpolate = interpolateZoom,
|
|
31908
|
+
listeners = dispatch("start", "zoom", "end"),
|
|
31909
|
+
touchstarting,
|
|
31910
|
+
touchfirst,
|
|
31911
|
+
touchending,
|
|
31912
|
+
touchDelay = 500,
|
|
31913
|
+
wheelDelay = 150,
|
|
31914
|
+
clickDistance2 = 0,
|
|
31915
|
+
tapDistance = 10;
|
|
31916
|
+
|
|
31917
|
+
function zoom(selection) {
|
|
31918
|
+
selection
|
|
31919
|
+
.property("__zoom", defaultTransform)
|
|
31920
|
+
.on("wheel.zoom", wheeled, {passive: false})
|
|
31921
|
+
.on("mousedown.zoom", mousedowned)
|
|
31922
|
+
.on("dblclick.zoom", dblclicked)
|
|
31923
|
+
.filter(touchable)
|
|
31924
|
+
.on("touchstart.zoom", touchstarted)
|
|
31925
|
+
.on("touchmove.zoom", touchmoved)
|
|
31926
|
+
.on("touchend.zoom touchcancel.zoom", touchended)
|
|
31927
|
+
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
31928
|
+
}
|
|
31929
|
+
|
|
31930
|
+
zoom.transform = function(collection, transform, point, event) {
|
|
31931
|
+
var selection = collection.selection ? collection.selection() : collection;
|
|
31932
|
+
selection.property("__zoom", defaultTransform);
|
|
31933
|
+
if (collection !== selection) {
|
|
31934
|
+
schedule(collection, transform, point, event);
|
|
31935
|
+
} else {
|
|
31936
|
+
selection.interrupt().each(function() {
|
|
31937
|
+
gesture(this, arguments)
|
|
31938
|
+
.event(event)
|
|
31939
|
+
.start()
|
|
31940
|
+
.zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
|
|
31941
|
+
.end();
|
|
31942
|
+
});
|
|
31943
|
+
}
|
|
31944
|
+
};
|
|
31945
|
+
|
|
31946
|
+
zoom.scaleBy = function(selection, k, p, event) {
|
|
31947
|
+
zoom.scaleTo(selection, function() {
|
|
31948
|
+
var k0 = this.__zoom.k,
|
|
31949
|
+
k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
|
31950
|
+
return k0 * k1;
|
|
31951
|
+
}, p, event);
|
|
31952
|
+
};
|
|
31953
|
+
|
|
31954
|
+
zoom.scaleTo = function(selection, k, p, event) {
|
|
31955
|
+
zoom.transform(selection, function() {
|
|
31956
|
+
var e = extent.apply(this, arguments),
|
|
31957
|
+
t0 = this.__zoom,
|
|
31958
|
+
p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p,
|
|
31959
|
+
p1 = t0.invert(p0),
|
|
31960
|
+
k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
|
31961
|
+
return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
|
|
31962
|
+
}, p, event);
|
|
31963
|
+
};
|
|
31964
|
+
|
|
31965
|
+
zoom.translateBy = function(selection, x, y, event) {
|
|
31966
|
+
zoom.transform(selection, function() {
|
|
31967
|
+
return constrain(this.__zoom.translate(
|
|
31968
|
+
typeof x === "function" ? x.apply(this, arguments) : x,
|
|
31969
|
+
typeof y === "function" ? y.apply(this, arguments) : y
|
|
31970
|
+
), extent.apply(this, arguments), translateExtent);
|
|
31971
|
+
}, null, event);
|
|
31972
|
+
};
|
|
31973
|
+
|
|
31974
|
+
zoom.translateTo = function(selection, x, y, p, event) {
|
|
31975
|
+
zoom.transform(selection, function() {
|
|
31976
|
+
var e = extent.apply(this, arguments),
|
|
31977
|
+
t = this.__zoom,
|
|
31978
|
+
p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
|
|
31979
|
+
return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(
|
|
31980
|
+
typeof x === "function" ? -x.apply(this, arguments) : -x,
|
|
31981
|
+
typeof y === "function" ? -y.apply(this, arguments) : -y
|
|
31982
|
+
), e, translateExtent);
|
|
31983
|
+
}, p, event);
|
|
31984
|
+
};
|
|
31985
|
+
|
|
31986
|
+
function scale(transform, k) {
|
|
31987
|
+
k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
|
|
31988
|
+
return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
|
|
31989
|
+
}
|
|
31990
|
+
|
|
31991
|
+
function translate(transform, p0, p1) {
|
|
31992
|
+
var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
|
|
31993
|
+
return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
|
|
31994
|
+
}
|
|
31995
|
+
|
|
31996
|
+
function centroid(extent) {
|
|
31997
|
+
return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
|
|
31998
|
+
}
|
|
31999
|
+
|
|
32000
|
+
function schedule(transition, transform, point, event) {
|
|
32001
|
+
transition
|
|
32002
|
+
.on("start.zoom", function() { gesture(this, arguments).event(event).start(); })
|
|
32003
|
+
.on("interrupt.zoom end.zoom", function() { gesture(this, arguments).event(event).end(); })
|
|
32004
|
+
.tween("zoom", function() {
|
|
32005
|
+
var that = this,
|
|
32006
|
+
args = arguments,
|
|
32007
|
+
g = gesture(that, args).event(event),
|
|
32008
|
+
e = extent.apply(that, args),
|
|
32009
|
+
p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point,
|
|
32010
|
+
w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
|
|
32011
|
+
a = that.__zoom,
|
|
32012
|
+
b = typeof transform === "function" ? transform.apply(that, args) : transform,
|
|
32013
|
+
i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
|
|
32014
|
+
return function(t) {
|
|
32015
|
+
if (t === 1) t = b; // Avoid rounding error on end.
|
|
32016
|
+
else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }
|
|
32017
|
+
g.zoom(null, t);
|
|
32018
|
+
};
|
|
32019
|
+
});
|
|
32020
|
+
}
|
|
32021
|
+
|
|
32022
|
+
function gesture(that, args, clean) {
|
|
32023
|
+
return (!clean && that.__zooming) || new Gesture(that, args);
|
|
32024
|
+
}
|
|
32025
|
+
|
|
32026
|
+
function Gesture(that, args) {
|
|
32027
|
+
this.that = that;
|
|
32028
|
+
this.args = args;
|
|
32029
|
+
this.active = 0;
|
|
32030
|
+
this.sourceEvent = null;
|
|
32031
|
+
this.extent = extent.apply(that, args);
|
|
32032
|
+
this.taps = 0;
|
|
32033
|
+
}
|
|
32034
|
+
|
|
32035
|
+
Gesture.prototype = {
|
|
32036
|
+
event: function(event) {
|
|
32037
|
+
if (event) this.sourceEvent = event;
|
|
32038
|
+
return this;
|
|
32039
|
+
},
|
|
32040
|
+
start: function() {
|
|
32041
|
+
if (++this.active === 1) {
|
|
32042
|
+
this.that.__zooming = this;
|
|
32043
|
+
this.emit("start");
|
|
32044
|
+
}
|
|
32045
|
+
return this;
|
|
32046
|
+
},
|
|
32047
|
+
zoom: function(key, transform) {
|
|
32048
|
+
if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
|
|
32049
|
+
if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
|
|
32050
|
+
if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
|
|
32051
|
+
this.that.__zoom = transform;
|
|
32052
|
+
this.emit("zoom");
|
|
32053
|
+
return this;
|
|
32054
|
+
},
|
|
32055
|
+
end: function() {
|
|
32056
|
+
if (--this.active === 0) {
|
|
32057
|
+
delete this.that.__zooming;
|
|
32058
|
+
this.emit("end");
|
|
32059
|
+
}
|
|
32060
|
+
return this;
|
|
32061
|
+
},
|
|
32062
|
+
emit: function(type) {
|
|
32063
|
+
var d = select(this.that).datum();
|
|
32064
|
+
listeners.call(
|
|
32065
|
+
type,
|
|
32066
|
+
this.that,
|
|
32067
|
+
new ZoomEvent(type, {
|
|
32068
|
+
sourceEvent: this.sourceEvent,
|
|
32069
|
+
target: zoom,
|
|
32070
|
+
type,
|
|
32071
|
+
transform: this.that.__zoom,
|
|
32072
|
+
dispatch: listeners
|
|
32073
|
+
}),
|
|
32074
|
+
d
|
|
32075
|
+
);
|
|
32076
|
+
}
|
|
32077
|
+
};
|
|
32078
|
+
|
|
32079
|
+
function wheeled(event, ...args) {
|
|
32080
|
+
if (!filter.apply(this, arguments)) return;
|
|
32081
|
+
var g = gesture(this, args).event(event),
|
|
32082
|
+
t = this.__zoom,
|
|
32083
|
+
k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
|
|
32084
|
+
p = pointer(event);
|
|
32085
|
+
|
|
32086
|
+
// If the mouse is in the same location as before, reuse it.
|
|
32087
|
+
// If there were recent wheel events, reset the wheel idle timeout.
|
|
32088
|
+
if (g.wheel) {
|
|
32089
|
+
if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
|
|
32090
|
+
g.mouse[1] = t.invert(g.mouse[0] = p);
|
|
32091
|
+
}
|
|
32092
|
+
clearTimeout(g.wheel);
|
|
32093
|
+
}
|
|
32094
|
+
|
|
32095
|
+
// If this wheel event won’t trigger a transform change, ignore it.
|
|
32096
|
+
else if (t.k === k) return;
|
|
32097
|
+
|
|
32098
|
+
// Otherwise, capture the mouse point and location at the start.
|
|
32099
|
+
else {
|
|
32100
|
+
g.mouse = [p, t.invert(p)];
|
|
32101
|
+
interrupt(this);
|
|
32102
|
+
g.start();
|
|
32103
|
+
}
|
|
32104
|
+
|
|
32105
|
+
noevent(event);
|
|
32106
|
+
g.wheel = setTimeout(wheelidled, wheelDelay);
|
|
32107
|
+
g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
|
|
32108
|
+
|
|
32109
|
+
function wheelidled() {
|
|
32110
|
+
g.wheel = null;
|
|
32111
|
+
g.end();
|
|
32112
|
+
}
|
|
32113
|
+
}
|
|
32114
|
+
|
|
32115
|
+
function mousedowned(event, ...args) {
|
|
32116
|
+
if (touchending || !filter.apply(this, arguments)) return;
|
|
32117
|
+
var currentTarget = event.currentTarget,
|
|
32118
|
+
g = gesture(this, args, true).event(event),
|
|
32119
|
+
v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
|
|
32120
|
+
p = pointer(event, currentTarget),
|
|
32121
|
+
x0 = event.clientX,
|
|
32122
|
+
y0 = event.clientY;
|
|
32123
|
+
|
|
32124
|
+
dragDisable(event.view);
|
|
32125
|
+
nopropagation(event);
|
|
32126
|
+
g.mouse = [p, this.__zoom.invert(p)];
|
|
32127
|
+
interrupt(this);
|
|
32128
|
+
g.start();
|
|
32129
|
+
|
|
32130
|
+
function mousemoved(event) {
|
|
32131
|
+
noevent(event);
|
|
32132
|
+
if (!g.moved) {
|
|
32133
|
+
var dx = event.clientX - x0, dy = event.clientY - y0;
|
|
32134
|
+
g.moved = dx * dx + dy * dy > clickDistance2;
|
|
32135
|
+
}
|
|
32136
|
+
g.event(event)
|
|
32137
|
+
.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));
|
|
32138
|
+
}
|
|
32139
|
+
|
|
32140
|
+
function mouseupped(event) {
|
|
32141
|
+
v.on("mousemove.zoom mouseup.zoom", null);
|
|
32142
|
+
yesdrag(event.view, g.moved);
|
|
32143
|
+
noevent(event);
|
|
32144
|
+
g.event(event).end();
|
|
32145
|
+
}
|
|
32146
|
+
}
|
|
32147
|
+
|
|
32148
|
+
function dblclicked(event, ...args) {
|
|
32149
|
+
if (!filter.apply(this, arguments)) return;
|
|
32150
|
+
var t0 = this.__zoom,
|
|
32151
|
+
p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this),
|
|
32152
|
+
p1 = t0.invert(p0),
|
|
32153
|
+
k1 = t0.k * (event.shiftKey ? 0.5 : 2),
|
|
32154
|
+
t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);
|
|
32155
|
+
|
|
32156
|
+
noevent(event);
|
|
32157
|
+
if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0, event);
|
|
32158
|
+
else select(this).call(zoom.transform, t1, p0, event);
|
|
32159
|
+
}
|
|
32160
|
+
|
|
32161
|
+
function touchstarted(event, ...args) {
|
|
32162
|
+
if (!filter.apply(this, arguments)) return;
|
|
32163
|
+
var touches = event.touches,
|
|
32164
|
+
n = touches.length,
|
|
32165
|
+
g = gesture(this, args, event.changedTouches.length === n).event(event),
|
|
32166
|
+
started, i, t, p;
|
|
32167
|
+
|
|
32168
|
+
nopropagation(event);
|
|
32169
|
+
for (i = 0; i < n; ++i) {
|
|
32170
|
+
t = touches[i], p = pointer(t, this);
|
|
32171
|
+
p = [p, this.__zoom.invert(p), t.identifier];
|
|
32172
|
+
if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
|
|
32173
|
+
else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;
|
|
32174
|
+
}
|
|
32175
|
+
|
|
32176
|
+
if (touchstarting) touchstarting = clearTimeout(touchstarting);
|
|
32177
|
+
|
|
32178
|
+
if (started) {
|
|
32179
|
+
if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);
|
|
32180
|
+
interrupt(this);
|
|
32181
|
+
g.start();
|
|
32182
|
+
}
|
|
32183
|
+
}
|
|
32184
|
+
|
|
32185
|
+
function touchmoved(event, ...args) {
|
|
32186
|
+
if (!this.__zooming) return;
|
|
32187
|
+
var g = gesture(this, args).event(event),
|
|
32188
|
+
touches = event.changedTouches,
|
|
32189
|
+
n = touches.length, i, t, p, l;
|
|
32190
|
+
|
|
32191
|
+
noevent(event);
|
|
32192
|
+
for (i = 0; i < n; ++i) {
|
|
32193
|
+
t = touches[i], p = pointer(t, this);
|
|
32194
|
+
if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
|
|
32195
|
+
else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
|
|
32196
|
+
}
|
|
32197
|
+
t = g.that.__zoom;
|
|
32198
|
+
if (g.touch1) {
|
|
32199
|
+
var p0 = g.touch0[0], l0 = g.touch0[1],
|
|
32200
|
+
p1 = g.touch1[0], l1 = g.touch1[1],
|
|
32201
|
+
dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,
|
|
32202
|
+
dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
|
|
32203
|
+
t = scale(t, Math.sqrt(dp / dl));
|
|
32204
|
+
p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
|
|
32205
|
+
l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
|
|
32206
|
+
}
|
|
32207
|
+
else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
|
|
32208
|
+
else return;
|
|
32209
|
+
|
|
32210
|
+
g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
|
|
32211
|
+
}
|
|
32212
|
+
|
|
32213
|
+
function touchended(event, ...args) {
|
|
32214
|
+
if (!this.__zooming) return;
|
|
32215
|
+
var g = gesture(this, args).event(event),
|
|
32216
|
+
touches = event.changedTouches,
|
|
32217
|
+
n = touches.length, i, t;
|
|
32218
|
+
|
|
32219
|
+
nopropagation(event);
|
|
32220
|
+
if (touchending) clearTimeout(touchending);
|
|
32221
|
+
touchending = setTimeout(function() { touchending = null; }, touchDelay);
|
|
32222
|
+
for (i = 0; i < n; ++i) {
|
|
32223
|
+
t = touches[i];
|
|
32224
|
+
if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
|
|
32225
|
+
else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
|
|
32226
|
+
}
|
|
32227
|
+
if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;
|
|
32228
|
+
if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
|
|
32229
|
+
else {
|
|
32230
|
+
g.end();
|
|
32231
|
+
// If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
|
|
32232
|
+
if (g.taps === 2) {
|
|
32233
|
+
t = pointer(t, this);
|
|
32234
|
+
if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
|
|
32235
|
+
var p = select(this).on("dblclick.zoom");
|
|
32236
|
+
if (p) p.apply(this, arguments);
|
|
32237
|
+
}
|
|
32238
|
+
}
|
|
32239
|
+
}
|
|
32240
|
+
}
|
|
32241
|
+
|
|
32242
|
+
zoom.wheelDelta = function(_) {
|
|
32243
|
+
return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
|
|
32244
|
+
};
|
|
32245
|
+
|
|
32246
|
+
zoom.filter = function(_) {
|
|
32247
|
+
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
|
|
32248
|
+
};
|
|
32249
|
+
|
|
32250
|
+
zoom.touchable = function(_) {
|
|
32251
|
+
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
|
|
32252
|
+
};
|
|
32253
|
+
|
|
32254
|
+
zoom.extent = function(_) {
|
|
32255
|
+
return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
|
|
32256
|
+
};
|
|
32257
|
+
|
|
32258
|
+
zoom.scaleExtent = function(_) {
|
|
32259
|
+
return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
|
|
32260
|
+
};
|
|
32261
|
+
|
|
32262
|
+
zoom.translateExtent = function(_) {
|
|
32263
|
+
return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
|
|
32264
|
+
};
|
|
32265
|
+
|
|
32266
|
+
zoom.constrain = function(_) {
|
|
32267
|
+
return arguments.length ? (constrain = _, zoom) : constrain;
|
|
32268
|
+
};
|
|
32269
|
+
|
|
32270
|
+
zoom.duration = function(_) {
|
|
32271
|
+
return arguments.length ? (duration = +_, zoom) : duration;
|
|
32272
|
+
};
|
|
32273
|
+
|
|
32274
|
+
zoom.interpolate = function(_) {
|
|
32275
|
+
return arguments.length ? (interpolate = _, zoom) : interpolate;
|
|
32276
|
+
};
|
|
32277
|
+
|
|
32278
|
+
zoom.on = function() {
|
|
32279
|
+
var value = listeners.on.apply(listeners, arguments);
|
|
32280
|
+
return value === listeners ? zoom : value;
|
|
32281
|
+
};
|
|
32282
|
+
|
|
32283
|
+
zoom.clickDistance = function(_) {
|
|
32284
|
+
return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
|
|
32285
|
+
};
|
|
32286
|
+
|
|
32287
|
+
zoom.tapDistance = function(_) {
|
|
32288
|
+
return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
|
|
32289
|
+
};
|
|
32290
|
+
|
|
32291
|
+
return zoom;
|
|
32292
|
+
}
|
|
32293
|
+
|
|
32294
|
+
/**
|
|
32295
|
+
* ZoomHandler deals with user interactions and events like zooming
|
|
32296
|
+
*/
|
|
32297
|
+
class ZoomHandler {
|
|
32298
|
+
constructor(canvas, zoomContainer, dataManager, renderingModule, canvasLength) {
|
|
32299
|
+
this.canvas = canvas;
|
|
32300
|
+
this.zoomContainer = zoomContainer;
|
|
32301
|
+
this.dataManager = dataManager;
|
|
32302
|
+
this.renderingModule = renderingModule;
|
|
32303
|
+
this.canvasLength = canvasLength;
|
|
32304
|
+
this.zoomTransform = identity;
|
|
32305
|
+
this.minScale = 1.1;
|
|
32306
|
+
this.minExtentPoint = [-100, -100];
|
|
32307
|
+
this.extentPadding = 100;
|
|
32308
|
+
}
|
|
32309
|
+
attachZoomBehavior() {
|
|
32310
|
+
this.zoomBehavior = this.createZoomBehavior();
|
|
32311
|
+
this.zoomBehavior(select(this.canvas));
|
|
32312
|
+
}
|
|
32313
|
+
resetTransform() {
|
|
32314
|
+
const canvasContext = this.canvas.getContext('2d');
|
|
32315
|
+
if (canvasContext === null) {
|
|
32316
|
+
return;
|
|
32317
|
+
}
|
|
32318
|
+
this.zoomTransform = identity;
|
|
32319
|
+
this.clearCanvas(canvasContext, this.canvasLength, this.canvasLength);
|
|
32320
|
+
this.scaleCanvas(canvasContext, identity.x, identity.y, identity.k);
|
|
32321
|
+
this.renderingModule.drawWafer();
|
|
32322
|
+
this.zoomBehavior?.transform(select(this.canvas), identity);
|
|
32323
|
+
}
|
|
32324
|
+
createZoomBehavior() {
|
|
32325
|
+
const zoomBehavior = zoom()
|
|
32326
|
+
.scaleExtent([
|
|
32327
|
+
1.1,
|
|
32328
|
+
this.getZoomMax(this.canvasLength * this.canvasLength, this.dataManager.containerDimensions.width
|
|
32329
|
+
* this.dataManager.containerDimensions.height)
|
|
32330
|
+
])
|
|
32331
|
+
.translateExtent([
|
|
32332
|
+
this.minExtentPoint,
|
|
32333
|
+
[
|
|
32334
|
+
this.canvasLength + this.extentPadding,
|
|
32335
|
+
this.canvasLength + this.extentPadding
|
|
32336
|
+
]
|
|
32337
|
+
])
|
|
32338
|
+
.filter((event) => {
|
|
32339
|
+
const transform$1 = transform(this.canvas);
|
|
32340
|
+
return transform$1.k >= this.minScale || event.type === 'wheel';
|
|
32341
|
+
})
|
|
32342
|
+
.on('zoom', (event) => {
|
|
32343
|
+
const transform = event.transform;
|
|
32344
|
+
const canvasContext = this.canvas.getContext('2d');
|
|
32345
|
+
if (canvasContext === null) {
|
|
32346
|
+
return;
|
|
32347
|
+
}
|
|
32348
|
+
canvasContext.save();
|
|
32349
|
+
if (transform.k === this.minScale) {
|
|
32350
|
+
this.zoomTransform = identity;
|
|
32351
|
+
this.clearCanvas(canvasContext, this.canvasLength, this.canvasLength);
|
|
32352
|
+
this.scaleCanvas(canvasContext, identity.x, identity.y, identity.k);
|
|
32353
|
+
this.renderingModule.drawWafer();
|
|
32354
|
+
zoomBehavior.transform(select(this.canvas), identity);
|
|
32355
|
+
}
|
|
32356
|
+
else {
|
|
32357
|
+
this.zoomTransform = transform;
|
|
32358
|
+
this.clearCanvas(canvasContext, this.canvasLength * this.zoomTransform.k, this.canvasLength * this.zoomTransform.k);
|
|
32359
|
+
this.scaleCanvas(canvasContext, transform.x, transform.y, transform.k);
|
|
32360
|
+
this.renderingModule.drawWafer();
|
|
32361
|
+
}
|
|
32362
|
+
canvasContext.restore();
|
|
32363
|
+
this.zoomContainer.setAttribute('transform', this.zoomTransform.toString());
|
|
32364
|
+
});
|
|
32365
|
+
return zoomBehavior;
|
|
32366
|
+
}
|
|
32367
|
+
getZoomMax(canvasArea, dataArea) {
|
|
32368
|
+
return Math.ceil((dataArea / canvasArea) * 100);
|
|
32369
|
+
}
|
|
32370
|
+
clearCanvas(context, width, height) {
|
|
32371
|
+
context.clearRect(0, 0, width, height);
|
|
32372
|
+
}
|
|
32373
|
+
scaleCanvas(context, x = 0, y = 0, scale = 1) {
|
|
32374
|
+
context.translate(x, y);
|
|
32375
|
+
context.scale(scale, scale);
|
|
32376
|
+
}
|
|
32377
|
+
}
|
|
32378
|
+
|
|
32379
|
+
/**
|
|
32380
|
+
* A nimble-styled WaferMap
|
|
32381
|
+
*/
|
|
32382
|
+
class WaferMap extends FoundationElement {
|
|
32383
|
+
constructor() {
|
|
32384
|
+
super(...arguments);
|
|
32385
|
+
this.quadrant = WaferMapQuadrant.topLeft;
|
|
32386
|
+
this.orientation = WaferMapOrientation.top;
|
|
32387
|
+
this.maxCharacters = 4;
|
|
32388
|
+
this.dieLabelsHidden = false;
|
|
32389
|
+
this.dieLabelsSuffix = '';
|
|
32390
|
+
this.colorScaleMode = WaferMapColorScaleMode.linear;
|
|
32391
|
+
this.highlightedValues = [];
|
|
32392
|
+
this.dies = [];
|
|
32393
|
+
this.colorScale = {
|
|
32394
|
+
colors: [],
|
|
32395
|
+
values: []
|
|
32396
|
+
};
|
|
32397
|
+
this.renderQueued = false;
|
|
32398
|
+
}
|
|
32399
|
+
connectedCallback() {
|
|
32400
|
+
super.connectedCallback();
|
|
32401
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
32402
|
+
const entry = entries[0];
|
|
32403
|
+
if (entry === undefined) {
|
|
32404
|
+
return;
|
|
32405
|
+
}
|
|
32406
|
+
const { height, width } = entry.contentRect;
|
|
32407
|
+
this.canvasSideLength = Math.min(height, width);
|
|
32408
|
+
});
|
|
32409
|
+
this.resizeObserver.observe(this);
|
|
32410
|
+
this.canvas.addEventListener('wheel', event => event.preventDefault(), {
|
|
32411
|
+
passive: false
|
|
32412
|
+
});
|
|
32413
|
+
this.queueRender();
|
|
32414
|
+
}
|
|
32415
|
+
disconnectedCallback() {
|
|
32416
|
+
super.disconnectedCallback();
|
|
32417
|
+
this.canvas.removeEventListener('wheel', event => event.preventDefault());
|
|
32418
|
+
this.resizeObserver.unobserve(this);
|
|
32419
|
+
}
|
|
32420
|
+
/**
|
|
32421
|
+
* @internal
|
|
32422
|
+
*/
|
|
32423
|
+
render() {
|
|
32424
|
+
this.renderQueued = false;
|
|
32425
|
+
if (this.canvasSideLength === undefined
|
|
32426
|
+
|| this.canvasSideLength === 0) {
|
|
32427
|
+
return;
|
|
32428
|
+
}
|
|
32429
|
+
this.renderer?.clearCanvas(this.canvasSideLength, this.canvasSideLength);
|
|
32430
|
+
this.dataManager = new DataManager(this.dies, this.quadrant, { width: this.canvasSideLength, height: this.canvasSideLength }, this.colorScale, this.highlightedValues, this.colorScaleMode, this.dieLabelsHidden, this.dieLabelsSuffix, this.maxCharacters);
|
|
32431
|
+
this.renderer = new RenderingModule(this.dataManager, this.canvas);
|
|
32432
|
+
this.zoomHandler = new ZoomHandler(this.canvas, this.zoomContainer, this.dataManager, this.renderer, this.canvasSideLength);
|
|
32433
|
+
this.zoomHandler.attachZoomBehavior();
|
|
32434
|
+
this.renderer.drawWafer();
|
|
32435
|
+
}
|
|
32436
|
+
quadrantChanged() {
|
|
32437
|
+
this.queueRender();
|
|
32438
|
+
}
|
|
32439
|
+
orientationChanged() {
|
|
32440
|
+
this.queueRender();
|
|
32441
|
+
}
|
|
32442
|
+
maxCharactersChanged() {
|
|
32443
|
+
this.queueRender();
|
|
29499
32444
|
}
|
|
29500
32445
|
dieLabelsHiddenChanged() {
|
|
29501
32446
|
this.queueRender();
|
|
@@ -29521,6 +32466,7 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
29521
32466
|
this.canvas.width = this.canvasSideLength;
|
|
29522
32467
|
this.canvas.height = this.canvasSideLength;
|
|
29523
32468
|
}
|
|
32469
|
+
this.zoomHandler?.resetTransform();
|
|
29524
32470
|
this.queueRender();
|
|
29525
32471
|
}
|
|
29526
32472
|
queueRender() {
|
|
@@ -29560,13 +32506,10 @@ Instead styling against the role which is more general and likely a better appro
|
|
|
29560
32506
|
attr({
|
|
29561
32507
|
attribute: 'color-scale-mode'
|
|
29562
32508
|
})
|
|
29563
|
-
], WaferMap.prototype, "
|
|
32509
|
+
], WaferMap.prototype, "colorScaleMode", void 0);
|
|
29564
32510
|
__decorate$1([
|
|
29565
32511
|
observable
|
|
29566
32512
|
], WaferMap.prototype, "canvasSideLength", void 0);
|
|
29567
|
-
__decorate$1([
|
|
29568
|
-
observable
|
|
29569
|
-
], WaferMap.prototype, "colorScaleMode", void 0);
|
|
29570
32513
|
__decorate$1([
|
|
29571
32514
|
observable
|
|
29572
32515
|
], WaferMap.prototype, "highlightedValues", void 0);
|