@d3plus/core 4.2.0 → 4.5.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 (214) hide show
  1. package/README.md +2137 -953
  2. package/es/index.js +1 -1
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +7 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/AreaPlot/index.js +1 -2
  7. package/es/src/charts/AreaPlot/index.js.map +1 -1
  8. package/es/src/charts/BarChart/index.js +1 -2
  9. package/es/src/charts/BarChart/index.js.map +1 -1
  10. package/es/src/charts/BoxWhisker/index.js +1 -2
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  12. package/es/src/charts/BumpChart/index.js +1 -2
  13. package/es/src/charts/BumpChart/index.js.map +1 -1
  14. package/es/src/charts/Chord/applyLayout.js +205 -0
  15. package/es/src/charts/Chord/applyLayout.js.map +1 -0
  16. package/es/src/charts/Chord/emit.js +168 -0
  17. package/es/src/charts/Chord/emit.js.map +1 -0
  18. package/es/src/charts/Chord/index.js +234 -0
  19. package/es/src/charts/Chord/index.js.map +1 -0
  20. package/es/src/charts/Geomap/basemapTheme.js +78 -0
  21. package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
  22. package/es/src/charts/Geomap/emit.js +58 -9
  23. package/es/src/charts/Geomap/emit.js.map +1 -1
  24. package/es/src/charts/Geomap/index.js +93 -99
  25. package/es/src/charts/Geomap/index.js.map +1 -1
  26. package/es/src/charts/LinePlot/index.js +1 -2
  27. package/es/src/charts/LinePlot/index.js.map +1 -1
  28. package/es/src/charts/Matrix/emit.js +6 -0
  29. package/es/src/charts/Matrix/emit.js.map +1 -1
  30. package/es/src/charts/Matrix/index.js +1 -2
  31. package/es/src/charts/Matrix/index.js.map +1 -1
  32. package/es/src/charts/Network/emit.js +58 -24
  33. package/es/src/charts/Network/emit.js.map +1 -1
  34. package/es/src/charts/Network/index.js +34 -54
  35. package/es/src/charts/Network/index.js.map +1 -1
  36. package/es/src/charts/Pack/emit.js +3 -0
  37. package/es/src/charts/Pack/emit.js.map +1 -1
  38. package/es/src/charts/Pack/index.js +1 -2
  39. package/es/src/charts/Pack/index.js.map +1 -1
  40. package/es/src/charts/Pie/emit.js +6 -2
  41. package/es/src/charts/Pie/emit.js.map +1 -1
  42. package/es/src/charts/Pie/index.js +1 -2
  43. package/es/src/charts/Pie/index.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +99 -4
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/pipeline.js +25 -5
  47. package/es/src/charts/Plot/pipeline.js.map +1 -1
  48. package/es/src/charts/Plot/plotZoom.js +278 -0
  49. package/es/src/charts/Plot/plotZoom.js.map +1 -0
  50. package/es/src/charts/Priestley/emit.js +4 -0
  51. package/es/src/charts/Priestley/emit.js.map +1 -1
  52. package/es/src/charts/Priestley/index.js +1 -2
  53. package/es/src/charts/Priestley/index.js.map +1 -1
  54. package/es/src/charts/Radar/emit.js +4 -1
  55. package/es/src/charts/Radar/emit.js.map +1 -1
  56. package/es/src/charts/Radar/index.js +1 -2
  57. package/es/src/charts/Radar/index.js.map +1 -1
  58. package/es/src/charts/RadialMatrix/emit.js +6 -0
  59. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  60. package/es/src/charts/RadialMatrix/index.js +1 -2
  61. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  62. package/es/src/charts/Rings/emit.js +74 -8
  63. package/es/src/charts/Rings/emit.js.map +1 -1
  64. package/es/src/charts/Rings/index.js +11 -3
  65. package/es/src/charts/Rings/index.js.map +1 -1
  66. package/es/src/charts/Sankey/emit.js +55 -11
  67. package/es/src/charts/Sankey/emit.js.map +1 -1
  68. package/es/src/charts/Sankey/index.js +8 -2
  69. package/es/src/charts/Sankey/index.js.map +1 -1
  70. package/es/src/charts/StackedArea/index.js +1 -2
  71. package/es/src/charts/StackedArea/index.js.map +1 -1
  72. package/es/src/charts/Tree/emit.js +8 -2
  73. package/es/src/charts/Tree/emit.js.map +1 -1
  74. package/es/src/charts/Tree/index.js +1 -2
  75. package/es/src/charts/Tree/index.js.map +1 -1
  76. package/es/src/charts/Treemap/index.js +1 -2
  77. package/es/src/charts/Treemap/index.js.map +1 -1
  78. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  79. package/es/src/charts/drawSteps/backControl.js +70 -0
  80. package/es/src/charts/drawSteps/backControl.js.map +1 -0
  81. package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
  82. package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
  83. package/es/src/charts/drawSteps/minimap.js +370 -0
  84. package/es/src/charts/drawSteps/minimap.js.map +1 -0
  85. package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
  86. package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
  87. package/es/src/charts/drawSteps/searchControls.js +358 -0
  88. package/es/src/charts/drawSteps/searchControls.js.map +1 -0
  89. package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
  90. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
  91. package/es/src/charts/drawSteps/tableView.js +173 -0
  92. package/es/src/charts/drawSteps/tableView.js.map +1 -0
  93. package/es/src/charts/drawSteps/tableViewControl.js +39 -0
  94. package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
  95. package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
  96. package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
  97. package/es/src/charts/drawSteps/topLeftControls.js +73 -0
  98. package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
  99. package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
  100. package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
  101. package/es/src/charts/drawSteps/zoomControls.js +314 -175
  102. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  103. package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
  104. package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
  105. package/es/src/charts/features/attributionFeature.js +137 -0
  106. package/es/src/charts/features/attributionFeature.js.map +1 -0
  107. package/es/src/charts/features/axes.js +20 -8
  108. package/es/src/charts/features/axes.js.map +1 -1
  109. package/es/src/charts/features/chartGeometry.js +16 -2
  110. package/es/src/charts/features/chartGeometry.js.map +1 -1
  111. package/es/src/charts/features/edgeArrows.js +155 -0
  112. package/es/src/charts/features/edgeArrows.js.map +1 -0
  113. package/es/src/charts/features/emitHelpers.js +8 -0
  114. package/es/src/charts/features/emitHelpers.js.map +1 -1
  115. package/es/src/charts/features/ensureZoomDom.js +63 -12
  116. package/es/src/charts/features/ensureZoomDom.js.map +1 -1
  117. package/es/src/charts/features/features.js +83 -110
  118. package/es/src/charts/features/features.js.map +1 -1
  119. package/es/src/charts/features/featuresLegend.js +45 -17
  120. package/es/src/charts/features/featuresLegend.js.map +1 -1
  121. package/es/src/charts/features/plotPaint.js +32 -7
  122. package/es/src/charts/features/plotPaint.js.map +1 -1
  123. package/es/src/charts/features/shapeEmit.js +3 -1
  124. package/es/src/charts/features/shapeEmit.js.map +1 -1
  125. package/es/src/charts/features/zoomExtent.js +185 -0
  126. package/es/src/charts/features/zoomExtent.js.map +1 -0
  127. package/es/src/charts/helpers/tileAttributions.js +26 -0
  128. package/es/src/charts/helpers/tileAttributions.js.map +1 -1
  129. package/es/src/charts/index.js +1 -0
  130. package/es/src/charts/index.js.map +1 -1
  131. package/es/src/charts/pipeline/runVizPipeline.js +33 -14
  132. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  133. package/es/src/charts/pipeline/vizDrawPure.js +32 -6
  134. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  135. package/es/src/charts/viz/Viz.js +102 -61
  136. package/es/src/charts/viz/Viz.js.map +1 -1
  137. package/es/src/charts/viz/VizBase.js +157 -4
  138. package/es/src/charts/viz/VizBase.js.map +1 -1
  139. package/es/src/charts/viz/VizBaseConfig.js +32 -2
  140. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  141. package/es/src/charts/viz/interactionOpacity.js +4 -1
  142. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  143. package/es/src/charts/viz/vizDefaults.js +247 -51
  144. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  145. package/es/src/charts/viz/vizRender.js +7 -3
  146. package/es/src/charts/viz/vizRender.js.map +1 -1
  147. package/es/src/charts/viz/vizTypes.js.map +1 -1
  148. package/es/src/components/Axis/Axis.js +10 -1
  149. package/es/src/components/Axis/Axis.js.map +1 -1
  150. package/es/src/components/Axis/axisLayoutLabels.js +2 -1
  151. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  152. package/es/src/components/Axis/axisRender.js +5 -1
  153. package/es/src/components/Axis/axisRender.js.map +1 -1
  154. package/es/src/components/Legend/legendConfig.js +86 -20
  155. package/es/src/components/Legend/legendConfig.js.map +1 -1
  156. package/es/src/shapes/Shape.js +12 -10
  157. package/es/src/shapes/Shape.js.map +1 -1
  158. package/es/src/shapes/hitAreaNode.js +31 -5
  159. package/es/src/shapes/hitAreaNode.js.map +1 -1
  160. package/es/src/shapes/interactionPoints.js +30 -0
  161. package/es/src/shapes/interactionPoints.js.map +1 -0
  162. package/es/src/utils/D3plusConfig.js.map +1 -1
  163. package/package.json +11 -10
  164. package/types/index.d.ts +1 -1
  165. package/types/internal.d.ts +8 -1
  166. package/types/src/charts/Chord/applyLayout.d.ts +43 -0
  167. package/types/src/charts/Chord/emit.d.ts +10 -0
  168. package/types/src/charts/Chord/index.d.ts +19 -0
  169. package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
  170. package/types/src/charts/Plot/index.d.ts +32 -2
  171. package/types/src/charts/Plot/pipeline.d.ts +2 -1
  172. package/types/src/charts/Plot/plotZoom.d.ts +65 -0
  173. package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
  174. package/types/src/charts/drawSteps/backControl.d.ts +29 -0
  175. package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
  176. package/types/src/charts/drawSteps/minimap.d.ts +19 -0
  177. package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
  178. package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
  179. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
  180. package/types/src/charts/drawSteps/tableView.d.ts +23 -0
  181. package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
  182. package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
  183. package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
  184. package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
  185. package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
  186. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
  187. package/types/src/charts/features/attributionFeature.d.ts +21 -0
  188. package/types/src/charts/features/axes.d.ts +1 -1
  189. package/types/src/charts/features/chartGeometry.d.ts +9 -3
  190. package/types/src/charts/features/edgeArrows.d.ts +92 -0
  191. package/types/src/charts/features/emitHelpers.d.ts +11 -0
  192. package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
  193. package/types/src/charts/features/features.d.ts +32 -17
  194. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  195. package/types/src/charts/features/plotPaint.d.ts +15 -2
  196. package/types/src/charts/features/zoomExtent.d.ts +25 -0
  197. package/types/src/charts/index.d.ts +1 -0
  198. package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
  199. package/types/src/charts/viz/Viz.d.ts +31 -1
  200. package/types/src/charts/viz/VizBase.d.ts +86 -4
  201. package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
  202. package/types/src/charts/viz/vizDefaults.d.ts +155 -0
  203. package/types/src/charts/viz/vizTypes.d.ts +75 -1
  204. package/types/src/components/Axis/Axis.d.ts +2 -0
  205. package/types/src/shapes/Shape.d.ts +2 -2
  206. package/types/src/shapes/hitAreaNode.d.ts +5 -4
  207. package/types/src/shapes/interactionPoints.d.ts +15 -0
  208. package/types/src/utils/D3plusConfig.d.ts +102 -8
  209. package/umd/d3plus-core.full.js +39793 -34875
  210. package/umd/d3plus-core.full.js.map +1 -1
  211. package/umd/d3plus-core.full.min.js +5836 -4264
  212. package/umd/d3plus-core.js +13998 -9927
  213. package/umd/d3plus-core.js.map +1 -1
  214. package/umd/d3plus-core.min.js +3716 -2264
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/D3plusConfig.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\n\nimport type VizBase from \"../charts/viz/VizBase.js\";\nimport type {AccessorFn} from \"./AccessorFn.js\";\n\ntype Position = \"top\" | \"right\" | \"bottom\" | \"left\";\n\ntype DataPointAccessor<T> = string | ((d: DataPoint) => T);\n\n/** A config value that is either a constant or a `(datum, index)` accessor. */\ntype Accessor<T> = T | ((d: DataPoint, i?: number) => T);\n\ntype AxisScale =\n | \"auto\"\n | \"band\"\n | \"diverging\"\n | \"divergingLog\"\n | \"divergingPow\"\n | \"divergingSqrt\"\n | \"divergingSymlog\"\n | \"identity\"\n | \"implicit\"\n | \"jenks\"\n | \"linear\"\n | \"log\"\n | \"ordinal\"\n | \"point\"\n | \"pow\"\n | \"quantile\"\n | \"quantize\"\n | \"radial\"\n | \"sequential\"\n | \"sequentialLog\"\n | \"sequentialPow\"\n | \"sequentialQuantile\"\n | \"sequentialSqrt\"\n | \"sequentialSymlog\"\n | \"sqrt\"\n | \"symlog\"\n | \"threshold\"\n | \"time\"\n | \"utc\";\n\nexport interface AxisConfig {\n barConfig?: Record<string, string | number>;\n /** Grid values of the axis. */\n grid?: unknown[];\n gridConfig?: Record<string, string | number>;\n /** Grid size of the axis. */\n gridSize?: number;\n label?: string;\n /** Visible tick labels of the axis. */\n labels?: unknown[];\n labelOffset?: false | number;\n /** Maximum size allowed for the space that contains the axis tick labels and title. */\n maxSize?: number;\n /** Minimum size alloted for the space that contains the axis tick labels and title. */\n minSize?: number;\n /**\n Scale range (in pixels) of the axis. The given array must have 2 values,\n but one may be `undefined` to allow the default behavior for that value.\n */\n range?: (number | undefined)[];\n /** Scale of the axis. */\n scale?: AxisScale;\n /** Tick formatter. */\n tickFormat?: (d: number | string) => string | number;\n /** Tick values of the axis. */\n ticks?: unknown[];\n tickSize?: number;\n /**\n Defines a custom locale object to be used in time scales. Must include\n `dateTime`, `date`, `time`, `periods`, `days`, `shortDays`, `months`, and\n `shortMonths` (see\n [d3-time-format](https://github.com/d3/d3-time-format/blob/master/README.md#timeFormatLocale)).\n */\n timeLocale?: Record<string, unknown>;\n /** Title of the axis. */\n title?: string;\n}\n\nexport interface TooltipConfig {\n /** The inner HTML content of the arrow element, empty by default. */\n arrow?: ((d: DataPoint) => string) | string;\n /** The background color accessor for each tooltip. */\n background?: ((d: DataPoint) => string) | string;\n /** The border accessor for each tooltip. */\n border?: ((d: DataPoint) => string) | string;\n /** The border-radius accessor for each tooltip. */\n borderRadius?: ((d: DataPoint) => string) | string;\n /** The footer content accessor for each tooltip. */\n footer?: ((d: DataPoint) => string) | string;\n /** The max-width accessor for each tooltip. */\n maxWidth?: ((d: DataPoint) => string | number) | string | number;\n /** The min-width accessor for each tooltip. */\n minWidth?: ((d: DataPoint) => string | number) | string | number;\n /** The pixel offset between the tooltip and its anchor point. */\n offset?: ((d: DataPoint) => number) | number;\n /** The inner padding of each tooltip. */\n padding?: ((d: DataPoint) => string | number) | string | number;\n title?: ((d: DataPoint) => string) | string;\n body?: ((d: DataPoint) => string) | string;\n thead?:\n | ((d: DataPoint) => [string, string][])\n | Array<\n Array<\n | ((d: DataPoint, i?: number, x?: {share: number}) => string)\n | string\n >\n >;\n tbody?:\n | ((d: DataPoint) => [string, string][])\n | Array<\n Array<\n | ((d: DataPoint, i?: number, x?: {share: number}) => string)\n | string\n >\n >;\n}\n\nexport interface TextBoxConfig {\n /** The text content for each box. */\n text?: Accessor<string>;\n /** The font color as an accessor function or static string. Inferred from the DOM selection by default. */\n fontColor?: Accessor<string>;\n /** The font size in pixels. Inferred from the DOM selection by default. */\n fontSize?: Accessor<number>;\n /**\n The font-family to use: a font name, a comma-separated list of fallbacks,\n an array of fallbacks, or an accessor returning a string or array. The\n first available font on the client is used.\n */\n fontFamily?: Accessor<string | string[]>;\n /** The font weight. Inferred from the DOM selection by default. */\n fontWeight?: Accessor<string | number>;\n /** The minimum font size in pixels, used when dynamically resizing fonts. */\n fontMin?: number;\n /** The maximum font size in pixels, used when dynamically resizing fonts. */\n fontMax?: number;\n /** Toggles font resizing — a static boolean, or an accessor returning a boolean. */\n fontResize?: Accessor<boolean>;\n /** The font opacity as an accessor function or static number between 0 and 1. */\n fontOpacity?: Accessor<number>;\n /** The font stroke color for the rendered text. */\n fontStroke?: Accessor<string>;\n /** The font stroke width for the rendered text. */\n fontStrokeWidth?: Accessor<number>;\n /** The line height, which is 1.2 times the font size by default. */\n lineHeight?: Accessor<number>;\n /** Restricts the maximum number of lines to wrap onto; null (unlimited) by default. */\n maxLines?: Accessor<number | null>;\n /** Whether text is allowed to overflow its bounding box. */\n overflow?: Accessor<boolean>;\n /**\n Handles truncated lines, returning the new line value. Passed the line's\n text and number; by default appends an ellipsis to every line except a\n first word that cannot fit (which returns \"\").\n */\n ellipsis?: (text: string, line: number) => string;\n /** The padding as a CSS shorthand string or number. Defaults to 0. */\n padding?: Accessor<string | number>;\n /** The anchor point around which to rotate the text box. */\n rotateAnchor?: Accessor<[number, number]>;\n /** The word split function: given a string, returns it split into an array of words. */\n split?: (text: string) => string[];\n /** The width for each text box. */\n width?: Accessor<number>;\n /** The height for each text box. */\n height?: Accessor<number>;\n /** The x position (left edge) for each text box. */\n x?: Accessor<number>;\n /** The y position (top edge) for each text box. */\n y?: Accessor<number>;\n}\n\nexport interface TimelineConfig {\n /** Brush event filter. */\n brushFilter?: () => boolean;\n /**\n The minimum number of ticks that can be highlighted when using \"ticks\"\n `buttonBehavior`. Helpful for x/y plots where selecting fewer than 2 time\n periods is undesirable.\n */\n brushMin?: number;\n /** Toggles the horizontal alignment of the button timeline. */\n buttonAlign?: \"start\" | \"middle\" | \"end\";\n /** Toggles the style of the timeline. */\n buttonBehavior?: \"auto\" | \"buttons\" | \"ticks\";\n /** Button height. */\n buttonHeight?: number;\n /** Button padding. */\n buttonPadding?: number;\n /** Handle style. */\n handleConfig?: Record<string, unknown>;\n /** Handle size. */\n handleSize?: number;\n /**\n Determines the visibility of the play button to the left of the timeline,\n which cycles through the available periods at a rate set by `playButtonInterval`.\n */\n playButton?: boolean;\n /**\n The interval, in milliseconds, between periods when cycling via the play\n button. Used only when the chart's `duration` is 0 (no transition);\n otherwise playback steps once per `duration` so each step animates in full.\n */\n playButtonInterval?: number;\n /** The current selection. Defaults to the most recent period in the timeline. */\n selection?: (Date | number)[] | Date | number | false;\n /** Toggles the snapping value. */\n snapping?: boolean;\n}\n\nexport interface LegendConfig {\n /** The active method for all shapes. */\n active?: ((d: DataPoint, i?: number) => boolean) | false;\n /** The hover method for all shapes. */\n hover?: ((d: DataPoint, i?: number) => boolean) | false;\n /** The shape type used for each legend entry. */\n shape?: Accessor<string>;\n}\n\nexport interface ColorScaleConfig {\n /**\n For a linear scale, the `[min, max]` values used by the color scale; values\n outside this range map to the nearest color.\n */\n domain?: number[];\n /**\n Formats the label for each bucket in a bucket-type scale (\"jenks\",\n \"quantile\", …). Passed the bucket's start value, its index, the full\n bucket array, and every data value used to build the buckets.\n */\n bucketFormat?: (\n start: number,\n i: number,\n buckets: number[],\n values: number[],\n ) => string;\n /** Given a bucket's minimum and maximum values, returns the full label. */\n bucketJoiner?: (min: string, max: string) => string;\n}\n\nexport interface D3plusConfig {\n /** Data array or URL string to load data from. */\n data?: DataPoint[] | string;\n /** Locale code used for text and number formatting. */\n locale?: string;\n\n /** The active callback function for highlighting shapes. */\n active?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Custom aggregation functions keyed by data property. */\n aggs?: {[k: string]: (d: DataPoint[]) => unknown};\n /** Hides the SVG from assistive technology when true (`aria-hidden`). */\n ariaHidden?: boolean;\n /** Padding between bars in pixels. */\n barPadding?: number;\n /** The baseline for the x/y plot. */\n baseline?: number;\n /** Whether to cache the processed data between renders. */\n cache?: boolean;\n /** Treat a discrete color field as ordered: color it with a single-hue light→dark ramp instead of nominal categorical hues. */\n colorOrdinal?: boolean;\n /** Color scale key or custom color function. */\n colorScale?: string | ((d: number) => string);\n /** Configuration for the color scale component. */\n colorScaleConfig?: {\n axisConfig?: AxisConfig;\n centered?: boolean;\n colors?: string[];\n colorMin?: string;\n colorMid?: string;\n colorMax?: string;\n scale?: AxisScale;\n };\n /** Whether the color scale uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n colorScalePadding?: boolean | ((viz: VizBase) => boolean);\n /** Position of the color scale, `false` to hide it, or an accessor returning either. */\n colorScalePosition?: false | Position | (() => false | Position);\n /** Column key for matrix-style layouts. */\n column?: string;\n /**\n The confidence interval as `[lower, upper]` bounds — each given as an\n accessor function or a static data key (e.g. `[\"lci\", \"hci\"]`), or `false`\n to disable.\n */\n confidence?:\n | [\n string | ((d: DataPoint, i: number) => number),\n string | ((d: DataPoint, i: number) => number),\n ]\n | false;\n /** Maximum number of data points to render before downsampling. */\n dataCutoff?: number;\n /** Active depth level for nested groupings. */\n depth?: number;\n /** Sets orientation of main category axis. */\n discrete?: \"x\" | \"y\";\n /** Default duration of transitions, in milliseconds. */\n duration?: number;\n /** Predicate filtering which data points are included, or false to disable. */\n filter?: ((d: DataPoint, i: number) => boolean) | false;\n /** Allows removing specific geographies from topojson file to improve zoom. */\n fitFilter?:\n | number\n | string\n | ((d: Record<string, unknown>) => boolean);\n /** Grouping key(s) or accessor function(s). */\n groupBy?:\n | string\n | string[]\n | ((d: DataPoint) => string | number)\n | ((d: DataPoint) => string | number)[];\n /** Padding between groups of bars in pixels. */\n groupPadding?: number;\n /** Overall height of the visualization in pixels. */\n height?: number;\n /** Color for legend shapes whose grouping is hidden (via legend click), or a `(datum, index)` accessor. */\n hiddenColor?: string | ((d: DataPoint, i: number) => string);\n /** Opacity for legend labels whose grouping is hidden (via legend click), or a `(datum, index)` accessor. */\n hiddenOpacity?: number | ((d: DataPoint, i: number) => number);\n /** The hover callback function for highlighting shapes on mouseover. */\n hover?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Persistently emphasizes matching marks (keep color) and grays the rest. */\n highlight?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Label accessor for shapes. */\n label?: string | string[] | false | AccessorFn;\n /**\n Controls legend visibility. Pass `false` to hide it, `true` to always\n show it, or a `(config, data) => boolean` accessor to decide dynamically\n — the chart defaults use an accessor to auto-hide the legend when it\n would be redundant.\n */\n legend?: boolean | ((config: D3plusConfig, arr: DataPoint[]) => boolean);\n /** Configuration for the legend component. */\n legendConfig?: {\n label?: DataPointAccessor<string>;\n shapeConfig?: Record<string, string | number>;\n };\n /** Inverts legend click behavior (click hides / shift-click solos, or the reverse), or an accessor receiving the viz. */\n legendFilterInvert?: boolean | ((viz: VizBase) => boolean);\n /** Whether the legend uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n legendPadding?: boolean | ((viz: VizBase) => boolean);\n /** Position of the legend, or an accessor returning it. */\n legendPosition?: Position | (() => Position);\n /** Custom sort comparator for legend items. */\n legendSort?: (a: DataPoint, b: DataPoint) => number;\n /** Tooltip configuration for legend items. */\n legendTooltip?: TooltipConfig;\n /** Whether to show labels on line charts. */\n lineLabels?: boolean;\n /** Whether to show the loading message. */\n loadingMessage?: boolean;\n /** Custom HTML content for the loading indicator, or a function receiving the viz instance. */\n loadingHTML?: string | ((viz: VizBase) => string);\n /** Metric key for the visualization. */\n metric?: string;\n /** Custom HTML content shown when no data is supplied, or a function receiving the viz instance. */\n noDataHTML?: string | ((viz: VizBase) => string);\n /** Ocean color for geomaps (any CSS value including 'transparent'). */\n ocean?: string;\n /** Event listeners keyed by event name. */\n on?: Record<string, (event: Event) => void>;\n /** Coordinate accessor for point-based geomaps. */\n point?: (d: DataPoint) => number[];\n /** Point size accessor for geomaps. */\n pointSize?: string | ((d: DataPoint) => number);\n /** Minimum point size for geomaps. */\n pointSizeMin?: number;\n /** Maximum point size for geomaps. */\n pointSizeMax?: number;\n /** Map projection name or function. */\n projection?: string | ((x: number, y: number) => [number, number]);\n /** Outer padding between the visualization edge and map shapes. */\n projectionPadding?: number | string;\n /** Rotation offset for the map projection center. */\n projectionRotate?: [number, number];\n /** Row key for matrix-style layouts. */\n row?: string;\n /** Scrollable container selector for tooltip positioning. */\n scrollContainer?: string | Window;\n /** Configuration for shape rendering. */\n shapeConfig?: {\n duration?: number;\n [key: string]: unknown;\n };\n /**\n A [sort comparator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n that receives each shape class (e.g. \"Circle\", \"Line\") as its arguments.\n Shapes are drawn in groups by type, so this defines the layering order for\n all shapes of a given type.\n */\n shapeSort?: (a: string, b: string) => number;\n /** Size accessor key. */\n size?: string;\n /** Whether to stack series. */\n stacked?: boolean;\n /**\n Vertical offset applied to stacked series. One of `\"diverging\"`\n (default — positive and negative values split around zero), `\"none\"`,\n `\"expand\"` (normalize each stack to 100%), `\"silhouette\"` (streamgraph),\n or `\"wiggle\"` (minimize slope changes); or a custom offset function.\n */\n stackOffset?: string | ((series: number[][][], order: number[]) => void);\n /**\n Order of stacked series, from the bottom of the stack upward. Accepts a\n named order (`\"descending\"` [default] / `\"ascending\"` by summed value,\n `\"key\"` / `\"keyReverse\"` alphabetically, `\"none\"` / `\"data\"` for input\n order, or d3's `\"insideOut\"` / `\"appearance\"` / `\"reverse\"`), an Array of\n series keys for an explicit order, a value accessor, or a `{value, order}`\n config to rank series by an aggregate of any data field.\n */\n stackOrder?:\n | string\n | string[]\n | {value: string | ((d: DataPoint) => unknown); order?: \"ascending\" | \"descending\"}\n | ((d: DataPoint) => unknown);\n /** Subtitle text, or an accessor returning it. */\n subtitle?: string | ((data: DataPoint[]) => string);\n /** Whether the subtitle uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n subtitlePadding?: boolean | ((viz: VizBase) => boolean);\n /** Value accessor for treemaps and aggregation. */\n sum?: DataPointAccessor<number>;\n /** Accessible description applied to the root SVG (`<desc>`). */\n svgDesc?: string;\n /** Accessible title applied to the root SVG (`<title>`). */\n svgTitle?: string;\n /** Threshold value for grouping small slices. */\n threshold?: number;\n /** Label for the threshold group, or a `(datum, index)` accessor. */\n thresholdName?: string | ((d: DataPoint, i: number) => string);\n /** URL to XYZ map tiles. */\n tileUrl?: string;\n /** Whether to show map tiles. */\n tiles?: boolean;\n /** Time key for temporal data. */\n time?: string;\n /** Predicate filtering which time slices are shown, or false to disable. */\n timeFilter?: ((d: DataPoint, i: number) => boolean) | false;\n /** Whether to show the timeline component. */\n timeline?: boolean;\n /** Whether the timeline uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n timelinePadding?: boolean | ((viz: VizBase) => boolean);\n /** Chart title or title accessor function. */\n title?: string | ((data: DataPoint[]) => string);\n /** CSS style configuration for the title. */\n titleConfig?: Record<string, string | number>;\n /** Whether the title uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n titlePadding?: boolean | ((viz: VizBase) => boolean);\n /** Whether to show tooltips, or a `(datum, index)` accessor deciding per mark. */\n tooltip?: boolean | ((d: DataPoint, i: number) => boolean);\n /** Configuration for the tooltip component. */\n tooltipConfig?: TooltipConfig;\n /** Path or object for the topojson data. */\n topojson?: string | object;\n /** CSS color to fill the map shapes. */\n topojsonFill?: string;\n /** Accessor function for topojson feature IDs. */\n topojsonId?: (obj: Record<string, unknown>) => string;\n /** Whether the total uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n totalPadding?: boolean | ((viz: VizBase) => boolean);\n /** Value accessor for the visualization. */\n value?: DataPointAccessor<number>;\n /** Overall width of the visualization in pixels. */\n width?: number;\n /** Key, index, or accessor function for x-axis values. */\n x?: string | number | ((d: DataPoint, i: number) => unknown);\n /** Configuration for the x-axis. */\n xConfig?: AxisConfig;\n /** The x domain as an array. If either value is undefined, it is calculated from the data. */\n xDomain?: (number | Date)[];\n /** The x2 domain as an array. If either value is undefined, it is calculated from the data. */\n x2Domain?: (number | Date)[];\n /** Custom sort function for x-axis values. */\n xSort?: (a: DataPoint, b: DataPoint) => number;\n /** Defines a custom sorting comparator function for discrete x2 axes. */\n x2Sort?: (a: DataPoint, b: DataPoint) => number;\n /** Key, index, or accessor function for y-axis values. */\n y?: string | number | ((d: DataPoint, i: number) => unknown);\n /** Configuration for the y-axis. */\n yConfig?: AxisConfig;\n /** The y domain as an array. If either value is undefined, it is calculated from the data. */\n yDomain?: (number | Date)[];\n /** The y2 domain as an array. If either value is undefined, it is calculated from the data. */\n y2Domain?: (number | Date)[];\n /** Custom sort function for y-axis values. */\n ySort?: (a: DataPoint, b: DataPoint) => number;\n /** Defines a custom sorting comparator function for discrete y2 axes. */\n y2Sort?: (a: DataPoint, b: DataPoint) => number;\n /** Set to false to disable zooming on Geomap and Network. */\n zoom?: boolean;\n /** Multiplier applied to programmatic zoom steps. */\n zoomFactor?: number;\n /** Maximum zoom scale factor. */\n zoomMax?: number;\n /** Whether panning (drag) is enabled while zoomed. */\n zoomPan?: boolean;\n /** Whether scroll-wheel zooming is enabled. */\n zoomScroll?: boolean;\n\n /** Allows additional custom properties. */\n [key: string]: unknown;\n}\n"],"names":[],"mappings":"AAmPA,WAmQC"}
1
+ {"version":3,"sources":["../../../src/utils/D3plusConfig.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\n\nimport type VizBase from \"../charts/viz/VizBase.js\";\nimport type {AccessorFn} from \"./AccessorFn.js\";\n\ntype Position = \"top\" | \"right\" | \"bottom\" | \"left\";\n\ntype DataPointAccessor<T> = string | ((d: DataPoint) => T);\n\n/** A config value that is either a constant or a `(datum, index)` accessor. */\ntype Accessor<T> = T | ((d: DataPoint, i?: number) => T);\n\ntype AxisScale =\n | \"auto\"\n | \"band\"\n | \"diverging\"\n | \"divergingLog\"\n | \"divergingPow\"\n | \"divergingSqrt\"\n | \"divergingSymlog\"\n | \"identity\"\n | \"implicit\"\n | \"jenks\"\n | \"linear\"\n | \"log\"\n | \"ordinal\"\n | \"point\"\n | \"pow\"\n | \"quantile\"\n | \"quantize\"\n | \"radial\"\n | \"sequential\"\n | \"sequentialLog\"\n | \"sequentialPow\"\n | \"sequentialQuantile\"\n | \"sequentialSqrt\"\n | \"sequentialSymlog\"\n | \"sqrt\"\n | \"symlog\"\n | \"threshold\"\n | \"time\"\n | \"utc\";\n\nexport interface AxisConfig {\n barConfig?: Record<string, string | number>;\n /** Grid values of the axis. */\n grid?: unknown[];\n gridConfig?: Record<string, string | number>;\n /** Grid size of the axis. */\n gridSize?: number;\n label?: string;\n /** Visible tick labels of the axis. */\n labels?: unknown[];\n labelOffset?: false | number;\n /**\n Exact size of the space that contains the axis tick labels and title.\n Labels that need more room overflow outward instead of moving the axis\n line; zooming pins a rescaled axis this way so it doesn't shift.\n */\n fixedSize?: number;\n /** Maximum size allowed for the space that contains the axis tick labels and title. */\n maxSize?: number;\n /** Minimum size alloted for the space that contains the axis tick labels and title. */\n minSize?: number;\n /**\n Scale range (in pixels) of the axis. The given array must have 2 values,\n but one may be `undefined` to allow the default behavior for that value.\n */\n range?: (number | undefined)[];\n /** Scale of the axis. */\n scale?: AxisScale;\n /** Tick formatter. */\n tickFormat?: (d: number | string) => string | number;\n /** Tick values of the axis. */\n ticks?: unknown[];\n /**\n Whether the domain's min and max are always shown as ticks, even when\n they aren't among the scale's own \"nice\" tick values (the nearest nice\n tick is dropped when it would crowd them). Defaults to `true`; zooming\n turns it off so a rescaled axis shows only nice values.\n */\n domainTicks?: boolean;\n tickSize?: number;\n /**\n Defines a custom locale object to be used in time scales. Must include\n `dateTime`, `date`, `time`, `periods`, `days`, `shortDays`, `months`, and\n `shortMonths` (see\n [d3-time-format](https://github.com/d3/d3-time-format/blob/master/README.md#timeFormatLocale)).\n */\n timeLocale?: Record<string, unknown>;\n /** Title of the axis. */\n title?: string;\n}\n\nexport interface TooltipConfig {\n /** The inner HTML content of the arrow element, empty by default. */\n arrow?: ((d: DataPoint) => string) | string;\n /** The background color accessor for each tooltip. */\n background?: ((d: DataPoint) => string) | string;\n /** The border accessor for each tooltip. */\n border?: ((d: DataPoint) => string) | string;\n /** The border-radius accessor for each tooltip. */\n borderRadius?: ((d: DataPoint) => string) | string;\n /** The footer content accessor for each tooltip. */\n footer?: ((d: DataPoint) => string) | string;\n /** The max-width accessor for each tooltip. */\n maxWidth?: ((d: DataPoint) => string | number) | string | number;\n /** The min-width accessor for each tooltip. */\n minWidth?: ((d: DataPoint) => string | number) | string | number;\n /** The pixel offset between the tooltip and its anchor point. */\n offset?: ((d: DataPoint) => number) | number;\n /** The inner padding of each tooltip. */\n padding?: ((d: DataPoint) => string | number) | string | number;\n title?: ((d: DataPoint) => string) | string;\n body?: ((d: DataPoint) => string) | string;\n thead?:\n | ((d: DataPoint) => [string, string][])\n | Array<\n Array<\n | ((d: DataPoint, i?: number, x?: {share: number}) => string)\n | string\n >\n >;\n tbody?:\n | ((d: DataPoint) => [string, string][])\n | Array<\n Array<\n | ((d: DataPoint, i?: number, x?: {share: number}) => string)\n | string\n >\n >;\n}\n\nexport interface TextBoxConfig {\n /** The text content for each box. */\n text?: Accessor<string>;\n /** The font color as an accessor function or static string. Inferred from the DOM selection by default. */\n fontColor?: Accessor<string>;\n /** The font size in pixels. Inferred from the DOM selection by default. */\n fontSize?: Accessor<number>;\n /**\n The font-family to use: a font name, a comma-separated list of fallbacks,\n an array of fallbacks, or an accessor returning a string or array. The\n first available font on the client is used.\n */\n fontFamily?: Accessor<string | string[]>;\n /** The font weight. Inferred from the DOM selection by default. */\n fontWeight?: Accessor<string | number>;\n /** The minimum font size in pixels, used when dynamically resizing fonts. */\n fontMin?: number;\n /** The maximum font size in pixels, used when dynamically resizing fonts. */\n fontMax?: number;\n /** Toggles font resizing — a static boolean, or an accessor returning a boolean. */\n fontResize?: Accessor<boolean>;\n /** The font opacity as an accessor function or static number between 0 and 1. */\n fontOpacity?: Accessor<number>;\n /** The font stroke color for the rendered text. */\n fontStroke?: Accessor<string>;\n /** The font stroke width for the rendered text. */\n fontStrokeWidth?: Accessor<number>;\n /** The line height, which is 1.2 times the font size by default. */\n lineHeight?: Accessor<number>;\n /** Restricts the maximum number of lines to wrap onto; null (unlimited) by default. */\n maxLines?: Accessor<number | null>;\n /** Whether text is allowed to overflow its bounding box. */\n overflow?: Accessor<boolean>;\n /**\n Handles truncated lines, returning the new line value. Passed the line's\n text and number; by default appends an ellipsis to every line except a\n first word that cannot fit (which returns \"\").\n */\n ellipsis?: (text: string, line: number) => string;\n /** The padding as a CSS shorthand string or number. Defaults to 0. */\n padding?: Accessor<string | number>;\n /** The anchor point around which to rotate the text box. */\n rotateAnchor?: Accessor<[number, number]>;\n /** The word split function: given a string, returns it split into an array of words. */\n split?: (text: string) => string[];\n /** The width for each text box. */\n width?: Accessor<number>;\n /** The height for each text box. */\n height?: Accessor<number>;\n /** The x position (left edge) for each text box. */\n x?: Accessor<number>;\n /** The y position (top edge) for each text box. */\n y?: Accessor<number>;\n}\n\nexport interface TimelineConfig {\n /** Brush event filter. */\n brushFilter?: () => boolean;\n /**\n The minimum number of ticks that can be highlighted when using \"ticks\"\n `buttonBehavior`. Helpful for x/y plots where selecting fewer than 2 time\n periods is undesirable.\n */\n brushMin?: number;\n /** Toggles the horizontal alignment of the button timeline. */\n buttonAlign?: \"start\" | \"middle\" | \"end\";\n /** Toggles the style of the timeline. */\n buttonBehavior?: \"auto\" | \"buttons\" | \"ticks\";\n /** Button height. */\n buttonHeight?: number;\n /** Button padding. */\n buttonPadding?: number;\n /** Handle style. */\n handleConfig?: Record<string, unknown>;\n /** Handle size. */\n handleSize?: number;\n /**\n Determines the visibility of the play button to the left of the timeline,\n which cycles through the available periods at a rate set by `playButtonInterval`.\n */\n playButton?: boolean;\n /**\n The interval, in milliseconds, between periods when cycling via the play\n button. Used only when the chart's `duration` is 0 (no transition);\n otherwise playback steps once per `duration` so each step animates in full.\n */\n playButtonInterval?: number;\n /** The current selection. Defaults to the most recent period in the timeline. */\n selection?: (Date | number)[] | Date | number | false;\n /** Toggles the snapping value. */\n snapping?: boolean;\n}\n\nexport interface LegendConfig {\n /** The active method for all shapes. */\n active?: ((d: DataPoint, i?: number) => boolean) | false;\n /** The hover method for all shapes. */\n hover?: ((d: DataPoint, i?: number) => boolean) | false;\n /** The shape type used for each legend entry. */\n shape?: Accessor<string>;\n}\n\nexport interface ColorScaleConfig {\n /**\n For a linear scale, the `[min, max]` values used by the color scale; values\n outside this range map to the nearest color.\n */\n domain?: number[];\n /**\n Formats the label for each bucket in a bucket-type scale (\"jenks\",\n \"quantile\", …). Passed the bucket's start value, its index, the full\n bucket array, and every data value used to build the buckets.\n */\n bucketFormat?: (\n start: number,\n i: number,\n buckets: number[],\n values: number[],\n ) => string;\n /** Given a bucket's minimum and maximum values, returns the full label. */\n bucketJoiner?: (min: string, max: string) => string;\n}\n\nexport interface D3plusConfig {\n /** Data array or URL string to load data from. */\n data?: DataPoint[] | string;\n /** Locale code used for text and number formatting. */\n locale?: string;\n\n /** The active callback function for highlighting shapes. */\n active?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Custom aggregation functions keyed by data property. */\n aggs?: {[k: string]: (d: DataPoint[]) => unknown};\n /** Hides the SVG from assistive technology when true (`aria-hidden`). */\n ariaHidden?: boolean;\n /**\n Text (rendered as HTML — any valid HTML string works, including anchor\n links) shown in the chart's bottom-right corner, most often a map tile\n credit. `false` (the default) shows nothing. A credit wider than half\n the chart area collapses to a small \"ⓘ\" badge that expands on hover,\n focus, or click.\n */\n attribution?: string | boolean;\n /**\n Overrides the \"ⓘ\" badge a long attribution collapses to, which\n otherwise renders as an inline SVG. A string is used as the badge's\n raw HTML content; a mount function, `(el: HTMLElement) => void | (() =>\n void)`, is called once with the badge's reserved element so a live\n component (a React tree via `createRoot(el).render(...)`, or anything\n else imperative) can be mounted into it — return a cleanup function if\n there's teardown to do.\n */\n attributionIcon?: string | ((el: HTMLElement) => void | (() => void));\n /** CSS key/value pairs used to style the attribution text. */\n attributionStyle?: Record<string, unknown>;\n /** Additional CSS class name(s) applied to the back button, alongside the fixed `back-control` class. */\n backControlClassName?: string;\n /** Padding between bars in pixels. */\n barPadding?: number;\n /** The baseline for the x/y plot. */\n baseline?: number;\n /** Whether to cache the processed data between renders. */\n cache?: boolean;\n /** Treat a discrete color field as ordered: color it with a single-hue light→dark ramp instead of nominal categorical hues. */\n colorOrdinal?: boolean;\n /** Color scale key or custom color function. */\n colorScale?: string | ((d: number) => string);\n /** Configuration for the color scale component. */\n colorScaleConfig?: {\n axisConfig?: AxisConfig;\n centered?: boolean;\n colors?: string[];\n colorMin?: string;\n colorMid?: string;\n colorMax?: string;\n scale?: AxisScale;\n };\n /** Whether the color scale uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n colorScalePadding?: boolean | ((viz: VizBase) => boolean);\n /** Position of the color scale, `false` to hide it, or an accessor returning either. */\n colorScalePosition?: false | Position | (() => false | Position);\n /** Column key for matrix-style layouts. */\n column?: string;\n /**\n The confidence interval as `[lower, upper]` bounds — each given as an\n accessor function or a static data key (e.g. `[\"lci\", \"hci\"]`), or `false`\n to disable.\n */\n confidence?:\n | [\n string | ((d: DataPoint, i: number) => number),\n string | ((d: DataPoint, i: number) => number),\n ]\n | false;\n /** Maximum number of data points to render before downsampling. */\n dataCutoff?: number;\n /** Active depth level for nested groupings. */\n depth?: number;\n /** Sets orientation of main category axis. */\n discrete?: \"x\" | \"y\";\n /** Default duration of transitions, in milliseconds. */\n duration?: number;\n /** Predicate filtering which data points are included, or false to disable. */\n filter?: ((d: DataPoint, i: number) => boolean) | false;\n /** Allows removing specific geographies from topojson file to improve zoom. */\n fitFilter?:\n | number\n | string\n | ((d: Record<string, unknown>) => boolean);\n /** Grouping key(s) or accessor function(s). */\n groupBy?:\n | string\n | string[]\n | ((d: DataPoint) => string | number)\n | ((d: DataPoint) => string | number)[];\n /** Padding between groups of bars in pixels. */\n groupPadding?: number;\n /** Overall height of the visualization in pixels. */\n height?: number;\n /** Color for legend shapes whose grouping is hidden (via legend click), or a `(datum, index)` accessor. */\n hiddenColor?: string | ((d: DataPoint, i: number) => string);\n /** Opacity for legend labels whose grouping is hidden (via legend click), or a `(datum, index)` accessor. */\n hiddenOpacity?: number | ((d: DataPoint, i: number) => number);\n /** The hover callback function for highlighting shapes on mouseover. */\n hover?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Persistently emphasizes matching marks (keep color) and grays the rest. */\n highlight?: ((d: DataPoint, i: number) => boolean) | false | null;\n /** Label accessor for shapes. */\n label?: string | string[] | false | AccessorFn;\n /**\n Controls legend visibility. Pass `false` to hide it, `true` to always\n show it, or a `(config, data) => boolean` accessor to decide dynamically\n — the chart defaults use an accessor to auto-hide the legend when it\n would be redundant.\n */\n legend?: boolean | ((config: D3plusConfig, arr: DataPoint[]) => boolean);\n /** Configuration for the legend component. */\n legendConfig?: {\n label?: DataPointAccessor<string>;\n shapeConfig?: Record<string, string | number>;\n };\n /** Inverts legend click behavior (click hides / shift-click solos, or the reverse), or an accessor receiving the viz. */\n legendFilterInvert?: boolean | ((viz: VizBase) => boolean);\n /** Whether the legend uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n legendPadding?: boolean | ((viz: VizBase) => boolean);\n /** Position of the legend, or an accessor returning it. */\n legendPosition?: Position | (() => Position);\n /** Custom sort comparator for legend items. */\n legendSort?: (a: DataPoint, b: DataPoint) => number;\n /** Tooltip configuration for legend items. */\n legendTooltip?: TooltipConfig;\n /** Whether to show labels on line charts. */\n lineLabels?: boolean;\n /** Whether to show the loading message. */\n loadingMessage?: boolean;\n /** Custom HTML content for the loading indicator, or a function receiving the viz instance. */\n loadingHTML?: string | ((viz: VizBase) => string);\n /** Metric key for the visualization. */\n metric?: string;\n /** Shows a small overview + draggable-viewport minimap underneath the zoom controls once the chart is zoomed in. On by default whenever `zoom` is enabled. */\n minimap?: boolean;\n /** Additional CSS class name(s) applied to the minimap, alongside its fixed `d3plus-minimap`/etc. classes. */\n minimapClassName?: string;\n /** Custom HTML content shown when no data is supplied, or a function receiving the viz instance. */\n noDataHTML?: string | ((viz: VizBase) => string);\n /**\n Ocean color for geomaps (any CSS value including 'transparent'), or a\n `{light, dark}` pair chosen by the chart's backdrop. Defaults to the\n default basemap's own water colors.\n */\n ocean?: string | {light: string; dark: string};\n /** Event listeners keyed by event name. */\n on?: Record<string, (event: Event) => void>;\n /** Coordinate accessor for point-based geomaps. */\n point?: (d: DataPoint) => number[];\n /** Point size accessor for geomaps. */\n pointSize?: string | ((d: DataPoint) => number);\n /** Minimum point size for geomaps. */\n pointSizeMin?: number;\n /** Maximum point size for geomaps. */\n pointSizeMax?: number;\n /** Map projection name or function. */\n projection?: string | ((x: number, y: number) => [number, number]);\n /** Outer padding between the visualization edge and map shapes. */\n projectionPadding?: number | string;\n /** Rotation offset for the map projection center. */\n projectionRotate?: [number, number];\n /** Row key for matrix-style layouts. */\n row?: string;\n /** Scrollable container selector for tooltip positioning. */\n scrollContainer?: string | Window;\n /** Shows a top-left search button that expands into an input; typing highlights shapes whose label matches. On by default for every chart. */\n search?: boolean;\n /** Resolves the string the search box matches its typed term against, for a given datum. Defaults to the mark's resolved on-screen label. */\n searchAccessor?: (d: DataPoint, i: number) => string;\n /** Additional CSS class name(s) applied to the search toggle button and input, alongside the fixed `search-control` classes. */\n searchControlClassName?: string;\n /** Configuration for shape rendering. */\n shapeConfig?: {\n duration?: number;\n [key: string]: unknown;\n };\n /**\n A [sort comparator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n that receives each shape class (e.g. \"Circle\", \"Line\") as its arguments.\n Shapes are drawn in groups by type, so this defines the layering order for\n all shapes of a given type.\n */\n shapeSort?: (a: string, b: string) => number;\n /** Size accessor key. */\n size?: string;\n /** Whether to stack series. */\n stacked?: boolean;\n /**\n Vertical offset applied to stacked series. One of `\"diverging\"`\n (default — positive and negative values split around zero), `\"none\"`,\n `\"expand\"` (normalize each stack to 100%), `\"silhouette\"` (streamgraph),\n or `\"wiggle\"` (minimize slope changes); or a custom offset function.\n */\n stackOffset?: string | ((series: number[][][], order: number[]) => void);\n /**\n Order of stacked series, from the bottom of the stack upward. Accepts a\n named order (`\"descending\"` [default] / `\"ascending\"` by summed value,\n `\"key\"` / `\"keyReverse\"` alphabetically, `\"none\"` / `\"data\"` for input\n order, or d3's `\"insideOut\"` / `\"appearance\"` / `\"reverse\"`), an Array of\n series keys for an explicit order, a value accessor, or a `{value, order}`\n config to rank series by an aggregate of any data field.\n */\n stackOrder?:\n | string\n | string[]\n | {value: string | ((d: DataPoint) => unknown); order?: \"ascending\" | \"descending\"}\n | ((d: DataPoint) => unknown);\n /** Subtitle text, or an accessor returning it. */\n subtitle?: string | ((data: DataPoint[]) => string);\n /** Whether the subtitle uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n subtitlePadding?: boolean | ((viz: VizBase) => boolean);\n /** Value accessor for treemaps and aggregation. */\n sum?: DataPointAccessor<number>;\n /** Accessible description applied to the root SVG (`<desc>`). */\n svgDesc?: string;\n /** Accessible title applied to the root SVG (`<title>`). */\n svgTitle?: string;\n /** Enables the top-left table-view toggle button, which swaps the chart for a static, scrollable `<table>` of its data. On by default for every chart. */\n tableView?: boolean;\n /** Additional CSS class name(s) applied to the `<table>` element rendered while in table view, alongside the fixed `d3plus-table-view-table` class. */\n tableViewClassName?: string;\n /** Additional CSS class name(s) applied to the table-view toggle button, alongside the fixed `table-view-control`/`table-view-toggle` classes. */\n tableViewControlClassName?: string;\n /** CSS key/value pairs styling the table-view toggle button. `false` removes all default styling. */\n tableViewControlStyle?: Record<string, unknown> | false;\n /** CSS key/value pairs styling the table-view toggle button while active (showing the data table). `false` removes all default styling. */\n tableViewControlStyleActive?: Record<string, unknown> | false;\n /** CSS key/value pairs styling the table-view toggle button on hover. `false` removes all default styling. */\n tableViewControlStyleHover?: Record<string, unknown> | false;\n /** Whether the data table shows a \"download CSV\" button, exporting its full (sorted, unpaginated) rows. On by default. */\n tableViewDownload?: boolean;\n /** Rows per page while in table view. `false` (or any non-positive number) disables pagination and shows every row on one page. */\n tableViewPageSize?: number | false;\n /** Whether the data table's column headers are clickable to sort (toggling asc/desc). On by default. */\n tableViewSort?: boolean;\n /** Threshold value for grouping small slices. */\n threshold?: number;\n /** Label for the threshold group, or a `(datum, index)` accessor. */\n thresholdName?: string | ((d: DataPoint, i: number) => string);\n /**\n URL template for XYZ map tiles, with `{z}`, `{x}`, `{y}` (and optional\n `{s}` subdomain) placeholders — or a `{light, dark}` pair, chosen by the\n chart's backdrop. Defaults to Esri's Light Gray and Dark Gray Canvas.\n */\n tileUrl?: string | {light: string; dark: string};\n /** Whether to show map tiles. */\n tiles?: boolean;\n /** Time key for temporal data. */\n time?: string;\n /** Predicate filtering which time slices are shown, or false to disable. */\n timeFilter?: ((d: DataPoint, i: number) => boolean) | false;\n /** Whether to show the timeline component. */\n timeline?: boolean;\n /** Whether the timeline uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n timelinePadding?: boolean | ((viz: VizBase) => boolean);\n /** Chart title or title accessor function. */\n title?: string | ((data: DataPoint[]) => string);\n /** CSS style configuration for the title. */\n titleConfig?: Record<string, string | number>;\n /** Whether the title uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n titlePadding?: boolean | ((viz: VizBase) => boolean);\n /** Whether to show tooltips, or a `(datum, index)` accessor deciding per mark. */\n tooltip?: boolean | ((d: DataPoint, i: number) => boolean);\n /** Configuration for the tooltip component. */\n tooltipConfig?: TooltipConfig;\n /** Path or object for the topojson data. */\n topojson?: string | object;\n /** CSS color to fill the map shapes. */\n topojsonFill?: string;\n /** Accessor function for topojson feature IDs. */\n topojsonId?: (obj: Record<string, unknown>) => string;\n /** Whether the total uses the visualization's internal padding when positioning, or an accessor receiving the viz. */\n totalPadding?: boolean | ((viz: VizBase) => boolean);\n /** Value accessor for the visualization. */\n value?: DataPointAccessor<number>;\n /** Overall width of the visualization in pixels. */\n width?: number;\n /** Key, index, or accessor function for x-axis values. */\n x?: string | number | ((d: DataPoint, i: number) => unknown);\n /** Configuration for the x-axis. */\n xConfig?: AxisConfig;\n /** The x domain as an array. If either value is undefined, it is calculated from the data. */\n xDomain?: (number | Date)[];\n /** The x2 domain as an array. If either value is undefined, it is calculated from the data. */\n x2Domain?: (number | Date)[];\n /** Custom sort function for x-axis values. */\n xSort?: (a: DataPoint, b: DataPoint) => number;\n /** Defines a custom sorting comparator function for discrete x2 axes. */\n x2Sort?: (a: DataPoint, b: DataPoint) => number;\n /** Key, index, or accessor function for y-axis values. */\n y?: string | number | ((d: DataPoint, i: number) => unknown);\n /** Configuration for the y-axis. */\n yConfig?: AxisConfig;\n /** The y domain as an array. If either value is undefined, it is calculated from the data. */\n yDomain?: (number | Date)[];\n /** The y2 domain as an array. If either value is undefined, it is calculated from the data. */\n y2Domain?: (number | Date)[];\n /** Custom sort function for y-axis values. */\n ySort?: (a: DataPoint, b: DataPoint) => number;\n /** Defines a custom sorting comparator function for discrete y2 axes. */\n y2Sort?: (a: DataPoint, b: DataPoint) => number;\n /** Enables pan/zoom with zoom-control buttons. On by default for every chart. */\n zoom?: boolean;\n /** Additional CSS class name(s) applied to each zoom control button, alongside the fixed `zoom-control`/`zoom-in`/etc. classes. */\n zoomControlClassName?: string;\n /**\n Overrides one or more of the four built-in zoom-control icons (`zoomIn`,\n `zoomOut`, `zoomReset`, `zoomBrush`), which otherwise render as inline\n SVGs. Each value is either raw HTML — used as that button's content — or\n a mount function, `(el: HTMLElement) => void | (() => void)`, called\n once with the button's reserved icon slot so a live component (a React\n tree via `createRoot(el).render(...)`, or anything else imperative) can\n be mounted into it — return a cleanup function if there's teardown to do.\n */\n zoomControlIcons?: Partial<\n Record<\n \"zoomIn\" | \"zoomOut\" | \"zoomReset\" | \"zoomBrush\",\n string | ((el: HTMLElement) => void | (() => void))\n >\n >;\n /** Multiplier applied to programmatic zoom steps. */\n zoomFactor?: number;\n /** Maximum zoom scale factor. Defaults to the scale at which the smallest shape fills the chart area. */\n zoomMax?: number;\n /** Whether panning (drag) is enabled while zoomed. */\n zoomPan?: boolean;\n /**\n Whether the mouse wheel (and one-finger touch) zooms. `\"modifier\"` (the\n default) leaves page scrolling alone: only\n Ctrl/⌘ + wheel or a trackpad/two-finger pinch zooms, and one finger pans\n only once zoomed in. `true` zooms on any wheel; `false` never does.\n */\n zoomScroll?: boolean | \"modifier\";\n\n /** Allows additional custom properties. */\n [key: string]: unknown;\n}\n"],"names":[],"mappings":"AAgQA,WAmVC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/core",
3
- "version": "4.2.0",
3
+ "version": "4.5.0",
4
4
  "description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,6 +42,7 @@
42
42
  "@floating-ui/dom": "^1.6.0",
43
43
  "d3-array": "^3.2.4",
44
44
  "d3-brush": "^3.0.0",
45
+ "d3-chord": "^3.0.1",
45
46
  "d3-color": "^3.1.0",
46
47
  "d3-composite-projections": "^1.4.0",
47
48
  "d3-force": "^3.0.0",
@@ -62,14 +63,14 @@
62
63
  "open-color": "^1.9.1",
63
64
  "textures": "^1.2.3",
64
65
  "topojson-client": "^3.1.0",
65
- "@d3plus/format": "4.2.0",
66
- "@d3plus/locales": "4.2.0",
67
- "@d3plus/dom": "4.2.0",
68
- "@d3plus/render": "4.2.0",
69
- "@d3plus/text": "4.2.0",
70
- "@d3plus/data": "4.2.0",
71
- "@d3plus/math": "4.2.0",
72
- "@d3plus/color": "4.2.0"
66
+ "@d3plus/data": "4.5.0",
67
+ "@d3plus/dom": "4.5.0",
68
+ "@d3plus/format": "4.5.0",
69
+ "@d3plus/locales": "4.5.0",
70
+ "@d3plus/math": "4.5.0",
71
+ "@d3plus/text": "4.5.0",
72
+ "@d3plus/render": "4.5.0",
73
+ "@d3plus/color": "4.5.0"
73
74
  },
