vvplot 0.3.0 → 0.4.1

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.
@@ -1697,6 +1697,15 @@ class GEnumLevel extends Array {
1697
1697
  }
1698
1698
  throw new Error(`Invalid level values: ${x2}`);
1699
1699
  }
1700
+ /**
1701
+ * Check if two GEnumLevel are equal, i.e. they have the same labels in the same order
1702
+ * @param {string[]} level
1703
+ */
1704
+ static isEqual(a, b) {
1705
+ if (a instanceof this && b instanceof this) {
1706
+ return a.length === b.length && Array(a.length).fill().every((_, i) => a[i].label === b[i].label);
1707
+ }
1708
+ }
1700
1709
  /**
1701
1710
  * build a GEnumLevel
1702
1711
  * @param {string[]} level
@@ -2650,7 +2659,7 @@ const boxplot = Object.assign(function(data, {}) {
2650
2659
  result[key] = cates.map((x2) => x2.group).map((i) => group.categories[i][key]);
2651
2660
  }
2652
2661
  return result;
2653
- }, { core_attrs: ["x", "y", "xnudge", "ynudge"] });
2662
+ }, { core_attrs: ["x", "y", "width", "height", "xnudge", "ynudge"] });
2654
2663
  const curve = Object.assign(function(data) {
2655
2664
  if (data.points != null) return data;
2656
2665
  let missingAes = ["x", "y"].filter((a) => data[a] == null);
@@ -6118,6 +6127,7 @@ function palette_scale_hue({
6118
6127
  c = 100,
6119
6128
  l = 65,
6120
6129
  h_start = 0,
6130
+ alpha: alpha2 = 1,
6121
6131
  direction = 1,
6122
6132
  limits,
6123
6133
  oob: oob2 = oob_censor,
@@ -6132,7 +6142,7 @@ function palette_scale_hue({
6132
6142
  v = this.oob(v, { min: scale_min, max: scale_max });
6133
6143
  if (v === null) return null_value;
6134
6144
  if (isNaN(v)) return na_value;
6135
- return hcl(h_start + h_min + h_interval * (v - scale_min) / scale_interval * direction, c, l).toString();
6145
+ return hcl(h_start + h_min + h_interval * (v - scale_min) / scale_interval * direction, c, l, alpha2).toString();
6136
6146
  });
6137
6147
  };
6138
6148
  return Object.assign(fn, { title, limits, oob: oob2 }, etc);
@@ -6224,12 +6234,13 @@ function palette_scale_gradientn({
6224
6234
  return Object.assign(fn, { title, limits, oob: oob2 }, etc);
6225
6235
  }
6226
6236
  function palette_scale_auto({
6237
+ alpha: alpha2,
6227
6238
  limits,
6228
6239
  oob: oob2 = oob_censor,
6229
6240
  title,
6230
6241
  ...etc
6231
6242
  } = {}) {
6232
- let scale_hue = palette_scale_hue(), scale_gradient = palette_scale_gradient();
6243
+ let scale_hue = palette_scale_hue({ alpha: alpha2 }), scale_gradient = palette_scale_gradient();
6233
6244
  let fn = function(arr) {
6234
6245
  if (arr.level != null) {
6235
6246
  return scale_hue.call(this, arr);
@@ -6240,15 +6251,13 @@ function palette_scale_auto({
6240
6251
  return Object.assign(fn, { title, limits, oob: oob2 }, etc);
6241
6252
  }
6242
6253
  function palette_scale_dynamic({
6243
- discrete,
6244
- continuous: continuous2,
6254
+ discrete = palette_scale_hue(),
6255
+ continuous: continuous2 = palette_scale_gradient(),
6245
6256
  limits,
6246
6257
  oob: oob2 = oob_censor,
6247
6258
  title,
6248
6259
  ...etc
6249
6260
  } = {}) {
6250
- discrete ??= palette_scale_hue();
6251
- continuous2 ??= palette_scale_gradient();
6252
6261
  let fn = function(arr) {
6253
6262
  if (arr.level != null) {
6254
6263
  return discrete.call(this, arr);
@@ -6259,7 +6268,7 @@ function palette_scale_dynamic({
6259
6268
  return Object.assign(fn, { title, limits, oob: oob2 }, etc);
6260
6269
  }
6261
6270
  function shape_scale_discrete({ title, ...etc } = {}) {
6262
- let shapes = ["circle", "square", "triangle", "diamond", "plus"];
6271
+ let shapes = ["circle", "square", "triangle", "diamond", "plus", "cross"];
6263
6272
  let fn = function(arr) {
6264
6273
  return arr.map((v) => shapes[+v]);
6265
6274
  };
@@ -6600,6 +6609,9 @@ function object_map(obj, expr) {
6600
6609
  if (obj == null) return {};
6601
6610
  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, expr(k, v)]));
6602
6611
  }
6612
+ function is_categorical(v) {
6613
+ return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
6614
+ }
6603
6615
  class GLayer {
6604
6616
  /**
6605
6617
  * Create a graphic layer from schema
@@ -6656,9 +6668,9 @@ class GLayer {
6656
6668
  if ($$data == null) $$data = $data;
6657
6669
  $$aes = { ...$aes, ...$$aes };
6658
6670
  let data = {};
6659
- let fns = {};
6671
+ this.$fnames = {};
6660
6672
  for (const aes in $$aes) {
6661
- fns[aes] = String($$aes[aes]);
6673
+ this.$fnames[aes] = String($$aes[aes]);
6662
6674
  data[aes] = $$data.map($$aes[aes]);
6663
6675
  }
6664
6676
  data.$raw = $$data;
@@ -6698,21 +6710,18 @@ class GLayer {
6698
6710
  ...vvgeom[$$geom]?.scale_attrs ?? []
6699
6711
  ]);
6700
6712
  this.$data = data;
6701
- this.$fns = fns;
6702
6713
  this.data = { ...data };
6703
6714
  for (const aes in data) {
6704
6715
  if ($$scales[aes] != null) {
6705
6716
  let scale = new Scale($$scales[aes]);
6706
6717
  scale.aesthetics = aes;
6707
- if (scale.title === void 0) {
6708
- scale.title = fns[aes];
6709
- }
6718
+ scale._title = this.$fnames[aes];
6710
6719
  let values = this.$data[aes];
6711
6720
  if (!values?.length) continue;
6712
6721
  if (!scale.asis) {
6713
6722
  if ($$levels?.[aes] != null) {
6714
6723
  scale.level = $$levels[aes];
6715
- } else if (values.some((v) => typeof v === "string")) {
6724
+ } else if (values.some(is_categorical)) {
6716
6725
  scale.level = GEnumLevel.from(values);
6717
6726
  } else {
6718
6727
  scale.extent = numutils.extent(values);
@@ -6779,15 +6788,13 @@ class GPlot {
6779
6788
  if (!scale.asis) {
6780
6789
  if (levels?.[aes] != null) {
6781
6790
  scale.level = levels[aes];
6782
- } else if (values.some((v) => typeof v === "string")) {
6791
+ } else if (values.some(is_categorical)) {
6783
6792
  scale.level = GEnumLevel.from(values);
6784
6793
  } else {
6785
6794
  scale.extent = numutils.extent(values);
6786
6795
  }
6787
6796
  }
6788
- if (scale.title == null) {
6789
- scale.title = this.layers.map((layer) => layer.$fns?.[aes]).find((s) => s != null);
6790
- }
6797
+ scale._title = this.layers.reduce((v, layer) => v ?? layer.$fnames?.[aes], null);
6791
6798
  for (const layer of this.layers) {
6792
6799
  if (!layer.localScales.has(aes)) {
6793
6800
  layer.applyScale(aes, scale);
@@ -6822,7 +6829,7 @@ class GPlot {
6822
6829
  let fn = vvgeom[layer.geom].get_values ?? vvgeom[layer.geom].get_range;
6823
6830
  return fn?.(layer.$data, aes);
6824
6831
  });
6825
- if (values.some((v) => typeof v === "string")) {
6832
+ if (values.some(is_categorical)) {
6826
6833
  this.levels[aes] = GEnumLevel.from(values);
6827
6834
  } else {
6828
6835
  values = this.layers.flatMap((layer) => vvgeom[layer.geom].get_range?.(layer.$data, aes)).filter((v) => !isNaN(v));
@@ -6933,6 +6940,9 @@ class Scale extends Function {
6933
6940
  let min = this.$limits?.min ?? (this.level ? 0 : this._limits?.min), max = this.$limits?.max ?? this.level?.length ?? this._limits?.max;
6934
6941
  return { 0: min, 1: max, length: 2, min, max };
6935
6942
  }
6943
+ toString() {
6944
+ return this.title ?? String(this._fn);
6945
+ }
6936
6946
  }
6937
6947
  class DiscreteCoordScale extends Function {
6938
6948
  constructor(level, { min, max } = {}) {
@@ -7086,6 +7096,7 @@ const _sfc_main$13 = {
7086
7096
  return {
7087
7097
  x: __props.x,
7088
7098
  y: __props.y,
7099
+ color: __props.color || null,
7089
7100
  fill: __props.color || null,
7090
7101
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
7091
7102
  stroke: __props.stroke || null,
@@ -14337,6 +14348,7 @@ const _sfc_main$12 = {
14337
14348
  return {
14338
14349
  x: __props.x,
14339
14350
  y: __props.y,
14351
+ color: __props.color || null,
14340
14352
  fill: __props.color || null,
14341
14353
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
14342
14354
  stroke: __props.stroke || null,
@@ -14582,7 +14594,9 @@ const _sfc_main$11 = {
14582
14594
  const iRef = useTemplateRef("i");
14583
14595
  function getPosition(event) {
14584
14596
  let rect2 = iRef.value.getBoundingClientRect();
14585
- let l = Math.trunc(event.clientX) - rect2.left - __props.layout.left, r = rect2.left + __props.layout.left + __props.layout.width - Math.trunc(event.clientX);
14597
+ let scaleX = rect2.width / iRef.value.getBBox().width;
14598
+ let offsetX = event.clientX - rect2.left;
14599
+ let l = offsetX / scaleX - __props.layout.left, r = __props.layout.left + __props.layout.width - offsetX / scaleX;
14586
14600
  let result = { l, r };
14587
14601
  let { x: x2, y: y2 } = __props.pos2coord({ h: l });
14588
14602
  if (x2) result.x = x2;
@@ -14617,11 +14631,13 @@ const _sfc_main$11 = {
14617
14631
  moveTimer = clearTimeout(moveTimer);
14618
14632
  let hmin0 = 0, hmax0 = __props.layout.width;
14619
14633
  let boundary = __props.coord2pos(act);
14634
+ let rect2 = iRef.value.getBoundingClientRect();
14635
+ let scaleX = rect2.width / iRef.value.getBBox().width;
14620
14636
  e.target.setPointerCapture(e.pointerId);
14621
14637
  e.target.onpointermove = (ev) => {
14622
14638
  movementX += ev.movementX;
14623
14639
  if (!pointerMoved) return;
14624
- let dh = oob_squish_any(-movementX, { min: boundary.hmin - hmin0, max: boundary.hmax - hmax0 });
14640
+ let dh = oob_squish_any(-movementX / scaleX, { min: boundary.hmin - hmin0, max: boundary.hmax - hmax0 });
14625
14641
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({ hmin: hmin0 + dh, hmax: hmax0 + dh });
14626
14642
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
14627
14643
  };
@@ -14648,12 +14664,14 @@ const _sfc_main$11 = {
14648
14664
  min: __props.coord2pos(act).hmin,
14649
14665
  max: __props.coord2pos({ hmin: coord0.hmax - mrh, hmax: coord0.hmin + mrh }).hmin
14650
14666
  };
14667
+ let rect2 = iRef.value.getBoundingClientRect();
14668
+ let scaleX = rect2.width / iRef.value.getBBox().width;
14651
14669
  let movementX2 = 0;
14652
14670
  e.target.setPointerCapture(e.pointerId);
14653
14671
  e.target.onpointermove = (ev) => {
14654
14672
  movementX2 += ev.movementX;
14655
14673
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({
14656
- hmin: oob_squish_any(hmax - (hmax - hmin) * position.r / Math.max(position.r - movementX2, 1), boundary),
14674
+ hmin: oob_squish_any(hmax - (hmax - hmin) * position.r / Math.max(position.r - movementX2 / scaleX, 1), boundary),
14657
14675
  hmax
14658
14676
  });
14659
14677
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
@@ -14676,6 +14694,8 @@ const _sfc_main$11 = {
14676
14694
  min: __props.coord2pos({ hmin: coord0.hmax - mrh, hmax: coord0.hmin + mrh }).hmax,
14677
14695
  max: __props.coord2pos(act).hmax
14678
14696
  };
14697
+ let rect2 = iRef.value.getBoundingClientRect();
14698
+ rect2.width / iRef.value.getBBox().width;
14679
14699
  let movementX2 = 0;
14680
14700
  e.target.setPointerCapture(e.pointerId);
14681
14701
  e.target.onpointermove = (ev) => {
@@ -15001,7 +15021,9 @@ const _sfc_main$10 = {
15001
15021
  const iRef = useTemplateRef("i");
15002
15022
  function getPosition(event) {
15003
15023
  let rect2 = iRef.value.getBoundingClientRect();
15004
- let t = Math.trunc(event.clientY) - rect2.top - __props.layout.top, b = rect2.top + __props.layout.top + __props.layout.height - Math.trunc(event.clientY);
15024
+ let scaleY = rect2.height / iRef.value.getBBox().height;
15025
+ let offsetY = event.clientY - rect2.top;
15026
+ let t = offsetY / scaleY - __props.layout.top, b = __props.layout.top + __props.layout.height - offsetY / scaleY;
15005
15027
  let result = { t, b };
15006
15028
  let { x: x2, y: y2 } = __props.pos2coord({ v: t });
15007
15029
  if (x2) result.x = x2;
@@ -15036,11 +15058,13 @@ const _sfc_main$10 = {
15036
15058
  moveTimer = clearTimeout(moveTimer);
15037
15059
  let vmin0 = 0, vmax0 = __props.layout.height;
15038
15060
  let boundary = __props.coord2pos(act);
15061
+ let rect2 = iRef.value.getBoundingClientRect();
15062
+ let scaleY = rect2.height / iRef.value.getBBox().height;
15039
15063
  e.target.setPointerCapture(e.pointerId);
15040
15064
  e.target.onpointermove = (ev) => {
15041
15065
  movementY += ev.movementY;
15042
15066
  if (!pointerMoved) return;
15043
- let dv = oob_squish_any(-movementY, { min: boundary.vmin - vmin0, max: boundary.vmax - vmax0 });
15067
+ let dv = oob_squish_any(-movementY / scaleY, { min: boundary.vmin - vmin0, max: boundary.vmax - vmax0 });
15044
15068
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({ vmin: vmin0 + dv, vmax: vmax0 + dv });
15045
15069
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15046
15070
  };
@@ -15067,12 +15091,14 @@ const _sfc_main$10 = {
15067
15091
  min: __props.coord2pos(act).vmin,
15068
15092
  max: __props.coord2pos({ vmin: coord0.vmax - mrv, vmax: coord0.vmin + mrv }).vmin
15069
15093
  };
15094
+ let rect2 = iRef.value.getBoundingClientRect();
15095
+ let scaleY = rect2.height / iRef.value.getBBox().height;
15070
15096
  let movementY2 = 0;
15071
15097
  e.target.setPointerCapture(e.pointerId);
15072
15098
  e.target.onpointermove = (ev) => {
15073
15099
  movementY2 += ev.movementY;
15074
15100
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({
15075
- vmin: oob_squish_any(vmax - (vmax - vmin) * position.b / Math.max(position.b - movementY2, 1), boundary),
15101
+ vmin: oob_squish_any(vmax - (vmax - vmin) * position.b / Math.max(position.b - movementY2 / scaleY, 1), boundary),
15076
15102
  vmax
15077
15103
  });
15078
15104
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
@@ -15095,13 +15121,15 @@ const _sfc_main$10 = {
15095
15121
  min: __props.coord2pos({ vmin: coord0.vmax - mrv, vmax: coord0.vmin + mrv }).vmax,
15096
15122
  max: __props.coord2pos(act).vmax
15097
15123
  };
15124
+ let rect2 = iRef.value.getBoundingClientRect();
15125
+ let scaleY = rect2.height / iRef.value.getBBox().height;
15098
15126
  let movementY2 = 0;
15099
15127
  e.target.setPointerCapture(e.pointerId);
15100
15128
  e.target.onpointermove = (ev) => {
15101
15129
  movementY2 += ev.movementY;
15102
15130
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({
15103
15131
  vmin,
15104
- vmax: oob_squish_any(vmin + (vmax - vmin) * position.t / Math.max(position.t + movementY2, 1), boundary)
15132
+ vmax: oob_squish_any(vmin + (vmax - vmin) * position.t / Math.max(position.t + movementY2 / scaleY, 1), boundary)
15105
15133
  });
15106
15134
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15107
15135
  };
@@ -15548,8 +15576,8 @@ const _sfc_main$Y = {
15548
15576
  canvas2.addEventListener(evt, function(e) {
15549
15577
  if (e._vhandled) return;
15550
15578
  const rect2 = canvas2.getBoundingClientRect();
15551
- const x2 = e.clientX - rect2.left;
15552
- const y2 = e.clientY - rect2.top;
15579
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
15580
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
15553
15581
  for (const [path2, data] of path_data) {
15554
15582
  if (ctx.isPointInPath(path2, x2, y2)) {
15555
15583
  emit(evt, e, __props.getCoord(e), data);
@@ -15616,7 +15644,7 @@ const _sfc_main$X = {
15616
15644
  points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p))).filter((p) => p.x != null && p.y != null);
15617
15645
  if (points.length === 0) continue;
15618
15646
  const path2d = new Path2D();
15619
- let interpolatorFn = interpolators[interpolate2] ?? natural$1;
15647
+ let interpolatorFn = typeof interpolate2 == "function" ? interpolate2 : interpolators[interpolate2] ?? natural$1;
15620
15648
  let interpolator = interpolatorFn(path2d);
15621
15649
  interpolator.lineStart();
15622
15650
  for (let i = 0; i < points.length; i++) {
@@ -15644,8 +15672,8 @@ const _sfc_main$X = {
15644
15672
  canvas2.addEventListener(evt, function(e) {
15645
15673
  if (e._vhandled) return;
15646
15674
  const rect2 = canvas2.getBoundingClientRect();
15647
- const x2 = e.clientX - rect2.left;
15648
- const y2 = e.clientY - rect2.top;
15675
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
15676
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
15649
15677
  for (const [path2, data] of path_data) {
15650
15678
  if (ctx.isPointInPath(path2, x2, y2)) {
15651
15679
  emit(evt, e, __props.getCoord(e), data);
@@ -15751,8 +15779,8 @@ const _sfc_main$W = {
15751
15779
  canvas2.addEventListener(evt, function(e) {
15752
15780
  if (e._vhandled) return;
15753
15781
  const rect2 = canvas2.getBoundingClientRect();
15754
- const x2 = e.clientX - rect2.left;
15755
- const y2 = e.clientY - rect2.top;
15782
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
15783
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
15756
15784
  for (const [path2, data] of path_data) {
15757
15785
  if (ctx.isPointInPath(path2, x2, y2)) {
15758
15786
  emit(evt, e, __props.getCoord(e), data);
@@ -15840,8 +15868,8 @@ const _sfc_main$V = {
15840
15868
  canvas2.addEventListener(evt, function(e) {
15841
15869
  if (e._vhandled) return;
15842
15870
  const rect2 = canvas2.getBoundingClientRect();
15843
- const x2 = e.clientX - rect2.left;
15844
- const y2 = e.clientY - rect2.top;
15871
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
15872
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
15845
15873
  for (const [path2, data] of path_data) {
15846
15874
  if (ctx.isPointInPath(path2, x2, y2)) {
15847
15875
  emit(evt, e, __props.getCoord(e), data);
@@ -15951,8 +15979,8 @@ const _sfc_main$U = {
15951
15979
  canvas2.addEventListener(evt, function(e) {
15952
15980
  if (e._vhandled) return;
15953
15981
  const rect2 = canvas2.getBoundingClientRect();
15954
- const x2 = e.clientX - rect2.left;
15955
- const y2 = e.clientY - rect2.top;
15982
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
15983
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
15956
15984
  for (const [path2, data] of path_data) {
15957
15985
  if (ctx.isPointInPath(path2, x2, y2)) {
15958
15986
  emit(evt, e, __props.getCoord(e), data);
@@ -16044,8 +16072,8 @@ const _sfc_main$T = {
16044
16072
  canvas2.addEventListener(evt, function(e) {
16045
16073
  if (e._vhandled) return;
16046
16074
  const rect2 = canvas2.getBoundingClientRect();
16047
- const x2 = e.clientX - rect2.left;
16048
- const y2 = e.clientY - rect2.top;
16075
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
16076
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
16049
16077
  for (const [path2, data] of path_data) {
16050
16078
  if (ctx.isPointInPath(path2, x2, y2)) {
16051
16079
  emit(evt, e, __props.getCoord(e), data);
@@ -16135,8 +16163,8 @@ const _sfc_main$S = {
16135
16163
  canvas2.addEventListener(evt, function(e) {
16136
16164
  if (e._vhandled) return;
16137
16165
  const rect2 = canvas2.getBoundingClientRect();
16138
- const x2 = e.clientX - rect2.left;
16139
- const y2 = e.clientY - rect2.top;
16166
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
16167
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
16140
16168
  for (const [path2, data] of path_data) {
16141
16169
  if (ctx.isPointInPath(path2, x2, y2)) {
16142
16170
  emit(evt, e, __props.getCoord(e), data);
@@ -16261,8 +16289,8 @@ const _sfc_main$R = {
16261
16289
  canvas2.addEventListener(evt, function(e) {
16262
16290
  if (e._vhandled) return;
16263
16291
  const rect2 = canvas2.getBoundingClientRect();
16264
- const x2 = e.clientX - rect2.left;
16265
- const y2 = e.clientY - rect2.top;
16292
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
16293
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
16266
16294
  for (const [path2, data] of path_data) {
16267
16295
  if (ctx.isPointInPath(path2, x2, y2)) {
16268
16296
  emit(evt, e, __props.getCoord(e), data);
@@ -16415,8 +16443,8 @@ const _sfc_main$Q = {
16415
16443
  canvas2.addEventListener(evt, function(e) {
16416
16444
  if (e._vhandled) return;
16417
16445
  const rect2 = canvas2.getBoundingClientRect();
16418
- const x2 = e.clientX - rect2.left;
16419
- const y2 = e.clientY - rect2.top;
16446
+ const x2 = (e.clientX - rect2.left) * canvas2.width / rect2.width;
16447
+ const y2 = (e.clientY - rect2.top) * canvas2.height / rect2.height;
16420
16448
  for (const [path2, data] of path_data) {
16421
16449
  if (ctx.isPointInPath(path2, x2, y2)) {
16422
16450
  emit(evt, e, __props.getCoord(e), data);
@@ -16506,6 +16534,7 @@ const _sfc_main$O = {
16506
16534
  y: __props.y - __props.height / 2,
16507
16535
  width: __props.width,
16508
16536
  height: __props.height,
16537
+ color: __props.color || null,
16509
16538
  fill: __props.fill || null,
16510
16539
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
16511
16540
  stroke: __props.color || null,
@@ -16543,6 +16572,7 @@ const _sfc_main$N = {
16543
16572
  },
16544
16573
  setup(__props) {
16545
16574
  const paths = {
16575
+ circle: "M0-0.5A0.5,0.5,0,1,1,0,0.5A0.5,0.5,0,1,1,0-0.5Z",
16546
16576
  square: "M-0.5-0.5H0.5V0.5H-0.5Z",
16547
16577
  triangle: "M0-0.667L0.577,0.333L-0.577,0.333Z",
16548
16578
  diamond: "M0-0.707L0.707,0L0,0.707L-0.707,0Z",
@@ -16552,6 +16582,7 @@ const _sfc_main$N = {
16552
16582
  const binds = computed(() => {
16553
16583
  let d = __props.shape?.startsWith?.("path:") ? __props.shape?.slice?.(5) : paths[__props.shape];
16554
16584
  let result = {
16585
+ color: __props.color || null,
16555
16586
  fill: __props.color || null,
16556
16587
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
16557
16588
  stroke: __props.stroke || null,
@@ -16560,10 +16591,11 @@ const _sfc_main$N = {
16560
16591
  "stroke-dasharray": parseLinetype(__props.linetype).join(" ") || null
16561
16592
  };
16562
16593
  if (d != null) {
16563
- let transform = `translate(${__props.x + __props.translateX},${__props.y + __props.translateY})`;
16564
- if (__props.size != 1) transform += `scale(${__props.size})`;
16565
- if (__props.angle) transform += `rotate(${__props.angle})`;
16566
- Object.assign(result, { d, transform });
16594
+ let transform = [], tslX = __props.x + __props.translateX, tslY = __props.y + __props.translateY;
16595
+ if (tslX !== 0 || tslY !== 0) transform.push(`translate(${tslX},${tslY})`);
16596
+ if (__props.size != 1) transform.push(`scale(${__props.size})`);
16597
+ if (__props.angle) transform.push(`rotate(${__props.angle})`);
16598
+ Object.assign(result, { d, transform: transform.join(" ") || null });
16567
16599
  } else {
16568
16600
  let transform = __props.translateX || __props.translateY ? `translate(${__props.translateX}, ${__props.translateY})` : null;
16569
16601
  Object.assign(result, { cx: __props.x, cy: __props.y, r: __props.size / 2, transform });
@@ -16603,6 +16635,7 @@ const _sfc_main$M = {
16603
16635
  x2: __props.x2,
16604
16636
  y1: __props.y1,
16605
16637
  y2: __props.y2,
16638
+ color: __props.color || null,
16606
16639
  stroke: __props.color || null,
16607
16640
  "stroke-width": __props.linewidth,
16608
16641
  "stroke-opacity": __props.alpha == 1 ? null : __props.alpha,
@@ -16625,7 +16658,9 @@ const _sfc_main$L = {
16625
16658
  data: Object,
16626
16659
  coord2pos: Function,
16627
16660
  getCoord: Function,
16628
- layout: Object
16661
+ layout: Object,
16662
+ groupClass: null,
16663
+ groupStyle: null
16629
16664
  },
16630
16665
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
16631
16666
  setup(__props, { emit: __emit }) {
@@ -16658,6 +16693,8 @@ const _sfc_main$L = {
16658
16693
  title,
16659
16694
  "translate-x": translateX = 0,
16660
16695
  "translate-y": translateY = 0,
16696
+ class: className,
16697
+ style,
16661
16698
  $raw
16662
16699
  }) => {
16663
16700
  const { hmin: x1, hmax: x22, vmin: y1, vmax: y22 } = __props.coord2pos({ xmin: $xmin, xmax: $xmax, ymin: $ymin, ymax: $ymax });
@@ -16684,7 +16721,9 @@ const _sfc_main$L = {
16684
16721
  alpha: alpha2,
16685
16722
  title,
16686
16723
  translateX,
16687
- translateY
16724
+ translateY,
16725
+ class: className,
16726
+ style
16688
16727
  },
16689
16728
  line: {
16690
16729
  x1: lx1,
@@ -16696,7 +16735,9 @@ const _sfc_main$L = {
16696
16735
  linewidth,
16697
16736
  alpha: alpha2,
16698
16737
  translateX,
16699
- translateY
16738
+ translateY,
16739
+ class: className,
16740
+ style
16700
16741
  },
16701
16742
  midline: {
16702
16743
  x1: mx1,
@@ -16708,7 +16749,9 @@ const _sfc_main$L = {
16708
16749
  linewidth: (linewidth ?? 1) * 2,
16709
16750
  alpha: alpha2,
16710
16751
  translateX,
16711
- translateY
16752
+ translateY,
16753
+ class: className,
16754
+ style
16712
16755
  },
16713
16756
  uwisker: {
16714
16757
  x1: uwx1,
@@ -16720,7 +16763,9 @@ const _sfc_main$L = {
16720
16763
  linewidth,
16721
16764
  alpha: alpha2,
16722
16765
  translateX,
16723
- translateY
16766
+ translateY,
16767
+ class: className,
16768
+ style
16724
16769
  },
16725
16770
  lwisker: {
16726
16771
  x1: lwx1,
@@ -16732,7 +16777,9 @@ const _sfc_main$L = {
16732
16777
  linewidth,
16733
16778
  alpha: alpha2,
16734
16779
  translateX,
16735
- translateY
16780
+ translateY,
16781
+ class: className,
16782
+ style
16736
16783
  },
16737
16784
  outliers: outliers?.map(({ x: x3, y: y3, $raw: $raw2 }) => {
16738
16785
  const { h: cx, v: cy } = __props.coord2pos({ x: x3, y: y3 });
@@ -16744,7 +16791,9 @@ const _sfc_main$L = {
16744
16791
  color: color2,
16745
16792
  alpha: alpha2,
16746
16793
  translateX,
16747
- translateY
16794
+ translateY,
16795
+ class: className,
16796
+ style
16748
16797
  };
16749
16798
  let von2 = Object.fromEntries(
16750
16799
  events.map((evt) => [evt, (e) => emit(evt, e, $raw2)])
@@ -16761,7 +16810,7 @@ const _sfc_main$L = {
16761
16810
  return (_ctx, _cache) => {
16762
16811
  return openBlock(), createElementBlock("g", null, [
16763
16812
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
16764
- return openBlock(), createElementBlock("g", null, [
16813
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
16765
16814
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbinds, von]) => {
16766
16815
  return openBlock(), createElementBlock("g", null, [
16767
16816
  createVNode(_sfc_main$M, mergeProps({ ref_for: true }, vbinds.line), null, 16),
@@ -16779,7 +16828,7 @@ const _sfc_main$L = {
16779
16828
  }), 256))
16780
16829
  ]);
16781
16830
  }), 256))
16782
- ]);
16831
+ ], 16);
16783
16832
  }), 256))
16784
16833
  ]);
16785
16834
  };
@@ -16803,10 +16852,12 @@ const _sfc_main$K = {
16803
16852
  },
16804
16853
  setup(__props) {
16805
16854
  const binds = computed(() => {
16806
- let interpolatorFn = interpolators[__props.interpolate] ?? natural$1;
16855
+ let interpolatorFn = typeof __props.interpolate == "function" ? __props.interpolate : interpolators[__props.interpolate] ?? natural$1;
16807
16856
  return {
16808
16857
  d: line().curve(interpolatorFn)(__props.points.map((p) => [p.x, p.y])),
16858
+ color: __props.color || null,
16809
16859
  fill: __props.fill || null,
16860
+ "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
16810
16861
  stroke: __props.color || null,
16811
16862
  "stroke-width": __props.linewidth,
16812
16863
  "stroke-opacity": __props.alpha == 1 ? null : __props.alpha,
@@ -16835,7 +16886,9 @@ const _sfc_main$J = {
16835
16886
  data: Object,
16836
16887
  coord2pos: Function,
16837
16888
  getCoord: Function,
16838
- layout: Object
16889
+ layout: Object,
16890
+ groupClass: null,
16891
+ groupStyle: null
16839
16892
  },
16840
16893
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
16841
16894
  setup(__props, { emit: __emit }) {
@@ -16853,6 +16906,8 @@ const _sfc_main$J = {
16853
16906
  title,
16854
16907
  "translate-x": translateX = 0,
16855
16908
  "translate-y": translateY = 0,
16909
+ class: className,
16910
+ style,
16856
16911
  $raw,
16857
16912
  interpolate: interpolate2
16858
16913
  }) => {
@@ -16868,6 +16923,8 @@ const _sfc_main$J = {
16868
16923
  title,
16869
16924
  translateX,
16870
16925
  translateY,
16926
+ class: className,
16927
+ style,
16871
16928
  interpolate: interpolate2
16872
16929
  };
16873
16930
  let von = Object.fromEntries(
@@ -16879,11 +16936,11 @@ const _sfc_main$J = {
16879
16936
  return (_ctx, _cache) => {
16880
16937
  return openBlock(), createElementBlock("g", null, [
16881
16938
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
16882
- return openBlock(), createElementBlock("g", null, [
16939
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
16883
16940
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
16884
16941
  return openBlock(), createBlock(_sfc_main$K, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
16885
16942
  }), 256))
16886
- ]);
16943
+ ], 16);
16887
16944
  }), 256))
16888
16945
  ]);
16889
16946
  };
@@ -16917,6 +16974,7 @@ const _sfc_main$I = {
16917
16974
  cy: __props.cy,
16918
16975
  rx: __props.rx,
16919
16976
  ry: __props.ry,
16977
+ color: __props.color || null,
16920
16978
  fill: __props.fill || null,
16921
16979
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
16922
16980
  stroke: __props.color || null,
@@ -16942,7 +17000,9 @@ const _sfc_main$H = {
16942
17000
  data: Object,
16943
17001
  coord2pos: Function,
16944
17002
  getCoord: Function,
16945
- layout: Object
17003
+ layout: Object,
17004
+ groupClass: null,
17005
+ groupStyle: null
16946
17006
  },
16947
17007
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
16948
17008
  setup(__props, { emit: __emit }) {
@@ -16964,6 +17024,8 @@ const _sfc_main$H = {
16964
17024
  title,
16965
17025
  "translate-x": translateX = 0,
16966
17026
  "translate-y": translateY = 0,
17027
+ class: className,
17028
+ style,
16967
17029
  $raw
16968
17030
  }) => {
16969
17031
  let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
@@ -16979,9 +17041,9 @@ const _sfc_main$H = {
16979
17041
  let vbind = {
16980
17042
  cx: ch,
16981
17043
  cy: cv,
16982
- rx: 1 / Math.sqrt(tr / 2 + disc),
16983
- ry: 1 / Math.sqrt(tr / 2 - disc),
16984
- angle: -Math.atan2(2 * B, A - C) / 2 * 180 / Math.PI,
17044
+ rx: 1 / Math.sqrt(tr / 2 + disc) || 0,
17045
+ ry: 1 / Math.sqrt(tr / 2 - disc) || 0,
17046
+ angle: -Math.atan2(2 * B, A - C) / 2 * 180 / Math.PI || 0,
16985
17047
  fill,
16986
17048
  color: color2,
16987
17049
  linetype,
@@ -16989,7 +17051,9 @@ const _sfc_main$H = {
16989
17051
  alpha: alpha2,
16990
17052
  title,
16991
17053
  translateX,
16992
- translateY
17054
+ translateY,
17055
+ class: className,
17056
+ style
16993
17057
  };
16994
17058
  let von = Object.fromEntries(
16995
17059
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17000,11 +17064,11 @@ const _sfc_main$H = {
17000
17064
  return (_ctx, _cache) => {
17001
17065
  return openBlock(), createElementBlock("g", null, [
17002
17066
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17003
- return openBlock(), createElementBlock("g", null, [
17067
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17004
17068
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17005
17069
  return openBlock(), createBlock(_sfc_main$I, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17006
17070
  }), 256))
17007
- ]);
17071
+ ], 16);
17008
17072
  }), 256))
17009
17073
  ]);
17010
17074
  };
@@ -17018,7 +17082,9 @@ const _sfc_main$G = {
17018
17082
  data: Object,
17019
17083
  coord2pos: Function,
17020
17084
  getCoord: Function,
17021
- layout: Object
17085
+ layout: Object,
17086
+ groupClass: null,
17087
+ groupStyle: null
17022
17088
  },
17023
17089
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17024
17090
  setup(__props, { emit: __emit }) {
@@ -17038,6 +17104,8 @@ const _sfc_main$G = {
17038
17104
  title,
17039
17105
  "translate-x": translateX = 0,
17040
17106
  "translate-y": translateY = 0,
17107
+ class: className,
17108
+ style,
17041
17109
  $raw
17042
17110
  }) => {
17043
17111
  const { h: x1, v: y1 } = __props.coord2pos({ x: x2, y: y2 });
@@ -17054,7 +17122,9 @@ const _sfc_main$G = {
17054
17122
  alpha: alpha2,
17055
17123
  title,
17056
17124
  translateX,
17057
- translateY
17125
+ translateY,
17126
+ class: className,
17127
+ style
17058
17128
  };
17059
17129
  let von = Object.fromEntries(
17060
17130
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17065,11 +17135,11 @@ const _sfc_main$G = {
17065
17135
  return (_ctx, _cache) => {
17066
17136
  return openBlock(), createElementBlock("g", null, [
17067
17137
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17068
- return openBlock(), createElementBlock("g", null, [
17138
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17069
17139
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17070
17140
  return openBlock(), createBlock(_sfc_main$M, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17071
17141
  }), 256))
17072
- ]);
17142
+ ], 16);
17073
17143
  }), 256))
17074
17144
  ]);
17075
17145
  };
@@ -17083,7 +17153,9 @@ const _sfc_main$F = {
17083
17153
  data: Object,
17084
17154
  coord2pos: Function,
17085
17155
  getCoord: Function,
17086
- layout: Object
17156
+ layout: Object,
17157
+ groupClass: null,
17158
+ groupStyle: null
17087
17159
  },
17088
17160
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17089
17161
  setup(__props, { emit: __emit }) {
@@ -17112,6 +17184,8 @@ const _sfc_main$F = {
17112
17184
  "text-length": textLength,
17113
17185
  "font-family": fontFamily = "sans-serif",
17114
17186
  "text-anchor": textAnchor,
17187
+ class: className,
17188
+ style,
17115
17189
  $raw
17116
17190
  }) => {
17117
17191
  if (label == null) return null;
@@ -17136,6 +17210,8 @@ const _sfc_main$F = {
17136
17210
  angle: angle2,
17137
17211
  translateX,
17138
17212
  translateY,
17213
+ class: className,
17214
+ style,
17139
17215
  anchorX,
17140
17216
  anchorY,
17141
17217
  dockX,
@@ -17153,11 +17229,11 @@ const _sfc_main$F = {
17153
17229
  return (_ctx, _cache) => {
17154
17230
  return openBlock(), createElementBlock("g", null, [
17155
17231
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17156
- return openBlock(), createElementBlock("g", null, [
17232
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17157
17233
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17158
17234
  return openBlock(), createBlock(_sfc_main$12, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17159
17235
  }), 256))
17160
- ]);
17236
+ ], 16);
17161
17237
  }), 256))
17162
17238
  ]);
17163
17239
  };
@@ -17171,7 +17247,9 @@ const _sfc_main$E = {
17171
17247
  data: Object,
17172
17248
  coord2pos: Function,
17173
17249
  getCoord: Function,
17174
- layout: Object
17250
+ layout: Object,
17251
+ groupClass: null,
17252
+ groupStyle: null
17175
17253
  },
17176
17254
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17177
17255
  setup(__props, { emit: __emit }) {
@@ -17197,6 +17275,8 @@ const _sfc_main$E = {
17197
17275
  "font-family": fontFamily = "sans-serif",
17198
17276
  "text-align": textAlign = "start",
17199
17277
  inset = 0,
17278
+ class: className,
17279
+ style,
17200
17280
  $raw
17201
17281
  }) => {
17202
17282
  if (label == null) return null;
@@ -17205,14 +17285,17 @@ const _sfc_main$E = {
17205
17285
  if (x1 < xlim_min && x22 < xlim_min || x1 > xlim_max && x22 > xlim_max || y1 < ylim_min && y22 < ylim_min || y1 > ylim_max && y22 > ylim_max) return null;
17206
17286
  let radian = Math.atan2(y22 - y1, x22 - x1);
17207
17287
  let vbind = {
17208
- fill: color2,
17288
+ color: color2 || null,
17289
+ fill: color2 || null,
17290
+ "fill-opacity": alpha2 == 1 ? null : alpha2,
17209
17291
  "font-size": size * 4,
17210
- stroke,
17292
+ stroke: stroke || null,
17211
17293
  "stroke-width": linewidth,
17212
17294
  "stroke-dasharray": parseLinetype(linetype).join(" ") || null,
17213
- "fill-opacity": alpha2,
17214
- "stroke-opacity": alpha2,
17215
- "font-family": fontFamily
17295
+ "stroke-opacity": alpha2 == 1 ? null : alpha2,
17296
+ "font-family": fontFamily,
17297
+ class: className,
17298
+ style
17216
17299
  };
17217
17300
  let von = Object.fromEntries(
17218
17301
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17327,7 +17410,7 @@ const _sfc_main$E = {
17327
17410
  return (_ctx, _cache) => {
17328
17411
  return openBlock(), createElementBlock("g", null, [
17329
17412
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17330
- return openBlock(), createElementBlock("g", null, [
17413
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17331
17414
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von, textFragments, title]) => {
17332
17415
  return openBlock(), createElementBlock("text", mergeProps({ ref_for: true }, vbind, toHandlers(von, true)), [
17333
17416
  createElementVNode("title", null, toDisplayString(title), 1),
@@ -17337,7 +17420,7 @@ const _sfc_main$E = {
17337
17420
  }), 256))
17338
17421
  ], 16);
17339
17422
  }), 256))
17340
- ]);
17423
+ ], 16);
17341
17424
  }), 256))
17342
17425
  ]);
17343
17426
  };
@@ -17351,7 +17434,9 @@ const _sfc_main$D = {
17351
17434
  data: Object,
17352
17435
  coord2pos: Function,
17353
17436
  getCoord: Function,
17354
- layout: Object
17437
+ layout: Object,
17438
+ groupClass: null,
17439
+ groupStyle: null
17355
17440
  },
17356
17441
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17357
17442
  setup(__props, { emit: __emit }) {
@@ -17373,6 +17458,8 @@ const _sfc_main$D = {
17373
17458
  "translate-x": translateX = 0,
17374
17459
  "translate-y": translateY = 0,
17375
17460
  angle: angle2,
17461
+ class: className,
17462
+ style,
17376
17463
  $raw
17377
17464
  }) => {
17378
17465
  const { h: cx, v: cy } = __props.coord2pos({ x: x2, y: y2 });
@@ -17390,7 +17477,9 @@ const _sfc_main$D = {
17390
17477
  title,
17391
17478
  angle: angle2,
17392
17479
  translateX,
17393
- translateY
17480
+ translateY,
17481
+ class: className,
17482
+ style
17394
17483
  };
17395
17484
  let von = Object.fromEntries(
17396
17485
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17401,11 +17490,11 @@ const _sfc_main$D = {
17401
17490
  return (_ctx, _cache) => {
17402
17491
  return openBlock(), createElementBlock("g", null, [
17403
17492
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17404
- return openBlock(), createElementBlock("g", null, [
17493
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17405
17494
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17406
17495
  return openBlock(), createBlock(_sfc_main$N, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17407
17496
  }), 256))
17408
- ]);
17497
+ ], 16);
17409
17498
  }), 256))
17410
17499
  ]);
17411
17500
  };
@@ -17429,6 +17518,7 @@ const _sfc_main$C = {
17429
17518
  const binds = computed(() => {
17430
17519
  return {
17431
17520
  points: __props.points.map((p) => `${p.x},${p.y}`).join(" "),
17521
+ color: __props.color || null,
17432
17522
  fill: __props.fill || null,
17433
17523
  "fill-opacity": __props.alpha == 1 ? null : __props.alpha,
17434
17524
  stroke: __props.color || null,
@@ -17453,7 +17543,9 @@ const _sfc_main$B = {
17453
17543
  data: Object,
17454
17544
  coord2pos: Function,
17455
17545
  getCoord: Function,
17456
- layout: Object
17546
+ layout: Object,
17547
+ groupClass: null,
17548
+ groupStyle: null
17457
17549
  },
17458
17550
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17459
17551
  setup(__props, { emit: __emit }) {
@@ -17471,6 +17563,8 @@ const _sfc_main$B = {
17471
17563
  title,
17472
17564
  "translate-x": translateX = 0,
17473
17565
  "translate-y": translateY = 0,
17566
+ class: className,
17567
+ style,
17474
17568
  $raw
17475
17569
  }) => {
17476
17570
  points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p)));
@@ -17484,7 +17578,9 @@ const _sfc_main$B = {
17484
17578
  alpha: alpha2,
17485
17579
  title,
17486
17580
  translateX,
17487
- translateY
17581
+ translateY,
17582
+ class: className,
17583
+ style
17488
17584
  };
17489
17585
  let von = Object.fromEntries(
17490
17586
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17495,11 +17591,11 @@ const _sfc_main$B = {
17495
17591
  return (_ctx, _cache) => {
17496
17592
  return openBlock(), createElementBlock("g", null, [
17497
17593
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17498
- return openBlock(), createElementBlock("g", null, [
17594
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17499
17595
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17500
17596
  return openBlock(), createBlock(_sfc_main$C, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17501
17597
  }), 256))
17502
- ]);
17598
+ ], 16);
17503
17599
  }), 256))
17504
17600
  ]);
17505
17601
  };
@@ -17513,7 +17609,9 @@ const _sfc_main$A = {
17513
17609
  data: Object,
17514
17610
  coord2pos: Function,
17515
17611
  getCoord: Function,
17516
- layout: Object
17612
+ layout: Object,
17613
+ groupClass: null,
17614
+ groupStyle: null
17517
17615
  },
17518
17616
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17519
17617
  setup(__props, { emit: __emit }) {
@@ -17534,6 +17632,8 @@ const _sfc_main$A = {
17534
17632
  title,
17535
17633
  "translate-x": translateX = 0,
17536
17634
  "translate-y": translateY = 0,
17635
+ class: className,
17636
+ style,
17537
17637
  $raw
17538
17638
  }) => {
17539
17639
  const { hmin: x1, hmax: x2, vmin: y1, vmax: y2 } = __props.coord2pos({ xmin, xmax, ymin, ymax });
@@ -17550,7 +17650,9 @@ const _sfc_main$A = {
17550
17650
  alpha: alpha2,
17551
17651
  title,
17552
17652
  translateX,
17553
- translateY
17653
+ translateY,
17654
+ class: className,
17655
+ style
17554
17656
  };
17555
17657
  let von = Object.fromEntries(
17556
17658
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17561,11 +17663,11 @@ const _sfc_main$A = {
17561
17663
  return (_ctx, _cache) => {
17562
17664
  return openBlock(), createElementBlock("g", null, [
17563
17665
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17564
- return openBlock(), createElementBlock("g", null, [
17666
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17565
17667
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17566
17668
  return openBlock(), createBlock(_sfc_main$O, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17567
17669
  }), 256))
17568
- ]);
17670
+ ], 16);
17569
17671
  }), 256))
17570
17672
  ]);
17571
17673
  };
@@ -17579,7 +17681,9 @@ const _sfc_main$z = {
17579
17681
  data: Object,
17580
17682
  coord2pos: Function,
17581
17683
  getCoord: Function,
17582
- layout: Object
17684
+ layout: Object,
17685
+ groupClass: null,
17686
+ groupStyle: null
17583
17687
  },
17584
17688
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17585
17689
  setup(__props, { emit: __emit }) {
@@ -17608,6 +17712,8 @@ const _sfc_main$z = {
17608
17712
  "text-length": textLength,
17609
17713
  "font-family": fontFamily,
17610
17714
  "text-anchor": textAnchor,
17715
+ class: className,
17716
+ style,
17611
17717
  $raw
17612
17718
  }) => {
17613
17719
  if (label == null) return null;
@@ -17632,6 +17738,8 @@ const _sfc_main$z = {
17632
17738
  angle: angle2,
17633
17739
  translateX,
17634
17740
  translateY,
17741
+ class: className,
17742
+ style,
17635
17743
  anchorX,
17636
17744
  anchorY,
17637
17745
  dockX,
@@ -17649,11 +17757,11 @@ const _sfc_main$z = {
17649
17757
  return (_ctx, _cache) => {
17650
17758
  return openBlock(), createElementBlock("g", null, [
17651
17759
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17652
- return openBlock(), createElementBlock("g", null, [
17760
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17653
17761
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17654
17762
  return openBlock(), createBlock(_sfc_main$13, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17655
17763
  }), 256))
17656
- ]);
17764
+ ], 16);
17657
17765
  }), 256))
17658
17766
  ]);
17659
17767
  };
@@ -17667,7 +17775,9 @@ const _sfc_main$y = {
17667
17775
  data: Object,
17668
17776
  coord2pos: Function,
17669
17777
  getCoord: Function,
17670
- layout: Object
17778
+ layout: Object,
17779
+ groupClass: null,
17780
+ groupStyle: null
17671
17781
  },
17672
17782
  emits: ["click", "contextmenu", "singleclick", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup", "wheel"],
17673
17783
  setup(__props, { emit: __emit }) {
@@ -17694,6 +17804,8 @@ const _sfc_main$y = {
17694
17804
  "text-align": textAlign = "justify",
17695
17805
  angle: angle2 = "auto",
17696
17806
  inset = 0,
17807
+ class: className,
17808
+ style,
17697
17809
  $raw
17698
17810
  }) => {
17699
17811
  if (label == null) return null;
@@ -17701,14 +17813,17 @@ const _sfc_main$y = {
17701
17813
  const { h: x22, v: y22 } = __props.coord2pos({ x: xend, y: yend });
17702
17814
  if (x1 < xlim_min && x22 < xlim_min || x1 > xlim_max && x22 > xlim_max || y1 < ylim_min && y22 < ylim_min || y1 > ylim_max && y22 > ylim_max) return null;
17703
17815
  let vbind = {
17704
- fill: color2,
17816
+ color: color2 || null,
17817
+ fill: color2 || null,
17818
+ "fill-opacity": alpha2 == 1 ? null : alpha2,
17705
17819
  "font-size": size * 4,
17706
- stroke,
17820
+ stroke: stroke || null,
17707
17821
  "stroke-width": linewidth,
17708
17822
  "stroke-dasharray": parseLinetype(linetype).join(" ") || null,
17709
- "fill-opacity": alpha2,
17710
- "stroke-opacity": alpha2,
17711
- "font-family": fontFamily
17823
+ "stroke-opacity": alpha2 == 1 ? null : alpha2,
17824
+ "font-family": fontFamily,
17825
+ class: className,
17826
+ style
17712
17827
  };
17713
17828
  let von = Object.fromEntries(
17714
17829
  events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
@@ -17806,7 +17921,7 @@ const _sfc_main$y = {
17806
17921
  return (_ctx, _cache) => {
17807
17922
  return openBlock(), createElementBlock("g", null, [
17808
17923
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17809
- return openBlock(), createElementBlock("g", null, [
17924
+ return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17810
17925
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von, content, title]) => {
17811
17926
  return openBlock(), createElementBlock("text", mergeProps({ ref_for: true }, vbind, toHandlers(von, true)), [
17812
17927
  createElementVNode("title", null, toDisplayString(title), 1),
@@ -17823,7 +17938,7 @@ const _sfc_main$y = {
17823
17938
  }), 256))
17824
17939
  ], 16);
17825
17940
  }), 256))
17826
- ]);
17941
+ ], 16);
17827
17942
  }), 256))
17828
17943
  ]);
17829
17944
  };
@@ -18233,18 +18348,23 @@ const _sfc_main$u = {
18233
18348
  }));
18234
18349
  let binds = categorize(keys.map((v) => v.bind));
18235
18350
  let group = Map.groupBy(keys.map((v) => v.label), (v, i) => binds.categories[binds[i]]);
18236
- return Array.from(group).map(([bind, labels]) => ({
18237
- bind,
18238
- label: labels.join("; ")
18239
- }));
18351
+ return Array.from(group).map(([$bind, labels]) => {
18352
+ let bind = { tile: {}, line: {}, point: {}, text: {} };
18353
+ for (let geom in bind) {
18354
+ for (let prop2 of Object.keys(element[geom].props)) {
18355
+ if ($bind[prop2]) bind[geom][prop2] = $bind[prop2];
18356
+ }
18357
+ }
18358
+ return { bind, label: labels.join("; ") };
18359
+ });
18240
18360
  });
18241
18361
  const geoms = computed(() => {
18242
18362
  let { text: text2, line: line2, point: point2, tile: tile2 } = __props.appearances;
18243
18363
  let result = {};
18244
- if (text2 != null) result.text = { size: 4, text: "a", ...text2 };
18364
+ if (tile2 != null) result.tile = { width: 10, height: 10, fill: "transparent", ...tile2 };
18245
18365
  if (line2 != null) result.line = { x1: -5, x2: 5, color: "black", ...line2 };
18246
18366
  if (point2 != null) result.point = { size: 6, ...point2 };
18247
- if (tile2 != null) result.tile = { width: 10, height: 10, fill: "transparent", ...tile2 };
18367
+ if (text2 != null) result.text = { size: 4, text: "a", ...text2 };
18248
18368
  return result;
18249
18369
  });
18250
18370
  const width = ref(0);
@@ -18267,7 +18387,7 @@ const _sfc_main$u = {
18267
18387
  }, [
18268
18388
  createElementVNode("g", _hoisted_3$1, [
18269
18389
  (openBlock(true), createElementBlock(Fragment, null, renderList(geoms.value, (bind, geom) => {
18270
- return openBlock(), createBlock(resolveDynamicComponent(element[geom]), mergeProps({ ref_for: true }, { ...bind, ...v.bind }), null, 16);
18390
+ return openBlock(), createBlock(resolveDynamicComponent(element[geom]), mergeProps({ ref_for: true }, { ...bind, ...v.bind[geom] }), null, 16);
18271
18391
  }), 256))
18272
18392
  ]),
18273
18393
  _cache[0] || (_cache[0] = createTextVNode()),
@@ -18290,7 +18410,7 @@ const _sfc_main$t = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18290
18410
  gradientbar: _sfc_main$v
18291
18411
  };
18292
18412
  const title = computed(() => {
18293
- return __props.scales.map(([s]) => s.title).find((v) => v != null);
18413
+ return __props.scales.reduce((v, [s]) => v ?? s.title, null) ?? __props.scales.reduce((v, [s]) => v ?? s._title, null);
18294
18414
  });
18295
18415
  const breaks = computed(() => {
18296
18416
  let scale_funcs = __props.scales.map(([s]) => s);
@@ -18309,10 +18429,10 @@ const _sfc_main$t = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18309
18429
  let result = { scales: __props.scales.map(([s]) => s) };
18310
18430
  if (__props.type == "legendkey") {
18311
18431
  result.appearances = {
18312
- text: obj_merge(...__props.scales.flatMap(([s, a]) => [a.text, a.markdown])),
18432
+ tile: obj_merge(...__props.scales.flatMap(([s, a]) => [a.rect, a.tile, a.polygon, a.ellipse])),
18313
18433
  line: obj_merge(...__props.scales.flatMap(([s, a]) => [a.line, a.linerange, a.curve])),
18314
18434
  point: obj_merge(...__props.scales.flatMap(([s, a]) => [a.point])),
18315
- tile: obj_merge(...__props.scales.flatMap(([s, a]) => [a.rect, a.tile, a.polygon, a.ellipse]))
18435
+ text: obj_merge(...__props.scales.flatMap(([s, a]) => [a.text, a.markdown]))
18316
18436
  };
18317
18437
  } else if (__props.type == "gradientbar") {
18318
18438
  let max = __props.scales.map(([s]) => s.limits?.max).filter((v) => v != null).reduce((a, b) => Math.min(a, b), Infinity);
@@ -18339,15 +18459,13 @@ const _sfc_main$s = {
18339
18459
  },
18340
18460
  setup(__props) {
18341
18461
  const guides = computed(() => {
18342
- let guide_scales = new Map(
18343
- Array.from(__props.scales).filter(([fn]) => fn.legend !== false)
18344
- );
18462
+ let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false));
18345
18463
  let scale_fns = Array.from(guide_scales.keys());
18346
18464
  let keys = scale_fns.map((s) => s.key);
18347
- let j = 1;
18348
- for (let i in keys) {
18349
- while (keys.includes("_guide_" + j)) j++;
18350
- if (keys[i] == null) keys[i] = "_guide_" + j;
18465
+ let n = 1;
18466
+ for (let i = 0; i < keys.length; i++) {
18467
+ while (keys.includes("_guide_" + n)) n++;
18468
+ keys[i] ??= keys.find((_, j) => keys[j] != null && GEnumLevel.isEqual(scale_fns[j].level, scale_fns[i].level)) ?? "_guide_" + n;
18351
18469
  }
18352
18470
  let types = scale_fns.map((s) => getGuideType(s));
18353
18471
  let groups = interaction(keys, types);
@@ -18659,13 +18777,16 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18659
18777
  }
18660
18778
  function getCoord(event) {
18661
18779
  let rect2 = svgRef.value.getBoundingClientRect();
18662
- let l = Math.trunc(event.clientX) - (rect2.left + panel.left + innerRect.left), t = Math.trunc(event.clientY) - (rect2.top + panel.top + innerRect.top), r = rect2.left + panel.left + innerRect.right - Math.trunc(event.clientX), b = rect2.top + panel.top + innerRect.bottom - Math.trunc(event.clientY);
18780
+ let scaleX = rect2.width / svgRef.value.clientWidth, scaleY = rect2.height / svgRef.value.clientHeight;
18781
+ let offsetX = event.clientX - rect2.left, offsetY = event.clientY - rect2.top;
18782
+ let l = offsetX / scaleX - (panel.left + innerRect.left), t = offsetY / scaleY - (panel.top + innerRect.top), r = panel.left + innerRect.right - offsetX / scaleX, b = panel.top + innerRect.bottom - offsetY / scaleY;
18663
18783
  let { x: x2, y: y2 } = pos2coord({ h: l, v: t });
18664
18784
  return { l, t, r, b, x: x2, y: y2 };
18665
18785
  }
18666
18786
  function isInPlot(event) {
18667
18787
  let rect2 = svgRef.value.getBoundingClientRect();
18668
- return event.clientX > rect2.left + panel.l && event.clientX < rect2.right - panel.r && event.clientY > rect2.top + panel.t && event.clientY < rect2.bottom - panel.b;
18788
+ let scaleX = rect2.width / svgRef.value.clientWidth, scaleY = rect2.height / svgRef.value.clientHeight;
18789
+ return event.clientX - rect2.left > panel.l * scaleX && rect2.right - event.clientX > panel.r * scaleX && event.clientY - rect2.top > panel.t * scaleY && rect2.bottom - event.clientY > panel.b * scaleY;
18669
18790
  }
18670
18791
  function dispatchPointerEvent(e) {
18671
18792
  if (!layers.value || e._vhandled || !isInPlot(e)) return e;
@@ -18789,6 +18910,8 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18789
18910
  }
18790
18911
  let act = props.action.find((a) => a.action == "move" && ["buttons", "ctrlKey", "shiftKey", "altKey", "metaKey"].every((k) => a[k] == e[k]));
18791
18912
  if (act) {
18913
+ let rect2 = svgRef.value.getBoundingClientRect();
18914
+ let scaleX = rect2.width / svgRef.value.clientWidth, scaleY = rect2.height / svgRef.value.clientHeight;
18792
18915
  e.target.setPointerCapture(e.pointerId);
18793
18916
  svg2.style.userSelect = "none";
18794
18917
  moveTimer = clearTimeout(moveTimer);
@@ -18799,13 +18922,13 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18799
18922
  let [h, v] = __props.flip ? [y2, x2] : [x2, y2];
18800
18923
  if (h) {
18801
18924
  movementX += ev.movementX;
18802
- let dh = oob_squish_any(-movementX, { min: boundary.hmin - hmin0, max: boundary.hmax - hmax0 });
18925
+ let dh = oob_squish_any(-movementX / scaleX, { min: boundary.hmin - hmin0, max: boundary.hmax - hmax0 });
18803
18926
  h1 = hmin0 + dh;
18804
18927
  h2 = hmax0 + dh;
18805
18928
  }
18806
18929
  if (v) {
18807
18930
  movementY += ev.movementY;
18808
- let dv = oob_squish_any(-movementY, { min: boundary.vmin - vmin0, max: boundary.vmax - vmax0 });
18931
+ let dv = oob_squish_any(-movementY / scaleY, { min: boundary.vmin - vmin0, max: boundary.vmax - vmax0 });
18809
18932
  v1 = vmin0 + dv;
18810
18933
  v2 = vmax0 + dv;
18811
18934
  }
@@ -19212,7 +19335,8 @@ const _sfc_main$l = {
19212
19335
  geom: "curve",
19213
19336
  stat: "curve"
19214
19337
  },
19215
- $_type: "layer"
19338
+ $_type: "layer",
19339
+ $_attrnames: ["interpolate"]
19216
19340
  };
19217
19341
  const _sfc_main$k = {
19218
19342
  $_props: {
@@ -19568,19 +19692,28 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19568
19692
  return vlayer.value.map((layer) => {
19569
19693
  let { geom, stat, scales, data, "extend-x": extendX, "extend-y": extendY, ...etc } = { ...layer.type.$_props, ...layer.props };
19570
19694
  let argnames = layer.type.$_argnames || [];
19695
+ let attrnames = layer.type.$_attrnames || [];
19571
19696
  let aes = {}, args = {}, attrs2 = {};
19572
19697
  let vBind2 = {};
19573
19698
  for (let key in etc) {
19574
19699
  if (key == "key") continue;
19575
19700
  if (argnames.includes(key)) {
19576
19701
  args[key] = etc[key];
19702
+ } else if (attrnames.includes(key)) {
19703
+ attrs2[key] = etc[key];
19577
19704
  } else if (key.startsWith("on")) {
19578
19705
  vBind2[key] = etc[key];
19579
19706
  } else if (typeof etc[key] === "function") {
19580
- aes[key] = etc[key];
19707
+ if (["item-class", "item-style"].includes(key)) {
19708
+ aes[key.slice(5)] = etc[key];
19709
+ } else {
19710
+ aes[key] = etc[key];
19711
+ }
19581
19712
  } else {
19582
- if (["class", "style", "render"].includes(key)) {
19713
+ if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
19583
19714
  vBind2[key] = etc[key];
19715
+ } else if (["item-class", "item-style"].includes(key)) {
19716
+ attrs2[key.slice(5)] = etc[key];
19584
19717
  } else {
19585
19718
  attrs2[key] = etc[key];
19586
19719
  }