semiotic 3.8.5 → 3.8.7

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 (277) hide show
  1. package/CLAUDE.md +37 -10
  2. package/README.md +83 -56
  3. package/ai/behaviorContracts.cjs +88 -3
  4. package/ai/componentMetadata.cjs +5 -10
  5. package/ai/dist/mcp-server.js +99 -10
  6. package/ai/examples.md +198 -9
  7. package/ai/schema.json +2002 -165
  8. package/ai/surface-manifest.json +14 -10
  9. package/ai/system-prompt.md +9 -3
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-JDSVSKGM.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  12. package/dist/chunk-chunk-2YAZHXL4.module.min.js +2 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
  15. package/dist/chunk-chunk-5SD6BHVW.module.min.js +2 -0
  16. package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
  17. package/dist/chunk-chunk-7TTBHSAG.module.min.js +2 -0
  18. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +2 -0
  19. package/dist/chunk-chunk-BGHPD3RA.module.min.js +1 -0
  20. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +2 -0
  21. package/dist/chunk-chunk-BNGBEY7N.module.min.js +2 -0
  22. package/dist/chunk-chunk-C7APLVQD.module.min.js +2 -0
  23. package/dist/chunk-chunk-DGWFBOGB.module.min.js +1 -0
  24. package/dist/chunk-chunk-DIVE2DRA.module.min.js +2 -0
  25. package/dist/chunk-chunk-FBUNUIPV.module.min.js +2 -0
  26. package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
  27. package/dist/chunk-chunk-FRO4TRXK.module.min.js +2 -0
  28. package/dist/chunk-chunk-G7QVPZUD.module.min.js +2 -0
  29. package/dist/chunk-chunk-GBPYV4FP.module.min.js +2 -0
  30. package/dist/chunk-chunk-GU2EJIDJ.module.min.js +2 -0
  31. package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
  32. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-JWXLNZSM.module.min.js} +1 -1
  33. package/dist/chunk-chunk-KXAFCCDB.module.min.js +2 -0
  34. package/dist/chunk-chunk-LG7YKJAK.module.min.js +2 -0
  35. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-LVHDZAT3.module.min.js} +1 -1
  36. package/dist/chunk-chunk-LWITSR2O.module.min.js +2 -0
  37. package/dist/chunk-chunk-MX35T6RX.module.min.js +2 -0
  38. package/dist/chunk-chunk-NH4MEAKP.module.min.js +2 -0
  39. package/dist/chunk-chunk-NJETWX42.module.min.js +2 -0
  40. package/dist/chunk-chunk-NW25WGLS.module.min.js +2 -0
  41. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-OI7R7EJB.module.min.js} +1 -1
  42. package/dist/chunk-chunk-ONMLEXHR.module.min.js +2 -0
  43. package/dist/chunk-chunk-OY66GCE6.module.min.js +1 -0
  44. package/dist/chunk-chunk-PZFT457G.module.min.js +1 -0
  45. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +1 -0
  46. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +1 -0
  47. package/dist/chunk-chunk-RJRM2E6P.module.min.js +1 -0
  48. package/dist/chunk-chunk-RPL7WYXI.module.min.js +1 -0
  49. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  50. package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
  51. package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
  52. package/dist/chunk-chunk-V3OAKG32.module.min.js +1 -0
  53. package/dist/chunk-chunk-WLOIUMWG.module.min.js +2 -0
  54. package/dist/chunk-chunk-XEGXX4F7.module.min.js +1 -0
  55. package/dist/chunk-chunk-XFRBLXYM.module.min.js +1 -0
  56. package/dist/chunk-chunk-Z2AJERX5.module.min.js +2 -0
  57. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +2 -0
  58. package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
  59. package/dist/components/ai/chartCapabilities.d.ts +5 -3
  60. package/dist/components/ai/conversationArc.d.ts +2 -176
  61. package/dist/components/ai/conversationArcTypes.d.ts +202 -0
  62. package/dist/components/ai/readerGrounding.d.ts +12 -0
  63. package/dist/components/ai/vacpAdapter.d.ts +13 -0
  64. package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
  65. package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
  66. package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
  67. package/dist/components/ai/vacpAdapterState.d.ts +3 -0
  68. package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
  69. package/dist/components/ai/vacpTypes.d.ts +160 -0
  70. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  71. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  72. package/dist/components/charts/index.d.ts +7 -4
  73. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  74. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  75. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  77. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  78. package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
  79. package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
  80. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
  81. package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
  82. package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
  83. package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
  84. package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
  85. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
  86. package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
  87. package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
  88. package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
  89. package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
  90. package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
  91. package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
  92. package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
  93. package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
  94. package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
  95. package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
  96. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  97. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  98. package/dist/components/charts/shared/gradient.d.ts +35 -0
  99. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  100. package/dist/components/charts/shared/hooks.d.ts +2 -50
  101. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  102. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  103. package/dist/components/charts/shared/useChartLegend.d.ts +65 -0
  104. package/dist/components/charts/shared/useChartSetup.d.ts +12 -0
  105. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  106. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  107. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  108. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  109. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  110. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  111. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  112. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  113. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  114. package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
  115. package/dist/components/data/portability/index.d.ts +2 -0
  116. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  117. package/dist/components/legendLayout.d.ts +75 -1
  118. package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
  119. package/dist/components/recipes/geographicGrid.d.ts +100 -0
  120. package/dist/components/recipes/physics.d.ts +2 -0
  121. package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
  122. package/dist/components/semiotic-ai.d.ts +6 -4
  123. package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
  124. package/dist/components/semiotic-experimental.d.ts +6 -3
  125. package/dist/components/semiotic-geo.d.ts +5 -0
  126. package/dist/components/semiotic-network.d.ts +1 -0
  127. package/dist/components/semiotic-ordinal.d.ts +2 -0
  128. package/dist/components/semiotic-physics.d.ts +10 -6
  129. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  130. package/dist/components/semiotic-recipes-core.d.ts +6 -1
  131. package/dist/components/semiotic-server-edge.d.ts +1 -1
  132. package/dist/components/semiotic-server.d.ts +1 -1
  133. package/dist/components/semiotic-xy.d.ts +4 -0
  134. package/dist/components/semiotic.d.ts +4 -4
  135. package/dist/components/server/renderEvidence.d.ts +1 -1
  136. package/dist/components/server/renderToStaticSVG.d.ts +2 -1
  137. package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
  138. package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
  139. package/dist/components/server/serverChartConfigShared.d.ts +16 -0
  140. package/dist/components/server/serverChartConfigs.d.ts +3 -2
  141. package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
  142. package/dist/components/server/serverChartConfigsXY.d.ts +1 -1
  143. package/dist/components/server/staticLegend.d.ts +10 -2
  144. package/dist/components/server/staticSVGChrome.d.ts +14 -6
  145. package/dist/components/server/staticValue.d.ts +8 -0
  146. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  147. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  148. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  149. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  150. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  151. package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
  152. package/dist/components/stream/geoTypes.d.ts +3 -6
  153. package/dist/components/stream/legendRenderer.d.ts +10 -6
  154. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  155. package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
  156. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  157. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
  158. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  159. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
  160. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  161. package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
  162. package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
  163. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
  164. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  165. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  166. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  167. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  168. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  169. package/dist/components/stream/types.d.ts +34 -56
  170. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  171. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  172. package/dist/components/types/legendTypes.d.ts +31 -6
  173. package/dist/controls.min.js +1 -1
  174. package/dist/controls.module.min.js +1 -1
  175. package/dist/geo.min.js +1 -1
  176. package/dist/geo.module.min.js +1 -1
  177. package/dist/network.min.js +1 -1
  178. package/dist/network.module.min.js +1 -1
  179. package/dist/ordinal.min.js +1 -1
  180. package/dist/ordinal.module.min.js +1 -1
  181. package/dist/physics.min.js +1 -1
  182. package/dist/physics.module.min.js +1 -1
  183. package/dist/physicsWorker.js +1 -1
  184. package/dist/realtime.min.js +1 -1
  185. package/dist/realtime.module.min.js +1 -1
  186. package/dist/semiotic-ai-core.min.js +1 -1
  187. package/dist/semiotic-ai-core.module.min.js +1 -1
  188. package/dist/semiotic-ai.d.ts +6 -4
  189. package/dist/semiotic-ai.min.js +1 -1
  190. package/dist/semiotic-ai.module.min.js +1 -1
  191. package/dist/semiotic-data.module.min.js +1 -1
  192. package/dist/semiotic-experimental-vacp.d.ts +11 -0
  193. package/dist/semiotic-experimental-vacp.min.js +1 -0
  194. package/dist/semiotic-experimental-vacp.module.min.js +1 -0
  195. package/dist/semiotic-experimental.d.ts +6 -3
  196. package/dist/semiotic-experimental.min.js +2 -1
  197. package/dist/semiotic-experimental.module.min.js +2 -1
  198. package/dist/semiotic-geo.d.ts +5 -0
  199. package/dist/semiotic-network.d.ts +1 -0
  200. package/dist/semiotic-ordinal.d.ts +2 -0
  201. package/dist/semiotic-physics.d.ts +10 -6
  202. package/dist/semiotic-realtime-core.d.ts +1 -0
  203. package/dist/semiotic-realtime-core.min.js +1 -1
  204. package/dist/semiotic-realtime-core.module.min.js +1 -1
  205. package/dist/semiotic-recipes-core.d.ts +6 -1
  206. package/dist/semiotic-recipes-core.min.js +1 -1
  207. package/dist/semiotic-recipes-core.module.min.js +1 -1
  208. package/dist/semiotic-recipes.min.js +1 -1
  209. package/dist/semiotic-recipes.module.min.js +1 -1
  210. package/dist/semiotic-server-edge.d.ts +1 -1
  211. package/dist/semiotic-server-edge.min.js +1 -1
  212. package/dist/semiotic-server-edge.module.min.js +1 -1
  213. package/dist/semiotic-server-node.min.js +1 -1
  214. package/dist/semiotic-server-node.module.min.js +1 -1
  215. package/dist/semiotic-server.d.ts +1 -1
  216. package/dist/semiotic-utils-core.min.js +1 -1
  217. package/dist/semiotic-utils-core.module.min.js +1 -1
  218. package/dist/semiotic-utils.min.js +1 -1
  219. package/dist/semiotic-utils.module.min.js +1 -1
  220. package/dist/semiotic-xy.d.ts +4 -0
  221. package/dist/semiotic.d.ts +4 -4
  222. package/dist/semiotic.min.js +1 -1
  223. package/dist/semiotic.module.min.js +1 -1
  224. package/dist/server.min.js +1 -1
  225. package/dist/server.module.min.js +1 -1
  226. package/dist/xy.min.js +1 -1
  227. package/dist/xy.module.min.js +1 -1
  228. package/package.json +18 -2
  229. package/spec/README.md +94 -2
  230. package/spec/bindings/README.md +14 -3
  231. package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
  232. package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
  233. package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
  234. package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
  235. package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
  236. package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
  237. package/dist/chunk-chunk-4AANPFOX.module.min.js +0 -2
  238. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  239. package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
  240. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  241. package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
  242. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  243. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  244. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  245. package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
  246. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  247. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  248. package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
  249. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  250. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  251. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
  252. package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
  253. package/dist/chunk-chunk-K3DMEW22.module.min.js +0 -1
  254. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +0 -1
  255. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  256. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  257. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  258. package/dist/chunk-chunk-N5DDKCCF.module.min.js +0 -1
  259. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  260. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  261. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  262. package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
  263. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  264. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  265. package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
  266. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  267. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  268. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  269. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  270. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  271. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  272. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  273. package/dist/chunk-chunk-XXWSHGPL.module.min.js +0 -2
  274. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
  275. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
  276. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  277. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