74
75
  "devDependencies": {
75
76
  "playwright": "1.59.1"
@@ -79,7 +80,7 @@
79
80
  "build:types": "tsc",
80
81
  "build:umd": "node ../../scripts/build-umd.js",
81
82
  "dev": "node ../../scripts/dev.js",
82
- "test": "eslint index.ts internal.ts umd-entry.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'",
83
+ "test": "eslint index.ts internal.ts umd-entry.ts src && eslint --global=it test && mocha 'test/**/*-test.js'",
83
84
  "test:coverage": "c8 -r text -r lcov --src src mocha 'test/**/*-test.js'"
84
85
  }
85
86
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AreaPlot, BarChart, BoxWhisker, BumpChart, Donut, Geomap, LinePlot, Matrix, Network, Pack, Pie, Plot, Priestley, Radar, RadialMatrix, Rings, Sankey, StackedArea, Tree, Treemap, Viz, } from "./src/charts/index.js";
1
+ export { AreaPlot, BarChart, BoxWhisker, BumpChart, Chord, Donut, Geomap, LinePlot, Matrix, Network, Pack, Pie, Plot, Priestley, Radar, RadialMatrix, Rings, Sankey, StackedArea, Tree, Treemap, Viz, } from "./src/charts/index.js";
2
2
  export { Axis, AxisBottom, AxisLeft, AxisRight, AxisTop, ColorScale, Legend, Message, TextBox, Timeline, Tooltip, } from "./src/components/index.js";
