@d3plus/core 4.0.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 (79) hide show
  1. package/README.md +947 -921
  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/charts/events/click.legend.js +1 -1
  41. package/es/src/charts/events/click.legend.js.map +1 -1
  42. package/es/src/charts/events/mousemove.legend.js +1 -1
  43. package/es/src/charts/events/mousemove.legend.js.map +1 -1
  44. package/es/src/charts/features/features.js +3 -3
  45. package/es/src/charts/features/features.js.map +1 -1
  46. package/es/src/charts/features/featuresLegend.js +1 -1
  47. package/es/src/charts/features/featuresLegend.js.map +1 -1
  48. package/es/src/charts/viz/VizBase.js.map +1 -1
  49. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  50. package/es/src/components/TextBox.js +21 -5
  51. package/es/src/components/TextBox.js.map +1 -1
  52. package/es/src/shapes/Circle.js +12 -4
  53. package/es/src/shapes/Circle.js.map +1 -1
  54. package/es/src/shapes/Image.js +2 -3
  55. package/es/src/shapes/Image.js.map +1 -1
  56. package/es/src/shapes/Shape.js +35 -36
  57. package/es/src/shapes/Shape.js.map +1 -1
  58. package/es/src/shapes/buildLabelData.js +59 -4
  59. package/es/src/shapes/buildLabelData.js.map +1 -1
  60. package/es/src/shapes/sceneSort.js +304 -24
  61. package/es/src/shapes/sceneSort.js.map +1 -1
  62. package/es/src/shapes/shapeConfig.js.map +1 -1
  63. package/es/src/utils/D3plusConfig.js.map +1 -1
  64. package/package.json +10 -10
  65. package/types/src/charts/Plot/index.d.ts +22 -6
  66. package/types/src/charts/Plot/stackHelpers.d.ts +62 -4
  67. package/types/src/charts/viz/VizBase.d.ts +4 -4
  68. package/types/src/charts/viz/VizBaseConfig.d.ts +4 -3
  69. package/types/src/shapes/Image.d.ts +2 -3
  70. package/types/src/shapes/Shape.d.ts +0 -2
  71. package/types/src/shapes/sceneSort.d.ts +83 -8
  72. package/types/src/shapes/shapeConfig.d.ts +7 -0
  73. package/types/src/utils/D3plusConfig.d.ts +59 -14
  74. package/umd/d3plus-core.full.js +1911 -640
  75. package/umd/d3plus-core.full.js.map +1 -1
  76. package/umd/d3plus-core.full.min.js +1192 -942
  77. package/umd/d3plus-core.js +585 -239
  78. package/umd/d3plus-core.js.map +1 -1
  79. package/umd/d3plus-core.min.js +495 -367
@@ -28,7 +28,7 @@ import { merge } from "d3-array";
28
28
  ];
29
29
  return id;
30
30
  })).length;
31
- var inverted = this.schema.legendFilterInvert.bind(this)();
31
+ var inverted = this.schema.legendFilterInvert.bind(this)(this);
32
32
  if (inverted) {
33
33
  if (event.shiftKey) {
34
34
  if (hiddenIndex < 0 && !this._solo.length) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/events/click.legend.ts"],"sourcesContent":["import {merge} from \"d3-array\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type Viz from \"../viz/Viz.js\";\n\n/**\n @module clickLegend\n On click event for all legend shapes in a Viz.\n @private\n*/\nexport default function (\n this: Viz,\n d: DataPoint,\n i: number,\n x: DataPoint,\n event: MouseEvent,\n): void {\n this._select.style(\"cursor\", \"auto\");\n if (this.schema.tooltip(d, i)) this._tooltipClass.data([]).render();\n\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n const hiddenIndex = this._hidden.indexOf(id[0]);\n const soloIndex = this._solo.indexOf(id[0]);\n const dataLength = merge(\n this._legendClass.data().map((d: DataPoint, i: number) => {\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n return id;\n }),\n ).length;\n\n const inverted = this.schema.legendFilterInvert.bind(this)();\n\n if (inverted) {\n if (event.shiftKey) {\n if (hiddenIndex < 0 && !this._solo.length) {\n this._hidden = this._hidden.concat(id);\n if (soloIndex >= 0) this._solo = [];\n if (this._hidden.length === dataLength) this._hidden = [];\n this.render();\n } else if (soloIndex >= 0) {\n this._solo = [];\n this._hidden = [];\n this.render();\n }\n } else {\n if (soloIndex < 0 && this._hidden.length < dataLength - 1) {\n this._solo = id;\n this._hidden = [];\n } else {\n this._solo = [];\n this._hidden = [];\n }\n this.render();\n }\n } else {\n if (event.shiftKey && soloIndex < 0) {\n this._solo = id;\n this._hidden = [];\n this.render();\n } else if (!event.shiftKey) {\n if (hiddenIndex >= 0) {\n this._hidden.splice(hiddenIndex, id.length);\n } else if (soloIndex >= 0) {\n this._solo = [];\n this._hidden = [];\n } else if (this._solo.length && soloIndex < 0) {\n this._solo = this._solo.concat(id);\n if (this._solo.length === dataLength) this._solo = [];\n } else {\n this._hidden = this._hidden.concat(id);\n if (this._hidden.length === dataLength) this._hidden = [];\n }\n this.render();\n }\n }\n}\n"],"names":["merge","d","i","x","event","_select","style","schema","tooltip","_tooltipClass","data","render","id","_id","Array","hiddenIndex","_hidden","indexOf","soloIndex","_solo","dataLength","_legendClass","map","length","inverted","legendFilterInvert","bind","shiftKey","concat","splice"],"mappings":";;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAI/B;;;;AAIA,GACA,eAAe,SAEbC,CAAY,EACZC,CAAS,EACTC,CAAY,EACZC,KAAiB;;IAEjB,IAAI,CAACC,OAAO,CAACC,KAAK,CAAC,UAAU;IAC7B,IAAI,IAAI,CAACC,MAAM,CAACC,OAAO,CAACP,GAAGC,IAAI,IAAI,CAACO,aAAa,CAACC,IAAI,CAAC,EAAE,EAAEC,MAAM;IAEjE,IAAIC,KAAK,IAAI,CAACC,GAAG,CAACZ,GAAGC;IACrB,IAAI,CAAEU,AAAE,YAAFA,IAAcE,QAAQF,KAAK;QAACA;KAAG;IACrC,IAAMG,cAAc,IAAI,CAACC,OAAO,CAACC,OAAO,CAACL,EAAE,CAAC,EAAE;IAC9C,IAAMM,YAAY,IAAI,CAACC,KAAK,CAACF,OAAO,CAACL,EAAE,CAAC,EAAE;IAC1C,IAAMQ,aAAapB,MACjB,IAAI,CAACqB,YAAY,CAACX,IAAI,GAAGY,GAAG,CAAC,SAACrB,GAAcC;QAC1C,IAAIU,KAA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,aAAaH,GAAGW,MAAM;YAC5C,OAAO,IAAIL,aAAa,GAAG;gBACzB,IAAI,CAACC,KAAK,GAAG,EAAE;gBACf,IAAI,CAACH,OAAO,GAAG,EAAE;YACnB,OAAO,IAAI,IAAI,CAACG,KAAK,CAACI,MAAM,IAAIL,YAAY,GAAG;gBAC7C,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACS,MAAM,CAAChB;gBAC/B,IAAI,IAAI,CAACO,KAAK,CAACI,MAAM,KAAKH,YAAY,IAAI,CAACD,KAAK,GAAG,EAAE;YACvD,OAAO;gBACL,IAAI,CAACH,OAAO,GAAG,IAAI,CAACA,OAAO,CAACY,MAAM,CAAChB;gBACnC,IAAI,IAAI,CAACI,OAAO,CAACO,MAAM,KAAKH,YAAY,IAAI,CAACJ,OAAO,GAAG,EAAE;YAC3D;YACA,IAAI,CAACL,MAAM;QACb;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/charts/events/click.legend.ts"],"sourcesContent":["import {merge} from \"d3-array\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type Viz from \"../viz/Viz.js\";\n\n/**\n @module clickLegend\n On click event for all legend shapes in a Viz.\n @private\n*/\nexport default function (\n this: Viz,\n d: DataPoint,\n i: number,\n x: DataPoint,\n event: MouseEvent,\n): void {\n this._select.style(\"cursor\", \"auto\");\n if (this.schema.tooltip(d, i)) this._tooltipClass.data([]).render();\n\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n const hiddenIndex = this._hidden.indexOf(id[0]);\n const soloIndex = this._solo.indexOf(id[0]);\n const dataLength = merge(\n this._legendClass.data().map((d: DataPoint, i: number) => {\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n return id;\n }),\n ).length;\n\n const inverted = this.schema.legendFilterInvert.bind(this)(this);\n\n if (inverted) {\n if (event.shiftKey) {\n if (hiddenIndex < 0 && !this._solo.length) {\n this._hidden = this._hidden.concat(id);\n if (soloIndex >= 0) this._solo = [];\n if (this._hidden.length === dataLength) this._hidden = [];\n this.render();\n } else if (soloIndex >= 0) {\n this._solo = [];\n this._hidden = [];\n this.render();\n }\n } else {\n if (soloIndex < 0 && this._hidden.length < dataLength - 1) {\n this._solo = id;\n this._hidden = [];\n } else {\n this._solo = [];\n this._hidden = [];\n }\n this.render();\n }\n } else {\n if (event.shiftKey && soloIndex < 0) {\n this._solo = id;\n this._hidden = [];\n this.render();\n } else if (!event.shiftKey) {\n if (hiddenIndex >= 0) {\n this._hidden.splice(hiddenIndex, id.length);\n } else if (soloIndex >= 0) {\n this._solo = [];\n this._hidden = [];\n } else if (this._solo.length && soloIndex < 0) {\n this._solo = this._solo.concat(id);\n if (this._solo.length === dataLength) this._solo = [];\n } else {\n this._hidden = this._hidden.concat(id);\n if (this._hidden.length === dataLength) this._hidden = [];\n }\n this.render();\n }\n }\n}\n"],"names":["merge","d","i","x","event","_select","style","schema","tooltip","_tooltipClass","data","render","id","_id","Array","hiddenIndex","_hidden","indexOf","soloIndex","_solo","dataLength","_legendClass","map","length","inverted","legendFilterInvert","bind","shiftKey","concat","splice"],"mappings":";;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAI/B;;;;AAIA,GACA,eAAe,SAEbC,CAAY,EACZC,CAAS,EACTC,CAAY,EACZC,KAAiB;;IAEjB,IAAI,CAACC,OAAO,CAACC,KAAK,CAAC,UAAU;IAC7B,IAAI,IAAI,CAACC,MAAM,CAACC,OAAO,CAACP,GAAGC,IAAI,IAAI,CAACO,aAAa,CAACC,IAAI,CAAC,EAAE,EAAEC,MAAM;IAEjE,IAAIC,KAAK,IAAI,CAACC,GAAG,CAACZ,GAAGC;IACrB,IAAI,CAAEU,AAAE,YAAFA,IAAcE,QAAQF,KAAK;QAACA;KAAG;IACrC,IAAMG,cAAc,IAAI,CAACC,OAAO,CAACC,OAAO,CAACL,EAAE,CAAC,EAAE;IAC9C,IAAMM,YAAY,IAAI,CAACC,KAAK,CAACF,OAAO,CAACL,EAAE,CAAC,EAA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CAACL,MAAM;QACb,OAAO,IAAI,CAACP,MAAMuB,QAAQ,EAAE;YAC1B,IAAIZ,eAAe,GAAG;gBACpB,IAAI,CAACC,OAAO,CAACa,MAAM,CAACd,aAAaH,GAAGW,MAAM;YAC5C,OAAO,IAAIL,aAAa,GAAG;gBACzB,IAAI,CAACC,KAAK,GAAG,EAAE;gBACf,IAAI,CAACH,OAAO,GAAG,EAAE;YACnB,OAAO,IAAI,IAAI,CAACG,KAAK,CAACI,MAAM,IAAIL,YAAY,GAAG;gBAC7C,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACS,MAAM,CAAChB;gBAC/B,IAAI,IAAI,CAACO,KAAK,CAACI,MAAM,KAAKH,YAAY,IAAI,CAACD,KAAK,GAAG,EAAE;YACvD,OAAO;gBACL,IAAI,CAACH,OAAO,GAAG,IAAI,CAACA,OAAO,CAACY,MAAM,CAAChB;gBACnC,IAAI,IAAI,CAACI,OAAO,CAACO,MAAM,KAAKH,YAAY,IAAI,CAACJ,OAAO,GAAG,EAAE;YAC3D;YACA,IAAI,CAACL,MAAM;QACb;IACF;AACF"}
@@ -53,7 +53,7 @@ import { configPrep } from "../../utils/index.js";
53
53
  var hasDeeperLevel = this._drawDepth < this.schema.groupBy.length - 1;
54
54
  // only show the hand cursor when the shape has a click event
55
55
  this._select.style("cursor", hasUserClick || hasDefaultClick && hasDeeperLevel ? "pointer" : "auto");
56
- var invertedBehavior = this.schema.legendFilterInvert.bind(this)();
56
+ var invertedBehavior = this.schema.legendFilterInvert.bind(this)(this);
57
57
  var solo = this._solo.includes(id);
58
58
  var hidden = this._hidden.includes(id);
