@d3plus/core 4.1.0 → 4.2.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 (61) hide show
  1. package/README.md +686 -671
  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/index.js +2 -1
  11. package/es/src/charts/Geomap/index.js.map +1 -1
  12. package/es/src/charts/LinePlot/index.js +2 -1
  13. package/es/src/charts/LinePlot/index.js.map +1 -1
  14. package/es/src/charts/Matrix/index.js +1 -0
  15. package/es/src/charts/Matrix/index.js.map +1 -1
  16. package/es/src/charts/Network/index.js +2 -1
  17. package/es/src/charts/Network/index.js.map +1 -1
  18. package/es/src/charts/Pack/index.js +1 -0
  19. package/es/src/charts/Pack/index.js.map +1 -1
  20. package/es/src/charts/Pie/index.js +1 -0
  21. package/es/src/charts/Pie/index.js.map +1 -1
  22. package/es/src/charts/Plot/index.js +22 -12
  23. package/es/src/charts/Plot/index.js.map +1 -1
  24. package/es/src/charts/Plot/pipelineDomains.js +3 -3
  25. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  26. package/es/src/charts/Plot/stackHelpers.js +128 -9
  27. package/es/src/charts/Plot/stackHelpers.js.map +1 -1
  28. package/es/src/charts/Radar/index.js +2 -1
  29. package/es/src/charts/Radar/index.js.map +1 -1
  30. package/es/src/charts/RadialMatrix/index.js +1 -0
  31. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  32. package/es/src/charts/Rings/index.js +2 -1
  33. package/es/src/charts/Rings/index.js.map +1 -1
  34. package/es/src/charts/Sankey/index.js +2 -1
  35. package/es/src/charts/Sankey/index.js.map +1 -1
  36. package/es/src/charts/Tree/index.js +2 -1
  37. package/es/src/charts/Tree/index.js.map +1 -1
  38. package/es/src/charts/Treemap/index.js +1 -0
  39. package/es/src/charts/Treemap/index.js.map +1 -1
  40. package/es/src/shapes/Image.js +2 -3
  41. package/es/src/shapes/Image.js.map +1 -1
  42. package/es/src/shapes/Shape.js +35 -36
  43. package/es/src/shapes/Shape.js.map +1 -1
  44. package/es/src/shapes/sceneSort.js +304 -24
  45. package/es/src/shapes/sceneSort.js.map +1 -1
  46. package/es/src/shapes/shapeConfig.js.map +1 -1
  47. package/es/src/utils/D3plusConfig.js.map +1 -1
  48. package/package.json +9 -9
  49. package/types/src/charts/Plot/index.d.ts +22 -6
  50. package/types/src/charts/Plot/stackHelpers.d.ts +62 -4
  51. package/types/src/shapes/Image.d.ts +2 -3
  52. package/types/src/shapes/Shape.d.ts +0 -2
  53. package/types/src/shapes/sceneSort.d.ts +83 -8
  54. package/types/src/shapes/shapeConfig.d.ts +7 -0
  55. package/types/src/utils/D3plusConfig.d.ts +19 -2
  56. package/umd/d3plus-core.full.js +1581 -561
  57. package/umd/d3plus-core.full.js.map +1 -1
  58. package/umd/d3plus-core.full.min.js +1091 -927
  59. package/umd/d3plus-core.js +541 -224
  60. package/umd/d3plus-core.js.map +1 -1
  61. package/umd/d3plus-core.min.js +468 -363