3
3
  export { Area, Bar, Box, Circle, Image, Line, Path, Rect, Shape, Whisker, } from "./src/shapes/index.js";
4
4
  export { accessor, BaseClass, configPrep, constant, RESET, } from "./src/utils/index.js";
@@ -9,6 +9,7 @@
9
9
  is implementation detail of the rendering pipeline and may change in any
10
10
  minor release. Import it knowingly.
11
11
  */
12
+ export { applyChordLayout } from "./src/charts/Chord/applyLayout.js";
12
13
  export { applyGeomapLayout } from "./src/charts/Geomap/applyLayout.js";
13
14
  export { applyMatrixLayout } from "./src/charts/Matrix/applyLayout.js";
14
15
  export { applyNetworkLayout } from "./src/charts/Network/applyLayout.js";
@@ -21,6 +22,7 @@ export { applyRadarLayout } from "./src/charts/Radar/applyLayout.js";
21
22
  export { applyRadialMatrixLayout } from "./src/charts/RadialMatrix/applyLayout.js";
22
23
  export { applyTreeLayout } from "./src/charts/Tree/applyLayout.js";
23
24
  export { applyTreemapLayout } from "./src/charts/Treemap/applyLayout.js";
25
+ export { chordDef } from "./src/charts/Chord/index.js";
24
26
  export { geomapDef } from "./src/charts/Geomap/index.js";