59
59
  this._tooltipClass.data([
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/events/mousemove.legend.ts"],"sourcesContent":["import {merge} from \"d3-array\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport clickLegend from \"./click.legend.js\";\nimport {legendLabel} from \"../features/legendLabel.js\";\nimport {configPrep} from \"../../utils/index.js\";\nimport type {VizContext} from \"../../utils/configPrep.js\";\nimport type Viz from \"../viz/Viz.js\";\n\n/**\n @module mouseMoveLegend\n Tooltip logic for a specified data point.\n @param config Optional configuration methods for the Tooltip class.\n @private\n*/\nexport default function (\n this: Viz,\n d: DataPoint,\n i: number,\n x: DataPoint,\n event: MouseEvent & TouchEvent,\n): void {\n const position = event.touches\n ? [event.touches[0].clientX, event.touches[0].clientY]\n : [event.clientX, event.clientY];\n const dataLength = merge(\n this._legendClass.data().map((d: DataPoint, i: number) => {\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n return id;\n }),\n ).length;\n\n if (d && this.schema.tooltip(d, i)) {\n let id = this._id(d, i);\n if (id instanceof Array) id = id[0];\n\n const t = this.schema.translate;\n const defaultClick = clickLegend.bind(this).toString();\n\n // does the legend have any user-defined click events?\n const hasUserClick = Object.keys(this.schema.on).some(\n (e: string) =>\n // all valid click event keys,\n [\"click\", \"click.legend\"].includes(e) &&\n // truthy values (no nulls),\n this.schema.on[e] &&\n // and it is not our default click.legend function\n this.schema.on[e].toString() !== defaultClick,\n );\n\n // does the legend still have our default \"click.legend\" event?\n // (if the user only sets \"click\", both functions will fire)\n const hasDefaultClick =\n this.schema.on[\"click.legend\"] &&\n this.schema.on[\"click.legend\"].toString() === defaultClick;\n\n // can the viz show deeper data?\n const hasDeeperLevel = this._drawDepth < this.schema.groupBy.length - 1;\n\n // only show the hand cursor when the shape has a click event\n this._select.style(\n \"cursor\",\n hasUserClick || (hasDefaultClick && hasDeeperLevel) ? \"pointer\" : \"auto\",\n );\n\n const invertedBehavior = this.schema.legendFilterInvert.bind(this)();\n\n const solo = this._solo.includes(id);\n const hidden = this._hidden.includes(id);\n\n this._tooltipClass\n .data([x || d])\n .footer(\n hasDefaultClick\n ? invertedBehavior\n ? (this._solo.length && !solo) || hidden\n ? t(\"Click to Highlight\")\n : (this._solo.length === 1 && solo) ||\n this._hidden.length === dataLength - 1\n ? t(\"Click to Show All\")\n : `${t(\"Click to Highlight\")}<br />${t(\"Shift+Click to Hide\")}`\n : (this._solo.length && !solo) || hidden\n ? `${t(\"Click to Show\")}<br />${t(\"Shift+Click to Highlight\")}`\n : (this._solo.length === 1 && solo) ||\n this._hidden.length === dataLength - 1\n ? t(\"Click to Show All\")\n : `${t(\"Click to Hide\")}<br />${t(\"Shift+Click to Highlight\")}`\n : false,\n )\n .title(\n this.schema.legendConfig.label\n ? this._legendClass.label()\n : legendLabel.bind(this),\n )\n .position(position)\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.tooltipConfig))\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.legendTooltip))\n .render();\n }\n}\n"],"names":["merge","clickLegend","legendLabel","configPrep","d","i","x","event","position","touches","clientX","clientY","dataLength","_legendClass","data","map","id","_id","Array","length","schema","tooltip","t","translate","defaultClick","bind","toString","hasUserClick","Object","keys","on","some","e","includes","hasDefaultClick","hasDeeperLevel","_drawDepth","groupBy","_select","style","invertedBehavior","legendFilterInvert","solo","_solo","hidden","_hidden","_tooltipClass","footer","title","legendConfig","label","config","tooltipConfig","legendTooltip","render"],"mappings":";;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAE/B,OAAOC,iBAAiB,oBAAoB;AAC5C,SAAQC,WAAW,QAAO,6BAA6B;AACvD,SAAQC,UAAU,QAAO,uBAAuB;AAIhD;;;;;AAKA,GACA,eAAe,SAEbC,CAAY,EACZC,CAAS,EACTC,CAAY,EACZC,KAA8B;;IAE9B,IAAMC,WAAWD,MAAME,OAAO,GAC1B;QAACF,MAAME,OAAO,CAAC,EAAE,CAACC,OAAO;QAAEH,MAAME,OAAO,CAAC,EAAE,CAACE,OAAO;KAAC,GACpD;QAACJ,MAAMG,OAAO;QAAEH,MAAMI,OAAO;KAAC;IAClC,IAAMC,aAAaZ,MACjB,IAAI,CAACa,YAAY,CAACC,IAAI,GAAGC,GAAG,CAAC,SAACX,GAAcC;QAC1C,IAAIW,KAAK,MAAKC,GAAG,CAACb,GAAGC;QACrB,IAA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4B,SAAS,IAAI,CAACC,OAAO,CAACZ,QAAQ,CAACjB;QAErC,IAAI,CAAC8B,aAAa,CACfhC,IAAI,CAAC;YAACR,KAAKF;SAAE,EACb2C,MAAM,CACLb,kBACIM,mBACE,AAAC,IAAI,CAACG,KAAK,CAACxB,MAAM,IAAI,CAACuB,QAASE,SAC9BtB,EAAE,wBACF,AAAC,IAAI,CAACqB,KAAK,CAACxB,MAAM,KAAK,KAAKuB,QAC1B,IAAI,CAACG,OAAO,CAAC1B,MAAM,KAAKP,aAAa,IACrCU,EAAE,uBACF,AAAC,GAAkCA,OAAhCA,EAAE,uBAAsB,UAAiC,OAAzBA,EAAE,0BACzC,AAAC,IAAI,CAACqB,KAAK,CAACxB,MAAM,IAAI,CAACuB,QAASE,SAC9B,AAAC,GAA6BtB,OAA3BA,EAAE,kBAAiB,UAAsC,OAA9BA,EAAE,+BAChC,AAAC,IAAI,CAACqB,KAAK,CAACxB,MAAM,KAAK,KAAKuB,QAC1B,IAAI,CAACG,OAAO,CAAC1B,MAAM,KAAKP,aAAa,IACrCU,EAAE,uBACF,AAAC,GAA6BA,OAA3BA,EAAE,kBAAiB,UAAsC,OAA9BA,EAAE,+BACtC,OAEL0B,KAAK,CACJ,IAAI,CAAC5B,MAAM,CAAC6B,YAAY,CAACC,KAAK,GAC1B,IAAI,CAACrC,YAAY,CAACqC,KAAK,KACvBhD,YAAYuB,IAAI,CAAC,IAAI,GAE1BjB,QAAQ,CAACA,UACT2C,MAAM,CAAChD,WAAWsB,IAAI,CAAC,IAAI,EAA2B,IAAI,CAACL,MAAM,CAACgC,aAAa,GAC/ED,MAAM,CAAChD,WAAWsB,IAAI,CAAC,IAAI,EAA2B,IAAI,CAACL,MAAM,CAACiC,aAAa,GAC/EC,MAAM;IACX;AACF"}
1
+ {"version":3,"sources":["../../../../src/charts/events/mousemove.legend.ts"],"sourcesContent":["import {merge} from \"d3-array\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport clickLegend from \"./click.legend.js\";\nimport {legendLabel} from \"../features/legendLabel.js\";\nimport {configPrep} from \"../../utils/index.js\";\nimport type {VizContext} from \"../../utils/configPrep.js\";\nimport type Viz from \"../viz/Viz.js\";\n\n/**\n @module mouseMoveLegend\n Tooltip logic for a specified data point.\n @param config Optional configuration methods for the Tooltip class.\n @private\n*/\nexport default function (\n this: Viz,\n d: DataPoint,\n i: number,\n x: DataPoint,\n event: MouseEvent & TouchEvent,\n): void {\n const position = event.touches\n ? [event.touches[0].clientX, event.touches[0].clientY]\n : [event.clientX, event.clientY];\n const dataLength = merge(\n this._legendClass.data().map((d: DataPoint, i: number) => {\n let id = this._id(d, i);\n if (!(id instanceof Array)) id = [id];\n return id;\n }),\n ).length;\n\n if (d && this.schema.tooltip(d, i)) {\n let id = this._id(d, i);\n if (id instanceof Array) id = id[0];\n\n const t = this.schema.translate;\n const defaultClick = clickLegend.bind(this).toString();\n\n // does the legend have any user-defined click events?\n const hasUserClick = Object.keys(this.schema.on).some(\n (e: string) =>\n // all valid click event keys,\n [\"click\", \"click.legend\"].includes(e) &&\n // truthy values (no nulls),\n this.schema.on[e] &&\n // and it is not our default click.legend function\n this.schema.on[e].toString() !== defaultClick,\n );\n\n // does the legend still have our default \"click.legend\" event?\n // (if the user only sets \"click\", both functions will fire)\n const hasDefaultClick =\n this.schema.on[\"click.legend\"] &&\n this.schema.on[\"click.legend\"].toString() === defaultClick;\n\n // can the viz show deeper data?\n const hasDeeperLevel = this._drawDepth < this.schema.groupBy.length - 1;\n\n // only show the hand cursor when the shape has a click event\n this._select.style(\n \"cursor\",\n hasUserClick || (hasDefaultClick && hasDeeperLevel) ? \"pointer\" : \"auto\",\n );\n\n const invertedBehavior = this.schema.legendFilterInvert.bind(this)(this);\n\n const solo = this._solo.includes(id);\n const hidden = this._hidden.includes(id);\n\n this._tooltipClass\n .data([x || d])\n .footer(\n hasDefaultClick\n ? invertedBehavior\n ? (this._solo.length && !solo) || hidden\n ? t(\"Click to Highlight\")\n : (this._solo.length === 1 && solo) ||\n this._hidden.length === dataLength - 1\n ? t(\"Click to Show All\")\n : `${t(\"Click to Highlight\")}<br />${t(\"Shift+Click to Hide\")}`\n : (this._solo.length && !solo) || hidden\n ? `${t(\"Click to Show\")}<br />${t(\"Shift+Click to Highlight\")}`\n : (this._solo.length === 1 && solo) ||\n this._hidden.length === dataLength - 1\n ? t(\"Click to Show All\")\n : `${t(\"Click to Hide\")}<br />${t(\"Shift+Click to Highlight\")}`\n : false,\n )\n .title(\n this.schema.legendConfig.label\n ? this._legendClass.label()\n : legendLabel.bind(this),\n )\n .position(position)\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.tooltipConfig))\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.legendTooltip))\n .render();\n }\n}\n"],"names":["merge","clickLegend","legendLabel","configPrep","d","i","x","event","position","touches","clientX","clientY","dataLength","_legendClass","data","map","id","_id","Array","length","schema","tooltip","t","translate","defaultClick","bind","toString","hasUserClick","Object","keys","on","some","e","includes","hasDefaultClick","hasDeeperLevel","_drawDepth","groupBy","_select","style","invertedBehavior","legendFilterInvert","solo","_solo","hidden","_hidden","_tooltipClass","footer","title","legendConfig","label","config","tooltipConfig","legendTooltip","render"],"mappings":";;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAE/B,OAAOC,iBAAiB,oBAAoB;AAC5C,SAAQC,WAAW,QAAO,6BAA6B;AACvD,SAAQC,UAAU,QAAO,uBAAuB;AAIhD;;;;;AAKA,GACA,eAAe,SAEbC,CAAY,EACZC,CAAS,EACTC,CAAY,EACZC,KAA8B;;IAE9B,IAAMC,WAAWD,MAAME,OAAO,GAC1B;QAACF,MAAME,OAAO,CAAC,EAAE,CAACC,OAAO;QAAEH,MAAME,OAAO,CAAC,EAAE,CAACE,OAAO;KAAC,GACpD;QAACJ,MAAMG,OAAO;QAAEH,MAAMI,OAAO;KAAC;IAClC,IAAMC,aAAaZ,MACjB,IAAI,CAACa,YAAY,CAACC,IAAI,GAAGC,GAAG,CAAC,SAACX,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204
204
  margin: {}
205
205
  };
