@d3plus/core 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +781 -688
  2. package/es/src/charts/AreaPlot/index.js +2 -1
  3. package/es/src/charts/AreaPlot/index.js.map +1 -1
  4. package/es/src/charts/BarChart/index.js +3 -1
  5. package/es/src/charts/BarChart/index.js.map +1 -1
  6. package/es/src/charts/BoxWhisker/index.js +2 -1
  7. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  8. package/es/src/charts/BumpChart/index.js +2 -1
  9. package/es/src/charts/BumpChart/index.js.map +1 -1
  10. package/es/src/charts/Geomap/emit.js +44 -4
  11. package/es/src/charts/Geomap/emit.js.map +1 -1
  12. package/es/src/charts/Geomap/index.js +32 -2
  13. package/es/src/charts/Geomap/index.js.map +1 -1
  14. package/es/src/charts/LinePlot/index.js +2 -1
  15. package/es/src/charts/LinePlot/index.js.map +1 -1
  16. package/es/src/charts/Matrix/index.js +1 -0
  17. package/es/src/charts/Matrix/index.js.map +1 -1
  18. package/es/src/charts/Network/index.js +2 -1
  19. package/es/src/charts/Network/index.js.map +1 -1
  20. package/es/src/charts/Pack/index.js +1 -0
  21. package/es/src/charts/Pack/index.js.map +1 -1
  22. package/es/src/charts/Pie/index.js +1 -0
  23. package/es/src/charts/Pie/index.js.map +1 -1
  24. package/es/src/charts/Plot/index.js +99 -14
  25. package/es/src/charts/Plot/index.js.map +1 -1
  26. package/es/src/charts/Plot/pipeline.js +24 -3
  27. package/es/src/charts/Plot/pipeline.js.map +1 -1
  28. package/es/src/charts/Plot/pipelineDomains.js +3 -3
  29. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  30. package/es/src/charts/Plot/stackHelpers.js +128 -9
  31. package/es/src/charts/Plot/stackHelpers.js.map +1 -1
  32. package/es/src/charts/Radar/index.js +2 -1
  33. package/es/src/charts/Radar/index.js.map +1 -1
  34. package/es/src/charts/RadialMatrix/index.js +1 -0
  35. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  36. package/es/src/charts/Rings/index.js +2 -1
  37. package/es/src/charts/Rings/index.js.map +1 -1
  38. package/es/src/charts/Sankey/index.js +2 -1
  39. package/es/src/charts/Sankey/index.js.map +1 -1
  40. package/es/src/charts/Tree/index.js +2 -1
  41. package/es/src/charts/Tree/index.js.map +1 -1
  42. package/es/src/charts/Treemap/index.js +1 -0
  43. package/es/src/charts/Treemap/index.js.map +1 -1
  44. package/es/src/charts/features/shapeEmit.js +3 -1
  45. package/es/src/charts/features/shapeEmit.js.map +1 -1
  46. package/es/src/charts/viz/Viz.js +63 -10
  47. package/es/src/charts/viz/Viz.js.map +1 -1
  48. package/es/src/charts/viz/interactionOpacity.js +4 -1
  49. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  50. package/es/src/charts/viz/vizDefaults.js +4 -1
  51. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  52. package/es/src/charts/viz/vizRender.js +7 -3
  53. package/es/src/charts/viz/vizRender.js.map +1 -1
  54. package/es/src/charts/viz/vizTypes.js.map +1 -1
  55. package/es/src/shapes/Image.js +2 -3
  56. package/es/src/shapes/Image.js.map +1 -1
  57. package/es/src/shapes/Shape.js +47 -46
  58. package/es/src/shapes/Shape.js.map +1 -1
  59. package/es/src/shapes/hitAreaNode.js +31 -5
  60. package/es/src/shapes/hitAreaNode.js.map +1 -1
  61. package/es/src/shapes/interactionPoints.js +30 -0
  62. package/es/src/shapes/interactionPoints.js.map +1 -0
  63. package/es/src/shapes/sceneSort.js +304 -24
  64. package/es/src/shapes/sceneSort.js.map +1 -1
  65. package/es/src/shapes/shapeConfig.js.map +1 -1
  66. package/es/src/utils/D3plusConfig.js.map +1 -1
  67. package/package.json +9 -9
  68. package/types/src/charts/Plot/index.d.ts +44 -7
  69. package/types/src/charts/Plot/pipeline.d.ts +2 -1
  70. package/types/src/charts/Plot/stackHelpers.d.ts +62 -4
  71. package/types/src/charts/viz/Viz.d.ts +31 -1
  72. package/types/src/charts/viz/vizTypes.d.ts +18 -0
  73. package/types/src/shapes/Image.d.ts +2 -3
  74. package/types/src/shapes/Shape.d.ts +2 -4
  75. package/types/src/shapes/hitAreaNode.d.ts +5 -4
  76. package/types/src/shapes/interactionPoints.d.ts +15 -0
  77. package/types/src/shapes/sceneSort.d.ts +83 -8
  78. package/types/src/shapes/shapeConfig.d.ts +7 -0
  79. package/types/src/utils/D3plusConfig.d.ts +19 -2
  80. package/umd/d3plus-core.full.js +2371 -672
  81. package/umd/d3plus-core.full.js.map +1 -1
  82. package/umd/d3plus-core.full.min.js +1506 -1156
  83. package/umd/d3plus-core.js +804 -259
  84. package/umd/d3plus-core.js.map +1 -1
  85. package/umd/d3plus-core.min.js +591 -390
@@ -214,6 +214,7 @@ import { accessor, BaseClass, constant } from "../utils/index.js";
214
214
  import { installFluent } from "../fluent.js";
215
215
  import { buildLabelData } from "./buildLabelData.js";
216
216
  import { hitAreaNode } from "./hitAreaNode.js";
217
+ import { interactionPoints } from "./interactionPoints.js";
217
218
  /** Coerces a value to a finite number, or undefined. @private */ export function numOrUndef(v) {
218
219
  var n = Number(v);
219
220
  return Number.isFinite(n) ? n : undefined;
@@ -231,8 +232,7 @@ import { hitAreaNode } from "./hitAreaNode.js";
231
232
  });
232
233
  return parts.length ? parts : undefined;
233
234
  }
234
- import Image from "./Image.js";
235
- import { emitBackgroundImages, sortRanks } from "./sceneSort.js";
235
+ import { backgroundImageLayout, emitBackgroundImages, sortRanks } from "./sceneSort.js";
236
236
  /** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */ var shapeSchema = [
237
237
  {
238
238
  key: "activeOpacity",
@@ -249,6 +249,11 @@ import { emitBackgroundImages, sortRanks } from "./sceneSort.js";
249
249
  coerce: "const",
250
250
  default: constant(false)
251
251
  },
252
+ {
253
+ key: "backgroundImageFit",
254
+ coerce: "const",
255
+ default: constant("cover")
256
+ },
252
257
  {
253
258
  key: "discrete",
254
259
  coerce: "identity"
@@ -404,9 +409,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
404
409
  var tagName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "g";
405
410
  _class_call_check(this, Shape);
406
411
  var _this;
407
- _this = _call_super(this, Shape), _define_property(_this, "_backgroundImageClass", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_labelClass", void 0), _define_property(_this, "_name", void 0), _define_property(_this, "_tagName", void 0), _define_property(_this, "_textureDefs", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_update", void 0), _define_property(_this, "_enter", void 0), _define_property(_this, "_exit", void 0), _define_property(_this, "_hoverGroup", void 0), _define_property(_this, "_activeGroup", void 0), _define_property(_this, "_path", void 0), /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */ _define_property(_this, "_sceneRenderer", void 0);
412
+ _this = _call_super(this, Shape), _define_property(_this, "_data", void 0), _define_property(_this, "_labelClass", void 0), _define_property(_this, "_name", void 0), _define_property(_this, "_tagName", void 0), _define_property(_this, "_textureDefs", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_update", void 0), _define_property(_this, "_enter", void 0), _define_property(_this, "_exit", void 0), _define_property(_this, "_hoverGroup", void 0), _define_property(_this, "_activeGroup", void 0), _define_property(_this, "_path", void 0), /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */ _define_property(_this, "_sceneRenderer", void 0);
408
413
  installFluent(_this, shapeSchema);
409
- _this._backgroundImageClass = new Image();
410
414
  _this._data = [];
411
415
  _this._labelClass = new TextBox();
412
416
  _this._name = "Shape";
@@ -581,16 +585,13 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
581
585
  Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
582
586
  @param callback Optional callback invoked after rendering completes.
583
587
  */ /**
584
- Resolves a style accessor for a data point, mirroring the nested-data logic
585
- of _applyStyle so scene output matches DOM rendering.
588
+ Resolves a style accessor. For a nested shape (Line/Area) the accessor gets
589
+ the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.
586
590
  @private
587
591
  */ key: "_styleVal",
588
592
  value: function _styleVal(fn, d, i) {
589
593
  if (typeof fn !== "function") return fn;
590
- if (d.nested && d.key && d.values) {
591
- var first = d.values[0];
592
- return fn(first, this._data.indexOf(first));
593
- }
594
+ if (d.nested && d.key && d.values) return fn(d.data, d.i);
594
595
  return fn(d, i);
595
596
  }
596
597
  },
@@ -673,10 +674,10 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
673
674
  var data = this._data;
674
675
  if (this._dataFilter) data = this._dataFilter(data);
675
676
  var children = [];
676
- // Build the backgroundImage data for emission below. Each datum that
677
- // resolves to a non-false `backgroundImage(d, i)` becomes an
678
- // ImageNode positioned at the shape's geometry.
679
- var imageData = [];
677
+ // Collected background images, emitted below (after the geometry) as clipped,
678
+ // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a
679
+ // truthy URL contributes one spec.
680
+ var bgSpecs = [];
680
681
  // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of
681
682
  // `data`: the render backends sort each group's children ascending by `z`
682
683
  // (stably), so a lower rank paints first (behind) and a higher rank paints
@@ -689,14 +690,18 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
689
690
  var key = _this._nestWrapper(_this.schema.id)(d, i);
690
691
  var datum = d.__d3plusShape__ ? d.data : d;
691
692
  var transform = _this._sceneTransform(d, i);
693
+ // Per-point positions (Line/Area) shared by the geometry and its hit area
694
+ // so a hover anywhere on either resolves to the nearest point.
695
+ var iPoints = interactionPoints(d, _this.schema.x, _this.schema.y, _this.schema.defined);
692
696
  // Push the hit area (if any) before the geometry so it sits behind it.
697
+ // Line's is a fat path built from the geometry `d`; Bar/legend etc. a rect.
693
698
  if (_this.schema.hitArea) {
694
- var ha = hitAreaNode(_this.schema.hitArea, d, i, _this._aes(d, i), key, datum, _this._name, transform);
699
+ var ha = hitAreaNode(_this.schema.hitArea, d, i, _this._aes(d, i), key, datum, _this._name, transform, geom.d);
695
700
  // Share the datum's rank so the hit area stays paired just behind its
696
701
  // own geometry (equal `z`, kept in push order by the stable sort).
697
- if (ha) children.push(rank ? _object_spread_props(_object_spread({}, ha), {
702
+ if (ha) children.push(rank ? _object_spread_props(_object_spread({}, ha, iPoints), {
698
703
  z: rank[i]
699
- }) : ha);
704
+ }) : _object_spread({}, ha, iPoints));
700
705
  }
701
706
  children.push(_object_spread(_object_spread_props(_object_spread({}, geom), {
702
707
  key: key,
@@ -709,45 +714,41 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
709
714
  role: strOrUndef(_this._nestWrapper(_this.schema.role)(d, i)),
710
715
  label: strOrUndef(_this._nestWrapper(_this.schema.ariaLabel)(d, i))
711
716
  }
712
- }), rank ? {
717
+ }), iPoints, rank ? {
713
718
  z: rank[i]
714
719
  } : {}));