25
27
  export { matrixDef } from "./src/charts/Matrix/index.js";
26
28
  export { networkDef } from "./src/charts/Network/index.js";
@@ -44,7 +46,11 @@ export { vizPreDrawPure, vizPostThresholdCtx } from "./src/charts/pipeline/vizPr
44
46
  export { plotEmit, plotPaint } from "./src/charts/features/plotPaint.js";
45
47
  export { renderAxes } from "./src/charts/features/axes.js";
46
48
  export { computeAxisLayout, measureAxis } from "./src/components/Axis/Axis.js";
47
- export { backFeature, colorScaleFeature, legendFeature, runLayout, subtitleFeature, timelineFeature, titleFeature, totalFeature, } from "./src/charts/features/features.js";
49
+ export { colorScaleFeature, legendFeature, runLayout, subtitleFeature, timelineFeature, titleFeature, totalFeature, } from "./src/charts/features/features.js";
50
+ export { getTopLeftContributions, topLeftControlsFeature, TOP_LEFT_CONTRIBUTORS, } from "./src/charts/drawSteps/topLeftControls.js";
51
+ export { backContribution } from "./src/charts/drawSteps/backControl.js";
52
+ export { tableViewContribution } from "./src/charts/drawSteps/tableViewControl.js";
53
+ export { searchContribution } from "./src/charts/drawSteps/searchControls.js";
48
54
  export type { ResolvedSpec } from "./src/charts/pipeline/resolveSpec.js";