@@ -222,9 +222,8 @@ var Image = /*#__PURE__*/ function() {
222
222
  /**
223
223
  Compute-mode scene emission. Mirrors Shape.toScene's shape — a
224
224
  keyed GroupNode wrapping per-datum ImageNodes. Used by chart
225
- compositors (Shape._backgroundImageClass, plotPaint) that need
226
- Image to participate in the scene graph rather than emit
227
- d3-selection DOM.
225
+ compositors (e.g. plotPaint) that need Image to participate in the
226
+ scene graph rather than emit d3-selection DOM.
228
227
  */ key: "toScene",
229
228
  value: function toScene() {
230
229
  var _this = this;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/shapes/Image.ts"],"sourcesContent":["import {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport type {GroupNode, ImageNode, SceneNode} from \"@d3plus/render\";\n\nimport {accessor, constant} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\n\n/** Image's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst imageSchema: ConfigField[] = [\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"height\", coerce: \"accessor\", default: accessor(\"height\")},\n {key: \"id\", coerce: \"identity\", default: accessor(\"id\")},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"auto\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"url\", coerce: \"identity\", default: accessor(\"url\")},\n {key: \"width\", coerce: \"accessor\", default: accessor(\"width\")},\n {key: \"x\", coerce: \"const\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"const\", default: accessor(\"y\", 0)},\n];\n\n/**\n Creates SVG images based on an array of data.\n @example <caption>a sample row of data</caption>\nvar data = {\"url\": \"file.png\", \"width\": \"100\", \"height\": \"50\"};\n@example <caption>passed to the generator</caption>\nnew Image().data([data]).render();\n@example <caption>creates the following</caption>\n<image class=\"d3plus-Image\" opacity=\"1\" href=\"file.png\" width=\"100\" height=\"50\" x=\"0\" y=\"0\"></image>\n@example <caption>this is shorthand for the following</caption>\nimage().data([data])();\n@example <caption>which also allows a post-draw callback function</caption>\nimage().data([data])(function() { alert(\"draw complete!\"); })\n*/\nexport default class Image {\n // installFluent generates the config accessors (width, x, url, …) at\n // runtime; 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema!: Record<string, any>;\n _select!: D3Selection;\n _data!: DataPoint[];\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n installFluent(this, imageSchema);\n }\n\n /**\n Get/set multiple config values at once. Mirrors the `BaseClass.config()`\n contract used by the other shapes (and relied on by the React wrapper):\n each patch key is routed through its matching fluent accessor (or\n `data`/`select`), with unknown keys stored on `schema` verbatim.\n */\n config(): Record<string, unknown>;\n config(_: Record<string, unknown>): this;\n config(_?: Record<string, unknown>): Record<string, unknown> | this {\n if (!arguments.length)\n return {...this.schema, data: this._data, select: this._select};\n const patch = _ as Record<string, unknown>;\n for (const k in patch) {\n if (!Object.prototype.hasOwnProperty.call(patch, k)) continue;\n // `this[k]` resolves the fluent accessor via the index signature.\n if (typeof this[k] === \"function\") this[k](patch[k]);\n else this.schema[k] = patch[k];\n }\n return this;\n }\n\n /**\n Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: () => void): this {\n // Compute mode is a no-op for DOM emission — the caller will read\n // `toScene()` to get a SceneNode tree, no need to mount.\n if (this.schema.renderMode === \"compute\") {\n if (callback) setTimeout(callback, 0);\n return this;\n }\n if (this._select === void 0)\n this.select(\n select(\"body\")\n .append(\"svg\")\n .style(\"width\", `${window.innerWidth}px`)\n .style(\"height\", `${window.innerHeight}px`)\n .style(\"display\", \"block\")\n .node(),\n );\n\n const images = this._select\n .selectAll<SVGImageElement, DataPoint>(\".d3plus-Image\")\n .data(this._data, this.schema.id);\n\n const enter = images\n .enter()\n .append(\"image\")\n .attr(\"class\", \"d3plus-Image\")\n .attr(\"opacity\", 0)\n .attr(\"width\", 0)\n .attr(\"height\", 0)\n .attr(\n \"x\",\n (d: DataPoint, i: number) =>\n (this.schema.x(d, i) as number) + (this.schema.width(d, i) as number) / 2,\n )\n .attr(\n \"y\",\n (d: DataPoint, i: number) =>\n (this.schema.y(d, i) as number) + (this.schema.height(d, i) as number) / 2,\n );\n\n const t = transition().duration(this.schema.duration),\n that = this,\n update = enter.merge(images);\n\n update\n .attr(\"xlink:href\", this.schema.url)\n .style(\"pointer-events\", this.schema.pointerEvents)\n .transition(t)\n .attr(\"opacity\", this.schema.opacity)\n .attr(\"width\", (d: DataPoint, i: number) => this.schema.width(d, i))\n .attr(\"height\", (d: DataPoint, i: number) => this.schema.height(d, i))\n .attr(\"x\", (d: DataPoint, i: number) => this.schema.x(d, i))\n .attr(\"y\", (d: DataPoint, i: number) => this.schema.y(d, i))\n .each(function (this: Element, d: DataPoint, i: number) {\n const image = select(this),\n link = that.schema.url(d, i) as string;\n const fullAddress =\n link.indexOf(\"http://\") === 0 || link.indexOf(\"https://\") === 0;\n if (!fullAddress || link.indexOf(window.location.hostname) === 0) {\n const img = new (\n window as unknown as Record<string, unknown> & {\n Image: new () => HTMLImageElement;\n }\n ).Image();\n img.src = link;\n img.crossOrigin = \"Anonymous\";\n img.onload = function () {\n const canvas = document.createElement(\"canvas\");\n canvas.width = img.width;\n canvas.height = img.height;\n const context = canvas.getContext(\"2d\")!;\n context.drawImage(img, 0, 0);\n image.attr(\"xlink:href\", canvas.toDataURL(\"image/png\"));\n };\n }\n });\n\n images\n .exit<DataPoint>()\n .transition(t)\n .attr(\"width\", (d: DataPoint, i: number) => this.schema.width(d, i))\n .attr(\"height\", (d: DataPoint, i: number) => this.schema.height(d, i))\n .attr(\"x\", (d: DataPoint, i: number) => this.schema.x(d, i))\n .attr(\"y\", (d: DataPoint, i: number) => this.schema.y(d, i))\n .attr(\"opacity\", 0)\n .remove();\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n The data array used to create image shapes. An <image> tag 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 Compute-mode scene emission. Mirrors Shape.toScene's shape — a\n keyed GroupNode wrapping per-datum ImageNodes. Used by chart\n compositors (Shape._backgroundImageClass, plotPaint) that need\n Image to participate in the scene graph rather than emit\n d3-selection DOM.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = (this._data || []).map(\n (d: DataPoint, i: number) => {\n const node: ImageNode = {\n type: \"image\",\n key: `${this.schema.id(d, i)}`,\n x: this.schema.x(d, i) as number,\n y: this.schema.y(d, i) as number,\n width: this.schema.width(d, i) as number,\n height: this.schema.height(d, i) as number,\n href: this.schema.url(d, i) as string,\n paint: {opacity: this.schema.opacity(d, i) as number},\n datum: d,\n index: i,\n };\n return node;\n },\n );\n return {type: \"group\", key: \"d3plus-Image\", children};\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"],"names":["select","transition","accessor","constant","installFluent","imageSchema","key","coerce","default","Image","schema","_select","_data","config","_","arguments","length","data","patch","k","Object","prototype","hasOwnProperty","call","render","callback","renderMode","setTimeout","append","style","window","innerWidth","innerHeight","node","images","selectAll","id","enter","attr","d","i","x","width","y","height","t","duration","that","update","merge","url","pointerEvents","opacity","each","image","link","fullAddress","indexOf","location","hostname","img","src","crossOrigin","onload","canvas","document","createElement","context","getContext","drawImage","toDataURL","exit","remove","toScene","children","map","type","href","paint","datum","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,eAAe;AACpC,SAAQC,UAAU,QAAO,gBAAgB;AAMzC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,oBAAoB;AACrD,SAAQC,aAAa,QAAO,eAAe;AAG3C,iFAAiF,GACjF,IAAMC,cAA6B;IACjC;QAACC,KAAK;QAAYC,QAAQ;QAAYC,SAAS;IAAG;IAClD;QAACF,KAAK;QAAUC,QAAQ;QAAYC,SAASN,SAAS;IAAS;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BACzBsC,OAAO;4BAAC1B,SAAS,MAAK1C,MAAM,CAAC0C,OAAO,CAACb,GAAGC;wBAAY;wBACpDuC,OAAOxC;wBACPyC,OAAOxC;oBACT;oBACA,OAAOP;gBACT;gBAEF,OAAO;oBAAC2C,MAAM;oBAAStE,KAAK;oBAAgBoE,UAAAA;gBAAQ;YACtD;;;YAOA1E,KAAAA;mBAAAA,SAAAA,QAAOc,CAA4C;gBACjD,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACL,OAAO,GAAGX,OAAOc,IAAyC,IAAI,AAAD,IACpE,IAAI,CAACH,OAAO;YAClB;;;WApLmBF;;AAbrB;;;;;;;;;;;;AAYA,GACA,SAAqBA,mBAqLpB"}
1
+ {"version":3,"sources":["../../../src/shapes/Image.ts"],"sourcesContent":["import {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport type {GroupNode, ImageNode, SceneNode} from \"@d3plus/render\";\n\nimport {accessor, constant} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\n\n/** Image's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst imageSchema: ConfigField[] = [\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"height\", coerce: \"accessor\", default: accessor(\"height\")},\n {key: \"id\", coerce: \"identity\", default: accessor(\"id\")},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"auto\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"url\", coerce: \"identity\", default: accessor(\"url\")},\n {key: \"width\", coerce: \"accessor\", default: accessor(\"width\")},\n {key: \"x\", coerce: \"const\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"const\", default: accessor(\"y\", 0)},\n];\n\n/**\n Creates SVG images based on an array of data.\n @example <caption>a sample row of data</caption>\nvar data = {\"url\": \"file.png\", \"width\": \"100\", \"height\": \"50\"};\n@example <caption>passed to the generator</caption>\nnew Image().data([data]).render();\n@example <caption>creates the following</caption>\n<image class=\"d3plus-Image\" opacity=\"1\" href=\"file.png\" width=\"100\" height=\"50\" x=\"0\" y=\"0\"></image>\n@example <caption>this is shorthand for the following</caption>\nimage().data([data])();\n@example <caption>which also allows a post-draw callback function</caption>\nimage().data([data])(function() { alert(\"draw complete!\"); })\n*/\nexport default class Image {\n // installFluent generates the config accessors (width, x, url, …) at\n // runtime; 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema!: Record<string, any>;\n _select!: D3Selection;\n _data!: DataPoint[];\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n installFluent(this, imageSchema);\n }\n\n /**\n Get/set multiple config values at once. Mirrors the `BaseClass.config()`\n contract used by the other shapes (and relied on by the React wrapper):\n each patch key is routed through its matching fluent accessor (or\n `data`/`select`), with unknown keys stored on `schema` verbatim.\n */\n config(): Record<string, unknown>;\n config(_: Record<string, unknown>): this;\n config(_?: Record<string, unknown>): Record<string, unknown> | this {\n if (!arguments.length)\n return {...this.schema, data: this._data, select: this._select};\n const patch = _ as Record<string, unknown>;\n for (const k in patch) {\n if (!Object.prototype.hasOwnProperty.call(patch, k)) continue;\n // `this[k]` resolves the fluent accessor via the index signature.\n if (typeof this[k] === \"function\") this[k](patch[k]);\n else this.schema[k] = patch[k];\n }\n return this;\n }\n\n /**\n Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: () => void): this {\n // Compute mode is a no-op for DOM emission — the caller will read\n // `toScene()` to get a SceneNode tree, no need to mount.\n if (this.schema.renderMode === \"compute\") {\n if (callback) setTimeout(callback, 0);\n return this;\n }\n if (this._select === void 0)\n this.select(\n select(\"body\")\n .append(\"svg\")\n .style(\"width\", `${window.innerWidth}px`)\n .style(\"height\", `${window.innerHeight}px`)\n .style(\"display\", \"block\")\n .node(),\n );\n\n const images = this._select\n .selectAll<SVGImageElement, DataPoint>(\".d3plus-Image\")\n .data(this._data, this.schema.id);\n\n const enter = images\n .enter()\n .append(\"image\")\n .attr(\"class\", \"d3plus-Image\")\n .attr(\"opacity\", 0)\n .attr(\"width\", 0)\n .attr(\"height\", 0)\n .attr(\n \"x\",\n (d: DataPoint, i: number) =>\n (this.schema.x(d, i) as number) + (this.schema.width(d, i) as number) / 2,\n )\n .attr(\n \"y\",\n (d: DataPoint, i: number) =>\n (this.schema.y(d, i) as number) + (this.schema.height(d, i) as number) / 2,\n );\n\n const t = transition().duration(this.schema.duration),\n that = this,\n update = enter.merge(images);\n\n update\n .attr(\"xlink:href\", this.schema.url)\n .style(\"pointer-events\", this.schema.pointerEvents)\n .transition(t)\n .attr(\"opacity\", this.schema.opacity)\n .attr(\"width\", (d: DataPoint, i: number) => this.schema.width(d, i))\n .attr(\"height\", (d: DataPoint, i: number) => this.schema.height(d, i))\n .attr(\"x\", (d: DataPoint, i: number) => this.schema.x(d, i))\n .attr(\"y\", (d: DataPoint, i: number) => this.schema.y(d, i))\n .each(function (this: Element, d: DataPoint, i: number) {\n const image = select(this),\n link = that.schema.url(d, i) as string;\n const fullAddress =\n link.indexOf(\"http://\") === 0 || link.indexOf(\"https://\") === 0;\n if (!fullAddress || link.indexOf(window.location.hostname) === 0) {\n const img = new (\n window as unknown as Record<string, unknown> & {\n Image: new () => HTMLImageElement;\n }\n ).Image();\n img.src = link;\n img.crossOrigin = \"Anonymous\";\n img.onload = function () {\n const canvas = document.createElement(\"canvas\");\n canvas.width = img.width;\n canvas.height = img.height;\n const context = canvas.getContext(\"2d\")!;\n context.drawImage(img, 0, 0);\n image.attr(\"xlink:href\", canvas.toDataURL(\"image/png\"));\n };\n }\n });\n\n images\n .exit<DataPoint>()\n .transition(t)\n .attr(\"width\", (d: DataPoint, i: number) => this.schema.width(d, i))\n .attr(\"height\", (d: DataPoint, i: number) => this.schema.height(d, i))\n .attr(\"x\", (d: DataPoint, i: number) => this.schema.x(d, i))\n .attr(\"y\", (d: DataPoint, i: number) => this.schema.y(d, i))\n .attr(\"opacity\", 0)\n .remove();\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n The data array used to create image shapes. An <image> tag 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 Compute-mode scene emission. Mirrors Shape.toScene's shape — a\n keyed GroupNode wrapping per-datum ImageNodes. Used by chart\n compositors (e.g. plotPaint) that need Image to participate in the\n scene graph rather than emit d3-selection DOM.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = (this._data || []).map(\n (d: DataPoint, i: number) => {\n const node: ImageNode = {\n type: \"image\",\n key: `${this.schema.id(d, i)}`,\n x: this.schema.x(d, i) as number,\n y: this.schema.y(d, i) as number,\n width: this.schema.width(d, i) as number,\n height: this.schema.height(d, i) as number,\n href: this.schema.url(d, i) as string,\n paint: {opacity: this.schema.opacity(d, i) as number},\n datum: d,\n index: i,\n };\n return node;\n },\n );\n return {type: \"group\", key: \"d3plus-Image\", children};\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"],"names":["select","transition","accessor","constant","installFluent","imageSchema","key","coerce","default","Image","schema","_select","_data","config","_","arguments","length","data","patch","k","Object","prototype","hasOwnProperty","call","render","callback","renderMode","setTimeout","append","style","window","innerWidth","innerHeight","node","images","selectAll","id","enter","attr","d","i","x","width","y","height","t","duration","that","update","merge","url","pointerEvents","opacity","each","image","link","fullAddress","indexOf","location","hostname","img","src","crossOrigin","onload","canvas","document","createElement","context","getContext","drawImage","toDataURL","exit","remove","toScene","children","map","type","href","paint","datum","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,eAAe;AACpC,SAAQC,UAAU,QAAO,gBAAgB;AAMzC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,oBAAoB;AACrD,SAAQC,aAAa,QAAO,eAAe;AAG3C,iFAAiF,GACjF,IAAMC,cAA6B;IACjC;QAACC,KAAK;QAAYC,QAAQ;QAAYC,SAAS;IAAG;IAClD;QAACF,KAAK;QAAUC,QAAQ;QAAYC,SAASN,SAAS;IAAS;IAC/D;QAACI,KAAK;QAAMC,QAAQ;QAAYC,SAASN,SAAS;IAAK;IACvD;QAACI,KAAK;QAAWC,QAAQ;QAASC,SAASL,SAAS;IAAE;IACtD;QAACG,KAAK;QAAiBC,QAAQ;QAASC,SAASL,SAAS;IAAO;IACjE;QAACG,KAAK;QAAcC,QAAQ;QAAYC,SAAS;IAAM;IACvD;QAACF,KAAK;QAAOC,QAAQ;QAAYC,SAASN,SAAS;IAAM;IACzD;QAACI,KAAK;QAASC,QAAQ;QAAYC,SAASN,SAAS;IAAQ;IAC7D;QAACI,KAAK;QAAKC,QAAQ;QAASC,SAASN,SAAS,KAAK;IAAE;IACrD;QAACI,KAAK;QAAKC,QAAQ;QAASC,SAASN,SAAS,KAAK;IAAE;CACtD;AAec,IAAA,AAAMO,sBAAN;;aAAMA;gCAAAA;QAKnB,8DAA8D;QAC9DC,uBAAAA,UAAAA,KAAAA;QACAC,uBAAAA,WAAAA,KAAAA;QACAC,uBAAAA,SAAAA,KAAAA;QAOER,cAAc,IAAI,EAAEC;;kBAfHI;;YA0BnBI,KAAAA;mBAAAA,SAAAA,OAAOC,CAA2B;gBAChC,IAAI,CAACC,UAAUC,MAAM,EACnB,OAAO,wCA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AC,CAAA,IAAI,CAAC9D,KAAK,IAAI,EAAE,AAAD,EAAG+D,GAAG,CAClD,SAACpC,GAAcC;oBACb,IAAMP,OAAkB;wBACtB2C,MAAM;wBACNtE,KAAK,AAAC,GAAuB,OAArB,MAAKI,MAAM,CAAC0B,EAAE,CAACG,GAAGC;wBAC1BC,GAAG,MAAK/B,MAAM,CAAC+B,CAAC,CAACF,GAAGC;wBACpBG,GAAG,MAAKjC,MAAM,CAACiC,CAAC,CAACJ,GAAGC;wBACpBE,OAAO,MAAKhC,MAAM,CAACgC,KAAK,CAACH,GAAGC;wBAC5BI,QAAQ,MAAKlC,MAAM,CAACkC,MAAM,CAACL,GAAGC;wBAC9BqC,MAAM,MAAKnE,MAAM,CAACwC,GAAG,CAACX,GAAGC;wBACzBsC,OAAO;4BAAC1B,SAAS,MAAK1C,MAAM,CAAC0C,OAAO,CAACb,GAAGC;wBAAY;wBACpDuC,OAAOxC;wBACPyC,OAAOxC;oBACT;oBACA,OAAOP;gBACT;gBAEF,OAAO;oBAAC2C,MAAM;oBAAStE,KAAK;oBAAgBoE,UAAAA;gBAAQ;YACtD;;;YAOA1E,KAAAA;mBAAAA,SAAAA,QAAOc,CAA4C;gBACjD,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACL,OAAO,GAAGX,OAAOc,IAAyC,IAAI,AAAD,IACpE,IAAI,CAACH,OAAO;YAClB;;;WAnLmBF;;AAbrB;;;;;;;;;;;;AAYA,GACA,SAAqBA,mBAoLpB"}
@@ -231,8 +231,7 @@ import { hitAreaNode } from "./hitAreaNode.js";
231
231
  });
232
232
  return parts.length ? parts : undefined;
233
233
  }
