@opendata-ai/openchart-vanilla 8.2.1 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ import {
15
15
  renderSingleMark,
16
16
  resolveMarkFill,
17
17
  stampAnimationVars
18
- } from "./chunk-XOZ6AM7C.js";
18
+ } from "./chunk-2CEKMIJH.js";
19
19
  import {
20
20
  SVG_NS,
21
21
  createSVGElement,
@@ -26,6 +26,7 @@ import {
26
26
  var DEBOUNCE_MS = 16;
27
27
  function observeResize(container, callback) {
28
28
  let timeoutId = null;
29
+ let lastDelivered = null;
29
30
  const observer = new ResizeObserver((entries) => {
30
31
  if (timeoutId !== null) {
31
32
  clearTimeout(timeoutId);
@@ -33,6 +34,10 @@ function observeResize(container, callback) {
33
34
  timeoutId = setTimeout(() => {
34
35
  for (const entry of entries) {
35
36
  const { width, height } = entry.contentRect;
37
+ if (lastDelivered && lastDelivered.width === width && lastDelivered.height === height) {
38
+ continue;
39
+ }
40
+ lastDelivered = { width, height };
36
41
  callback(width, height);
37
42
  }
38
43
  timeoutId = null;
@@ -959,490 +964,12 @@ import { buildAreaPath as buildAreaPath2, buildLinePath as buildLinePath2, EXIT_
959
964
  // src/transition/apply.ts
960
965
  import { buildArcPath } from "@opendata-ai/openchart-engine";
961
966
 
962
- // ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/define.js
963
- function define_default(constructor, factory, prototype) {
964
- constructor.prototype = factory.prototype = prototype;
965
- prototype.constructor = constructor;
966
- }
967
- function extend(parent, definition) {
968
- var prototype = Object.create(parent.prototype);
969
- for (var key in definition) prototype[key] = definition[key];
970
- return prototype;
971
- }
972
-
973
- // ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/color.js
974
- function Color() {
975
- }
976
- var darker = 0.7;
977
- var brighter = 1 / darker;
978
- var reI = "\\s*([+-]?\\d+)\\s*";
979
- var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
980
- var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
981
- var reHex = /^#([0-9a-f]{3,8})$/;
982
- var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
983
- var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
984
- var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
985
- var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
986
- var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
987
- var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
988
- var named = {
989
- aliceblue: 15792383,
990
- antiquewhite: 16444375,
991
- aqua: 65535,
992
- aquamarine: 8388564,
993
- azure: 15794175,
994
- beige: 16119260,
995
- bisque: 16770244,
996
- black: 0,
997
- blanchedalmond: 16772045,
998
- blue: 255,
999
- blueviolet: 9055202,
1000
- brown: 10824234,
1001
- burlywood: 14596231,
1002
- cadetblue: 6266528,
1003
- chartreuse: 8388352,
1004
- chocolate: 13789470,
1005
- coral: 16744272,
1006
- cornflowerblue: 6591981,
1007
- cornsilk: 16775388,
1008
- crimson: 14423100,
1009
- cyan: 65535,
1010
- darkblue: 139,
1011
- darkcyan: 35723,
1012
- darkgoldenrod: 12092939,
1013
- darkgray: 11119017,
1014
- darkgreen: 25600,
1015
- darkgrey: 11119017,
1016
- darkkhaki: 12433259,
1017
- darkmagenta: 9109643,
1018
- darkolivegreen: 5597999,
1019
- darkorange: 16747520,
1020
- darkorchid: 10040012,
1021
- darkred: 9109504,
1022
- darksalmon: 15308410,
1023
- darkseagreen: 9419919,
1024
- darkslateblue: 4734347,
1025
- darkslategray: 3100495,
1026
- darkslategrey: 3100495,
1027
- darkturquoise: 52945,
1028
- darkviolet: 9699539,
1029
- deeppink: 16716947,
1030
- deepskyblue: 49151,
1031
- dimgray: 6908265,
1032
- dimgrey: 6908265,
1033
- dodgerblue: 2003199,
1034
- firebrick: 11674146,
1035
- floralwhite: 16775920,
1036
- forestgreen: 2263842,
1037
- fuchsia: 16711935,
1038
- gainsboro: 14474460,
1039
- ghostwhite: 16316671,
1040
- gold: 16766720,
1041
- goldenrod: 14329120,
1042
- gray: 8421504,
1043
- green: 32768,
1044
- greenyellow: 11403055,
1045
- grey: 8421504,
1046
- honeydew: 15794160,
1047
- hotpink: 16738740,
1048
- indianred: 13458524,
1049
- indigo: 4915330,
1050
- ivory: 16777200,
1051
- khaki: 15787660,
1052
- lavender: 15132410,
1053
- lavenderblush: 16773365,
1054
- lawngreen: 8190976,
1055
- lemonchiffon: 16775885,
1056
- lightblue: 11393254,
1057
- lightcoral: 15761536,
1058
- lightcyan: 14745599,
1059
- lightgoldenrodyellow: 16448210,
1060
- lightgray: 13882323,
1061
- lightgreen: 9498256,
1062
- lightgrey: 13882323,
1063
- lightpink: 16758465,
1064
- lightsalmon: 16752762,
1065
- lightseagreen: 2142890,
1066
- lightskyblue: 8900346,
1067
- lightslategray: 7833753,
1068
- lightslategrey: 7833753,
1069
- lightsteelblue: 11584734,
1070
- lightyellow: 16777184,
1071
- lime: 65280,
1072
- limegreen: 3329330,
1073
- linen: 16445670,
1074
- magenta: 16711935,
1075
- maroon: 8388608,
1076
- mediumaquamarine: 6737322,
1077
- mediumblue: 205,
1078
- mediumorchid: 12211667,
1079
- mediumpurple: 9662683,
1080
- mediumseagreen: 3978097,
1081
- mediumslateblue: 8087790,
1082
- mediumspringgreen: 64154,
1083
- mediumturquoise: 4772300,
1084
- mediumvioletred: 13047173,
1085
- midnightblue: 1644912,
1086
- mintcream: 16121850,
1087
- mistyrose: 16770273,
1088
- moccasin: 16770229,
1089
- navajowhite: 16768685,
1090
- navy: 128,
1091
- oldlace: 16643558,
1092
- olive: 8421376,
1093
- olivedrab: 7048739,
1094
- orange: 16753920,
1095
- orangered: 16729344,
1096
- orchid: 14315734,
1097
- palegoldenrod: 15657130,
1098
- palegreen: 10025880,
1099
- paleturquoise: 11529966,
1100
- palevioletred: 14381203,
1101
- papayawhip: 16773077,
1102
- peachpuff: 16767673,
1103
- peru: 13468991,
1104
- pink: 16761035,
1105
- plum: 14524637,
1106
- powderblue: 11591910,
1107
- purple: 8388736,
1108
- rebeccapurple: 6697881,
1109
- red: 16711680,
1110
- rosybrown: 12357519,
1111
- royalblue: 4286945,
1112
- saddlebrown: 9127187,
1113
- salmon: 16416882,
1114
- sandybrown: 16032864,
1115
- seagreen: 3050327,
1116
- seashell: 16774638,
1117
- sienna: 10506797,
1118
- silver: 12632256,
1119
- skyblue: 8900331,
1120
- slateblue: 6970061,
1121
- slategray: 7372944,
1122
- slategrey: 7372944,
1123
- snow: 16775930,
1124
- springgreen: 65407,
1125
- steelblue: 4620980,
1126
- tan: 13808780,
1127
- teal: 32896,
1128
- thistle: 14204888,
1129
- tomato: 16737095,
1130
- turquoise: 4251856,
1131
- violet: 15631086,
1132
- wheat: 16113331,
1133
- white: 16777215,
1134
- whitesmoke: 16119285,
1135
- yellow: 16776960,
1136
- yellowgreen: 10145074
1137
- };
1138
- define_default(Color, color, {
1139
- copy(channels) {
1140
- return Object.assign(new this.constructor(), this, channels);
1141
- },
1142
- displayable() {
1143
- return this.rgb().displayable();
1144
- },
1145
- hex: color_formatHex,
1146
- // Deprecated! Use color.formatHex.
1147
- formatHex: color_formatHex,
1148
- formatHex8: color_formatHex8,
1149
- formatHsl: color_formatHsl,
1150
- formatRgb: color_formatRgb,
1151
- toString: color_formatRgb
1152
- });
1153
- function color_formatHex() {
1154
- return this.rgb().formatHex();
1155
- }
1156
- function color_formatHex8() {
1157
- return this.rgb().formatHex8();
1158
- }
1159
- function color_formatHsl() {
1160
- return hslConvert(this).formatHsl();
1161
- }
1162
- function color_formatRgb() {
1163
- return this.rgb().formatRgb();
1164
- }
1165
- function color(format) {
1166
- var m, l;
1167
- format = (format + "").trim().toLowerCase();
1168
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
1169
- }
1170
- function rgbn(n) {
1171
- return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
1172
- }
1173
- function rgba(r, g, b, a) {
1174
- if (a <= 0) r = g = b = NaN;
1175
- return new Rgb(r, g, b, a);
1176
- }
1177
- function rgbConvert(o) {
1178
- if (!(o instanceof Color)) o = color(o);
1179
- if (!o) return new Rgb();
1180
- o = o.rgb();
1181
- return new Rgb(o.r, o.g, o.b, o.opacity);
1182
- }
1183
- function rgb(r, g, b, opacity) {
1184
- return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
1185
- }
1186
- function Rgb(r, g, b, opacity) {
1187
- this.r = +r;
1188
- this.g = +g;
1189
- this.b = +b;
1190
- this.opacity = +opacity;
1191
- }
1192
- define_default(Rgb, rgb, extend(Color, {
1193
- brighter(k) {
1194
- k = k == null ? brighter : Math.pow(brighter, k);
1195
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
1196
- },
1197
- darker(k) {
1198
- k = k == null ? darker : Math.pow(darker, k);
1199
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
1200
- },
1201
- rgb() {
1202
- return this;
1203
- },
1204
- clamp() {
1205
- return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
1206
- },
1207
- displayable() {
1208
- return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
1209
- },
1210
- hex: rgb_formatHex,
1211
- // Deprecated! Use color.formatHex.
1212
- formatHex: rgb_formatHex,
1213
- formatHex8: rgb_formatHex8,
1214
- formatRgb: rgb_formatRgb,
1215
- toString: rgb_formatRgb
1216
- }));
1217
- function rgb_formatHex() {
1218
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
1219
- }
1220
- function rgb_formatHex8() {
1221
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1222
- }
1223
- function rgb_formatRgb() {
1224
- const a = clampa(this.opacity);
1225
- return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
1226
- }
1227
- function clampa(opacity) {
1228
- return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
1229
- }
1230
- function clampi(value) {
1231
- return Math.max(0, Math.min(255, Math.round(value) || 0));
1232
- }
1233
- function hex(value) {
1234
- value = clampi(value);
1235
- return (value < 16 ? "0" : "") + value.toString(16);
1236
- }
1237
- function hsla(h, s, l, a) {
1238
- if (a <= 0) h = s = l = NaN;
1239
- else if (l <= 0 || l >= 1) h = s = NaN;
1240
- else if (s <= 0) h = NaN;
1241
- return new Hsl(h, s, l, a);
1242
- }
1243
- function hslConvert(o) {
1244
- if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
1245
- if (!(o instanceof Color)) o = color(o);
1246
- if (!o) return new Hsl();
1247
- if (o instanceof Hsl) return o;
1248
- o = o.rgb();
1249
- var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
1250
- if (s) {
1251
- if (r === max) h = (g - b) / s + (g < b) * 6;
1252
- else if (g === max) h = (b - r) / s + 2;
1253
- else h = (r - g) / s + 4;
1254
- s /= l < 0.5 ? max + min : 2 - max - min;
1255
- h *= 60;
1256
- } else {
1257
- s = l > 0 && l < 1 ? 0 : h;
1258
- }
1259
- return new Hsl(h, s, l, o.opacity);
1260
- }
1261
- function hsl(h, s, l, opacity) {
1262
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
1263
- }
1264
- function Hsl(h, s, l, opacity) {
1265
- this.h = +h;
1266
- this.s = +s;
1267
- this.l = +l;
1268
- this.opacity = +opacity;
1269
- }
1270
- define_default(Hsl, hsl, extend(Color, {
1271
- brighter(k) {
1272
- k = k == null ? brighter : Math.pow(brighter, k);
1273
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
1274
- },
1275
- darker(k) {
1276
- k = k == null ? darker : Math.pow(darker, k);
1277
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
1278
- },
1279
- rgb() {
1280
- var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
1281
- return new Rgb(
1282
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
1283
- hsl2rgb(h, m1, m2),
1284
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
1285
- this.opacity
1286
- );
1287
- },
1288
- clamp() {
1289
- return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
1290
- },
1291
- displayable() {
1292
- return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
1293
- },
1294
- formatHsl() {
1295
- const a = clampa(this.opacity);
1296
- return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
1297
- }
1298
- }));
1299
- function clamph(value) {
1300
- value = (value || 0) % 360;
1301
- return value < 0 ? value + 360 : value;
1302
- }
1303
- function clampt(value) {
1304
- return Math.max(0, Math.min(1, value || 0));
1305
- }
1306
- function hsl2rgb(h, m1, m2) {
1307
- return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
1308
- }
1309
-
1310
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js
1311
- function basis(t1, v0, v1, v2, v3) {
1312
- var t2 = t1 * t1, t3 = t2 * t1;
1313
- return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
1314
- }
1315
- function basis_default(values) {
1316
- var n = values.length - 1;
1317
- return function(t) {
1318
- var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
1319
- return basis((t - i / n) * n, v0, v1, v2, v3);
1320
- };
1321
- }
1322
-
1323
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js
1324
- function basisClosed_default(values) {
1325
- var n = values.length;
1326
- return function(t) {
1327
- var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];
1328
- return basis((t - i / n) * n, v0, v1, v2, v3);
1329
- };
1330
- }
1331
-
1332
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js
1333
- var constant_default = (x) => () => x;
1334
-
1335
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js
1336
- function linear2(a, d) {
1337
- return function(t) {
1338
- return a + t * d;
1339
- };
1340
- }
1341
- function exponential(a, b, y) {
1342
- return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
1343
- return Math.pow(a + t * b, y);
1344
- };
1345
- }
1346
- function gamma(y) {
1347
- return (y = +y) === 1 ? nogamma : function(a, b) {
1348
- return b - a ? exponential(a, b, y) : constant_default(isNaN(a) ? b : a);
1349
- };
1350
- }
1351
- function nogamma(a, b) {
1352
- var d = b - a;
1353
- return d ? linear2(a, d) : constant_default(isNaN(a) ? b : a);
1354
- }
1355
-
1356
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js
1357
- var rgb_default = (function rgbGamma(y) {
1358
- var color2 = gamma(y);
1359
- function rgb2(start, end) {
1360
- var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
1361
- return function(t) {
1362
- start.r = r(t);
1363
- start.g = g(t);
1364
- start.b = b(t);
1365
- start.opacity = opacity(t);
1366
- return start + "";
1367
- };
1368
- }
1369
- rgb2.gamma = rgbGamma;
1370
- return rgb2;
1371
- })(1);
1372
- function rgbSpline(spline) {
1373
- return function(colors) {
1374
- var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;
1375
- for (i = 0; i < n; ++i) {
1376
- color2 = rgb(colors[i]);
1377
- r[i] = color2.r || 0;
1378
- g[i] = color2.g || 0;
1379
- b[i] = color2.b || 0;
1380
- }
1381
- r = spline(r);
1382
- g = spline(g);
1383
- b = spline(b);
1384
- color2.opacity = 1;
1385
- return function(t) {
1386
- color2.r = r(t);
1387
- color2.g = g(t);
1388
- color2.b = b(t);
1389
- return color2 + "";
1390
- };
1391
- };
1392
- }
1393
- var rgbBasis = rgbSpline(basis_default);
1394
- var rgbBasisClosed = rgbSpline(basisClosed_default);
1395
-
1396
- // ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/zoom.js
1397
- var epsilon2 = 1e-12;
1398
- function cosh(x) {
1399
- return ((x = Math.exp(x)) + 1 / x) / 2;
1400
- }
1401
- function sinh(x) {
1402
- return ((x = Math.exp(x)) - 1 / x) / 2;
1403
- }
1404
- function tanh(x) {
1405
- return ((x = Math.exp(2 * x)) - 1) / (x + 1);
1406
- }
1407
- var zoom_default = (function zoomRho(rho, rho2, rho4) {
1408
- function zoom(p0, p1) {
1409
- var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;
1410
- if (d2 < epsilon2) {
1411
- S = Math.log(w1 / w0) / rho;
1412
- i = function(t) {
1413
- return [
1414
- ux0 + t * dx,
1415
- uy0 + t * dy,
1416
- w0 * Math.exp(rho * t * S)
1417
- ];
1418
- };
1419
- } else {
1420
- var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
1421
- S = (r1 - r0) / rho;
1422
- i = function(t) {
1423
- var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
1424
- return [
1425
- ux0 + u * dx,
1426
- uy0 + u * dy,
1427
- w0 * coshr0 / cosh(rho * s + r0)
1428
- ];
1429
- };
1430
- }
1431
- i.duration = S * 1e3 * rho / Math.SQRT2;
1432
- return i;
1433
- }
1434
- zoom.rho = function(_) {
1435
- var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
1436
- return zoomRho(_1, _2, _4);
1437
- };
1438
- return zoom;
1439
- })(Math.SQRT2, 2, 4);
1440
-
1441
967
  // src/transition/canvas-tweens.ts
1442
968
  import { serializeKeyValue as serializeKeyValue2 } from "@opendata-ai/openchart-engine";
1443
969
 
1444
970
  // src/transition/chrome-tweens.ts
1445
971
  import { serializeKeyValue } from "@opendata-ai/openchart-engine";
972
+ import { interpolateRgb } from "d3-interpolate";
1446
973
  function markShapeElement(el, attr) {
1447
974
  if (el.tagName === "circle" || el.tagName === "rect" || el.tagName === "path") return el;
1448
975
  if (attr === "stroke") {
@@ -1476,7 +1003,8 @@ function buildColorTweens(prevLayout, nextLayout, dom, tweens) {
1476
1003
  el: markShapeElement(group, attr),
1477
1004
  attr,
1478
1005
  from,
1479
- to
1006
+ to,
1007
+ interpolator: interpolateRgb(from, to)
1480
1008
  });
1481
1009
  }
1482
1010
  }
@@ -1524,9 +1052,13 @@ function buildAxisTweens(svg, prevLayout, nextLayout, tweens, ghosts) {
1524
1052
  }
1525
1053
  function computeGridlineDeltas(prevAxis, nextAxis) {
1526
1054
  const byValue = (axis) => {
1055
+ const glByPosition = /* @__PURE__ */ new Map();
1056
+ for (const g of axis.gridlines) {
1057
+ if (!glByPosition.has(g.position)) glByPosition.set(g.position, g);
1058
+ }
1527
1059
  const map = /* @__PURE__ */ new Map();
1528
1060
  for (const tick of axis.ticks) {
1529
- const matching = axis.gridlines.find((g) => g.position === tick.position);
1061
+ const matching = glByPosition.get(tick.position);
1530
1062
  if (matching) map.set(serializeKeyValue(tick.value), matching.position);
1531
1063
  }
1532
1064
  return map;
@@ -1581,9 +1113,14 @@ function buildSingleAxisTweens(svg, prevAxis, nextAxis, orientation, layout, twe
1581
1113
  });
1582
1114
  }
1583
1115
  }
1116
+ const prevTickByKey = /* @__PURE__ */ new Map();
1117
+ for (const t of prevAxis.ticks) {
1118
+ const k = serializeKeyValue(t.value);
1119
+ if (!prevTickByKey.has(k)) prevTickByKey.set(k, t);
1120
+ }
1584
1121
  for (const [key, prevPos] of prevTickMap) {
1585
1122
  if (nextTickMap.has(key)) continue;
1586
- const prevTick = prevAxis.ticks.find((t) => serializeKeyValue(t.value) === key);
1123
+ const prevTick = prevTickByKey.get(key);
1587
1124
  if (!prevTick) continue;
1588
1125
  const ghost = document.createElementNS("http://www.w3.org/2000/svg", "text");
1589
1126
  ghost.setAttribute("class", "oc-axis-tick oc-ghost");
@@ -1893,13 +1430,25 @@ import { buildAreaPath, buildLinePath } from "@opendata-ai/openchart-engine";
1893
1430
  function geomFromMark(m) {
1894
1431
  return { x: m.x, y: m.y, width: m.width, height: m.height };
1895
1432
  }
1896
- function applyGeomToElement(el, geom, mark) {
1897
- const shapeEl = el.querySelector("rect, path");
1433
+ function resolveRectShapeElement(el) {
1434
+ return el.querySelector("rect, path");
1435
+ }
1436
+ function applyGeomToElement(el, geom, mark, cachedShapeEl, scratch) {
1437
+ const shapeEl = cachedShapeEl !== void 0 ? cachedShapeEl : resolveRectShapeElement(el);
1898
1438
  if (!shapeEl) return;
1899
1439
  const sides = mark.cornerRadiusSides;
1900
1440
  const partialCorners = !!sides && (!sides.tl || !sides.tr || !sides.br || !sides.bl) && !!mark.cornerRadius;
1901
1441
  if (partialCorners && shapeEl.tagName === "path") {
1902
- const tempMark = { ...mark, ...geom };
1442
+ let tempMark;
1443
+ if (scratch) {
1444
+ scratch.x = geom.x;
1445
+ scratch.y = geom.y;
1446
+ scratch.width = geom.width;
1447
+ scratch.height = geom.height;
1448
+ tempMark = scratch;
1449
+ } else {
1450
+ tempMark = { ...mark, ...geom };
1451
+ }
1903
1452
  shapeEl.setAttribute("d", rectPathWithCorners(tempMark, sides));
1904
1453
  } else {
1905
1454
  shapeEl.setAttribute("x", String(geom.x));
@@ -2097,26 +1646,38 @@ function findRemovalPosition(key, merged, mergedIndex, prevByKey, nextByKey, pre
2097
1646
  }
2098
1647
  return prevPt;
2099
1648
  }
2100
- function interpolatePoints(fromPts, toPts, t) {
1649
+ function interpolatePoints(fromPts, toPts, t, out) {
2101
1650
  const len = Math.min(fromPts.length, toPts.length);
2102
- const result = new Array(len);
1651
+ const result = out ?? new Array(len);
2103
1652
  for (let i = 0; i < len; i++) {
2104
- result[i] = lerpPoint(fromPts[i], toPts[i], t);
1653
+ const from = fromPts[i];
1654
+ const to = toPts[i];
1655
+ const existing = result[i];
1656
+ if (existing) {
1657
+ existing.x = from.x + (to.x - from.x) * t;
1658
+ existing.y = from.y + (to.y - from.y) * t;
1659
+ } else {
1660
+ result[i] = lerpPoint(from, to, t);
1661
+ }
2105
1662
  }
1663
+ if (result.length !== len) result.length = len;
2106
1664
  return result;
2107
1665
  }
2108
- function applyLinePath(el, points, interpolate) {
2109
- const pathEl = el.querySelector("path");
1666
+ function applyLinePath(el, points, interpolate, cachedPathEl) {
1667
+ const pathEl = cachedPathEl !== void 0 ? cachedPathEl : el.querySelector("path");
2110
1668
  if (!pathEl) return;
2111
1669
  pathEl.setAttribute("d", buildLinePath(points, interpolate));
2112
1670
  }
2113
- function applyAreaPaths(el, topPoints, bottomPoints, interpolate, hasStroke) {
2114
- const paths = el.querySelectorAll("path");
2115
- if (paths[0]) {
2116
- paths[0].setAttribute("d", buildAreaPath(topPoints, bottomPoints, interpolate));
1671
+ function applyAreaPaths(el, topPoints, bottomPoints, interpolate, hasStroke, cachedFillPathEl, cachedTopPathEl) {
1672
+ const fillPathEl = cachedFillPathEl !== void 0 ? cachedFillPathEl : el.querySelectorAll("path")[0] ?? null;
1673
+ if (fillPathEl) {
1674
+ fillPathEl.setAttribute("d", buildAreaPath(topPoints, bottomPoints, interpolate));
2117
1675
  }
2118
- if (hasStroke && paths[1]) {
2119
- paths[1].setAttribute("d", buildLinePath(topPoints, interpolate));
1676
+ if (hasStroke) {
1677
+ const topPathEl = cachedTopPathEl !== void 0 ? cachedTopPathEl : el.querySelectorAll("path")[1] ?? null;
1678
+ if (topPathEl) {
1679
+ topPathEl.setAttribute("d", buildLinePath(topPoints, interpolate));
1680
+ }
2120
1681
  }
2121
1682
  }
2122
1683
  function applyFinalLinePath(el, mark) {
@@ -2161,6 +1722,9 @@ function getKeyForTween(tw) {
2161
1722
  function resolveLineElement(el) {
2162
1723
  return el.tagName === "line" ? el : el.querySelector("line") ?? el;
2163
1724
  }
1725
+ function resolveTweenLineElement(tw) {
1726
+ return tw.lineEl ?? resolveLineElement(tw.el);
1727
+ }
2164
1728
  function applyTweenState(tw, elapsed, update, exit, enterDelay, enterDuration) {
2165
1729
  if (tw.tweenType === "canvasPoints") {
2166
1730
  applyCanvasPointsState(tw, elapsed, update, exit, enterDelay, enterDuration);
@@ -2186,18 +1750,26 @@ function applyTweenState(tw, elapsed, update, exit, enterDelay, enterDuration) {
2186
1750
  switch (tw.tweenType) {
2187
1751
  case "rect": {
2188
1752
  const geom = lerpGeom(tw.from, tw.to, eased);
2189
- applyGeomToElement(tw.el, geom, tw.mark);
1753
+ applyGeomToElement(tw.el, geom, tw.mark, tw.shapeEl, tw.cornerScratch);
2190
1754
  break;
2191
1755
  }
2192
1756
  case "line": {
2193
- const pts = interpolatePoints(tw.fromPts, tw.toPts, eased);
2194
- applyLinePath(tw.el, pts, tw.interpolate);
1757
+ tw.ptsBuffer = interpolatePoints(tw.fromPts, tw.toPts, eased, tw.ptsBuffer);
1758
+ applyLinePath(tw.el, tw.ptsBuffer, tw.interpolate, tw.pathEl);
2195
1759
  break;
2196
1760
  }
2197
1761
  case "area": {
2198
- const top = interpolatePoints(tw.fromTop, tw.toTop, eased);
2199
- const bottom = interpolatePoints(tw.fromBottom, tw.toBottom, eased);
2200
- applyAreaPaths(tw.el, top, bottom, tw.interpolate, tw.hasStroke);
1762
+ tw.topBuffer = interpolatePoints(tw.fromTop, tw.toTop, eased, tw.topBuffer);
1763
+ tw.bottomBuffer = interpolatePoints(tw.fromBottom, tw.toBottom, eased, tw.bottomBuffer);
1764
+ applyAreaPaths(
1765
+ tw.el,
1766
+ tw.topBuffer,
1767
+ tw.bottomBuffer,
1768
+ tw.interpolate,
1769
+ tw.hasStroke,
1770
+ tw.fillPathEl,
1771
+ tw.topPathEl
1772
+ );
2201
1773
  break;
2202
1774
  }
2203
1775
  case "arc": {
@@ -2217,7 +1789,7 @@ function applyTweenState(tw, elapsed, update, exit, enterDelay, enterDuration) {
2217
1789
  }
2218
1790
  case "rule":
2219
1791
  case "tick": {
2220
- const lineEl = resolveLineElement(tw.el);
1792
+ const lineEl = resolveTweenLineElement(tw);
2221
1793
  lineEl.setAttribute("x1", String(tw.fromX1 + (tw.toX1 - tw.fromX1) * eased));
2222
1794
  lineEl.setAttribute("y1", String(tw.fromY1 + (tw.toY1 - tw.fromY1) * eased));
2223
1795
  lineEl.setAttribute("x2", String(tw.fromX2 + (tw.toX2 - tw.fromX2) * eased));
@@ -2255,7 +1827,7 @@ function applyTweenState(tw, elapsed, update, exit, enterDelay, enterDuration) {
2255
1827
  break;
2256
1828
  }
2257
1829
  case "color": {
2258
- tw.el.setAttribute(tw.attr, rgb_default(tw.from, tw.to)(eased));
1830
+ tw.el.setAttribute(tw.attr, tw.interpolator(eased));
2259
1831
  break;
2260
1832
  }
2261
1833
  case "annotation": {
@@ -2283,13 +1855,21 @@ function snapTweenToFinal(tw) {
2283
1855
  }
2284
1856
  switch (tw.tweenType) {
2285
1857
  case "rect":
2286
- applyGeomToElement(tw.el, tw.to, tw.mark);
1858
+ applyGeomToElement(tw.el, tw.to, tw.mark, tw.shapeEl, tw.cornerScratch);
2287
1859
  break;
2288
1860
  case "line":
2289
- applyLinePath(tw.el, tw.toPts, tw.interpolate);
1861
+ applyLinePath(tw.el, tw.toPts, tw.interpolate, tw.pathEl);
2290
1862
  break;
2291
1863
  case "area":
2292
- applyAreaPaths(tw.el, tw.toTop, tw.toBottom, tw.interpolate, tw.hasStroke);
1864
+ applyAreaPaths(
1865
+ tw.el,
1866
+ tw.toTop,
1867
+ tw.toBottom,
1868
+ tw.interpolate,
1869
+ tw.hasStroke,
1870
+ tw.fillPathEl,
1871
+ tw.topPathEl
1872
+ );
2293
1873
  break;
2294
1874
  case "arc": {
2295
1875
  const pathEl = tw.el.tagName === "path" ? tw.el : tw.el.querySelector("path");
@@ -2306,7 +1886,7 @@ function snapTweenToFinal(tw) {
2306
1886
  break;
2307
1887
  case "rule":
2308
1888
  case "tick": {
2309
- const lineEl = resolveLineElement(tw.el);
1889
+ const lineEl = resolveTweenLineElement(tw);
2310
1890
  lineEl.setAttribute("x1", String(tw.toX1));
2311
1891
  lineEl.setAttribute("y1", String(tw.toY1));
2312
1892
  lineEl.setAttribute("x2", String(tw.toX2));
@@ -2378,6 +1958,21 @@ function buildMarkDomIndex(marksContainer) {
2378
1958
  }
2379
1959
 
2380
1960
  // src/transition/svg-tweens.ts
1961
+ function buildCornerScratch(mark) {
1962
+ const sides = mark.cornerRadiusSides;
1963
+ const partialCorners = !!sides && (!sides.tl || !sides.tr || !sides.br || !sides.bl) && !!mark.cornerRadius;
1964
+ return partialCorners ? { ...mark } : void 0;
1965
+ }
1966
+ function resolveLinePathEl(el) {
1967
+ return el.querySelector("path");
1968
+ }
1969
+ function resolveAreaPathEls(el) {
1970
+ const paths = el.querySelectorAll("path");
1971
+ return {
1972
+ fillPathEl: paths[0] ?? null,
1973
+ topPathEl: paths[1] ?? null
1974
+ };
1975
+ }
2381
1976
  function resolveGhostGradientFill(mark, ghostGradientMap) {
2382
1977
  if (!mark.fill || typeof mark.fill === "string" || ghostGradientMap.size === 0) return mark;
2383
1978
  const resolved = resolveMarkFill(mark.fill, ghostGradientMap);
@@ -2410,7 +2005,9 @@ function buildRectTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2410
2005
  el,
2411
2006
  from: fromGeom,
2412
2007
  to: geomFromMark(next),
2413
- mark: next
2008
+ mark: next,
2009
+ shapeEl: resolveRectShapeElement(el),
2010
+ cornerScratch: buildCornerScratch(next)
2414
2011
  });
2415
2012
  }
2416
2013
  for (const [key, next] of nextByKey) {
@@ -2429,7 +2026,9 @@ function buildRectTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2429
2026
  el,
2430
2027
  from: fromGeom,
2431
2028
  to: geomFromMark(next),
2432
- mark: next
2029
+ mark: next,
2030
+ shapeEl: resolveRectShapeElement(el),
2031
+ cornerScratch: buildCornerScratch(next)
2433
2032
  });
2434
2033
  }
2435
2034
  for (const [key, prev] of prevByKey) {
@@ -2456,6 +2055,8 @@ function buildRectTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2456
2055
  from: geomFromMark(prev),
2457
2056
  to: toGeom,
2458
2057
  mark: prev,
2058
+ shapeEl: resolveRectShapeElement(ghost),
2059
+ cornerScratch: buildCornerScratch(prev),
2459
2060
  ghost,
2460
2061
  fromOpacity: 1,
2461
2062
  toOpacity: 0
@@ -2500,7 +2101,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2500
2101
  interpolate: next.interpolate,
2501
2102
  ghost,
2502
2103
  fromOpacity: 1,
2503
- toOpacity: 0
2104
+ toOpacity: 0,
2105
+ pathEl: ghostPath
2504
2106
  });
2505
2107
  tweens.push({
2506
2108
  tweenType: "line",
@@ -2511,7 +2113,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2511
2113
  finalPoints: next.points,
2512
2114
  interpolate: next.interpolate,
2513
2115
  fromOpacity: 0,
2514
- toOpacity: 1
2116
+ toOpacity: 1,
2117
+ pathEl: resolveLinePathEl(el)
2515
2118
  });
2516
2119
  continue;
2517
2120
  }
@@ -2538,7 +2141,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2538
2141
  interpolate: prev.interpolate,
2539
2142
  ghost,
2540
2143
  fromOpacity: 1,
2541
- toOpacity: 0
2144
+ toOpacity: 0,
2145
+ pathEl: resolveLinePathEl(ghost)
2542
2146
  });
2543
2147
  }
2544
2148
  tweens.push({
@@ -2550,7 +2154,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2550
2154
  finalPoints: next.points,
2551
2155
  interpolate: next.interpolate,
2552
2156
  fromOpacity: 0,
2553
- toOpacity: 1
2157
+ toOpacity: 1,
2158
+ pathEl: resolveLinePathEl(el)
2554
2159
  });
2555
2160
  } else {
2556
2161
  const [fromPts, toPts] = normalizePointArrays(prev.points, next.points, prevPKs, nextPKs);
@@ -2561,7 +2166,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2561
2166
  fromPts,
2562
2167
  toPts,
2563
2168
  finalPoints: next.points,
2564
- interpolate: next.interpolate
2169
+ interpolate: next.interpolate,
2170
+ pathEl: resolveLinePathEl(el)
2565
2171
  });
2566
2172
  }
2567
2173
  }
@@ -2578,7 +2184,8 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2578
2184
  finalPoints: next.points,
2579
2185
  interpolate: next.interpolate,
2580
2186
  fromOpacity: 0,
2581
- toOpacity: 1
2187
+ toOpacity: 1,
2188
+ pathEl: resolveLinePathEl(el)
2582
2189
  });
2583
2190
  }
2584
2191
  for (const [key, prev] of prevByKey) {
@@ -2600,6 +2207,7 @@ function buildLineTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2600
2207
  finalPoints: prev.points,
2601
2208
  interpolate: prev.interpolate,
2602
2209
  ghost,
2210
+ pathEl: resolveLinePathEl(ghost),
2603
2211
  fromOpacity: 1,
2604
2212
  toOpacity: 0
2605
2213
  });
@@ -2647,8 +2255,11 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2647
2255
  hasStroke: !!next.stroke && !!next.topPath,
2648
2256
  ghost,
2649
2257
  fromOpacity: 1,
2650
- toOpacity: 0
2258
+ toOpacity: 0,
2259
+ fillPathEl: ghostPaths[0] ?? null,
2260
+ topPathEl: ghostPaths[1] ?? null
2651
2261
  });
2262
+ const enterPaths = resolveAreaPathEls(el);
2652
2263
  tweens.push({
2653
2264
  tweenType: "area",
2654
2265
  kind: "enter",
@@ -2662,7 +2273,9 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2662
2273
  interpolate: next.interpolate,
2663
2274
  hasStroke: !!next.stroke && !!next.topPath,
2664
2275
  fromOpacity: 0,
2665
- toOpacity: 1
2276
+ toOpacity: 1,
2277
+ fillPathEl: enterPaths.fillPathEl,
2278
+ topPathEl: enterPaths.topPathEl
2666
2279
  });
2667
2280
  continue;
2668
2281
  }
@@ -2693,7 +2306,8 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2693
2306
  hasStroke: !!prev.stroke && !!prev.topPath,
2694
2307
  ghost,
2695
2308
  fromOpacity: 1,
2696
- toOpacity: 0
2309
+ toOpacity: 0,
2310
+ ...resolveAreaPathEls(ghost)
2697
2311
  });
2698
2312
  }
2699
2313
  tweens.push({
@@ -2709,7 +2323,8 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2709
2323
  interpolate: next.interpolate,
2710
2324
  hasStroke: !!next.stroke && !!next.topPath,
2711
2325
  fromOpacity: 0,
2712
- toOpacity: 1
2326
+ toOpacity: 1,
2327
+ ...resolveAreaPathEls(el)
2713
2328
  });
2714
2329
  } else {
2715
2330
  const [fromTop, toTop] = normalizePointArrays(
@@ -2735,7 +2350,8 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2735
2350
  finalTopPoints: next.topPoints,
2736
2351
  finalBottomPoints: next.bottomPoints,
2737
2352
  interpolate: next.interpolate,
2738
- hasStroke: !!next.stroke && !!next.topPath
2353
+ hasStroke: !!next.stroke && !!next.topPath,
2354
+ ...resolveAreaPathEls(el)
2739
2355
  });
2740
2356
  }
2741
2357
  }
@@ -2756,7 +2372,8 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2756
2372
  interpolate: next.interpolate,
2757
2373
  hasStroke: !!next.stroke && !!next.topPath,
2758
2374
  fromOpacity: 0,
2759
- toOpacity: 1
2375
+ toOpacity: 1,
2376
+ ...resolveAreaPathEls(el)
2760
2377
  });