49
55
  export type { VizContext } from "./src/charts/pipeline/vizContext.js";
50
56
  export type { VizPreDrawResult } from "./src/charts/pipeline/vizPreDrawPure.js";
@@ -52,3 +58,4 @@ export type { PlotMeasureResult, PlotPaintContext } from "./src/charts/features/
52
58
  export type { ShapeLike, VizLike } from "./src/charts/features/emitHelpers.js";
53
59
  export type { VizInstance, VizRenderer } from "./src/charts/viz/vizTypes.js";
54
60
  export type { AxisLayout, AxisLayoutResult } from "./src/components/Axis/Axis.js";
61
+ export type { Contribution } from "./src/charts/drawSteps/topLeftControlsMarkup.js";
@@ -0,0 +1,43 @@
1
+ /**
2
+ `applyChordLayout` — Chord's chart-specific layout stage. Resolves nodes +
3
+ links into a square flow matrix, runs the d3-chord layout (directed by
4
+ default), builds the arc (group) + ribbon (chord) path generators, computes
5
+ per-node label geometry, and stashes `chordCtx` + `nodeLookup` + `adjacency`
6
+ on `viz.ctx`.
7
+
8
+ Geometry is generated at the origin (0,0), like Pie/Donut — the chart is
9
+ centered by `chordDef.chartTransform`.
10
+ */
11
+ import type { Chord, ChordGroup, Chords } from "d3-chord";
12
+ import type { DataPoint } from "@d3plus/data";
13
+ import type { TransformStage } from "../pipeline/stages.js";
14
+ /** A single laid-out Chord node (group), accreted across the layout passes. */
15
+ export interface ChordNode {
16
+ __d3plus__: true;
17
+ data: DataPoint;
18
+ node: DataPoint;
19
+ i: number;
20
+ id: string | number;
21
+ shape: string;
22
+ /** The d3-chord group for this node, set once the layout runs. */
23
+ group?: ChordGroup;
24
+ /** Label anchor point (on the outer radius, centered coords). */
25
+ labelX?: number;
26
+ labelY?: number;
27
+ labelRotate?: number;
28
+ labelAnchor?: "start" | "end";
29
+ labelBounds?: {
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ };
35
+ }
36
+ /** Everything `chordEmit` needs, stashed on `viz.ctx.chordCtx`. */
37
+ export interface ChordCtx {
38
+ nodes: ChordNode[];
39
+ chords: Chords;
40
+ arcFn: (d: ChordGroup) => string;
41
+ ribbonFn: (d: Chord) => string;
42
+ }
43
+ export declare const applyChordLayout: TransformStage;
@@ -0,0 +1,10 @@
1
+ /**
2
+ `chordEmit` — ribbon Paths (chords) + arc Paths (groups) + rotated group
3
+ labels, from `chordCtx` stashed on `viz.ctx`. Emits flat SceneNodes directly.
4
+
5
+ Ribbons are emitted first so the arcs paint on top of their attach points.
6
+ Ribbon fill is resolved against the *source* node so each flow reads as
7
+ leaving its origin; arc fill is the node's own color.
8
+ */
9
+ import type { ChartEmit } from "../definition/ChartDefinition.js";
10
+ export declare const chordEmit: ChartEmit;
@@ -0,0 +1,19 @@
1
+ /**
2
+ Chord — d3-chord relationship diagram.
3
+
4
+ Groups (nodes) are laid out as arcs around a circle; ribbons (chords) connect
5
+ them, sized by the flow (link value) between each pair. Built on the same
6
+ nodes/links data model as Network, Rings, and Sankey.
7
+
8
+ Implementation files in this folder:
9
+ - `applyLayout.ts` — node/link resolution → flow matrix → d3-chord layout +
10
+ arc/ribbon generators + label geometry.
11
+ - `emit.ts` — ribbon Paths + arc Paths + rotated group labels.
12
+ */
13
+ import type { ChartDefinition } from "../definition/ChartDefinition.js";
14
+ export declare const chordDef: ChartDefinition;
15
+ /**
16
+ Creates a Chord diagram based on a defined set of nodes and links.
17
+ */
18
+ declare const _default: new () => any;
19
+ export default _default;
@@ -0,0 +1,35 @@
1
+ /**
2
+ Light/dark basemaps. `tileUrl` and `ocean` accept either one value or a
3
+ `{light, dark}` pair; a pair resolves against the chart's backdrop each
4
+ draw, and the chart redraws when that backdrop flips.
5
+
6
+ @module
7
+ */
8
+ import type { VizInstance } from "../viz/vizTypes.js";
9
+ /** A value, or one per page theme. */
10
+ export type Themed<T> = T | {
11
+ light: T;
12
+ dark: T;
13
+ };
14
+ /** Esri's Canvas basemaps: muted, nearly label-free bases for data overlays. */
15
+ export declare const DEFAULT_TILE_URL: Themed<string>;
16
+ /** The Canvas basemaps' own water colors, so the ocean around the tiles matches. */
17
+ export declare const DEFAULT_OCEAN: Themed<string>;
18
+ /** Picks a themed value's light or dark side. */
19
+ export declare function resolveThemed<T>(value: Themed<T>, dark: boolean): T;
20
+ /** Whether a Geomap has any themed value that depends on the backdrop. */
21
+ export declare function isThemed(viz: VizInstance): boolean;
22
+ /**
23
+ Whether the chart sits on a dark backdrop: the first non-transparent
24
+ background among its ancestors, or — when none sets one — the browser's
25
+ own page canvas, which is dark only when the page opts into a dark
26
+ `color-scheme` and the system prefers dark. Server renders are light.
27
+ */
28
+ export declare function pageIsDark(viz: VizInstance): boolean;
29
+ /**
30
+ Redraws the chart when its backdrop changes theme: on a system theme
31
+ change, or when the page flips a theme class/attribute/style on <html>
32
+ or <body> (how most theme toggles work). Installed once per chart, and
33
+ only while it uses a `{light, dark}` pair.
34
+ */
35
+ export declare function watchPageTheme(viz: VizInstance): void;
@@ -1,7 +1,8 @@
1
1
  import { type StackOffsetFn, type StackOrderFn, type StackOrderInput } from "./stackHelpers.js";
