semiotic 3.7.5 → 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 (575) hide show
  1. package/CLAUDE.md +63 -18
  2. package/README.md +121 -27
  3. package/agent-skill/semiotic-charts/SKILL.md +146 -0
  4. package/ai/cli.js +133 -45
  5. package/ai/componentMetadata.cjs +6 -1
  6. package/ai/dist/mcp-server.js +1741 -163
  7. package/ai/examples.md +174 -0
  8. package/ai/schema.json +2733 -536
  9. package/ai/surface-manifest.json +201 -0
  10. package/ai/system-prompt.md +20 -4
  11. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  12. package/dist/components/AccessibleNavTree.d.ts +7 -1
  13. package/dist/components/CategoryColors.d.ts +1 -1
  14. package/dist/components/ChartContainer.d.ts +91 -0
  15. package/dist/components/ChartGrid.d.ts +11 -1
  16. package/dist/components/CircularBrush.d.ts +61 -0
  17. package/dist/components/ContextLayout.d.ts +5 -1
  18. package/dist/components/DirectManipulationControl.d.ts +63 -0
  19. package/dist/components/LinkedCharts.d.ts +3 -1
  20. package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
  21. package/dist/components/MobileChartContainer.d.ts +51 -0
  22. package/dist/components/MobileStandardControls.d.ts +68 -0
  23. package/dist/components/SmallMultipleChart.d.ts +84 -0
  24. package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
  25. package/dist/components/ai/ChartRecipe.d.ts +16 -0
  26. package/dist/components/ai/IntentMark.d.ts +15 -0
  27. package/dist/components/ai/chartCapabilities.d.ts +8 -1
  28. package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
  29. package/dist/components/ai/chartClinic.d.ts +91 -0
  30. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  31. package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
  32. package/dist/components/ai/chartRecipes.d.ts +278 -0
  33. package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
  34. package/dist/components/ai/describeChart.d.ts +7 -0
  35. package/dist/components/ai/describeRecipeChart.d.ts +16 -0
  36. package/dist/components/ai/generativeChart.d.ts +28 -3
  37. package/dist/components/ai/intentManifest.d.ts +62 -0
  38. package/dist/components/ai/navigationTree.d.ts +3 -0
  39. package/dist/components/ai/observedSceneAudit.d.ts +72 -0
  40. package/dist/components/ai/readerGrounding.d.ts +83 -0
  41. package/dist/components/ai/recipeCapability.d.ts +8 -0
  42. package/dist/components/ai/recipeNavigation.d.ts +13 -0
  43. package/dist/components/ai/recipeSemantics.d.ts +11 -0
  44. package/dist/components/ai/repairChartConfig.d.ts +9 -0
  45. package/dist/components/ai/suggestCharts.d.ts +11 -1
  46. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  47. package/dist/components/chartContainerMobile.d.ts +9 -0
  48. package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
  49. package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
  50. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
  51. package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
  52. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  53. package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
  54. package/dist/components/charts/geo/FlowMap.d.ts +11 -7
  55. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
  56. package/dist/components/charts/geo/index.d.ts +2 -0
  57. package/dist/components/charts/index.d.ts +35 -1
  58. package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
  59. package/dist/components/charts/network/CirclePack.d.ts +1 -1
  60. package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -5
  61. package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
  62. package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
  63. package/dist/components/charts/network/SankeyDiagram.d.ts +10 -2
  64. package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
  65. package/dist/components/charts/network/Treemap.d.ts +1 -1
  66. package/dist/components/charts/network/useForceLayout.d.ts +17 -0
  67. package/dist/components/charts/ordinal/BarChart.d.ts +22 -1
  68. package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
  69. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  70. package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
  71. package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
  72. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +12 -1
  73. package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
  74. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  75. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +12 -1
  77. package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
  78. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
  79. package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
  80. package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
  81. package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
  82. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +54 -0
  83. package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
  84. package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
  85. package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
  86. package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -0
  87. package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
  88. package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
  89. package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
  90. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
  91. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +99 -0
  92. package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
  93. package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -0
  94. package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
  95. package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
  96. package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
  97. package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
  98. package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
  99. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
  100. package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
  101. package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
  102. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
  103. package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
  104. package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
  105. package/dist/components/charts/physics/gauntletController.d.ts +73 -0
  106. package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
  107. package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
  108. package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
  109. package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
  110. package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
  111. package/dist/components/charts/physics/physicsChartShared.d.ts +57 -0
  112. package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
  113. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  114. package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
  115. package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
  116. package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
  117. package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
  118. package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
  119. package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
  120. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
  121. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
  122. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
  123. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
  124. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
  125. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  126. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  127. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  128. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  129. package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
  130. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
  131. package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
  132. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  133. package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
  134. package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
  135. package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
  136. package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
  137. package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
  138. package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
  139. package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
  140. package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
  141. package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
  142. package/dist/components/charts/shared/colorContrast.d.ts +3 -0
  143. package/dist/components/charts/shared/colorUtils.d.ts +16 -1
  144. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  145. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -0
  146. package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
  147. package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
  148. package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
  149. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  150. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  151. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  152. package/dist/components/charts/shared/hooks.d.ts +34 -10
  153. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  154. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  155. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  156. package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
  157. package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
  158. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  159. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  160. package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
  161. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  162. package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
  163. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  164. package/dist/components/charts/shared/types.d.ts +58 -7
  165. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  166. package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
  167. package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
  168. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  169. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  170. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
  171. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  172. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
  173. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
  174. package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
  175. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  176. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  177. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  178. package/dist/components/charts/shared/validationMap.d.ts +7 -9
  179. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  180. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  181. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  182. package/dist/components/charts/value/types.d.ts +5 -6
  183. package/dist/components/charts/xy/AreaChart.d.ts +9 -1
  184. package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
  185. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  186. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  187. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  188. package/dist/components/charts/xy/LineChart.d.ts +12 -1
  189. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  190. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
  191. package/dist/components/charts/xy/QuadrantChart.d.ts +8 -1
  192. package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
  193. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
  194. package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
  195. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  196. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  197. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  198. package/dist/components/controls/controlAudit.d.ts +24 -0
  199. package/dist/components/controls/controlContract.d.ts +57 -0
  200. package/dist/components/data/fromFlintChart.d.ts +74 -0
  201. package/dist/components/data/fromVegaLite.d.ts +46 -9
  202. package/dist/components/data/portability/index.d.ts +6 -3
  203. package/dist/components/data/portability/result.d.ts +52 -0
  204. package/dist/components/data/portability/spec.d.ts +31 -0
  205. package/dist/components/data/portability/vegaLite.d.ts +24 -6
  206. package/dist/components/export/chartConfig.d.ts +11 -0
  207. package/dist/components/realtime/types.d.ts +11 -0
  208. package/dist/components/recipes/annotationLayout.d.ts +29 -0
  209. package/dist/components/recipes/axisFixedForce.d.ts +119 -0
  210. package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
  211. package/dist/components/recipes/cyclical.d.ts +39 -0
  212. package/dist/components/recipes/edgeRouter.d.ts +103 -0
  213. package/dist/components/recipes/forceLayout.d.ts +48 -0
  214. package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
  215. package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
  216. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
  217. package/dist/components/recipes/gofishIR.d.ts +178 -132
  218. package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
  219. package/dist/components/recipes/intervalLanes.d.ts +87 -0
  220. package/dist/components/recipes/intervals.d.ts +80 -0
  221. package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
  222. package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
  223. package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
  224. package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
  225. package/dist/components/recipes/networkAnalysis.d.ts +102 -0
  226. package/dist/components/recipes/networkLayouts.d.ts +83 -0
  227. package/dist/components/recipes/physics.d.ts +122 -0
  228. package/dist/components/recipes/physicsReference.d.ts +102 -0
  229. package/dist/components/recipes/processAggregates.d.ts +32 -0
  230. package/dist/components/recipes/processChrome.d.ts +67 -0
  231. package/dist/components/recipes/processJourney.d.ts +54 -0
  232. package/dist/components/recipes/processPhysics.d.ts +300 -0
  233. package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
  234. package/dist/components/recipes/radialCoords.d.ts +69 -0
  235. package/dist/components/recipes/random.d.ts +2 -0
  236. package/dist/components/recipes/recipeChrome.d.ts +91 -0
  237. package/dist/components/recipes/recipeGlyph.d.ts +42 -0
  238. package/dist/components/recipes/recipeLegend.d.ts +53 -1
  239. package/dist/components/recipes/recipeUtils.d.ts +52 -0
  240. package/dist/components/recipes/runs.d.ts +59 -0
  241. package/dist/components/recipes/tokenEncoding.d.ts +157 -0
  242. package/dist/components/recipes/tokenLayer.d.ts +79 -0
  243. package/dist/components/recipes/unitize.d.ts +108 -0
  244. package/dist/components/recipes/vector.d.ts +28 -0
  245. package/dist/components/recipes/waffle.d.ts +43 -0
  246. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  247. package/dist/components/semiotic-ai-core.d.ts +47 -0
  248. package/dist/components/semiotic-ai.d.ts +53 -9
  249. package/dist/components/semiotic-controls.d.ts +20 -0
  250. package/dist/components/semiotic-experimental.d.ts +38 -9
  251. package/dist/components/semiotic-geo.d.ts +15 -0
  252. package/dist/components/semiotic-network.d.ts +15 -0
  253. package/dist/components/semiotic-ordinal.d.ts +14 -0
  254. package/dist/components/semiotic-physics-matter.d.ts +10 -0
  255. package/dist/components/semiotic-physics-rapier.d.ts +9 -0
  256. package/dist/components/semiotic-physics.d.ts +60 -0
  257. package/dist/components/semiotic-realtime-core.d.ts +34 -0
  258. package/dist/components/semiotic-realtime-react.d.ts +10 -0
  259. package/dist/components/semiotic-realtime.d.ts +4 -30
  260. package/dist/components/semiotic-recipes-core.d.ts +92 -0
  261. package/dist/components/semiotic-recipes-react.d.ts +7 -0
  262. package/dist/components/semiotic-recipes.d.ts +4 -43
  263. package/dist/components/semiotic-rough.d.ts +4 -0
  264. package/dist/components/semiotic-server-edge.d.ts +8 -0
  265. package/dist/components/semiotic-server-node.d.ts +5 -0
  266. package/dist/components/semiotic-server.d.ts +2 -2
  267. package/dist/components/semiotic-themes-core.d.ts +53 -0
  268. package/dist/components/semiotic-themes-react.d.ts +4 -0
  269. package/dist/components/semiotic-themes.d.ts +6 -76
  270. package/dist/components/semiotic-utils-core.d.ts +50 -0
  271. package/dist/components/semiotic-utils-react.d.ts +5 -0
  272. package/dist/components/semiotic-utils.d.ts +3 -39
  273. package/dist/components/semiotic-xy.d.ts +12 -0
  274. package/dist/components/semiotic.d.ts +44 -8
  275. package/dist/components/server/animatedGif.d.ts +36 -0
  276. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  277. package/dist/components/server/renderEvidence.d.ts +1 -1
  278. package/dist/components/server/renderToStaticSVG.d.ts +3 -35
  279. package/dist/components/server/serverChartConfigShared.d.ts +21 -0
  280. package/dist/components/server/serverChartConfigs.d.ts +22 -12
  281. package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
  282. package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
  283. package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
  284. package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
  285. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  286. package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
  287. package/dist/components/server/staticAnnotations.d.ts +6 -3
  288. package/dist/components/server/staticGeo.d.ts +4 -0
  289. package/dist/components/server/staticLegend.d.ts +2 -2
  290. package/dist/components/server/staticNetwork.d.ts +8 -0
  291. package/dist/components/server/staticOrdinal.d.ts +11 -0
  292. package/dist/components/server/staticPhysics.d.ts +3 -0
  293. package/dist/components/server/staticSVGChrome.d.ts +110 -0
  294. package/dist/components/server/staticXY.d.ts +4 -0
  295. package/dist/components/store/ObservationStore.d.ts +23 -2
  296. package/dist/components/store/themeSerialization.d.ts +32 -0
  297. package/dist/components/store/useChartInterrogation.d.ts +9 -0
  298. package/dist/components/stream/AccessibleDataTable.d.ts +7 -23
  299. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  300. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  301. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  302. package/dist/components/stream/FocusRing.d.ts +4 -2
  303. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  304. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  305. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  306. package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
  307. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  308. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  309. package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
  310. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  311. package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
  312. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  313. package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
  314. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  315. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  316. package/dist/components/stream/ParticlePool.d.ts +1 -1
  317. package/dist/components/stream/PipelineStore.d.ts +81 -174
  318. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  319. package/dist/components/stream/SceneGraph.d.ts +12 -4
  320. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  321. package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
  322. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  323. package/dist/components/stream/StreamXYFrame.d.ts +2 -18
  324. package/dist/components/stream/accessibleDataRows.d.ts +33 -0
  325. package/dist/components/stream/accessorUtils.d.ts +25 -12
  326. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  327. package/dist/components/stream/brushAccessibility.d.ts +25 -0
  328. package/dist/components/stream/canvasBackground.d.ts +24 -0
  329. package/dist/components/stream/canvasSetup.d.ts +4 -1
  330. package/dist/components/stream/customLayoutFailure.d.ts +33 -0
  331. package/dist/components/stream/customLayoutPalette.d.ts +19 -9
  332. package/dist/components/stream/frameGraphics.d.ts +4 -0
  333. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  334. package/dist/components/stream/frameThemeColors.d.ts +24 -0
  335. package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
  336. package/dist/components/stream/geoCartogram.d.ts +17 -0
  337. package/dist/components/stream/geoCustomLayout.d.ts +59 -0
  338. package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
  339. package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
  340. package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
  341. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  342. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  343. package/dist/components/stream/geoTypes.d.ts +97 -15
  344. package/dist/components/stream/glyphDef.d.ts +98 -0
  345. package/dist/components/stream/hitTarget.d.ts +170 -0
  346. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  347. package/dist/components/stream/hoverUtils.d.ts +7 -2
  348. package/dist/components/stream/keyboardNav.d.ts +4 -1
  349. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
  350. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +58 -0
  351. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  352. package/dist/components/stream/networkBezier.d.ts +10 -0
  353. package/dist/components/stream/networkColorAccessors.d.ts +49 -0
  354. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  355. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  356. package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
  357. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  358. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  359. package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
  360. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  361. package/dist/components/stream/networkFramePaint.d.ts +52 -0
  362. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  363. package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
  364. package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
  365. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  366. package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
  367. package/dist/components/stream/networkTypes.d.ts +103 -51
  368. package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
  369. package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
  370. package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
  371. package/dist/components/stream/ordinalDomain.d.ts +38 -0
  372. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +31 -0
  373. package/dist/components/stream/ordinalPulse.d.ts +10 -0
  374. package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
  375. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
  376. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  377. package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
  378. package/dist/components/stream/ordinalTypes.d.ts +68 -9
  379. package/dist/components/stream/paintNeeds.d.ts +31 -0
  380. package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
  381. package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
  382. package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
  383. package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
  384. package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
  385. package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
  386. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
  387. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
  388. package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
  389. package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
  390. package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
  391. package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
  392. package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
  393. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
  394. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +86 -0
  395. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
  396. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -0
  397. package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
  398. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
  399. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
  400. package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
  401. package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
  402. package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
  403. package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
  404. package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
  405. package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
  406. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
  407. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +317 -0
  408. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
  409. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  410. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  411. package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
  412. package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
  413. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
  414. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +27 -0
  415. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
  416. package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
  417. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +18 -0
  418. package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
  419. package/dist/components/stream/pipelineConfig.d.ts +179 -0
  420. package/dist/components/stream/pipelineDecay.d.ts +21 -3
  421. package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
  422. package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
  423. package/dist/components/stream/pipelinePulse.d.ts +17 -3
  424. package/dist/components/stream/pipelineRibbons.d.ts +41 -0
  425. package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
  426. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +33 -0
  427. package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
  428. package/dist/components/stream/pipelineTransitions.d.ts +3 -1
  429. package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
  430. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  431. package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
  432. package/dist/components/stream/renderBackend.d.ts +27 -0
  433. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  434. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  435. package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
  436. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  437. package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
  438. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  439. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
  440. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  441. package/dist/components/stream/streamStoreSync.d.ts +37 -0
  442. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  443. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  444. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  445. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  446. package/dist/components/stream/titleLayout.d.ts +31 -0
  447. package/dist/components/stream/types.d.ts +165 -72
  448. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  449. package/dist/components/stream/useFrame.d.ts +44 -2
  450. package/dist/components/stream/useHydration.d.ts +6 -0
  451. package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
  452. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  453. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  454. package/dist/components/stream/workerModuleUrl.d.ts +10 -0
  455. package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
  456. package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
  457. package/dist/components/stream/xyCrosshair.d.ts +11 -0
  458. package/dist/components/stream/xyDateTicks.d.ts +9 -0
  459. package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
  460. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  461. package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
  462. package/dist/controls.min.js +2 -0
  463. package/dist/controls.module.min.js +2 -0
  464. package/dist/forceLayoutWorker.js +1 -0
  465. package/dist/geo.min.js +1 -1
  466. package/dist/geo.module.min.js +1 -1
  467. package/dist/network.min.js +1 -1
  468. package/dist/network.module.min.js +1 -1
  469. package/dist/ordinal.min.js +1 -1
  470. package/dist/ordinal.module.min.js +1 -1
  471. package/dist/physics-matter.min.js +1 -0
  472. package/dist/physics-matter.module.min.js +1 -0
  473. package/dist/physics-rapier.min.js +1 -0
  474. package/dist/physics-rapier.module.min.js +1 -0
  475. package/dist/physics.min.js +2 -0
  476. package/dist/physics.module.min.js +2 -0
  477. package/dist/physicsWorker.js +1 -0
  478. package/dist/realtime.min.js +1 -1
  479. package/dist/realtime.module.min.js +1 -1
  480. package/dist/rough.min.js +1 -0
  481. package/dist/rough.module.min.js +1 -0
  482. package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
  483. package/dist/semiotic-ai-core.d.ts +47 -0
  484. package/dist/semiotic-ai-core.min.js +1 -0
  485. package/dist/semiotic-ai-core.module.min.js +1 -0
  486. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
  487. package/dist/semiotic-ai.d.ts +53 -9
  488. package/dist/semiotic-ai.min.js +1 -1
  489. package/dist/semiotic-ai.module.min.js +1 -1
  490. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
  491. package/dist/semiotic-controls.d.ts +20 -0
  492. package/dist/semiotic-data.min.js +1 -1
  493. package/dist/semiotic-data.module.min.js +1 -1
  494. package/dist/semiotic-experimental.d.ts +38 -9
  495. package/dist/semiotic-experimental.min.js +1 -1
  496. package/dist/semiotic-experimental.module.min.js +1 -1
  497. package/dist/semiotic-geo.d.ts +15 -0
  498. package/dist/semiotic-network.d.ts +15 -0
  499. package/dist/semiotic-ordinal.d.ts +14 -0
  500. package/dist/semiotic-physics-matter.d.ts +10 -0
  501. package/dist/semiotic-physics-rapier.d.ts +9 -0
  502. package/dist/semiotic-physics.d.ts +60 -0
  503. package/dist/semiotic-realtime-core.d.ts +34 -0
  504. package/dist/semiotic-realtime-core.min.js +1 -0
  505. package/dist/semiotic-realtime-core.module.min.js +1 -0
  506. package/dist/semiotic-realtime-react.d.ts +10 -0
  507. package/dist/semiotic-realtime-react.min.js +2 -0
  508. package/dist/semiotic-realtime-react.module.min.js +2 -0
  509. package/dist/semiotic-realtime.d.ts +4 -30
  510. package/dist/semiotic-recipes-core.d.ts +92 -0
  511. package/dist/semiotic-recipes-core.min.js +1 -0
  512. package/dist/semiotic-recipes-core.module.min.js +1 -0
  513. package/dist/semiotic-recipes-react.d.ts +7 -0
  514. package/dist/semiotic-recipes-react.min.js +2 -0
  515. package/dist/semiotic-recipes-react.module.min.js +2 -0
  516. package/dist/semiotic-recipes.d.ts +4 -43
  517. package/dist/semiotic-recipes.min.js +1 -1
  518. package/dist/semiotic-recipes.module.min.js +1 -1
  519. package/dist/semiotic-rough.d.ts +4 -0
  520. package/dist/semiotic-server-edge.d.ts +8 -0
  521. package/dist/semiotic-server-edge.min.js +1 -0
  522. package/dist/semiotic-server-edge.module.min.js +1 -0
  523. package/dist/semiotic-server-node.d.ts +5 -0
  524. package/dist/semiotic-server-node.min.js +1 -0
  525. package/dist/semiotic-server-node.module.min.js +1 -0
  526. package/dist/semiotic-server.d.ts +2 -2
  527. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
  528. package/dist/semiotic-themes-core.d.ts +53 -0
  529. package/dist/semiotic-themes-core.min.js +1 -0
  530. package/dist/semiotic-themes-core.module.min.js +1 -0
  531. package/dist/semiotic-themes-react.d.ts +4 -0
  532. package/dist/semiotic-themes-react.min.js +2 -0
  533. package/dist/semiotic-themes-react.module.min.js +2 -0
  534. package/dist/semiotic-themes.d.ts +6 -76
  535. package/dist/semiotic-themes.min.js +1 -2
  536. package/dist/semiotic-themes.module.min.js +1 -2
  537. package/dist/semiotic-utils-core.d.ts +50 -0
  538. package/dist/semiotic-utils-core.min.js +1 -0
  539. package/dist/semiotic-utils-core.module.min.js +1 -0
  540. package/dist/semiotic-utils-react.d.ts +5 -0
  541. package/dist/semiotic-utils-react.min.js +2 -0
  542. package/dist/semiotic-utils-react.module.min.js +2 -0
  543. package/dist/semiotic-utils.d.ts +3 -39
  544. package/dist/semiotic-utils.min.js +1 -2
  545. package/dist/semiotic-utils.module.min.js +1 -2
  546. package/dist/semiotic-value.min.js +1 -1
  547. package/dist/semiotic-value.module.min.js +1 -1
  548. package/dist/semiotic-xy.d.ts +12 -0
  549. package/dist/semiotic.d.ts +44 -8
  550. package/dist/semiotic.min.js +1 -1
  551. package/dist/semiotic.module.min.js +1 -1
  552. package/dist/server.min.js +1 -1
  553. package/dist/server.module.min.js +1 -1
  554. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  555. package/dist/test-utils/frameMock.d.ts +12 -9
  556. package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
  557. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
  558. package/dist/xy.min.js +1 -1
  559. package/dist/xy.module.min.js +1 -1
  560. package/package.json +259 -88
  561. package/spec/README.md +152 -0
  562. package/spec/bindings/README.md +35 -0
  563. package/spec/bindings/vega-lite.mjs +112 -0
  564. package/spec/v0.1/annotation-provenance.schema.json +127 -0
  565. package/spec/v0.1/audience-profile.schema.json +67 -0
  566. package/spec/v0.1/chart-capability.schema.json +186 -0
  567. package/dist/components/recipes/gofish.d.ts +0 -207
  568. package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
  569. package/dist/components/recipes/gofishLambdas.d.ts +0 -145
  570. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
  571. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
  572. package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
  573. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
  574. package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
  575. package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