234
- import Image from "./Image.js";
235
- import { emitBackgroundImages, sortRanks } from "./sceneSort.js";
234
+ import { backgroundImageLayout, emitBackgroundImages, sortRanks } from "./sceneSort.js";
236
235
  /** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */ var shapeSchema = [
237
236
  {
238
237
  key: "activeOpacity",
@@ -249,6 +248,11 @@ import { emitBackgroundImages, sortRanks } from "./sceneSort.js";
249
248
  coerce: "const",
250
249
  default: constant(false)
251
250
  },
251
+ {
252
+ key: "backgroundImageFit",
253
+ coerce: "const",
254
+ default: constant("cover")
255
+ },
252
256
  {
253
257
  key: "discrete",
254
258
  coerce: "identity"
@@ -404,9 +408,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
404
408
  var tagName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "g";
405
409
  _class_call_check(this, Shape);
406
410
  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);
411
+ _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
412
  installFluent(_this, shapeSchema);
409
- _this._backgroundImageClass = new Image();
410
413
  _this._data = [];
411
414
  _this._labelClass = new TextBox();
412
415
  _this._name = "Shape";
@@ -673,10 +676,10 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
673
676
  var data = this._data;
674
677
  if (this._dataFilter) data = this._dataFilter(data);
675
678
  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 = [];
679
+ // Collected background images, emitted below (after the geometry) as clipped,
680
+ // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a
681
+ // truthy URL contributes one spec.
682
+ var bgSpecs = [];
680
683
  // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of
681
684
  // `data`: the render backends sort each group's children ascending by `z`
682
685
  // (stably), so a lower rank paints first (behind) and a higher rank paints
@@ -712,42 +715,38 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
712
715
  }), rank ? {
713
716
  z: rank[i]
714
717
  } : {}));
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).
718
+ // backgroundImage: collect a per-datum image (see backgroundImageLayout for
719
+ // the cover/contain fit). The wrapping group carries the shape transform,
720
+ // so the image box + clip stay in local space.
718
721
  var bg = _this._nestWrapper(_this.schema.backgroundImage)(d, i);
