semiotic 3.8.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CLAUDE.md +12 -9
  2. package/README.md +39 -39
  3. package/ai/dist/mcp-server.js +98 -17
  4. package/ai/schema.json +1 -1
  5. package/ai/surface-manifest.json +3 -2
  6. package/ai/system-prompt.md +3 -2
  7. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  8. package/dist/components/AccessibleNavTree.d.ts +7 -1
  9. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  10. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  11. package/dist/components/chartContainerMobile.d.ts +9 -0
  12. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  13. package/dist/components/charts/geo/DistanceCartogram.d.ts +14 -2
  14. package/dist/components/charts/geo/FlowMap.d.ts +10 -6
  15. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +14 -2
  16. package/dist/components/charts/index.d.ts +6 -0
  17. package/dist/components/charts/network/ChordDiagram.d.ts +9 -1
  18. package/dist/components/charts/network/ForceDirectedGraph.d.ts +11 -0
  19. package/dist/components/charts/network/SankeyDiagram.d.ts +9 -1
  20. package/dist/components/charts/ordinal/BarChart.d.ts +21 -0
  21. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +11 -0
  22. package/dist/components/charts/ordinal/StackedBarChart.d.ts +11 -0
  23. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +7 -0
  24. package/dist/components/charts/physics/EventDropChart.d.ts +7 -0
  25. package/dist/components/charts/physics/GaltonBoardChart.d.ts +8 -0
  26. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +4 -25
  27. package/dist/components/charts/physics/PhysicsPileChart.d.ts +7 -0
  28. package/dist/components/charts/physics/physicsChartShared.d.ts +17 -1
  29. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  30. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  31. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  32. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  33. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  34. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  35. package/dist/components/charts/shared/chartSpecCore.d.ts +3 -3
  36. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  37. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +2 -0
  38. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  39. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  40. package/dist/components/charts/shared/hooks.d.ts +7 -6
  41. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  42. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  43. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  44. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  45. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  46. package/dist/components/charts/shared/streamPropsHelpers.d.ts +6 -4
  47. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  48. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  49. package/dist/components/charts/shared/types.d.ts +9 -6
  50. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  51. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  52. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  53. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  54. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  55. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  56. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +24 -1
  57. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  58. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  59. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  60. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  61. package/dist/components/charts/shared/validationMap.d.ts +11 -2
  62. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  63. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  64. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  65. package/dist/components/charts/value/types.d.ts +5 -6
  66. package/dist/components/charts/xy/AreaChart.d.ts +8 -0
  67. package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
  68. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  69. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  70. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  71. package/dist/components/charts/xy/LineChart.d.ts +11 -0
  72. package/dist/components/charts/xy/QuadrantChart.d.ts +7 -0
  73. package/dist/components/charts/xy/Scatterplot.d.ts +10 -0
  74. package/dist/components/charts/xy/StackedAreaChart.d.ts +7 -0
  75. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  76. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  77. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  78. package/dist/components/data/fromVegaLite.d.ts +19 -9
  79. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  80. package/dist/components/semiotic-ai.d.ts +3 -1
  81. package/dist/components/semiotic-controls.d.ts +2 -0
  82. package/dist/components/semiotic-geo.d.ts +4 -0
  83. package/dist/components/semiotic-network.d.ts +4 -0
  84. package/dist/components/semiotic-ordinal.d.ts +6 -0
  85. package/dist/components/semiotic-physics.d.ts +4 -0
  86. package/dist/components/semiotic-rough.d.ts +4 -0
  87. package/dist/components/semiotic-utils-core.d.ts +4 -0
  88. package/dist/components/semiotic-xy.d.ts +4 -0
  89. package/dist/components/semiotic.d.ts +9 -1
  90. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  91. package/dist/components/server/serverChartConfigShared.d.ts +9 -5
  92. package/dist/components/server/serverChartConfigs.d.ts +4 -4
  93. package/dist/components/server/staticAnnotations.d.ts +6 -3
  94. package/dist/components/server/staticLegend.d.ts +1 -1
  95. package/dist/components/server/staticNetwork.d.ts +4 -4
  96. package/dist/components/server/staticSVGChrome.d.ts +2 -2
  97. package/dist/components/store/ObservationStore.d.ts +21 -1
  98. package/dist/components/stream/AccessibleDataTable.d.ts +4 -10
  99. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  100. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  101. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  102. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  103. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  104. package/dist/components/stream/GeoPipelineStore.d.ts +43 -12
  105. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  106. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  107. package/dist/components/stream/NetworkPipelineStore.d.ts +24 -21
  108. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  109. package/dist/components/stream/NetworkSVGOverlay.d.ts +6 -0
  110. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  111. package/dist/components/stream/OrdinalPipelineStore.d.ts +13 -13
  112. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  113. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  114. package/dist/components/stream/ParticlePool.d.ts +1 -1
  115. package/dist/components/stream/PipelineStore.d.ts +12 -16
  116. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  117. package/dist/components/stream/SceneGraph.d.ts +3 -3
  118. package/dist/components/stream/accessorUtils.d.ts +2 -2
  119. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  120. package/dist/components/stream/frameGraphics.d.ts +4 -0
  121. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  122. package/dist/components/stream/geoPipelineHelpers.d.ts +3 -3
  123. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  124. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  125. package/dist/components/stream/geoTypes.d.ts +48 -15
  126. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  127. package/dist/components/stream/hoverUtils.d.ts +4 -2
  128. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +1 -0
  129. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  130. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  131. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  132. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  133. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  134. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  135. package/dist/components/stream/networkFramePaint.d.ts +11 -2
  136. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  137. package/dist/components/stream/networkPipelineConfig.d.ts +2 -2
  138. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  139. package/dist/components/stream/networkTypes.d.ts +37 -56
  140. package/dist/components/stream/ordinalCanvasRenderers.d.ts +2 -2
  141. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +20 -1
  142. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  143. package/dist/components/stream/ordinalTypes.d.ts +30 -3
  144. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +2 -0
  145. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +6 -0
  146. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +21 -6
  147. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  148. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  149. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +19 -1
  150. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +3 -1
  151. package/dist/components/stream/pipelineConfig.d.ts +4 -2
  152. package/dist/components/stream/pipelineDecay.d.ts +2 -2
  153. package/dist/components/stream/pipelinePulse.d.ts +2 -2
  154. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +23 -2
  155. package/dist/components/stream/pipelineTransitions.d.ts +1 -1
  156. package/dist/components/stream/pipelineUpdateContract.d.ts +7 -0
  157. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  158. package/dist/components/stream/renderBackend.d.ts +27 -0
  159. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  160. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  161. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  162. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  163. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +31 -4
  164. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  165. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  166. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  167. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  168. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  169. package/dist/components/stream/titleLayout.d.ts +31 -0
  170. package/dist/components/stream/types.d.ts +30 -65
  171. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  172. package/dist/components/stream/useFrame.d.ts +23 -0
  173. package/dist/components/stream/useLegendCategoryEmission.d.ts +3 -3
  174. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  175. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  176. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  177. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -5
  178. package/dist/controls.min.js +1 -1
  179. package/dist/controls.module.min.js +1 -1
  180. package/dist/forceLayoutWorker.js +1 -1
  181. package/dist/geo.min.js +1 -1
  182. package/dist/geo.module.min.js +1 -1
  183. package/dist/network.min.js +1 -1
  184. package/dist/network.module.min.js +1 -1
  185. package/dist/ordinal.min.js +1 -1
  186. package/dist/ordinal.module.min.js +1 -1
  187. package/dist/physics.min.js +1 -1
  188. package/dist/physics.module.min.js +1 -1
  189. package/dist/physicsWorker.js +1 -1
  190. package/dist/realtime.min.js +1 -1
  191. package/dist/realtime.module.min.js +1 -1
  192. package/dist/rough.min.js +1 -0
  193. package/dist/rough.module.min.js +1 -0
  194. package/dist/semiotic-ai-core.min.js +1 -1
  195. package/dist/semiotic-ai-core.module.min.js +1 -1
  196. package/dist/semiotic-ai.d.ts +3 -1
  197. package/dist/semiotic-ai.min.js +1 -1
  198. package/dist/semiotic-ai.module.min.js +1 -1
  199. package/dist/semiotic-controls.d.ts +2 -0
  200. package/dist/semiotic-data.min.js +1 -1
  201. package/dist/semiotic-data.module.min.js +1 -1
  202. package/dist/semiotic-experimental.min.js +1 -1
  203. package/dist/semiotic-experimental.module.min.js +1 -1
  204. package/dist/semiotic-geo.d.ts +4 -0
  205. package/dist/semiotic-network.d.ts +4 -0
  206. package/dist/semiotic-ordinal.d.ts +6 -0
  207. package/dist/semiotic-physics.d.ts +4 -0
  208. package/dist/semiotic-realtime-core.min.js +1 -1
  209. package/dist/semiotic-realtime-core.module.min.js +1 -1
  210. package/dist/semiotic-realtime-react.min.js +1 -1
  211. package/dist/semiotic-realtime-react.module.min.js +1 -1
  212. package/dist/semiotic-rough.d.ts +4 -0
  213. package/dist/semiotic-server-edge.min.js +1 -1
  214. package/dist/semiotic-server-edge.module.min.js +1 -1
  215. package/dist/semiotic-server-node.min.js +1 -1
  216. package/dist/semiotic-server-node.module.min.js +1 -1
  217. package/dist/semiotic-utils-core.d.ts +4 -0
  218. package/dist/semiotic-utils-core.min.js +1 -1
  219. package/dist/semiotic-utils-core.module.min.js +1 -1
  220. package/dist/semiotic-utils.min.js +1 -1
  221. package/dist/semiotic-utils.module.min.js +1 -1
  222. package/dist/semiotic-value.min.js +1 -1
  223. package/dist/semiotic-value.module.min.js +1 -1
  224. package/dist/semiotic-xy.d.ts +4 -0
  225. package/dist/semiotic.d.ts +9 -1
  226. package/dist/semiotic.min.js +1 -1
  227. package/dist/semiotic.module.min.js +1 -1
  228. package/dist/server.min.js +1 -1
  229. package/dist/server.module.min.js +1 -1
  230. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  231. package/dist/test-utils/frameMock.d.ts +12 -9
  232. package/dist/xy.min.js +1 -1
  233. package/dist/xy.module.min.js +1 -1
  234. package/package.json +26 -7