@@ -1,8 +1,9 @@
1
+ import type { ReactElement } from "react";
1
2
  import type { LegendGroup } from "../types/legendTypes";
2
3
  import { type NetworkSymbolName } from "../stream/symbolPath";
3
4
  /**
4
5
  * `legendGroupsFrom` — build the `LegendGroup[]` a custom-layout recipe passes
5
- * through `frameProps.legend` (`{ legendGroups }`). All three custom-chart HOCs
6
+ * through `frameProps.legend` (`{ legendGroups }`). All four custom-chart HOCs
6
7
  * disable the built-in legend because the *layout* owns color/shape/size; without
7
8
  * this, authors hand-roll the `LegendGroup` shape (its `styleFn`, custom-glyph
8
9
  * `type` render functions, swatch sizing). This closes that gap without the frame
@@ -55,3 +56,54 @@ export interface LegendGroupsInput {
55
56
  sizeLabel?: string;
56
57
  }
57
58
  export declare function legendGroupsFrom(input: LegendGroupsInput): LegendGroup[];
59
+ export interface LegendSwatch {
60
+ /** Legend entry label. */
61
+ label: string;
62
+ /** Filled-square swatch color (the categorical / fill case). */
63
+ color?: string;
64
+ /** Line-stroke swatch color (a horizontal bar — for line-series legends). */
65
+ line?: string;
66
+ /** Glyph-shape swatch (the per-datum shape channel). */
67
+ shape?: NetworkSymbolName;
68
+ /** Diagonal-hatch swatch (percentile / uncertainty bands). Line color comes
69
+ * from `color`, falling back to the label color. */
70
+ hatch?: boolean;
71
+ }
72
+ export interface LegendSwatchesProps {
73
+ entries: LegendSwatch[];
74
+ /** Top-left x of the legend block, in plot coordinates. */
75
+ x: number;
76
+ /** Top-left y of the legend block, in plot coordinates. */
77
+ y: number;
78
+ /** Stack entries down (`vertical`) or flow them across (`horizontal`).
79
+ * @default "vertical" */
80
+ orientation?: "vertical" | "horizontal";
81
+ /** Swatch box size in px. @default 14 */
82
+ swatchSize?: number;
83
+ /** Row height (vertical) / inter-entry gap (horizontal), px. @default 8 (+ swatch) */
84
+ gap?: number;
85
+ /** Gap between a swatch and its label, px. @default 6 */
86
+ labelGap?: number;
87
+ /** @default 12 */
88
+ fontSize?: number;
89
+ /** Label color. @default "var(--semiotic-text-secondary, #888)" */
90
+ color?: string;
91
+ className?: string;
92
+ keyId?: string | number;
93
+ }
94
+ /**
95
+ * A self-contained SVG legend a custom layout draws in its `overlays` — the
96
+ * portable counterpart to {@link legendGroupsFrom} (which feeds the *frame's*
97
+ * legend via `frameProps.legend`). Custom charts disable the built-in legend,
98
+ * so this renders swatch + label rows directly: fill squares, line bars, glyph
99
+ * shapes, and diagonal-hatch swatches, stacked or flowed. `pointerEvents: none`.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * legendSwatches({
104
+ * x: 0, y: 0, orientation: "horizontal",
105
+ * entries: SPHERES.map((s) => ({ label: s, color: COLORS[s] })),
106
+ * })
107
+ * ```
108
+ */
109
+ export declare function legendSwatches(p: LegendSwatchesProps): ReactElement;
@@ -13,6 +13,35 @@ export declare function resolveAccessor<T = unknown>(a: string | ((d: Datum) =>
13
13
  * it lives here once. Returns `unknown` — narrow at the call site.
14
14
  */
15
15
  export declare function readField(d: unknown, key: string, fallback: unknown): unknown;
16
+ /**
17
+ * Return the **raw user datum** from a value that may be a frame wrapper.
18
+ *
19
+ * Stream Frames and custom-layout scene nodes carry the user's object under
20
+ * `.data` (a `RealtimeNode` / `SceneDatum` wrapper), and some interaction
21
+ * payloads nest it under `.datum` (hit-test results, certain tooltip inputs) —
22
+ * the wrapped-vs-raw split that bites every `onObservation` consumer. This
23
+ * collapses all of it: `unwrapDatum(value)` always yields the object you
24
+ * passed in, whether the frame wrapped it (either way) or not.
25
+ *
26
+ * This is **the** unwrap path for both `onObservation` handlers and
27
+ * `frameProps.tooltipContent` renderers — call it once on the incoming value
28
+ * instead of hand-rolling `x.data ?? x` guards (and never pre-unwrap the
29
+ * argument yourself: `unwrapDatum(x?.data ?? x)` can double-unwrap a raw datum
30
+ * that legitimately carries a `data` field).
31
+ *
32
+ * Heuristic footgun: any value with a top-level `data` (or `datum`) property is
33
+ * treated as a wrapper. If your *raw* datum legitimately has its own such
34
+ * field, this returns that field instead of the datum — rename the field or
35
+ * read it directly.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * onObservation={(o) => {
40
+ * if (o.type === "hover") setActive(unwrapDatum(o.datum))
41
+ * }}
42
+ * ```
43
+ */
44
+ export declare function unwrapDatum<T = Datum>(value: unknown): T | null;
16
45
  /**
17
46
  * Group items into a `Map` keyed by a derived string. Insertion order is
18
47
  * preserved both for keys and within each bucket — recipes rely on stable
@@ -130,3 +159,26 @@ export declare class LayoutCache<V> {
130
159
  export declare function makeShade(baseColor: string, strength?: number): (t: number) => string;
131
160
  /** One-shot form of {@link makeShade}: perceptual lightness shade of `baseColor`. */
132
161
  export declare function shade(baseColor: string, t: number, strength?: number): string;
162
+ /** Build a scene-node `datum` from a flat field map (a thin wrapper over
163
+ * {@link createSafeDatum}, used by recipes that synthesize per-glyph data). */
164
+ export declare function datumFromFields(fields: Record<string, unknown>): Datum;
165
+ /** A stable, URL/key-safe id from an arbitrary label — for keyed overlays and
166
+ * transition identity (`"Extra Boba" → "extra-boba"`). */
167
+ export declare function stableGlyphId(value: string): string;
168
+ /** Clamp `value` into `[min, max]`. The one-liner every layout re-declares to
169
+ * keep a radius, opacity, or pixel position inside its valid range. */
170
+ export declare function clamp(value: number, min: number, max: number): number;
171
+ /** Coerce to a finite non-negative number. Shared by tally/token helpers so
172
+ * non-finite inputs fail closed instead of leaking NaN into geometry. */
173
+ export declare function nonNegativeFinite(value: number | undefined): number;
174
+ /** Arithmetic mean of a numeric list; `0` for an empty list (so it's safe to
175
+ * feed an unfiltered slice). Recipes average angles, positions, and weights. */
176
+ export declare function mean(values: readonly number[]): number;
177
+ /**
178
+ * Turn a hex color (`#rgb` or `#rrggbb`) into an `rgba(…)` string at `alpha`.
179
+ * The dimming-by-alpha helper a custom layout reaches for when it must express
180
+ * hover/selection fade as a *fill color* (e.g. inside a recipe's `resolveColor`
181
+ * callback, where the frame's opacity channel isn't available). Non-hex input
182
+ * is returned unchanged so it composes with CSS-var / `rgb()` colors.
183
+ */
184
+ export declare function withAlpha(color: string, alpha: number): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Run-length encoding for sequential/categorical series — the "collapse a
3
+ * per-step categorical field into drawable runs" operation that condition
4
+ * strips, status timelines, and calendar ribbons all need. A custom layout
5
+ * draws one rect per run instead of one per step.
6
+ *
7
+ * Pure / SSR-safe. Several custom charts re-derived this with three slightly
8
+ * different signatures (value-change by index, value-change by domain coord,
9
+ * boolean-present); this is the single form that covers all three.
10
+ */
11
+ export interface Run<V> {
12
+ /** The constant value over the run. */
13
+ value: V;
14
+ /** Run start on the domain axis — the array index of the first item, or the
15
+ * `coord` of the first item when `coord` is supplied. Inclusive. */
16
+ start: number;
17
+ /** Run end on the domain axis. Half-open: the run covers `[start, end)`. With
18
+ * `coord`, this is the next item's coord (or the last coord + `step` for the
19
+ * final run / a run that precedes a gap). Without `coord`, the index after
20
+ * the run's last item. */
21
+ end: number;
22
+ /** Number of consecutive items in the run. */
23
+ count: number;
24
+ /** Index of the run's first item in the input array. */
25
+ startIndex: number;
26
+ /** Index of the run's last item in the input array (inclusive). */
27
+ endIndex: number;
28
+ }
29
+ export interface RunOptions<T, V> {
30
+ /** Map an item to its position on the domain axis (e.g. day-of-year). When
31
+ * omitted, the array index is used and runs are index-based. A gap in
32
+ * `coord` (a jump larger than `step`) closes the current run. */
33
+ coord?: (item: T, index: number) => number;
34
+ /** Width of one item on the domain axis — closes the final run and detects
35
+ * gaps when `coord` is supplied. @default 1 */
36
+ step?: number;
37
+ /** Custom equality for grouping adjacent items. @default `Object.is` */
38
+ equals?: (a: V, b: V) => boolean;
39
+ /** Presence mode: only items with a truthy value form runs; falsy items break
40
+ * the current run and are excluded entirely (the boolean condition-strip
41
+ * variant). @default false */
42
+ truthyOnly?: boolean;
43
+ }
44
+ /**
45
+ * Collapse a sequential series into runs of equal adjacent values.
46
+ *
47
+ * @example value-change runs over a domain coordinate (a condition ring/strip)
48
+ * ```ts
49
+ * runs(days, (d) => d.condition, { coord: (d) => d.day, step: 1 })
50
+ * // → [{ value: "clear", start: 0, end: 5, count: 5, ... }, ...]
51
+ * ```
52
+ * @example boolean present/absent runs (a "freezing days" strip)
53
+ * ```ts
54
+ * runs(days, (d) => d.belowFreezing, { truthyOnly: true })
55
+ * ```
56
+ */
57
+ export declare function runs<T, V = unknown>(items: readonly T[], value: (item: T, index: number) => V, opts?: RunOptions<T, V>): Run<V>[];
58
+ /** Alias for {@link runs} — the textbook name for the transform. */
59
+ export declare const runLengthEncode: typeof runs;
@@ -0,0 +1,157 @@
1
+ export type TokenType = "dot" | "icon" | "glyph";
2
+ export type TokenSemantics = "observed-unit" | "unitized-measure" | "possible-outcome" | "posterior-sample" | "hypothetical-case" | "risk-case" | "topic-anchor" | "decorative";
3
+ export type TokenCountStrategy = "actual" | "unitized" | "fixed-denominator" | "quantile" | "sample" | "posterior-sample" | "random-sample";
4
+ export type TokenLayout = "row" | "column" | "grid" | "stack" | "bar-segment" | "waffle" | "beeswarm" | "dotplot" | "quantile-strip" | "small-multiple";
5
+ export type TokenLabelPolicy = "text-plus-token" | "text-plus-icon" | "text-only" | "token-only" | "icon-only" | "none";
6
+ export type TokenTaskIntent = "precise-comparison" | "frequency-reasoning" | "probability-estimation" | "risk-communication" | "memory" | "editorial-engagement" | "public-explanation" | "support-decision" | "measure" | "estimate probability" | "understand risk" | "remember" | "decide";
7
+ export type TokenCapabilityIntent = "compare-categories" | "distribution" | "part-to-whole" | "rank" | "outlier-detection";
8
+ export interface TokenEncoding {
9
+ tokenType: TokenType;
10
+ tokenSemantics: TokenSemantics;
11
+ countStrategy: TokenCountStrategy;
12
+ layout?: TokenLayout;
13
+ /** Named icon/glyph key in host code; Semiotic keeps this semantic, not visual. */
14
+ token?: string;
15
+ icon?: string;
16
+ /** Value represented by one complete token for unitized measures. */
17
+ unitValue?: number;
18
+ /** Alias for `unitValue`, matching the lower-level `unitize` helper. */
19
+ unit?: number;
20
+ /** Human-readable meaning, e.g. "one token = 1,000 commuters". */
21
+ unitMeaning?: string;
22
+ tokenCount?: number;
23
+ maxTokens?: number;
24
+ minFraction?: number;
25
+ numerator?: number;
26
+ denominator?: number;
27
+ labelPolicy?: TokenLabelPolicy;
28
+ seed?: number;
29
+ }
30
+ export interface TokenGeneratorInput<D = unknown> {
31
+ value?: number;
32
+ /** Scenario/projection endpoint for `unitized` tallies. */
33
+ rangeValue?: number;
34
+ numerator?: number;
35
+ denominator?: number;
36
+ samples?: readonly number[];
37
+ data?: readonly D[];
38
+ valueAccessor?: keyof D | ((d: D) => number);
39
+ }
40
+ export interface VisualToken<D = unknown> {
41
+ index: number;
42
+ tokenType: TokenType;
43
+ tokenSemantics: TokenSemantics;
44
+ countStrategy: TokenCountStrategy;
45
+ fraction: number;
46
+ startFraction: number;
47
+ value: number;
48
+ start: number;
49
+ end: number;
50
+ unitValue?: number;
51
+ unitMeaning?: string;
52
+ highlighted?: boolean;
53
+ /** Marks a token as the projected/scenario extension of a range tally. */
54
+ range?: "scenario";
55
+ quantile?: number;
56
+ sample?: number;
57
+ datum?: D;
58
+ }
59
+ export type TokenDiagnosticCode = "TOKEN_SEMANTICS_UNCLEAR" | "MISSING_COUNT_STRATEGY" | "ICON_ONLY_LABELS" | "TOO_MANY_VISIBLE_TOKENS" | "DECORATIVE_PICTOGRAPHS" | "TOKEN_STRATEGY_MISMATCH" | "MISSING_UNIT_VALUE" | "MISSING_UNIT_MEANING";
60
+ export interface TokenDiagnostic {
61
+ code: TokenDiagnosticCode;
62
+ severity: "warning" | "info";
63
+ message: string;
64
+ }
65
+ export interface TokenDiagnosticsContext {
66
+ visibleTokens?: number;
67
+ maxRecommendedTokens?: number;
68
+ }
69
+ export interface TokenSet<D = unknown> {
70
+ tokens: VisualToken<D>[];
71
+ encoding: TokenEncoding;
72
+ /**
73
+ * Strategy-specific source total: value-space for `unitized`/numeric `actual`,
74
+ * denominator for `fixed-denominator`, sample count for sample/quantile
75
+ * strategies, and observed datum count for data-backed `actual`.
76
+ */
77
+ total: number;
78
+ /**
79
+ * Strategy-specific visible amount: represented value for `unitized`, visible
80
+ * token count for fixed-denominator/sample/quantile/data-backed actual.
81
+ */
82
+ shown: number;
83
+ overflow: boolean;
84
+ numerator?: number;
85
+ denominator?: number;
86
+ unitValue?: number;
87
+ /** Projected/scenario endpoint when input.rangeValue is supplied. */
88
+ rangeTotal?: number;
89
+ /** Tokens extending a unitized tally from total to rangeTotal. */
90
+ rangeTokens?: VisualToken<D>[];
91
+ diagnostics: TokenDiagnostic[];
92
+ }
93
+ export interface TokenGridOptions {
94
+ x?: number;
95
+ y?: number;
96
+ columns?: number;
97
+ rows?: number;
98
+ cellWidth?: number;
99
+ cellHeight?: number;
100
+ gutter?: number;
101
+ flow?: "row" | "column";
102
+ columnDirection?: "right" | "left";
103
+ rowDirection?: "down" | "up";
104
+ /** Anchor within each cell for the returned point. `[0.5, 1]` is useful for feet-down glyphs. */
105
+ anchor?: [number, number];
106
+ }
107
+ export interface PositionedToken<D = unknown> extends VisualToken<D> {
108
+ x: number;
109
+ y: number;
110
+ row: number;
111
+ column: number;
112
+ }
113
+ export interface TokenEncodingSuggestion {
114
+ recommendedEncoding: string;
115
+ tokenEncoding?: TokenEncoding;
116
+ rationale: string;
117
+ warnings: TokenDiagnostic[];
118
+ alternatives: string[];
119
+ }
120
+ export interface SuggestTokenEncodingInput {
121
+ taskIntent: TokenTaskIntent;
122
+ dataType?: "count" | "measure" | "distribution" | "probability" | "risk" | "category";
123
+ audience?: "expert" | "general-public" | "internal";
124
+ precisionNeed?: "low" | "medium" | "high";
125
+ availableSpace?: "small" | "medium" | "large";
126
+ concreteEntity?: string;
127
+ }
128
+ export declare function normalizeTokenEncoding(encoding: TokenEncoding): TokenEncoding;
129
+ /**
130
+ * Generate visible token records from a semantic token encoding.
131
+ *
132
+ * This is the frame-agnostic bridge between the strategy layer ("each token
133
+ * is a case / unit / possible outcome") and today's glyph/dot/icon renderers.
134
+ * `unitized` delegates to `unitize`, so fractional final glyphs keep the same
135
+ * ISOTYPE partial-fill convention used by existing custom layouts.
136
+ */
137
+ export declare function generateTokens<D = unknown>(input: number | readonly number[] | TokenGeneratorInput<D>, encoding: TokenEncoding): TokenSet<D>;
138
+ /**
139
+ * Position generated tokens in a deterministic row/column grid. The returned
140
+ * `(x, y)` is the anchor point inside each cell, so use `[0.5, 1]` for
141
+ * baseline-standing ISOTYPE glyphs and `[0.5, 0.5]` for centered dots/icons.
142
+ */
143
+ export declare function layoutTokenGrid<D = unknown>(tokenSetOrTokens: TokenSet<D> | readonly VisualToken<D>[], options?: TokenGridOptions): PositionedToken<D>[];
144
+ export declare function diagnoseTokenEncoding(encoding: Partial<TokenEncoding>, context?: TokenDiagnosticsContext): TokenDiagnostic[];
145
+ /**
146
+ * Bridge token-task intents into the chart capability taxonomy used by
147
+ * `suggestCharts`. Human-friendly aliases normalize first, so callers can use
148
+ * either the canonical token intent (`probability-estimation`) or the UI label
149
+ * alias (`estimate probability`).
150
+ */
151
+ export declare function tokenTaskIntentToCapabilityIntents(intent: TokenTaskIntent): TokenCapabilityIntent[];
152
+ /**
153
+ * Task-aware defaults for tokenized reasoning. This does not render a chart;
154
+ * it returns the semantic encoding Semiotic/IDID can explain, critique, or
155
+ * hand to `generateTokens` before a custom layout stamps dots/icons/glyphs.
156
+ */
157
+ export declare function suggestTokenEncoding(input: SuggestTokenEncodingInput): TokenEncodingSuggestion;
@@ -0,0 +1,79 @@
1
+ import type { GlyphDef } from "../stream/glyphDef";
2
+ import type { SceneAccessibilityMetadata, SceneDatum, SceneNode, Style } from "../stream/types";
3
+ import type { SymbolName } from "../stream/symbolPath";
4
+ import { type PositionedToken, type TokenEncoding, type TokenGeneratorInput, type TokenGridOptions, type TokenLayout, type TokenSet, type VisualToken } from "./tokenEncoding";
5
+ export type TokenLayerInput<D> = number | readonly number[] | TokenGeneratorInput<D> | TokenSet<D>;
6
+ export type TokenLayerValue<T, D> = T | ((token: PositionedToken<D>) => T | undefined);
7
+ export interface TokenPosition {
8
+ x: number;
9
+ y: number;
10
+ row?: number;
11
+ column?: number;
12
+ }
13
+ export interface TokenLayerOptions<D = unknown> extends TokenGridOptions {
14
+ /** Override the encoding's preferred layout for this placement. */
15
+ layout?: TokenLayout;
16
+ /** Plot-space width used to infer grid columns or normalize quantile strips. */
17
+ width?: number;
18
+ /** Plot-space height used to normalize quantile strips. */
19
+ height?: number;
20
+ /** Rendered glyph height / symbol diameter / dot diameter. @default 12
21
+ * For user-facing ISOTYPE/icon arrays, prefer 16px+ in the final layout. */
22
+ tokenSize?: TokenLayerValue<number, D>;
23
+ /** Dot radius. Defaults to half tokenSize. */
24
+ radius?: TokenLayerValue<number, D>;
25
+ /** Primary mark paint. Prefer passing ctx.resolveColor(...) from custom layouts. */
26
+ color?: TokenLayerValue<string, D>;
27
+ /** Paint for unhighlighted fixed-denominator tokens. */
28
+ inactiveColor?: TokenLayerValue<string, D>;
29
+ /** Paint for projected/scenario range tokens when includeRange is true. */
30
+ rangeColor?: TokenLayerValue<string, D>;
31
+ /** Accent paint for glyph role fills. */
32
+ accent?: TokenLayerValue<string, D>;
33
+ /** Ghost paint for partial glyph fills. */
34
+ ghostColor?: TokenLayerValue<string | undefined, D>;
35
+ /** Symbol shape for dot/icon fallback rendering. */
36
+ symbolType?: TokenLayerValue<SymbolName, D>;
37
+ /** Custom origin-centered SVG path for symbol nodes. */
38
+ symbolPath?: TokenLayerValue<string | undefined, D>;
39
+ /** Composite pictogram definition for icon/glyph tokens. */
40
+ glyph?: TokenLayerValue<GlyphDef | undefined, D>;
41
+ /** Partial-fill axis for glyph tokens. */
42
+ fractionDirection?: TokenLayerValue<"horizontal" | "vertical", D>;
43
+ rotation?: TokenLayerValue<number | undefined, D>;
44
+ style?: TokenLayerValue<Style | undefined, D>;
45
+ datum?: TokenLayerValue<SceneDatum, D>;
46
+ accessibleDatum?: TokenLayerValue<SceneAccessibilityMetadata["accessibleDatum"], D>;
47
+ accessibility?: TokenLayerValue<SceneAccessibilityMetadata["accessibility"], D>;
48
+ pointId?: TokenLayerValue<string | undefined, D>;
49
+ idPrefix?: string;
50
+ include?: (token: PositionedToken<D>) => boolean;
51
+ /** Render `TokenSet.rangeTokens` after base tokens for unitized scenario tallies. */
52
+ includeRange?: boolean;
53
+ /** Custom placement hook for scale-driven strips, stacks, map clusters, etc. */
54
+ positionToken?: (token: VisualToken<D>, index: number, tokens: readonly VisualToken<D>[]) => TokenPosition;
55
+ /** Maps a sample/value to plot-space x for quantile/sample strips. */
56
+ valueToX?: (value: number, token: VisualToken<D>) => number;
57
+ /** Maps a sample/value to plot-space y for quantile/sample strips. */
58
+ valueToY?: (value: number, token: VisualToken<D>) => number;
59
+ }
60
+ export interface TokenLayerConfig<D = unknown> {
61
+ input: TokenLayerInput<D>;
62
+ encoding?: TokenEncoding;
63
+ options?: TokenLayerOptions<D>;
64
+ }
65
+ export interface TokenLayerResult<D = unknown> {
66
+ tokenSet: TokenSet<D>;
67
+ positionedTokens: PositionedToken<D>[];
68
+ nodes: SceneNode[];
69
+ }
70
+ /**
71
+ * Frame-agnostic rendering helper for tokenized reasoning.
72
+ *
73
+ * `tokenLayer` is the scene-node bridge for ISOTYPE/icon arrays, risk grids,
74
+ * quantile dotplots, and hybrid bar-token layouts. It creates the semantic
75
+ * tokens, positions them, and returns ordinary Semiotic scene nodes so custom
76
+ * charts still get canvas/SVG rendering, hit testing, keyboard navigation,
77
+ * pointId annotations, transitions, and accessible table rows.
78
+ */
79
+ export declare function tokenLayer<D = unknown>({ input, encoding, options, }: TokenLayerConfig<D>): TokenLayerResult<D>;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * `unitize` — the pictogram/tally allocator: turn a magnitude into repeated
3
+ * unit signs with a fractional final sign (the ISOTYPE rule: symbols repeat,
4
+ * they do not grow).
5
+ *
6
+ * This is the counting sibling of {@link allocateCells} (`waffle.ts`):
7
+ * `allocateCells` divides a *fixed* number of grid cells proportionally among
8
+ * categories (largest-remainder, integer cells); `unitize` converts one value
9
+ * into *as many* signs as it needs at a fixed value-per-sign, preserving the
10
+ * remainder as a partial sign. Use `allocateCells` for part-to-whole waffles,
11
+ * `unitize` for unit charts, pictogram rows, arrow bundles, and sign stacks.
12
+ */
13
+ /** One drawn unit sign. */
14
+ export interface UnitSign {
15
+ /** 0-based position in the tally (also the grid/wrap index). */
16
+ index: number;
17
+ /** How much of this sign is filled, 0–1. All signs but the last are 1. */
18
+ fraction: number;
19
+ /** Value where this sign begins (`index * unit`). */
20
+ start: number;
21
+ /** Value this sign reaches (`min(value, (index + 1) * unit)`). */
22
+ end: number;
23
+ /** Value carried by this sign (`end - start`, i.e. `fraction * unit`). */
24
+ value: number;
25
+ }
26
+ /** A unit sign inside the projected/scenario extension of a range tally. */
27
+ export interface RangeUnitSign extends UnitSign {
28
+ /**
29
+ * Where the range fill begins within this sign, 0–1. Non-zero only on the
30
+ * boundary sign when the base value ends mid-sign — draw the range fill
31
+ * clipped from `startFraction` to `fraction` so base and range tile one
32
+ * sign without double-painting.
33
+ */
34
+ startFraction: number;
35
+ }
36
+ export interface UnitizeOptions {
37
+ /** Value represented by one complete sign. Must be > 0. */
38
+ unit: number;
39
+ /**
40
+ * Cap on the number of signs. When the tally is truncated the result's
41
+ * `overflow` flag is set (render a `+`, a count label, or scale the unit).
42
+ * @default Infinity
43
+ */
44
+ maxUnits?: number;
45
+ /**
46
+ * Drop a trailing partial sign whose fraction falls below this threshold —
47
+ * 176 at unit 25 is seven arrows, not seven arrows and a 4% stub. The
48
+ * dropped remainder is still visible as `total - shown`.
49
+ * @default 0
50
+ */
51
+ minFraction?: number;
52
+ }
53
+ export interface UnitizeResult {
54
+ /** The signs to draw, in order; every sign but the last has fraction 1. */
55
+ units: UnitSign[];
56
+ /** The value-per-sign the tally was built with. */
57
+ unit: number;
58
+ /** The sanitized input value (non-finite and negative clamp to 0). */
59
+ total: number;
60
+ /** Value actually represented by the drawn signs (≤ `total` when capped or a sliver was dropped). */
61
+ shown: number;
62
+ /** True when `maxUnits` truncated the tally. */
63
+ overflow: boolean;
64
+ }
65
+ export interface UnitizeRangeResult extends UnitizeResult {
66
+ /**
67
+ * Signs extending the tally from `value` to `rangeValue` — the projected /
68
+ * scenario portion, conventionally drawn hatched or outlined. Indices
69
+ * continue the base tally; the first entry carries a non-zero
70
+ * `startFraction` when the base value ends mid-sign.
71
+ */
72
+ rangeUnits: RangeUnitSign[];
73
+ /** The sanitized range endpoint (≥ `total`). */
74
+ rangeTotal: number;
75
+ }
76
+ /**
77
+ * Allocate a value into repeated unit signs with a fractional final sign.
78
+ *
79
+ * Feeds any repeated-mark rendering: a row of pictograms, a stack of signs on
80
+ * a map, an arrow bundle, wrapped unit grids (derive row/column from
81
+ * `index`). Pair each sign with a `glyph` scene node (its `fraction` maps
82
+ * directly onto the glyph's partial fill) or clip your own SVG.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const tally = unitize(176, { unit: 25 })
87
+ * // 8 signs: seven at fraction 1, the last at 0.04 — or drop the stub:
88
+ * const arrows = unitize(176, { unit: 25, minFraction: 0.08 })
89
+ * // arrows.units.length === 7, arrows.shown === 175, arrows.total === 176
90
+ * ```
91
+ */
92
+ export declare function unitize(value: number, options: UnitizeOptions): UnitizeResult;
93
+ /**
94
+ * Allocate a value plus a projected/scenario extension: solid signs to
95
+ * `value`, continuation signs from `value` to `rangeValue` (draw them hatched
96
+ * or outlined — countable, but visibly not yet real).
97
+ *
98
+ * When `value` ends mid-sign, the first range sign shares that sign: its
99
+ * `startFraction` is where the solid fill stopped, so the two fills tile one
100
+ * sign exactly.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const { units, rangeUnits } = unitizeRange(325, 580, { unit: 25 })
105
+ * // 13 solid signs, then 11 hatched signs (the last at fraction 0.2)
106
+ * ```
107
+ */
108
+ export declare function unitizeRange(value: number, rangeValue: number, options: UnitizeOptions): UnitizeRangeResult;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 2D vector kit — the handful of point/vector operations every hand-built
3
+ * custom layout re-derives when it positions marks in Cartesian space:
4
+ * add/subtract two points, scale one, take a magnitude, normalize to a unit
5
+ * direction. A radial network spoke, an edge offset normal to its tangent, a
6
+ * leader line — all of them open with three or four of these one-liners.
7
+ *
8
+ * Pure / SSR-safe, dependency-free. Operates on the shared {@link Point}
9
+ * (`{ x, y }`) used across the radial and edge-router kits, so results compose
10
+ * directly with `polarToXY`, `boxEdgeAnchors`, `curvedEdgePath`, and the cubic
11
+ * helpers in `edgeRouter`.
12
+ */
13
+ import type { Point } from "./radialCoords";
14
+ export type { Point };
15
+ /** Component-wise sum `a + b`. */
16
+ export declare function addPoints(a: Point, b: Point): Point;
17
+ /** Component-wise difference `a - b` (the vector from `b` to `a`). */
18
+ export declare function subtractPoints(a: Point, b: Point): Point;
19
+ /** Scale a point/vector by a scalar `k`. */
20
+ export declare function scalePoint(a: Point, k: number): Point;
21
+ /** Euclidean length of the vector from the origin to `a`. */
22
+ export declare function pointMagnitude(a: Point): number;
23
+ /**
24
+ * The unit vector in the direction of `a`. A zero-length vector returns `a`
25
+ * unchanged (its magnitude is treated as 1) so callers never divide by zero —
26
+ * the common "tangent of a degenerate edge" case stays finite.
27
+ */
28
+ export declare function normalizePoint(a: Point): Point;
@@ -44,3 +44,46 @@ export interface WaffleConfig {
44
44
  * ```
45
45
  */
46
46
  export declare const waffleLayout: CustomLayout<WaffleConfig>;
47
+ export interface CellWeight {
48
+ /** Stable identity for the category (used as the secondary sort tiebreak). */
49
+ key: string;
50
+ /** Relative weight — cells are allocated proportional to this. */
51
+ weight: number;
52
+ }
53
+ export interface AllocatedCells extends CellWeight {
54
+ /** The category's exact (fractional) share of `totalCells`. */
55
+ exact: number;
56
+ /** The integer cells assigned to this category. */
57
+ cells: number;
58
+ /** Fractional leftover (`exact - floor(exact)`), the largest-remainder key. */
59
+ remainder: number;
60
+ }
61
+ export interface AllocateCellsOptions {
62
+ /** Cells guaranteed to every category with a positive weight, even when its
63
+ * proportional share rounds below this. Over-allocation is then clawed back
64
+ * from the largest categories. @default 0 */
65
+ minPerCategory?: number;
66
+ }
67
+ /**
68
+ * Distribute `totalCells` across weighted categories so each gets a count
69
+ * proportional to its weight, using the **largest-remainder method** (every
70
+ * cell is assigned; no drift from rounding each share independently). The pure
71
+ * allocation math behind a feature-mix / proportional waffle: turn `{kind →
72
+ * count}` into `{kind → grid cells}`.
73
+ *
74
+ * With `minPerCategory` every present category keeps at least that many cells
75
+ * (so small-but-nonzero categories stay visible); the shortfall is reclaimed
76
+ * from the categories holding the most cells. Categories are returned in input
77
+ * order — sort the input first if you want a particular legend/fill order.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const alloc = allocateCells(
82
+ * [{ key: "monument", weight: 7 }, { key: "museum", weight: 2 }, { key: "park", weight: 1 }],
83
+ * 100,
84
+ * { minPerCategory: 1 },
85
+ * )
86
+ * // → [{ key: "monument", cells: 70, … }, { key: "museum", cells: 20, … }, { key: "park", cells: 10, … }]
87
+ * ```
88
+ */
89
+ export declare function allocateCells(weights: readonly CellWeight[], totalCells: number, opts?: AllocateCellsOptions): AllocatedCells[];
@@ -0,0 +1,46 @@
1
+ import type { SceneDatum, SceneRenderBackend, Style } from "../stream/types";
2
+ import type { Datum } from "../charts/shared/datumTypes";
3
+ type RoughSceneNode = Datum & {
4
+ type?: string;
5
+ style?: Style;
6
+ datum?: SceneDatum;
7
+ };
8
+ export interface RoughRenderModeOptions {
9
+ /** Base seed. Each scene identity derives a stable non-zero Rough.js seed. @default 1 */
10
+ seed?: number;
11
+ roughness?: number;
12
+ bowing?: number;
13
+ maxRandomnessOffset?: number;
14
+ curveFitting?: number;
15
+ curveTightness?: number;
16
+ curveStepCount?: number;
17
+ fillStyle?: "hachure" | "solid" | "zigzag" | "cross-hatch" | "dots" | "dashed" | "zigzag-line";
18
+ fillWeight?: number;
19
+ hachureAngle?: number;
20
+ hachureGap?: number;
21
+ dashOffset?: number;
22
+ dashGap?: number;
23
+ zigzagOffset?: number;
24
+ disableMultiStroke?: boolean;
25
+ disableMultiStrokeFill?: boolean;
26
+ preserveVertices?: boolean;
27
+ simplification?: number;
28
+ fixedDecimalPlaceDigits?: number;
29
+ /** Maximum reusable drawables retained by this mode instance. @default 1000 */
30
+ cacheSize?: number;
31
+ }
32
+ export interface RoughRenderMode extends SceneRenderBackend<RoughSceneNode> {
33
+ readonly id: "roughjs";
34
+ readonly seed: number;
35
+ readonly cacheEntries: number;
36
+ clearCache(): void;
37
+ }
38
+ /** Deterministic FNV-1a seed helper suitable for Rough.js's non-zero seed range. */
39
+ export declare function stableRoughSeed(value: unknown): number;
40
+ /**
41
+ * Create an explicit optional Rough.js scene backend. Keep one instance (for
42
+ * example with `useMemo`) so its deterministic drawables can be reused across
43
+ * hover, selection, and Canvas repaints.
44
+ */
45
+ export declare function createRoughRenderMode(options?: RoughRenderModeOptions): RoughRenderMode;
46
+ export {};