2
- import { type PlotPaintContext } from "../features/plotPaint.js";
2
+ import type { PlotPaintContext } from "../features/plotPaint.js";
3
+ import { type ZoomState } from "./plotZoom.js";
3
4
  import Viz from "../viz/Viz.js";
4
- import type { Scene } from "@d3plus/render";
5
+ import type { InteractionPoint, PickResult, Scene, SceneEvent } from "@d3plus/render";
5
6
  import type { DataPoint } from "@d3plus/data";
6
7
  import type { VizInstance } from "../viz/vizTypes.js";
7
8
  /** Accessor function or string key for a plotted value. */
@@ -47,6 +48,28 @@ export default class Plot extends Viz {
47
48
  _wirePlotShapeEvents(shape: {
48
49
  on(event: string, handler: unknown): unknown;
49
50
  }, shapeKey: string, events: string[]): void;
51
+ /**
52
+ For a multi-point shape (Line/Area) reports the point nearest the cursor
53
+ along the discrete axis, so every mouse event (tooltip, click, user
54
+ handlers) reflects the hovered x rather than the whole-series aggregate.
55
+ Non-nested shapes and legend swatches fall through to the base (aggregate)
56
+ behavior.
57
+ @private
58
+ */
59
+ _interactionDatum(pick: PickResult, event: SceneEvent): {
60
+ d: unknown;
61
+ i: number;
62
+ x: unknown;
63
+ };
64
+ /**
65
+ Picks the interaction point closest to a surface-local cursor position
66
+ along the discrete axis. `event.point` is post-zoom surface space while the
67
+ points are in chart content space (under the `viz-zoom` group and then
68
+ the chart's own `viz-chart-body` transform), so the cursor is un-zoomed
69
+ by `_zoomTransform` and offset by `_chartTransform` before comparing.
70
+ @private
71
+ */
72
+ _nearestInteractionPoint(points: InteractionPoint[], point: [number, number]): InteractionPoint | null;
50
73
  /**
51
74
  Extends the draw behavior of the abstract Viz class.
52
75
  @private
@@ -59,6 +82,13 @@ export default class Plot extends Viz {
59
82
  scope beyond the explicit context).
60
83
  */
61
84
  _paint(pCtx: PlotPaintContext): this;
85
+ /**
86
+ Zooms by rescaling the plot's linear axes instead of scaling the
87
+ rendered picture (see `Plot/plotZoom.ts`). Returns false when no axis
88
+ is linear, so the plot falls back to picture zoom.
89
+ @private
90
+ */
91
+ _zoomRescale(t: ZoomState, duration?: number): boolean;
62
92
  /**
63
93
  Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
64
94
 
@@ -6,7 +6,8 @@ export { measurePlotLineLabels } from "./pipelineLineLabels.js";
6
6
  `formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
7
7
  time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
8
8
  filtered data through `prepData` to produce the per-row PlotDatum shape
9
- (x/y/x2/y2 + id + group + shape + lci/hci + discrete), and constructs
9
+ (x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose
10
+ axis values can't be plotted (`isPlottableRow` — see #776), and constructs
10
11
  the `_sizeScaleD3` if `_size` is set.
11
12
 
12
13
  Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`
@@ -0,0 +1,65 @@
1
+ /**
2
+ Axis-rescaling zoom for the Plot family (#780).
3
+
4
+ Rather than scaling the rendered picture (how every other chart zooms), a
5
+ Plot keeps its axes in place and rescales the domain of each simple linear
6
+ axis, then repaints its axes and shapes at the new scale. Discrete, time,
7
+ and log axes stay fixed — a bar chart zooms and pans along its value axis
8
+ only. The d3-zoom behavior and controls are shared with every other chart
9
+ (`drawSteps/zoomControls.ts`); `zoomed()` hands each transform to
10
+ `Plot._zoomRescale`, which lands here.
11
+
12
+ @module
13
+ */
14
+ import type { SceneNode } from "@d3plus/render";
15
+ import type { PlotMeasureResult, PlotPaintContext } from "../features/plotPaint.js";
16
+ import type { VizInstance as Viz } from "../viz/vizTypes.js";
17
+ type AxisName = "x" | "x2" | "y" | "y2";
18
+ /** The invertible piece of an axis's d3 scale the rescale needs. */
19
+ interface LinearScale {
20
+ (value: number): number;
21
+ domain(): number[];
22
+ range(): number[];
23
+ invert(value: number): number;
24
+ }
25
+ /** A continuous transform in surface space, as d3-zoom reports it. */
26
+ export interface ZoomState {
27
+ k: number;
28
+ x: number;
29
+ y: number;
30
+ }
31
+ /** The unzoomed draw a zoom rescales from. */
32
+ export interface PlotZoomBase {
33
+ pCtx: PlotPaintContext;
34
+ layout: PlotMeasureResult;
35
+ chartTransform: {
36
+ x: number;
37
+ y: number;
38
+ };
39
+ scales: Partial<Record<AxisName, LinearScale>>;
40
+ labelSpace: Partial<Record<AxisName, number>>;
41
+ }
42
+ /**
43
+ Paints a Plot at its natural (unzoomed) scale and records what a zoom
44
+ needs to rescale from. When a zoom is already in effect (the chart was
45
+ re-rendered mid-zoom), the plot is immediately repainted at that zoom so
46
+ the view doesn't snap back.
47
+ */
48
+ export declare function paintZoomablePlot(viz: Viz, pCtx: PlotPaintContext, current?: ZoomState): SceneNode[];
49
+ /**
50
+ Repaints the plot for a zoom transform. Returns the new chart scene, or
51
+ `undefined` when the plot has no linear axis to rescale (it then falls
52
+ back to picture zoom like any other chart). The content is clipped to the
53
+ plot rect unless the view is at its natural scale (or `keepClip` is set),
54
+ where shapes drawn at the domain edges would otherwise be cut off.
55
+ */
56
+ export declare function rescalePlot(viz: Viz, t: ZoomState, keepClip?: boolean): SceneNode[] | undefined;
57
+ /**
58
+ Repaints the plot for a zoom transform, animated over `duration`. An
59
+ animated return to the natural scale from a zoomed view keeps the clip until the transition
60
+ settles, so shapes tweening back in from outside the plot don't paint
61
+ over the axes on the way; the clip is then dropped with an instant
62
+ repaint.
63
+ */
64
+ export declare function zoomPlot(viz: Viz, t: ZoomState, duration: number): SceneNode[] | undefined;
65
+ export {};
@@ -45,7 +45,9 @@ interface ChartDefinitionBase {
45
45
  scene coordinates that the chart content is clipped to). Geomap uses this to
46
46
  contain projected geography within the map rectangle so it can't spill under
47
47
  the legend/timeline; the clip stays put while pan/zoom moves content beneath
48
- it. Only meaningful for charts whose `chartTransform` is undefined.
48
+ it. The chart-cells group is untransformed (`chartTransform` applies to a
49
+ group inside it), so the clip is in surface coordinates. Zoomable charts
50
+ without one are clipped to the chart area.
49
51
  */
50
52
  chartClip?: (viz: VizInstance) => import("@d3plus/render").ClipShape | undefined;
51
53
  /**
@@ -0,0 +1,29 @@
1
+ /**
2
+ The "← Back" control's contribution to the shared top-left controls
3
+ panel (`topLeftControls.ts`) — visible only when the chart has
4
+ drill-down history to pop. Styled like the zoom/search controls: a real
5
+ `<button>` at the same 20px height, an SVG arrow icon (not a text
6
+ glyph), and no default background/border/color — a plain
7
+ browser-appearance button that lets native/host-page button chrome
8
+ show through, restylable via `.backControlStyle()`/
9
+ `.backControlClassName()` the same way zoom/search are.
10
+
11
+ Previously `backFeature` rendered "← Back" as an SVG text scene node in
12
+ its own margin-claiming row, with its click routed through
13
+ `Viz._routeSceneEvent`'s `interactionGroup === "back"` special case —
14
+ the only way to attach a click handler to a plain scene text node. As a
15
+ real button inside the shared `htmlOverlay` panel, its click instead
16
+ rides the same declarative delegated-events map every other top-left/
17
+ zoom control uses, and it claims no margin of its own — like zoom, it
18
+ floats over whatever's there, and content that needs to avoid it insets
19
+ around the whole panel via `topLeftControlsInset`.
20
+
21
+ @module
22
+ */
23
+ import type Viz from "../viz/Viz.js";
24
+ import type { Contribution } from "./topLeftControlsMarkup.js";
25
+ /** Paints the back button's inline style. There's no active/hover override — unlike zoom/search it's not a toggle, so it relies on the browser's native `:hover`, like their own hover default (`false`) already does. */
26
+ export declare function paintBackButton(viz: Viz, btn: HTMLElement): void;
27
+ /** The back button's markup: a real `<button>` (icon + visible "Back" text), so host-page button styling applies through the cascade once `backControlClassName` auto-disables the inline default. */
28
+ export declare function backControlsHtml(viz: Viz): string;
29
+ export declare function backContribution(viz: Viz): Contribution | null;
@@ -0,0 +1,45 @@
1
+ /**
2
+ Shared mechanics for a chart-chrome button's base/active/hover inline
3
+ styling — the resolve-and-paint algorithm zoom/search/back controls all
4
+ use identically. Each control still owns its OWN default style VALUES
5
+ and schema keys (`zoomControlStyle*` vs `searchControlStyle*` vs
6
+ `backControlStyle`) in its own module, so restyling one doesn't affect
7
+ another — only the mechanical part (which was three copy-pasted near-
8
+ duplicates) lives here.
9
+
10
+ @module
11
+ */
12
+ export type StyleObject = Record<string, string | number | undefined | null | false>;
13
+ export type ControlStyleValue = StyleObject | false | null | undefined;
14
+ /** `alignItems` / `align-items` → `align-items`, for `style.setProperty`. */
15
+ export declare const kebab: (key: string) => string;
16
+ /**
17
+ Fallbacks for CSS system colors a browser may not support yet: an
18
+ active-button default uses the OS accent color (Firefox, Safari), and
19
+ Chromium falls back to the text-selection highlight.
20
+ */
21
+ export declare const SYSTEM_COLOR_FALLBACKS: Record<string, string>;
22
+ /** Sets one style property, swapping an unsupported system color for its fallback. */
23
+ export declare function setControlStyle(el: HTMLElement, key: string, value: string): void;
24
+ /**
25
+ Resolves a `*ControlStyle`/`Active`/`Hover` value for painting. Setting
26
+ the matching `*ControlClassName` auto-disables whichever of the three is
27
+ still the untouched built-in default (identified by reference — the
28
+ caller's own default constant) so a host page's own button styling can
29
+ apply through the cascade without also requiring `.xControlStyle(false)`.
30
+ An explicit custom style object (a different reference) always wins,
31
+ className or not.
32
+ */
33
+ export declare function resolveControlStyle(value: ControlStyleValue, defaultValue: ControlStyleValue, classNameSet: boolean): StyleObject;
34
+ /**
35
+ Paints a control button's inline style for its current state: the base
36
+ style, then the hover style while hovered, then the active style while
37
+ its mode is on (so an active button reads as active even under the
38
+ cursor). Every property any of the three styles sets is cleared first,
39
+ so leaving a state fully undoes it.
40
+ */
41
+ export declare function paintControlButton(btn: HTMLElement, styles: {
42
+ base: StyleObject;
43
+ active?: StyleObject;
44
+ hover?: StyleObject;
45
+ }, hovered: boolean, isActive: boolean): void;
@@ -0,0 +1,19 @@
1
+ import type { FeatureModule } from "../features/features.js";
2
+ /**
3
+ @name minimapFeature
4
+ A small overview of the full scene, underneath the zoom-control panel,
5
+ with a draggable box showing the current viewport and a zoom-level
6
+ label — hidden at the chart's natural 1x view, shown once zoomed in.
7
+
8
+ Runs as a post-draw `FeatureModule` right after `zoomFeature` (needs its
9
+ `_zoomBehavior.translateExtent()`/`scaleExtent()` already configured for
10
+ this draw). Claims zero margin, like `zoomFeature` — it floats over the
11
+ existing chart area rather than pushing content around. The panel is
12
+ ALWAYS mounted whenever zoom + minimap are both enabled, regardless of
13
+ the current zoom level: the "hidden at 1x" gate lives inside the panel's
14
+ `onUpdate`, reading the LIVE transform on every repaint, so it hides/
15
+ shows correctly during any live pan/zoom gesture — not just on the next
16
+ full `.render()` (dragging the minimap itself, wheel-zooming, clicking a
17
+ zoom button, and brush-zooming all repaint outside the layout pipeline).
18
+ */
19
+ export declare const minimapFeature: FeatureModule;
@@ -0,0 +1,45 @@
1
+ /**
2
+ Markup, styling, and formatting for the minimap panel — mirrors
3
+ `zoomControlsMarkup.ts`'s shape for the zoom-control buttons.
4
+
5
+ @module
6
+ */
7
+ import type Viz from "../viz/Viz.js";
8
+ export type StyleObject = Record<string, string | number | undefined | null | false>;
9
+ /** The resolved outer / viewport / viewport-active / label styles for a chart. */
10
+ export declare function minimapStyles(viz: Viz): {
11
+ outer: StyleObject;
12
+ viewport: StyleObject;
13
+ viewportActive: StyleObject;
14
+ label: StyleObject;
15
+ };
16
+ /**
17
+ Paints one or more style layers onto an element, clearing the union of
18
+ their keys first so leaving a state (e.g. no longer dragging) fully
19
+ undoes it. Mirrors `paintZoomButton`'s clear-then-apply pattern in
20
+ `zoomControlsMarkup.ts`.
21
+ */
22
+ export declare function paintMinimapStyle(el: HTMLElement, ...layers: StyleObject[]): void;
23
+ /** Formats a zoom scale as a short label: `"2x"`, `"4.4x"`. */
24
+ export declare function formatZoomLabel(k: number): string;
25
+ /**
26
+ The minimap's static HTML skeleton — no baked-in geometry; `onUpdate`
27
+ positions the viewport box and label live on every repaint (see
28
+ `minimap.ts`), the same reason `zoomControlsHtml` bakes in everything
29
+ that CAN change (locale, className) but nothing here changes per-tick.
30
+ The viewport box is `tabindex="0"` so it's keyboard-focusable — arrow
31
+ keys nudge the pan, matching what the `aria-label` describes. No ARIA
32
+ `role`: a 2D pan target doesn't map onto any single widget role (a
33
+ `slider` is one-dimensional), so a plain focusable, labeled element is
34
+ the more honest choice over one implying unmet role semantics.
35
+
36
+ `minimapClassName` (documented as applying to all three elements — the
37
+ outer box, viewport box, and label) is appended to the viewport/label
38
+ classes here; the outer box gets it separately, in `minimap.ts`'s panel
39
+ `className`, since that one isn't part of this inner HTML string.
40
+ */
41
+ export declare function minimapHtml(viz: Viz): string;
42
+ /** Right inset shared with the zoom-control panel, so the two clusters' right edges line up. */
43
+ export declare const MINIMAP_RIGHT_INSET = 4;
44
+ /** Vertical gap between the zoom-control panel and the minimap beneath it. */
45
+ export declare const MINIMAP_GAP = 4;
@@ -0,0 +1,3 @@
1
+ import type Viz from "../viz/Viz.js";
2
+ import type { Contribution } from "./topLeftControlsMarkup.js";
3
+ export declare function searchContribution(viz: Viz): Contribution | null;