@@ -4,6 +4,7 @@ import type { StreamGeoFrameProps, ProjectionProp } from "../../stream/geoTypes"
4
4
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
5
5
  import { type TooltipProp } from "../../Tooltip/Tooltip";
6
6
  import type { LegendInteractionMode } from "../shared/hooks";
7
+ import { type StyleRule } from "../shared/styleRules";
7
8
  import { type AreasProp } from "../../geo/useReferenceAreas";
8
9
  /**
9
10
  * ChoroplethMap component props
@@ -33,6 +34,17 @@ export interface ChoroplethMapProps<TDatum extends Datum = Datum> extends BaseCh
33
34
  valueAccessor: ChartAccessor<TDatum, number>;
34
35
  /** Sequential color scheme @default "blues" */
35
36
  colorScheme?: string;
37
+ /**
38
+ * Declarative, threshold-aware feature styling. Ordered `{ when, style }`
39
+ * rules; last applicable rule wins per property. `when` accepts a predicate
40
+ * `(feature, ctx) => boolean` (`ctx.value` is the feature's `valueAccessor`
41
+ * value; rules see the feature with its `properties` flattened, so
42
+ * `{ field: "iso", eq: "USA" }` works), a declarative threshold
43
+ * (`{ gt, gte, within, in, … }`), or `true`. A rule's `fill` may be a color
44
+ * or a HatchFill (hatch flags a feature — e.g. "no data" / "under review").
45
+ * Layers over the sequential-scale base fill.
46
+ */
47
+ styleRules?: StyleRule[];
36
48
  /** Geographic projection @default "equalEarth" */