719
722
  if (bg) {
720
- var _t_x, _t_y;
723
+ var _this__aes_points;
721
724
  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
- });
725
+ // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle
726
+ // derive their layout from `d`/width/r directly.
727
+ var needsPoints = typeof g.d !== "string" && typeof g.width !== "number" && typeof g.r !== "number";
728
+ var points = needsPoints ? (_this__aes_points = _this._aes(d, i).points) !== null && _this__aes_points !== void 0 ? _this__aes_points : [] : [];
729
+ var fit = _this._nestWrapper(_this.schema.backgroundImageFit)(d, i);
730
+ var layout = backgroundImageLayout(g, points, fit === "contain" ? "contain" : "cover");
731
+ if (layout) {
732
+ bgSpecs.push({
733
+ key: key,
734
+ index: i,
735
+ datum: datum,
736
+ url: bg,
737
+ box: layout.box,
738
+ clip: layout.clip,
739
+ preserveAspectRatio: layout.preserveAspectRatio,
740
+ opacity: numOrUndef(_this._nestWrapper(_this.schema.opacity)(d, i)),
741
+ transform: transform
742
+ });
743
+ }
745
744
  }
746
745
  });
747
746
  // Emit background images AFTER shape children so they paint above the
748
747
  // shape's fill — matches the DOM order where the <image> was
749
748
  // 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)));
749
+ if (bgSpecs.length) (_children = children).push.apply(_children, _to_consumable_array(emitBackgroundImages(bgSpecs, rank, data.length)));
751
750
  // NOTE: Labels are NOT pushed here. The canonical aggregation point is
752
751
  // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`
753
752
  // 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,QACJS,MAAM,CAACV,SAAAA;eAAKC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ACwH,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 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 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 // 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 // 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 (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","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","first","_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","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;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,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