2761
2378
  }
2762
2379
  for (const [key, prev] of prevByKey) {
@@ -2784,7 +2401,8 @@ function buildAreaTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
2784
2401
  hasStroke: !!prev.stroke && !!prev.topPath,
2785
2402
  ghost,
2786
2403
  fromOpacity: 1,
2787
- toOpacity: 0
2404
+ toOpacity: 0,
2405
+ ...resolveAreaPathEls(ghost)
2788
2406
  });
2789
2407
  }
2790
2408
  }
@@ -3004,7 +2622,8 @@ function buildRuleTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3004
2622
  toX1: next.x1,
3005
2623
  toY1: next.y1,
3006
2624
  toX2: next.x2,
3007
- toY2: next.y2
2625
+ toY2: next.y2,
2626
+ lineEl: resolveLineElement(el)
3008
2627
  });
3009
2628
  }
3010
2629
  for (const [key, next] of nextByKey) {
@@ -3024,7 +2643,8 @@ function buildRuleTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3024
2643
  toX2: next.x2,
3025
2644
  toY2: next.y2,
3026
2645
  fromOpacity: 0,
3027
- toOpacity: 1
2646
+ toOpacity: 1,
2647
+ lineEl: resolveLineElement(el)
3028
2648
  });
3029
2649
  }