715
- // backgroundImage: collect a per-datum image when the accessor
716
- // returns a truthy URL. The image is sized to the shape's
717
- // geometry (preferring width/height fields when present).
720
+ // backgroundImage: collect a per-datum image (see backgroundImageLayout for
721
+ // the cover/contain fit). The wrapping group carries the shape transform,
722
+ // so the image box + clip stay in local space.
718
723
  var bg = _this._nestWrapper(_this.schema.backgroundImage)(d, i);
719
724
  if (bg) {
720
- var _t_x, _t_y;
725
+ var _this__aes_points;
721
726
  var g = geom;
722
- // Shape geometry is origin-centered; its on-screen position lives in
723
- // the node transform. The background image is emitted as a flat sibling
724
- // (no transform), so bake the shape's translate into the image x/y —
725
- // otherwise every image lands at the origin (top-left).
726
- var t = _this._sceneTransform(d, i);
727
- var w = typeof g.width === "number" ? g.width : undefined;
728
- var h = typeof g.height === "number" ? g.height : undefined;
729
- var cx = typeof g.cx === "number" ? g.cx : typeof g.x === "number" ? g.x : 0;
730
- var cy = typeof g.cy === "number" ? g.cy : typeof g.y === "number" ? g.y : 0;
731
- var r = typeof g.r === "number" ? g.r : undefined;
732
- var iw = w !== null && w !== void 0 ? w : r != null ? r * 2 : 0;
733
- var ih = h !== null && h !== void 0 ? h : r != null ? r * 2 : 0;
734
- imageData.push({
735
- __d3plus__: true,
736
- data: d,
737
- i: i,
738
- id: _this._nestWrapper(_this.schema.id)(d, i),
739
- url: bg,
740
- x: ((_t_x = t.x) !== null && _t_x !== void 0 ? _t_x : 0) + cx - iw / 2,
741
- y: ((_t_y = t.y) !== null && _t_y !== void 0 ? _t_y : 0) + cy - ih / 2,
742
- width: iw,
743
- height: ih
744
- });
727
+ // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle
728
+ // derive their layout from `d`/width/r directly.
729
+ var needsPoints = typeof g.d !== "string" && typeof g.width !== "number" && typeof g.r !== "number";
730
+ var points = needsPoints ? (_this__aes_points = _this._aes(d, i).points) !== null && _this__aes_points !== void 0 ? _this__aes_points : [] : [];
731
+ var fit = _this._nestWrapper(_this.schema.backgroundImageFit)(d, i);
732
+ var layout = backgroundImageLayout(g, points, fit === "contain" ? "contain" : "cover");
733
+ if (layout) {
734
+ bgSpecs.push({
735
+ key: key,
736
+ index: i,
737
+ datum: datum,
738
+ url: bg,
739
+ box: layout.box,
740
+ clip: layout.clip,
741
+ preserveAspectRatio: layout.preserveAspectRatio,
742
+ opacity: numOrUndef(_this._nestWrapper(_this.schema.opacity)(d, i)),
743
+ transform: transform
744
+ });
745
+ }
745
746
  }
746
747
  });
747
748
  // Emit background images AFTER shape children so they paint above the
748
749
  // shape's fill — matches the DOM order where the <image> was
749
750
  // appended as a sibling of the shape.
750
- if (imageData.length) (_children = children).push.apply(_children, _to_consumable_array(emitBackgroundImages(this._backgroundImageClass, imageData, rank, data.length)));
751
+ if (bgSpecs.length) (_children = children).push.apply(_children, _to_consumable_array(emitBackgroundImages(bgSpecs, rank, data.length)));
751
752
  // NOTE: Labels are NOT pushed here. The canonical aggregation point is
752
753
  // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`
