@d3plus/core 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +374 -296
- package/es/src/charts/Geomap/emit.js +44 -4
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +30 -1
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Plot/index.js +77 -2
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +24 -3
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +3 -1
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/viz/Viz.js +63 -10
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +4 -1
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +4 -1
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +7 -3
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/shapes/Shape.js +12 -10
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/hitAreaNode.js +31 -5
- package/es/src/shapes/hitAreaNode.js.map +1 -1
- package/es/src/shapes/interactionPoints.js +30 -0
- package/es/src/shapes/interactionPoints.js.map +1 -0
- package/package.json +9 -9
- package/types/src/charts/Plot/index.d.ts +22 -1
- package/types/src/charts/Plot/pipeline.d.ts +2 -1
- package/types/src/charts/viz/Viz.d.ts +31 -1
- package/types/src/charts/viz/vizTypes.d.ts +18 -0
- package/types/src/shapes/Shape.d.ts +2 -2
- package/types/src/shapes/hitAreaNode.d.ts +5 -4
- package/types/src/shapes/interactionPoints.d.ts +15 -0
- package/umd/d3plus-core.full.js +954 -275
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +1285 -1099
- package/umd/d3plus-core.js +267 -39
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +266 -170
package/umd/d3plus-core.full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v4.
|
|
2
|
+
@d3plus/core v4.3.0
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -9142,13 +9142,69 @@
|
|
|
9142
9142
|
return left instanceof right;
|
|
9143
9143
|
}
|
|
9144
9144
|
}
|
|
9145
|
+
/** Common named HTML entities for the DOM-free decode fallback. */ var NAMED_ENTITIES = {
|
|
9146
|
+
amp: "&",
|
|
9147
|
+
lt: "<",
|
|
9148
|
+
gt: ">",
|
|
9149
|
+
quot: '"',
|
|
9150
|
+
apos: "'",
|
|
9151
|
+
nbsp: " ",
|
|
9152
|
+
ndash: "–",
|
|
9153
|
+
mdash: "—",
|
|
9154
|
+
hellip: "…",
|
|
9155
|
+
copy: "©",
|
|
9156
|
+
reg: "®",
|
|
9157
|
+
trade: "™",
|
|
9158
|
+
deg: "°",
|
|
9159
|
+
middot: "·",
|
|
9160
|
+
bull: "•",
|
|
9161
|
+
laquo: "«",
|
|
9162
|
+
raquo: "»",
|
|
9163
|
+
times: "×",
|
|
9164
|
+
divide: "÷",
|
|
9165
|
+
lsquo: "‘",
|
|
9166
|
+
rsquo: "’",
|
|
9167
|
+
ldquo: "“",
|
|
9168
|
+
rdquo: "”",
|
|
9169
|
+
euro: "€",
|
|
9170
|
+
pound: "£",
|
|
9171
|
+
cent: "¢",
|
|
9172
|
+
yen: "¥",
|
|
9173
|
+
sect: "§",
|
|
9174
|
+
para: "¶",
|
|
9175
|
+
plusmn: "±"
|
|
9176
|
+
};
|
|
9177
|
+
/**
|
|
9178
|
+
* Decodes HTML entities without a DOM, for headless/server-side rendering where
|
|
9179
|
+
* `DOMParser` may be absent. Handles numeric (` `/` `) and the common
|
|
9180
|
+
* named entities above; unknown or out-of-range entities are left as-is.
|
|
9181
|
+
* Exported for testing; not part of the package's public API.
|
|
9182
|
+
* @param {String} input tag-stripped text
|
|
9183
|
+
*/ function decodeEntities(input) {
|
|
9184
|
+
return input.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);/g, function(match, code) {
|
|
9185
|
+
if (code[0] === "#") {
|
|
9186
|
+
var cp = code[1] === "x" ? parseInt(code.slice(2), 16) : parseInt(code.slice(1), 10);
|
|
9187
|
+
// Reject code points outside the Unicode range — String.fromCodePoint
|
|
9188
|
+
// throws on them; leave the raw entity in place instead.
|
|
9189
|
+
return cp <= 0x10ffff ? String.fromCodePoint(cp) : match;
|
|
9190
|
+
}
|
|
9191
|
+
var named = NAMED_ENTITIES[code];
|
|
9192
|
+
return named !== undefined ? named : match;
|
|
9193
|
+
});
|
|
9194
|
+
}
|
|
9145
9195
|
/**
|
|
9146
|
-
* Strips HTML and "un-escapes" escape characters.
|
|
9196
|
+
* Strips HTML and "un-escapes" escape characters. Uses `DOMParser` when present
|
|
9197
|
+
* (browser / jsdom) for full entity coverage, falling back to a DOM-free decode
|
|
9198
|
+
* so text measurement works in any headless environment.
|
|
9147
9199
|
* @param {String} input
|
|
9148
9200
|
*/ function htmlDecode(input) {
|
|
9149
9201
|
if (input.replace(/\s+/g, "") === "") return input;
|
|
9150
|
-
var
|
|
9151
|
-
|
|
9202
|
+
var stripped = input.replace(/<[^>]+>/g, "");
|
|
9203
|
+
if (typeof DOMParser !== "undefined") {
|
|
9204
|
+
var doc = new DOMParser().parseFromString(stripped, "text/html");
|
|
9205
|
+
return doc.documentElement ? doc.documentElement.textContent : input;
|
|
9206
|
+
}
|
|
9207
|
+
return decodeEntities(stripped);
|
|
9152
9208
|
}
|
|
9153
9209
|
/**
|
|
9154
9210
|
* Builds a CSS font shorthand string from a style object.
|
|
@@ -9651,7 +9707,7 @@
|
|
|
9651
9707
|
return newObject;
|
|
9652
9708
|
}
|
|
9653
9709
|
|
|
9654
|
-
function _array_like_to_array$
|
|
9710
|
+
function _array_like_to_array$j(arr, len) {
|
|
9655
9711
|
if (len == null || len > arr.length) len = arr.length;
|
|
9656
9712
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9657
9713
|
return arr2;
|
|
@@ -9659,8 +9715,8 @@
|
|
|
9659
9715
|
function _array_with_holes$f(arr) {
|
|
9660
9716
|
if (Array.isArray(arr)) return arr;
|
|
9661
9717
|
}
|
|
9662
|
-
function _array_without_holes$
|
|
9663
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
9718
|
+
function _array_without_holes$9(arr) {
|
|
9719
|
+
if (Array.isArray(arr)) return _array_like_to_array$j(arr);
|
|
9664
9720
|
}
|
|
9665
9721
|
function _instanceof$4(left, right) {
|
|
9666
9722
|
"@swc/helpers - instanceof";
|
|
@@ -9670,7 +9726,7 @@
|
|
|
9670
9726
|
return left instanceof right;
|
|
9671
9727
|
}
|
|
9672
9728
|
}
|
|
9673
|
-
function _iterable_to_array$
|
|
9729
|
+
function _iterable_to_array$9(iter) {
|
|
9674
9730
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9675
9731
|
}
|
|
9676
9732
|
function _iterable_to_array_limit$f(arr, i) {
|
|
@@ -9700,22 +9756,22 @@
|
|
|
9700
9756
|
function _non_iterable_rest$f() {
|
|
9701
9757
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9702
9758
|
}
|
|
9703
|
-
function _non_iterable_spread$
|
|
9759
|
+
function _non_iterable_spread$9() {
|
|
9704
9760
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9705
9761
|
}
|
|
9706
9762
|
function _sliced_to_array$f(arr, i) {
|
|
9707
|
-
return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$
|
|
9763
|
+
return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$j(arr, i) || _non_iterable_rest$f();
|
|
9708
9764
|
}
|
|
9709
|
-
function _to_consumable_array$
|
|
9710
|
-
return _array_without_holes$
|
|
9765
|
+
function _to_consumable_array$9(arr) {
|
|
9766
|
+
return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$j(arr) || _non_iterable_spread$9();
|
|
9711
9767
|
}
|
|
9712
|
-
function _unsupported_iterable_to_array$
|
|
9768
|
+
function _unsupported_iterable_to_array$j(o, minLen) {
|
|
9713
9769
|
if (!o) return;
|
|
9714
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
9770
|
+
if (typeof o === "string") return _array_like_to_array$j(o, minLen);
|
|
9715
9771
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9716
9772
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9717
9773
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9718
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
9774
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$j(o, minLen);
|
|
9719
9775
|
}
|
|
9720
9776
|
/**
|
|
9721
9777
|
@summary Extends the base behavior of d3.nest to allow for multiple depth levels.
|
|
@@ -9734,7 +9790,7 @@
|
|
|
9734
9790
|
@param fns An array of key accessor functions, one per nesting level.
|
|
9735
9791
|
*/ function nestGroups(data, fns) {
|
|
9736
9792
|
if (!fns.length) return data;
|
|
9737
|
-
return _to_consumable_array$
|
|
9793
|
+
return _to_consumable_array$9(group(data, fns[0])).map(function(param) {
|
|
9738
9794
|
var _param = _sliced_to_array$f(param, 2), key = _param[0], values = _param[1];
|
|
9739
9795
|
return {
|
|
9740
9796
|
key: key,
|
|
@@ -20540,7 +20596,7 @@
|
|
|
20540
20596
|
}
|
|
20541
20597
|
};
|
|
20542
20598
|
|
|
20543
|
-
function _define_property$
|
|
20599
|
+
function _define_property$9(obj, key, value) {
|
|
20544
20600
|
if (key in obj) {
|
|
20545
20601
|
Object.defineProperty(obj, key, {
|
|
20546
20602
|
value: value,
|
|
@@ -20562,7 +20618,7 @@
|
|
|
20562
20618
|
});
|
|
20563
20619
|
if (locale.location && isoLanguage) {
|
|
20564
20620
|
var _obj;
|
|
20565
|
-
locales.push((_obj = {}, _define_property$
|
|
20621
|
+
locales.push((_obj = {}, _define_property$9(_obj, "name", locale.language), _define_property$9(_obj, "location", locale.location), _define_property$9(_obj, "tag", locale.tag), _define_property$9(_obj, "lcid", locale.id), _define_property$9(_obj, "iso639-2", isoCodes[isoLanguage]["iso639-2"]), _define_property$9(_obj, "iso639-1", isoCodes[isoLanguage]["iso639-1"]), _obj));
|
|
20566
20622
|
}
|
|
20567
20623
|
});
|
|
20568
20624
|
var defaultLocales = {
|
|
@@ -21894,7 +21950,7 @@
|
|
|
21894
21950
|
};
|
|
21895
21951
|
}
|
|
21896
21952
|
|
|
21897
|
-
function _array_like_to_array$
|
|
21953
|
+
function _array_like_to_array$i(arr, len) {
|
|
21898
21954
|
if (len == null || len > arr.length) len = arr.length;
|
|
21899
21955
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21900
21956
|
return arr2;
|
|
@@ -21902,7 +21958,7 @@
|
|
|
21902
21958
|
function _array_with_holes$e(arr) {
|
|
21903
21959
|
if (Array.isArray(arr)) return arr;
|
|
21904
21960
|
}
|
|
21905
|
-
function _define_property$
|
|
21961
|
+
function _define_property$8(obj, key, value) {
|
|
21906
21962
|
if (key in obj) {
|
|
21907
21963
|
Object.defineProperty(obj, key, {
|
|
21908
21964
|
value: value,
|
|
@@ -21952,7 +22008,7 @@
|
|
|
21952
22008
|
}));
|
|
21953
22009
|
}
|
|
21954
22010
|
ownKeys.forEach(function(key) {
|
|
21955
|
-
_define_property$
|
|
22011
|
+
_define_property$8(target, key, source[key]);
|
|
21956
22012
|
});
|
|
21957
22013
|
}
|
|
21958
22014
|
return target;
|
|
@@ -21977,15 +22033,15 @@
|
|
|
21977
22033
|
return target;
|
|
21978
22034
|
}
|
|
21979
22035
|
function _sliced_to_array$e(arr, i) {
|
|
21980
|
-
return _array_with_holes$e(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$
|
|
22036
|
+
return _array_with_holes$e(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$i(arr, i) || _non_iterable_rest$e();
|
|
21981
22037
|
}
|
|
21982
|
-
function _unsupported_iterable_to_array$
|
|
22038
|
+
function _unsupported_iterable_to_array$i(o, minLen) {
|
|
21983
22039
|
if (!o) return;
|
|
21984
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
22040
|
+
if (typeof o === "string") return _array_like_to_array$i(o, minLen);
|
|
21985
22041
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21986
22042
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21987
22043
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21988
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
22044
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$i(o, minLen);
|
|
21989
22045
|
}
|
|
21990
22046
|
/**
|
|
21991
22047
|
The default easing curve, identical to d3-transition's default (cubic in-out),
|
|
@@ -22259,7 +22315,7 @@
|
|
|
22259
22315
|
}
|
|
22260
22316
|
}
|
|
22261
22317
|
|
|
22262
|
-
function _array_like_to_array$
|
|
22318
|
+
function _array_like_to_array$h(arr, len) {
|
|
22263
22319
|
if (len == null || len > arr.length) len = arr.length;
|
|
22264
22320
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22265
22321
|
return arr2;
|
|
@@ -22267,10 +22323,10 @@
|
|
|
22267
22323
|
function _array_with_holes$d(arr) {
|
|
22268
22324
|
if (Array.isArray(arr)) return arr;
|
|
22269
22325
|
}
|
|
22270
|
-
function _array_without_holes$
|
|
22271
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
22326
|
+
function _array_without_holes$8(arr) {
|
|
22327
|
+
if (Array.isArray(arr)) return _array_like_to_array$h(arr);
|
|
22272
22328
|
}
|
|
22273
|
-
function _iterable_to_array$
|
|
22329
|
+
function _iterable_to_array$8(iter) {
|
|
22274
22330
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
22275
22331
|
}
|
|
22276
22332
|
function _iterable_to_array_limit$d(arr, i) {
|
|
@@ -22300,22 +22356,22 @@
|
|
|
22300
22356
|
function _non_iterable_rest$d() {
|
|
22301
22357
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22302
22358
|
}
|
|
22303
|
-
function _non_iterable_spread$
|
|
22359
|
+
function _non_iterable_spread$8() {
|
|
22304
22360
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22305
22361
|
}
|
|
22306
22362
|
function _sliced_to_array$d(arr, i) {
|
|
22307
|
-
return _array_with_holes$d(arr) || _iterable_to_array_limit$d(arr, i) || _unsupported_iterable_to_array$
|
|
22363
|
+
return _array_with_holes$d(arr) || _iterable_to_array_limit$d(arr, i) || _unsupported_iterable_to_array$h(arr, i) || _non_iterable_rest$d();
|
|
22308
22364
|
}
|
|
22309
|
-
function _to_consumable_array$
|
|
22310
|
-
return _array_without_holes$
|
|
22365
|
+
function _to_consumable_array$8(arr) {
|
|
22366
|
+
return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$h(arr) || _non_iterable_spread$8();
|
|
22311
22367
|
}
|
|
22312
|
-
function _unsupported_iterable_to_array$
|
|
22368
|
+
function _unsupported_iterable_to_array$h(o, minLen) {
|
|
22313
22369
|
if (!o) return;
|
|
22314
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
22370
|
+
if (typeof o === "string") return _array_like_to_array$h(o, minLen);
|
|
22315
22371
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22316
22372
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
22317
22373
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22318
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
22374
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$h(o, minLen);
|
|
22319
22375
|
}
|
|
22320
22376
|
/**
|
|
22321
22377
|
Motion-trail geometry shared by both backends. A trail is a tapering "cone"
|
|
@@ -22360,8 +22416,8 @@
|
|
|
22360
22416
|
}), ys = pts.map(function(p) {
|
|
22361
22417
|
return p[1];
|
|
22362
22418
|
});
|
|
22363
|
-
var minX = (_Math = Math).min.apply(_Math, _to_consumable_array$
|
|
22364
|
-
var minY = (_Math2 = Math).min.apply(_Math2, _to_consumable_array$
|
|
22419
|
+
var minX = (_Math = Math).min.apply(_Math, _to_consumable_array$8(xs)), maxX = (_Math1 = Math).max.apply(_Math1, _to_consumable_array$8(xs));
|
|
22420
|
+
var minY = (_Math2 = Math).min.apply(_Math2, _to_consumable_array$8(ys)), maxY = (_Math3 = Math).max.apply(_Math3, _to_consumable_array$8(ys));
|
|
22365
22421
|
return {
|
|
22366
22422
|
x: minX,
|
|
22367
22423
|
y: minY,
|
|
@@ -22491,7 +22547,7 @@
|
|
|
22491
22547
|
])
|
|
22492
22548
|
};
|
|
22493
22549
|
}
|
|
22494
|
-
return pathBox(convexHull(_to_consumable_array$
|
|
22550
|
+
return pathBox(convexHull(_to_consumable_array$8(rectCorners(A[0], A[1], aDims[0], aDims[1], rotate)).concat(_to_consumable_array$8(rectCorners(hx, hy, hDims[0], hDims[1], rotate)))));
|
|
22495
22551
|
}
|
|
22496
22552
|
/**
|
|
22497
22553
|
The trail's fill: a gradient (objectBoundingBox units) along the travel
|
|
@@ -22583,20 +22639,20 @@
|
|
|
22583
22639
|
};
|
|
22584
22640
|
}
|
|
22585
22641
|
|
|
22586
|
-
function _array_like_to_array$
|
|
22642
|
+
function _array_like_to_array$g(arr, len) {
|
|
22587
22643
|
if (len == null || len > arr.length) len = arr.length;
|
|
22588
22644
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22589
22645
|
return arr2;
|
|
22590
22646
|
}
|
|
22591
|
-
function _array_without_holes$
|
|
22592
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
22647
|
+
function _array_without_holes$7(arr) {
|
|
22648
|
+
if (Array.isArray(arr)) return _array_like_to_array$g(arr);
|
|
22593
22649
|
}
|
|
22594
|
-
function _class_call_check$
|
|
22650
|
+
function _class_call_check$5(instance, Constructor) {
|
|
22595
22651
|
if (!(instance instanceof Constructor)) {
|
|
22596
22652
|
throw new TypeError("Cannot call a class as a function");
|
|
22597
22653
|
}
|
|
22598
22654
|
}
|
|
22599
|
-
function _defineProperties$
|
|
22655
|
+
function _defineProperties$5(target, props) {
|
|
22600
22656
|
for(var i = 0; i < props.length; i++){
|
|
22601
22657
|
var descriptor = props[i];
|
|
22602
22658
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -22605,11 +22661,11 @@
|
|
|
22605
22661
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
22606
22662
|
}
|
|
22607
22663
|
}
|
|
22608
|
-
function _create_class$
|
|
22609
|
-
if (protoProps) _defineProperties$
|
|
22664
|
+
function _create_class$5(Constructor, protoProps, staticProps) {
|
|
22665
|
+
if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
|
|
22610
22666
|
return Constructor;
|
|
22611
22667
|
}
|
|
22612
|
-
function _define_property$
|
|
22668
|
+
function _define_property$7(obj, key, value) {
|
|
22613
22669
|
if (key in obj) {
|
|
22614
22670
|
Object.defineProperty(obj, key, {
|
|
22615
22671
|
value: value,
|
|
@@ -22622,10 +22678,10 @@
|
|
|
22622
22678
|
}
|
|
22623
22679
|
return obj;
|
|
22624
22680
|
}
|
|
22625
|
-
function _iterable_to_array$
|
|
22681
|
+
function _iterable_to_array$7(iter) {
|
|
22626
22682
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
22627
22683
|
}
|
|
22628
|
-
function _non_iterable_spread$
|
|
22684
|
+
function _non_iterable_spread$7() {
|
|
22629
22685
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22630
22686
|
}
|
|
22631
22687
|
function _object_spread$2(target) {
|
|
@@ -22638,7 +22694,7 @@
|
|
|
22638
22694
|
}));
|
|
22639
22695
|
}
|
|
22640
22696
|
ownKeys.forEach(function(key) {
|
|
22641
|
-
_define_property$
|
|
22697
|
+
_define_property$7(target, key, source[key]);
|
|
22642
22698
|
});
|
|
22643
22699
|
}
|
|
22644
22700
|
return target;
|
|
@@ -22662,23 +22718,23 @@
|
|
|
22662
22718
|
}
|
|
22663
22719
|
return target;
|
|
22664
22720
|
}
|
|
22665
|
-
function _to_consumable_array$
|
|
22666
|
-
return _array_without_holes$
|
|
22721
|
+
function _to_consumable_array$7(arr) {
|
|
22722
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$g(arr) || _non_iterable_spread$7();
|
|
22667
22723
|
}
|
|
22668
|
-
function _unsupported_iterable_to_array$
|
|
22724
|
+
function _unsupported_iterable_to_array$g(o, minLen) {
|
|
22669
22725
|
if (!o) return;
|
|
22670
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
22726
|
+
if (typeof o === "string") return _array_like_to_array$g(o, minLen);
|
|
22671
22727
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22672
22728
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
22673
22729
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22674
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
22730
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$g(o, minLen);
|
|
22675
22731
|
}
|
|
22676
22732
|
var TrailLog = /*#__PURE__*/ function() {
|
|
22677
22733
|
function TrailLog() {
|
|
22678
|
-
_class_call_check$
|
|
22679
|
-
_define_property$
|
|
22734
|
+
_class_call_check$5(this, TrailLog);
|
|
22735
|
+
_define_property$7(this, "map", new Map());
|
|
22680
22736
|
}
|
|
22681
|
-
_create_class$
|
|
22737
|
+
_create_class$5(TrailLog, [
|
|
22682
22738
|
{
|
|
22683
22739
|
/**
|
|
22684
22740
|
Fold a mark's current geometry into its history, keyed by the timeline value
|
|
@@ -22750,7 +22806,7 @@
|
|
|
22750
22806
|
// instead of retracting the whole jump and detaching.
|
|
22751
22807
|
var forwardInFlight = ((_e_animating1 = e.animating) === null || _e_animating1 === void 0 ? void 0 : _e_animating1.dir) === 1 ? e.animating.seg : null;
|
|
22752
22808
|
e.animating = null;
|
|
22753
|
-
var all = forwardInFlight ? _to_consumable_array$
|
|
22809
|
+
var all = forwardInFlight ? _to_consumable_array$7(e.committed).concat([
|
|
22754
22810
|
forwardInFlight
|
|
22755
22811
|
]) : e.committed;
|
|
22756
22812
|
e.committed = [];
|
|
@@ -25100,7 +25156,7 @@
|
|
|
25100
25156
|
}))) !== null && _gen !== void 0 ? _gen : "";
|
|
25101
25157
|
}
|
|
25102
25158
|
|
|
25103
|
-
function _array_like_to_array$
|
|
25159
|
+
function _array_like_to_array$f(arr, len) {
|
|
25104
25160
|
if (len == null || len > arr.length) len = arr.length;
|
|
25105
25161
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
25106
25162
|
return arr2;
|
|
@@ -25136,15 +25192,15 @@
|
|
|
25136
25192
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25137
25193
|
}
|
|
25138
25194
|
function _sliced_to_array$c(arr, i) {
|
|
25139
|
-
return _array_with_holes$c(arr) || _iterable_to_array_limit$c(arr, i) || _unsupported_iterable_to_array$
|
|
25195
|
+
return _array_with_holes$c(arr) || _iterable_to_array_limit$c(arr, i) || _unsupported_iterable_to_array$f(arr, i) || _non_iterable_rest$c();
|
|
25140
25196
|
}
|
|
25141
|
-
function _unsupported_iterable_to_array$
|
|
25197
|
+
function _unsupported_iterable_to_array$f(o, minLen) {
|
|
25142
25198
|
if (!o) return;
|
|
25143
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
25199
|
+
if (typeof o === "string") return _array_like_to_array$f(o, minLen);
|
|
25144
25200
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
25145
25201
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
25146
25202
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
25147
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
25203
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
|
|
25148
25204
|
}
|
|
25149
25205
|
var SVG_NS$1 = "http://www.w3.org/2000/svg";
|
|
25150
25206
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
@@ -25352,12 +25408,12 @@
|
|
|
25352
25408
|
target.attr("transform", transformStr(node));
|
|
25353
25409
|
}
|
|
25354
25410
|
|
|
25355
|
-
function _class_call_check$
|
|
25411
|
+
function _class_call_check$4(instance, Constructor) {
|
|
25356
25412
|
if (!(instance instanceof Constructor)) {
|
|
25357
25413
|
throw new TypeError("Cannot call a class as a function");
|
|
25358
25414
|
}
|
|
25359
25415
|
}
|
|
25360
|
-
function _defineProperties$
|
|
25416
|
+
function _defineProperties$4(target, props) {
|
|
25361
25417
|
for(var i = 0; i < props.length; i++){
|
|
25362
25418
|
var descriptor = props[i];
|
|
25363
25419
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -25366,11 +25422,11 @@
|
|
|
25366
25422
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25367
25423
|
}
|
|
25368
25424
|
}
|
|
25369
|
-
function _create_class$
|
|
25370
|
-
if (protoProps) _defineProperties$
|
|
25425
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
25426
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
25371
25427
|
return Constructor;
|
|
25372
25428
|
}
|
|
25373
|
-
function _define_property$
|
|
25429
|
+
function _define_property$6(obj, key, value) {
|
|
25374
25430
|
if (key in obj) {
|
|
25375
25431
|
Object.defineProperty(obj, key, {
|
|
25376
25432
|
value: value,
|
|
@@ -25493,17 +25549,17 @@
|
|
|
25493
25549
|
renderer's (possibly not-yet-mounted) state.
|
|
25494
25550
|
*/ var TrailGradients = /*#__PURE__*/ function() {
|
|
25495
25551
|
function TrailGradients(defs, uid) {
|
|
25496
|
-
_class_call_check$
|
|
25497
|
-
_define_property$
|
|
25498
|
-
_define_property$
|
|
25499
|
-
_define_property$
|
|
25500
|
-
_define_property$
|
|
25552
|
+
_class_call_check$4(this, TrailGradients);
|
|
25553
|
+
_define_property$6(this, "defs", void 0);
|
|
25554
|
+
_define_property$6(this, "uid", void 0);
|
|
25555
|
+
_define_property$6(this, "map", void 0);
|
|
25556
|
+
_define_property$6(this, "seq", void 0);
|
|
25501
25557
|
this.defs = defs;
|
|
25502
25558
|
this.uid = uid;
|
|
25503
25559
|
this.map = new Map();
|
|
25504
25560
|
this.seq = 0;
|
|
25505
25561
|
}
|
|
25506
|
-
_create_class$
|
|
25562
|
+
_create_class$4(TrailGradients, [
|
|
25507
25563
|
{
|
|
25508
25564
|
/** Create/update this mark's gradient from a `gradient:<json>` token; returns its url. */ key: "apply",
|
|
25509
25565
|
value: function apply(key, fill) {
|
|
@@ -25867,7 +25923,7 @@
|
|
|
25867
25923
|
}
|
|
25868
25924
|
}
|
|
25869
25925
|
|
|
25870
|
-
function _array_like_to_array$
|
|
25926
|
+
function _array_like_to_array$e(arr, len) {
|
|
25871
25927
|
if (len == null || len > arr.length) len = arr.length;
|
|
25872
25928
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
25873
25929
|
return arr2;
|
|
@@ -25875,15 +25931,15 @@
|
|
|
25875
25931
|
function _array_with_holes$b(arr) {
|
|
25876
25932
|
if (Array.isArray(arr)) return arr;
|
|
25877
25933
|
}
|
|
25878
|
-
function _array_without_holes$
|
|
25879
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
25934
|
+
function _array_without_holes$6(arr) {
|
|
25935
|
+
if (Array.isArray(arr)) return _array_like_to_array$e(arr);
|
|
25880
25936
|
}
|
|
25881
|
-
function _class_call_check$
|
|
25937
|
+
function _class_call_check$3(instance, Constructor) {
|
|
25882
25938
|
if (!(instance instanceof Constructor)) {
|
|
25883
25939
|
throw new TypeError("Cannot call a class as a function");
|
|
25884
25940
|
}
|
|
25885
25941
|
}
|
|
25886
|
-
function _defineProperties$
|
|
25942
|
+
function _defineProperties$3(target, props) {
|
|
25887
25943
|
for(var i = 0; i < props.length; i++){
|
|
25888
25944
|
var descriptor = props[i];
|
|
25889
25945
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -25892,11 +25948,11 @@
|
|
|
25892
25948
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25893
25949
|
}
|
|
25894
25950
|
}
|
|
25895
|
-
function _create_class$
|
|
25896
|
-
if (protoProps) _defineProperties$
|
|
25951
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
25952
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
25897
25953
|
return Constructor;
|
|
25898
25954
|
}
|
|
25899
|
-
function _define_property$
|
|
25955
|
+
function _define_property$5(obj, key, value) {
|
|
25900
25956
|
if (key in obj) {
|
|
25901
25957
|
Object.defineProperty(obj, key, {
|
|
25902
25958
|
value: value,
|
|
@@ -25909,7 +25965,7 @@
|
|
|
25909
25965
|
}
|
|
25910
25966
|
return obj;
|
|
25911
25967
|
}
|
|
25912
|
-
function _iterable_to_array$
|
|
25968
|
+
function _iterable_to_array$6(iter) {
|
|
25913
25969
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
25914
25970
|
}
|
|
25915
25971
|
function _iterable_to_array_limit$b(arr, i) {
|
|
@@ -25939,22 +25995,22 @@
|
|
|
25939
25995
|
function _non_iterable_rest$b() {
|
|
25940
25996
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25941
25997
|
}
|
|
25942
|
-
function _non_iterable_spread$
|
|
25998
|
+
function _non_iterable_spread$6() {
|
|
25943
25999
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25944
26000
|
}
|
|
25945
26001
|
function _sliced_to_array$b(arr, i) {
|
|
25946
|
-
return _array_with_holes$b(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$
|
|
26002
|
+
return _array_with_holes$b(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$e(arr, i) || _non_iterable_rest$b();
|
|
25947
26003
|
}
|
|
25948
|
-
function _to_consumable_array$
|
|
25949
|
-
return _array_without_holes$
|
|
26004
|
+
function _to_consumable_array$6(arr) {
|
|
26005
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$6();
|
|
25950
26006
|
}
|
|
25951
|
-
function _unsupported_iterable_to_array$
|
|
26007
|
+
function _unsupported_iterable_to_array$e(o, minLen) {
|
|
25952
26008
|
if (!o) return;
|
|
25953
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
26009
|
+
if (typeof o === "string") return _array_like_to_array$e(o, minLen);
|
|
25954
26010
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
25955
26011
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
25956
26012
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
25957
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
26013
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
25958
26014
|
}
|
|
25959
26015
|
/**
|
|
25960
26016
|
A Renderer backend that realizes a Scene as SVG, using a keyed enter/update/exit
|
|
@@ -25972,45 +26028,49 @@
|
|
|
25972
26028
|
var SvgRenderer = /*#__PURE__*/ function() {
|
|
25973
26029
|
function SvgRenderer() {
|
|
25974
26030
|
var _this = this;
|
|
25975
|
-
_class_call_check$
|
|
25976
|
-
_define_property$
|
|
25977
|
-
/** Unique per-instance prefix for this renderer's document-scoped def ids. */ _define_property$
|
|
25978
|
-
_define_property$
|
|
25979
|
-
_define_property$
|
|
25980
|
-
_define_property$
|
|
25981
|
-
/** Per-mark position history for persistent motion trails. */ _define_property$
|
|
25982
|
-
/** Whether persistent trails are active this draw (single-period timeline). */ _define_property$
|
|
25983
|
-
/** Lazy <defs> for clipPaths / patterns. Created on first use. */ _define_property$
|
|
25984
|
-
/** Stable id counter so each GroupNode clip gets a unique <clipPath>. */ _define_property$
|
|
25985
|
-
_define_property$
|
|
25986
|
-
/** Sibling host for HtmlOverlayNode mounts. Positioned absolutely over the svg. */ _define_property$
|
|
25987
|
-
_define_property$
|
|
25988
|
-
_define_property$
|
|
25989
|
-
_define_property$
|
|
25990
|
-
/** Cache of `gradient:<json>` token → `url(#id)`, materialized in <defs>. */ _define_property$
|
|
25991
|
-
_define_property$
|
|
25992
|
-
/** Reused per-mark userSpaceOnUse gradients for persistent trails. */ _define_property$
|
|
26031
|
+
_class_call_check$3(this, SvgRenderer);
|
|
26032
|
+
_define_property$5(this, "kind", "svg");
|
|
26033
|
+
/** Unique per-instance prefix for this renderer's document-scoped def ids. */ _define_property$5(this, "_uid", ++rendererInstanceSeq);
|
|
26034
|
+
_define_property$5(this, "_target", void 0);
|
|
26035
|
+
_define_property$5(this, "_svg", void 0);
|
|
26036
|
+
_define_property$5(this, "_root", void 0);
|
|
26037
|
+
/** Per-mark position history for persistent motion trails. */ _define_property$5(this, "_trailLog", new TrailLog());
|
|
26038
|
+
/** Whether persistent trails are active this draw (single-period timeline). */ _define_property$5(this, "_trailActive", false);
|
|
26039
|
+
/** Lazy <defs> for clipPaths / patterns. Created on first use. */ _define_property$5(this, "_defs", void 0);
|
|
26040
|
+
/** Stable id counter so each GroupNode clip gets a unique <clipPath>. */ _define_property$5(this, "_clipIds", new Map());
|
|
26041
|
+
_define_property$5(this, "_clipSeq", 0);
|
|
26042
|
+
/** Sibling host for HtmlOverlayNode mounts. Positioned absolutely over the svg. */ _define_property$5(this, "_overlayHost", void 0);
|
|
26043
|
+
_define_property$5(this, "_scene", void 0);
|
|
26044
|
+
_define_property$5(this, "_index", new Map());
|
|
26045
|
+
_define_property$5(this, "_textureDefs", new Map());
|
|
26046
|
+
/** Cache of `gradient:<json>` token → `url(#id)`, materialized in <defs>. */ _define_property$5(this, "_gradientDefs", new Map());
|
|
26047
|
+
_define_property$5(this, "_gradientSeq", 0);
|
|
26048
|
+
/** Reused per-mark userSpaceOnUse gradients for persistent trails. */ _define_property$5(this, "_trailGrads", new TrailGradients(function() {
|
|
25993
26049
|
return _this._ensureDefs();
|
|
25994
26050
|
}, function() {
|
|
25995
26051
|
return _this._uid;
|
|
25996
26052
|
}));
|
|
25997
|
-
_define_property$
|
|
25998
|
-
_define_property$
|
|
25999
|
-
_define_property$
|
|
26000
|
-
_define_property$
|
|
26001
|
-
_define_property$
|
|
26002
|
-
_define_property$
|
|
26003
|
-
_define_property$
|
|
26004
|
-
/** Cancel handle for the latest drawScene transition; flipped on overlap. */ _define_property$
|
|
26005
|
-
/** Marks `_index` as needing a rebuild before the next external read. */ _define_property$
|
|
26006
|
-
}
|
|
26007
|
-
_create_class$
|
|
26053
|
+
_define_property$5(this, "_handlers", new Set());
|
|
26054
|
+
_define_property$5(this, "_domListeners", {});
|
|
26055
|
+
_define_property$5(this, "_listening", false);
|
|
26056
|
+
_define_property$5(this, "_hoverKey", null);
|
|
26057
|
+
_define_property$5(this, "_timers", new Set());
|
|
26058
|
+
_define_property$5(this, "_invalidatePointerRect", null);
|
|
26059
|
+
_define_property$5(this, "_removePointerRectListeners", null);
|
|
26060
|
+
/** Cancel handle for the latest drawScene transition; flipped on overlap. */ _define_property$5(this, "_cancelDraw", null);
|
|
26061
|
+
/** Marks `_index` as needing a rebuild before the next external read. */ _define_property$5(this, "_indexDirty", true);
|
|
26062
|
+
}
|
|
26063
|
+
_create_class$3(SvgRenderer, [
|
|
26008
26064
|
{
|
|
26009
26065
|
key: "mount",
|
|
26010
26066
|
value: function mount(target) {
|
|
26011
26067
|
this._target = target;
|
|
26012
26068
|
var svg = document.createElementNS(SVG_NS$1, "svg");
|
|
26013
26069
|
svg.setAttribute("class", "d3plus-render-svg");
|
|
26070
|
+
// Explicit namespace so the serialized output (toSVGString → outerHTML) is a
|
|
26071
|
+
// valid standalone SVG. Browsers infer it from the DOM namespace, but the
|
|
26072
|
+
// HTML serializer doesn't always emit it; a redundant attribute is harmless.
|
|
26073
|
+
svg.setAttribute("xmlns", SVG_NS$1);
|
|
26014
26074
|
svg.style.display = "block";
|
|
26015
26075
|
// Transparent background — without this, default UA stylesheet may
|
|
26016
26076
|
// give the svg a white background, which briefly bleeds through
|
|
@@ -26195,7 +26255,7 @@
|
|
|
26195
26255
|
if (k in t) {
|
|
26196
26256
|
var _t;
|
|
26197
26257
|
var v = config[k];
|
|
26198
|
-
if (Array.isArray(v)) (_t = t)[k].apply(_t, _to_consumable_array$
|
|
26258
|
+
if (Array.isArray(v)) (_t = t)[k].apply(_t, _to_consumable_array$6(v));
|
|
26199
26259
|
else t[k](v);
|
|
26200
26260
|
}
|
|
26201
26261
|
}
|
|
@@ -26233,7 +26293,7 @@
|
|
|
26233
26293
|
break;
|
|
26234
26294
|
}
|
|
26235
26295
|
}
|
|
26236
|
-
var ordered = needsSort ? _to_consumable_array$
|
|
26296
|
+
var ordered = needsSort ? _to_consumable_array$6(svgChildren).sort(function(a, b) {
|
|
26237
26297
|
var _a_z, _b_z;
|
|
26238
26298
|
return ((_a_z = a.z) !== null && _a_z !== void 0 ? _a_z : 0) - ((_b_z = b.z) !== null && _b_z !== void 0 ? _b_z : 0);
|
|
26239
26299
|
}) : svgChildren;
|
|
@@ -26698,7 +26758,7 @@
|
|
|
26698
26758
|
return SvgRenderer;
|
|
26699
26759
|
}();
|
|
26700
26760
|
|
|
26701
|
-
function _array_like_to_array$
|
|
26761
|
+
function _array_like_to_array$d(arr, len) {
|
|
26702
26762
|
if (len == null || len > arr.length) len = arr.length;
|
|
26703
26763
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
26704
26764
|
return arr2;
|
|
@@ -26706,7 +26766,7 @@
|
|
|
26706
26766
|
function _array_with_holes$a(arr) {
|
|
26707
26767
|
if (Array.isArray(arr)) return arr;
|
|
26708
26768
|
}
|
|
26709
|
-
function _define_property$
|
|
26769
|
+
function _define_property$4(obj, key, value) {
|
|
26710
26770
|
if (key in obj) {
|
|
26711
26771
|
Object.defineProperty(obj, key, {
|
|
26712
26772
|
value: value,
|
|
@@ -26756,7 +26816,7 @@
|
|
|
26756
26816
|
}));
|
|
26757
26817
|
}
|
|
26758
26818
|
ownKeys.forEach(function(key) {
|
|
26759
|
-
_define_property$
|
|
26819
|
+
_define_property$4(target, key, source[key]);
|
|
26760
26820
|
});
|
|
26761
26821
|
}
|
|
26762
26822
|
return target;
|
|
@@ -26781,15 +26841,15 @@
|
|
|
26781
26841
|
return target;
|
|
26782
26842
|
}
|
|
26783
26843
|
function _sliced_to_array$a(arr, i) {
|
|
26784
|
-
return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$
|
|
26844
|
+
return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$a();
|
|
26785
26845
|
}
|
|
26786
|
-
function _unsupported_iterable_to_array$
|
|
26846
|
+
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
26787
26847
|
if (!o) return;
|
|
26788
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
26848
|
+
if (typeof o === "string") return _array_like_to_array$d(o, minLen);
|
|
26789
26849
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
26790
26850
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
26791
26851
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
26792
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
26852
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
|
|
26793
26853
|
}
|
|
26794
26854
|
/**
|
|
26795
26855
|
Reads a motion-trail spec off a moving update-pair of trailed mark nodes,
|
|
@@ -27046,7 +27106,7 @@
|
|
|
27046
27106
|
};
|
|
27047
27107
|
}
|
|
27048
27108
|
|
|
27049
|
-
function _array_like_to_array$
|
|
27109
|
+
function _array_like_to_array$c(arr, len) {
|
|
27050
27110
|
if (len == null || len > arr.length) len = arr.length;
|
|
27051
27111
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
27052
27112
|
return arr2;
|
|
@@ -27082,15 +27142,15 @@
|
|
|
27082
27142
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27083
27143
|
}
|
|
27084
27144
|
function _sliced_to_array$9(arr, i) {
|
|
27085
|
-
return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$
|
|
27145
|
+
return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$9();
|
|
27086
27146
|
}
|
|
27087
|
-
function _unsupported_iterable_to_array$
|
|
27147
|
+
function _unsupported_iterable_to_array$c(o, minLen) {
|
|
27088
27148
|
if (!o) return;
|
|
27089
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
27149
|
+
if (typeof o === "string") return _array_like_to_array$c(o, minLen);
|
|
27090
27150
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
27091
27151
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
27092
27152
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
27093
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
27153
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
|
|
27094
27154
|
}
|
|
27095
27155
|
var identity$7 = [
|
|
27096
27156
|
1,
|
|
@@ -27188,7 +27248,21 @@
|
|
|
27188
27248
|
return m;
|
|
27189
27249
|
}
|
|
27190
27250
|
|
|
27191
|
-
/** Issues the current-path commands for a node's geometry into the context. */
|
|
27251
|
+
/** Issues the current-path commands for a node's geometry into the context. */ /**
|
|
27252
|
+
Hit-tests a `path` node: its fill region first, then — for a stroked/unfilled
|
|
27253
|
+
path (a Line, or its fat transparent hit area) — the stroke at the node's
|
|
27254
|
+
width. Assumes an identity CTM (as at pick time), so `lineWidth` shares the
|
|
27255
|
+
path's local units.
|
|
27256
|
+
*/ function pathHit(ctx, node, lx, ly) {
|
|
27257
|
+
var _node_paint;
|
|
27258
|
+
var p = new Path2D(node.d);
|
|
27259
|
+
if (ctx.isPointInPath(p, lx, ly)) return true;
|
|
27260
|
+
var sw = (_node_paint = node.paint) === null || _node_paint === void 0 ? void 0 : _node_paint.strokeWidth;
|
|
27261
|
+
if (!sw) return false;
|
|
27262
|
+
ctx.lineWidth = sw;
|
|
27263
|
+
return ctx.isPointInStroke(p, lx, ly);
|
|
27264
|
+
}
|
|
27265
|
+
function pathFor(ctx, node) {
|
|
27192
27266
|
switch(node.type){
|
|
27193
27267
|
case "rect":
|
|
27194
27268
|
ctx.beginPath();
|
|
@@ -27359,7 +27433,38 @@
|
|
|
27359
27433
|
used to honor `vector-effect: non-scaling-stroke`, which holds a stroke at a
|
|
27360
27434
|
constant screen width regardless of an ancestor zoom/scale. It's 1 when
|
|
27361
27435
|
nothing above the node scales, so unzoomed output is unchanged.
|
|
27362
|
-
*/
|
|
27436
|
+
*/ /**
|
|
27437
|
+
Returns a dash array safe to pass to `setLineDash`, or `[]` (solid) for a
|
|
27438
|
+
degenerate one. Browsers ignore an all-zero/non-finite dash and draw solid;
|
|
27439
|
+
Skia-backed canvases (`@napi-rs/canvas`) instead throw "Make line dash path
|
|
27440
|
+
effect failed", so normalize here for backend parity.
|
|
27441
|
+
*/ function validDash(dash) {
|
|
27442
|
+
if (!dash || !dash.length) return [];
|
|
27443
|
+
var sum = 0;
|
|
27444
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
27445
|
+
try {
|
|
27446
|
+
for(var _iterator = dash[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
27447
|
+
var v = _step.value;
|
|
27448
|
+
if (!isFinite(v) || v < 0) return [];
|
|
27449
|
+
sum += v;
|
|
27450
|
+
}
|
|
27451
|
+
} catch (err) {
|
|
27452
|
+
_didIteratorError = true;
|
|
27453
|
+
_iteratorError = err;
|
|
27454
|
+
} finally{
|
|
27455
|
+
try {
|
|
27456
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
27457
|
+
_iterator.return();
|
|
27458
|
+
}
|
|
27459
|
+
} finally{
|
|
27460
|
+
if (_didIteratorError) {
|
|
27461
|
+
throw _iteratorError;
|
|
27462
|
+
}
|
|
27463
|
+
}
|
|
27464
|
+
}
|
|
27465
|
+
return sum > 0 ? dash : [];
|
|
27466
|
+
}
|
|
27467
|
+
function paint(ctx, node, alpha, path, resolvePattern) {
|
|
27363
27468
|
var cssScale = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 1;
|
|
27364
27469
|
var _p_strokeWidth;
|
|
27365
27470
|
var p = node.paint || {};
|
|
@@ -27371,41 +27476,78 @@
|
|
|
27371
27476
|
else ctx.fill();
|
|
27372
27477
|
}
|
|
27373
27478
|
if (p.stroke && p.stroke !== "none" && ((_p_strokeWidth = p.strokeWidth) !== null && _p_strokeWidth !== void 0 ? _p_strokeWidth : 0) > 0) {
|
|
27374
|
-
var _p_strokeOpacity
|
|
27479
|
+
var _p_strokeOpacity;
|
|
27375
27480
|
ctx.globalAlpha = alpha * ((_p_strokeOpacity = p.strokeOpacity) !== null && _p_strokeOpacity !== void 0 ? _p_strokeOpacity : 1);
|
|
27376
27481
|
ctx.strokeStyle = p.stroke;
|
|
27377
27482
|
ctx.lineWidth = p.vectorEffect === "non-scaling-stroke" && cssScale ? p.strokeWidth / cssScale : p.strokeWidth;
|
|
27378
|
-
ctx.setLineDash((
|
|
27483
|
+
ctx.setLineDash(validDash(p.strokeDasharray));
|
|
27379
27484
|
if (p.strokeLinecap) ctx.lineCap = p.strokeLinecap;
|
|
27380
27485
|
if (path) ctx.stroke(path);
|
|
27381
27486
|
else ctx.stroke();
|
|
27382
27487
|
}
|
|
27383
27488
|
}
|
|
27384
27489
|
|
|
27385
|
-
|
|
27490
|
+
/**
|
|
27491
|
+
@module canvas/backend
|
|
27492
|
+
A small injection seam so the Canvas backend can run outside a browser.
|
|
27493
|
+
|
|
27494
|
+
In the browser the surface is a real `<canvas>` element and images decode
|
|
27495
|
+
via `new Image()`. On a server there is no DOM `<canvas>`; a native canvas
|
|
27496
|
+
implementation (e.g. `@napi-rs/canvas`) supplies a structurally-compatible
|
|
27497
|
+
canvas + an async image loader. `CanvasRenderer` obtains both through the
|
|
27498
|
+
active backend rather than touching `document`/`Image` directly, so the same
|
|
27499
|
+
paint code runs in both places. The default backend is the browser one, so
|
|
27500
|
+
nothing changes unless a caller installs a different backend.
|
|
27501
|
+
*/ /**
|
|
27502
|
+
The canvas surface `CanvasRenderer` paints into. A browser `HTMLCanvasElement`
|
|
27503
|
+
and a native canvas both satisfy this; server backends return a native canvas
|
|
27504
|
+
cast to `HTMLCanvasElement` (the renderer only touches DOM-specific members —
|
|
27505
|
+
`style`, `className`, `remove`, listeners — behind the `dom` flag below).
|
|
27506
|
+
*/ /** The browser backend: a real `<canvas>` and `Image`-based decoding. */ var domBackend = {
|
|
27507
|
+
dom: true,
|
|
27508
|
+
createCanvas: function createCanvas() {
|
|
27509
|
+
return document.createElement("canvas");
|
|
27510
|
+
},
|
|
27511
|
+
loadImage: function loadImage(src) {
|
|
27512
|
+
return new Promise(function(resolve, reject) {
|
|
27513
|
+
var img = new Image();
|
|
27514
|
+
img.onload = function() {
|
|
27515
|
+
return resolve(img);
|
|
27516
|
+
};
|
|
27517
|
+
img.onerror = reject;
|
|
27518
|
+
img.src = src;
|
|
27519
|
+
});
|
|
27520
|
+
}
|
|
27521
|
+
};
|
|
27522
|
+
var current = domBackend;
|
|
27523
|
+
/** The currently-active canvas backend. */ function getCanvasBackend() {
|
|
27524
|
+
return current;
|
|
27525
|
+
}
|
|
27526
|
+
|
|
27527
|
+
function _array_like_to_array$b(arr, len) {
|
|
27386
27528
|
if (len == null || len > arr.length) len = arr.length;
|
|
27387
27529
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
27388
27530
|
return arr2;
|
|
27389
27531
|
}
|
|
27390
|
-
function _array_without_holes$
|
|
27391
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
27532
|
+
function _array_without_holes$5(arr) {
|
|
27533
|
+
if (Array.isArray(arr)) return _array_like_to_array$b(arr);
|
|
27392
27534
|
}
|
|
27393
|
-
function _iterable_to_array$
|
|
27535
|
+
function _iterable_to_array$5(iter) {
|
|
27394
27536
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27395
27537
|
}
|
|
27396
|
-
function _non_iterable_spread$
|
|
27538
|
+
function _non_iterable_spread$5() {
|
|
27397
27539
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27398
27540
|
}
|
|
27399
|
-
function _to_consumable_array$
|
|
27400
|
-
return _array_without_holes$
|
|
27541
|
+
function _to_consumable_array$5(arr) {
|
|
27542
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$5();
|
|
27401
27543
|
}
|
|
27402
|
-
function _unsupported_iterable_to_array$
|
|
27544
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
27403
27545
|
if (!o) return;
|
|
27404
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
27546
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
27405
27547
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
27406
27548
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
27407
27549
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
27408
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
27550
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
|
|
27409
27551
|
}
|
|
27410
27552
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
27411
27553
|
/**
|
|
@@ -27443,7 +27585,7 @@
|
|
|
27443
27585
|
if (k in t) {
|
|
27444
27586
|
var _t;
|
|
27445
27587
|
var v = config[k];
|
|
27446
|
-
if (Array.isArray(v)) (_t = t)[k].apply(_t, _to_consumable_array$
|
|
27588
|
+
if (Array.isArray(v)) (_t = t)[k].apply(_t, _to_consumable_array$5(v));
|
|
27447
27589
|
else t[k](v);
|
|
27448
27590
|
}
|
|
27449
27591
|
}
|
|
@@ -27470,6 +27612,342 @@
|
|
|
27470
27612
|
};
|
|
27471
27613
|
}
|
|
27472
27614
|
|
|
27615
|
+
function _array_like_to_array$a(arr, len) {
|
|
27616
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
27617
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
27618
|
+
return arr2;
|
|
27619
|
+
}
|
|
27620
|
+
function _array_without_holes$4(arr) {
|
|
27621
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
27622
|
+
}
|
|
27623
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
27624
|
+
try {
|
|
27625
|
+
var info = gen[key](arg);
|
|
27626
|
+
var value = info.value;
|
|
27627
|
+
} catch (error) {
|
|
27628
|
+
reject(error);
|
|
27629
|
+
return;
|
|
27630
|
+
}
|
|
27631
|
+
if (info.done) {
|
|
27632
|
+
resolve(value);
|
|
27633
|
+
} else {
|
|
27634
|
+
Promise.resolve(value).then(_next, _throw);
|
|
27635
|
+
}
|
|
27636
|
+
}
|
|
27637
|
+
function _async_to_generator(fn) {
|
|
27638
|
+
return function() {
|
|
27639
|
+
var self = this, args = arguments;
|
|
27640
|
+
return new Promise(function(resolve, reject) {
|
|
27641
|
+
var gen = fn.apply(self, args);
|
|
27642
|
+
function _next(value) {
|
|
27643
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
27644
|
+
}
|
|
27645
|
+
function _throw(err) {
|
|
27646
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
27647
|
+
}
|
|
27648
|
+
_next(undefined);
|
|
27649
|
+
});
|
|
27650
|
+
};
|
|
27651
|
+
}
|
|
27652
|
+
function _class_call_check$2(instance, Constructor) {
|
|
27653
|
+
if (!(instance instanceof Constructor)) {
|
|
27654
|
+
throw new TypeError("Cannot call a class as a function");
|
|
27655
|
+
}
|
|
27656
|
+
}
|
|
27657
|
+
function _defineProperties$2(target, props) {
|
|
27658
|
+
for(var i = 0; i < props.length; i++){
|
|
27659
|
+
var descriptor = props[i];
|
|
27660
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
27661
|
+
descriptor.configurable = true;
|
|
27662
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
27663
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27664
|
+
}
|
|
27665
|
+
}
|
|
27666
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
27667
|
+
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
27668
|
+
return Constructor;
|
|
27669
|
+
}
|
|
27670
|
+
function _define_property$3(obj, key, value) {
|
|
27671
|
+
if (key in obj) {
|
|
27672
|
+
Object.defineProperty(obj, key, {
|
|
27673
|
+
value: value,
|
|
27674
|
+
enumerable: true,
|
|
27675
|
+
configurable: true,
|
|
27676
|
+
writable: true
|
|
27677
|
+
});
|
|
27678
|
+
} else {
|
|
27679
|
+
obj[key] = value;
|
|
27680
|
+
}
|
|
27681
|
+
return obj;
|
|
27682
|
+
}
|
|
27683
|
+
function _iterable_to_array$4(iter) {
|
|
27684
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27685
|
+
}
|
|
27686
|
+
function _non_iterable_spread$4() {
|
|
27687
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27688
|
+
}
|
|
27689
|
+
function _to_consumable_array$4(arr) {
|
|
27690
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$4();
|
|
27691
|
+
}
|
|
27692
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
27693
|
+
if (!o) return;
|
|
27694
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
27695
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
27696
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
27697
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
27698
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
27699
|
+
}
|
|
27700
|
+
function _ts_generator(thisArg, body) {
|
|
27701
|
+
var f, y, t, _ = {
|
|
27702
|
+
label: 0,
|
|
27703
|
+
sent: function() {
|
|
27704
|
+
if (t[0] & 1) throw t[1];
|
|
27705
|
+
return t[1];
|
|
27706
|
+
},
|
|
27707
|
+
trys: [],
|
|
27708
|
+
ops: []
|
|
27709
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
27710
|
+
return d(g, "next", {
|
|
27711
|
+
value: verb(0)
|
|
27712
|
+
}), d(g, "throw", {
|
|
27713
|
+
value: verb(1)
|
|
27714
|
+
}), d(g, "return", {
|
|
27715
|
+
value: verb(2)
|
|
27716
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
27717
|
+
value: function() {
|
|
27718
|
+
return this;
|
|
27719
|
+
}
|
|
27720
|
+
}), g;
|
|
27721
|
+
function verb(n) {
|
|
27722
|
+
return function(v) {
|
|
27723
|
+
return step([
|
|
27724
|
+
n,
|
|
27725
|
+
v
|
|
27726
|
+
]);
|
|
27727
|
+
};
|
|
27728
|
+
}
|
|
27729
|
+
function step(op) {
|
|
27730
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27731
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
27732
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
27733
|
+
if (y = 0, t) op = [
|
|
27734
|
+
op[0] & 2,
|
|
27735
|
+
t.value
|
|
27736
|
+
];
|
|
27737
|
+
switch(op[0]){
|
|
27738
|
+
case 0:
|
|
27739
|
+
case 1:
|
|
27740
|
+
t = op;
|
|
27741
|
+
break;
|
|
27742
|
+
case 4:
|
|
27743
|
+
_.label++;
|
|
27744
|
+
return {
|
|
27745
|
+
value: op[1],
|
|
27746
|
+
done: false
|
|
27747
|
+
};
|
|
27748
|
+
case 5:
|
|
27749
|
+
_.label++;
|
|
27750
|
+
y = op[1];
|
|
27751
|
+
op = [
|
|
27752
|
+
0
|
|
27753
|
+
];
|
|
27754
|
+
continue;
|
|
27755
|
+
case 7:
|
|
27756
|
+
op = _.ops.pop();
|
|
27757
|
+
_.trys.pop();
|
|
27758
|
+
continue;
|
|
27759
|
+
default:
|
|
27760
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
27761
|
+
_ = 0;
|
|
27762
|
+
continue;
|
|
27763
|
+
}
|
|
27764
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
27765
|
+
_.label = op[1];
|
|
27766
|
+
break;
|
|
27767
|
+
}
|
|
27768
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
27769
|
+
_.label = t[1];
|
|
27770
|
+
t = op;
|
|
27771
|
+
break;
|
|
27772
|
+
}
|
|
27773
|
+
if (t && _.label < t[2]) {
|
|
27774
|
+
_.label = t[2];
|
|
27775
|
+
_.ops.push(op);
|
|
27776
|
+
break;
|
|
27777
|
+
}
|
|
27778
|
+
if (t[2]) _.ops.pop();
|
|
27779
|
+
_.trys.pop();
|
|
27780
|
+
continue;
|
|
27781
|
+
}
|
|
27782
|
+
op = body.call(thisArg, _);
|
|
27783
|
+
} catch (e) {
|
|
27784
|
+
op = [
|
|
27785
|
+
6,
|
|
27786
|
+
e
|
|
27787
|
+
];
|
|
27788
|
+
y = 0;
|
|
27789
|
+
} finally{
|
|
27790
|
+
f = t = 0;
|
|
27791
|
+
}
|
|
27792
|
+
if (op[0] & 5) throw op[1];
|
|
27793
|
+
return {
|
|
27794
|
+
value: op[0] ? op[1] : void 0,
|
|
27795
|
+
done: true
|
|
27796
|
+
};
|
|
27797
|
+
}
|
|
27798
|
+
}
|
|
27799
|
+
/**
|
|
27800
|
+
@class CanvasResources
|
|
27801
|
+
Owns the Canvas backend's async resources — decoded `<image>` bitmaps and
|
|
27802
|
+
tiled texture `CanvasPattern`s — plus the machinery to wait for them.
|
|
27803
|
+
|
|
27804
|
+
Both decode asynchronously: the first paint that needs a resource kicks off
|
|
27805
|
+
its load and paints a fallback (nothing for images, the texture's solid color
|
|
27806
|
+
for patterns); a repaint follows once the resource is ready. That live
|
|
27807
|
+
warm-up-then-repaint model is invisible in the browser. A server render, which
|
|
27808
|
+
reads pixels once and stops, instead awaits {@link whenSettled} so every
|
|
27809
|
+
resource is present before encoding.
|
|
27810
|
+
*/ var CanvasResources = /*#__PURE__*/ function() {
|
|
27811
|
+
function CanvasResources(ctx, repaint) {
|
|
27812
|
+
_class_call_check$2(this, CanvasResources);
|
|
27813
|
+
_define_property$3(this, "ctx", void 0);
|
|
27814
|
+
_define_property$3(this, "repaint", void 0);
|
|
27815
|
+
/** href → decoded image (present only once fully loaded). */ _define_property$3(this, "images", void 0);
|
|
27816
|
+
/** token → tiled pattern (present only once rasterized). */ _define_property$3(this, "patterns", void 0);
|
|
27817
|
+
_define_property$3(this, "imagesPending", void 0);
|
|
27818
|
+
_define_property$3(this, "patternsPending", void 0);
|
|
27819
|
+
_define_property$3(this, "pending", void 0);
|
|
27820
|
+
this.ctx = ctx;
|
|
27821
|
+
this.repaint = repaint;
|
|
27822
|
+
this.images = new Map();
|
|
27823
|
+
this.patterns = new Map();
|
|
27824
|
+
this.imagesPending = new Set();
|
|
27825
|
+
this.patternsPending = new Set();
|
|
27826
|
+
this.pending = new Set();
|
|
27827
|
+
}
|
|
27828
|
+
_create_class$2(CanvasResources, [
|
|
27829
|
+
{
|
|
27830
|
+
key: "track",
|
|
27831
|
+
value: /** Tracks an in-flight decode so {@link whenSettled} can await it. */ function track(p) {
|
|
27832
|
+
var _this = this;
|
|
27833
|
+
this.pending.add(p);
|
|
27834
|
+
var done = function done() {
|
|
27835
|
+
_this.pending.delete(p);
|
|
27836
|
+
};
|
|
27837
|
+
p.then(done, done);
|
|
27838
|
+
}
|
|
27839
|
+
},
|
|
27840
|
+
{
|
|
27841
|
+
key: "whenSettled",
|
|
27842
|
+
value: /**
|
|
27843
|
+
Resolves once every in-flight decode has settled and a final frame has
|
|
27844
|
+
repainted. A resolution repaints, which can enqueue further decodes, so
|
|
27845
|
+
this drains until the queue empties (guarded against pathological loops).
|
|
27846
|
+
*/ function whenSettled() {
|
|
27847
|
+
return _async_to_generator(function() {
|
|
27848
|
+
var guard;
|
|
27849
|
+
return _ts_generator(this, function(_state) {
|
|
27850
|
+
switch(_state.label){
|
|
27851
|
+
case 0:
|
|
27852
|
+
guard = 0;
|
|
27853
|
+
_state.label = 1;
|
|
27854
|
+
case 1:
|
|
27855
|
+
if (!(this.pending.size && guard++ < 1000)) return [
|
|
27856
|
+
3,
|
|
27857
|
+
3
|
|
27858
|
+
];
|
|
27859
|
+
return [
|
|
27860
|
+
4,
|
|
27861
|
+
Promise.allSettled(_to_consumable_array$4(this.pending))
|
|
27862
|
+
];
|
|
27863
|
+
case 2:
|
|
27864
|
+
_state.sent();
|
|
27865
|
+
return [
|
|
27866
|
+
3,
|
|
27867
|
+
1
|
|
27868
|
+
];
|
|
27869
|
+
case 3:
|
|
27870
|
+
this.repaint();
|
|
27871
|
+
return [
|
|
27872
|
+
2
|
|
27873
|
+
];
|
|
27874
|
+
}
|
|
27875
|
+
});
|
|
27876
|
+
}).call(this);
|
|
27877
|
+
}
|
|
27878
|
+
},
|
|
27879
|
+
{
|
|
27880
|
+
/**
|
|
27881
|
+
Returns the decoded image for `href`, or `null` if it isn't ready yet
|
|
27882
|
+
(kicking off the load on first request). Callers draw only when non-null.
|
|
27883
|
+
*/ key: "imageFor",
|
|
27884
|
+
value: function imageFor(href) {
|
|
27885
|
+
var _this = this;
|
|
27886
|
+
var img = this.images.get(href);
|
|
27887
|
+
if (img) return img;
|
|
27888
|
+
if (!this.imagesPending.has(href)) {
|
|
27889
|
+
this.imagesPending.add(href);
|
|
27890
|
+
this.track(getCanvasBackend().loadImage(href).then(function(loaded) {
|
|
27891
|
+
_this.images.set(href, loaded);
|
|
27892
|
+
}, function() {
|
|
27893
|
+
/* broken image — never enters the ready map */ }).finally(function() {
|
|
27894
|
+
_this.imagesPending.delete(href);
|
|
27895
|
+
_this.repaint();
|
|
27896
|
+
}));
|
|
27897
|
+
}
|
|
27898
|
+
return null;
|
|
27899
|
+
}
|
|
27900
|
+
},
|
|
27901
|
+
{
|
|
27902
|
+
/**
|
|
27903
|
+
Resolves a `pattern:<json>` texture token to a tiled `CanvasPattern`, or
|
|
27904
|
+
`null` until it rasterizes. textures.js emits SVG a 2D context can't
|
|
27905
|
+
consume, so the tile's standalone SVG ({@link patternTileSvg}) is decoded
|
|
27906
|
+
onto an offscreen canvas and tiled with `createPattern(…, "repeat")`.
|
|
27907
|
+
*/ key: "resolvePattern",
|
|
27908
|
+
value: function resolvePattern(token) {
|
|
27909
|
+
var _this = this;
|
|
27910
|
+
var cached = this.patterns.get(token);
|
|
27911
|
+
if (cached) return cached;
|
|
27912
|
+
if (this.patternsPending.has(token)) return null;
|
|
27913
|
+
var tile = patternTileSvg(token);
|
|
27914
|
+
if (!tile) return null;
|
|
27915
|
+
var backend = getCanvasBackend();
|
|
27916
|
+
this.patternsPending.add(token);
|
|
27917
|
+
var src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(tile.svg));
|
|
27918
|
+
this.track(backend.loadImage(src).then(function(img) {
|
|
27919
|
+
var off = backend.createCanvas(tile.width, tile.height);
|
|
27920
|
+
off.width = tile.width;
|
|
27921
|
+
off.height = tile.height;
|
|
27922
|
+
var octx = off.getContext("2d");
|
|
27923
|
+
if (octx) {
|
|
27924
|
+
var _this_ctx;
|
|
27925
|
+
octx.drawImage(img, 0, 0, tile.width, tile.height);
|
|
27926
|
+
var pat = (_this_ctx = _this.ctx()) === null || _this_ctx === void 0 ? void 0 : _this_ctx.createPattern(off, "repeat");
|
|
27927
|
+
if (pat) _this.patterns.set(token, pat);
|
|
27928
|
+
}
|
|
27929
|
+
}, function() {
|
|
27930
|
+
/* decode failed — the solid fallback stays */ }).finally(function() {
|
|
27931
|
+
_this.patternsPending.delete(token);
|
|
27932
|
+
_this.repaint();
|
|
27933
|
+
}));
|
|
27934
|
+
return null;
|
|
27935
|
+
}
|
|
27936
|
+
},
|
|
27937
|
+
{
|
|
27938
|
+
/** Drops all cached + pending resources (CanvasPatterns are context-bound). */ key: "clear",
|
|
27939
|
+
value: function clear() {
|
|
27940
|
+
this.images.clear();
|
|
27941
|
+
this.imagesPending.clear();
|
|
27942
|
+
this.patterns.clear();
|
|
27943
|
+
this.patternsPending.clear();
|
|
27944
|
+
this.pending.clear();
|
|
27945
|
+
}
|
|
27946
|
+
}
|
|
27947
|
+
]);
|
|
27948
|
+
return CanvasResources;
|
|
27949
|
+
}();
|
|
27950
|
+
|
|
27473
27951
|
function _array_like_to_array$9(arr, len) {
|
|
27474
27952
|
if (len == null || len > arr.length) len = arr.length;
|
|
27475
27953
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -27591,15 +28069,21 @@
|
|
|
27591
28069
|
_define_property$2(this, "_scene", null);
|
|
27592
28070
|
/** Per-mark position history for persistent motion trails. */ _define_property$2(this, "_trailLog", new TrailLog());
|
|
27593
28071
|
_define_property$2(this, "_pickIndex", []);
|
|
27594
|
-
|
|
27595
|
-
|
|
27596
|
-
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
28072
|
+
/**
|
|
28073
|
+
* Async image + texture-pattern resources and the settle machinery. See
|
|
28074
|
+
* {@link CanvasResources}. `_patternResolver` is a pre-bound view passed into
|
|
28075
|
+
* the paint path so no closure is allocated per node per frame.
|
|
28076
|
+
*/ _define_property$2(this, "_res", new CanvasResources(function() {
|
|
28077
|
+
return _this._ctx;
|
|
28078
|
+
}, function() {
|
|
28079
|
+
if (_this._scene) _this._paint(_this._scene);
|
|
28080
|
+
}));
|
|
28081
|
+
/**
|
|
28082
|
+
* Whether the mounted surface is a real DOM canvas. False under a headless
|
|
28083
|
+
* backend (`@d3plus/ssr`), where DOM mounting + interaction wiring are skipped.
|
|
28084
|
+
*/ _define_property$2(this, "_dom", true);
|
|
27601
28085
|
_define_property$2(this, "_patternResolver", function(token) {
|
|
27602
|
-
return _this.
|
|
28086
|
+
return _this._res.resolvePattern(token);
|
|
27603
28087
|
});
|
|
27604
28088
|
_define_property$2(this, "_handlers", new Set());
|
|
27605
28089
|
_define_property$2(this, "_domListeners", {});
|
|
@@ -27621,14 +28105,20 @@
|
|
|
27621
28105
|
var _target_pixelRatio;
|
|
27622
28106
|
this._target = target;
|
|
27623
28107
|
this._ratio = (_target_pixelRatio = target.pixelRatio) !== null && _target_pixelRatio !== void 0 ? _target_pixelRatio : typeof devicePixelRatio !== "undefined" ? devicePixelRatio : 1;
|
|
27624
|
-
var
|
|
27625
|
-
|
|
27626
|
-
canvas.
|
|
27627
|
-
// `createOverlayHost` handles `position: relative` on container.
|
|
27628
|
-
this._overlayHost = createOverlayHost(target);
|
|
27629
|
-
target.container.insertBefore(canvas, this._overlayHost);
|
|
28108
|
+
var backend = getCanvasBackend();
|
|
28109
|
+
this._dom = backend.dom !== false;
|
|
28110
|
+
var canvas = backend.createCanvas(target.width, target.height);
|
|
27630
28111
|
this._canvas = canvas;
|
|
27631
28112
|
this._ctx = canvas.getContext("2d");
|
|
28113
|
+
// Headless backends (no DOM canvas) skip mounting + overlay hosting; they
|
|
28114
|
+
// only produce pixels. The browser backend inserts the canvas + overlay host.
|
|
28115
|
+
if (this._dom) {
|
|
28116
|
+
canvas.className = "d3plus-render-canvas";
|
|
28117
|
+
canvas.style.display = "block";
|
|
28118
|
+
// `createOverlayHost` handles `position: relative` on container.
|
|
28119
|
+
this._overlayHost = createOverlayHost(target);
|
|
28120
|
+
target.container.insertBefore(canvas, this._overlayHost);
|
|
28121
|
+
}
|
|
27632
28122
|
this.resize(target.width, target.height);
|
|
27633
28123
|
}
|
|
27634
28124
|
},
|
|
@@ -27640,8 +28130,10 @@
|
|
|
27640
28130
|
if (!this._canvas) return;
|
|
27641
28131
|
this._canvas.width = Math.round(width * this._ratio);
|
|
27642
28132
|
this._canvas.height = Math.round(height * this._ratio);
|
|
27643
|
-
this.
|
|
27644
|
-
|
|
28133
|
+
if (this._dom) {
|
|
28134
|
+
this._canvas.style.width = "".concat(width, "px");
|
|
28135
|
+
this._canvas.style.height = "".concat(height, "px");
|
|
28136
|
+
}
|
|
27645
28137
|
if (this._invalidatePointerRect) this._invalidatePointerRect();
|
|
27646
28138
|
if (this._scene) this._paint(this._scene);
|
|
27647
28139
|
}
|
|
@@ -28010,77 +28502,36 @@
|
|
|
28010
28502
|
}
|
|
28011
28503
|
},
|
|
28012
28504
|
{
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
|
|
28020
|
-
tiles it. Loading is async, so the first paint returns null (the caller
|
|
28021
|
-
paints the texture's solid fallback) and we repaint once the tile is ready
|
|
28022
|
-
— the same warm-up-then-repaint model as {@link _drawImage}.
|
|
28023
|
-
*/ function _resolvePattern(token) {
|
|
28024
|
-
var _this = this;
|
|
28025
|
-
var cached = this._patterns.get(token);
|
|
28026
|
-
if (cached) return cached;
|
|
28027
|
-
if (this._patternsPending.has(token)) return null;
|
|
28028
|
-
var tile = patternTileSvg(token);
|
|
28029
|
-
if (!tile) return null;
|
|
28030
|
-
this._patternsPending.add(token);
|
|
28031
|
-
var img = new Image();
|
|
28032
|
-
img.onload = function() {
|
|
28033
|
-
try {
|
|
28034
|
-
var _this__ctx;
|
|
28035
|
-
var off = document.createElement("canvas");
|
|
28036
|
-
off.width = tile.width;
|
|
28037
|
-
off.height = tile.height;
|
|
28038
|
-
var octx = off.getContext("2d");
|
|
28039
|
-
var pat = octx && (octx.drawImage(img, 0, 0, tile.width, tile.height), (_this__ctx = _this._ctx) === null || _this__ctx === void 0 ? void 0 : _this__ctx.createPattern(off, "repeat"));
|
|
28040
|
-
if (pat) _this._patterns.set(token, pat);
|
|
28041
|
-
} finally{
|
|
28042
|
-
_this._patternsPending.delete(token);
|
|
28043
|
-
if (_this._scene) _this._paint(_this._scene);
|
|
28044
|
-
}
|
|
28045
|
-
};
|
|
28046
|
-
img.onerror = function() {
|
|
28047
|
-
_this._patternsPending.delete(token);
|
|
28048
|
-
};
|
|
28049
|
-
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(tile.svg));
|
|
28050
|
-
return null;
|
|
28505
|
+
/**
|
|
28506
|
+
Resolves once all in-flight image/texture decodes settle and a final frame
|
|
28507
|
+
repaints. Server-side callers await this before reading pixels; the browser
|
|
28508
|
+
repaints live and never needs it. See {@link CanvasResources}.
|
|
28509
|
+
*/ key: "whenSettled",
|
|
28510
|
+
value: function whenSettled() {
|
|
28511
|
+
return this._res.whenSettled();
|
|
28051
28512
|
}
|
|
28052
28513
|
},
|
|
28053
28514
|
{
|
|
28054
28515
|
key: "_drawImage",
|
|
28055
28516
|
value: function _drawImage(ctx, node, alpha) {
|
|
28056
|
-
var
|
|
28057
|
-
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
var
|
|
28070
|
-
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
var sw = node.width / scale, sh = node.height / scale;
|
|
28075
|
-
ctx.drawImage(img, (iw - sw) / 2, (ih - sh) / 2, sw, sh, node.x, node.y, node.width, node.height);
|
|
28076
|
-
} else if (par && par !== "none" && par.includes("meet")) {
|
|
28077
|
-
// CSS `contain`: fit the whole image inside the box (centered).
|
|
28078
|
-
var scale1 = Math.min(node.width / iw, node.height / ih);
|
|
28079
|
-
var dw = iw * scale1, dh = ih * scale1;
|
|
28080
|
-
ctx.drawImage(img, node.x + (node.width - dw) / 2, node.y + (node.height - dh) / 2, dw, dh);
|
|
28081
|
-
} else {
|
|
28082
|
-
ctx.drawImage(img, node.x, node.y, node.width, node.height);
|
|
28083
|
-
}
|
|
28517
|
+
var img = this._res.imageFor(node.href);
|
|
28518
|
+
if (!img) return;
|
|
28519
|
+
ctx.globalAlpha = alpha;
|
|
28520
|
+
var par = node.preserveAspectRatio;
|
|
28521
|
+
var iw = img.naturalWidth || img.width, ih = img.naturalHeight || img.height;
|
|
28522
|
+
if (par && par.includes("slice")) {
|
|
28523
|
+
// CSS `cover`: scale the image to fill the box, cropping the overflow
|
|
28524
|
+
// (centered), via drawImage's source-rect crop.
|
|
28525
|
+
var scale = Math.max(node.width / iw, node.height / ih);
|
|
28526
|
+
var sw = node.width / scale, sh = node.height / scale;
|
|
28527
|
+
ctx.drawImage(img, (iw - sw) / 2, (ih - sh) / 2, sw, sh, node.x, node.y, node.width, node.height);
|
|
28528
|
+
} else if (par && par !== "none" && par.includes("meet")) {
|
|
28529
|
+
// CSS `contain`: fit the whole image inside the box (centered).
|
|
28530
|
+
var scale1 = Math.min(node.width / iw, node.height / ih);
|
|
28531
|
+
var dw = iw * scale1, dh = ih * scale1;
|
|
28532
|
+
ctx.drawImage(img, node.x + (node.width - dw) / 2, node.y + (node.height - dh) / 2, dw, dh);
|
|
28533
|
+
} else {
|
|
28534
|
+
ctx.drawImage(img, node.x, node.y, node.width, node.height);
|
|
28084
28535
|
}
|
|
28085
28536
|
}
|
|
28086
28537
|
},
|
|
@@ -28112,7 +28563,7 @@
|
|
|
28112
28563
|
case "circle":
|
|
28113
28564
|
return Math.pow(lx - node.cx, 2) + Math.pow(ly - node.cy, 2) <= Math.pow(node.r, 2);
|
|
28114
28565
|
case "path":
|
|
28115
|
-
return this._ctx ? this._ctx
|
|
28566
|
+
return this._ctx ? pathHit(this._ctx, node, lx, ly) : false;
|
|
28116
28567
|
case "area":
|
|
28117
28568
|
if (!this._ctx) return false;
|
|
28118
28569
|
pathFor(this._ctx, node);
|
|
@@ -28185,7 +28636,9 @@
|
|
|
28185
28636
|
value: function on(handler) {
|
|
28186
28637
|
var _this = this;
|
|
28187
28638
|
this._handlers.add(handler);
|
|
28188
|
-
|
|
28639
|
+
// A headless backend (`@d3plus/ssr`) has no DOM canvas to bind pointer
|
|
28640
|
+
// listeners to; interaction is a no-op server-side.
|
|
28641
|
+
if (this._dom && !this._listening) this._attachListeners();
|
|
28189
28642
|
return function() {
|
|
28190
28643
|
_this._handlers.delete(handler);
|
|
28191
28644
|
};
|
|
@@ -28359,7 +28812,7 @@
|
|
|
28359
28812
|
key: "destroy",
|
|
28360
28813
|
value: function destroy() {
|
|
28361
28814
|
if (this._cancelAnim) this._cancelAnim();
|
|
28362
|
-
if (this._canvas) {
|
|
28815
|
+
if (this._canvas && this._dom) {
|
|
28363
28816
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
28364
28817
|
try {
|
|
28365
28818
|
for(var _iterator = Object.entries(this._domListeners)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -28395,10 +28848,8 @@
|
|
|
28395
28848
|
this._handlers.clear();
|
|
28396
28849
|
this._domListeners = {};
|
|
28397
28850
|
this._listening = false;
|
|
28398
|
-
this._images.clear();
|
|
28399
28851
|
// CanvasPatterns are bound to the context being torn down.
|
|
28400
|
-
this.
|
|
28401
|
-
this._patternsPending.clear();
|
|
28852
|
+
this._res.clear();
|
|
28402
28853
|
this._canvas = undefined;
|
|
28403
28854
|
this._ctx = undefined;
|
|
28404
28855
|
this._scene = null;
|
|
@@ -36012,7 +36463,10 @@
|
|
|
36012
36463
|
};
|
|
36013
36464
|
let base = typeof paint.fill === "string" ? paint.fill : undefined;
|
|
36014
36465
|
if (!base || base === "transparent" || base === "none") base = typeof paint.stroke === "string" ? paint.stroke : undefined;
|
|
36015
|
-
|
|
36466
|
+
// No visible paint to emphasize (e.g. an invisible hit-area node): leave it
|
|
36467
|
+
// untouched — darkening `transparent`/`none` would format to opaque black.
|
|
36468
|
+
if (!base || base === "transparent" || base === "none") return node;
|
|
36469
|
+
const c = color(base);
|
|
36016
36470
|
if (c) paint.stroke = c.darker(darken).formatHex();
|
|
36017
36471
|
const w = typeof paint.strokeWidth === "number" && paint.strokeWidth ? paint.strokeWidth : 1;
|
|
36018
36472
|
paint.strokeWidth = w * widthMult;
|
|
@@ -42509,12 +42963,38 @@
|
|
|
42509
42963
|
the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the
|
|
42510
42964
|
visible geometry are siblings, and the SVG keyed join can't hold two nodes
|
|
42511
42965
|
under one key — sharing it made the geometry re-enter (collapse→grow) on every
|
|
42512
|
-
redraw (a "pulse" on e.g. every timeline step). Returns null when no
|
|
42513
|
-
|
|
42514
|
-
|
|
42515
|
-
|
|
42966
|
+
redraw (a "pulse" on e.g. every timeline step). Returns null when no hitArea
|
|
42967
|
+
is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses
|
|
42968
|
+
the resolved geometry `d`/`transform` so the hover target overlaps the
|
|
42969
|
+
visible line exactly while extending past its ~1px stroke.
|
|
42970
|
+
*/ function hitAreaNode(hitArea, d, i, aes, key, datum, name, transform, geomD) {
|
|
42516
42971
|
const bounds = typeof hitArea === "function" ? hitArea(d, i, aes) : hitArea;
|
|
42517
|
-
if (!bounds
|
|
42972
|
+
if (!bounds) return null;
|
|
42973
|
+
// Path-style hitArea (Line): widen the hover target to a fat transparent
|
|
42974
|
+
// stroke over the line's own geometry. `stroke: transparent` (not "none") is
|
|
42975
|
+
// painted, so it hit-tests across the full width on both backends.
|
|
42976
|
+
if (typeof bounds.width !== "number" && typeof geomD === "string") {
|
|
42977
|
+
const sw = typeof bounds["stroke-width"] === "number" ? bounds["stroke-width"] : 10;
|
|
42978
|
+
return {
|
|
42979
|
+
type: "path",
|
|
42980
|
+
d: geomD,
|
|
42981
|
+
key: `${key}::hit`,
|
|
42982
|
+
datum,
|
|
42983
|
+
index: i,
|
|
42984
|
+
shapeType: name,
|
|
42985
|
+
paint: {
|
|
42986
|
+
fill: "none",
|
|
42987
|
+
stroke: "transparent",
|
|
42988
|
+
strokeWidth: sw,
|
|
42989
|
+
vectorEffect: "non-scaling-stroke"
|
|
42990
|
+
},
|
|
42991
|
+
transform,
|
|
42992
|
+
aria: {
|
|
42993
|
+
hidden: true
|
|
42994
|
+
}
|
|
42995
|
+
};
|
|
42996
|
+
}
|
|
42997
|
+
if (typeof bounds.width !== "number" || typeof bounds.height !== "number") return null;
|
|
42518
42998
|
return {
|
|
42519
42999
|
type: "rect",
|
|
42520
43000
|
x: typeof bounds.x === "number" ? bounds.x : -bounds.width / 2,
|
|
@@ -42535,6 +43015,35 @@
|
|
|
42535
43015
|
};
|
|
42536
43016
|
}
|
|
42537
43017
|
|
|
43018
|
+
/**
|
|
43019
|
+
For a nested shape datum (Line/Area, whose datum wraps many points) returns a
|
|
43020
|
+
spreadable scene-node fragment carrying each point's content-space position
|
|
43021
|
+
paired with its source datum, so the pointer bridge can report the point
|
|
43022
|
+
nearest the cursor rather than the whole-series aggregate. Points the
|
|
43023
|
+
`defined` accessor rejects, or whose position isn't finite (a missing value),
|
|
43024
|
+
are skipped — so the nearest match is always a real, defined point. Returns
|
|
43025
|
+
an empty object for non-nested data (spreads to nothing).
|
|
43026
|
+
*/ function interactionPoints(d, x, y, defined) {
|
|
43027
|
+
if (!d.__d3plusShape__ || !Array.isArray(d.values)) return {};
|
|
43028
|
+
const values = d.values;
|
|
43029
|
+
const points = [];
|
|
43030
|
+
values.forEach((v, k)=>{
|
|
43031
|
+
if (typeof defined === "function" && defined(v, k) === false) return;
|
|
43032
|
+
const px = Number(x(v, k));
|
|
43033
|
+
const py = Number(y(v, k));
|
|
43034
|
+
if (!Number.isFinite(px) || !Number.isFinite(py)) return;
|
|
43035
|
+
points.push({
|
|
43036
|
+
x: px,
|
|
43037
|
+
y: py,
|
|
43038
|
+
datum: v,
|
|
43039
|
+
index: typeof v.i === "number" ? v.i : k
|
|
43040
|
+
});
|
|
43041
|
+
});
|
|
43042
|
+
return points.length ? {
|
|
43043
|
+
interactionPoints: points
|
|
43044
|
+
} : {};
|
|
43045
|
+
}
|
|
43046
|
+
|
|
42538
43047
|
/** Follows the chart (`__d3plus__`) and shape (`__d3plusShape__`) wrappers back
|
|
42539
43048
|
to the source datum, so a `sort` comparator sees the same object the other
|
|
42540
43049
|
per-datum accessors receive. */ function unwrap(d) {
|
|
@@ -43043,15 +43552,12 @@
|
|
|
43043
43552
|
Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
43044
43553
|
@param callback Optional callback invoked after rendering completes.
|
|
43045
43554
|
*/ /**
|
|
43046
|
-
Resolves a style accessor
|
|
43047
|
-
|
|
43555
|
+
Resolves a style accessor. For a nested shape (Line/Area) the accessor gets
|
|
43556
|
+
the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.
|
|
43048
43557
|
@private
|
|
43049
43558
|
*/ _styleVal(fn, d, i) {
|
|
43050
43559
|
if (typeof fn !== "function") return fn;
|
|
43051
|
-
if (d.nested && d.key && d.values)
|
|
43052
|
-
const first = d.values[0];
|
|
43053
|
-
return fn(first, this._data.indexOf(first));
|
|
43054
|
-
}
|
|
43560
|
+
if (d.nested && d.key && d.values) return fn(d.data, d.i);
|
|
43055
43561
|
return fn(d, i);
|
|
43056
43562
|
}
|
|
43057
43563
|
/**
|
|
@@ -43136,15 +43642,23 @@
|
|
|
43136
43642
|
const key = this._nestWrapper(this.schema.id)(d, i);
|
|
43137
43643
|
const datum = d.__d3plusShape__ ? d.data : d;
|
|
43138
43644
|
const transform = this._sceneTransform(d, i);
|
|
43645
|
+
// Per-point positions (Line/Area) shared by the geometry and its hit area
|
|
43646
|
+
// so a hover anywhere on either resolves to the nearest point.
|
|
43647
|
+
const iPoints = interactionPoints(d, this.schema.x, this.schema.y, this.schema.defined);
|
|
43139
43648
|
// Push the hit area (if any) before the geometry so it sits behind it.
|
|
43649
|
+
// Line's is a fat path built from the geometry `d`; Bar/legend etc. a rect.
|
|
43140
43650
|
if (this.schema.hitArea) {
|
|
43141
|
-
const ha = hitAreaNode(this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform);
|
|
43651
|
+
const ha = hitAreaNode(this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform, geom.d);
|
|
43142
43652
|
// Share the datum's rank so the hit area stays paired just behind its
|
|
43143
43653
|
// own geometry (equal `z`, kept in push order by the stable sort).
|
|
43144
43654
|
if (ha) children.push(rank ? {
|
|
43145
43655
|
...ha,
|
|
43656
|
+
...iPoints,
|
|
43146
43657
|
z: rank[i]
|
|
43147
|
-
} :
|
|
43658
|
+
} : {
|
|
43659
|
+
...ha,
|
|
43660
|
+
...iPoints
|
|
43661
|
+
});
|
|
43148
43662
|
}
|
|
43149
43663
|
children.push({
|
|
43150
43664
|
...geom,
|
|
@@ -43158,6 +43672,7 @@
|
|
|
43158
43672
|
role: strOrUndef(this._nestWrapper(this.schema.role)(d, i)),
|
|
43159
43673
|
label: strOrUndef(this._nestWrapper(this.schema.ariaLabel)(d, i))
|
|
43160
43674
|
},
|
|
43675
|
+
...iPoints,
|
|
43161
43676
|
...rank ? {
|
|
43162
43677
|
z: rank[i]
|
|
43163
43678
|
} : {}
|
|
@@ -50479,7 +50994,10 @@
|
|
|
50479
50994
|
}
|
|
50480
50995
|
};
|
|
50481
50996
|
const debouncedResize = debounce(applyResize, viz.schema.detectResizeDelay);
|
|
50482
|
-
|
|
50997
|
+
// Guarded so a chart can be constructed in an environment without a DOM (e.g.
|
|
50998
|
+
// before `@d3plus/ssr` installs one). Auto-resize is a browser-only feature;
|
|
50999
|
+
// when absent, `_resizeObserver` stays undefined and its call sites skip it.
|
|
51000
|
+
viz._resizeObserver = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver((entries)=>{
|
|
50483
51001
|
// The first real-size notification after `observe()` reports the
|
|
50484
51002
|
// container's settled layout size, which on an auto-sized chart often
|
|
50485
51003
|
// differs from the size the chart just measured pre-layout (the
|
|
@@ -51094,7 +51612,9 @@
|
|
|
51094
51612
|
viz._visiblePoll = clearInterval(viz._visiblePoll);
|
|
51095
51613
|
viz._resizePoll = clearTimeout(viz._resizePoll);
|
|
51096
51614
|
viz._scrollPoll = clearTimeout(viz._scrollPoll);
|
|
51097
|
-
|
|
51615
|
+
// scrollContainer is "" when constructed without a window (headless/SSR);
|
|
51616
|
+
// there is nothing to unbind and select("") throws on an invalid selector.
|
|
51617
|
+
if (viz.schema.scrollContainer) select(viz.schema.scrollContainer).on(`scroll.${viz._uuid}`, null);
|
|
51098
51618
|
}
|
|
51099
51619
|
/**
|
|
51100
51620
|
Installs the visibility/scroll detection that defers rendering until the
|
|
@@ -51195,9 +51715,9 @@
|
|
|
51195
51715
|
if (viz._select.attr("opacity") === "0") viz._select.transition().duration(viz.schema.duration).attr("opacity", 1);
|
|
51196
51716
|
}
|
|
51197
51717
|
if (viz.schema.detectResize && (viz._autoWidth || viz._autoHeight)) {
|
|
51198
|
-
viz._resizeObserver
|
|
51718
|
+
viz._resizeObserver?.observe(viz._select.node().parentNode);
|
|
51199
51719
|
} else {
|
|
51200
|
-
viz._resizeObserver
|
|
51720
|
+
viz._resizeObserver?.unobserve(viz._select.node().parentNode);
|
|
51201
51721
|
}
|
|
51202
51722
|
if (callback) setTimeout(()=>{
|
|
51203
51723
|
callback();
|
|
@@ -51896,6 +52416,23 @@
|
|
|
51896
52416
|
*/ render(callback) {
|
|
51897
52417
|
return vizRender(this, callback);
|
|
51898
52418
|
}
|
|
52419
|
+
/**
|
|
52420
|
+
Serializes the most recently rendered output to an SVG string. Returns
|
|
52421
|
+
`""` if the chart has not been rendered yet. Both backends support this:
|
|
52422
|
+
the SVG backend returns its live `<svg>`, the canvas backend re-renders the
|
|
52423
|
+
retained scene through a throwaway SVG backend. Primarily used for
|
|
52424
|
+
server-side rendering (see `@d3plus/ssr`).
|
|
52425
|
+
*/ toSVGString() {
|
|
52426
|
+
return this._sceneRenderer?.toSVGString?.() ?? "";
|
|
52427
|
+
}
|
|
52428
|
+
/**
|
|
52429
|
+
Returns the underlying canvas element of the most recent render when the
|
|
52430
|
+
canvas backend is active (`renderer("canvas")`), or `undefined` otherwise.
|
|
52431
|
+
Server-side callers cast this to their native canvas to encode a raster
|
|
52432
|
+
(see `@d3plus/ssr`).
|
|
52433
|
+
*/ toCanvas() {
|
|
52434
|
+
return this._renderer === "canvas" ? this._sceneRenderer?.toCanvas?.() : undefined;
|
|
52435
|
+
}
|
|
51899
52436
|
renderer(_) {
|
|
51900
52437
|
if (!arguments.length) return this._renderer;
|
|
51901
52438
|
this._renderer = _ === "canvas" ? "canvas" : "svg";
|
|
@@ -51959,10 +52496,14 @@
|
|
|
51959
52496
|
if (this._sceneRenderer && typeof this._sceneRenderer.destroy === "function") this._sceneRenderer.destroy();
|
|
51960
52497
|
const Ctor = kind === "canvas" ? CanvasRenderer : SvgRenderer;
|
|
51961
52498
|
this._sceneRenderer = new Ctor();
|
|
52499
|
+
// `_scenePixelRatio`, when set (e.g. by @d3plus/ssr for hi-res PNG output),
|
|
52500
|
+
// fixes the canvas backing-store scale; otherwise the renderer falls back
|
|
52501
|
+
// to `devicePixelRatio`.
|
|
51962
52502
|
this._sceneRenderer.mount({
|
|
51963
52503
|
container: mountTarget,
|
|
51964
52504
|
width: w,
|
|
51965
|
-
height: h
|
|
52505
|
+
height: h,
|
|
52506
|
+
pixelRatio: this._scenePixelRatio
|
|
51966
52507
|
});
|
|
51967
52508
|
// Bridge renderer pointer events → viz.schema.on handlers. Without this,
|
|
51968
52509
|
// tooltips never fire on the v4 scene-rendered path because
|
|
@@ -52046,6 +52587,25 @@
|
|
|
52046
52587
|
if (tlGroup) host.appendChild(tlGroup);
|
|
52047
52588
|
}
|
|
52048
52589
|
}
|
|
52590
|
+
/**
|
|
52591
|
+
Resolves the `(d, i, x)` a picked scene node reports to interaction
|
|
52592
|
+
handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw
|
|
52593
|
+
scene datum; for a Plot shape that's the wrapped record `{data, i}`, which
|
|
52594
|
+
handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that
|
|
52595
|
+
unwrap; Plot overrides this to report the point nearest the cursor for
|
|
52596
|
+
multi-point shapes (Line/Area) so a series tooltip reflects the hovered
|
|
52597
|
+
x rather than the whole-series aggregate.
|
|
52598
|
+
@private
|
|
52599
|
+
*/ _interactionDatum(pick, _event) {
|
|
52600
|
+
const rawDatum = pick.datum;
|
|
52601
|
+
const sourceDatum = rawDatum && rawDatum.data ? rawDatum.data : rawDatum;
|
|
52602
|
+
const sourceIndex = rawDatum && typeof rawDatum.i === "number" ? rawDatum.i : pick.index ?? 0;
|
|
52603
|
+
return {
|
|
52604
|
+
d: sourceDatum,
|
|
52605
|
+
i: sourceIndex,
|
|
52606
|
+
x: rawDatum
|
|
52607
|
+
};
|
|
52608
|
+
}
|
|
52049
52609
|
/**
|
|
52050
52610
|
Routes a renderer pointer event to the matching `viz.schema.on` handlers.
|
|
52051
52611
|
Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where
|
|
@@ -52117,12 +52677,12 @@
|
|
|
52117
52677
|
const isLegendNode = nodeAny.interactionGroup === "legend" || (target && typeof target.closest === "function" ? !!target.closest('[data-key="viz-legend"]') : false);
|
|
52118
52678
|
const suffix = isLegendNode ? "legend" : "shape";
|
|
52119
52679
|
const handlerKey = `${event.type}.${suffix}`;
|
|
52120
|
-
// Resolve the
|
|
52121
|
-
//
|
|
52122
|
-
//
|
|
52123
|
-
|
|
52124
|
-
|
|
52125
|
-
const
|
|
52680
|
+
// Resolve the datum + index this pick reports to handlers, ONCE, and reuse
|
|
52681
|
+
// it for every handler fired below so tooltip/click/user handlers agree on
|
|
52682
|
+
// which datum the pointer is over. The base unwraps the node's raw datum to
|
|
52683
|
+
// its source row; Plot overrides `_interactionDatum` to report the point
|
|
52684
|
+
// nearest the cursor for multi-point shapes (Line/Area).
|
|
52685
|
+
const { d: sourceDatum, i: sourceIndex, x: rawDatum } = this._interactionDatum(pick, event);
|
|
52126
52686
|
const shapeType = typeof nodeAny.shapeType === "string" ? nodeAny.shapeType : null;
|
|
52127
52687
|
this._lastScenePick = {
|
|
52128
52688
|
d: sourceDatum,
|
|
@@ -52168,7 +52728,7 @@
|
|
|
52168
52728
|
/**
|
|
52169
52729
|
Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
|
|
52170
52730
|
*/ destroy() {
|
|
52171
|
-
this._resizeObserver
|
|
52731
|
+
this._resizeObserver?.disconnect();
|
|
52172
52732
|
this._tooltipClass.data([]).render();
|
|
52173
52733
|
select("body").on(`touchstart.${this._uuid}`, null);
|
|
52174
52734
|
// Clear the visibility/resize/scroll poll timers + scroll listener
|
|
@@ -52189,7 +52749,7 @@
|
|
|
52189
52749
|
if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(this._sceneRepaintRAF);
|
|
52190
52750
|
this._sceneRepaintRAF = undefined;
|
|
52191
52751
|
}
|
|
52192
|
-
select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);
|
|
52752
|
+
if (this.schema.scrollContainer) select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);
|
|
52193
52753
|
// Destroy the active scene renderer (clears its own pointer-rect
|
|
52194
52754
|
// listeners, overlay host, canvas/svg DOM, timers).
|
|
52195
52755
|
if (this._sceneRenderer && typeof this._sceneRenderer.destroy === "function") {
|
|
@@ -52601,11 +53161,28 @@
|
|
|
52601
53161
|
};
|
|
52602
53162
|
|
|
52603
53163
|
/** d3-scale's scale constructors, indexed by the dynamic `scale<Type>` name. */ const scaleConstructors = scales;
|
|
53164
|
+
/**
|
|
53165
|
+
A plotted axis value that can't be turned into a pixel coordinate: a
|
|
53166
|
+
non-finite number (`NaN`/`±Infinity`), `null`, or the empty-array sentinel
|
|
53167
|
+
`merge` yields when a numeric column aggregates to no usable value. Any of
|
|
53168
|
+
these poisons the shape's transform or path `d` downstream — e.g.
|
|
53169
|
+
`translate(NaN,…)` or `…L268.75,NaN` — which the browser rejects. A bare
|
|
53170
|
+
`undefined` is NOT bad: it's how an unused secondary axis (x2/y2) reports
|
|
53171
|
+
"no value on this row".
|
|
53172
|
+
*/ const isBadAxisValue = (v)=>v === null || typeof v === "number" && !Number.isFinite(v) || Array.isArray(v) && v.length === 0;
|
|
53173
|
+
/**
|
|
53174
|
+
A formatted row is plottable when its x/y — and any *defined* x2/y2 — are
|
|
53175
|
+
real coordinates. Rows failing this are dropped in `formatPlotData` before
|
|
53176
|
+
domains, stacking, and paint ever read `_formattedData`, so a NaN measure
|
|
53177
|
+
no longer widens a domain, stacks as 0, or emits a broken coordinate.
|
|
53178
|
+
Resolves d3plus/d3plus#776.
|
|
53179
|
+
*/ const isPlottableRow = (d)=>!isBadAxisValue(d.x) && !isBadAxisValue(d.y) && (d.x2 === undefined || !isBadAxisValue(d.x2)) && (d.y2 === undefined || !isBadAxisValue(d.y2));
|
|
52604
53180
|
/**
|
|
52605
53181
|
`formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
|
|
52606
53182
|
time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
|
|
52607
53183
|
filtered data through `prepData` to produce the per-row PlotDatum shape
|
|
52608
|
-
(x/y/x2/y2 + id + group + shape + lci/hci + discrete),
|
|
53184
|
+
(x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose
|
|
53185
|
+
axis values can't be plotted (`isPlottableRow` — see #776), and constructs
|
|
52609
53186
|
the `_sizeScaleD3` if `_size` is set.
|
|
52610
53187
|
|
|
52611
53188
|
Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`
|
|
@@ -52646,8 +53223,8 @@
|
|
|
52646
53223
|
newD.id = newD.shape === "Bar" ? `${newD.id}_${newD[viz.schema.discrete]}` : newD.id;
|
|
52647
53224
|
return newD;
|
|
52648
53225
|
};
|
|
52649
|
-
const formattedData = viz._formattedData = viz._filteredData.map(prepData);
|
|
52650
|
-
const axisData = viz._axisPersist ? viz._data.map(prepData) : formattedData;
|
|
53226
|
+
const formattedData = viz._formattedData = viz._filteredData.map(prepData).filter(isPlottableRow);
|
|
53227
|
+
const axisData = viz._axisPersist ? viz._data.map(prepData).filter(isPlottableRow) : formattedData;
|
|
52651
53228
|
if (viz._size) {
|
|
52652
53229
|
const rExtent = extent$1(axisData, (d)=>viz._size(d.data));
|
|
52653
53230
|
viz._sizeScaleD3 = scaleConstructors[`scale${viz.schema.sizeScale.charAt(0).toUpperCase()}${viz.schema.sizeScale.slice(1)}`]().domain(rExtent).range([
|
|
@@ -54193,7 +54770,9 @@
|
|
|
54193
54770
|
areaConfig[`${key}0`] = (d)=>scaleFunction(confidence[0] ? d.lci : d[key]);
|
|
54194
54771
|
areaConfig[`${key}1`] = (d)=>scaleFunction(confidence[1] ? d.hci : d[key]);
|
|
54195
54772
|
const area = makeShape("Area").renderMode("compute").config(areaConfig).data(values);
|
|
54196
|
-
|
|
54773
|
+
// Fresh object — must NOT mutate the shared `shapeConfig`, or the confidence
|
|
54774
|
+
// fill/fillOpacity leak onto every other shape and every later render.
|
|
54775
|
+
const confidenceConfig = Object.assign({}, viz.schema.shapeConfig, viz._confidenceConfig);
|
|
54197
54776
|
area.config(assign(shapeConfigFor(viz, "Line", confidenceConfig), shapeConfigFor(viz, "Area", confidenceConfig))).render();
|
|
54198
54777
|
out.push(...collectComputed(area));
|
|
54199
54778
|
}
|
|
@@ -55002,6 +55581,53 @@
|
|
|
55002
55581
|
for (const evt of shapeEvents)shape.on(evt, forward(evt));
|
|
55003
55582
|
for (const evt of classEvents)shape.on(evt, forward(evt));
|
|
55004
55583
|
}
|
|
55584
|
+
/**
|
|
55585
|
+
For a multi-point shape (Line/Area) reports the point nearest the cursor
|
|
55586
|
+
along the discrete axis, so every mouse event (tooltip, click, user
|
|
55587
|
+
handlers) reflects the hovered x rather than the whole-series aggregate.
|
|
55588
|
+
Non-nested shapes and legend swatches fall through to the base (aggregate)
|
|
55589
|
+
behavior.
|
|
55590
|
+
@private
|
|
55591
|
+
*/ _interactionDatum(pick, event) {
|
|
55592
|
+
const node = pick.node;
|
|
55593
|
+
const points = node && node.interactionPoints;
|
|
55594
|
+
if (node && node.interactionGroup !== "legend" && Array.isArray(points) && points.length && event && Array.isArray(event.point)) {
|
|
55595
|
+
const nearest = this._nearestInteractionPoint(points, event.point);
|
|
55596
|
+
if (nearest) {
|
|
55597
|
+
const wrapped = nearest.datum;
|
|
55598
|
+
return {
|
|
55599
|
+
d: wrapped && wrapped.data ? wrapped.data : wrapped,
|
|
55600
|
+
i: typeof wrapped.i === "number" ? wrapped.i : nearest.index,
|
|
55601
|
+
x: wrapped
|
|
55602
|
+
};
|
|
55603
|
+
}
|
|
55604
|
+
}
|
|
55605
|
+
return super._interactionDatum(pick, event);
|
|
55606
|
+
}
|
|
55607
|
+
/**
|
|
55608
|
+
Picks the interaction point closest to a surface-local cursor position
|
|
55609
|
+
along the discrete axis. `event.point` is post-zoom surface space while the
|
|
55610
|
+
points are in pre-zoom content space (they live under the `viz-zoom`
|
|
55611
|
+
group), so the cursor is un-zoomed by `_zoomTransform` before comparing.
|
|
55612
|
+
@private
|
|
55613
|
+
*/ _nearestInteractionPoint(points, point) {
|
|
55614
|
+
const t = this._zoomTransform;
|
|
55615
|
+
const scale = t && t.scale ? t.scale : 1;
|
|
55616
|
+
const cx = (point[0] - (t ? t.x : 0)) / scale;
|
|
55617
|
+
const cy = (point[1] - (t ? t.y : 0)) / scale;
|
|
55618
|
+
const axis = this.schema.discrete === "y" ? "y" : "x";
|
|
55619
|
+
const target = axis === "y" ? cy : cx;
|
|
55620
|
+
let best = null;
|
|
55621
|
+
let bestDist = Infinity;
|
|
55622
|
+
for (const p of points){
|
|
55623
|
+
const dist = Math.abs(p[axis] - target);
|
|
55624
|
+
if (dist < bestDist) {
|
|
55625
|
+
bestDist = dist;
|
|
55626
|
+
best = p;
|
|
55627
|
+
}
|
|
55628
|
+
}
|
|
55629
|
+
return best;
|
|
55630
|
+
}
|
|
55005
55631
|
/**
|
|
55006
55632
|
Extends the draw behavior of the abstract Viz class.
|
|
55007
55633
|
@private
|
|
@@ -55249,9 +55875,14 @@
|
|
|
55249
55875
|
Line: false
|
|
55250
55876
|
});
|
|
55251
55877
|
this._confidenceConfig = {
|
|
55878
|
+
// A line's colour is its stroke, so the confidence band fills with that
|
|
55879
|
+
// same colour (at the reduced opacity below). Prefer a per-Line stroke
|
|
55880
|
+
// override, else the shared stroke accessor (the Line config itself sets
|
|
55881
|
+
// no `stroke` — the colour comes from the top-level `shapeConfig.stroke`).
|
|
55252
55882
|
fill: (d, i)=>{
|
|
55253
|
-
const
|
|
55254
|
-
|
|
55883
|
+
const { Line, stroke } = this.schema.shapeConfig;
|
|
55884
|
+
const s = Line && Line.stroke !== undefined ? Line.stroke : stroke;
|
|
55885
|
+
return typeof s === "function" ? s(d, i) : s;
|
|
55255
55886
|
},
|
|
55256
55887
|
fillOpacity: constant$b(0.5)
|
|
55257
55888
|
};
|
|
@@ -68570,10 +69201,12 @@
|
|
|
68570
69201
|
const c = viz.ctx.geomapCtx;
|
|
68571
69202
|
if (!c) return [];
|
|
68572
69203
|
const out = [];
|
|
68573
|
-
//
|
|
68574
|
-
// (
|
|
68575
|
-
//
|
|
68576
|
-
|
|
69204
|
+
// The ocean rect and basemap tiles normally live in the imperative geomap
|
|
69205
|
+
// <svg> (`_container`), outside the scene graph. That's fine on-screen, but a
|
|
69206
|
+
// server render serializes only the scene, so under SSR (`viz._ssr`) — and on
|
|
69207
|
+
// the canvas backend, whose compute <svg> keeps its ocean transparent — paint
|
|
69208
|
+
// them into the scene here, beneath the geography, so the output is complete.
|
|
69209
|
+
if (viz._renderer === "canvas" || viz._ssr) {
|
|
68577
69210
|
const ocean = viz.schema.ocean;
|
|
68578
69211
|
if (ocean && ocean !== "transparent") {
|
|
68579
69212
|
const { width, height } = chartBounds(viz);
|
|
@@ -68590,6 +69223,27 @@
|
|
|
68590
69223
|
});
|
|
68591
69224
|
}
|
|
68592
69225
|
}
|
|
69226
|
+
// Basemap tiles, pre-fetched + inlined as data URIs by @d3plus/ssr. Placed
|
|
69227
|
+
// above the ocean and below the geography, at the positions `_computeTileList`
|
|
69228
|
+
// derives from the fitted projection (same math as the live `_renderTiles`).
|
|
69229
|
+
const ssrTiles = viz._ssrTiles;
|
|
69230
|
+
if (ssrTiles && ssrTiles.size && typeof viz._computeTileList === "function") {
|
|
69231
|
+
for (const t of viz._computeTileList()){
|
|
69232
|
+
const href = ssrTiles.get(t.key);
|
|
69233
|
+
if (!href) continue;
|
|
69234
|
+
out.push({
|
|
69235
|
+
type: "image",
|
|
69236
|
+
key: `geomap-tile-${t.key}`,
|
|
69237
|
+
x: t.x,
|
|
69238
|
+
y: t.y,
|
|
69239
|
+
width: t.size,
|
|
69240
|
+
height: t.size,
|
|
69241
|
+
href,
|
|
69242
|
+
preserveAspectRatio: "none",
|
|
69243
|
+
interactive: false
|
|
69244
|
+
});
|
|
69245
|
+
}
|
|
69246
|
+
}
|
|
68593
69247
|
if (c.topoData && c.topoData.length) {
|
|
68594
69248
|
const pathConfig = shapeConfigFor(viz, "Path");
|
|
68595
69249
|
for(let i = 0; i < c.topoData.length; i++){
|
|
@@ -68662,6 +69316,11 @@
|
|
|
68662
69316
|
/** Installs `_renderTiles`, the per-instance method that mutates the tile group. */ function setupGeomapRenderTiles(viz) {
|
|
68663
69317
|
// `_renderTiles` is a per-instance method that mutates the tile group.
|
|
68664
69318
|
viz._renderTiles = function(transform = transform$2((this._zoomEventTarget || this._container).node()), duration = 0) {
|
|
69319
|
+
// Under SSR the basemap is composited into the scene graph (see geomapEmit +
|
|
69320
|
+
// `_computeTileList`), so skip the imperative <image> tile layer entirely.
|
|
69321
|
+
// It wouldn't be serialized anyway, and its transform transition relies on
|
|
69322
|
+
// SVGGElement.transform.baseVal, which headless DOMs don't implement.
|
|
69323
|
+
if (this._ssr) return;
|
|
68665
69324
|
let tileData = [];
|
|
68666
69325
|
if (this.schema.tiles) {
|
|
68667
69326
|
tileData = this._tileGen.extent(this._zoomBehavior.translateExtent()).scale(this.schema.projection.scale() * (2 * Math.PI) * transform.k).translate(transform.apply(this.schema.projection.translate()))();
|
|
@@ -68678,6 +69337,23 @@
|
|
|
68678
69337
|
"c"
|
|
68679
69338
|
][Math.random() * 3 | 0]).replace("{z}", `${z}`).replace("{x}", `${x}`).replace("{y}", `${y}`)).attr("x", ([x])=>x * scale + tileData.translate[0] * scale - transform.x / transform.k).attr("y", ([, y])=>y * scale + tileData.translate[1] * scale - transform.y / transform.k);
|
|
68680
69339
|
};
|
|
69340
|
+
// Static (identity-transform) tile list for server-side rendering: the tile
|
|
69341
|
+
// URLs + their positions in projection pixel space, so @d3plus/ssr can fetch
|
|
69342
|
+
// them and geomapEmit can place them as scene image nodes (both SVG string and
|
|
69343
|
+
// canvas output then include the basemap, with no network at view time).
|
|
69344
|
+
// Deterministic `{s}` = "a" so tiles are cacheable across renders.
|
|
69345
|
+
viz._computeTileList = function() {
|
|
69346
|
+
if (!this.schema.tiles) return [];
|
|
69347
|
+
const tileData = this._tileGen.extent(this._zoomBehavior.translateExtent()).scale(this.schema.projection.scale() * (2 * Math.PI)).translate(this.schema.projection.translate())();
|
|
69348
|
+
const size = tileData.scale;
|
|
69349
|
+
return tileData.map(([x, y, z])=>({
|
|
69350
|
+
key: `${x}-${y}-${z}`,
|
|
69351
|
+
url: this.schema.tileUrl.replace("{s}", "a").replace("{z}", `${z}`).replace("{x}", `${x}`).replace("{y}", `${y}`),
|
|
69352
|
+
x: x * size + tileData.translate[0] * size,
|
|
69353
|
+
y: y * size + tileData.translate[1] * size,
|
|
69354
|
+
size
|
|
69355
|
+
}));
|
|
69356
|
+
};
|
|
68681
69357
|
}
|
|
68682
69358
|
/** Wraps `_draw` to ensure the DOM zoom group + zoom wiring exist before drawing. */ function setupGeomapDraw(viz) {
|
|
68683
69359
|
// Wrap _draw to ensure DOM zoom group + zoom wiring.
|
|
@@ -68749,7 +69425,10 @@
|
|
|
68749
69425
|
const supDrawScene = viz._drawSceneToTarget.bind(viz);
|
|
68750
69426
|
viz._drawSceneToTarget = function(durationOverride) {
|
|
68751
69427
|
supDrawScene(durationOverride);
|
|
68752
|
-
if (viz._renderer === "canvas" &&
|
|
69428
|
+
if (viz._renderer === "canvas" && // Under SSR the canvas is a headless native surface with no
|
|
69429
|
+
// addEventListener; there is no interaction to wire, so skip the
|
|
69430
|
+
// pointer/zoom rebind entirely.
|
|
69431
|
+
!viz._ssr && viz._sceneRenderer && typeof viz._sceneRenderer.toCanvas === "function") {
|
|
68753
69432
|
const canvasNode = viz._sceneRenderer.toCanvas();
|
|
68754
69433
|
if (canvasNode) {
|
|
68755
69434
|
// The compute svg is absolutely positioned over the canvas; an svg root
|