3030
2650
  for (const [key, prev] of prevByKey) {
@@ -3051,7 +2671,8 @@ function buildRuleTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3051
2671
  toY2: prev.y2,
3052
2672
  ghost,
3053
2673
  fromOpacity: 1,
3054
- toOpacity: 0
2674
+ toOpacity: 0,
2675
+ lineEl: resolveLineElement(ghost)
3055
2676
  });
3056
2677
  }
3057
2678
  }
@@ -3095,7 +2716,8 @@ function buildTickTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3095
2716
  toX1: nEnd.x1,
3096
2717
  toY1: nEnd.y1,
3097
2718
  toX2: nEnd.x2,
3098
- toY2: nEnd.y2
2719
+ toY2: nEnd.y2,
2720
+ lineEl: resolveLineElement(el)
3099
2721
  });
3100
2722
  }
3101
2723
  for (const [key, next] of nextByKey) {
@@ -3116,7 +2738,8 @@ function buildTickTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3116
2738
  toX2: nEnd.x2,
3117
2739
  toY2: nEnd.y2,
3118
2740
  fromOpacity: 0,
3119
- toOpacity: 1
2741
+ toOpacity: 1,
2742
+ lineEl: resolveLineElement(el)
3120
2743
  });
3121
2744
  }
3122
2745
  for (const [key, prev] of prevByKey) {
@@ -3144,7 +2767,8 @@ function buildTickTweens(prevLayout, nextLayout, marksContainer, dom, tweens, gh
3144
2767
  toY2: pEnd.y2,
3145
2768
  ghost,
3146
2769
  fromOpacity: 1,
3147
- toOpacity: 0
2770
+ toOpacity: 0,
2771
+ lineEl: resolveLineElement(ghost)
3148
2772
  });