206
- var usesPadding = viz.schema[opts.paddingMethod]();
206
+ var usesPadding = viz.schema[opts.paddingMethod](viz);
207
207
  var padding = usesPadding ? viz._padding : {
208
208
  top: 0,
209
209
  right: 0,
@@ -422,7 +422,7 @@ var VALID_POSITIONS = new Set([
422
422
  return date(d);
423
423
  }) : [];
424
424
  timelinePossible = timelinePossible && ticks.length > 1;
425
- var padding = viz.schema.timelinePadding() ? viz._padding : {
425
+ var padding = viz.schema.timelinePadding(viz) ? viz._padding : {
426
426
  top: 0,
427
427
  right: 0,
428
428
  bottom: 0,
@@ -518,7 +518,7 @@ var VALID_POSITIONS = new Set([
518
518
  "bottom"
519
519
  ].includes(position);
520
520
  var showColorScale = viz.schema.colorScale && position;
521
- var padding = viz.schema.colorScalePadding() ? viz._padding : {
521
+ var padding = viz.schema.colorScalePadding(viz) ? viz._padding : {
522
522
  top: 0,
523
523
  right: 0,
524
524
  bottom: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/features/features.ts"],"sourcesContent":["/**\n FeatureModule + layout engine. The chart-level features (title,\n subtitle, total, legend, timeline, colorScale, back) are\n `FeatureModule` values composed by `runLayout`, which performs\n **explicit margin negotiation** — each feature returns a `MarginClaim`\n + optional `panel` scene node + optional declarative `vizUpdate`\n writes, and the engine accumulates margins across features in order.\n\n Every Plot-family + chart-shell feature here is wired into\n `vizDrawPure` via `runLayout(ctx, [...features])`.\n*/\nimport {extent, min, rollup, sum} from \"d3-array\";\nimport {select} from \"d3-selection\";\n\nimport {merge, unique} from \"@d3plus/data\";\nimport type {DataPoint, MergedDataPoint} from \"@d3plus/data\";\nimport {date, elem, stylize} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */\nexport interface MarginClaim {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n}\n\n/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */\nexport interface FeatureLayout {\n panel: SceneNode | null;\n margin: MarginClaim;\n /**\n v4 purity: features that need to publish CROSS-FEATURE state — a\n write that a DIFFERENT feature or downstream stage will read — return\n those writes here as declarative key→value pairs. `runLayout`\n applies them to viz after the layout call so the next feature in\n the chain sees them.\n\n Key convention: keys are auto-prefixed with `_` to match viz's\n internal field convention. Return `{drawDepth: 2}` to write\n `viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)\n pass through unchanged for the rare case where the engine\n shouldn't prepend. This rule exists because a leading underscore\n is easy to forget and writing `viz.drawDepth` (no underscore) is\n almost never what callers want.\n\n Intra-feature local writes (a feature setting state that its OWN\n component instance reads inside the same `layout()` body) are\n legitimate direct mutations on viz — `vizUpdate` would defer the\n write past the local read. legendFeature's `_legendDepth` is an\n example of an intra-feature local; timelineFeature's\n `_timelineSelection` similarly mutates from its event handler\n context. The contract is about CROSS-feature mutation, not all\n mutation.\n */\n vizUpdate?: Record<string, unknown>;\n}\n\n/**\n @interface FeatureModule\n A chart-level component (title, subtitle, total, legend, timeline,\n colorScale, back, attribution) expressed as a pure value. Each feature:\n - contributes config keys to the chart's schema (`configFields`),\n - optionally derives extra fields onto the pipeline context (`derive`),\n - optionally claims a margin region + emits its panel scene (`layout`),\n - optionally registers event reducers (`events`).\n*/\nexport interface FeatureModule {\n name: string;\n /** Keys the chart's config inherits from this feature (used by E4 fluent gen). */\n configFields?: string[];\n /** Extra derivations to add into the pipeline context. */\n derive?: (ctx: VizContext) => Partial<VizContext>;\n /**\n Pure layout: read the (possibly updated-by-earlier-features) context and\n return the panel scene + margin this feature claims. The layoutEngine\n threads the margin claims through `ctx.layoutMargin` so a feature can\n read what earlier features already took.\n */\n layout?: (\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n ) => FeatureLayout;\n /**\n Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a\n user interaction occurs on a node tagged with this feature's name.\n */\n events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;\n}\n\n/**\n Result of running a list of features through the layout engine.\n*/\nexport interface LayoutResult {\n /** Panel nodes in feature order, ready to compose into the scene root. */\n panels: SceneNode[];\n /** Final margin after every feature claimed its space. */\n margin: Required<MarginClaim>;\n}\n\n/**\n The allowed values for `legendPosition` and `colorScalePosition`.\n `false` means \"hidden\" (the feature still runs to tear down DOM); the\n four strings are the four sides.\n*/\nexport type PanelPosition = false | \"top\" | \"right\" | \"bottom\" | \"left\";\n\nconst VALID_POSITIONS: ReadonlySet<PanelPosition | string> = new Set([\n false as unknown as string,\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\n/**\n Canonical sanitizer for `legendPosition` / `colorScalePosition`.\n Falls back to `\"bottom\"` when the user-supplied accessor returns\n something outside the allowed set. Single source of truth — used by\n `vizDrawPure` (for sanitized ctx publication) and by `legendFeature`\n + `colorScaleFeature` (for their internal positioning math).\n*/\nexport function sanitizePosition(raw: unknown): PanelPosition {\n return (VALID_POSITIONS.has(raw as string) ? raw : \"bottom\") as PanelPosition;\n}\n\n/**\n Runs each feature's `layout` in order, accumulating margin claims so that\n later features see the space already taken by earlier ones. The order of\n `features` is the layout order — this is how implicit `this._margin +=`\n side effects become *explicit* data flow.\n\n Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,\n `drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,\n `drawTimeline`) should be ported verbatim as the default sequence — port\n the math first, then improve.\n*/\nexport function runLayout(\n ctx: VizContext,\n features: FeatureModule[],\n baseMargin: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0},\n): LayoutResult {\n // `claims` is this call's accumulated margin (the returned delta).\n // `layoutMargin` handed to each feature is the running TOTAL —\n // `baseMargin` (margin already taken by prior runLayout calls in the same\n // draw) plus the claims taken so far in this call — so a feature reads\n // the true current margin without touching viz._margin.\n const claims: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0};\n const panels: SceneNode[] = [];\n for (const f of features) {\n if (!f.layout) continue;\n const layoutMargin: Required<MarginClaim> = {\n top: baseMargin.top + claims.top,\n right: baseMargin.right + claims.right,\n bottom: baseMargin.bottom + claims.bottom,\n left: baseMargin.left + claims.left,\n };\n const result = f.layout({...ctx, layoutMargin});\n const {panel, margin: claim, vizUpdate} = result;\n if (panel) panels.push(panel);\n claims.top += claim.top ?? 0;\n claims.right += claim.right ?? 0;\n claims.bottom += claim.bottom ?? 0;\n claims.left += claim.left ?? 0;\n // v4 purity: features publish cross-feature viz writes declaratively\n // via `vizUpdate`. The engine applies them — features don't mutate\n // viz directly from layout(). Skips own component-instance config\n // calls (those are local mutation, not cross-feature). Use\n // `Object.keys` (not `for...in`) so inherited enumerable properties\n // on a class-instance vizUpdate don't leak onto viz.\n //\n // Key convention: keys are auto-prefixed with `_` to land on the\n // viz's internal field convention (`viz._drawDepth`, `viz._legendDepth`).\n // Features should return UNPREFIXED keys (`{drawDepth: 2}`); the\n // engine normalizes — so feature authors can't accidentally write\n // `viz.drawDepth` (a different non-underscore property) instead of\n // `viz._drawDepth`. Keys that already start with `_` are passed\n // through unchanged so future explicit-internal writes still work.\n if (vizUpdate && ctx.viz) {\n const target = ctx.viz as Record<string, unknown>;\n for (const k of Object.keys(vizUpdate)) {\n const key = k.startsWith(\"_\") ? k : `_${k}`;\n target[key] = vizUpdate[k];\n }\n }\n }\n return {panels, margin: claims};\n}\n\n/* --------------------------- text-block features --------------------------- */\n\n/**\n Shared layout logic for any \"single line of text claiming margin.top\" feature\n (title, subtitle, total). Each feature passes the viz fields that source its\n text + TextBox + config; the helper computes the panel + margin claim using\n the TextBox's pure `_textData()` (no DOM).\n*/\nfunction textBlockLayout(\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n opts: {\n panelKey: string;\n getText: (viz: VizInstance) => string | false;\n textClassKey: string; // e.g. \"_titleClass\"\n configKey: string; // schema key, e.g. \"titleConfig\"\n paddingMethod: string; // schema key, e.g. \"titlePadding\"\n },\n): FeatureLayout {\n const {viz, layoutMargin} = ctx;\n const text = opts.getText(viz);\n if (!text) return {panel: null, margin: {}};\n\n const usesPadding = (viz.schema[opts.paddingMethod] as () => boolean)();\n const padding = usesPadding\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n const width =\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n\n const textClass = viz[opts.textClassKey];\n textClass\n .data([{text}])\n .locale(viz.schema.locale)\n .width(width)\n .config(viz.schema[opts.configKey]);\n const boxes = textClass._textData() as Array<{\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n }>;\n if (!boxes.length) return {panel: null, margin: {}};\n const box = boxes[0];\n\n const x = layoutMargin.left + padding.left;\n const y = layoutMargin.top;\n const lineHeight = box.lH;\n const blockPadding = (viz.schema[opts.configKey]?.padding as number) ?? 0;\n const height = box.lines.length * lineHeight + blockPadding * 2;\n\n const lines = box.lines.map((str: string, i: number) => ({\n text: str,\n x:\n box.tA === \"middle\"\n ? width / 2\n : box.tA === \"end\"\n ? width\n : 0,\n y: (i + 1) * lineHeight - (lineHeight - box.fS),\n width: box.widths?.[i] ?? 0,\n }));\n\n const panel: SceneNode = {\n type: \"text\",\n key: opts.panelKey,\n x: 0,\n y: 0,\n lines,\n font: {\n family: box.fF,\n size: box.fS,\n anchor:\n box.tA === \"middle\" || box.tA === \"end\" || box.tA === \"start\"\n ? (box.tA as \"middle\" | \"end\" | \"start\")\n : \"start\",\n baseline: \"alphabetic\",\n },\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x, y},\n };\n\n return {panel, margin: {top: height}};\n}\n\n/**\n Title as a FeatureModule. Uses `_titleClass._textData()` for height\n (pure compute, no DOM) and returns the margin claim explicitly.\n*/\nexport const titleFeature: FeatureModule = {\n name: \"title\",\n configFields: [\"title\", \"titleConfig\", \"titlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-title\",\n getText: viz => (viz.schema.title ? viz.schema.title(viz._filteredData || []) : false),\n textClassKey: \"_titleClass\",\n configKey: \"titleConfig\",\n paddingMethod: \"titlePadding\",\n }),\n};\n\n/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */\nexport const subtitleFeature: FeatureModule = {\n name: \"subtitle\",\n configFields: [\"subtitle\", \"subtitleConfig\", \"subtitlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-subtitle\",\n getText: viz => (viz.schema.subtitle ? viz.schema.subtitle(viz._filteredData || []) : false),\n textClassKey: \"_subtitleClass\",\n configKey: \"subtitleConfig\",\n paddingMethod: \"subtitlePadding\",\n }),\n};\n\n/**\n Converts `drawBack.ts` to a FeatureModule. Visible only when there are\n drill-down history entries; emits a \"← Back\" TextNode at the chart's\n top-left and claims its line height + padding × 2 from `margin.top`.\n*/\nexport const backFeature: FeatureModule = {\n name: \"back\",\n configFields: [\"backConfig\"],\n layout: ({viz, layoutMargin}) => {\n if (!viz._history || !viz._history.length) return {panel: null, margin: {}};\n\n const text = `← ${viz.schema.translate(\"Back\")}`;\n viz._backClass.data([{text, x: 0, y: 0}]).config(viz.schema.backConfig);\n const boxes = viz._backClass._textData() as Array<{\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n }>;\n // _backClass might have a fontSize/padding only style (no wrapping data),\n // in which case _textData may be empty; fall back to direct accessor reads\n // for the margin claim to match drawBack's math precisely.\n const fontSize = viz._backClass.fontSize()();\n const padding = viz._backClass.padding()();\n const height = fontSize + padding * 2;\n\n if (!boxes.length) {\n return {panel: null, margin: {top: height}};\n }\n const box = boxes[0];\n\n const panel: SceneNode = {\n type: \"text\",\n key: \"viz-back\",\n x: 0,\n y: 0,\n lines: box.lines.map((str, i) => ({\n text: str,\n x: 0,\n y: (i + 1) * box.lH - (box.lH - box.fS),\n width: box.widths?.[i] ?? 0,\n })),\n font: {family: box.fF, size: box.fS, baseline: \"alphabetic\"},\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x: layoutMargin.left, y: layoutMargin.top},\n };\n return {panel, margin: {top: height}};\n },\n};\n\n/* -------------------------------- Legend --------------------------------- */\n\nexport {legendFeature} from \"./featuresLegend.js\";\n\n/* -------------------------------- Timeline ------------------------------- */\n\n/**\n Helper mirroring drawTimeline's `setTimeFilter`. Triggers a re-render when\n the brush selection changes — kept here so the feature owns its event flow.\n*/\nfunction setTimeFilter(viz: VizInstance, s: Date | Date[] | number[]): void {\n if (!Array.isArray(s)) s = [s, s] as Date[];\n if (JSON.stringify(s) !== JSON.stringify(viz._timelineSelection)) {\n viz._timelineSelection = s;\n const nums = (s as Array<Date | number>).map(Number) as number[];\n viz\n .timeFilter!((d: DataPoint) => {\n const ms = (date(viz.schema.time(d)) as Date).getTime();\n return ms >= nums[0] && ms <= nums[1];\n })\n .render!();\n }\n}\n\n/**\n Converts `drawTimeline.ts` to a FeatureModule.\n\n Visible only when `_time` is set, `_timeline` is truthy, and there is more\n than one distinct tick. Renders the chart's `_timelineClass` Timeline\n instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's\n components collection) and claims `margin.bottom` from its outerBounds.\n*/\nexport const timelineFeature: FeatureModule = {\n name: \"timeline\",\n configFields: [\"timeline\", \"timelineConfig\", \"timelinePadding\"],\n layout: ({viz, layoutMargin}) => {\n let timelinePossible = viz.schema.time && viz.schema.timeline;\n const ticks = (\n timelinePossible\n ? unique(viz._data.map(viz.schema.time)).map(\n (d: unknown) => date(d as string | number),\n )\n : []\n ) as Date[];\n timelinePossible = timelinePossible && ticks.length > 1;\n const padding = viz.schema.timelinePadding()\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const transform = {\n transform: `translate(${layoutMargin.left + padding.left}, 0)`,\n };\n\n const timelineGroup = elem(\"g.d3plus-viz-timeline\", {\n condition: timelinePossible,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!timelinePossible) return {panel: null, margin: {}};\n\n const timeline = viz._timelineClass\n .renderMode(\"compute\")\n .domain(extent(ticks) as [Date, Date])\n .duration(viz.schema.duration)\n .height(viz.schema.height - layoutMargin.bottom)\n .locale(viz.schema.locale)\n .select(timelineGroup)\n .ticks(ticks.sort((a: Date, b: Date) => +a - +b))\n .width(\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right),\n );\n\n // Clamp bound = the full time range (every tick); it never goes stale\n // mid-render. Clamping to `viz._filteredData`'s extent instead collapsed a\n // freshly-committed range down to the previous selection — the release\n // snap-back (e.g. [2017,2024] clamped to a stale [2022,2022]).\n const fullExtent = extent(ticks) as [Date, Date];\n if (!viz._timelineSelection) {\n // First render only: default to the *filtered* extent, which the\n // synthesized default timeFilter pins to the latest period (see\n // vizPreDraw) — the historical default. `timelineDefault` overrides it.\n const filtered = extent(\n (viz._filteredData || [])\n .map(viz.schema.time)\n .map((d: unknown) => date(d as string | number)) as Date[],\n ) as [Date, Date];\n viz._timelineSelection =\n viz.schema.timelineDefault || (filtered[0] ? filtered : fullExtent);\n } else {\n if (viz._timelineSelection[0] < fullExtent[0])\n viz._timelineSelection[0] = fullExtent[0];\n if (viz._timelineSelection[1] > fullExtent[1])\n viz._timelineSelection[1] = fullExtent[1];\n }\n timeline.selection(viz._timelineSelection);\n\n // Repaint the scene when playback toggles without moving the selection\n // (e.g. a manual pause), so the play/pause glyph refreshes immediately.\n timeline._onPlayToggle = () => viz._scheduleSceneRepaint();\n\n const config = viz.schema.timelineConfig;\n timeline\n .config(config)\n .on(\"brush\", (s: Date[]) => {\n // Filter on \"end\", not on every brush move. Re-rendering the whole Viz\n // mid-drag re-creates the d3-brush (and starts a brush transition),\n // which fights the active gesture and can make the selection snap back\n // on release — and it re-lays-out the chart on every pixel of the drag,\n // which is costly for large data. The brush still tracks the cursor\n // live; the chart updates when the drag finishes. User `on.brush`\n // callbacks still fire for custom live behavior.\n if (config.on && config.on.brush) config.on.brush(s);\n })\n .on(\"end\", (s: Date[]) => {\n setTimeFilter(viz, s);\n if (config.on && config.on.end) config.on.end(s);\n })\n .render();\n\n return {\n panel: null,\n margin: {bottom: timeline.outerBounds().height + timeline.padding() * 2},\n };\n },\n};\n\n/* ------------------------------- ColorScale ------------------------------ */\n\n/**\n Converts `drawColorScale.ts` to a FeatureModule.\n\n Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves\n to a side. Renders the chart's `_colorScaleClass` ColorScale instance and\n claims margin along its position side.\n*/\nexport const colorScaleFeature: FeatureModule = {\n name: \"colorScale\",\n configFields: [\n \"colorScale\",\n \"colorScaleConfig\",\n \"colorScaleMaxSize\",\n \"colorScalePadding\",\n \"colorScalePosition\",\n ],\n layout: ({viz, layoutMargin}) => {\n const data = Array.from(\n rollup(\n viz._data,\n (leaves: DataPoint[]) => merge(leaves, viz.schema.aggs),\n (d: DataPoint, i: number) =>\n `${viz.schema.time ? viz.schema.time(d, i) : \"all\"}-${viz._ids(d, i).join(\"_\")}`,\n ).values(),\n );\n\n const position = sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const showColorScale = viz.schema.colorScale && position;\n const padding = viz.schema.colorScalePadding()\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const availableWidth =\n viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n const width = wide\n ? min([viz.schema.colorScaleMaxSize, availableWidth])!\n : viz.schema.width - (layoutMargin.left + layoutMargin.right);\n\n const availableHeight =\n viz.schema.height - (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top);\n const height = !wide\n ? min([viz.schema.colorScaleMaxSize, availableHeight])!\n : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);\n\n const transform = {\n opacity: position ? 1 : 0,\n transform: `translate(${\n wide\n ? layoutMargin.left + padding.left + (availableWidth - width) / 2\n : layoutMargin.left\n }, ${\n wide\n ? layoutMargin.top\n : layoutMargin.top + padding.top + (availableHeight - height) / 2\n })`,\n };\n\n const scaleGroup = elem(\"g.d3plus-viz-colorScale\", {\n condition: showColorScale && !viz.schema.colorScaleConfig.select,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!viz.schema.colorScale) return {panel: null, margin: {}};\n\n const scaleData = data.filter((d: MergedDataPoint, i: number) => {\n const c = viz.schema.colorScale(d as unknown as DataPoint, i);\n return c !== undefined && c !== null;\n });\n\n // Discrete (bucket/jenks/quantile) colorScales render their swatches via an\n // internal Legend, which composes cleanly through the Viz scene — so run\n // them in compute mode (like the legend) so the Viz's toScene owns them and\n // hover/active dimming applies. Without this they render full-mode, where\n // paintComponentScene paints a full-opacity copy that overlays and defeats\n // the dimming. The smooth-gradient variant stays full-mode: its gradient\n // fill is materialized through paintComponentScene, not the Viz scene.\n const csCfg = (viz.schema.colorScaleConfig || {}) as {\n scale?: string;\n bucketAxis?: boolean;\n };\n const csDiscrete =\n !csCfg.bucketAxis &&\n [\"buckets\", \"jenks\", \"quantile\"].includes(\n typeof csCfg.scale === \"string\" ? csCfg.scale : \"\",\n );\n\n viz._colorScaleClass\n .renderMode(csDiscrete ? \"compute\" : \"full\")\n .align(\n ({bottom: \"end\", left: \"start\", right: \"end\", top: \"start\"} as Record<string, string>)[\n position as string\n ] || \"bottom\",\n )\n .duration(viz.schema.duration)\n .data(scaleData)\n .height(height)\n .locale(viz.schema.locale)\n .orient(position)\n .select(scaleGroup)\n .value(viz.schema.colorScale)\n .width(width)\n .config(viz.schema.colorScaleConfig)\n .render();\n\n const margin: Record<string, number> = {};\n if (showColorScale) {\n const scaleBounds = viz._colorScaleClass.outerBounds();\n if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {\n // Use the colorScale's OWN padding for its margin claim — not the\n // legend's, so a custom legendPadding doesn't shift the\n // colorScale's claim when the legend is hidden. The colorScale\n // class is the source of truth.\n const csPadding =\n typeof viz._colorScaleClass.padding === \"function\"\n ? viz._colorScaleClass.padding()\n : viz._legendClass.padding();\n if (wide) margin[position] = scaleBounds.height + csPadding * 2;\n else margin[position] = scaleBounds.width + csPadding * 2;\n }\n }\n return {panel: null, margin};\n },\n};\n\n/* ------------------------------ Attribution ------------------------------ */\n\n/**\n Converts `drawAttribution.ts` to a FeatureModule.\n\n Attribution is an HTML `<div>` overlay positioned absolutely outside the SVG\n plane — it doesn't fit naturally as a SceneNode in the chart scene graph.\n Rather than encode an HTML overlay into the scene graph, this feature runs\n the DOM-creating side effect imperatively from inside `layout()`, so\n invocation is funneled through `runLayout` for consistency with the\n other features. It claims zero margin and emits no panel.\n*/\nexport const attributionFeature: FeatureModule = {\n name: \"attribution\",\n configFields: [\"attribution\", \"attributionStyle\"],\n layout: ({viz}) => {\n let attr: D3Selection = select(viz._select.node().parentNode)\n .selectAll(\"div.d3plus-attribution\")\n .data(viz.schema.attribution ? [0] : []) as unknown as D3Selection;\n\n const attrEnter = attr\n .enter()\n .append(\"div\")\n .attr(\"class\", \"d3plus-attribution\");\n\n attr.exit().remove();\n\n attr = attr\n .merge(attrEnter as never)\n .style(\"position\", \"absolute\")\n .html(viz.schema.attribution)\n .style(\"right\", `${viz._margin.right}px`)\n .style(\"bottom\", `${viz._margin.bottom}px`)\n .call(stylize as never, viz.schema.attributionStyle);\n\n return {panel: null, margin: {}};\n },\n};\n\n/**\n Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/\n subtitle: the text comes from `sum()` over the filtered data when `_total`\n is a function, or from `sum(data.map(_size))` when `_total === true`.\n*/\nexport const totalFeature: FeatureModule = {\n name: \"total\",\n configFields: [\"total\", \"totalConfig\", \"totalFormat\", \"totalPadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-total\",\n getText: viz => {\n const data = viz._filteredData || [];\n const total =\n typeof viz.schema.total === \"function\"\n ? sum(data.map(viz.schema.total))\n : viz.schema.total === true && viz._size\n ? sum(data.map(viz._size))\n : false;\n return total ? viz.schema.totalFormat(total) : false;\n },\n textClassKey: \"_totalClass\",\n configKey: \"totalConfig\",\n paddingMethod: \"totalPadding\",\n }),\n};\n"],"names":["extent","min","rollup","sum","select","merge","unique","date","elem","stylize","resolveSpec","VALID_POSITIONS","Set","sanitizePosition","raw","has","runLayout","ctx","features","baseMargin","top","right","bottom","left","claims","panels","f","claim","layout","layoutMargin","result","panel","margin","vizUpdate","push","viz","target","Object","keys","k","key","startsWith","textBlockLayout","opts","text","getText","usesPadding","schema","paddingMethod","padding","_padding","width","textClass","textClassKey","data","locale","config","configKey","boxes","_textData","length","box","x","y","lineHeight","lH","blockPadding","height","lines","map","str","i","tA","fS","widths","type","panelKey","font","family","fF","size","anchor","baseline","paint","fill","fC","opacity","fO","transform","titleFeature","name","configFields","title","_filteredData","subtitleFeature","subtitle","backFeature","_history","translate","_backClass","backConfig","fontSize","legendFeature","setTimeFilter","s","Array","isArray","JSON","stringify","_timelineSelection","nums","Number","timeFilter","d","ms","time","getTime","render","timelineFeature","timelinePossible","timeline","ticks","_data","timelinePadding","timelineGroup","condition","enter","parent","_select","duration","update","node","_timelineClass","renderMode","domain","sort","a","b","fullExtent","filtered","timelineDefault","selection","_onPlayToggle","_scheduleSceneRepaint","timelineConfig","on","brush","end","outerBounds","colorScaleFeature","from","leaves","aggs","_ids","join","values","position","colorScalePosition","bind","wide","includes","showColorScale","colorScale","colorScalePadding","availableWidth","colorScaleMaxSize","availableHeight","scaleGroup","colorScaleConfig","scaleData","filter","c","undefined","csCfg","csDiscrete","bucketAxis","scale","_colorScaleClass","align","orient","value","scaleBounds","csPadding","_legendClass","attributionFeature","attr","parentNode","selectAll","attribution","attrEnter","append","exit","remove","style","html","_margin","call","attributionStyle","totalFeature","total","_size","totalFormat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA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B9J,IAAIgK,OAAO,CAAC9K,KAAK,EAAC,OACpC4K,KAAK,CAAC,UAAU,AAAC,GAAqB,OAAnB9J,IAAIgK,OAAO,CAAC7K,MAAM,EAAC,OACtC8K,IAAI,CAAC3L,SAAkB0B,IAAIY,MAAM,CAACsJ,gBAAgB;QAErD,OAAO;YAACtK,OAAO;YAAMC,QAAQ,CAAC;QAAC;IACjC;AACF,EAAE;AAEF;;;;AAIA,GACA,OAAO,IAAMsK,eAA8B;IACzC5G,MAAM;IACNC,cAAc;QAAC;QAAS;QAAe;QAAe;KAAe;IACrE/D,QAAQX,SAARW,OAAQX;eACNyB,gBAAgBzB,KAAK;YACnB2D,UAAU;YACV/B,SAASV,SAATU,QAASV;gBACP,IAAMmB,OAAOnB,IAAI0D,aAAa,IAAI,EAAE;gBACpC,IAAM0G,QACJ,OAAOpK,IAAIY,MAAM,CAACwJ,KAAK,KAAK,aACxBpM,IAAImD,KAAKe,GAAG,CAAClC,IAAIY,MAAM,CAACwJ,KAAK,KAC7BpK,IAAIY,MAAM,CAACwJ,KAAK,KAAK,QAAQpK,IAAIqK,KAAK,GACpCrM,IAAImD,KAAKe,GAAG,CAAClC,IAAIqK,KAAK,KACtB;gBACR,OAAOD,QAAQpK,IAAIY,MAAM,CAAC0J,WAAW,CAACF,SAAS;YACjD;YACAlJ,cAAc;YACdI,WAAW;YACXT,eAAe;QACjB;;AACJ,EAAE"}
1
+ {"version":3,"sources":["../../../../src/charts/features/features.ts"],"sourcesContent":["/**\n FeatureModule + layout engine. The chart-level features (title,\n subtitle, total, legend, timeline, colorScale, back) are\n `FeatureModule` values composed by `runLayout`, which performs\n **explicit margin negotiation** — each feature returns a `MarginClaim`\n + optional `panel` scene node + optional declarative `vizUpdate`\n writes, and the engine accumulates margins across features in order.\n\n Every Plot-family + chart-shell feature here is wired into\n `vizDrawPure` via `runLayout(ctx, [...features])`.\n*/\nimport {extent, min, rollup, sum} from \"d3-array\";\nimport {select} from \"d3-selection\";\n\nimport {merge, unique} from \"@d3plus/data\";\nimport type {DataPoint, MergedDataPoint} from \"@d3plus/data\";\nimport {date, elem, stylize} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */\nexport interface MarginClaim {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n}\n\n/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */\nexport interface FeatureLayout {\n panel: SceneNode | null;\n margin: MarginClaim;\n /**\n v4 purity: features that need to publish CROSS-FEATURE state — a\n write that a DIFFERENT feature or downstream stage will read — return\n those writes here as declarative key→value pairs. `runLayout`\n applies them to viz after the layout call so the next feature in\n the chain sees them.\n\n Key convention: keys are auto-prefixed with `_` to match viz's\n internal field convention. Return `{drawDepth: 2}` to write\n `viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)\n pass through unchanged for the rare case where the engine\n shouldn't prepend. This rule exists because a leading underscore\n is easy to forget and writing `viz.drawDepth` (no underscore) is\n almost never what callers want.\n\n Intra-feature local writes (a feature setting state that its OWN\n component instance reads inside the same `layout()` body) are\n legitimate direct mutations on viz — `vizUpdate` would defer the\n write past the local read. legendFeature's `_legendDepth` is an\n example of an intra-feature local; timelineFeature's\n `_timelineSelection` similarly mutates from its event handler\n context. The contract is about CROSS-feature mutation, not all\n mutation.\n */\n vizUpdate?: Record<string, unknown>;\n}\n\n/**\n @interface FeatureModule\n A chart-level component (title, subtitle, total, legend, timeline,\n colorScale, back, attribution) expressed as a pure value. Each feature:\n - contributes config keys to the chart's schema (`configFields`),\n - optionally derives extra fields onto the pipeline context (`derive`),\n - optionally claims a margin region + emits its panel scene (`layout`),\n - optionally registers event reducers (`events`).\n*/\nexport interface FeatureModule {\n name: string;\n /** Keys the chart's config inherits from this feature (used by E4 fluent gen). */\n configFields?: string[];\n /** Extra derivations to add into the pipeline context. */\n derive?: (ctx: VizContext) => Partial<VizContext>;\n /**\n Pure layout: read the (possibly updated-by-earlier-features) context and\n return the panel scene + margin this feature claims. The layoutEngine\n threads the margin claims through `ctx.layoutMargin` so a feature can\n read what earlier features already took.\n */\n layout?: (\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n ) => FeatureLayout;\n /**\n Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a\n user interaction occurs on a node tagged with this feature's name.\n */\n events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;\n}\n\n/**\n Result of running a list of features through the layout engine.\n*/\nexport interface LayoutResult {\n /** Panel nodes in feature order, ready to compose into the scene root. */\n panels: SceneNode[];\n /** Final margin after every feature claimed its space. */\n margin: Required<MarginClaim>;\n}\n\n/**\n The allowed values for `legendPosition` and `colorScalePosition`.\n `false` means \"hidden\" (the feature still runs to tear down DOM); the\n four strings are the four sides.\n*/\nexport type PanelPosition = false | \"top\" | \"right\" | \"bottom\" | \"left\";\n\nconst VALID_POSITIONS: ReadonlySet<PanelPosition | string> = new Set([\n false as unknown as string,\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\n/**\n Canonical sanitizer for `legendPosition` / `colorScalePosition`.\n Falls back to `\"bottom\"` when the user-supplied accessor returns\n something outside the allowed set. Single source of truth — used by\n `vizDrawPure` (for sanitized ctx publication) and by `legendFeature`\n + `colorScaleFeature` (for their internal positioning math).\n*/\nexport function sanitizePosition(raw: unknown): PanelPosition {\n return (VALID_POSITIONS.has(raw as string) ? raw : \"bottom\") as PanelPosition;\n}\n\n/**\n Runs each feature's `layout` in order, accumulating margin claims so that\n later features see the space already taken by earlier ones. The order of\n `features` is the layout order — this is how implicit `this._margin +=`\n side effects become *explicit* data flow.\n\n Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,\n `drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,\n `drawTimeline`) should be ported verbatim as the default sequence — port\n the math first, then improve.\n*/\nexport function runLayout(\n ctx: VizContext,\n features: FeatureModule[],\n baseMargin: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0},\n): LayoutResult {\n // `claims` is this call's accumulated margin (the returned delta).\n // `layoutMargin` handed to each feature is the running TOTAL —\n // `baseMargin` (margin already taken by prior runLayout calls in the same\n // draw) plus the claims taken so far in this call — so a feature reads\n // the true current margin without touching viz._margin.\n const claims: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0};\n const panels: SceneNode[] = [];\n for (const f of features) {\n if (!f.layout) continue;\n const layoutMargin: Required<MarginClaim> = {\n top: baseMargin.top + claims.top,\n right: baseMargin.right + claims.right,\n bottom: baseMargin.bottom + claims.bottom,\n left: baseMargin.left + claims.left,\n };\n const result = f.layout({...ctx, layoutMargin});\n const {panel, margin: claim, vizUpdate} = result;\n if (panel) panels.push(panel);\n claims.top += claim.top ?? 0;\n claims.right += claim.right ?? 0;\n claims.bottom += claim.bottom ?? 0;\n claims.left += claim.left ?? 0;\n // v4 purity: features publish cross-feature viz writes declaratively\n // via `vizUpdate`. The engine applies them — features don't mutate\n // viz directly from layout(). Skips own component-instance config\n // calls (those are local mutation, not cross-feature). Use\n // `Object.keys` (not `for...in`) so inherited enumerable properties\n // on a class-instance vizUpdate don't leak onto viz.\n //\n // Key convention: keys are auto-prefixed with `_` to land on the\n // viz's internal field convention (`viz._drawDepth`, `viz._legendDepth`).\n // Features should return UNPREFIXED keys (`{drawDepth: 2}`); the\n // engine normalizes — so feature authors can't accidentally write\n // `viz.drawDepth` (a different non-underscore property) instead of\n // `viz._drawDepth`. Keys that already start with `_` are passed\n // through unchanged so future explicit-internal writes still work.\n if (vizUpdate && ctx.viz) {\n const target = ctx.viz as Record<string, unknown>;\n for (const k of Object.keys(vizUpdate)) {\n const key = k.startsWith(\"_\") ? k : `_${k}`;\n target[key] = vizUpdate[k];\n }\n }\n }\n return {panels, margin: claims};\n}\n\n/* --------------------------- text-block features --------------------------- */\n\n/**\n Shared layout logic for any \"single line of text claiming margin.top\" feature\n (title, subtitle, total). Each feature passes the viz fields that source its\n text + TextBox + config; the helper computes the panel + margin claim using\n the TextBox's pure `_textData()` (no DOM).\n*/\nfunction textBlockLayout(\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n opts: {\n panelKey: string;\n getText: (viz: VizInstance) => string | false;\n textClassKey: string; // e.g. \"_titleClass\"\n configKey: string; // schema key, e.g. \"titleConfig\"\n paddingMethod: string; // schema key, e.g. \"titlePadding\"\n },\n): FeatureLayout {\n const {viz, layoutMargin} = ctx;\n const text = opts.getText(viz);\n if (!text) return {panel: null, margin: {}};\n\n const usesPadding = (viz.schema[opts.paddingMethod] as (viz: VizInstance) => boolean)(viz);\n const padding = usesPadding\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n const width =\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n\n const textClass = viz[opts.textClassKey];\n textClass\n .data([{text}])\n .locale(viz.schema.locale)\n .width(width)\n .config(viz.schema[opts.configKey]);\n const boxes = textClass._textData() as Array<{\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n }>;\n if (!boxes.length) return {panel: null, margin: {}};\n const box = boxes[0];\n\n const x = layoutMargin.left + padding.left;\n const y = layoutMargin.top;\n const lineHeight = box.lH;\n const blockPadding = (viz.schema[opts.configKey]?.padding as number) ?? 0;\n const height = box.lines.length * lineHeight + blockPadding * 2;\n\n const lines = box.lines.map((str: string, i: number) => ({\n text: str,\n x:\n box.tA === \"middle\"\n ? width / 2\n : box.tA === \"end\"\n ? width\n : 0,\n y: (i + 1) * lineHeight - (lineHeight - box.fS),\n width: box.widths?.[i] ?? 0,\n }));\n\n const panel: SceneNode = {\n type: \"text\",\n key: opts.panelKey,\n x: 0,\n y: 0,\n lines,\n font: {\n family: box.fF,\n size: box.fS,\n anchor:\n box.tA === \"middle\" || box.tA === \"end\" || box.tA === \"start\"\n ? (box.tA as \"middle\" | \"end\" | \"start\")\n : \"start\",\n baseline: \"alphabetic\",\n },\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x, y},\n };\n\n return {panel, margin: {top: height}};\n}\n\n/**\n Title as a FeatureModule. Uses `_titleClass._textData()` for height\n (pure compute, no DOM) and returns the margin claim explicitly.\n*/\nexport const titleFeature: FeatureModule = {\n name: \"title\",\n configFields: [\"title\", \"titleConfig\", \"titlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-title\",\n getText: viz => (viz.schema.title ? viz.schema.title(viz._filteredData || []) : false),\n textClassKey: \"_titleClass\",\n configKey: \"titleConfig\",\n paddingMethod: \"titlePadding\",\n }),\n};\n\n/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */\nexport const subtitleFeature: FeatureModule = {\n name: \"subtitle\",\n configFields: [\"subtitle\", \"subtitleConfig\", \"subtitlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-subtitle\",\n getText: viz => (viz.schema.subtitle ? viz.schema.subtitle(viz._filteredData || []) : false),\n textClassKey: \"_subtitleClass\",\n configKey: \"subtitleConfig\",\n paddingMethod: \"subtitlePadding\",\n }),\n};\n\n/**\n Converts `drawBack.ts` to a FeatureModule. Visible only when there are\n drill-down history entries; emits a \"← Back\" TextNode at the chart's\n top-left and claims its line height + padding × 2 from `margin.top`.\n*/\nexport const backFeature: FeatureModule = {\n name: \"back\",\n configFields: [\"backConfig\"],\n layout: ({viz, layoutMargin}) => {\n if (!viz._history || !viz._history.length) return {panel: null, margin: {}};\n\n const text = `← ${viz.schema.translate(\"Back\")}`;\n viz._backClass.data([{text, x: 0, y: 0}]).config(viz.schema.backConfig);\n const boxes = viz._backClass._textData() as Array<{\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n }>;\n // _backClass might have a fontSize/padding only style (no wrapping data),\n // in which case _textData may be empty; fall back to direct accessor reads\n // for the margin claim to match drawBack's math precisely.\n const fontSize = viz._backClass.fontSize()();\n const padding = viz._backClass.padding()();\n const height = fontSize + padding * 2;\n\n if (!boxes.length) {\n return {panel: null, margin: {top: height}};\n }\n const box = boxes[0];\n\n const panel: SceneNode = {\n type: \"text\",\n key: \"viz-back\",\n x: 0,\n y: 0,\n lines: box.lines.map((str, i) => ({\n text: str,\n x: 0,\n y: (i + 1) * box.lH - (box.lH - box.fS),\n width: box.widths?.[i] ?? 0,\n })),\n font: {family: box.fF, size: box.fS, baseline: \"alphabetic\"},\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x: layoutMargin.left, y: layoutMargin.top},\n };\n return {panel, margin: {top: height}};\n },\n};\n\n/* -------------------------------- Legend --------------------------------- */\n\nexport {legendFeature} from \"./featuresLegend.js\";\n\n/* -------------------------------- Timeline ------------------------------- */\n\n/**\n Helper mirroring drawTimeline's `setTimeFilter`. Triggers a re-render when\n the brush selection changes — kept here so the feature owns its event flow.\n*/\nfunction setTimeFilter(viz: VizInstance, s: Date | Date[] | number[]): void {\n if (!Array.isArray(s)) s = [s, s] as Date[];\n if (JSON.stringify(s) !== JSON.stringify(viz._timelineSelection)) {\n viz._timelineSelection = s;\n const nums = (s as Array<Date | number>).map(Number) as number[];\n viz\n .timeFilter!((d: DataPoint) => {\n const ms = (date(viz.schema.time(d)) as Date).getTime();\n return ms >= nums[0] && ms <= nums[1];\n })\n .render!();\n }\n}\n\n/**\n Converts `drawTimeline.ts` to a FeatureModule.\n\n Visible only when `_time` is set, `_timeline` is truthy, and there is more\n than one distinct tick. Renders the chart's `_timelineClass` Timeline\n instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's\n components collection) and claims `margin.bottom` from its outerBounds.\n*/\nexport const timelineFeature: FeatureModule = {\n name: \"timeline\",\n configFields: [\"timeline\", \"timelineConfig\", \"timelinePadding\"],\n layout: ({viz, layoutMargin}) => {\n let timelinePossible = viz.schema.time && viz.schema.timeline;\n const ticks = (\n timelinePossible\n ? unique(viz._data.map(viz.schema.time)).map(\n (d: unknown) => date(d as string | number),\n )\n : []\n ) as Date[];\n timelinePossible = timelinePossible && ticks.length > 1;\n const padding = viz.schema.timelinePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const transform = {\n transform: `translate(${layoutMargin.left + padding.left}, 0)`,\n };\n\n const timelineGroup = elem(\"g.d3plus-viz-timeline\", {\n condition: timelinePossible,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!timelinePossible) return {panel: null, margin: {}};\n\n const timeline = viz._timelineClass\n .renderMode(\"compute\")\n .domain(extent(ticks) as [Date, Date])\n .duration(viz.schema.duration)\n .height(viz.schema.height - layoutMargin.bottom)\n .locale(viz.schema.locale)\n .select(timelineGroup)\n .ticks(ticks.sort((a: Date, b: Date) => +a - +b))\n .width(\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right),\n );\n\n // Clamp bound = the full time range (every tick); it never goes stale\n // mid-render. Clamping to `viz._filteredData`'s extent instead collapsed a\n // freshly-committed range down to the previous selection — the release\n // snap-back (e.g. [2017,2024] clamped to a stale [2022,2022]).\n const fullExtent = extent(ticks) as [Date, Date];\n if (!viz._timelineSelection) {\n // First render only: default to the *filtered* extent, which the\n // synthesized default timeFilter pins to the latest period (see\n // vizPreDraw) — the historical default. `timelineDefault` overrides it.\n const filtered = extent(\n (viz._filteredData || [])\n .map(viz.schema.time)\n .map((d: unknown) => date(d as string | number)) as Date[],\n ) as [Date, Date];\n viz._timelineSelection =\n viz.schema.timelineDefault || (filtered[0] ? filtered : fullExtent);\n } else {\n if (viz._timelineSelection[0] < fullExtent[0])\n viz._timelineSelection[0] = fullExtent[0];\n if (viz._timelineSelection[1] > fullExtent[1])\n viz._timelineSelection[1] = fullExtent[1];\n }\n timeline.selection(viz._timelineSelection);\n\n // Repaint the scene when playback toggles without moving the selection\n // (e.g. a manual pause), so the play/pause glyph refreshes immediately.\n timeline._onPlayToggle = () => viz._scheduleSceneRepaint();\n\n const config = viz.schema.timelineConfig;\n timeline\n .config(config)\n .on(\"brush\", (s: Date[]) => {\n // Filter on \"end\", not on every brush move. Re-rendering the whole Viz\n // mid-drag re-creates the d3-brush (and starts a brush transition),\n // which fights the active gesture and can make the selection snap back\n // on release — and it re-lays-out the chart on every pixel of the drag,\n // which is costly for large data. The brush still tracks the cursor\n // live; the chart updates when the drag finishes. User `on.brush`\n // callbacks still fire for custom live behavior.\n if (config.on && config.on.brush) config.on.brush(s);\n })\n .on(\"end\", (s: Date[]) => {\n setTimeFilter(viz, s);\n if (config.on && config.on.end) config.on.end(s);\n })\n .render();\n\n return {\n panel: null,\n margin: {bottom: timeline.outerBounds().height + timeline.padding() * 2},\n };\n },\n};\n\n/* ------------------------------- ColorScale ------------------------------ */\n\n/**\n Converts `drawColorScale.ts` to a FeatureModule.\n\n Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves\n to a side. Renders the chart's `_colorScaleClass` ColorScale instance and\n claims margin along its position side.\n*/\nexport const colorScaleFeature: FeatureModule = {\n name: \"colorScale\",\n configFields: [\n \"colorScale\",\n \"colorScaleConfig\",\n \"colorScaleMaxSize\",\n \"colorScalePadding\",\n \"colorScalePosition\",\n ],\n layout: ({viz, layoutMargin}) => {\n const data = Array.from(\n rollup(\n viz._data,\n (leaves: DataPoint[]) => merge(leaves, viz.schema.aggs),\n (d: DataPoint, i: number) =>\n `${viz.schema.time ? viz.schema.time(d, i) : \"all\"}-${viz._ids(d, i).join(\"_\")}`,\n ).values(),\n );\n\n const position = sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const showColorScale = viz.schema.colorScale && position;\n const padding = viz.schema.colorScalePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const availableWidth =\n viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n const width = wide\n ? min([viz.schema.colorScaleMaxSize, availableWidth])!\n : viz.schema.width - (layoutMargin.left + layoutMargin.right);\n\n const availableHeight =\n viz.schema.height - (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top);\n const height = !wide\n ? min([viz.schema.colorScaleMaxSize, availableHeight])!\n : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);\n\n const transform = {\n opacity: position ? 1 : 0,\n transform: `translate(${\n wide\n ? layoutMargin.left + padding.left + (availableWidth - width) / 2\n : layoutMargin.left\n }, ${\n wide\n ? layoutMargin.top\n : layoutMargin.top + padding.top + (availableHeight - height) / 2\n })`,\n };\n\n const scaleGroup = elem(\"g.d3plus-viz-colorScale\", {\n condition: showColorScale && !viz.schema.colorScaleConfig.select,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!viz.schema.colorScale) return {panel: null, margin: {}};\n\n const scaleData = data.filter((d: MergedDataPoint, i: number) => {\n const c = viz.schema.colorScale(d as unknown as DataPoint, i);\n return c !== undefined && c !== null;\n });\n\n // Discrete (bucket/jenks/quantile) colorScales render their swatches via an\n // internal Legend, which composes cleanly through the Viz scene — so run\n // them in compute mode (like the legend) so the Viz's toScene owns them and\n // hover/active dimming applies. Without this they render full-mode, where\n // paintComponentScene paints a full-opacity copy that overlays and defeats\n // the dimming. The smooth-gradient variant stays full-mode: its gradient\n // fill is materialized through paintComponentScene, not the Viz scene.\n const csCfg = (viz.schema.colorScaleConfig || {}) as {\n scale?: string;\n bucketAxis?: boolean;\n };\n const csDiscrete =\n !csCfg.bucketAxis &&\n [\"buckets\", \"jenks\", \"quantile\"].includes(\n typeof csCfg.scale === \"string\" ? csCfg.scale : \"\",\n );\n\n viz._colorScaleClass\n .renderMode(csDiscrete ? \"compute\" : \"full\")\n .align(\n ({bottom: \"end\", left: \"start\", right: \"end\", top: \"start\"} as Record<string, string>)[\n position as string\n ] || \"bottom\",\n )\n .duration(viz.schema.duration)\n .data(scaleData)\n .height(height)\n .locale(viz.schema.locale)\n .orient(position)\n .select(scaleGroup)\n .value(viz.schema.colorScale)\n .width(width)\n .config(viz.schema.colorScaleConfig)\n .render();\n\n const margin: Record<string, number> = {};\n if (showColorScale) {\n const scaleBounds = viz._colorScaleClass.outerBounds();\n if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {\n // Use the colorScale's OWN padding for its margin claim — not the\n // legend's, so a custom legendPadding doesn't shift the\n // colorScale's claim when the legend is hidden. The colorScale\n // class is the source of truth.\n const csPadding =\n typeof viz._colorScaleClass.padding === \"function\"\n ? viz._colorScaleClass.padding()\n : viz._legendClass.padding();\n if (wide) margin[position] = scaleBounds.height + csPadding * 2;\n else margin[position] = scaleBounds.width + csPadding * 2;\n }\n }\n return {panel: null, margin};\n },\n};\n\n/* ------------------------------ Attribution ------------------------------ */\n\n/**\n Converts `drawAttribution.ts` to a FeatureModule.\n\n Attribution is an HTML `<div>` overlay positioned absolutely outside the SVG\n plane — it doesn't fit naturally as a SceneNode in the chart scene graph.\n Rather than encode an HTML overlay into the scene graph, this feature runs\n the DOM-creating side effect imperatively from inside `layout()`, so\n invocation is funneled through `runLayout` for consistency with the\n other features. It claims zero margin and emits no panel.\n*/\nexport const attributionFeature: FeatureModule = {\n name: \"attribution\",\n configFields: [\"attribution\", \"attributionStyle\"],\n layout: ({viz}) => {\n let attr: D3Selection = select(viz._select.node().parentNode)\n .selectAll(\"div.d3plus-attribution\")\n .data(viz.schema.attribution ? [0] : []) as unknown as D3Selection;\n\n const attrEnter = attr\n .enter()\n .append(\"div\")\n .attr(\"class\", \"d3plus-attribution\");\n\n attr.exit().remove();\n\n attr = attr\n .merge(attrEnter as never)\n .style(\"position\", \"absolute\")\n .html(viz.schema.attribution)\n .style(\"right\", `${viz._margin.right}px`)\n .style(\"bottom\", `${viz._margin.bottom}px`)\n .call(stylize as never, viz.schema.attributionStyle);\n\n return {panel: null, margin: {}};\n },\n};\n\n/**\n Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/\n subtitle: the text comes from `sum()` over the filtered data when `_total`\n is a function, or from `sum(data.map(_size))` when `_total === true`.\n*/\nexport const totalFeature: FeatureModule = {\n name: \"total\",\n configFields: [\"total\", \"totalConfig\", \"totalFormat\", \"totalPadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-total\",\n getText: viz => {\n const data = viz._filteredData || [];\n const total =\n typeof viz.schema.total === \"function\"\n ? sum(data.map(viz.schema.total))\n : viz.schema.total === true && viz._size\n ? sum(data.map(viz._size))\n : false;\n return total ? viz.schema.totalFormat(total) : false;\n },\n textClassKey: \"_totalClass\",\n configKey: \"totalConfig\",\n paddingMethod: \"totalPadding\",\n }),\n};\n"],"names":["extent","min","rollup","sum","select","merge","unique","date","elem","stylize","resolveSpec","VALID_POSITIONS","Set","sanitizePosition","raw","has","runLayout","ctx","features","baseMargin","top","right","bottom","left","claims","panels","f","claim","layout","layoutMargin","result","panel","margin","vizUpdate","push","viz","target","Object","keys","k","key","startsWith","textBlockLayout","opts","text","getText","usesPadding","schema","paddingMethod","padding","_padding","width","textClass","textClassKey","data","locale","config","configKey","boxes","_textData","length","box","x","y","lineHeight","lH","blockPadding","height","lines","map","str","i","tA","fS","widths","type","panelKey","font","family","fF","size","anchor","baseline","paint","fill","fC","opacity","fO","transform","titleFeature","name","configFields","title","_filteredData","subtitleFeature","subtitle","backFeature","_history","translate","_backClass","backConfig","fontSize","legendFeature","setTimeFilter","s","Array","isArray","JSON","stringify","_timelineSelection","nums","Number","timeFilter","d","ms","time","getTime","render","timelineFeature","timelinePossible","timeline","ticks","_data","timelinePadding","timelineGroup","condition","enter","parent","_select","duration","update","node","_timelineClass","renderMode","domain","sort","a","b","fullExtent","filtered","timelineDefault","selection","_onPlayToggle","_scheduleSceneRepaint","timelineConfig","on","brush","end","outerBounds","colorScaleFeature","from","leaves","aggs","_ids","join","values","position","colorScalePosition","bind","wide","includes","showColorScale","colorScale","colorScalePadding","availableWidth","colorScaleMaxSize","availableHeight","scaleGroup","colorScaleConfig","scaleData","filter","c","undefined","csCfg","csDiscrete","bucketAxis","scale","_colorScaleClass","align","orient","value","scaleBounds","csPadding","_legendClass","attributionFeature","attr","parentNode","selectAll","attribution","attrEnter","append","exit","remove","style","html","_margin","call","attributionStyle","totalFeature","total","_size","totalFormat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA,GACA,SAAQA,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,GAAG,QAAO,WAAW;AAClD,SAAQC,MAAM,QAAO,eAAe;AAEpC,SAAQC,KAAK,EAAEC,MAAM,QAAO,eAAe;AAE3C,SAAQC,IAAI,EAAEC,IAAI,EAAEC,OAAO,QAAO,cAAc;AAKhD,SAAQC,WAAW,QAAO,6BAA6B;AA2FvD,IAAMC,kBAAuD,IAAIC,IAAI;IACnE;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;AAMA,GACA,OAAO,SAASC,iBAAiBC,GAAY;IAC3C,OAAQH,gBAAgBI,GAAG,CAACD,OAAiBA,MAAM;AACrD;AAEA;;;;;;;;;;AAUA,GACA,OAAO,SAASE,UACdC,GAAe,EACfC,QAAyB;QACzBC,aAAAA,iEAAoC;QAACC,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAEzE,mEAAmE;IACnE,+DAA+D;IAC/D,0EAA0E;IAC1E,uEAAuE;IACvE,wDAAwD;IACxD,IAAMC,SAAgC;QAACJ,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAC3E,IAAME,SAAsB,EAAE;QACzB,kCAAA,2BAAA;;QAAL,QAAK,YAAWP,6BAAX,SAAA,6BAAA,QAAA,yBAAA,iCAAqB;YAArB,IAAMQ,IAAN;gBAWWC,YACEA,cACCA,eACFA;YAbf,IAAI,CAACD,EAAEE,MAAM,EAAE;YACf,IAAMC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102
  "bottom"
103
103
  ].includes(position);
104
- var padding = viz.schema.legendPadding() ? viz._padding : {
104
+ var padding = viz.schema.legendPadding(viz) ? viz._padding : {
105
105
  top: 0,
106
106
  right: 0,
107
107
  bottom: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/features/featuresLegend.ts"],"sourcesContent":["/**\n The `legendFeature` FeatureModule, extracted from `features.ts` and\n re-exported there. The `layout` body is split into `buildLegendData`\n (rollup + sort + legend-depth) and `renderLegendFeature` (positioning,\n render, margin claim) so each stays a readable unit.\n*/\nimport {rollup} from \"d3-array\";\n\nimport {merge} from \"@d3plus/data\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {configPrep} from \"../../utils/index.js\";\nimport type {VizContext as ConfigPrepContext} from \"../../utils/configPrep.js\";\n\nimport type {FeatureLayout, FeatureModule, MarginClaim} from \"./features.js\";\nimport {sanitizePosition} from \"./features.js\";\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\nconst legendAttrs = [\"fill\", \"opacity\", \"texture\"];\n\ninterface LegendData {\n legendData: DataPoint[];\n fill: (d: DataPoint, i: number) => string;\n getAttr: (d: DataPoint, i: number, attr: string) => string;\n}\n\n/**\n Rolls filtered legend data up by paint attributes, sorts it, and computes\n `viz._legendDepth` (the lowest groupBy level whose values are unique).\n Returns the `legendData` array plus the `fill`/`getAttr` accessors the\n render step reuses.\n*/\nfunction buildLegendData(viz: VizInstance): LegendData {\n // Source: `_legendData` from the rollupAndFilter pipeline stage — same\n // arg drawLegend received via `drawLegend.bind(this)(this._legendData)`.\n const data: DataPoint[] = viz._legendData || [];\n const legendData: DataPoint[] = [];\n\n const getAttr = (d: DataPoint, i: number, attr: string): string => {\n const shape = viz.schema.shape(d, i);\n if (attr === \"fill\" && shape === \"Line\") attr = \"stroke\";\n const value =\n viz.schema.shapeConfig[shape] && viz.schema.shapeConfig[shape][attr]\n ? viz.schema.shapeConfig[shape][attr]\n : viz.schema.shapeConfig[attr];\n return typeof value === \"function\" ? value.bind(viz)(d, i) : value;\n };\n\n const fill = (d: DataPoint, i: number): string =>\n legendAttrs.map(a => getAttr(d, i, a)).join(\"_\");\n\n const rollupData = viz.schema.colorScale\n ? data.filter(\n (d: DataPoint, i: number) => viz.schema.colorScale(d, i) === undefined,\n )\n : data;\n rollup(\n rollupData,\n (leaves: DataPoint[]) =>\n legendData.push(merge(leaves, viz.schema.aggs) as unknown as DataPoint),\n fill,\n );\n\n legendData.sort(viz.schema.legendSort);\n\n const labels = legendData.map((d: DataPoint, i: number) =>\n viz._ids(d, i).slice(0, viz._drawDepth + 1),\n );\n // viz._legendDepth: the legend's drill-down depth (lowest unique\n // groupBy level). Computed and written here BEFORE the\n // `viz._legendClass!.render()` call below, because that render\n // invokes `legendLabel.bind(viz)` (Viz.ts:217) which reads\n // `viz._legendDepth` live to format each legend entry. The write\n // is INTRA-FEATURE state — it's owned by legendFeature, consumed\n // by legendFeature's own component instance. `FeatureLayout.vizUpdate`\n // is the CROSS-feature publishing channel (for state OTHER features\n // need); intra-feature writes that the same feature reads in its own\n // body legitimately live on viz directly, which is what's happening\n // here. Downstream consumers (BarChart.ts:28, Viz.ts:210, legendLabel)\n // observe the value after layout completes — same as before.\n viz._legendDepth = 0;\n for (let x = 0; x <= viz._drawDepth; x++) {\n const values = labels.map((l: string[]) => l[x]);\n if (\n !values.some((v: string | string[]) => Array.isArray(v)) &&\n Array.from(new Set(values)).length === legendData.length\n ) {\n viz._legendDepth = x;\n break;\n }\n }\n\n return {legendData, fill, getAttr};\n}\n\n/**\n Positions, configures, and renders the chart's `_legendClass` Legend\n instance (compute mode — Legend contributes to the scene via its\n `toScene()` collected on Viz.toScene), then returns the margin claim\n derived from the previous render's outerBounds.\n*/\nfunction renderLegendFeature(\n viz: VizInstance,\n built: LegendData,\n layoutMargin: Required<MarginClaim>,\n): FeatureLayout {\n const {legendData, fill, getAttr} = built;\n\n const hidden = (d: DataPoint, i: number): boolean => {\n let id = viz._id(d, i);\n if (Array.isArray(id)) id = id[0];\n return (\n viz._hidden.includes(id) ||\n (viz._solo.length > 0 && !viz._solo.includes(id))\n );\n };\n\n // The margin *claim* uses the previous render's outerBounds; on first\n // render it's zero and the Legend re-flows on the second render with the\n // real space.\n const legendBounds = viz._legendClass!.outerBounds();\n const config = resolveSpec(viz);\n const position = sanitizePosition(viz.schema.legendPosition.bind(viz)(config));\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const padding = viz.schema.legendPadding()\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n const transform = {\n transform: `translate(${\n wide ? layoutMargin.left + padding.left : layoutMargin.left\n }, ${wide ? layoutMargin.top : layoutMargin.top + padding.top})`,\n };\n // `visible` gates the legend group's DOM presence + data binding.\n // `position === false` forces it off so `.legendPosition(false)` is\n // an actual hide signal: the legend's render runs against [] data,\n // which exits any prior DOM and emits no scene.\n const visible =\n position === false ? false : viz.schema.legend.bind(viz)(config, legendData);\n\n // The Legend instance renders into a `g.d3plus-viz-legend` group as a\n // child of the chart's svg. This group is created via the `elem` helper\n // so the Legend has a DOM `_select` (its `toScene()` walks from there).\n // Once Legend is fully compute-only the elem wrapper can go.\n const legendGroup = elem(\"g.d3plus-viz-legend\", {\n condition: visible && !viz.schema.legendConfig.select,\n enter: transform,\n parent: viz._select as unknown as D3Selection,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n viz._legendClass!\n .renderMode(\"compute\")\n .id(fill)\n .align(wide ? \"center\" : position)\n .direction(wide ? \"row\" : \"column\")\n .duration(viz.schema.duration)\n .data(visible ? legendData : [])\n .height(\n wide\n ? viz.schema.height - (layoutMargin.bottom + layoutMargin.top)\n : viz.schema.height -\n (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top),\n )\n .locale(viz.schema.locale)\n .parent(viz)\n .select(legendGroup)\n .shape((d: DataPoint, i: number) =>\n viz.schema.shape(d, i) === \"Circle\" ? \"Circle\" : \"Rect\",\n )\n .verticalAlign(!wide ? \"middle\" : position)\n .width(\n wide\n ? viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right)\n : viz.schema.width - (layoutMargin.left + layoutMargin.right),\n )\n .shapeConfig(configPrep.bind(viz as unknown as ConfigPrepContext)(viz.schema.shapeConfig, \"legend\"))\n .shapeConfig({\n fill: (d: DataPoint, i: number) =>\n hidden(d, i) ? viz.schema.hiddenColor(d, i) : getAttr(d, i, \"fill\"),\n labelConfig: {\n fontOpacity: (d: DataPoint, i: number) =>\n hidden(d, i) ? viz.schema.hiddenOpacity(d, i) : 1,\n },\n })\n .config(viz.schema.legendConfig)\n .render();\n\n // Margin claim from the *previous* render's outerBounds:\n // `outerBounds()` reads stored state, so on the first render the claim\n // is zero and Legend overlaps the chart for one frame; the next render\n // flows with full margin.\n const margin: MarginClaim = {};\n if (!viz.schema.legendConfig.select && legendBounds.height) {\n if (wide)\n (margin as Record<string, number>)[position as string] =\n legendBounds.height + viz._legendClass!.padding() * 2;\n else\n (margin as Record<string, number>)[position as string] =\n legendBounds.width + viz._legendClass!.padding() * 2;\n }\n return {panel: null, margin};\n}\n\n/**\n Converts `drawLegend.ts` to a FeatureModule.\n\n Layout responsibility: roll filtered data up by paint attributes, configure\n + render the chart's `_legendClass` Legend instance (compute mode — Legend\n contributes to the scene via its `toScene()` collected on Viz.toScene),\n and return the margin claim corresponding to its outerBounds + padding.\n No panel SceneNode is emitted — Legend is a component, not a panel; the\n scene composition for Legend happens via Viz.toScene's `components` array.\n*/\nexport const legendFeature: FeatureModule = {\n name: \"legend\",\n configFields: [\"legend\", \"legendConfig\", \"legendPadding\", \"legendPosition\", \"legendSort\"],\n layout: ({viz, layoutMargin}: VizContext & {layoutMargin: Required<MarginClaim>}) => {\n const built = buildLegendData(viz);\n return renderLegendFeature(viz, built, layoutMargin);\n },\n};\n"],"names":["rollup","merge","elem","configPrep","sanitizePosition","resolveSpec","legendAttrs","buildLegendData","viz","values","labels","map","l","x","some","v","Array","isArray","from","Set","length","legendData","_legendDepth","data","_legendData","getAttr","d","i","attr","shape","schema","value","shapeConfig","bind","fill","a","join","rollupData","colorScale","filter","undefined","leaves","push","aggs","sort","legendSort","_ids","slice","_drawDepth","renderLegendFeature","built","layoutMargin","hidden","id","_id","_hidden","includes","_solo","legendBounds","_legendClass","outerBounds","config","position","legendPosition","wide","padding","legendPadding","_padding","top","right","bottom","left","transform","visible","legend","legendGroup","condition","legendConfig","select","enter","parent","_select","duration","update","node","renderMode","align","direction","height","locale","verticalAlign","width","hiddenColor","labelConfig","fontOpacity","hiddenOpacity","render","margin","panel","legendFeature","name","configFields","layout"],"mappings":"AAAA;;;;;AAKA,GACA,SAAQA,MAAM,QAAO,WAAW;AAEhC,SAAQC,KAAK,QAAO,eAAe;AAEnC,SAAQC,IAAI,QAAO,cAAc;AAGjC,SAAQC,UAAU,QAAO,uBAAuB;AAIhD,SAAQC,gBAAgB,QAAO,gBAAgB;AAC/C,SAAQC,WAAW,QAAO,6BAA6B;AAIvD,IAAMC,cAAc;IAAC;IAAQ;IAAW;CAAU;AAQlD;;;;;AAKA,GACA,SAASC,gBAAgBC,GAAgB;;QAkDrC,IAAMC,SAASC,OAAOC,GAAG,CAAC,SAACC;mBAAgBA,CAAC,CAACC,EAAE;;QAC/C,IACE,CAACJ,OAAOK,IAAI,CAAC,SAACC;mBAAyBC,MAAMC,OAAO,CAACF;cACrDC,MAAME,IAAI,CAAC,IAAIC,IAAIV,SAASW,MAAM,KAAKC,WAAWD,MAAM,EACxD;YACAZ,IAAIc,YAAY,GAAGT;YACnB,OAAA;QACF;IACF;IAzDA,uEAAuE;IACvE,yEAAyE;IACzE,IAAMU,OAAoBf,IAAIgB,WAAW,IAAI,EAAE;IAC/C,IAAMH,aAA0B,EAAE;IAElC,IAAMI,UAAU,iBAACC,GAAcC,GAAWC;QACxC,IAAMC,QAAQ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AoBzC,KAAK0C,OAAOC;IACzC;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/charts/features/featuresLegend.ts"],"sourcesContent":["/**\n The `legendFeature` FeatureModule, extracted from `features.ts` and\n re-exported there. The `layout` body is split into `buildLegendData`\n (rollup + sort + legend-depth) and `renderLegendFeature` (positioning,\n render, margin claim) so each stays a readable unit.\n*/\nimport {rollup} from \"d3-array\";\n\nimport {merge} from \"@d3plus/data\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {configPrep} from \"../../utils/index.js\";\nimport type {VizContext as ConfigPrepContext} from \"../../utils/configPrep.js\";\n\nimport type {FeatureLayout, FeatureModule, MarginClaim} from \"./features.js\";\nimport {sanitizePosition} from \"./features.js\";\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\nconst legendAttrs = [\"fill\", \"opacity\", \"texture\"];\n\ninterface LegendData {\n legendData: DataPoint[];\n fill: (d: DataPoint, i: number) => string;\n getAttr: (d: DataPoint, i: number, attr: string) => string;\n}\n\n/**\n Rolls filtered legend data up by paint attributes, sorts it, and computes\n `viz._legendDepth` (the lowest groupBy level whose values are unique).\n Returns the `legendData` array plus the `fill`/`getAttr` accessors the\n render step reuses.\n*/\nfunction buildLegendData(viz: VizInstance): LegendData {\n // Source: `_legendData` from the rollupAndFilter pipeline stage — same\n // arg drawLegend received via `drawLegend.bind(this)(this._legendData)`.\n const data: DataPoint[] = viz._legendData || [];\n const legendData: DataPoint[] = [];\n\n const getAttr = (d: DataPoint, i: number, attr: string): string => {\n const shape = viz.schema.shape(d, i);\n if (attr === \"fill\" && shape === \"Line\") attr = \"stroke\";\n const value =\n viz.schema.shapeConfig[shape] && viz.schema.shapeConfig[shape][attr]\n ? viz.schema.shapeConfig[shape][attr]\n : viz.schema.shapeConfig[attr];\n return typeof value === \"function\" ? value.bind(viz)(d, i) : value;\n };\n\n const fill = (d: DataPoint, i: number): string =>\n legendAttrs.map(a => getAttr(d, i, a)).join(\"_\");\n\n const rollupData = viz.schema.colorScale\n ? data.filter(\n (d: DataPoint, i: number) => viz.schema.colorScale(d, i) === undefined,\n )\n : data;\n rollup(\n rollupData,\n (leaves: DataPoint[]) =>\n legendData.push(merge(leaves, viz.schema.aggs) as unknown as DataPoint),\n fill,\n );\n\n legendData.sort(viz.schema.legendSort);\n\n const labels = legendData.map((d: DataPoint, i: number) =>\n viz._ids(d, i).slice(0, viz._drawDepth + 1),\n );\n // viz._legendDepth: the legend's drill-down depth (lowest unique\n // groupBy level). Computed and written here BEFORE the\n // `viz._legendClass!.render()` call below, because that render\n // invokes `legendLabel.bind(viz)` (Viz.ts:217) which reads\n // `viz._legendDepth` live to format each legend entry. The write\n // is INTRA-FEATURE state — it's owned by legendFeature, consumed\n // by legendFeature's own component instance. `FeatureLayout.vizUpdate`\n // is the CROSS-feature publishing channel (for state OTHER features\n // need); intra-feature writes that the same feature reads in its own\n // body legitimately live on viz directly, which is what's happening\n // here. Downstream consumers (BarChart.ts:28, Viz.ts:210, legendLabel)\n // observe the value after layout completes — same as before.\n viz._legendDepth = 0;\n for (let x = 0; x <= viz._drawDepth; x++) {\n const values = labels.map((l: string[]) => l[x]);\n if (\n !values.some((v: string | string[]) => Array.isArray(v)) &&\n Array.from(new Set(values)).length === legendData.length\n ) {\n viz._legendDepth = x;\n break;\n }\n }\n\n return {legendData, fill, getAttr};\n}\n\n/**\n Positions, configures, and renders the chart's `_legendClass` Legend\n instance (compute mode — Legend contributes to the scene via its\n `toScene()` collected on Viz.toScene), then returns the margin claim\n derived from the previous render's outerBounds.\n*/\nfunction renderLegendFeature(\n viz: VizInstance,\n built: LegendData,\n layoutMargin: Required<MarginClaim>,\n): FeatureLayout {\n const {legendData, fill, getAttr} = built;\n\n const hidden = (d: DataPoint, i: number): boolean => {\n let id = viz._id(d, i);\n if (Array.isArray(id)) id = id[0];\n return (\n viz._hidden.includes(id) ||\n (viz._solo.length > 0 && !viz._solo.includes(id))\n );\n };\n\n // The margin *claim* uses the previous render's outerBounds; on first\n // render it's zero and the Legend re-flows on the second render with the\n // real space.\n const legendBounds = viz._legendClass!.outerBounds();\n const config = resolveSpec(viz);\n const position = sanitizePosition(viz.schema.legendPosition.bind(viz)(config));\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const padding = viz.schema.legendPadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n const transform = {\n transform: `translate(${\n wide ? layoutMargin.left + padding.left : layoutMargin.left\n }, ${wide ? layoutMargin.top : layoutMargin.top + padding.top})`,\n };\n // `visible` gates the legend group's DOM presence + data binding.\n // `position === false` forces it off so `.legendPosition(false)` is\n // an actual hide signal: the legend's render runs against [] data,\n // which exits any prior DOM and emits no scene.\n const visible =\n position === false ? false : viz.schema.legend.bind(viz)(config, legendData);\n\n // The Legend instance renders into a `g.d3plus-viz-legend` group as a\n // child of the chart's svg. This group is created via the `elem` helper\n // so the Legend has a DOM `_select` (its `toScene()` walks from there).\n // Once Legend is fully compute-only the elem wrapper can go.\n const legendGroup = elem(\"g.d3plus-viz-legend\", {\n condition: visible && !viz.schema.legendConfig.select,\n enter: transform,\n parent: viz._select as unknown as D3Selection,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n viz._legendClass!\n .renderMode(\"compute\")\n .id(fill)\n .align(wide ? \"center\" : position)\n .direction(wide ? \"row\" : \"column\")\n .duration(viz.schema.duration)\n .data(visible ? legendData : [])\n .height(\n wide\n ? viz.schema.height - (layoutMargin.bottom + layoutMargin.top)\n : viz.schema.height -\n (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top),\n )\n .locale(viz.schema.locale)\n .parent(viz)\n .select(legendGroup)\n .shape((d: DataPoint, i: number) =>\n viz.schema.shape(d, i) === \"Circle\" ? \"Circle\" : \"Rect\",\n )\n .verticalAlign(!wide ? \"middle\" : position)\n .width(\n wide\n ? viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right)\n : viz.schema.width - (layoutMargin.left + layoutMargin.right),\n )\n .shapeConfig(configPrep.bind(viz as unknown as ConfigPrepContext)(viz.schema.shapeConfig, \"legend\"))\n .shapeConfig({\n fill: (d: DataPoint, i: number) =>\n hidden(d, i) ? viz.schema.hiddenColor(d, i) : getAttr(d, i, \"fill\"),\n labelConfig: {\n fontOpacity: (d: DataPoint, i: number) =>\n hidden(d, i) ? viz.schema.hiddenOpacity(d, i) : 1,\n },\n })\n .config(viz.schema.legendConfig)\n .render();\n\n // Margin claim from the *previous* render's outerBounds:\n // `outerBounds()` reads stored state, so on the first render the claim\n // is zero and Legend overlaps the chart for one frame; the next render\n // flows with full margin.\n const margin: MarginClaim = {};\n if (!viz.schema.legendConfig.select && legendBounds.height) {\n if (wide)\n (margin as Record<string, number>)[position as string] =\n legendBounds.height + viz._legendClass!.padding() * 2;\n else\n (margin as Record<string, number>)[position as string] =\n legendBounds.width + viz._legendClass!.padding() * 2;\n }\n return {panel: null, margin};\n}\n\n/**\n Converts `drawLegend.ts` to a FeatureModule.\n\n Layout responsibility: roll filtered data up by paint attributes, configure\n + render the chart's `_legendClass` Legend instance (compute mode — Legend\n contributes to the scene via its `toScene()` collected on Viz.toScene),\n and return the margin claim corresponding to its outerBounds + padding.\n No panel SceneNode is emitted — Legend is a component, not a panel; the\n scene composition for Legend happens via Viz.toScene's `components` array.\n*/\nexport const legendFeature: FeatureModule = {\n name: \"legend\",\n configFields: [\"legend\", \"legendConfig\", \"legendPadding\", \"legendPosition\", \"legendSort\"],\n layout: ({viz, layoutMargin}: VizContext & {layoutMargin: Required<MarginClaim>}) => {\n const built = buildLegendData(viz);\n return renderLegendFeature(viz, built, layoutMargin);\n },\n};\n"],"names":["rollup","merge","elem","configPrep","sanitizePosition","resolveSpec","legendAttrs","buildLegendData","viz","values","labels","map","l","x","some","v","Array","isArray","from","Set","length","legendData","_legendDepth","data","_legendData","getAttr","d","i","attr","shape","schema","value","shapeConfig","bind","fill","a","join","rollupData","colorScale","filter","undefined","leaves","push","aggs","sort","legendSort","_ids","slice","_drawDepth","renderLegendFeature","built","layoutMargin","hidden","id","_id","_hidden","includes","_solo","legendBounds","_legendClass","outerBounds","config","position","legendPosition","wide","padding","legendPadding","_padding","top","right","bottom","left","transform","visible","legend","legendGroup","condition","legendConfig","select","enter","parent","_select","duration","update","node","renderMode","align","direction","height","locale","verticalAlign","width","hiddenColor","labelConfig","fontOpacity","hiddenOpacity","render","margin","panel","legendFeature","name","configFields","layout"],"mappings":"AAAA;;;;;AAKA,GACA,SAAQA,MAAM,QAAO,WAAW;AAEhC,SAAQC,KAAK,QAAO,eAAe;AAEnC,SAAQC,IAAI,QAAO,cAAc;AAGjC,SAAQC,UAAU,QAAO,uBAAuB;AAIhD,SAAQC,gBAAgB,QAAO,gBAAgB;AAC/C,SAAQC,WAAW,QAAO,6BAA6B;AAIvD,IAAMC,cAAc;IAAC;IAAQ;IAAW;CAAU;AAQlD;;;;;AAKA,GACA,SAASC,gBAAgBC,GAAgB;;QAkDrC,IAAMC,SAASC,OAAOC,GAAG,CAAC,SAACC;mBAAgBA,CAAC,CAACC,EAAE;;QAC/C,IACE,CAACJ,OAAOK,IAAI,CAAC,SAACC;mBAAyBC,MAAMC,OAAO,CAACF;cACrDC,MAAME,IAAI,CAAC,IAAIC,IAAIV,SAASW,MAAM,KAAKC,WAAWD,MAAM,EACxD;YACAZ,IAAIc,YAAY,GAAGT;YACnB,OAAA;QACF;IACF;IAzDA,uEAAuE;IACvE,yEAAyE;IACzE,IAAMU,OAAoBf,IAAIgB,WAAW,IAAI,EAAE;IAC/C,IAAMH,aAA0B,EAAE;IAElC,IAAMI,UAAU,iBAACC,GAAcC,GAAWC;QACxC,IAAMC,QAAQrB,IAAIsB,MAAM,CAACD,KAAK,CAACH,GAAGC;QAClC,IAAIC,SAAS,UAAUC,UAAU,QAAQD,OAAO;QAChD,IAAMG,QACJvB,I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esContent":["import {select} from \"d3-selection\";\n\nimport {unique} from \"@d3plus/data\";\nimport {assign, date} from \"@d3plus/dom\";\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport {accessor, constant} from \"../../utils/index.js\";\nimport type {D3plusConfig} from \"../../utils/index.js\";\nimport VizBaseConfig from \"./VizBaseConfig.js\";\n\n/**\n Second half of the fluent config accessors shared by every Viz chart\n (`loadingHTML` through `zoomPadding`), extending `VizBaseConfig` which\n holds the first half. Split purely so each file stays under the\n `max-lines` budget; the methods remain real prototype methods, so\n `BaseClass.config()` reflection and polymorphic `this` chaining are\n unchanged.\n*/\nexport default class VizBase extends VizBaseConfig {\n\n /**\n The inner HTML of the status message displayed when loading AJAX requests and displaying errors. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.\n*/\n loadingHTML(\n _?: string | ((viz: VizBase) => string),\n ): this | string | ((viz: VizBase) => string) {\n return arguments.length\n ? ((this.schema.loadingHTML = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.loadingHTML;\n }\n\n /**\n Toggles the visibility of the status message that is displayed when loading AJAX requests and displaying errors.\n*/\n loadingMessage(_?: boolean): this | boolean {\n return arguments.length\n ? ((this.schema.loadingMessage = _), this)\n : this.schema.loadingMessage;\n }\n\n /**\n The color of the mask displayed underneath the status message when loading AJAX requests and displaying errors. Set to `false` to turn off the mask completely.\n*/\n messageMask(_?: string | boolean): this | string | boolean {\n return arguments.length\n ? ((this.schema.messageMask = _), this)\n : this.schema.messageMask;\n }\n\n /**\n Defines the CSS style properties for the status message that is displayed when loading AJAX requests and displaying errors.\n*/\n messageStyle(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.messageStyle = assign(this.schema.messageStyle, _!)), this)\n : this.schema.messageStyle;\n }\n\n /**\n The inner HTML of the status message displayed when no data is supplied to the visualization. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.\n*/\n noDataHTML(\n _?: string | ((viz: VizBase) => string),\n ): this | string | ((viz: VizBase) => string) {\n return arguments.length\n ? ((this.schema.noDataHTML = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.noDataHTML;\n }\n\n /**\n Toggles the visibility of the status message that is displayed when no data is supplied to the visualization.\n*/\n noDataMessage(_?: boolean): this | boolean {\n return arguments.length\n ? ((this.schema.noDataMessage = _), this)\n : this.schema.noDataMessage;\n }\n\n /**\n If using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.\n*/\n scrollContainer(\n _?: string | HTMLElement | Window,\n ): this | string | HTMLElement | Window {\n return arguments.length\n ? ((this.schema.scrollContainer = _), this)\n : this.schema.scrollContainer;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element. Defaults to `undefined`.\n*/\n select(_?: string | HTMLElement): this | ReturnType<typeof select> {\n return arguments.length\n ? ((this._select = select(_! as string)), this)\n : this._select;\n }\n\n /**\n Changes the primary shape used to represent each data point in a visualization. Not all visualizations support changing shapes, this method can be provided the String name of a D3plus shape class (for example, \"Rect\" or \"Circle\"), or an accessor Function that returns the String class name to be used for each individual data point.\n*/\n shape(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | string | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this.schema.shape = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.shape;\n }\n\n /**\n Configuration object with key/value pairs applied as method calls on each shape.\n*/\n shapeConfig(): D3plusConfig;\n shapeConfig(_: D3plusConfig): this;\n shapeConfig(_?: D3plusConfig): this | D3plusConfig {\n return arguments.length\n ? ((this.schema.shapeConfig = assign(this.schema.shapeConfig, _!)), this)\n : this.schema.shapeConfig;\n }\n\n /**\n Accessor function or string for the visualization's subtitle.\n*/\n subtitle(\n _?: string | ((data: DataPoint[]) => string),\n ): this | string | ((data: DataPoint[]) => string) {\n return arguments.length\n ? ((this.schema.subtitle = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.subtitle;\n }\n\n /**\n Configuration object for the subtitle.\n*/\n subtitleConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.subtitleConfig = assign(this.schema.subtitleConfig, _!)), this)\n : this.schema.subtitleConfig;\n }\n\n /**\n Tells the subtitle whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the subtitle appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n subtitlePadding(\n _?: boolean | (() => boolean),\n ): this | boolean | (() => boolean) {\n return arguments.length\n ? ((this.schema.subtitlePadding = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.subtitlePadding;\n }\n\n /**\n The threshold value for bucketing small data points together.\n*/\n threshold(\n _?: number | ((data: DataPoint[]) => number),\n ): this | number | ((data: DataPoint[]) => number) {\n if (arguments.length) {\n if (typeof _ === \"function\") {\n this.schema.threshold = _;\n } else if (isFinite(_!) && !isNaN(_!)) {\n this.schema.threshold = constant(_! * 1);\n }\n return this;\n } else return this.schema.threshold;\n }\n\n /**\n Accessor for the value used in the threshold algorithm.\n @param key The data key used to group values for thresholding.\n*/\n thresholdKey(\n key?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]),\n ): this | string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) {\n if (arguments.length) {\n if (typeof key === \"function\") {\n this.schema.thresholdKey = key;\n } else {\n this.schema.thresholdKey = accessor(key!);\n }\n return this;\n } else return this.schema.thresholdKey;\n }\n\n /**\n The label displayed for bucketed threshold items.\n*/\n thresholdName(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | string | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this.schema.thresholdName = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.thresholdName;\n }\n\n /**\n Accessor function or string key for the time dimension of each data point.\n*/\n time(\n _?:\n | string\n | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint])\n | false,\n ):\n | this\n | string\n | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint])\n | false {\n if (arguments.length) {\n if (typeof _ === \"function\") {\n this.schema.time = _;\n } else if (_) {\n this.schema.time = accessor(_);\n if (!this.schema.aggs[_]) {\n this.schema.aggs[_] = (\n a: DataPoint[],\n c: (d: DataPoint) => DataPoint[keyof DataPoint],\n ) => {\n const v = unique(a.map(c));\n return v.length === 1 ? v[0] : v;\n };\n }\n if (\n this._userTime &&\n JSON.stringify(_) !== JSON.stringify(this._userTime)\n ) {\n this.schema.timeFilter = false;\n this._timelineSelection = false;\n }\n this._userTime = _;\n } else {\n this.schema.time = undefined;\n this._userTime = undefined;\n this.schema.timeFilter = false;\n this._timelineSelection = false;\n }\n return this;\n } else return this.schema.time;\n }\n\n /**\n Configuration object for the timeline.\n*/\n timelineConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.timelineConfig = assign(this.schema.timelineConfig, _!)), this)\n : this.schema.timelineConfig;\n }\n\n /**\n The starting time or range for the timeline. Can be a single Date/String, or an Array of 2 values representing the min and max.\n*/\n timelineDefault(_?: Date | string | (Date | string)[]): this | Date[] {\n if (arguments.length) {\n if (!(_ instanceof Array)) _ = [_!, _!];\n this.schema.timelineDefault = (_ as (Date | string)[])\n .map(d => date(d as string | number | false))\n .filter((d): d is Date => d !== false);\n return this;\n } else return this.schema.timelineDefault;\n }\n\n /**\n Tells the timeline whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the timeline appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n timelinePadding(\n _?: boolean | (() => boolean),\n ): this | boolean | (() => boolean) {\n return arguments.length\n ? ((this.schema.timelinePadding = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.timelinePadding;\n }\n\n /**\n Accessor function or string for the visualization's title.\n*/\n title(\n _?: string | ((data: DataPoint[]) => string),\n ): this | string | ((data: DataPoint[]) => string) {\n return arguments.length\n ? ((this.schema.title = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.title;\n }\n\n /**\n Configuration object for the title.\n*/\n titleConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.titleConfig = assign(this.schema.titleConfig, _!)), this)\n : this.schema.titleConfig;\n }\n\n /**\n Tells the title whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the title appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n titlePadding(\n _?: boolean | (() => boolean),\n ): this | boolean | (() => boolean) {\n return arguments.length\n ? ((this.schema.titlePadding = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.titlePadding;\n }\n\n /**\n Whether to display tooltips on hover.\n*/\n tooltip(\n _?: boolean | ((d: DataPoint, i: number) => boolean),\n ): this | boolean | ((d: DataPoint, i: number) => boolean) {\n return arguments.length\n ? ((this.schema.tooltip = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.tooltip;\n }\n\n /**\n Configuration object for the tooltip.\n*/\n tooltipConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.tooltipConfig = assign(this.schema.tooltipConfig, _!)), this)\n : this.schema.tooltipConfig;\n }\n\n /**\n Accessor function or string key for the total value displayed in the visualization.\n*/\n total(\n _?: boolean | string | ((d: DataPoint, i: number) => number),\n ): this | boolean | string | ((d: DataPoint, i: number) => number) {\n if (arguments.length) {\n if (typeof _ === \"function\") this.schema.total = _;\n else if (_) this.schema.total = accessor(_ as string);\n else this.schema.total = false;\n return this;\n } else return this.schema.total;\n }\n\n /**\n Configuration object for the total bar.\n*/\n totalConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.totalConfig = assign(this.schema.totalConfig, _!)), this)\n : this.schema.totalConfig;\n }\n\n /**\n Formatter function for the value in the total bar.\n*/\n totalFormat(_?: (d: number) => string): this | ((d: number) => string) {\n return arguments.length\n ? ((this.schema.totalFormat = _), this)\n : this.schema.totalFormat;\n }\n\n /**\n Tells the total whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the total appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n totalPadding(\n _?: boolean | (() => boolean),\n ): this | boolean | (() => boolean) {\n return arguments.length\n ? ((this.schema.totalPadding = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.totalPadding;\n }\n\n /**\n The pixel stroke-width of the zoom brush area.\n*/\n zoomBrushHandleSize(_?: number): this | number {\n return arguments.length\n ? ((this.schema.zoomBrushHandleSize = _), this)\n : this.schema.zoomBrushHandleSize;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style the outer handle area of the zoom brush. Passing `false` will remove all default styling.\n*/\n zoomBrushHandleStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomBrushHandleStyle = _), this)\n : this.schema.zoomBrushHandleStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style the inner selection area of the zoom brush. Passing `false` will remove all default styling.\n*/\n zoomBrushSelectionStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomBrushSelectionStyle = _), this)\n : this.schema.zoomBrushSelectionStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyle = _), this)\n : this.schema.zoomControlStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button when active (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyleActive(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyleActive = _), this)\n : this.schema.zoomControlStyleActive;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyleHover(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyleHover = _), this)\n : this.schema.zoomControlStyleHover;\n }\n\n /**\n A pixel value to be used to pad all sides of a zoomed area.\n*/\n zoomPadding(_?: number): this | number {\n return arguments.length\n ? ((this.schema.zoomPadding = _), this)\n : this.schema.zoomPadding;\n }\n\n}\n"],"names":["select","unique","assign","date","accessor","constant","VizBaseConfig","VizBase","loadingHTML","_","arguments","length","schema","loadingMessage","messageMask","messageStyle","noDataHTML","noDataMessage","scrollContainer","_select","shape","shapeConfig","subtitle","subtitleConfig","subtitlePadding","threshold","isFinite","isNaN","thresholdKey","key","thresholdName","time","aggs","a","c","v","map","_userTime","JSON","stringify","timeFilter","_timelineSelection","undefined","timelineConfig","timelineDefault","Array","d","filter","timelinePadding","title","titleConfig","titlePadding","tooltip","tooltipConfig","total","totalConfig","totalFormat","totalPadding","zoomBrushHandleSize","zoomBrushHandleStyle","zoomBrushSelectionStyle","zoomControlStyle","zoomControlStyleActive","zoomControlStyleHover","zoomPadding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,eAAe;AAEpC,SAAQC,MAAM,QAAO,eAAe;AACpC,SAAQC,MAAM,EAAEC,IAAI,QAAO,cAAc;AAGzC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AAExD,OAAOC,mBAAmB,qBAAqB;AAUhC,IAAA,AAAMC,wBAAN;;cAAMA;aAAAA;gCAAAA;QAAN,OAAA,kBAAMA;;kBAAAA;;YAEnB;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,YACEC,CAAuC;gBAEv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,CAACgD,uBAAuB;YACzC;;;YAEA;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,iBACEpD,CAAmC;gBAEnC,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACC,MAAM,CAACiD,gBAAgB,GAAGpD,GAAI,IAAI,AAAD,IACxC,IAAI,CAACG,MAAM,CAACiD,gBAAgB;YAClC;;;YAEA;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,uBACErD,CAAmC;gBAEnC,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACC,MAAM,CAACkD,sBAAsB,GAAGrD,GAAI,IAAI,AAAD,IAC9C,IAAI,CAACG,MAAM,CAACkD,sBAAsB;YACxC;;;YAEA;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,sBACEtD,CAAmC;gBAEnC,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACC,MAAM,CAACmD,qBAAqB,GAAGtD,GAAI,IAAI,AAAD,IAC7C,IAAI,CAACG,MAAM,CAACmD,qBAAqB;YACvC;;;YAEA;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,YAAYvD,CAAU;gBACpB,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACC,MAAM,CAACoD,WAAW,GAAGvD,GAAI,IAAI,AAAD,IACnC,IAAI,CAACG,MAAM,CAACoD,WAAW;YAC7B;;;WAvamBzD;EAAgBD;AARrC;;;;;;;AAOA,GACA,SAAqBC,qBAyapB"}
1
+ {"version":3,"sources":["../../../../src/charts/viz/VizBase.ts"],"sourcesContent":["import {select} from \"d3-selection\";\n\nimport {unique} from \"@d3plus/data\";\nimport {assign, date} from \"@d3plus/dom\";\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport {accessor, constant} from \"../../utils/index.js\";\nimport type {D3plusConfig} from \"../../utils/index.js\";\nimport VizBaseConfig from \"./VizBaseConfig.js\";\n\n/**\n Second half of the fluent config accessors shared by every Viz chart\n (`loadingHTML` through `zoomPadding`), extending `VizBaseConfig` which\n holds the first half. Split purely so each file stays under the\n `max-lines` budget; the methods remain real prototype methods, so\n `BaseClass.config()` reflection and polymorphic `this` chaining are\n unchanged.\n*/\nexport default class VizBase extends VizBaseConfig {\n\n /**\n The inner HTML of the status message displayed when loading AJAX requests and displaying errors. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.\n*/\n loadingHTML(\n _?: string | ((viz: VizBase) => string),\n ): this | string | ((viz: VizBase) => string) {\n return arguments.length\n ? ((this.schema.loadingHTML = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.loadingHTML;\n }\n\n /**\n Toggles the visibility of the status message that is displayed when loading AJAX requests and displaying errors.\n*/\n loadingMessage(_?: boolean): this | boolean {\n return arguments.length\n ? ((this.schema.loadingMessage = _), this)\n : this.schema.loadingMessage;\n }\n\n /**\n The color of the mask displayed underneath the status message when loading AJAX requests and displaying errors. Set to `false` to turn off the mask completely.\n*/\n messageMask(_?: string | boolean): this | string | boolean {\n return arguments.length\n ? ((this.schema.messageMask = _), this)\n : this.schema.messageMask;\n }\n\n /**\n Defines the CSS style properties for the status message that is displayed when loading AJAX requests and displaying errors.\n*/\n messageStyle(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.messageStyle = assign(this.schema.messageStyle, _!)), this)\n : this.schema.messageStyle;\n }\n\n /**\n The inner HTML of the status message displayed when no data is supplied to the visualization. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.\n*/\n noDataHTML(\n _?: string | ((viz: VizBase) => string),\n ): this | string | ((viz: VizBase) => string) {\n return arguments.length\n ? ((this.schema.noDataHTML = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.noDataHTML;\n }\n\n /**\n Toggles the visibility of the status message that is displayed when no data is supplied to the visualization.\n*/\n noDataMessage(_?: boolean): this | boolean {\n return arguments.length\n ? ((this.schema.noDataMessage = _), this)\n : this.schema.noDataMessage;\n }\n\n /**\n If using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.\n*/\n scrollContainer(\n _?: string | HTMLElement | Window,\n ): this | string | HTMLElement | Window {\n return arguments.length\n ? ((this.schema.scrollContainer = _), this)\n : this.schema.scrollContainer;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element. Defaults to `undefined`.\n*/\n select(_?: string | HTMLElement): this | ReturnType<typeof select> {\n return arguments.length\n ? ((this._select = select(_! as string)), this)\n : this._select;\n }\n\n /**\n Changes the primary shape used to represent each data point in a visualization. Not all visualizations support changing shapes, this method can be provided the String name of a D3plus shape class (for example, \"Rect\" or \"Circle\"), or an accessor Function that returns the String class name to be used for each individual data point.\n*/\n shape(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | string | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this.schema.shape = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.shape;\n }\n\n /**\n Configuration object with key/value pairs applied as method calls on each shape.\n*/\n shapeConfig(): D3plusConfig;\n shapeConfig(_: D3plusConfig): this;\n shapeConfig(_?: D3plusConfig): this | D3plusConfig {\n return arguments.length\n ? ((this.schema.shapeConfig = assign(this.schema.shapeConfig, _!)), this)\n : this.schema.shapeConfig;\n }\n\n /**\n Accessor function or string for the visualization's subtitle.\n*/\n subtitle(\n _?: string | ((data: DataPoint[]) => string),\n ): this | string | ((data: DataPoint[]) => string) {\n return arguments.length\n ? ((this.schema.subtitle = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.subtitle;\n }\n\n /**\n Configuration object for the subtitle.\n*/\n subtitleConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.subtitleConfig = assign(this.schema.subtitleConfig, _!)), this)\n : this.schema.subtitleConfig;\n }\n\n /**\n Tells the subtitle whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the subtitle appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n subtitlePadding(\n _?: boolean | ((viz: VizBase) => boolean),\n ): this | boolean | ((viz: VizBase) => boolean) {\n return arguments.length\n ? ((this.schema.subtitlePadding = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.subtitlePadding;\n }\n\n /**\n The threshold value for bucketing small data points together.\n*/\n threshold(\n _?: number | ((data: DataPoint[]) => number),\n ): this | number | ((data: DataPoint[]) => number) {\n if (arguments.length) {\n if (typeof _ === \"function\") {\n this.schema.threshold = _;\n } else if (isFinite(_!) && !isNaN(_!)) {\n this.schema.threshold = constant(_! * 1);\n }\n return this;\n } else return this.schema.threshold;\n }\n\n /**\n Accessor for the value used in the threshold algorithm.\n @param key The data key used to group values for thresholding.\n*/\n thresholdKey(\n key?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]),\n ): this | string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) {\n if (arguments.length) {\n if (typeof key === \"function\") {\n this.schema.thresholdKey = key;\n } else {\n this.schema.thresholdKey = accessor(key!);\n }\n return this;\n } else return this.schema.thresholdKey;\n }\n\n /**\n The label displayed for bucketed threshold items.\n*/\n thresholdName(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | string | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this.schema.thresholdName = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.thresholdName;\n }\n\n /**\n Accessor function or string key for the time dimension of each data point.\n*/\n time(\n _?:\n | string\n | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint])\n | false,\n ):\n | this\n | string\n | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint])\n | false {\n if (arguments.length) {\n if (typeof _ === \"function\") {\n this.schema.time = _;\n } else if (_) {\n this.schema.time = accessor(_);\n if (!this.schema.aggs[_]) {\n this.schema.aggs[_] = (\n a: DataPoint[],\n c: (d: DataPoint) => DataPoint[keyof DataPoint],\n ) => {\n const v = unique(a.map(c));\n return v.length === 1 ? v[0] : v;\n };\n }\n if (\n this._userTime &&\n JSON.stringify(_) !== JSON.stringify(this._userTime)\n ) {\n this.schema.timeFilter = false;\n this._timelineSelection = false;\n }\n this._userTime = _;\n } else {\n this.schema.time = undefined;\n this._userTime = undefined;\n this.schema.timeFilter = false;\n this._timelineSelection = false;\n }\n return this;\n } else return this.schema.time;\n }\n\n /**\n Configuration object for the timeline.\n*/\n timelineConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.timelineConfig = assign(this.schema.timelineConfig, _!)), this)\n : this.schema.timelineConfig;\n }\n\n /**\n The starting time or range for the timeline. Can be a single Date/String, or an Array of 2 values representing the min and max.\n*/\n timelineDefault(_?: Date | string | (Date | string)[]): this | Date[] {\n if (arguments.length) {\n if (!(_ instanceof Array)) _ = [_!, _!];\n this.schema.timelineDefault = (_ as (Date | string)[])\n .map(d => date(d as string | number | false))\n .filter((d): d is Date => d !== false);\n return this;\n } else return this.schema.timelineDefault;\n }\n\n /**\n Tells the timeline whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the timeline appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n timelinePadding(\n _?: boolean | ((viz: VizBase) => boolean),\n ): this | boolean | ((viz: VizBase) => boolean) {\n return arguments.length\n ? ((this.schema.timelinePadding = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this.schema.timelinePadding;\n }\n\n /**\n Accessor function or string for the visualization's title.\n*/\n title(\n _?: string | ((data: DataPoint[]) => string),\n ): this | string | ((data: DataPoint[]) => string) {\n return arguments.length\n ? ((this.schema.title = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.title;\n }\n\n /**\n Configuration object for the title.\n*/\n titleConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.titleConfig = assign(this.schema.titleConfig, _!)), this)\n : this.schema.titleConfig;\n }\n\n /**\n Tells the title whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the title appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n titlePadding(\n _?: boolean | ((viz: VizBase) => boolean),\n ): this | boolean | ((viz: VizBase) => boolean) {\n return arguments.length\n ? ((this.schema.titlePadding = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.titlePadding;\n }\n\n /**\n Whether to display tooltips on hover.\n*/\n tooltip(\n _?: boolean | ((d: DataPoint, i: number) => boolean),\n ): this | boolean | ((d: DataPoint, i: number) => boolean) {\n return arguments.length\n ? ((this.schema.tooltip = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.tooltip;\n }\n\n /**\n Configuration object for the tooltip.\n*/\n tooltipConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.tooltipConfig = assign(this.schema.tooltipConfig, _!)), this)\n : this.schema.tooltipConfig;\n }\n\n /**\n Accessor function or string key for the total value displayed in the visualization.\n*/\n total(\n _?: boolean | string | ((d: DataPoint, i: number) => number),\n ): this | boolean | string | ((d: DataPoint, i: number) => number) {\n if (arguments.length) {\n if (typeof _ === \"function\") this.schema.total = _;\n else if (_) this.schema.total = accessor(_ as string);\n else this.schema.total = false;\n return this;\n } else return this.schema.total;\n }\n\n /**\n Configuration object for the total bar.\n*/\n totalConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this.schema.totalConfig = assign(this.schema.totalConfig, _!)), this)\n : this.schema.totalConfig;\n }\n\n /**\n Formatter function for the value in the total bar.\n*/\n totalFormat(_?: (d: number) => string): this | ((d: number) => string) {\n return arguments.length\n ? ((this.schema.totalFormat = _), this)\n : this.schema.totalFormat;\n }\n\n /**\n Tells the total whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the total appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.\n*/\n totalPadding(\n _?: boolean | ((viz: VizBase) => boolean),\n ): this | boolean | ((viz: VizBase) => boolean) {\n return arguments.length\n ? ((this.schema.totalPadding = typeof _ === \"function\" ? _ : constant(_)), this)\n : this.schema.totalPadding;\n }\n\n /**\n The pixel stroke-width of the zoom brush area.\n*/\n zoomBrushHandleSize(_?: number): this | number {\n return arguments.length\n ? ((this.schema.zoomBrushHandleSize = _), this)\n : this.schema.zoomBrushHandleSize;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style the outer handle area of the zoom brush. Passing `false` will remove all default styling.\n*/\n zoomBrushHandleStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomBrushHandleStyle = _), this)\n : this.schema.zoomBrushHandleStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style the inner selection area of the zoom brush. Passing `false` will remove all default styling.\n*/\n zoomBrushSelectionStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomBrushSelectionStyle = _), this)\n : this.schema.zoomBrushSelectionStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyle(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyle = _), this)\n : this.schema.zoomControlStyle;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button when active (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyleActive(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyleActive = _), this)\n : this.schema.zoomControlStyleActive;\n }\n\n /**\n An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.\n*/\n zoomControlStyleHover(\n _?: Record<string, unknown> | false,\n ): this | Record<string, unknown> | false {\n return arguments.length\n ? ((this.schema.zoomControlStyleHover = _), this)\n : this.schema.zoomControlStyleHover;\n }\n\n /**\n A pixel value to be used to pad all sides of a zoomed area.\n*/\n zoomPadding(_?: number): this | number {\n return arguments.length\n ? ((this.schema.zoomPadding = _), this)\n : this.schema.zoomPadding;\n }\n\n}\n"],"names":["select","unique","assign","date","accessor","constant","VizBaseConfig","VizBase","loadingHTML","_","arguments","length","schema","loadingMessage","messageMask","messageStyle","noDataHTML","noDataMessage","scrollContainer","_select","shape","shapeConfig","subtitle","subtitleConfig","subtitlePadding","threshold","isFinite","isNaN","thresholdKey","key","thresholdName","time","aggs","a","c","v","map","_userTime","JSON","stringify","timeFilter","_timelineSelection","undefined","timelineConfig","timelineDefault","Array","d","filter","timelinePadding","title","titleConfig","titlePadding","tooltip","tooltipConfig","total","totalConfig","totalFormat","totalPadding","zoomBrushHandleSize","zoomBrushHandleStyle","zoomBrushSelectionStyle","zoomControlStyle","zoomControlStyleActive","zoomControlStyleHover","zoomPadding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,eAAe;AAEpC,SAAQC,MAAM,QAAO,eAAe;AACpC,SAAQC,MAAM,EAAEC,IAAI,QAAO,cAAc;AAGzC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AAExD,OAAOC,mBAAmB,qBAAqB;AAUhC,IAAA,AAAMC,wBAAN;;cAAMA;aAAAA;gCAAAA;QAAN,OAAA,kBAAMA;;kBAAAA;;YAEnB;;AAEF,GACEC,KAAAA;mBAAAA,SAAAA,YACEC,CAAuC;gBAEvC,OAAOC,UAAUC,MAAM,GAClB,CAAA,AAAC,IAAI,CAACC,MAAM,CAACJ,WAAW,GAAG,OAAOC,MAAM,aAAaA,IAAIJ,SAASI,IAAK,IAAI,AAAD,IAC3E,IAAI,CAACG,MAAM,CAACJ,WAAW;YAC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