753
754
  // AND `shape._labelClass.toScene()` independently. Pushing labels here
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/shapes/Shape.ts"],"sourcesContent":["import {color} from \"d3-color\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast} from \"@d3plus/color\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, getSize, isObject} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {SvgRenderer} from \"@d3plus/render\";\nimport type {GroupNode, Paint, SceneNode, Transform} from \"@d3plus/render\";\n\nimport {TextBox} from \"../components/index.js\";\nimport {accessor, BaseClass, constant} from \"../utils/index.js\";\nimport type {AccessorFn, D3plusConfig} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\nimport {buildLabelData} from \"./buildLabelData.js\";\nimport {hitAreaNode} from \"./hitAreaNode.js\";\nimport type {BaseShapeConfig} from \"./shapeConfig.js\";\n\n/** Coerces a value to a finite number, or undefined. @private */\nexport function numOrUndef(v: unknown): number | undefined {\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Returns a non-empty string, or undefined. @private */\nexport function strOrUndef(v: unknown): string | undefined {\n return v == null || v === \"\" ? undefined : String(v);\n}\n\n/** Parses an SVG stroke-dasharray value into an array of numbers. @private */\nexport function parseDash(v: unknown): number[] | undefined {\n if (v == null || v === \"none\" || v === \"\") return undefined;\n if (typeof v === \"number\") return [v];\n const parts = String(v)\n .split(/[\\s,]+/)\n .map(Number)\n .filter(n => Number.isFinite(n));\n return parts.length ? parts : undefined;\n}\n\nexport interface ShapeAes {\n width?: number;\n height?: number;\n points?: [number, number][];\n r?: number;\n x?: number;\n y?: number;\n}\n\n\nimport Image from \"./Image.js\";\nimport {emitBackgroundImages, sortRanks} from \"./sceneSort.js\";\n\n/** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst shapeSchema: ConfigField[] = [\n {key: \"activeOpacity\", coerce: \"identity\", default: 0.25},\n {key: \"ariaLabel\", coerce: \"const\", default: constant(\"\")},\n {key: \"backgroundImage\", coerce: \"const\", default: constant(false)},\n {key: \"discrete\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"fill\", coerce: \"const\", default: constant(\"black\")},\n {key: \"fillOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"hitArea\", coerce: \"const\"},\n {key: \"hoverOpacity\", coerce: \"identity\", default: 0.5},\n {\n key: \"id\",\n coerce: \"accessor\",\n default: (d: DataPoint, i?: number) => (d.id !== void 0 ? d.id : i!),\n },\n {key: \"label\", coerce: \"const\", default: constant(false)},\n {key: \"labelBounds\", coerce: \"const\"},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"visiblePainted\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"role\", coerce: \"const\", default: constant(\"presentation\")},\n {key: \"rotate\", coerce: \"const\", default: constant(0)},\n {key: \"rx\", coerce: \"const\", default: constant(0)},\n {key: \"ry\", coerce: \"const\", default: constant(0)},\n {key: \"scale\", coerce: \"const\", default: constant(1)},\n {key: \"shapeRendering\", coerce: \"const\", default: constant(\"geometricPrecision\")},\n {key: \"stroke\", coerce: \"const\"},\n {key: \"strokeDasharray\", coerce: \"const\", default: constant(\"0\")},\n {key: \"strokeLinecap\", coerce: \"const\", default: constant(\"butt\")},\n {key: \"strokeOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"strokeWidth\", coerce: \"const\", default: constant(0)},\n {key: \"textAnchor\", coerce: \"const\", default: constant(\"start\")},\n {key: \"texture\", coerce: \"const\", default: constant(false)},\n {key: \"vectorEffect\", coerce: \"const\", default: constant(\"non-scaling-stroke\")},\n {key: \"verticalAlign\", coerce: \"const\", default: constant(\"top\")},\n // \"accessor\" (not \"const\"): a string names a data key (`.x(\"year\")`), a\n // number is a constant (`.x(50)`), and a function passes through — so a\n // standalone shape given string accessors (as the pipeline never does, but\n // direct users do) reads the field instead of treating \"x\" as the literal.\n {key: \"x\", coerce: \"accessor\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"accessor\", default: accessor(\"y\", 0)},\n];\n\n/**\n An abstracted class for generating shapes.\n*/\nexport default class Shape extends BaseClass {\n // installFluent generates the config accessors (fill, x, id, …) at runtime;\n // the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n\n _backgroundImageClass: Image;\n _data: DataPoint[];\n _labelClass: TextBox;\n _name: string;\n _tagName: string;\n _textureDefs: Record<string, Record<string, unknown>>;\n _select!: D3Selection;\n _transition!: ReturnType<typeof transition>;\n /** @param data The raw data array to filter. */\n _dataFilter?(data: DataPoint[]): DataPoint[];\n _group!: D3Selection;\n _update!: D3Selection;\n _enter!: D3Selection;\n _exit!: D3Selection;\n _hoverGroup!: D3Selection;\n _activeGroup!: D3Selection;\n _path!: Record<string, unknown>;\n /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor(tagName: string = \"g\") {\n super();\n\n installFluent(this, shapeSchema);\n\n this._backgroundImageClass = new Image();\n this._data = [];\n this._labelClass = new TextBox();\n this._name = \"Shape\";\n this._tagName = tagName;\n this._textureDefs = {};\n\n // stroke defaults to a darker shade of fill — closes over `this.schema`\n // so it tracks the current fill accessor. A fill that doesn't parse as a\n // color (e.g. \"none\"/\"transparent\", a gradient token) has no darker shade,\n // so fall back to the fill value itself.\n this.schema.stroke = (d: DataPoint, i?: number) => {\n const c = color(this.schema.fill(d, i) as string);\n return c ? c.darker(1).formatHex() : (this.schema.fill(d, i) as string);\n };\n\n this.schema.activeStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(1) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 3;\n },\n };\n this.schema.hoverStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(0.5) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 2;\n },\n };\n // Shape's label defaults. These are pushed to `_labelClass` via\n // `_labelClass.config(this.schema.labelConfig)` in render() so the\n // TextBox actually picks them up.\n // textAnchor defaults to \"start\" (left-aligned) — Treemap, Pie,\n // etc. rely on this. Bar overrides to \"middle\" in its constructor.\n this.schema.labelConfig = {\n fontColor: (d: DataPoint, i: number) =>\n colorContrast(this.schema.fill(d, i) as string),\n // Fade labels with their shape's opacity (e.g. an axis tick label hides\n // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —\n // like `fontColor` reads `fill` — which unwraps nested label data.\n fontOpacity: (d: DataPoint, i: number) =>\n this.schema.opacity(d, i) as number,\n fontResize: true,\n fontMax: 50,\n fontMin: 8,\n fontSize: 12,\n padding: 5,\n textAnchor: \"start\",\n verticalAlign: \"top\",\n };\n this.schema.textureDefault = {};\n }\n\n /**\n Given a specific data point and index, returns the aesthetic properties of the shape.\n @param data point*\n @param index @private\n*/\n _aes(_d?: DataPoint, _i?: number): ShapeAes {\n return {};\n }\n\n\n /**\n Returns a full JSON string of the texture config for a given data point.\n\n @private\n*/\n _getTextureKey(d: DataPoint, i: number): string | false {\n const textureVal: unknown = this.schema.texture(d, i);\n if (!textureVal) return false;\n\n /**\n Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.\n @private\n*/\n const styleLogic = (_: unknown): unknown => {\n return typeof _ !== \"function\"\n ? _\n : d.nested && d.key && d.values\n ? (_ as AccessorFn)(\n (d.values as unknown as DataPoint[])[0],\n this._data.indexOf((d.values as unknown as DataPoint[])[0]),\n )\n : (_ as AccessorFn)(d, i);\n };\n\n const fallback = this.schema.textureDefault;\n\n let texture: Record<string, unknown>;\n if (!isObject(textureVal))\n texture = {texture: textureVal} as Record<string, unknown>;\n else texture = textureVal as Record<string, unknown>;\n if (!texture.background) texture.background = styleLogic(this.schema.fill);\n if (!texture.stroke && !fallback.stroke)\n texture.stroke = styleLogic(this.schema.stroke);\n const pathNames = [\n \"squares\",\n \"nylon\",\n \"waves\",\n \"woven\",\n \"crosses\",\n \"caps\",\n \"hexagons\",\n ];\n if (\n pathNames.includes(texture.texture as string) ||\n typeof texture.texture === \"function\"\n ) {\n texture.d = texture.texture;\n texture.texture = \"paths\";\n } else if (texture.texture === \"grid\") {\n if (!texture.orientation && !fallback.orientation)\n texture.orientation = [\"vertical\", \"horizontal\"];\n texture.texture = \"lines\";\n }\n if (!texture.fill && texture.texture !== \"paths\")\n texture.fill = texture.stroke;\n const retObj = assign({}, fallback, texture);\n if (typeof retObj.d === \"function\") {\n retObj.d = retObj.d(retObj.size || 20);\n }\n return JSON.stringify(retObj);\n }\n\n /**\n Checks for nested data and uses the appropriate variables for accessor functions.\n @param elem @private\n*/\n _nestWrapper(\n method: AccessorFn,\n ): (d: DataPoint, i: number) => DataPoint[keyof DataPoint] {\n return (d: DataPoint, i: number) =>\n method(\n d.__d3plusShape__ ? (d.data as DataPoint) : d,\n d.__d3plusShape__ ? (d.i as number) : i,\n );\n }\n\n\n /**\n Adds labels to each shape group.\n @private\n*/\n _buildLabelData(): DataPoint[] {\n // Delegates to the pure `buildLabelData()` helper. The helper\n // takes the same inputs `this` exposes but works without a Shape\n // instance — emit functions or other callers that need only the\n // label-record layout can call it directly without instantiating\n // a Shape in compute mode.\n // All Shape methods bound to `this` before handing them to the pure\n // helper — subclasses (e.g. Line._dataFilter) reach for `this.schema.id`\n // and friends inside their bodies.\n return buildLabelData({\n data: this._data,\n dataFilter: this._dataFilter ? this._dataFilter.bind(this) : undefined,\n label: this.schema.label,\n labelBounds: this.schema.labelBounds\n ? this.schema.labelBounds.bind(this)\n : undefined,\n x: this.schema.x,\n y: this.schema.y,\n aes: this._aes.bind(this),\n rotate: this.schema.rotate,\n id: this.schema.id,\n });\n }\n\n\n /**\n Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n /**\n Resolves a style accessor for a data point, mirroring the nested-data logic\n of _applyStyle so scene output matches DOM rendering.\n @private\n*/\n _styleVal(fn: unknown, d: DataPoint, i: number): unknown {\n if (typeof fn !== \"function\") return fn;\n if (d.nested && d.key && d.values) {\n const first = (d.values as unknown as DataPoint[])[0];\n return (fn as AccessorFn)(first, this._data.indexOf(first));\n }\n return (fn as AccessorFn)(d, i);\n }\n\n /**\n Builds the resolved Transform for a data point, mirroring _applyTransform.\n @private\n*/\n _sceneTransform(d: DataPoint, i: number): Transform {\n const wrapped = Boolean(d.__d3plusShape__);\n const dd = (wrapped ? d.data : d) as DataPoint;\n const ii = wrapped ? (d.i as number) : i;\n let x: number, y: number;\n if (wrapped && d.translate) {\n const [tx, ty] = String(d.translate).split(\",\").map(Number);\n x = tx;\n y = ty;\n } else {\n x = Number(this.schema.x(dd, ii));\n y = Number(this.schema.y(dd, ii));\n }\n const scale =\n wrapped && d.scale !== undefined\n ? Number(d.scale)\n : Number(this.schema.scale(dd, ii));\n const rotate =\n wrapped && d.rotate !== undefined\n ? Number(d.rotate)\n : Number(this.schema.rotate((d.data || d) as DataPoint, ii));\n return {x, y, scale, rotate};\n }\n\n /**\n Builds the resolved Paint for a data point, mirroring _applyStyle.\n Texture fills are encoded as a stable \"pattern:<key>\" token at this\n layer; the backend renderers (`SvgRenderer._resolveFill`,\n `CanvasRenderer._resolveFill`) materialize them into a real SVG\n pattern or a Canvas image pattern. The two-stage resolve is\n intentional — Shapes stay backend-free, and texture\n materialization happens once per renderer instead of per-shape.\n @private\n*/\n _scenePaint(d: DataPoint, i: number): Paint {\n // A texture resolves to a stable \"pattern:<key>\" token (the same JSON config\n // render() uses); each backend materializes or degrades it.\n const textureKey = this._getTextureKey(d, i);\n return {\n fill: textureKey\n ? `pattern:${textureKey}`\n : strOrUndef(this._styleVal(this.schema.fill, d, i)),\n fillOpacity: numOrUndef(this._styleVal(this.schema.fillOpacity, d, i)),\n stroke: strOrUndef(this._styleVal(this.schema.stroke, d, i)),\n strokeWidth: numOrUndef(this._styleVal(this.schema.strokeWidth, d, i)),\n strokeOpacity: numOrUndef(this._styleVal(this.schema.strokeOpacity, d, i)),\n strokeDasharray: parseDash(\n this._styleVal(this.schema.strokeDasharray, d, i),\n ),\n strokeLinecap: strOrUndef(\n this._styleVal(this.schema.strokeLinecap, d, i),\n ) as Paint[\"strokeLinecap\"],\n vectorEffect: strOrUndef(\n this._styleVal(this.schema.vectorEffect, d, i),\n ) as Paint[\"vectorEffect\"],\n shapeRendering: strOrUndef(\n this._nestWrapper(this.schema.shapeRendering)(d, i),\n ),\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n };\n }\n\n /**\n Returns the geometry-specific scene fields for a data point. Overridden by\n each shape subclass; the base provides none.\n @private\n*/\n _sceneGeometry(_d: DataPoint, _i: number): Record<string, unknown> | null {\n return null;\n }\n\n /**\n Produces a backend-agnostic scene graph for this shape's data, reusing the\n same accessors render() applies to the DOM. This is the migration seam toward\n the @d3plus/render pluggable backends; it has no effect on render().\n*/\n toScene(): GroupNode {\n let data: DataPoint[] & {key?: AccessorFn} = this._data;\n if (this._dataFilter)\n data = this._dataFilter(data) as DataPoint[] & {key?: AccessorFn};\n const children: SceneNode[] = [];\n // Build the backgroundImage data for emission below. Each datum that\n // resolves to a non-false `backgroundImage(d, i)` becomes an\n // ImageNode positioned at the shape's geometry.\n const imageData: DataPoint[] = [];\n // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of\n // `data`: the render backends sort each group's children ascending by `z`\n // (stably), so a lower rank paints first (behind) and a higher rank paints\n // last (on top) — the same back-to-front meaning `.sort()` has always had,\n // without disturbing the keyed data-join order that drives transitions.\n const rank = sortRanks(\n data,\n this.schema.sort as ((a: DataPoint, b: DataPoint) => number) | null,\n );\n data.forEach((d, i) => {\n const geom = this._sceneGeometry(d, i);\n if (!geom) return;\n const key = this._nestWrapper(this.schema.id)(d, i) as string | number;\n const datum = (d.__d3plusShape__ ? d.data : d) as DataPoint;\n const transform = this._sceneTransform(d, i);\n\n // Push the hit area (if any) before the geometry so it sits behind it.\n if (this.schema.hitArea) {\n const ha = hitAreaNode(\n this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform,\n );\n // Share the datum's rank so the hit area stays paired just behind its\n // own geometry (equal `z`, kept in push order by the stable sort).\n if (ha) children.push(rank ? ({...ha, z: rank[i]} as SceneNode) : ha);\n }\n\n children.push({\n ...geom,\n key,\n datum,\n index: i,\n shapeType: this._name,\n paint: this._scenePaint(d, i),\n transform,\n aria: {\n role: strOrUndef(this._nestWrapper(this.schema.role)(d, i)),\n label: strOrUndef(this._nestWrapper(this.schema.ariaLabel)(d, i)),\n },\n ...(rank ? {z: rank[i]} : {}),\n } as unknown as SceneNode);\n // backgroundImage: collect a per-datum image when the accessor\n // returns a truthy URL. The image is sized to the shape's\n // geometry (preferring width/height fields when present).\n const bg = this._nestWrapper(this.schema.backgroundImage)(d, i) as\n | string\n | false;\n if (bg) {\n const g = geom as Record<string, unknown>;\n // Shape geometry is origin-centered; its on-screen position lives in\n // the node transform. The background image is emitted as a flat sibling\n // (no transform), so bake the shape's translate into the image x/y —\n // otherwise every image lands at the origin (top-left).\n const t = this._sceneTransform(d, i) as {x?: number; y?: number};\n const w = typeof g.width === \"number\" ? g.width : undefined;\n const h = typeof g.height === \"number\" ? g.height : undefined;\n const cx = typeof g.cx === \"number\" ? g.cx : (typeof g.x === \"number\" ? g.x : 0);\n const cy = typeof g.cy === \"number\" ? g.cy : (typeof g.y === \"number\" ? g.y : 0);\n const r = typeof g.r === \"number\" ? g.r : undefined;\n const iw = w ?? (r != null ? r * 2 : 0);\n const ih = h ?? (r != null ? r * 2 : 0);\n imageData.push({\n __d3plus__: true,\n data: d,\n i,\n id: this._nestWrapper(this.schema.id)(d, i),\n url: bg,\n x: (t.x ?? 0) + (cx as number) - iw / 2,\n y: (t.y ?? 0) + (cy as number) - ih / 2,\n width: iw,\n height: ih,\n } as unknown as DataPoint);\n }\n });\n // Emit background images AFTER shape children so they paint above the\n // shape's fill — matches the DOM order where the <image> was\n // appended as a sibling of the shape.\n if (imageData.length)\n children.push(\n ...emitBackgroundImages(this._backgroundImageClass, imageData, rank, data.length),\n );\n // NOTE: Labels are NOT pushed here. The canonical aggregation point is\n // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`\n // AND `shape._labelClass.toScene()` independently. Pushing labels here\n // too would emit them twice in every chart that calls collectComputed\n // (Pie/Donut/Pack/Treemap/Network/Priestley/Radar/RadialMatrix/Geomap…).\n // Standalone shape.render() consumers (no collectComputed wrapper) get\n // labels through Shape.render's own SvgRenderer path below.\n return {type: \"group\", key: `${this._name}-group`, children};\n }\n\n render(callback?: () => void): this {\n // Populate the label TextBox so toScene() reads correct label data. The\n // label class is always in compute mode — the scene path materializes text.\n const lc = this._labelClass as unknown as {renderMode?: (m: string) => unknown};\n if (lc && typeof lc.renderMode === \"function\") lc.renderMode(\"compute\");\n // Apply Shape's labelConfig (fontColor, fontResize, padding, textAnchor,\n // verticalAlign, fontSize, …) to the underlying TextBox. Function\n // accessors receive the LABEL RECORD (with `d.data` = source\n // datum, `d.l` = which label index in a multi-label-per-datum\n // setup, `d.text` = label text, etc.). That gives consumers like\n // Treemap (two labels per cell — title + share %) the context to\n // vary anchor / color / etc. based on which label they're styling.\n // Shape's default `fontColor` uses `this.schema.fill(d, i)` — since\n // `fill` is the configPrep-wrapped accessor, it unwraps `d.data`\n // back to the source datum automatically before invoking the user\n // fill function.\n this._labelClass.config(this.schema.labelConfig as Record<string, unknown>);\n this._labelClass.data(this._buildLabelData());\n\n if (this.schema.renderMode === \"compute\") {\n // A Viz pipeline is driving this shape — Viz.renderScene composes the\n // whole chart's scene itself, so don't spin up our own SvgRenderer.\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n // Standalone shape rendering: route the shape's own toScene() through\n // SvgRenderer. Preserves `new Rect().render()` ergonomics with no\n // d3-selection DOM.\n if (this._select === undefined && typeof document !== \"undefined\") {\n const div = document.createElement(\"div\");\n div.style.cssText = \"display:block;\";\n document.body.appendChild(div);\n this.select(div);\n }\n\n if (this._select) {\n const sel = this._select;\n // `_select` is a D3Selection, but the standalone path historically also\n // accepted a raw element; handle both without widening to `any`.\n const node: Element | null =\n sel && typeof sel.node === \"function\"\n ? (sel.node() as Element | null)\n : (sel as unknown as Element | null);\n if (node) {\n const tag = (node.tagName || \"\").toLowerCase();\n const isSvg = tag === \"svg\";\n // Explicit numeric size first: an <svg>'s width/height attribute, or a\n // non-svg container's client box.\n const rawW = isSvg ? Number(node.getAttribute(\"width\")) : (node as HTMLElement).clientWidth;\n const rawH = isSvg ? Number(node.getAttribute(\"height\")) : (node as HTMLElement).clientHeight;\n // When that isn't a usable number — e.g. width=\"100%\" (Number → NaN)\n // or a 0-size box — measure the container's real rendered size,\n // walking up to the first constrained ancestor. Only fall back to the\n // static 400x300 when nothing is measurable (e.g. no layout in jsdom).\n const [measuredW, measuredH] = rawW && rawH ? [rawW, rawH] : getSize(node as HTMLElement);\n const width = rawW || measuredW || 400;\n const height = rawH || measuredH || 300;\n // Combine the shape's scene + label children. toScene() deliberately\n // omits labels (collectComputed is the canonical aggregator for the\n // chart pipeline); for the standalone render() path we add them here\n // so `new Rect().data(...).render()` still produces label text.\n const shapeGroup = this.toScene();\n const labelChildren: SceneNode[] = [];\n if (\n this._labelClass &&\n typeof (this._labelClass as {toScene?: unknown}).toScene === \"function\" &&\n this._labelClass._data &&\n this._labelClass._data.length\n ) {\n labelChildren.push(\n ...(this._labelClass.toScene().children as SceneNode[]),\n );\n }\n const root: GroupNode = {\n ...shapeGroup,\n children: [...shapeGroup.children, ...labelChildren],\n };\n const scene = {root, width, height};\n // Tear down any previous SvgRenderer so its DOM listeners + timers\n // are cleared instead of leaking on every re-render.\n const prev = this._sceneRenderer;\n if (prev && typeof prev.destroy === \"function\") prev.destroy();\n // Caller's element is preserved (downstream selectors still find it);\n // we mount SvgRenderer INSIDE it. When `node` is a <g> the result is\n // a nested <svg>-in-<g>, which is valid SVG but visually unusual —\n // chart code reaches this path only via the Box/Whisker full-mode\n // fallback, which is not the recommended flow (compute mode is).\n // Only wipe children when this is the FIRST time we're mounting\n // here — re-renders into the same node would otherwise destroy any\n // labels/auxiliary DOM the caller put alongside.\n if (!prev) {\n while (node.firstChild) node.removeChild(node.firstChild);\n }\n const renderer = new SvgRenderer();\n renderer.mount({container: node, width, height});\n renderer.drawScene(scene);\n this._sceneRenderer = renderer;\n }\n }\n\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n /**\n The active callback function for highlighting shapes.\n*/\n active(): ((d: DataPoint, i: number) => boolean) | null;\n active(_: ((d: DataPoint, i: number) => boolean) | null): this;\n active(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === undefined) return this.schema.active;\n this.schema.active = _;\n // v4: active/hover visuals come from the scene path's paint recomputation\n // on the next render(); no DOM mutation here.\n return this;\n }\n\n /**\n The style to apply to active shapes.\n*/\n activeStyle(): Record<string, unknown>;\n activeStyle(_: Record<string, unknown>): this;\n activeStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.activeStyle = assign({}, this.schema.activeStyle, _!)),\n this)\n : this.schema.activeStyle;\n }\n\n /**\n The data array used to create shapes. A shape will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): DataPoint[] | this {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n The hover callback function for highlighting shapes on mouseover.\n*/\n hover(): ((d: DataPoint, i: number) => boolean) | null;\n hover(_: ((d: DataPoint, i: number) => boolean) | null): this;\n hover(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === void 0) return this.schema.hover;\n this.schema.hover = _;\n // v4: hover dim comes from the scene path's paint recomputation; no DOM here.\n return this;\n }\n\n /**\n The style to apply to hovered shapes.\n*/\n hoverStyle(): Record<string, unknown>;\n hoverStyle(_: Record<string, unknown>): this;\n hoverStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.hoverStyle = assign({}, this.schema.hoverStyle, _!)), this)\n : this.schema.hoverStyle;\n }\n\n /**\n A pass-through to the config method of the TextBox class used to create a shape's labels.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | SVGElement | null): this;\n select(_?: string | HTMLElement | SVGElement | null): D3Selection | this {\n return arguments.length\n ? ((this._select = select(_ as string) as unknown as D3Selection), this)\n : this._select;\n }\n\n /**\n A comparator function used to sort shapes for layering order.\n*/\n sort(): ((a: DataPoint, b: DataPoint) => number) | null;\n sort(_: ((a: DataPoint, b: DataPoint) => number) | null): this;\n sort(\n _?: ((a: DataPoint, b: DataPoint) => number) | null,\n ): ((a: DataPoint, b: DataPoint) => number) | null | this {\n return arguments.length\n ? ((this.schema.sort = _ ?? null), this)\n : this.schema.sort;\n }\n\n /**\n A series of global texture methods to be used for all textures (ie. `{stroke: \"darkorange\", strokeWidth: 2}`).\n*/\n textureDefault(): Record<string, unknown>;\n textureDefault(_: Record<string, unknown>): this;\n textureDefault(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.textureDefault = assign(this.schema.textureDefault, _!)),\n this)\n : this.schema.textureDefault;\n }\n\n /**\n Narrowed `.config()` for Shape. Inherited surface from\n `BaseClass.config()`; the override exists only to surface per-shape\n keys (e.g. `width`/`height` for Rect) in autocomplete + type checks.\n */\n config(): BaseShapeConfig;\n config(_: Partial<BaseShapeConfig>): this;\n config(_?: Partial<BaseShapeConfig>): BaseShapeConfig | this {\n if (!arguments.length) return super.config() as BaseShapeConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["color","select","colorContrast","assign","getSize","isObject","SvgRenderer","TextBox","accessor","BaseClass","constant","installFluent","buildLabelData","hitAreaNode","numOrUndef","v","n","Number","isFinite","undefined","strOrUndef","String","parseDash","parts","split","map","filter","length","Image","emitBackgroundImages","sortRanks","shapeSchema","key","coerce","default","d","i","id","Shape","tagName","_backgroundImageClass","_data","_labelClass","_name","_tagName","_textureDefs","_select","_transition","_group","_update","_enter","_exit","_hoverGroup","_activeGroup","_path","_sceneRenderer","schema","stroke","c","fill","darker","formatHex","activeStyle","includes","col","s","strokeWidth","hoverStyle","labelConfig","fontColor","fontOpacity","opacity","fontResize","fontMax","fontMin","fontSize","padding","textAnchor","verticalAlign","textureDefault","_aes","_d","_i","_getTextureKey","textureVal","texture","styleLogic","_","nested","values","indexOf","fallback","background","pathNames","orientation","retObj","size","JSON","stringify","_nestWrapper","method","__d3plusShape__","data","_buildLabelData","dataFilter","_dataFilter","bind","label","labelBounds","x","y","aes","rotate","_styleVal","fn","first","_sceneTransform","wrapped","Boolean","dd","ii","translate","tx","ty","scale","_scenePaint","textureKey","fillOpacity","strokeOpacity","strokeDasharray","strokeLinecap","vectorEffect","shapeRendering","_sceneGeometry","toScene","children","imageData","rank","sort","forEach","geom","datum","transform","hitArea","ha","push","z","index","shapeType","paint","aria","role","ariaLabel","bg","backgroundImage","t","g","w","width","h","height","cx","cy","r","iw","ih","__d3plus__","url","type","render","callback","lc","renderMode","config","setTimeout","document","div","createElement","style","cssText","body","appendChild","sel","node","tag","toLowerCase","isSvg","rawW","getAttribute","clientWidth","rawH","clientHeight","measuredW","measuredH","shapeGroup","labelChildren","root","scene","prev","destroy","firstChild","removeChild","renderer","mount","container","drawScene","active","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAC/B,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,aAAa,QAAO,gBAAgB;AAE5C,SAAQC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAO,cAAc;AAGtD,SAAQC,WAAW,QAAO,iBAAiB;AAG3C,SAAQC,OAAO,QAAO,yBAAyB;AAC/C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAO,oBAAoB;AAEhE,SAAQC,aAAa,QAAO,eAAe;AAE3C,SAAQC,cAAc,QAAO,sBAAsB;AACnD,SAAQC,WAAW,QAAO,mBAAmB;AAG7C,+DAA+D,GAC/D,OAAO,SAASC,WAAWC,CAAU;IACnC,IAAMC,IAAIC,OAAOF;IACjB,OAAOE,OAAOC,QAAQ,CAACF,KAAKA,IAAIG;AAClC;AAEA,uDAAuD,GACvD,OAAO,SAASC,WAAWL,CAAU;IACnC,OAAOA,KAAK,QAAQA,MAAM,KAAKI,YAAYE,OAAON;AACpD;AAEA,4EAA4E,GAC5E,OAAO,SAASO,UAAUP,CAAU;IAClC,IAAIA,KAAK,QAAQA,MAAM,UAAUA,MAAM,IAAI,OAAOI;IAClD,IAAI,OAAOJ,MAAM,UAAU,OAAO;QAACA;KAAE;IACrC,IAAMQ,QAAQF,OAAON,GAClBS,KAAK,CAAC,UACNC,GAAG,CAACR,Q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AAOtF,CAA4B;gBACjC,IAAI,CAACwH,UAAUpL,MAAM,EAAE,OAAO,uBA3nBbW,kBA2nBmBuI,UAAN,IAAK;gBACnC,uBA5nBiBvI,kBA4nBXuI,UAAN,IAAK,aAAQtF;gBACb,OAAO,IAAI;YACb;;;WA9nBmBjD;EAAc7B;AAHnC;;AAEA,GACA,SAAqB6B,mBA+nBpB"}
1
+ {"version":3,"sources":["../../../src/shapes/Shape.ts"],"sourcesContent":["import {color} from \"d3-color\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast} from \"@d3plus/color\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, getSize, isObject} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {SvgRenderer} from \"@d3plus/render\";\nimport type {GroupNode, Paint, SceneNode, Transform} from \"@d3plus/render\";\n\nimport {TextBox} from \"../components/index.js\";\nimport {accessor, BaseClass, constant} from \"../utils/index.js\";\nimport type {AccessorFn, D3plusConfig} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\nimport {buildLabelData} from \"./buildLabelData.js\";\nimport {hitAreaNode} from \"./hitAreaNode.js\";\nimport {interactionPoints} from \"./interactionPoints.js\";\nimport type {BaseShapeConfig} from \"./shapeConfig.js\";\n\n/** Coerces a value to a finite number, or undefined. @private */\nexport function numOrUndef(v: unknown): number | undefined {\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Returns a non-empty string, or undefined. @private */\nexport function strOrUndef(v: unknown): string | undefined {\n return v == null || v === \"\" ? undefined : String(v);\n}\n\n/** Parses an SVG stroke-dasharray value into an array of numbers. @private */\nexport function parseDash(v: unknown): number[] | undefined {\n if (v == null || v === \"none\" || v === \"\") return undefined;\n if (typeof v === \"number\") return [v];\n const parts = String(v)\n .split(/[\\s,]+/)\n .map(Number)\n .filter(n => Number.isFinite(n));\n return parts.length ? parts : undefined;\n}\n\nexport interface ShapeAes {\n width?: number;\n height?: number;\n points?: [number, number][];\n r?: number;\n x?: number;\n y?: number;\n}\n\n\nimport {\n backgroundImageLayout,\n emitBackgroundImages,\n sortRanks,\n type BackgroundImageSpec,\n} from \"./sceneSort.js\";\n\n/** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst shapeSchema: ConfigField[] = [\n {key: \"activeOpacity\", coerce: \"identity\", default: 0.25},\n {key: \"ariaLabel\", coerce: \"const\", default: constant(\"\")},\n {key: \"backgroundImage\", coerce: \"const\", default: constant(false)},\n {key: \"backgroundImageFit\", coerce: \"const\", default: constant(\"cover\")},\n {key: \"discrete\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"fill\", coerce: \"const\", default: constant(\"black\")},\n {key: \"fillOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"hitArea\", coerce: \"const\"},\n {key: \"hoverOpacity\", coerce: \"identity\", default: 0.5},\n {\n key: \"id\",\n coerce: \"accessor\",\n default: (d: DataPoint, i?: number) => (d.id !== void 0 ? d.id : i!),\n },\n {key: \"label\", coerce: \"const\", default: constant(false)},\n {key: \"labelBounds\", coerce: \"const\"},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"visiblePainted\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"role\", coerce: \"const\", default: constant(\"presentation\")},\n {key: \"rotate\", coerce: \"const\", default: constant(0)},\n {key: \"rx\", coerce: \"const\", default: constant(0)},\n {key: \"ry\", coerce: \"const\", default: constant(0)},\n {key: \"scale\", coerce: \"const\", default: constant(1)},\n {key: \"shapeRendering\", coerce: \"const\", default: constant(\"geometricPrecision\")},\n {key: \"stroke\", coerce: \"const\"},\n {key: \"strokeDasharray\", coerce: \"const\", default: constant(\"0\")},\n {key: \"strokeLinecap\", coerce: \"const\", default: constant(\"butt\")},\n {key: \"strokeOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"strokeWidth\", coerce: \"const\", default: constant(0)},\n {key: \"textAnchor\", coerce: \"const\", default: constant(\"start\")},\n {key: \"texture\", coerce: \"const\", default: constant(false)},\n {key: \"vectorEffect\", coerce: \"const\", default: constant(\"non-scaling-stroke\")},\n {key: \"verticalAlign\", coerce: \"const\", default: constant(\"top\")},\n // \"accessor\" (not \"const\"): a string names a data key (`.x(\"year\")`), a\n // number is a constant (`.x(50)`), and a function passes through — so a\n // standalone shape given string accessors (as the pipeline never does, but\n // direct users do) reads the field instead of treating \"x\" as the literal.\n {key: \"x\", coerce: \"accessor\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"accessor\", default: accessor(\"y\", 0)},\n];\n\n/**\n An abstracted class for generating shapes.\n*/\nexport default class Shape extends BaseClass {\n // installFluent generates the config accessors (fill, x, id, …) at runtime;\n // the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n\n _data: DataPoint[];\n _labelClass: TextBox;\n _name: string;\n _tagName: string;\n _textureDefs: Record<string, Record<string, unknown>>;\n _select!: D3Selection;\n _transition!: ReturnType<typeof transition>;\n /** @param data The raw data array to filter. */\n _dataFilter?(data: DataPoint[]): DataPoint[];\n _group!: D3Selection;\n _update!: D3Selection;\n _enter!: D3Selection;\n _exit!: D3Selection;\n _hoverGroup!: D3Selection;\n _activeGroup!: D3Selection;\n _path!: Record<string, unknown>;\n /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor(tagName: string = \"g\") {\n super();\n\n installFluent(this, shapeSchema);\n\n this._data = [];\n this._labelClass = new TextBox();\n this._name = \"Shape\";\n this._tagName = tagName;\n this._textureDefs = {};\n\n // stroke defaults to a darker shade of fill — closes over `this.schema`\n // so it tracks the current fill accessor. A fill that doesn't parse as a\n // color (e.g. \"none\"/\"transparent\", a gradient token) has no darker shade,\n // so fall back to the fill value itself.\n this.schema.stroke = (d: DataPoint, i?: number) => {\n const c = color(this.schema.fill(d, i) as string);\n return c ? c.darker(1).formatHex() : (this.schema.fill(d, i) as string);\n };\n\n this.schema.activeStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(1) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 3;\n },\n };\n this.schema.hoverStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(0.5) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 2;\n },\n };\n // Shape's label defaults. These are pushed to `_labelClass` via\n // `_labelClass.config(this.schema.labelConfig)` in render() so the\n // TextBox actually picks them up.\n // textAnchor defaults to \"start\" (left-aligned) — Treemap, Pie,\n // etc. rely on this. Bar overrides to \"middle\" in its constructor.\n this.schema.labelConfig = {\n fontColor: (d: DataPoint, i: number) =>\n colorContrast(this.schema.fill(d, i) as string),\n // Fade labels with their shape's opacity (e.g. an axis tick label hides\n // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —\n // like `fontColor` reads `fill` — which unwraps nested label data.\n fontOpacity: (d: DataPoint, i: number) =>\n this.schema.opacity(d, i) as number,\n fontResize: true,\n fontMax: 50,\n fontMin: 8,\n fontSize: 12,\n padding: 5,\n textAnchor: \"start\",\n verticalAlign: \"top\",\n };\n this.schema.textureDefault = {};\n }\n\n /**\n Given a specific data point and index, returns the aesthetic properties of the shape.\n @param data point*\n @param index @private\n*/\n _aes(_d?: DataPoint, _i?: number): ShapeAes {\n return {};\n }\n\n\n /**\n Returns a full JSON string of the texture config for a given data point.\n\n @private\n*/\n _getTextureKey(d: DataPoint, i: number): string | false {\n const textureVal: unknown = this.schema.texture(d, i);\n if (!textureVal) return false;\n\n /**\n Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.\n @private\n*/\n const styleLogic = (_: unknown): unknown => {\n return typeof _ !== \"function\"\n ? _\n : d.nested && d.key && d.values\n ? (_ as AccessorFn)(\n (d.values as unknown as DataPoint[])[0],\n this._data.indexOf((d.values as unknown as DataPoint[])[0]),\n )\n : (_ as AccessorFn)(d, i);\n };\n\n const fallback = this.schema.textureDefault;\n\n let texture: Record<string, unknown>;\n if (!isObject(textureVal))\n texture = {texture: textureVal} as Record<string, unknown>;\n else texture = textureVal as Record<string, unknown>;\n if (!texture.background) texture.background = styleLogic(this.schema.fill);\n if (!texture.stroke && !fallback.stroke)\n texture.stroke = styleLogic(this.schema.stroke);\n const pathNames = [\n \"squares\",\n \"nylon\",\n \"waves\",\n \"woven\",\n \"crosses\",\n \"caps\",\n \"hexagons\",\n ];\n if (\n pathNames.includes(texture.texture as string) ||\n typeof texture.texture === \"function\"\n ) {\n texture.d = texture.texture;\n texture.texture = \"paths\";\n } else if (texture.texture === \"grid\") {\n if (!texture.orientation && !fallback.orientation)\n texture.orientation = [\"vertical\", \"horizontal\"];\n texture.texture = \"lines\";\n }\n if (!texture.fill && texture.texture !== \"paths\")\n texture.fill = texture.stroke;\n const retObj = assign({}, fallback, texture);\n if (typeof retObj.d === \"function\") {\n retObj.d = retObj.d(retObj.size || 20);\n }\n return JSON.stringify(retObj);\n }\n\n /**\n Checks for nested data and uses the appropriate variables for accessor functions.\n @param elem @private\n*/\n _nestWrapper(\n method: AccessorFn,\n ): (d: DataPoint, i: number) => DataPoint[keyof DataPoint] {\n return (d: DataPoint, i: number) =>\n method(\n d.__d3plusShape__ ? (d.data as DataPoint) : d,\n d.__d3plusShape__ ? (d.i as number) : i,\n );\n }\n\n\n /**\n Adds labels to each shape group.\n @private\n*/\n _buildLabelData(): DataPoint[] {\n // Delegates to the pure `buildLabelData()` helper. The helper\n // takes the same inputs `this` exposes but works without a Shape\n // instance — emit functions or other callers that need only the\n // label-record layout can call it directly without instantiating\n // a Shape in compute mode.\n // All Shape methods bound to `this` before handing them to the pure\n // helper — subclasses (e.g. Line._dataFilter) reach for `this.schema.id`\n // and friends inside their bodies.\n return buildLabelData({\n data: this._data,\n dataFilter: this._dataFilter ? this._dataFilter.bind(this) : undefined,\n label: this.schema.label,\n labelBounds: this.schema.labelBounds\n ? this.schema.labelBounds.bind(this)\n : undefined,\n x: this.schema.x,\n y: this.schema.y,\n aes: this._aes.bind(this),\n rotate: this.schema.rotate,\n id: this.schema.id,\n });\n }\n\n\n /**\n Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n /**\n Resolves a style accessor. For a nested shape (Line/Area) the accessor gets\n the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.\n @private\n*/\n _styleVal(fn: unknown, d: DataPoint, i: number): unknown {\n if (typeof fn !== \"function\") return fn;\n if (d.nested && d.key && d.values)\n return (fn as AccessorFn)(d.data as DataPoint, d.i as number);\n return (fn as AccessorFn)(d, i);\n }\n\n /**\n Builds the resolved Transform for a data point, mirroring _applyTransform.\n @private\n*/\n _sceneTransform(d: DataPoint, i: number): Transform {\n const wrapped = Boolean(d.__d3plusShape__);\n const dd = (wrapped ? d.data : d) as DataPoint;\n const ii = wrapped ? (d.i as number) : i;\n let x: number, y: number;\n if (wrapped && d.translate) {\n const [tx, ty] = String(d.translate).split(\",\").map(Number);\n x = tx;\n y = ty;\n } else {\n x = Number(this.schema.x(dd, ii));\n y = Number(this.schema.y(dd, ii));\n }\n const scale =\n wrapped && d.scale !== undefined\n ? Number(d.scale)\n : Number(this.schema.scale(dd, ii));\n const rotate =\n wrapped && d.rotate !== undefined\n ? Number(d.rotate)\n : Number(this.schema.rotate((d.data || d) as DataPoint, ii));\n return {x, y, scale, rotate};\n }\n\n /**\n Builds the resolved Paint for a data point, mirroring _applyStyle.\n Texture fills are encoded as a stable \"pattern:<key>\" token at this\n layer; the backend renderers (`SvgRenderer._resolveFill`,\n `CanvasRenderer._resolveFill`) materialize them into a real SVG\n pattern or a Canvas image pattern. The two-stage resolve is\n intentional — Shapes stay backend-free, and texture\n materialization happens once per renderer instead of per-shape.\n @private\n*/\n _scenePaint(d: DataPoint, i: number): Paint {\n // A texture resolves to a stable \"pattern:<key>\" token (the same JSON config\n // render() uses); each backend materializes or degrades it.\n const textureKey = this._getTextureKey(d, i);\n return {\n fill: textureKey\n ? `pattern:${textureKey}`\n : strOrUndef(this._styleVal(this.schema.fill, d, i)),\n fillOpacity: numOrUndef(this._styleVal(this.schema.fillOpacity, d, i)),\n stroke: strOrUndef(this._styleVal(this.schema.stroke, d, i)),\n strokeWidth: numOrUndef(this._styleVal(this.schema.strokeWidth, d, i)),\n strokeOpacity: numOrUndef(this._styleVal(this.schema.strokeOpacity, d, i)),\n strokeDasharray: parseDash(\n this._styleVal(this.schema.strokeDasharray, d, i),\n ),\n strokeLinecap: strOrUndef(\n this._styleVal(this.schema.strokeLinecap, d, i),\n ) as Paint[\"strokeLinecap\"],\n vectorEffect: strOrUndef(\n this._styleVal(this.schema.vectorEffect, d, i),\n ) as Paint[\"vectorEffect\"],\n shapeRendering: strOrUndef(\n this._nestWrapper(this.schema.shapeRendering)(d, i),\n ),\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n };\n }\n\n /**\n Returns the geometry-specific scene fields for a data point. Overridden by\n each shape subclass; the base provides none.\n @private\n*/\n _sceneGeometry(_d: DataPoint, _i: number): Record<string, unknown> | null {\n return null;\n }\n\n /**\n Produces a backend-agnostic scene graph for this shape's data, reusing the\n same accessors render() applies to the DOM. This is the migration seam toward\n the @d3plus/render pluggable backends; it has no effect on render().\n*/\n toScene(): GroupNode {\n let data: DataPoint[] & {key?: AccessorFn} = this._data;\n if (this._dataFilter)\n data = this._dataFilter(data) as DataPoint[] & {key?: AccessorFn};\n const children: SceneNode[] = [];\n // Collected background images, emitted below (after the geometry) as clipped,\n // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a\n // truthy URL contributes one spec.\n const bgSpecs: BackgroundImageSpec[] = [];\n // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of\n // `data`: the render backends sort each group's children ascending by `z`\n // (stably), so a lower rank paints first (behind) and a higher rank paints\n // last (on top) — the same back-to-front meaning `.sort()` has always had,\n // without disturbing the keyed data-join order that drives transitions.\n const rank = sortRanks(\n data,\n this.schema.sort as ((a: DataPoint, b: DataPoint) => number) | null,\n );\n data.forEach((d, i) => {\n const geom = this._sceneGeometry(d, i);\n if (!geom) return;\n const key = this._nestWrapper(this.schema.id)(d, i) as string | number;\n const datum = (d.__d3plusShape__ ? d.data : d) as DataPoint;\n const transform = this._sceneTransform(d, i);\n\n // Per-point positions (Line/Area) shared by the geometry and its hit area\n // so a hover anywhere on either resolves to the nearest point.\n const iPoints = interactionPoints(d, this.schema.x, this.schema.y, this.schema.defined);\n // Push the hit area (if any) before the geometry so it sits behind it.\n // Line's is a fat path built from the geometry `d`; Bar/legend etc. a rect.\n if (this.schema.hitArea) {\n const ha = hitAreaNode(this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform, geom.d as string);\n // Share the datum's rank so the hit area stays paired just behind its\n // own geometry (equal `z`, kept in push order by the stable sort).\n if (ha) children.push(rank ? ({...ha, ...iPoints, z: rank[i]} as SceneNode) : ({...ha, ...iPoints} as SceneNode));\n }\n\n children.push({\n ...geom,\n key,\n datum,\n index: i,\n shapeType: this._name,\n paint: this._scenePaint(d, i),\n transform,\n aria: {\n role: strOrUndef(this._nestWrapper(this.schema.role)(d, i)),\n label: strOrUndef(this._nestWrapper(this.schema.ariaLabel)(d, i)),\n },\n ...iPoints,\n ...(rank ? {z: rank[i]} : {}),\n } as unknown as SceneNode);\n // backgroundImage: collect a per-datum image (see backgroundImageLayout for\n // the cover/contain fit). The wrapping group carries the shape transform,\n // so the image box + clip stay in local space.\n const bg = this._nestWrapper(this.schema.backgroundImage)(d, i) as\n | string\n | false;\n if (bg) {\n const g = geom as Record<string, unknown>;\n // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle\n // derive their layout from `d`/width/r directly.\n const needsPoints =\n typeof g.d !== \"string\" &&\n typeof g.width !== \"number\" &&\n typeof g.r !== \"number\";\n const points = needsPoints\n ? ((this._aes(d, i).points ?? []) as [number, number][])\n : [];\n const fit = this._nestWrapper(this.schema.backgroundImageFit)(d, i);\n const layout = backgroundImageLayout(\n g, points, fit === \"contain\" ? \"contain\" : \"cover\",\n );\n if (layout) {\n bgSpecs.push({\n key,\n index: i,\n datum,\n url: bg,\n box: layout.box,\n clip: layout.clip,\n preserveAspectRatio: layout.preserveAspectRatio,\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n transform,\n });\n }\n }\n });\n // Emit background images AFTER shape children so they paint above the\n // shape's fill — matches the DOM order where the <image> was\n // appended as a sibling of the shape.\n if (bgSpecs.length)\n children.push(...emitBackgroundImages(bgSpecs, rank, data.length));\n // NOTE: Labels are NOT pushed here. The canonical aggregation point is\n // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`\n // AND `shape._labelClass.toScene()` independently. Pushing labels here\n // too would emit them twice in every chart that calls collectComputed\n // (Pie/Donut/Pack/Treemap/Network/Priestley/Radar/RadialMatrix/Geomap…).\n // Standalone shape.render() consumers (no collectComputed wrapper) get\n // labels through Shape.render's own SvgRenderer path below.\n return {type: \"group\", key: `${this._name}-group`, children};\n }\n\n render(callback?: () => void): this {\n // Populate the label TextBox so toScene() reads correct label data. The\n // label class is always in compute mode — the scene path materializes text.\n const lc = this._labelClass as unknown as {renderMode?: (m: string) => unknown};\n if (lc && typeof lc.renderMode === \"function\") lc.renderMode(\"compute\");\n // Apply Shape's labelConfig (fontColor, fontResize, padding, textAnchor,\n // verticalAlign, fontSize, …) to the underlying TextBox. Function\n // accessors receive the LABEL RECORD (with `d.data` = source\n // datum, `d.l` = which label index in a multi-label-per-datum\n // setup, `d.text` = label text, etc.). That gives consumers like\n // Treemap (two labels per cell — title + share %) the context to\n // vary anchor / color / etc. based on which label they're styling.\n // Shape's default `fontColor` uses `this.schema.fill(d, i)` — since\n // `fill` is the configPrep-wrapped accessor, it unwraps `d.data`\n // back to the source datum automatically before invoking the user\n // fill function.\n this._labelClass.config(this.schema.labelConfig as Record<string, unknown>);\n this._labelClass.data(this._buildLabelData());\n\n if (this.schema.renderMode === \"compute\") {\n // A Viz pipeline is driving this shape — Viz.renderScene composes the\n // whole chart's scene itself, so don't spin up our own SvgRenderer.\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n // Standalone shape rendering: route the shape's own toScene() through\n // SvgRenderer. Preserves `new Rect().render()` ergonomics with no\n // d3-selection DOM.\n if (this._select === undefined && typeof document !== \"undefined\") {\n const div = document.createElement(\"div\");\n div.style.cssText = \"display:block;\";\n document.body.appendChild(div);\n this.select(div);\n }\n\n if (this._select) {\n const sel = this._select;\n // `_select` is a D3Selection, but the standalone path historically also\n // accepted a raw element; handle both without widening to `any`.\n const node: Element | null =\n sel && typeof sel.node === \"function\"\n ? (sel.node() as Element | null)\n : (sel as unknown as Element | null);\n if (node) {\n const tag = (node.tagName || \"\").toLowerCase();\n const isSvg = tag === \"svg\";\n // Explicit numeric size first: an <svg>'s width/height attribute, or a\n // non-svg container's client box.\n const rawW = isSvg ? Number(node.getAttribute(\"width\")) : (node as HTMLElement).clientWidth;\n const rawH = isSvg ? Number(node.getAttribute(\"height\")) : (node as HTMLElement).clientHeight;\n // When that isn't a usable number — e.g. width=\"100%\" (Number → NaN)\n // or a 0-size box — measure the container's real rendered size,\n // walking up to the first constrained ancestor. Only fall back to the\n // static 400x300 when nothing is measurable (e.g. no layout in jsdom).\n const [measuredW, measuredH] = rawW && rawH ? [rawW, rawH] : getSize(node as HTMLElement);\n const width = rawW || measuredW || 400;\n const height = rawH || measuredH || 300;\n // Combine the shape's scene + label children. toScene() deliberately\n // omits labels (collectComputed is the canonical aggregator for the\n // chart pipeline); for the standalone render() path we add them here\n // so `new Rect().data(...).render()` still produces label text.\n const shapeGroup = this.toScene();\n const labelChildren: SceneNode[] = [];\n if (\n this._labelClass &&\n typeof (this._labelClass as {toScene?: unknown}).toScene === \"function\" &&\n this._labelClass._data &&\n this._labelClass._data.length\n ) {\n labelChildren.push(\n ...(this._labelClass.toScene().children as SceneNode[]),\n );\n }\n const root: GroupNode = {\n ...shapeGroup,\n children: [...shapeGroup.children, ...labelChildren],\n };\n const scene = {root, width, height};\n // Tear down any previous SvgRenderer so its DOM listeners + timers\n // are cleared instead of leaking on every re-render.\n const prev = this._sceneRenderer;\n if (prev && typeof prev.destroy === \"function\") prev.destroy();\n // Caller's element is preserved (downstream selectors still find it);\n // we mount SvgRenderer INSIDE it. When `node` is a <g> the result is\n // a nested <svg>-in-<g>, which is valid SVG but visually unusual —\n // chart code reaches this path only via the Box/Whisker full-mode\n // fallback, which is not the recommended flow (compute mode is).\n // Only wipe children when this is the FIRST time we're mounting\n // here — re-renders into the same node would otherwise destroy any\n // labels/auxiliary DOM the caller put alongside.\n if (!prev) {\n while (node.firstChild) node.removeChild(node.firstChild);\n }\n const renderer = new SvgRenderer();\n renderer.mount({container: node, width, height});\n renderer.drawScene(scene);\n this._sceneRenderer = renderer;\n }\n }\n\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n /**\n The active callback function for highlighting shapes.\n*/\n active(): ((d: DataPoint, i: number) => boolean) | null;\n active(_: ((d: DataPoint, i: number) => boolean) | null): this;\n active(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === undefined) return this.schema.active;\n this.schema.active = _;\n // v4: active/hover visuals come from the scene path's paint recomputation\n // on the next render(); no DOM mutation here.\n return this;\n }\n\n /**\n The style to apply to active shapes.\n*/\n activeStyle(): Record<string, unknown>;\n activeStyle(_: Record<string, unknown>): this;\n activeStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.activeStyle = assign({}, this.schema.activeStyle, _!)),\n this)\n : this.schema.activeStyle;\n }\n\n /**\n The data array used to create shapes. A shape will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): DataPoint[] | this {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n The hover callback function for highlighting shapes on mouseover.\n*/\n hover(): ((d: DataPoint, i: number) => boolean) | null;\n hover(_: ((d: DataPoint, i: number) => boolean) | null): this;\n hover(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === void 0) return this.schema.hover;\n this.schema.hover = _;\n // v4: hover dim comes from the scene path's paint recomputation; no DOM here.\n return this;\n }\n\n /**\n The style to apply to hovered shapes.\n*/\n hoverStyle(): Record<string, unknown>;\n hoverStyle(_: Record<string, unknown>): this;\n hoverStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.hoverStyle = assign({}, this.schema.hoverStyle, _!)), this)\n : this.schema.hoverStyle;\n }\n\n /**\n A pass-through to the config method of the TextBox class used to create a shape's labels.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | SVGElement | null): this;\n select(_?: string | HTMLElement | SVGElement | null): D3Selection | this {\n return arguments.length\n ? ((this._select = select(_ as string) as unknown as D3Selection), this)\n : this._select;\n }\n\n /**\n A comparator function used to sort shapes for layering order.\n*/\n sort(): ((a: DataPoint, b: DataPoint) => number) | null;\n sort(_: ((a: DataPoint, b: DataPoint) => number) | null): this;\n sort(\n _?: ((a: DataPoint, b: DataPoint) => number) | null,\n ): ((a: DataPoint, b: DataPoint) => number) | null | this {\n return arguments.length\n ? ((this.schema.sort = _ ?? null), this)\n : this.schema.sort;\n }\n\n /**\n A series of global texture methods to be used for all textures (ie. `{stroke: \"darkorange\", strokeWidth: 2}`).\n*/\n textureDefault(): Record<string, unknown>;\n textureDefault(_: Record<string, unknown>): this;\n textureDefault(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.textureDefault = assign(this.schema.textureDefault, _!)),\n this)\n : this.schema.textureDefault;\n }\n\n /**\n Narrowed `.config()` for Shape. Inherited surface from\n `BaseClass.config()`; the override exists only to surface per-shape\n keys (e.g. `width`/`height` for Rect) in autocomplete + type checks.\n */\n config(): BaseShapeConfig;\n config(_: Partial<BaseShapeConfig>): this;\n config(_?: Partial<BaseShapeConfig>): BaseShapeConfig | this {\n if (!arguments.length) return super.config() as BaseShapeConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["color","select","colorContrast","assign","getSize","isObject","SvgRenderer","TextBox","accessor","BaseClass","constant","installFluent","buildLabelData","hitAreaNode","interactionPoints","numOrUndef","v","n","Number","isFinite","undefined","strOrUndef","String","parseDash","parts","split","map","filter","length","backgroundImageLayout","emitBackgroundImages","sortRanks","shapeSchema","key","coerce","default","d","i","id","Shape","tagName","_data","_labelClass","_name","_tagName","_textureDefs","_select","_transition","_group","_update","_enter","_exit","_hoverGroup","_activeGroup","_path","_sceneRenderer","schema","stroke","c","fill","darker","formatHex","activeStyle","includes","col","s","strokeWidth","hoverStyle","labelConfig","fontColor","fontOpacity","opacity","fontResize","fontMax","fontMin","fontSize","padding","textAnchor","verticalAlign","textureDefault","_aes","_d","_i","_getTextureKey","textureVal","texture","styleLogic","_","nested","values","indexOf","fallback","background","pathNames","orientation","retObj","size","JSON","stringify","_nestWrapper","method","__d3plusShape__","data","_buildLabelData","dataFilter","_dataFilter","bind","label","labelBounds","x","y","aes","rotate","_styleVal","fn","_sceneTransform","wrapped","Boolean","dd","ii","translate","tx","ty","scale","_scenePaint","textureKey","fillOpacity","strokeOpacity","strokeDasharray","strokeLinecap","vectorEffect","shapeRendering","_sceneGeometry","toScene","children","bgSpecs","rank","sort","forEach","geom","datum","transform","iPoints","defined","hitArea","ha","push","z","index","shapeType","paint","aria","role","ariaLabel","bg","backgroundImage","g","needsPoints","width","r","points","fit","backgroundImageFit","layout","url","box","clip","preserveAspectRatio","type","render","callback","lc","renderMode","config","setTimeout","document","div","createElement","style","cssText","body","appendChild","sel","node","tag","toLowerCase","isSvg","rawW","getAttribute","clientWidth","rawH","clientHeight","measuredW","measuredH","height","shapeGroup","labelChildren","root","scene","prev","destroy","firstChild","removeChild","renderer","mount","container","drawScene","active","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAC/B,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,aAAa,QAAO,gBAAgB;AAE5C,SAAQC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAO,cAAc;AAGtD,SAAQC,WAAW,QAAO,iBAAiB;AAG3C,SAAQC,OAAO,QAAO,yBAAyB;AAC/C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAO,oBAAoB;AAEhE,SAAQC,aAAa,QAAO,eAAe;AAE3C,SAAQC,cAAc,QAAO,sBAAsB;AACnD,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,iBAAiB,QAAO,yBAAyB;AAGzD,+DAA+D,GAC/D,OAAO,SAASC,WAAWC,CAAU;IACnC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AEQ,IAClE,IAAI,AAAD,IACH,IAAI,CAAC/B,MAAM,CAACuB,cAAc;YAChC;;;YASA8F,KAAAA;mBAAAA,SAAAA,OAAOtF,CAA4B;gBACjC,IAAI,CAACyH,UAAUpL,MAAM,EAAE,OAAO,uBA3nBbW,kBA2nBmBsI,UAAN,IAAK;gBACnC,uBA5nBiBtI,kBA4nBXsI,UAAN,IAAK,aAAQtF;gBACb,OAAO,IAAI;YACb;;;WA9nBmBhD;EAAc9B;AAHnC;;AAEA,GACA,SAAqB8B,mBA+nBpB"}
@@ -8,12 +8,38 @@
8
8
  the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the
9
9
  visible geometry are siblings, and the SVG keyed join can't hold two nodes
10
10
  under one key — sharing it made the geometry re-enter (collapse→grow) on every
11
- redraw (a "pulse" on e.g. every timeline step). Returns null when no
12
- rect-style hitArea is configured; Line's path-style hitArea is covered by its
13
- own geometry.
14
- */ export function hitAreaNode(hitArea, d, i, aes, key, datum, name, transform) {
11
+ redraw (a "pulse" on e.g. every timeline step). Returns null when no hitArea
12
+ is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses
13
+ the resolved geometry `d`/`transform` so the hover target overlaps the
14
+ visible line exactly while extending past its ~1px stroke.
15
+ */ export function hitAreaNode(hitArea, d, i, aes, key, datum, name, transform, geomD) {
15
16
  var bounds = typeof hitArea === "function" ? hitArea(d, i, aes) : hitArea;
16
- if (!bounds || typeof bounds.width !== "number" || typeof bounds.height !== "number") return null;
17
+ if (!bounds) return null;
18
+ // Path-style hitArea (Line): widen the hover target to a fat transparent
19
+ // stroke over the line's own geometry. `stroke: transparent` (not "none") is
20
+ // painted, so it hit-tests across the full width on both backends.
21
+ if (typeof bounds.width !== "number" && typeof geomD === "string") {
22
+ var sw = typeof bounds["stroke-width"] === "number" ? bounds["stroke-width"] : 10;
23
+ return {
24
+ type: "path",
25
+ d: geomD,
26
+ key: "".concat(key, "::hit"),
27
+ datum: datum,
28
+ index: i,
29
+ shapeType: name,
30
+ paint: {
31
+ fill: "none",
32
+ stroke: "transparent",
33
+ strokeWidth: sw,
34
+ vectorEffect: "non-scaling-stroke"
35
+ },
36
+ transform: transform,
37
+ aria: {
38
+ hidden: true
39
+ }
40
+ };
41
+ }
42
+ if (typeof bounds.width !== "number" || typeof bounds.height !== "number") return null;
17
43
  return {
18
44
  type: "rect",
19
45
  x: typeof bounds.x === "number" ? bounds.x : -bounds.width / 2,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/shapes/hitAreaNode.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode, Transform} from \"@d3plus/render\";\n\ntype HitArea =\n | ((d: DataPoint, i: number, aes: unknown) => Record<string, unknown>)\n | Record<string, unknown>\n | undefined;\n\n/**\n Builds the invisible, interactive \"hit area\" rect for a shape datum — a\n transparent box that can extend past the shape's own geometry (e.g. a legend\n swatch reaching across the padding to its label) so the space between them\n stays one continuous hover target instead of firing mouseleave/mouseenter as\n the pointer crosses the gap. Carries the shape's `datum` (so pointer handlers\n treat it as the same item, and the `mouseleave` same-datum suppressor bridges\n the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the\n visible geometry are siblings, and the SVG keyed join can't hold two nodes\n under one key — sharing it made the geometry re-enter (collapse→grow) on every\n redraw (a \"pulse\" on e.g. every timeline step). Returns null when no\n rect-style hitArea is configured; Line's path-style hitArea is covered by its\n own geometry.\n*/\nexport function hitAreaNode(\n hitArea: HitArea,\n d: DataPoint,\n i: number,\n aes: unknown,\n key: string | number,\n datum: DataPoint,\n name: string,\n transform: Transform,\n): SceneNode | null {\n const bounds = (\n typeof hitArea === \"function\" ? hitArea(d, i, aes) : hitArea\n ) as Record<string, unknown> | null | undefined;\n if (!bounds || typeof bounds.width !== \"number\" || typeof bounds.height !== \"number\")\n return null;\n return {\n type: \"rect\",\n x: typeof bounds.x === \"number\" ? bounds.x : -bounds.width / 2,\n y: typeof bounds.y === \"number\" ? bounds.y : -bounds.height / 2,\n width: bounds.width,\n height: bounds.height,\n key: `${key}::hit`,\n datum,\n index: i,\n shapeType: name,\n paint: {fill: \"transparent\"},\n transform,\n aria: {hidden: true},\n } as unknown as SceneNode;\n}\n"],"names":["hitAreaNode","hitArea","d","i","aes","key","datum","name","transform","bounds","width","height","type","x","y","index","shapeType","paint","fill","aria","hidden"],"mappings":"AAQA;;;;;;;;;;;;;AAaA,GACA,OAAO,SAASA,YACdC,OAAgB,EAChBC,CAAY,EACZC,CAAS,EACTC,GAAY,EACZC,GAAoB,EACpBC,KAAgB,EAChBC,IAAY,EACZC,SAAoB;IAEpB,IAAMC,SACJ,OAAOR,YAAY,aAAaA,QAAQC,GAAGC,GAAGC,OAAOH;IAEvD,IAAI,CAACQ,UAAU,OAAOA,OAAOC,KAAK,KAAK,YAAY,OAAOD,OAAOE,MAAM,KAAK,UAC1E,OAAO;IACT,OAAO;QACLC,MAAM;QACNC,GAAG,OAAOJ,OAAOI,CAAC,KAAK,WAAWJ,OAAOI,CAAC,GAAG,CAACJ,OAAOC,KAAK,GAAG;QAC7DI,GAAG,OAAOL,OAAOK,CAAC,KAAK,WAAWL,OAAOK,CAAC,GAAG,CAACL,OAAOE,MAAM,GAAG;QAC9DD,OAAOD,OAAOC,KAAK;QACnBC,QAAQF,OAAOE,MAAM;QACrBN,KAAK,AAAC,GAAM,OAAJA,KAAI;QACZC,OAAAA;QACAS,OAAOZ;QACPa,WAAWT;QACXU,OAAO;YAACC,MAAM;QAAa;QAC3BV,WAAAA;QACAW,MAAM;YAACC,QAAQ;QAAI;IACrB;AACF"}
1
+ {"version":3,"sources":["../../../src/shapes/hitAreaNode.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode, Transform} from \"@d3plus/render\";\n\ntype HitArea =\n | ((d: DataPoint, i: number, aes: unknown) => Record<string, unknown>)\n | Record<string, unknown>\n | undefined;\n\n/**\n Builds the invisible, interactive \"hit area\" rect for a shape datum — a\n transparent box that can extend past the shape's own geometry (e.g. a legend\n swatch reaching across the padding to its label) so the space between them\n stays one continuous hover target instead of firing mouseleave/mouseenter as\n the pointer crosses the gap. Carries the shape's `datum` (so pointer handlers\n treat it as the same item, and the `mouseleave` same-datum suppressor bridges\n the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the\n visible geometry are siblings, and the SVG keyed join can't hold two nodes\n under one key — sharing it made the geometry re-enter (collapse→grow) on every\n redraw (a \"pulse\" on e.g. every timeline step). Returns null when no hitArea\n is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses\n the resolved geometry `d`/`transform` so the hover target overlaps the\n visible line exactly while extending past its ~1px stroke.\n*/\nexport function hitAreaNode(\n hitArea: HitArea,\n d: DataPoint,\n i: number,\n aes: unknown,\n key: string | number,\n datum: DataPoint,\n name: string,\n transform: Transform,\n geomD?: string,\n): SceneNode | null {\n const bounds = (\n typeof hitArea === \"function\" ? hitArea(d, i, aes) : hitArea\n ) as Record<string, unknown> | null | undefined;\n if (!bounds) return null;\n // Path-style hitArea (Line): widen the hover target to a fat transparent\n // stroke over the line's own geometry. `stroke: transparent` (not \"none\") is\n // painted, so it hit-tests across the full width on both backends.\n if (typeof bounds.width !== \"number\" && typeof geomD === \"string\") {\n const sw = typeof bounds[\"stroke-width\"] === \"number\" ? (bounds[\"stroke-width\"] as number) : 10;\n return {\n type: \"path\",\n d: geomD,\n key: `${key}::hit`,\n datum,\n index: i,\n shapeType: name,\n paint: {fill: \"none\", stroke: \"transparent\", strokeWidth: sw, vectorEffect: \"non-scaling-stroke\"},\n transform,\n aria: {hidden: true},\n } as unknown as SceneNode;\n }\n if (typeof bounds.width !== \"number\" || typeof bounds.height !== \"number\")\n return null;\n return {\n type: \"rect\",\n x: typeof bounds.x === \"number\" ? bounds.x : -bounds.width / 2,\n y: typeof bounds.y === \"number\" ? bounds.y : -bounds.height / 2,\n width: bounds.width,\n height: bounds.height,\n key: `${key}::hit`,\n datum,\n index: i,\n shapeType: name,\n paint: {fill: \"transparent\"},\n transform,\n aria: {hidden: true},\n } as unknown as SceneNode;\n}\n"],"names":["hitAreaNode","hitArea","d","i","aes","key","datum","name","transform","geomD","bounds","width","sw","type","index","shapeType","paint","fill","stroke","strokeWidth","vectorEffect","aria","hidden","height","x","y"],"mappings":"AAQA;;;;;;;;;;;;;;AAcA,GACA,OAAO,SAASA,YACdC,OAAgB,EAChBC,CAAY,EACZC,CAAS,EACTC,GAAY,EACZC,GAAoB,EACpBC,KAAgB,EAChBC,IAAY,EACZC,SAAoB,EACpBC,KAAc;IAEd,IAAMC,SACJ,OAAOT,YAAY,aAAaA,QAAQC,GAAGC,GAAGC,OAAOH;IAEvD,IAAI,CAACS,QAAQ,OAAO;IACpB,yEAAyE;IACzE,6EAA6E;IAC7E,mEAAmE;IACnE,IAAI,OAAOA,OAAOC,KAAK,KAAK,YAAY,OAAOF,UAAU,UAAU;QACjE,IAAMG,KAAK,OAAOF,MAAM,CAAC,eAAe,KAAK,WAAYA,MAAM,CAAC,eAAe,GAAc;QAC7F,OAAO;YACLG,MAAM;YACNX,GAAGO;YACHJ,KAAK,AAAC,GAAM,OAAJA,KAAI;YACZC,OAAAA;YACAQ,OAAOX;YACPY,WAAWR;YACXS,OAAO;gBAACC,MAAM;gBAAQC,QAAQ;gBAAeC,aAAaP;gBAAIQ,cAAc;YAAoB;YAChGZ,WAAAA;YACAa,MAAM;gBAACC,QAAQ;YAAI;QACrB;IACF;IACA,IAAI,OAAOZ,OAAOC,KAAK,KAAK,YAAY,OAAOD,OAAOa,MAAM,KAAK,UAC/D,OAAO;IACT,OAAO;QACLV,MAAM;QACNW,GAAG,OAAOd,OAAOc,CAAC,KAAK,WAAWd,OAAOc,CAAC,GAAG,CAACd,OAAOC,KAAK,GAAG;QAC7Dc,GAAG,OAAOf,OAAOe,CAAC,KAAK,WAAWf,OAAOe,CAAC,GAAG,CAACf,OAAOa,MAAM,GAAG;QAC9DZ,OAAOD,OAAOC,KAAK;QACnBY,QAAQb,OAAOa,MAAM;QACrBlB,KAAK,AAAC,GAAM,OAAJA,KAAI;QACZC,OAAAA;QACAQ,OAAOX;QACPY,WAAWR;QACXS,OAAO;YAACC,MAAM;QAAa;QAC3BT,WAAAA;QACAa,MAAM;YAACC,QAAQ;QAAI;IACrB;AACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ For a nested shape datum (Line/Area, whose datum wraps many points) returns a
3
+ spreadable scene-node fragment carrying each point's content-space position
4
+ paired with its source datum, so the pointer bridge can report the point
5
+ nearest the cursor rather than the whole-series aggregate. Points the
6
+ `defined` accessor rejects, or whose position isn't finite (a missing value),
7
+ are skipped — so the nearest match is always a real, defined point. Returns
8
+ an empty object for non-nested data (spreads to nothing).
9
+ */ export function interactionPoints(d, x, y, defined) {
10
+ if (!d.__d3plusShape__ || !Array.isArray(d.values)) return {};
11
+ var values = d.values;
12
+ var points = [];
13
+ values.forEach(function(v, k) {
14
+ if (typeof defined === "function" && defined(v, k) === false) return;
15
+ var px = Number(x(v, k));
16
+ var py = Number(y(v, k));
17
+ if (!Number.isFinite(px) || !Number.isFinite(py)) return;
18
+ points.push({
19
+ x: px,
20
+ y: py,
21
+ datum: v,
22
+ index: typeof v.i === "number" ? v.i : k
23
+ });
24
+ });
25
+ return points.length ? {
26
+ interactionPoints: points
27
+ } : {};
28
+ }
29
+
30
+ //# sourceMappingURL=interactionPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shapes/interactionPoints.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {InteractionPoint} from \"@d3plus/render\";\nimport type {AccessorFn} from \"../utils/index.js\";\n\n/**\n For a nested shape datum (Line/Area, whose datum wraps many points) returns a\n spreadable scene-node fragment carrying each point's content-space position\n paired with its source datum, so the pointer bridge can report the point\n nearest the cursor rather than the whole-series aggregate. Points the\n `defined` accessor rejects, or whose position isn't finite (a missing value),\n are skipped — so the nearest match is always a real, defined point. Returns\n an empty object for non-nested data (spreads to nothing).\n*/\nexport function interactionPoints(\n d: DataPoint,\n x: AccessorFn,\n y: AccessorFn,\n defined?: AccessorFn,\n): {interactionPoints?: InteractionPoint[]} {\n if (!d.__d3plusShape__ || !Array.isArray(d.values)) return {};\n const values = d.values as unknown as DataPoint[];\n const points: InteractionPoint[] = [];\n values.forEach((v, k) => {\n if (typeof defined === \"function\" && defined(v, k) === false) return;\n const px = Number(x(v, k));\n const py = Number(y(v, k));\n if (!Number.isFinite(px) || !Number.isFinite(py)) return;\n points.push({\n x: px,\n y: py,\n datum: v,\n index: typeof v.i === \"number\" ? (v.i as number) : k,\n });\n });\n return points.length ? {interactionPoints: points} : {};\n}\n"],"names":["interactionPoints","d","x","y","defined","__d3plusShape__","Array","isArray","values","points","forEach","v","k","px","Number","py","isFinite","push","datum","index","i","length"],"mappings":"AAIA;;;;;;;;AAQA,GACA,OAAO,SAASA,kBACdC,CAAY,EACZC,CAAa,EACbC,CAAa,EACbC,OAAoB;IAEpB,IAAI,CAACH,EAAEI,eAAe,IAAI,CAACC,MAAMC,OAAO,CAACN,EAAEO,MAAM,GAAG,OAAO,CAAC;IAC5D,IAAMA,SAASP,EAAEO,MAAM;IACvB,IAAMC,SAA6B,EAAE;IACrCD,OAAOE,OAAO,CAAC,SAACC,GAAGC;QACjB,IAAI,OAAOR,YAAY,cAAcA,QAAQO,GAAGC,OAAO,OAAO;QAC9D,IAAMC,KAAKC,OAAOZ,EAAES,GAAGC;QACvB,IAAMG,KAAKD,OAAOX,EAAEQ,GAAGC;QACvB,IAAI,CAACE,OAAOE,QAAQ,CAACH,OAAO,CAACC,OAAOE,QAAQ,CAACD,KAAK;QAClDN,OAAOQ,IAAI,CAAC;YACVf,GAAGW;YACHV,GAAGY;YACHG,OAAOP;YACPQ,OAAO,OAAOR,EAAES,CAAC,KAAK,WAAYT,EAAES,CAAC,GAAcR;QACrD;IACF;IACA,OAAOH,OAAOY,MAAM,GAAG;QAACrB,mBAAmBS;IAAM,IAAI,CAAC;AACxD"}