3149
2773
  }
3150
2774
  }
@@ -3577,7 +3201,7 @@ function createYouDrawIt(options) {
3577
3201
  let svgEl = null;
3578
3202
  const guessByX = /* @__PURE__ */ new Map();
3579
3203
  let cleanupPointerEvents = null;
3580
- function buildHatchPattern(id, color2) {
3204
+ function buildHatchPattern(id, color) {
3581
3205
  const pattern = document.createElementNS(SVG_NS, "pattern");
3582
3206
  pattern.setAttribute("id", id);
3583
3207
  pattern.setAttribute("patternUnits", "userSpaceOnUse");
@@ -3585,7 +3209,7 @@ function createYouDrawIt(options) {
3585
3209
  pattern.setAttribute("height", "8");
3586
3210
  pattern.setAttribute("patternTransform", "rotate(45)");
3587
3211
  const line = document.createElementNS(SVG_NS, "line");
3588
- setAttrs(line, { x1: 0, y1: 0, x2: 0, y2: 8, stroke: color2, "stroke-width": 1 });
3212
+ setAttrs(line, { x1: 0, y1: 0, x2: 0, y2: 8, stroke: color, "stroke-width": 1 });
3589
3213
  line.setAttribute("stroke-opacity", "0.5");
3590
3214
  pattern.appendChild(line);
3591
3215
  return pattern;
@@ -4066,12 +3690,12 @@ function collectSeriesGroups(layout) {
4066
3690
  const key = mark.seriesKey ?? "__default__";
4067
3691
  const existingType = markTypeByKey.get(key);
4068
3692
  if (existingType === "line" && mark.type === "area") continue;
4069
- const color2 = mark.type === "line" ? mark.stroke : getRepresentativeColor(mark.fill);
3693
+ const color = mark.type === "line" ? mark.stroke : getRepresentativeColor(mark.fill);
4070
3694
  const pointsByX = /* @__PURE__ */ new Map();
4071
3695
  for (const dp of mark.dataPoints) {
4072
3696
  pointsByX.set(snapKey(dp.x), { ...dp });
4073
3697
  }
4074
- byKey.set(key, { seriesKey: key, color: color2, pointsByX });
3698
+ byKey.set(key, { seriesKey: key, color, pointsByX });
4075
3699
  markTypeByKey.set(key, mark.type);
4076
3700
  }
4077
3701
  }
@@ -4109,7 +3733,9 @@ function buildSliceTooltip(hits) {
4109
3733
  const tip = point.tooltip;
4110
3734
  if (!tip) continue;
4111
3735
  if (isMulti) {
4112
- const yField = tip.fields.find((f) => !f.color && f.label !== title) ?? tip.fields[tip.fields.length - 1] ?? null;
3736
+ const yField = tip.fields.find(
3737
+ (f) => !f.color && f.label !== title && f.value !== title && f.value !== group.seriesKey
3738
+ ) ?? tip.fields[tip.fields.length - 1] ?? null;
4113
3739
  if (!yField) continue;
4114
3740
  fields.push({
4115
3741
  label: group.seriesKey,
@@ -5520,302 +5146,8 @@ var AnimationScheduler = class {
5520
5146
  }
5521
5147
  };
5522
5148
 
5523
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/add.js
5524
- function add_default(d) {
5525
- const x = +this._x.call(null, d), y = +this._y.call(null, d);
5526
- return add(this.cover(x, y), x, y, d);
5527
- }
5528
- function add(tree, x, y, d) {
5529
- if (isNaN(x) || isNaN(y)) return tree;
5530
- var parent, node = tree._root, leaf = { data: d }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j;
5531
- if (!node) return tree._root = leaf, tree;
5532
- while (node.length) {
5533
- if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;
5534
- else x1 = xm;
5535
- if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;
5536
- else y1 = ym;
5537
- if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
5538
- }
5539
- xp = +tree._x.call(null, node.data);
5540
- yp = +tree._y.call(null, node.data);
5541
- if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
5542
- do {
5543
- parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
5544
- if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;
5545
- else x1 = xm;
5546
- if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;
5547
- else y1 = ym;
5548
- } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));
5549
- return parent[j] = node, parent[i] = leaf, tree;
5550
- }
5551
- function addAll(data) {
5552
- var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
5553
- for (i = 0; i < n; ++i) {
5554
- if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
5555
- xz[i] = x;
5556
- yz[i] = y;
5557
- if (x < x0) x0 = x;
5558
- if (x > x1) x1 = x;
5559
- if (y < y0) y0 = y;
5560
- if (y > y1) y1 = y;
5561
- }
5562
- if (x0 > x1 || y0 > y1) return this;
5563
- this.cover(x0, y0).cover(x1, y1);
5564
- for (i = 0; i < n; ++i) {
5565
- add(this, xz[i], yz[i], data[i]);
5566
- }
5567
- return this;
5568
- }
5569
-
5570
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/cover.js
5571
- function cover_default(x, y) {
5572
- if (isNaN(x = +x) || isNaN(y = +y)) return this;
5573
- var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
5574
- if (isNaN(x0)) {
5575
- x1 = (x0 = Math.floor(x)) + 1;
5576
- y1 = (y0 = Math.floor(y)) + 1;
5577
- } else {
5578
- var z = x1 - x0 || 1, node = this._root, parent, i;
5579
- while (x0 > x || x >= x1 || y0 > y || y >= y1) {
5580
- i = (y < y0) << 1 | x < x0;
5581
- parent = new Array(4), parent[i] = node, node = parent, z *= 2;
5582
- switch (i) {
5583
- case 0:
5584
- x1 = x0 + z, y1 = y0 + z;
5585
- break;
5586
- case 1:
5587
- x0 = x1 - z, y1 = y0 + z;
5588
- break;
5589
- case 2:
5590
- x1 = x0 + z, y0 = y1 - z;
5591
- break;
5592
- case 3:
5593
- x0 = x1 - z, y0 = y1 - z;
5594
- break;
5595
- }
5596
- }
5597
- if (this._root && this._root.length) this._root = node;
5598
- }
5599
- this._x0 = x0;
5600
- this._y0 = y0;
5601
- this._x1 = x1;
5602
- this._y1 = y1;
5603
- return this;
5604
- }
5605
-
5606
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/data.js
5607
- function data_default() {
5608
- var data = [];
5609
- this.visit(function(node) {
5610
- if (!node.length) do
5611
- data.push(node.data);
5612
- while (node = node.next);
5613
- });
5614
- return data;
5615
- }
5616
-
5617
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/extent.js
5618
- function extent_default(_) {
5619
- return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
5620
- }
5621
-
5622
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quad.js
5623
- function quad_default(node, x0, y0, x1, y1) {
5624
- this.node = node;
5625
- this.x0 = x0;
5626
- this.y0 = y0;
5627
- this.x1 = x1;
5628
- this.y1 = y1;
5629
- }
5630
-
5631
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/find.js
5632
- function find_default(x, y, radius) {
5633
- var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i;
5634
- if (node) quads.push(new quad_default(node, x0, y0, x3, y3));
5635
- if (radius == null) radius = Infinity;
5636
- else {
5637
- x0 = x - radius, y0 = y - radius;
5638
- x3 = x + radius, y3 = y + radius;
5639
- radius *= radius;
5640
- }
5641
- while (q = quads.pop()) {
5642
- if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue;
5643
- if (node.length) {
5644
- var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2;
5645
- quads.push(
5646
- new quad_default(node[3], xm, ym, x2, y2),
5647
- new quad_default(node[2], x1, ym, xm, y2),
5648
- new quad_default(node[1], xm, y1, x2, ym),
5649
- new quad_default(node[0], x1, y1, xm, ym)
5650
- );
5651
- if (i = (y >= ym) << 1 | x >= xm) {
5652
- q = quads[quads.length - 1];
5653
- quads[quads.length - 1] = quads[quads.length - 1 - i];
5654
- quads[quads.length - 1 - i] = q;
5655
- }
5656
- } else {
5657
- var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
5658
- if (d2 < radius) {
5659
- var d = Math.sqrt(radius = d2);
5660
- x0 = x - d, y0 = y - d;
5661
- x3 = x + d, y3 = y + d;
5662
- data = node.data;
5663
- }
5664
- }
5665
- }
5666
- return data;
5667
- }
5668
-
5669
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/remove.js
5670
- function remove_default(d) {
5671
- if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this;
5672
- var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j;
5673
- if (!node) return this;
5674
- if (node.length) while (true) {
5675
- if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;
5676
- else x1 = xm;
5677
- if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;
5678
- else y1 = ym;
5679
- if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
5680
- if (!node.length) break;
5681
- if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i;
5682
- }
5683
- while (node.data !== d) if (!(previous = node, node = node.next)) return this;
5684
- if (next = node.next) delete node.next;
5685
- if (previous) return next ? previous.next = next : delete previous.next, this;
5686
- if (!parent) return this._root = next, this;
5687
- next ? parent[i] = next : delete parent[i];
5688
- if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
5689
- if (retainer) retainer[j] = node;
5690
- else this._root = node;
5691
- }
5692
- return this;
5693
- }
5694
- function removeAll(data) {
5695
- for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
5696
- return this;
5697
- }
5698
-
5699
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/root.js
5700
- function root_default() {
5701
- return this._root;
5702
- }
5703
-
5704
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/size.js
5705
- function size_default() {
5706
- var size = 0;
5707
- this.visit(function(node) {
5708
- if (!node.length) do
5709
- ++size;
5710
- while (node = node.next);
5711
- });
5712
- return size;
5713
- }
5714
-
5715
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visit.js
5716
- function visit_default(callback) {
5717
- var quads = [], q, node = this._root, child, x0, y0, x1, y1;
5718
- if (node) quads.push(new quad_default(node, this._x0, this._y0, this._x1, this._y1));
5719
- while (q = quads.pop()) {
5720
- if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
5721
- var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
5722
- if (child = node[3]) quads.push(new quad_default(child, xm, ym, x1, y1));
5723
- if (child = node[2]) quads.push(new quad_default(child, x0, ym, xm, y1));
5724
- if (child = node[1]) quads.push(new quad_default(child, xm, y0, x1, ym));
5725
- if (child = node[0]) quads.push(new quad_default(child, x0, y0, xm, ym));
5726
- }
5727
- }
5728
- return this;
5729
- }
5730
-
5731
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visitAfter.js
5732
- function visitAfter_default(callback) {
5733
- var quads = [], next = [], q;
5734
- if (this._root) quads.push(new quad_default(this._root, this._x0, this._y0, this._x1, this._y1));
5735
- while (q = quads.pop()) {
5736
- var node = q.node;
5737
- if (node.length) {
5738
- var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
5739
- if (child = node[0]) quads.push(new quad_default(child, x0, y0, xm, ym));
5740
- if (child = node[1]) quads.push(new quad_default(child, xm, y0, x1, ym));
5741
- if (child = node[2]) quads.push(new quad_default(child, x0, ym, xm, y1));
5742
- if (child = node[3]) quads.push(new quad_default(child, xm, ym, x1, y1));
5743
- }
5744
- next.push(q);
5745
- }
5746
- while (q = next.pop()) {
5747
- callback(q.node, q.x0, q.y0, q.x1, q.y1);
5748
- }
5749
- return this;
5750
- }
5751
-
5752
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/x.js
5753
- function defaultX(d) {
5754
- return d[0];
5755
- }
5756
- function x_default(_) {
5757
- return arguments.length ? (this._x = _, this) : this._x;
5758
- }
5759
-
5760
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/y.js
5761
- function defaultY(d) {
5762
- return d[1];
5763
- }
5764
- function y_default(_) {
5765
- return arguments.length ? (this._y = _, this) : this._y;
5766
- }
5767
-
5768
- // ../../node_modules/.bun/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quadtree.js
5769
- function quadtree(nodes, x, y) {
5770
- var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
5771
- return nodes == null ? tree : tree.addAll(nodes);
5772
- }
5773
- function Quadtree(x, y, x0, y0, x1, y1) {
5774
- this._x = x;
5775
- this._y = y;
5776
- this._x0 = x0;
5777
- this._y0 = y0;
5778
- this._x1 = x1;
5779
- this._y1 = y1;
5780
- this._root = void 0;
5781
- }
5782
- function leaf_copy(leaf) {
5783
- var copy = { data: leaf.data }, next = copy;
5784
- while (leaf = leaf.next) next = next.next = { data: leaf.data };
5785
- return copy;
5786
- }
5787
- var treeProto = quadtree.prototype = Quadtree.prototype;
5788
- treeProto.copy = function() {
5789
- var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child;
5790
- if (!node) return copy;
5791
- if (!node.length) return copy._root = leaf_copy(node), copy;
5792
- nodes = [{ source: node, target: copy._root = new Array(4) }];
5793
- while (node = nodes.pop()) {
5794
- for (var i = 0; i < 4; ++i) {
5795
- if (child = node.source[i]) {
5796
- if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) });
5797
- else node.target[i] = leaf_copy(child);
5798
- }
5799
- }
5800
- }
5801
- return copy;
5802
- };
5803
- treeProto.add = add_default;
5804
- treeProto.addAll = addAll;
5805
- treeProto.cover = cover_default;
5806
- treeProto.data = data_default;
5807
- treeProto.extent = extent_default;
5808
- treeProto.find = find_default;
5809
- treeProto.remove = remove_default;
5810
- treeProto.removeAll = removeAll;
5811
- treeProto.root = root_default;
5812
- treeProto.size = size_default;
5813
- treeProto.visit = visit_default;
5814
- treeProto.visitAfter = visitAfter_default;
5815
- treeProto.x = x_default;
5816
- treeProto.y = y_default;
5817
-
5818
5149
  // src/spatial-index.ts