37
49
  projection?: ProjectionProp;
38
50
  /** Show graticule grid lines */
@@ -43,8 +55,13 @@ export interface ChoroplethMapProps<TDatum extends Datum = Datum> extends BaseCh
43
55
  showLegend?: boolean;
44
56
  /** Legend interaction mode */
45
57
  legendInteraction?: LegendInteractionMode;
46
- /** Padding fraction for auto-fit projection. 0.1 = 10% inset from edges. @default 0 */
47
- fitPadding?: number;
58
+ /**
59
+ * Finite projection-fit fraction in `[0, 0.5)`. `0.1` = 10% inset;
60
+ * nullish values use 0 and invalid values throw. An explicit
61
+ * `frameProps.projectionExtent` remains authoritative.
62
+ * @default 0
63
+ */
64
+ fitPadding?: number | null;
48
65
  /** Enable zoom/pan. Defaults to true when tileURL is set, false otherwise. */
49
66
  zoomable?: boolean;
50
67
  /** [minZoom, maxZoom] @default [1, 8] */
@@ -4,6 +4,7 @@ import type { StreamGeoFrameProps, ProjectionProp } from "../../stream/geoTypes"
4
4
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
5
5
  import { type TooltipProp } from "../../Tooltip/Tooltip";
6
6
  import type { LegendPosition } from "../shared/hooks";