@@ -49,8 +49,17 @@ export declare class PhysicsPipelineStore {
49
49
  materializeDueSpawns(): string[];
50
50
  clear(): void;
51
51
  tick(deltaSeconds: number): PhysicsPipelineTickResult;
52
+ /** Steps-only settle. Kernel/sensor transitions are stepped but not observed. */
52
53
  settle(maxSteps?: number): number;
53
54
  settleWithObservations(maxSteps?: number): PhysicsPipelineTickResult;
55
+ /** Bind this store to the shared settle loop (see physicsPipelineSettle). */
56
+ private settleHost;
57
+ /**
58
+ * One settle implementation for both entry points, so "run to completion"
59
+ * can't mean two different things. `observe` adds kernel/sensor observation
60
+ * and the collected tick result; the stepping itself is identical.
61
+ */
62
+ private runSettle;
54
63
  readBodies(out?: PhysicsBodyState[]): PhysicsBodyState[];
55
64
  readSediment(): PhysicsSedimentBinSnapshot[];
56
65
  bodyBudgetStatus(): PhysicsBodyBudgetDecision;
@@ -6,7 +6,7 @@
6
6
  import type { Datum } from "../../charts/shared/datumTypes";
7
7
  import * as React from "react";
8
8
  import type { ReactNode } from "react";
9
- import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../../types/legendTypes";
9
+ import type { LegendLayout, LegendValue } from "../../types/legendTypes";
10
10
  import { type AutoPlaceAnnotations } from "../../recipes/annotationLayout";
11
11
  import type { AnnotationContext } from "../../realtime/types";
12
12
  import type { PhysicsBodyState } from "./PhysicsKernel";
@@ -31,11 +31,7 @@ export interface PhysicsSVGOverlayProps {
31
31
  left: number;
32
32
  };
33
33
  title?: string | ReactNode;
34
- legend?: ReactNode | {
35
- legendGroups: LegendGroup[];
36
- } | {
37
- gradient: GradientLegendConfig;
38
- };
34
+ legend?: LegendValue;
39
35
  legendHoverBehavior?: (item: {
40
36
  label: string;
41
37
  } | null) => void;
@@ -8,6 +8,11 @@ export interface PhysicsSettledSceneOptions {
8
8
  projectionRows?: PhysicsSettledProjectionRow[];
9
9
  bodyStyle?: Style | ((body: PhysicsBodyState) => Style);
10
10
  getBodyLabel?: (body: PhysicsBodyState) => string | undefined;
11
+ /**
12
+ * Total bodies the chart claims entered. Enables the settled ledger check
13
+ * (see {@link PhysicsSettledEvidence.ledger}); omitted means no ledger.
14
+ */
15
+ charge?: number;
11
16
  }
12
17
  export interface PhysicsSettledScene {
13
18
  snapshot: PhysicsPipelineSnapshot;
@@ -10,7 +10,7 @@ import type { Datum } from "../../charts/shared/datumTypes";
10
10
  import type { OnObservationCallback } from "../../store/ObservationStore";
11
11
  import type { AutoPlaceAnnotations } from "../../recipes/annotationLayout";
12
12
  import type { AnnotationContext } from "../../realtime/types";
13
- import type { GradientLegendConfig, LegendGroup, LegendLayout } from "../../types/legendTypes";
13
+ import type { LegendLayout, LegendValue } from "../../types/legendTypes";
14
14
  import type { FocusRingProps } from "../FocusRing";
15
15
  import type { PhysicsBodyState, PhysicsColliderBodyFilter, PhysicsColliderShape } from "./PhysicsKernel";
16
16
  import type { PhysicsPipelineConfig, PhysicsPipelineControlSurface, PhysicsPipelineStore, PhysicsPipelineTickResult, PhysicsQueuedSpawn, PhysicsSpawnPacingOptions, PhysicsSimulationState, PhysicsObservationEvent } from "./PhysicsPipelineStore";
@@ -245,11 +245,7 @@ export interface StreamPhysicsFrameProps {
245
245
  onAnnotationActivate?: import("../../charts/shared/annotationActivation").OnAnnotationActivateCallback;
246
246
  autoPlaceAnnotations?: AutoPlaceAnnotations;
247
247
  svgAnnotationRules?: (annotation: Datum, index: number, context: AnnotationContext) => React.ReactNode;
248
- legend?: React.ReactNode | {
249
- legendGroups: LegendGroup[];
250
- } | {
251
- gradient: GradientLegendConfig;
252
- };
248
+ legend?: LegendValue;
253
249
  legendHoverBehavior?: (item: {
254
250
  label: string;
255
251
  } | null) => void;
@@ -0,0 +1,19 @@
1
+ import type { Datum } from "../../charts/shared/datumTypes";
2
+ import type { PhysicsObservationEvent, PhysicsPipelineConfig } from "./PhysicsPipelineStore";
3
+ import type { StreamPhysicsRegionEffect } from "./StreamPhysicsTypes";
4
+ interface PhysicsFramePipelineConfigOptions {
5
+ annotations?: Datum[];
6
+ chartId?: string;
7
+ chartType: string;
8
+ config?: PhysicsPipelineConfig;
9
+ onRegionObservation: (event: PhysicsObservationEvent) => void;
10
+ regionEffects: StreamPhysicsRegionEffect[];
11
+ seed?: number;
12
+ size: [number, number];
13
+ }
14
+ /**
15
+ * Adds frame-owned annotation/region colliders and observation wiring without
16
+ * mutating the caller's pipeline configuration.
17
+ */
18
+ export declare function resolvePhysicsFramePipelineConfig({ annotations, chartId, chartType, config, onRegionObservation, regionEffects, seed, size }: PhysicsFramePipelineConfigOptions): PhysicsPipelineConfig | undefined;
19
+ export {};
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The shared "run this simulation to completion" loop behind both of
3
+ * `PhysicsPipelineStore`'s settle entry points.
4
+ *
5
+ * Settling has to mean *the simulation reached its end state*, and that includes
6
+ * admitting every arrival the queue still owes. Advancing simulated time per
7
+ * step and re-checking due spawns inside the loop is what lets paced spawns
8
+ * (`initialSpawnPacing`, per-datum `spawnAt`) and elapsed-time event tapes
9
+ * finish on the reduced-motion / snapshot path instead of freezing at the first
10
+ * spawn instant. Both entry points run this one loop so they cannot drift apart.
11
+ */
12
+ import type { PhysicsBodyBudgetDecision } from "./PhysicsBodyBudget";
13
+ import type { PhysicsKernelEvent } from "./PhysicsKernel";
14
+ import type { PhysicsPipelineEvictionResult } from "./physicsPipelineHelpers";
15
+ import type { PhysicsObservationEvent } from "./PhysicsPipelineTypes";
16
+ /**
17
+ * The slice of store behavior the loop drives. Passed explicitly (rather than
18
+ * reaching into the store) so the loop stays independently testable.
19
+ */
20
+ export interface PhysicsSettleHost {
21
+ fixedDt: number;
22
+ queueSize: () => number;
23
+ atRest: () => boolean;
24
+ /** Advance simulated time; this is what makes time-driven consumers progress. */
25
+ advanceTime: (seconds: number) => void;
26
+ spawnDue: (spawned: string[], observations?: PhysicsObservationEvent[]) => void;
27
+ observeBodyBudget: (observations?: PhysicsObservationEvent[]) => PhysicsBodyBudgetDecision;
28
+ evictOverflow: (observations?: PhysicsObservationEvent[]) => PhysicsPipelineEvictionResult;
29
+ step: (deltaSeconds: number) => void;
30
+ /** Drain buffered kernel events for this step. */
31
+ drainEvents: () => PhysicsKernelEvent[];
32
+ observeKernelEvents: (events: PhysicsKernelEvent[], observations?: PhysicsObservationEvent[]) => void;
33
+ observeSensorTransitions: (observations?: PhysicsObservationEvent[]) => void;
34
+ refreshQuiescence: (deltaSeconds: number, spawnedCount: number) => void;
35
+ }
36
+ /**
37
+ * Collectors for the run. Only `spawned` is required — the cheap `settle()` path
38
+ * discards the rest, while `settleWithObservations()` collects everything.
39
+ * Omitting `events` also suppresses observation of kernel/sensor transitions.
40
+ */
41
+ export interface PhysicsSettleSink {
42
+ spawned: string[];
43
+ evicted?: string[];
44
+ sedimented?: string[];
45
+ events?: PhysicsKernelEvent[];
46
+ observations?: PhysicsObservationEvent[];
47
+ }
48
+ export interface PhysicsSettleRun {
49
+ steps: number;
50
+ budget?: PhysicsBodyBudgetDecision;
51
+ }
52
+ export declare function runPhysicsSettleSteps(host: PhysicsSettleHost, maxSteps: number, sink: PhysicsSettleSink): PhysicsSettleRun;
@@ -29,6 +29,29 @@ export declare function regionRuntimeEffectsRequireSync(regionEffects: readonly
29
29
  export declare function applyActiveRegionEffects(controls: PhysicsPipelineControlSurface, regionEffects: readonly StreamPhysicsRegionEffect[], regionState: Map<string, InternalStreamPhysicsBodyRegionState>, dtSeconds: number): boolean;
30
30
  export declare function resolveBodyForceVector(force: StreamPhysicsBodyForce | undefined, context: StreamPhysicsBodyForceContext): StreamPhysicsRegionVector | null;
31
31
  export declare function applyBodyForces(controls: PhysicsPipelineControlSurface, bodyForces: StreamPhysicsBodyForce | undefined, regionEffects: readonly StreamPhysicsRegionEffect[], regionState: Map<string, InternalStreamPhysicsBodyRegionState>, simulationState: PhysicsSimulationState, dtSeconds: number): boolean;
32
+ export interface PhysicsPostTickOutcome {
33
+ regionEffectsApplied: boolean;
34
+ bodyForcesApplied: boolean;
35
+ snapshot: ReturnType<PhysicsPipelineStore["snapshot"]>;
36
+ result: PhysicsPipelineTickResult;
37
+ }
38
+ /**
39
+ * How many settle → `onTick` → settle passes the reduced-motion path runs before
40
+ * giving up. Event-tape charts spawn bodies from `onTick`, so one pass is never
41
+ * enough; a small bound keeps a controller that always reports work from
42
+ * blocking the main thread.
43
+ */
44
+ export declare const REDUCED_MOTION_SETTLE_PASSES = 4;
45
+ /**
46
+ * The reduced-motion / snapshot render pass.
47
+ *
48
+ * Reduced motion never schedules a second frame, so any work a settle hands to
49
+ * `onTick` — an event tape spawning gate bodies, a capacity controller
50
+ * releasing queued items — would be enqueued and never simulated. Settle
51
+ * repeatedly while the store still reports pending work so the scene reaches
52
+ * the same end state an animated run would.
53
+ */
54
+ export declare function runPhysicsReducedMotionPasses(store: PhysicsPipelineStore, postTick: (result: PhysicsPipelineTickResult) => Omit<PhysicsPostTickOutcome, "result">, maxPasses?: number): PhysicsPostTickOutcome;
32
55
  /**
33
56
  * Shared post-tick pipeline: region forces → body forces → controllers → onTick.
34
57
  * Used by the main RAF path and the worker-fallback path (DRY + one snapshot).
@@ -8,6 +8,7 @@ import type { CoercibleNumber } from "./accessorUtils";
8
8
  import type { CustomLayout } from "./customLayout";
9
9
  import type { CustomLayoutSelection } from "./customLayoutSelection";
10
10
  import type { MarginType } from "../types/marginType";
11
+ import type { GradientConfig } from "../charts/shared/gradient";
11
12
  export interface PipelineConfig {
12
13
  chartType: StreamChartType;
13
14
  runtimeMode?: "streaming" | "bounded";
@@ -76,22 +77,13 @@ export interface PipelineConfig {
76
77
  boundsStyle?: Style | ((d: Datum, group?: string) => Style);
77
78
  y0Accessor?: string | ((d: Datum) => CoercibleNumber);
78
79
  band?: BandConfig | BandConfig[];
79
- gradientFill?: {
80
- topOpacity: number;
81
- bottomOpacity: number;
82
- } | {
83
- colorStops: Array<{
84
- offset: number;
85
- color: string;
86
- }>;
87
- };
80
+ gradientFill?: GradientConfig;
88
81
  areaGroups?: Set<string>;
89
- lineGradient?: {
90
- colorStops: Array<{
91
- offset: number;
92
- color: string;
93
- }>;
94
- };
82
+ lineGradient?: GradientConfig;
83
+ semanticLineStops?: Array<{
84
+ offset: number;
85
+ color: string;
86
+ }>;
95
87
  lineStyle?: Style | ((d: Datum, group?: string) => Style);
96
88
  pointStyle?: (d: Datum) => Style & {
97
89
  r?: number;
@@ -1,50 +1,12 @@
1
- /**
2
- * Shared canvas-rendering primitives used by `bar`/`area`/`line`/`point`
3
- * renderers (and any future mark renderer that paints a fill, a stroke,
4
- * or a linear gradient).
5
- *
6
- * These are extractions, not abstractions: every function in this module
7
- * was inline-duplicated across two or more renderers in byte-identical
8
- * (or near-identical) form. Centralizing them eliminates drift at the
9
- * "what does the canvas seam look like for a stream renderer" boundary
10
- * and keeps each renderer focused on its mark-specific path tracing.
11
- *
12
- * Anything genuinely chart-shape-specific — `buildBarGradient`'s
13
- * tip-vs-base coordinate computation from `node.roundedEdge`, the
14
- * area's strip-decay path, the line's threshold-color crossing logic —
15
- * stays in the renderer that owns the mark. The helpers here are the
16
- * mechanical bits that recur regardless of the shape being painted.
17
- */
1
+ /** Shared canvas primitives for fills, strokes, curves, and gradients. */
18
2
  import type { CurveType } from "../types";
3
+ import type { GradientConfig } from "../../charts/shared/gradient";
19
4
  import { type HatchFill } from "../../charts/shared/hatchFill";
20
5
  import type { CurveFactory } from "d3-shape";
21
- /**
22
- * Structural shapes for the gradient configs the helpers accept. Kept
23
- * local rather than exported from `types.ts` because today's scene-node
24
- * interfaces (`AreaSceneNode`, `RectSceneNode`, `LineSceneNode`) declare
25
- * the same shapes inline. TS structural typing means a caller passing
26
- * `node.fillGradient` satisfies these types without an explicit cast.
27
- */
28
- type ColorStop = {
29
- offset: number;
30
- color: string;
31
- };
32
- export type ColorStopGradient = {
33
- colorStops: ColorStop[];
34
- };
35
- export type OpacityGradient = {
36
- topOpacity: number;
37
- bottomOpacity: number;
38
- };
39
- export type FillGradient = ColorStopGradient | OpacityGradient;
40
6
  /**
41
7
  * Map a `CurveType` string to a d3-shape curve factory. Returns `null`
42
8
  * for `"linear"` and `undefined` so callers can branch on a single
43
9
  * "use linear fallback" sentinel instead of a separate has-curve check.
44
- *
45
- * Identical implementations previously lived in `areaCanvasRenderer.ts`
46
- * and `lineCanvasRenderer.ts` — every new curve token had to be added
47
- * to both switches in lockstep.
48
10
  */
49
11
  export declare function resolveCurveFactory(curve: CurveType | undefined): CurveFactory | null;
50
12
  /**
@@ -52,15 +14,10 @@ export declare function resolveCurveFactory(curve: CurveType | undefined): Curve
52
14
  * canvas can accept as `fillStyle` / `strokeStyle`:
53
15
  *
54
16
  * - Strings go through `resolveCSSColor` so `var(...)` references
55
- * resolve via the canvas DOM ancestor's computed style. Without
56
- * this, canvas silently rejects CSS-variable strings and falls
57
- * back to `#000000`.
17
+ * resolve via the canvas DOM ancestor's computed style.
58
18
  * - `CanvasPattern` values pass through untouched.
59
19
  * - `null` / `undefined` returns the caller-provided fallback.
60
20
  *
61
- * The previous inline form was
62
- * `(typeof X === "string" ? resolveCSSColor(ctx, X) : X) || fallback`,
63
- * repeated once per renderer per fill/stroke site.
64
21
  */
65
22
  export declare function resolveCanvasFill(ctx: CanvasRenderingContext2D, fill: string | HatchFill | CanvasPattern | null | undefined, fallback: string): string | CanvasPattern;
66
23
  /**
@@ -77,30 +34,13 @@ export declare function resolveCanvasFill(ctx: CanvasRenderingContext2D, fill: s
77
34
  */
78
35
  export declare function coerceCanvasFill(ctx: CanvasRenderingContext2D, fill: string | HatchFill | CanvasPattern | null | undefined): string | CanvasPattern | undefined;
79
36
  /**
80
- * Build a linear gradient from a `FillGradient` config. Returns `null`
81
- * when the gradient cannot be constructed (fewer than two valid color
82
- * stops in the `colorStops` form, or a non-finite opacity in the
83
- * `topOpacity` form).
37
+ * Build a linear gradient from a normalized gradient config. Stops without a
38
+ * color inherit the resolved mark color.
84
39
  *
85
40
  * The renderer is responsible for choosing the gradient axis (a bar
86
41
  * runs tip→base along its value axis; an area runs minTop→maxBottom
87
- * vertically). The opacity-form path color-normalizes through the
88
- * canvas via `parseCanvasColor` so named colors (`steelblue`), hsl(),
89
- * etc. all produce gradients that match the mark's actual fill.
90
- *
91
- * Replaces `buildBarGradient` (bar) and the inline gradient block in
92
- * `areaCanvasRenderer` — both implemented the same two-shape switch
93
- * with the same offset-clamping and the same parseCanvasColor flow.
94
- */
95
- export declare function buildLinearFillGradient(ctx: CanvasRenderingContext2D, fillGradient: FillGradient, baseFill: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
96
- /**
97
- * Build a linear gradient from a `ColorStopGradient` (the stroke-side
98
- * shape — only the `colorStops` form, no opacity variant). Returns
99
- * `null` when there aren't enough valid stops to render a gradient.
100
- *
101
- * Caller picks the axis. Identical patterns previously lived inline in
102
- * `areaCanvasRenderer`'s top-stroke branch and `lineCanvasRenderer`'s
103
- * stroke branch.
42
+ * vertically).
104
43
  */
105
- export declare function buildColorStopGradient(ctx: CanvasRenderingContext2D, strokeGradient: ColorStopGradient, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
106
- export {};
44
+ export declare function buildLinearFillGradient(ctx: CanvasRenderingContext2D, fillGradient: GradientConfig, baseFill: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
45
+ /** Build a linear stroke gradient along the caller-provided axis. */
46
+ export declare function buildColorStopGradient(ctx: CanvasRenderingContext2D, strokeGradient: GradientConfig, baseStroke: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
@@ -1,13 +1,6 @@
1
1
  /**
2
- * Per-corner radius utilities shared between the canvas (`barCanvasRenderer`)
3
- * and SVG (`SceneToSVG`) paint paths.
4
- *
5
- * Both paths previously carried the same `hasAnyCornerRadius` predicate
6
- * and the same `min(radius, w/2, h/2)` clamp inline. Splitting them by
7
- * renderer left two near-identical implementations that drifted in
8
- * comments more than once; centralizing here keeps the swimlane rounding
9
- * contract — and any future per-corner shape (cards, tab corners,
10
- * partial-stack rounding) — in one place.
2
+ * Per-corner radius geometry shared between the canvas
3
+ * (`barCanvasRenderer`) and SVG (`SceneToSVG`) paint paths.
11
4
  *
12
5
  * The actual path-tracing primitives (canvas `arcTo` vs SVG `A`) stay in
13
6
  * each renderer because their output formats differ — this module owns
@@ -0,0 +1,12 @@
1
+ import type { LineColorThreshold } from "../types";
2
+ export interface ThresholdLineSegment {
3
+ color: string;
4
+ path: [number, number][];
5
+ }
6
+ export declare function resolveThresholdColor(value: number, thresholds: LineColorThreshold[], baseColor: string): string;
7
+ /**
8
+ * Split a value-bearing polyline wherever it crosses a color threshold.
9
+ * Adjacent intervals with the same resolved color are merged so canvas and
10
+ * SVG can paint identical hard-edged bands with a minimal number of paths.
11
+ */
12
+ export declare function buildThresholdLineSegments(path: [number, number][], rawValues: number[], thresholds: LineColorThreshold[], baseColor: string): ThresholdLineSegment[];
@@ -9,6 +9,7 @@ import type { DefaultArcObject } from "d3-shape";
9
9
  import { type HatchFill } from "../charts/shared/hatchFill";
10
10
  import type { GlyphDef } from "./glyphDef";
11
11
  import type { RectSceneNode, Style, SymbolSceneNode } from "./types";
12
+ import type { GradientStop } from "../charts/shared/gradient";
12
13
  /**
13
14
  * Sentinel arg for d3-shape arc generators that have all four
14
15
  * accessors set to constants. The generator's call signature requires
@@ -49,14 +50,11 @@ export declare function glyphNodeToSVG(g: {
49
50
  pointId?: string;
50
51
  _decayOpacity?: number;
51
52
  }, x: number, y: number, key: string): React.ReactNode;
52
- export declare function colorStopElements(colorStops: Array<{
53
- offset: number;
54
- color: string;
55
- }>): React.ReactElement[] | null;
53
+ export declare function colorStopElements(stops: GradientStop[], baseColor: string): React.ReactElement[] | null;
56
54
  /**
57
55
  * Build `<defs><linearGradient>` for a bar's fillGradient, mirroring the
58
56
  * tip→base direction the canvas renderer uses (inferred from roundedEdge).
59
- * Returns null when the config can't resolve (e.g. colorStops < 2), so the
57
+ * Returns null when the config has fewer than two usable stops, so the
60
58
  * caller falls back to a solid fill — same parity with the canvas path.
61
59
  *
62
60
  * Using `gradientUnits="userSpaceOnUse"` with absolute coords keeps each bar's
@@ -1,10 +1,11 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ScaleLinear } from "d3-scale";
3
3
  import type { AnimateProp } from "./pipelineTransitionUtils";
4
- import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
4
+ import type { LegendLayout, LegendValue } from "../types/legendTypes";
5
5
  import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode } from "../realtime/types";
6
6
  import type { Datum } from "../charts/shared/datumTypes";
7
7
  import type { HatchFill } from "../charts/shared/hatchFill";
8
+ import type { ColorGradientInput, GradientConfig, GradientInput } from "../charts/shared/gradient";
8
9
  import type { CoercibleNumber } from "./accessorUtils";
9
10
  import type { AutoPlaceAnnotations } from "../recipes/annotationLayout";
10
11
  import type { SymbolName } from "./symbolPath";
@@ -147,12 +148,7 @@ export interface LineSceneNode {
147
148
  accessibility?: SceneAccessibilityMetadata["accessibility"];
148
149
  group?: string;
149
150
  /** Horizontal gradient for the line stroke */
150
- strokeGradient?: {
151
- colorStops: Array<{
152
- offset: number;
153
- color: string;
154
- }>;
155
- };
151
+ strokeGradient?: GradientConfig;
156
152
  /** Curve interpolation type (default: linear / straight segments) */
157
153
  curve?: CurveType;
158
154
  /** Per-vertex decay opacities (oldest→newest = minOpacity→1.0). Set by PipelineStore.applyDecay. */
@@ -174,6 +170,20 @@ export interface AreaSceneNode {
174
170
  type: "area";
175
171
  topPath: [number, number][];
176
172
  bottomPath: [number, number][];
173
+ /** Raw y-values corresponding to each top-path point (for threshold coloring) */
174
+ rawValues?: number[];
175
+ /** Threshold-based colors for the area's top-edge stroke */
176
+ colorThresholds?: LineColorThreshold[];
177
+ /**
178
+ * Plot-relative horizontal clips for value-colored top strokes. Each band
179
+ * redraws the complete top path, preserving its configured curve exactly.
180
+ * An omitted color means the area's normal stroke color.
181
+ */
182
+ strokeColorBands?: Array<{
183
+ y: number;
184
+ height: number;
185
+ color?: string;
186
+ }>;
177
187
  style: Style;
178
188
  datum: SeriesDatum;
179
189
  accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
@@ -187,23 +197,10 @@ export interface AreaSceneNode {
187
197
  width: number;
188
198
  height: number;
189
199
  };
190
- /** Gradient fill: opacity-based (topOpacity/bottomOpacity) or multi-color (colorStops) */
191
- fillGradient?: {
192
- topOpacity: number;
193
- bottomOpacity: number;
194
- } | {
195
- colorStops: Array<{
196
- offset: number;
197
- color: string;
198
- }>;
199
- };
200
+ /** Gradient fill from top edge to baseline. */
201
+ fillGradient?: GradientConfig;
200
202
  /** Horizontal gradient for the line stroke */
201
- strokeGradient?: {
202
- colorStops: Array<{
203
- offset: number;
204
- color: string;
205
- }>;
206
- };
203
+ strokeGradient?: GradientConfig;
207
204
  /** When false, skip hit testing (used for decorative bounds areas) */
208
205
  interactive?: boolean;
209
206
  /** Pulse intensity 0–1 (set when aggregated group value changes) */
@@ -238,6 +235,8 @@ export interface PointSceneNode {
238
235
  r: number;
239
236
  style: Style;
240
237
  datum: SceneDatum;
238
+ /** Whether this point participates in hit testing and spatial indexing. Set to false for decorative points. @default true */
239
+ interactive?: boolean;
241
240
  accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
242
241
  accessibility?: SceneAccessibilityMetadata["accessibility"];
243
242
  /** Optional unique identifier for point-anchored annotations */
@@ -384,15 +383,7 @@ export interface RectSceneNode {
384
383
  };
385
384
  /** Gradient fill — same shape as the area-scene version. Runs tip → base
386
385
  * along the bar axis (inferred from `roundedEdge`). */
387
- fillGradient?: {
388
- topOpacity: number;
389
- bottomOpacity: number;
390
- } | {
391
- colorStops: Array<{
392
- offset: number;
393
- color: string;
394
- }>;
395
- };
386
+ fillGradient?: GradientConfig;
396
387
  style: Style;
397
388
  datum: SceneDatum;
398
389
  accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
@@ -641,27 +632,18 @@ export interface StreamXYFrameProps<T = Datum> extends StreamSemanticInteraction
641
632
  * Use for percentile bands, confidence ribbons, or any band/ribbon chart.
642
633
  */
643
634
  y0Accessor?: string | ((d: T) => number);
635
+ /** Gradient fill for area charts. Offset 0 is the top edge; offset 1 is the baseline. */
636
+ gradientFill?: GradientInput;
637
+ /** Horizontal gradient for line strokes. Offset 0 is left; offset 1 is right. */
638
+ lineGradient?: ColorGradientInput;
644
639
  /**
645
- * Gradient fill for area charts. The fill fades from topOpacity at the line
646
- * to bottomOpacity at the baseline. Set to `true` for default (0.8 → 0.05)
647
- * or `{ topOpacity, bottomOpacity }` for custom values.
640
+ * Internal value-anchored color stops for an area's top-edge stroke.
641
+ * Offsets are resolved against the final y-domain by the scene builder.
648
642
  */
649
- gradientFill?: boolean | {
650
- topOpacity: number;
651
- bottomOpacity: number;
652
- } | {
653
- colorStops: Array<{
654
- offset: number;
655
- color: string;
656
- }>;
657
- };
658
- /** Horizontal gradient for line strokes. Applied to all lines/area top-strokes. */
659
- lineGradient?: {
660
- colorStops: Array<{
661
- offset: number;
662
- color: string;
663
- }>;
664
- };
643
+ semanticLineStops?: Array<{
644
+ offset: number;
645
+ color: string;
646
+ }>;
665
647
  /** Series names (matching lineBy/colorBy group keys) that render as filled areas in "mixed" chartType */
666
648
  areaGroups?: string[];
667
649
  /**
@@ -777,11 +759,7 @@ export interface StreamXYFrameProps<T = Datum> extends StreamSemanticInteraction
777
759
  autoPlaceAnnotations?: AutoPlaceAnnotations;
778
760
  svgAnnotationRules?: (annotation: Datum, index: number, context: AnnotationContext) => ReactNode;
779
761
  showGrid?: boolean;
780
- legend?: ReactNode | {
781
- legendGroups: LegendGroup[];
782
- } | {
783
- gradient: GradientLegendConfig;
784
- };
762
+ legend?: LegendValue;
785
763
  legendHoverBehavior?: (item: {
786
764
  label: string;
787
765
  } | null) => void;
@@ -1,20 +1,4 @@
1
- import type { AreaSceneNode } from "../types";
2
- type ResolvedAreaGradient = NonNullable<AreaSceneNode["fillGradient"]>;
3
- type OpacityGradient = {
4
- topOpacity: number;
5
- bottomOpacity: number;
6
- };
7
- type ColorStopGradient = {
8
- colorStops: Array<{
9
- offset: number;
10
- color: string;
11
- }>;
12
- };
13
- type OpacityGradientConfig = {
14
- topOpacity?: number;
15
- bottomOpacity?: number;
16
- };
17
- export type AreaGradientConfig = boolean | OpacityGradientConfig | ColorStopGradient;
18
- export declare const DEFAULT_AREA_GRADIENT: OpacityGradient;
19
- export declare function resolveAreaGradient(gradient: AreaGradientConfig | undefined): ResolvedAreaGradient | undefined;
20
- export {};
1
+ import { type GradientConfig, type GradientInput } from "../../charts/shared/gradient";
2
+ export type AreaGradientConfig = GradientInput;
3
+ export declare const DEFAULT_AREA_GRADIENT: GradientConfig;
4
+ export declare function resolveAreaGradient(gradient: AreaGradientConfig | undefined): GradientConfig | undefined;
@@ -11,6 +11,7 @@ import type { AreaGradientConfig } from "./areaGradient";
11
11
  import type { StreamScales, Style, CurveType, BarStyle, ThemeSemanticColors } from "../types";
12
12
  import type { SymbolName } from "../symbolPath";
13
13
  import type { ResolvedRibbon } from "./ribbonScene";
14
+ import type { GradientConfig } from "../../charts/shared/gradient";
14
15
  export interface XYSceneContext {
15
16
  scales: StreamScales;
16
17
  config: XYSceneConfig;
@@ -61,12 +62,11 @@ export interface XYSceneConfig {
61
62
  stackOrder?: "key" | "input" | "insideOut" | "asc" | "desc";
62
63
  gradientFill?: AreaGradientConfig;
63
64
  areaGroups?: Set<string>;
64
- lineGradient?: {
65
- colorStops: Array<{
66
- offset: number;
67
- color: string;
68
- }>;
69
- };
65
+ lineGradient?: GradientConfig;
66
+ semanticLineStops?: Array<{
67
+ offset: number;
68
+ color: string;
69
+ }>;
70
70
  annotations?: Datum[];
71
71
  pointStyle?: (d: Datum) => Style & {
72
72
  r?: number;
@@ -25,11 +25,16 @@ export interface GradientLegendConfig {
25
25
  }
26
26
  export interface CategoricalLegendConfig {
27
27
  legendGroups: LegendGroup[];
28
+ /** Gap in pixels between the legend and the plot/side gutter. Default: 10. */
29
+ legendDistance?: number;
28
30
  }
29
- /** Public legend slot accepted by stream frames and legend-aware chart HOCs. */
30
- export type LegendValue = ReactNode | CategoricalLegendConfig | {
31
+ export interface GradientLegendValue {
31
32
  gradient: GradientLegendConfig;
32
- };
33
+ /** Gap in pixels between the legend and the plot/side gutter. Default: 10. */
34
+ legendDistance?: number;
35
+ }
36
+ /** Public legend slot accepted by stream frames and legend-aware chart HOCs. */
37
+ export type LegendValue = ReactNode | CategoricalLegendConfig | GradientLegendValue;
33
38
  /**
34
39
  * Compose inferred and caller-supplied legends without discarding either
35
40
  * categorical domain. Configured groups are appended in argument order, so
@@ -41,9 +46,7 @@ export declare function composeLegendConfigs(...values: Array<LegendValue | null
41
46
  /** Type guard: categorical legend config */
42
47
  export declare function isLegendConfig(value: unknown): value is CategoricalLegendConfig;
43
48
  /** Type guard: gradient legend config */
44
- export declare function isGradientLegendConfig(value: unknown): value is {
45
- gradient: GradientLegendConfig;
46
- };
49
+ export declare function isGradientLegendConfig(value: unknown): value is GradientLegendValue;
47
50
  export interface LegendLayout {
48
51
  /** Horizontal alignment for top/bottom legends within the plot width */
49
52
  align?: "start" | "center" | "end" | "left" | "right";
@@ -57,6 +60,28 @@ export interface LegendLayout {
57
60
  rowHeight?: number;
58
61
  /** Override the alignment width used for top/bottom legends */
59
62
  maxWidth?: number;
63
+ /**
64
+ * Space between the plot and a left/right legend reserved for adjacent
65
+ * chart chrome such as axis ticks and an axis title. Ignored for top/bottom
66
+ * legends — see `axisGutter`. The legend is placed outside this gutter.
67
+ */
68
+ sideGutter?: number;
69
+ /**
70
+ * The top/bottom counterpart of `sideGutter`: space between the plot and a
71
+ * top/bottom legend reserved for that side's axis chrome (tick labels and
72
+ * an axis title).
73
+ *
74
+ * **Auto-measurement is bottom-axis only.** A bottom legend defaults to the
75
+ * measured chrome of the axis actually drawn, so it clears the tick labels
76
+ * instead of overdrawing them, and resolves to 0 when the chart has no
77
+ * bottom axis. Top axes are opt-in (`frameProps.axes` with
78
+ * `orient: "top"`), so a *top* legend defaults to 0 and needs this set
79
+ * explicitly to clear a top axis.
80
+ *
81
+ * Set explicitly to override either side, or `0` to opt out and anchor the
82
+ * legend directly to the plot edge.
83
+ */
84
+ axisGutter?: number;
60
85
  }
61
86
  export interface LegendProps {
62
87
  legendGroups?: LegendGroup[];