5150
+ import { quadtree } from "d3-quadtree";
5819
5151
  var SpatialIndex = class {
5820
5152
  tree = null;
5821
5153
  nodes = [];
@@ -7899,6 +7231,7 @@ function renderMapSVG(layout, opts) {
7899
7231
  }
7900
7232
 
7901
7233
  // src/map-transition.ts
7234
+ import { interpolateRgb as interpolateRgb2 } from "d3-interpolate";
7902
7235
  function numAttr(el, name) {
7903
7236
  const raw = el.getAttribute(name);
7904
7237
  if (raw === null) return void 0;
@@ -7956,7 +7289,7 @@ function runMapFillTransition(svg, prev, opts) {
7956
7289
  const to = p.getAttribute("fill");
7957
7290
  const from = key ? snapshot.fills.get(key) : void 0;
7958
7291
  if (from && to && from !== to) {
7959
- tweens.push({ kind: "fill", el: p, to, interp: rgb_default(from, to) });
7292
+ tweens.push({ kind: "fill", el: p, to, interp: interpolateRgb2(from, to) });
7960
7293
  p.setAttribute("fill", from);
7961
7294
  }
7962
7295
  }
@@ -7971,7 +7304,7 @@ function runMapFillTransition(svg, prev, opts) {
7971
7304
  kind: "fill",
7972
7305
  el: p,
7973
7306
  to: toFill,
7974
- interp: rgb_default(before.fill, toFill)
7307
+ interp: interpolateRgb2(before.fill, toFill)
7975
7308
  });
7976
7309
  p.setAttribute("fill", before.fill);
7977
7310
  }