7
+ import { type StyleRule } from "../shared/styleRules";
7
8
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
9
  export interface DistanceCartogramProps<TDatum extends Datum = Datum> extends BaseChartProps {
9
10
  /** Point data with geographic coordinates */
@@ -36,6 +37,12 @@ export interface DistanceCartogramProps<TDatum extends Datum = Datum> extends Ba
36
37
  transition?: number;
37
38
  /** Field to determine point color */
38
39
  colorBy?: ChartAccessor<TDatum, string>;
40
+ /**
41
+ * Declarative, threshold-aware point styling. Ordered `{ when, style }`
42
+ * rules; last applicable rule wins. `ctx` = `{ value, category }`
43
+ * (category = `colorBy`). A rule `fill` may be a color or a HatchFill.
44
+ */
45
+ styleRules?: StyleRule[];
39
46
  /** Color scheme @default "category10" */
40
47
  colorScheme?: string | string[] | Record<string, string>;
41
48
  /** Point radius @default 5 */
@@ -46,8 +53,13 @@ export interface DistanceCartogramProps<TDatum extends Datum = Datum> extends Ba
46
53
  showLegend?: boolean;
47
54
  /** Legend position */
48
55
  legendPosition?: LegendPosition;
49
- /** Padding fraction for auto-fit projection. 0.1 = 10% inset from edges. @default 0 */
50
- fitPadding?: number;
56
+ /**
57
+ * Finite projection-fit fraction in `[0, 0.5)`. `0.1` = 10% inset;
58
+ * nullish values use 0 and invalid values throw. An explicit
59
+ * `frameProps.projectionExtent` remains authoritative.
60
+ * @default 0
61
+ */
62
+ fitPadding?: number | null;
51
63
  /** Enable zoom/pan. Defaults to true when tileURL is set, false otherwise. */
52
64
  zoomable?: boolean;
53
65
  /** [minZoom, maxZoom] @default [1, 8] */
@@ -10,12 +10,11 @@ import type { GeoParticleStyle } from "../../stream/GeoParticlePool";
10
10
  import { type AreasProp } from "../../geo/useReferenceAreas";
11
11
  export interface FlowMapProps<TDatum extends Datum = Datum> extends BaseChartProps {
12
12
  /** Flow edges with source/target/value */
13
- flows?: {
13
+ flows?: Array<Datum & {
14
14
  source: string;
15
15
  target: string;
16
16
  value?: number;
17
- [key: string]: any;
18
- }[];
17
+ }>;
19
18
  /** Geographic nodes with coordinates */
20
19
  nodes?: TDatum[];
21
20
  /** Node ID accessor @default "id" */
@@ -39,7 +38,7 @@ export interface FlowMapProps<TDatum extends Datum = Datum> extends BaseChartPro
39
38
  /** Background area style */
40
39
  areaStyle?: Style;
41
40
  /** Edge color accessor */
42
- edgeColorBy?: ChartAccessor<any, string>;
41
+ edgeColorBy?: ChartAccessor<Datum, string>;
43
42
  /** Edge opacity @default 0.6 */
44
43
  edgeOpacity?: number;
45
44
  /** Min/max pixel width for proportional edge width @default [1, 8] */
@@ -60,8 +59,13 @@ export interface FlowMapProps<TDatum extends Datum = Datum> extends BaseChartPro
60
59
  legendInteraction?: LegendInteractionMode;
61
60
  /** Legend position */
62
61
  legendPosition?: LegendPosition;
63
- /** Padding fraction for auto-fit projection. 0.1 = 10% inset from edges. @default 0 */
64
- fitPadding?: number;
62
+ /**
63
+ * Finite projection-fit fraction in `[0, 0.5)`. `0.1` = 10% inset;
64
+ * nullish values use 0 and invalid values throw. An explicit
65
+ * `frameProps.projectionExtent` remains authoritative.
66
+ * @default 0
67
+ */
68
+ fitPadding?: number | null;
65
69
  /** Enable zoom/pan. Defaults to true when tileURL is set, false otherwise. */
66
70
  zoomable?: boolean;
67
71
  /** [minZoom, maxZoom] @default [1, 8] */
@@ -5,6 +5,7 @@ import type { RealtimeFrameHandle } from "../../realtime/types";
5
5
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  import type { Style } from "../../stream/types";
9
10
  import { type AreasProp } from "../../geo/useReferenceAreas";
10
11
  export interface ProportionalSymbolMapProps<TDatum extends Datum = Datum> extends BaseChartProps {
@@ -20,6 +21,12 @@ export interface ProportionalSymbolMapProps<TDatum extends Datum = Datum> extend
20
21
  sizeRange?: [number, number];
21
22
  /** Field to determine point color */
22
23
  colorBy?: ChartAccessor<TDatum, string>;
24
+ /**
25
+ * Declarative, threshold-aware symbol styling. Ordered `{ when, style }`
26
+ * rules; last applicable rule wins. `ctx` = `{ value, category }` (value =
27
+ * `sizeBy`, category = `colorBy`). A rule `fill` may be a color or HatchFill.
28
+ */
29
+ styleRules?: StyleRule[];
23
30
  /** Color scheme @default "category10" */
24
31
  colorScheme?: string | string[] | Record<string, string>;
25
32
  /** Geographic projection @default "equalEarth" */
@@ -38,8 +45,13 @@ export interface ProportionalSymbolMapProps<TDatum extends Datum = Datum> extend
38
45
  legendInteraction?: LegendInteractionMode;
39
46
  /** Legend position */
40
47
  legendPosition?: LegendPosition;
41
- /** Padding fraction for auto-fit projection. 0.1 = 10% inset from edges. @default 0 */
42
- fitPadding?: number;
48
+ /**
49
+ * Finite projection-fit fraction in `[0, 0.5)`. `0.1` = 10% inset;
50
+ * nullish values use 0 and invalid values throw. An explicit
51
+ * `frameProps.projectionExtent` remains authoritative.
52
+ * @default 0
53
+ */
54
+ fitPadding?: number | null;
43
55
  /** Enable zoom/pan. Defaults to true when tileURL is set, false otherwise. */
44
56
  zoomable?: boolean;
45
57
  /** [minZoom, maxZoom] @default [1, 8] */
@@ -133,3 +133,9 @@ export { Tooltip, MultiLineTooltip, normalizeTooltip } from "../Tooltip/Tooltip"
133
133
  export type { TooltipProp, TooltipConfig, TooltipField, MultiLineTooltipConfig } from "../Tooltip/Tooltip";
134
134
  export { createHatchPattern } from "./shared/hatchPattern";
135
135
  export type { HatchPatternOptions } from "./shared/hatchPattern";
136
+ export { isHatchFill, hatchPatternDef, resolveSvgFill, hatchFillId } from "./shared/hatchFill";
137
+ export type { HatchFill } from "./shared/hatchFill";
138
+ export { resolveStyleRules, matchesThreshold, ruleMatches, makeRuleValueResolver, makeXYRuleContext, makeNodeRuleContext, composeStyleRules, makeStyleRuleStyleFn, } from "./shared/styleRules";
139
+ export type { StyleRule, StyleRuleStyle, StyleRuleThreshold, StyleRuleContext, StyleRulePredicate, } from "./shared/styleRules";
140
+ export { AnnotationLabel, estimateLabelWidth } from "./shared/AnnotationLabel";
141
+ export type { AnnotationLabelBackground, AnnotationLabelBackgroundConfig, AnnotationLabelProps } from "./shared/AnnotationLabel";
@@ -5,6 +5,7 @@ import type { RealtimeFrameHandle } from "../../realtime/types";
5
5
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { LegendInteractionMode } from "../shared/hooks";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  /**
9
10
  * ChordDiagram component props
10
11
  */
@@ -17,10 +18,17 @@ export interface ChordDiagramProps<TNode extends Datum = Datum, TEdge extends Da
17
18
  nodeIdAccessor?: ChartAccessor<TNode, string>;
18
19
  colorBy?: ChartAccessor<TNode, string>;
19
20
  colorScheme?: string | string[] | Record<string, string>;
21
+ /**
22
+ * Declarative, threshold-aware node styling (see ForceDirectedGraph).
23
+ * Ordered `{ when, style }` rules; last applicable rule wins. Rules see the
24
+ * raw node object. A rule `fill` may be a color or a HatchFill.
25
+ */
26
+ styleRules?: StyleRule[];
20
27
  edgeColorBy?: "source" | "target" | ((d: Datum) => string);
21
28
  padAngle?: number;
22
29
  groupWidth?: number;
23
- sortGroups?: (a: any, b: any) => number;
30
+ /** Compare D3 chord group indices to control their angular order. */
31
+ sortGroups?: (a: number, b: number) => number;
24
32
  nodeLabel?: ChartAccessor<TNode, string>;
25
33
  showLabels?: boolean;
26
34
  enableHover?: boolean;
@@ -5,6 +5,7 @@ import type { RealtimeFrameHandle } from "../../realtime/types";
5
5
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  /**
9
10
  * ForceDirectedGraph component props
10
11
  */
@@ -68,6 +69,16 @@ export interface ForceDirectedGraphProps<TNode extends Datum = Datum, TEdge exte
68
69
  colorBy?: ChartAccessor<TNode, string>;
69
70
  /** d3 scheme name or explicit color array; falls back to theme. */
70
71
  colorScheme?: string | string[] | Record<string, string>;
72
+ /**
73
+ * Declarative, threshold-aware node styling. Ordered `{ when, style }`
74
+ * rules; the last applicable rule wins per property. `when` accepts a
75
+ * predicate `(node, ctx) => boolean` (rules see the raw node object; `ctx` =
76
+ * `{ value, category }` where `category` is the `colorBy` group), a
77
+ * declarative threshold (`{ field, gt, eq, in, … }`), or `true` — so you can
78
+ * style whole groups of nodes (`{ field: "type", eq: "db" }`). A rule's
79
+ * `fill` may be a color or a HatchFill. Layers over the resolved node color.
80
+ */
81
+ styleRules?: StyleRule[];
71
82
  /**
72
83
  * Constant pixel radius, or a function/field returning a numeric value
73
84
  * scaled into `nodeSizeRange`.
@@ -5,6 +5,7 @@ import type { RealtimeFrameHandle } from "../../realtime/types";
5
5
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  /**
9
10
  * SankeyDiagram component props
10
11
  */
@@ -17,6 +18,13 @@ export interface SankeyDiagramProps<TNode extends Datum = Datum, TEdge extends D
17
18
  nodeIdAccessor?: ChartAccessor<TNode, string>;
18
19
  colorBy?: ChartAccessor<TNode, string>;
19
20
  colorScheme?: string | string[] | Record<string, string>;
21
+ /**
22
+ * Declarative, threshold-aware node styling (see ForceDirectedGraph).
23
+ * Ordered `{ when, style }` rules; last applicable rule wins. Rules see the
24
+ * raw node object; `ctx` = `{ value, category }`. A rule `fill` may be a
25
+ * color or a HatchFill. Layers over the resolved node color.
26
+ */
27
+ styleRules?: StyleRule[];
20
28
  edgeColorBy?: "source" | "target" | "gradient" | ((d: Datum) => string);
21
29
  orientation?: "horizontal" | "vertical";
22
30
  nodeAlign?: "justify" | "left" | "right" | "center";
@@ -31,7 +39,7 @@ export interface SankeyDiagramProps<TNode extends Datum = Datum, TEdge extends D
31
39
  legendPosition?: LegendPosition;
32
40
  legendInteraction?: LegendInteractionMode;
33
41
  edgeOpacity?: number;
34
- edgeSort?: (a: any, b: any) => number;
42
+ edgeSort?: (a: TEdge, b: TEdge) => number;
35
43
  tooltip?: TooltipProp;
36
44
  frameProps?: Partial<Omit<StreamNetworkFrameProps, "edges" | "size">>;
37
45
  }
@@ -5,6 +5,7 @@ import type { LegendInteractionMode } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  import { type RegressionProp } from "../shared/regressionUtils";
9
10
  /**
10
11
  * BarChart component props
@@ -81,6 +82,26 @@ export interface BarChartProps<TDatum extends Datum = Datum> extends BaseChartPr
81
82
  color: string;
82
83
  }>;
83
84
  };
85
+ /**
86
+ * Declarative, threshold-aware bar styling. An ordered list of
87
+ * `{ when, style }` rules; every rule whose condition matches a bar
88
+ * contributes its style, merged in order so the **last applicable rule
89
+ * wins** per property. `when` accepts a predicate `(datum, ctx) => boolean`,
90
+ * a declarative threshold (`{ gt, lte, within, in, … }` — compares the
91
+ * bar's value unless `field` is set), or `true`/omitted (always applies).
92
+ * A rule's `fill` may be a color string or a declarative
93
+ * {@link HatchFill} for diagonal hatching (renders on canvas and SSR).
94
+ * Rules layer over the resolved base color; `frameProps.pieceStyle` and
95
+ * top-level `stroke`/`strokeWidth`/`opacity` still override them.
96
+ * @example
97
+ * ```tsx
98
+ * styleRules={[
99
+ * { when: { gte: 10 }, style: { fill: "var(--semiotic-warning)" } },
100
+ * { when: { gt: 15 }, style: { fill: { type: "hatch", background: "#e0a92a", stroke: "#fff" } } },
101
+ * ]}
102
+ * ```
103
+ */
104
+ styleRules?: StyleRule[];
84
105
  /** When true, adds padding below the 0 baseline. Default false (bars flush with axis). */
85
106
  baselinePadding?: boolean;
86
107
  enableHover?: boolean;
@@ -4,6 +4,7 @@ import type { StreamOrdinalFrameProps } from "../../stream/ordinalTypes";
4
4
  import type { LegendInteractionMode } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
+ import { type StyleRule } from "../shared/styleRules";
7
8
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
9
  export interface GroupedBarChartProps<TDatum extends Datum = Datum> extends BaseChartProps {
9
10
  data?: TDatum[];
@@ -21,6 +22,16 @@ export interface GroupedBarChartProps<TDatum extends Datum = Datum> extends Base
21
22
  barPadding?: number;
22
23
  /** Rounded corner radius on bar ends (away from baseline). */
23
24
  roundedTop?: number;
25
+ /**
26
+ * Declarative, threshold-aware bar styling. Ordered `{ when, style }`
27
+ * rules; the last applicable rule wins per property. `when` accepts a
28
+ * predicate `(datum, ctx) => boolean` (where `ctx.category` is the group
29
+ * series key), a declarative threshold on the bar value
30
+ * (`{ gt, lte, within, in, … }`), or `true`. A rule's `fill` may be a color
31
+ * or a {@link HatchFill}. Layers over the resolved series color;
32
+ * `frameProps.pieceStyle` overrides.
33
+ */
34
+ styleRules?: StyleRule[];
24
35
  baselinePadding?: boolean;
25
36
  enableHover?: boolean;
26
37
  showGrid?: boolean;
@@ -5,6 +5,7 @@ import type { LegendInteractionMode } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ import { type StyleRule } from "../shared/styleRules";
8
9
  export interface StackedBarChartProps<TDatum extends Datum = Datum> extends BaseChartProps {
9
10
  data?: TDatum[];
10
11
  categoryAccessor?: ChartAccessor<TDatum, string>;
@@ -22,6 +23,16 @@ export interface StackedBarChartProps<TDatum extends Datum = Datum> extends Base
22
23
  barPadding?: number;
23
24
  /** Rounded top corner radius. Only the topmost stacked segment gets rounded. */
24
25
  roundedTop?: number;
26
+ /**
27
+ * Declarative, threshold-aware segment styling. Ordered `{ when, style }`
28
+ * rules; the last applicable rule wins per property. `when` accepts a
29
+ * predicate `(datum, ctx) => boolean` (where `ctx.category` is the stack
30
+ * series key), a declarative threshold on the segment value
31
+ * (`{ gt, lte, within, in, … }`), or `true`. A rule's `fill` may be a color
32
+ * or a {@link HatchFill} for hatching a segment (e.g. a "fixed-rate" band).
33
+ * Layers over the resolved series color; `frameProps.pieceStyle` overrides.
34
+ */
35
+ styleRules?: StyleRule[];
25
36
  baselinePadding?: boolean;
26
37
  enableHover?: boolean;
27
38
  showGrid?: boolean;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { Datum } from "../shared/datumTypes";
3
3
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
4
+ import type { StyleRule } from "../shared/styleRules";
4
5
  import { type PhysicsFrameHandle } from "./physicsHocHandle";
5
6
  import { type PhysicsHocFrameProps, type PhysicsSharedChartProps, type TooltipProp } from "./physicsHocUtils";
6
7
  export interface CollisionSwarmChartProps<TDatum extends Datum = Datum> extends Omit<BaseChartProps, "margin">, PhysicsSharedChartProps {
@@ -11,6 +12,12 @@ export interface CollisionSwarmChartProps<TDatum extends Datum = Datum> extends
11
12
  radiusAccessor?: ChartAccessor<TDatum, number>;
12
13
  pointRadius?: number;
13
14
  colorBy?: ChartAccessor<TDatum, string>;
15
+ /**
16
+ * Declarative, threshold-aware dot styling. Ordered `{ when, style }` rules;
17
+ * last applicable rule wins. `ctx` = `{ value, category }` (value = the
18
+ * `xAccessor` position). A rule `fill` may be a color or a HatchFill.
19
+ */
20
+ styleRules?: StyleRule[];
14
21
  seed?: number;
15
22
  xExtent?: [number, number];
16
23
  collisionIterations?: number;
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import type { Datum } from "../shared/datumTypes";
3
3
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
4
4
  import { type EventDropWindowOptions } from "./physicsChartUtils";
5
+ import type { StyleRule } from "../shared/styleRules";
5
6
  import { type PhysicsFrameHandle } from "./physicsHocHandle";
6
7
  import { type PhysicsHocFrameProps, type PhysicsSharedChartProps, type TooltipProp } from "./physicsHocUtils";
7
8
  export interface EventDropChartProps<TDatum extends Datum = Datum> extends Omit<BaseChartProps, "margin">, PhysicsSharedChartProps {
@@ -16,6 +17,12 @@ export interface EventDropChartProps<TDatum extends Datum = Datum> extends Omit<
16
17
  } | ((latestEventTime: number) => number);
17
18
  ballRadius?: number;
18
19
  colorBy?: ChartAccessor<TDatum, string>;
20
+ /**
21
+ * Declarative, threshold-aware drop styling. Ordered `{ when, style }`
22
+ * rules; last applicable rule wins. `ctx` = `{ value, category }` (value =
23
+ * the event time). A rule `fill` may be a color or a HatchFill.
24
+ */
25
+ styleRules?: StyleRule[];
19
26
  seed?: number;
20
27
  timeExtent?: [number, number];
21
28
  timeScale?: number;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { Datum } from "../shared/datumTypes";
3
3
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
4
+ import type { StyleRule } from "../shared/styleRules";
4
5
  import { type PhysicsFrameHandle } from "./physicsHocHandle";
5
6
  import { type PhysicsHocFrameProps, type PhysicsSharedChartProps, type PhysicsSimulationMode, type TooltipProp } from "./physicsHocUtils";
6
7
  import type { ChartMode } from "../shared/types";
@@ -32,6 +33,13 @@ export interface GaltonBoardChartProps<TDatum extends Datum = Datum> extends Omi
32
33
  branchProbability?: number;
33
34
  ballRadius?: number;
34
35
  colorBy?: ChartAccessor<TDatum, string>;
36
+ /**
37
+ * Declarative, threshold-aware ball styling. Ordered `{ when, style }`
38
+ * rules; last applicable rule wins. Rules resolve against each ball's datum;
39
+ * `ctx` = `{ value, category }` (category = the colorBy group). A rule `fill`
40
+ * may be a color or a HatchFill. Layers over the colorBy-derived fill.
41
+ */
42
+ styleRules?: StyleRule[];
35
43
  referenceLines?: GaltonBoardReferenceLine | GaltonBoardReferenceLine[];
36
44
  seed?: number;
37
45
  showProjection?: boolean;
@@ -1,16 +1,17 @@
1
1
  import * as React from "react";
2
2
  import type { ReactNode } from "react";
3
- import { type ScaleLinear } from "d3-scale";
3
+ import type { ScaleLinear } from "d3-scale";
4
4
  import type { ThemeSemanticColors } from "../../stream/types";
5
5
  import { type PhysicsSemanticItem, type StreamPhysicsBodyForce, type StreamPhysicsFrameProps, type StreamPhysicsRegionEffect } from "../../stream/physics/StreamPhysicsFrame";
6
6
  import type { PhysicsController } from "../../stream/physics/PhysicsControllers";
7
- import { PhysicsPipelineStore, type PhysicsPipelineConfig, type PhysicsQueuedSpawn, type PhysicsSpawnPacingOptions } from "../../stream/physics/PhysicsPipelineStore";
7
+ import type { PhysicsPipelineStore, PhysicsPipelineConfig, PhysicsQueuedSpawn, PhysicsSpawnPacingOptions } from "../../stream/physics/PhysicsPipelineStore";
8
8
  import type { PhysicsColliderSpec, PhysicsSpringSpec } from "../../stream/physics/PhysicsKernel";
9
9
  import type { Datum } from "../shared/datumTypes";
10
10
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
11
- import { type PhysicsChartArea } from "./physicsChartUtils";
11
+ import type { PhysicsChartArea } from "./physicsChartUtils";
12
12
  import { type PhysicsDatumSpawnResult, type PhysicsFrameHandle } from "./physicsHocHandle";
13
13
  import { type PhysicsHocFrameProps, type PhysicsSharedChartProps, type TooltipProp } from "./physicsHocUtils";
14
+ export { resolveCustomLayout } from "./physicsCustomLayout";
14
15
  export interface PhysicsCustomLayoutContext<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>> {
15
16
  data: TDatum[];
16
17
  scales: {
@@ -91,28 +92,6 @@ export interface PhysicsCustomChartProps<TDatum extends Datum = Datum, TConfig e
91
92
  */
92
93
  frameProps?: PhysicsHocFrameProps<"config">;
93
94
  }
94
- interface ResolvedPhysicsCustomLayout<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>> {
95
- config: PhysicsPipelineConfig;
96
- context: PhysicsCustomLayoutContext<TDatum, TConfig>;
97
- initialSpawnPacing?: PhysicsSpawnPacingOptions;
98
- initialSpawns: PhysicsQueuedSpawn[];
99
- result: PhysicsCustomLayoutResult;
100
- }
101
- export declare function resolveCustomLayout<TDatum extends Datum, TConfig extends object>(options: {
102
- chartId?: string;
103
- colorScheme?: string | string[] | Record<string, string>;
104
- config?: PhysicsPipelineConfig;
105
- data: TDatum[];
106
- layout: PhysicsCustomLayout<TDatum, TConfig>;
107
- layoutConfig?: TConfig;
108
- onObservation?: BaseChartProps["onObservation"];
109
- semantic: ThemeSemanticColors;
110
- skipLayout?: boolean;
111
- size: [number, number];
112
- themeCategorical: string[];
113
- xExtent?: [number, number];
114
- yExtent?: [number, number];
115
- }): ResolvedPhysicsCustomLayout<TDatum, TConfig>;
116
95
  export declare const PhysicsCustomChart: {
117
96
  <TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>>(props: PhysicsCustomChartProps<TDatum, TConfig> & React.RefAttributes<PhysicsFrameHandle>): React.ReactElement | null;
118
97
  displayName?: string;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { Datum } from "../shared/datumTypes";
3
3
  import type { BaseChartProps, ChartAccessor, ChartMode } from "../shared/types";
4
+ import type { StyleRule } from "../shared/styleRules";
4
5
  import { type PhysicsFrameHandle } from "./physicsHocHandle";
5
6
  import { type PhysicsHocFrameProps, type PhysicsSharedChartProps, type PhysicsSimulationMode, type TooltipProp } from "./physicsHocUtils";
6
7
  export interface PhysicsPileChartProps<TDatum extends Datum = Datum> extends Omit<BaseChartProps, "margin" | "mode">, PhysicsSharedChartProps {
@@ -19,6 +20,12 @@ export interface PhysicsPileChartProps<TDatum extends Datum = Datum> extends Omi
19
20
  unitValue?: number;
20
21
  ballRadius?: number;
21
22
  colorBy?: ChartAccessor<TDatum, string>;
23
+ /**
24
+ * Declarative, threshold-aware body styling. Ordered `{ when, style }`
25
+ * rules; last applicable rule wins. `ctx` = `{ value, category }`. A rule
26
+ * `fill` may be a color or a HatchFill. Layers over the colorBy-derived fill.
27
+ */
28
+ styleRules?: StyleRule[];
22
29
  seed?: number;
23
30
  showProjection?: boolean;
24
31
  sediment?: boolean;
@@ -1,6 +1,7 @@
1
1
  import type { Datum } from "../shared/datumTypes";
2
2
  import type { ChartAccessor } from "../shared/types";
3
3
  import type { Style } from "../../stream/types";
4
+ import { type StyleRule } from "../shared/styleRules";
4
5
  import type { PhysicsColliderSpec } from "../../stream/physics/PhysicsKernel";
5
6
  import type { PhysicsPipelineConfig, PhysicsQueuedSpawn, PhysicsSpawnPacingOptions } from "../../stream/physics/PhysicsPipelineStore";
6
7
  import type { PhysicsSemanticItem } from "../../stream/physics/StreamPhysicsTypes";
@@ -27,7 +28,22 @@ export interface PhysicsChartArea {
27
28
  }
28
29
  export declare function physicsChartArea(size: [number, number]): PhysicsChartArea;
29
30
  export declare function hashStringColor(value: unknown): string;
30
- export declare function styleFromColorAccessor<TDatum extends Datum>(colorBy: ChartAccessor<TDatum, string> | undefined, fallback?: string): (body: {
31
+ export interface PhysicsStyleRuleOptions {
32
+ /** Declarative style rules, merged on top of the colorBy-derived body fill. */
33
+ styleRules?: ReadonlyArray<StyleRule>;
34
+ /** Numeric field/accessor a threshold rule compares against (defaults to `value`). */
35
+ valueAccessor?: string | ((d: Datum) => unknown);
36
+ }
37
+ /**
38
+ * Build a per-body `bodyStyle` from a `colorBy` accessor. When `styleRules`
39
+ * are supplied, the merged rule style layers on top of the colorBy-derived
40
+ * fill (last-applicable rule wins) — the physics counterpart to the ordinal
41
+ * bar `styleRules`. Rules resolve against the body's original `datum`; `ctx` =
42
+ * `{ value, category }` where `category` is the colorBy group. Because every
43
+ * colorBy-driven physics HOC and its SSR config funnel through this helper,
44
+ * one call wires rules for all of them.
45
+ */
46
+ export declare function styleFromColorAccessor<TDatum extends Datum>(colorBy: ChartAccessor<TDatum, string> | undefined, fallback?: string, opts?: PhysicsStyleRuleOptions): (body: {
31
47
  datum?: unknown;
32
48
  }) => Style;
33
49
  export declare function baseConfig(seed: number, colliders: PhysicsColliderSpec[], chartType: string, kernel?: Partial<NonNullable<PhysicsPipelineConfig["kernel"]>>): PhysicsPipelineConfig;
@@ -0,0 +1,32 @@
1
+ import type { ThemeSemanticColors } from "../../stream/types";
2
+ import { type PhysicsPipelineConfig, type PhysicsQueuedSpawn, type PhysicsSpawnPacingOptions } from "../../stream/physics/PhysicsPipelineStore";
3
+ import type { Datum } from "../shared/datumTypes";
4
+ import type { BaseChartProps } from "../shared/types";
5
+ import type { PhysicsCustomLayout, PhysicsCustomLayoutContext, PhysicsCustomLayoutResult } from "./PhysicsCustomChart";
6
+ interface ResolvedPhysicsCustomLayout<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>> {
7
+ config: PhysicsPipelineConfig;
8
+ context: PhysicsCustomLayoutContext<TDatum, TConfig>;
9
+ initialSpawnPacing?: PhysicsSpawnPacingOptions;
10
+ initialSpawns: PhysicsQueuedSpawn[];
11
+ result: PhysicsCustomLayoutResult;
12
+ }
13
+ /**
14
+ * Resolve the pure PhysicsCustomChart layout contract without importing the
15
+ * React HOC. Shared by the component and the static server renderer.
16
+ */
17
+ export declare function resolveCustomLayout<TDatum extends Datum, TConfig extends object>(options: {
18
+ chartId?: string;
19
+ colorScheme?: string | string[] | Record<string, string>;
20
+ config?: PhysicsPipelineConfig;
21
+ data: TDatum[];
22
+ layout: PhysicsCustomLayout<TDatum, TConfig>;
23
+ layoutConfig?: TConfig;
24
+ onObservation?: BaseChartProps["onObservation"];
25
+ semantic: ThemeSemanticColors;
26
+ skipLayout?: boolean;
27
+ size: [number, number];
28
+ themeCategorical: string[];
29
+ xExtent?: [number, number];
30
+ yExtent?: [number, number];
31
+ }): ResolvedPhysicsCustomLayout<TDatum, TConfig>;
32
+ export {};
@@ -0,0 +1,88 @@
1
+ /**
2
+ * `<AnnotationLabel>` — the single, shared renderer for the text label of a
3
+ * region-bounding annotation (threshold lines, bands, enclosures, category
4
+ * highlights) across every frame and the server SSR path.
5
+ *
6
+ * Two problems it solves:
7
+ * 1. **Legibility.** A label sitting over dense marks needs a backdrop to
8
+ * stay readable. Historically the region rules hand-rolled a
9
+ * `paint-order: stroke` white "halo" inline — and only some of them, and
10
+ * the client and server disagreed (client `y-threshold` had a halo, the
11
+ * server's didn't). This component makes the halo a first-class,
12
+ * consistent option and adds a genuine semitransparent **box** backdrop
13
+ * (the rounded panel behind a label like "Fast-scaling · 10").
14
+ * 2. **Duplication.** Client (`annotationRules.tsx`) and server
15
+ * (`staticAnnotations.tsx`) both emit label `<text>`; routing both through
16
+ * one component removes the drift.
17
+ *
18
+ * `background` is the knob:
19
+ * - `"halo"` / `true` — a stroke halo (default for region annotations; matches
20
+ * the legacy look byte-for-byte when `haloColor`/`haloWidth` are unset)
21
+ * - `"box"` — a filled, optionally-semitransparent rounded rect behind the text
22
+ * - `"none"` / `false` — plain text
23
+ * - a config object — fine-grained control over either treatment
24
+ *
25
+ * The box's geometry is derived from an *estimated* text width (SVG can't
26
+ * measure text without a live DOM, and the server path has none), which is
27
+ * accurate enough for a padded backdrop and identical on both backends.
28
+ */
29
+ import * as React from "react";
30
+ export interface AnnotationLabelBackgroundConfig {
31
+ /** Backdrop treatment. @default "halo" */
32
+ type?: "halo" | "box";
33
+ /**
34
+ * Backdrop paint. For `"halo"` it is the outline color (defaults to the
35
+ * plot background so the halo "erases" marks under the text). For `"box"`
36
+ * it is the panel fill.
37
+ * @default "var(--semiotic-bg, #ffffff)"
38
+ */
39
+ fill?: string;
40
+ /** Box fill opacity (box mode only). @default 0.85 */
41
+ opacity?: number;
42
+ /** Box inner padding in px — number (uniform) or `{x,y}`. @default {x:6,y:3} */
43
+ padding?: number | {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ /** Box corner radius in px. @default 3 */
48
+ radius?: number;
49
+ /** Box border color (box mode only). */
50
+ stroke?: string;
51
+ /** Box border width in px. @default 0 */
52
+ strokeWidth?: number;
53
+ /** Halo stroke width in px (halo mode only). @default 3 */
54
+ haloWidth?: number;
55
+ }
56
+ export type AnnotationLabelBackground = boolean | "halo" | "box" | "none" | AnnotationLabelBackgroundConfig;
57
+ export interface AnnotationLabelProps {
58
+ x: number;
59
+ y: number;
60
+ text: string | number;
61
+ /** Text color. */
62
+ fill: string;
63
+ fontSize?: number;
64
+ fontWeight?: string | number;
65
+ fontFamily?: string;
66
+ textAnchor?: "start" | "middle" | "end";
67
+ dominantBaseline?: React.SVGAttributes<SVGTextElement>["dominantBaseline"];
68
+ /**
69
+ * Backdrop treatment. Defaults to `"halo"` (the legacy region-label look).
70
+ * Pass `"box"` for a semitransparent panel, `"none"` for plain text, or a
71
+ * config object for fine control.
72
+ */
73
+ background?: AnnotationLabelBackground;
74
+ className?: string;
75
+ }
76
+ /**
77
+ * Rough width of a rendered label. SVG offers no synchronous text metrics
78
+ * (and the server has no DOM at all), so we estimate from character count.
79
+ * ~0.6em per glyph is a reasonable average for the sans-serif UI faces this
80
+ * library ships; the box carries padding, so a small error is invisible.
81
+ */
82
+ export declare function estimateLabelWidth(text: string | number, fontSize: number): number;
83
+ /**
84
+ * Render an annotation's text label with an optional legibility backdrop.
85
+ * Emits a bare `<text>` (halo/none) or a `<g>` with a backing `<rect>` + text
86
+ * (box). Safe on both the client SVG overlay and the server static SVG path.
87
+ */
88
+ export declare function AnnotationLabel(props: AnnotationLabelProps): React.ReactElement;