@@ -8082,12 +7415,17 @@ function createGeoMap(container, spec, options) {
8082
7415
  }
8083
7416
  function wireTooltipAndInteraction(svg, layout) {
8084
7417
  const cleanups = [];
7418
+ const featuresById = /* @__PURE__ */ new Map();
7419
+ for (const f of layout.features) {
7420
+ const key = String(f.id);
7421
+ if (!featuresById.has(key)) featuresById.set(key, f);
7422
+ }
8085
7423
  const featureElements = svg.querySelectorAll(".oc-map-feature");
8086
7424
  for (const el of featureElements) {
8087
7425
  const featureId = el.getAttribute("data-feature-id");
8088
7426
  if (!featureId) continue;
8089
7427
  const content = layout.tooltipDescriptors.get(featureId);
8090
- const feature = layout.features.find((f) => String(f.id) === featureId);
7428
+ const feature = featuresById.get(featureId);
8091
7429
  const handleMouseEnter = (e) => {
8092
7430
  const mouseEvent = e;
8093
7431
  el.style.setProperty("cursor", "pointer");
@@ -8535,7 +7873,6 @@ export {
8535
7873
  materializeCanvasModeSVG,
8536
7874
  applySrOnlyStyles,
8537
7875
  AnimationScheduler,
8538
- quadtree,
8539
7876
  SpatialIndex,
8540
7877
  clamp01,
8541
7878
  lerp,
@@ -8543,7 +7880,6 @@ export {
8543
7880
  prefersReducedMotion,
8544
7881
  createTween,
8545
7882
  createTextEditOverlay,
8546
- zoom_default,
8547
7883
  DEFAULT_UPDATE_MAX_MARKS,
8548
7884
  CANVAS_DEFAULT_UPDATE_MAX_MARKS,
8549
7885
  canTransitionSpecShape,
@@ -8562,4 +7898,4 @@ export {
8562
7898
  scrubCamera,
8563
7899
  createGeoMap
8564
7900
  };
8565
- //# sourceMappingURL=chunk-N5KDVZU7.js.map
7901
+ //# sourceMappingURL=chunk-BKN4R3J6.js.map