@pibbl/core 0.0.1 → 0.0.3-alpha.109.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 (683) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +81 -0
  3. package/dist/features/machines/animation.d.ts +64 -0
  4. package/dist/features/machines/animation.js +55 -0
  5. package/dist/features/machines/animation.js.map +7 -0
  6. package/dist/features/machines/animation.mjs +1 -0
  7. package/dist/features/machines/assign.d.ts +16 -0
  8. package/dist/features/machines/assign.js +15 -0
  9. package/dist/features/machines/assign.js.map +7 -0
  10. package/dist/features/machines/callback.d.ts +9 -0
  11. package/dist/features/machines/callback.js +7 -0
  12. package/dist/features/machines/callback.js.map +7 -0
  13. package/dist/features/machines/hook.d.ts +30 -0
  14. package/dist/features/machines/hook.js +37 -0
  15. package/dist/features/machines/hook.js.map +7 -0
  16. package/dist/features/machines/index.d.ts +6 -0
  17. package/dist/features/machines/index.js +12 -0
  18. package/dist/features/machines/index.js.map +7 -0
  19. package/dist/features/machines/index.mjs +1 -0
  20. package/dist/features/machines/runtime.d.ts +18 -0
  21. package/dist/features/machines/runtime.js +363 -0
  22. package/dist/features/machines/runtime.js.map +7 -0
  23. package/dist/features/machines/types.d.ts +164 -0
  24. package/dist/features/physics/2d-geometry.d.ts +3 -3
  25. package/dist/features/physics/2d-geometry.js.map +1 -1
  26. package/dist/features/physics/2d-testing.d.ts +1 -1
  27. package/dist/features/physics/2d-testing.js +2 -2
  28. package/dist/features/physics/2d-testing.js.map +2 -2
  29. package/dist/features/physics/2d.d.ts +115 -62
  30. package/dist/features/physics/2d.js +59 -28
  31. package/dist/features/physics/2d.js.map +2 -2
  32. package/dist/features/physics/lib/2d/canvas/components.js +25 -21
  33. package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
  34. package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
  35. package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
  36. package/dist/features/physics/lib/2d/collision/casts.js +4 -2
  37. package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
  38. package/dist/features/physics/lib/2d/query-types.d.ts +6 -0
  39. package/dist/features/physics/lib/2d/runtime/controller.d.ts +7 -6
  40. package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
  41. package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
  42. package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
  43. package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
  44. package/dist/features/physics/lib/2d/shapes.js +8 -9
  45. package/dist/features/physics/lib/2d/shapes.js.map +2 -2
  46. package/dist/features/physics/lib/2d/types.d.ts +8 -30
  47. package/dist/features/physics/lib/2d/world/queries.d.ts +7 -6
  48. package/dist/features/physics/lib/2d/world/queries.js.map +2 -2
  49. package/dist/features/physics/lib/2d/world/rapier.js +22 -26
  50. package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
  51. package/dist/features/sprites/formats/aseprite.d.ts +5 -0
  52. package/dist/features/sprites/formats/texture-packer.d.ts +5 -0
  53. package/dist/features/sprites/index.d.ts +6 -0
  54. package/dist/features/sprites/loader.d.ts +25 -0
  55. package/dist/features/sprites/loader.js +6 -3
  56. package/dist/features/sprites/loader.js.map +2 -2
  57. package/dist/features/sprites/model.d.ts +75 -0
  58. package/dist/features/sprites/sprite.d.ts +22 -0
  59. package/dist/features/textures/index.d.ts +12 -2
  60. package/dist/features/textures/index.js +33 -1
  61. package/dist/features/textures/index.js.map +2 -2
  62. package/dist/features/textures/lib/chemical-field.d.ts +56 -0
  63. package/dist/features/textures/lib/chemical-field.js +154 -0
  64. package/dist/features/textures/lib/chemical-field.js.map +7 -0
  65. package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
  66. package/dist/features/textures/lib/chemical-recipes.js +275 -0
  67. package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
  68. package/dist/features/textures/lib/definitions.d.ts +3 -18
  69. package/dist/features/textures/lib/definitions.js +17 -24
  70. package/dist/features/textures/lib/definitions.js.map +2 -2
  71. package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
  72. package/dist/features/textures/lib/geometric-patterns.js +305 -0
  73. package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
  74. package/dist/features/textures/lib/gray-scott.d.ts +55 -0
  75. package/dist/features/textures/lib/gray-scott.js +37 -0
  76. package/dist/features/textures/lib/gray-scott.js.map +7 -0
  77. package/dist/features/textures/lib/palette.js +1 -3
  78. package/dist/features/textures/lib/palette.js.map +2 -2
  79. package/dist/features/textures/lib/patterns.d.ts +123 -0
  80. package/dist/features/textures/lib/patterns.js +344 -0
  81. package/dist/features/textures/lib/patterns.js.map +7 -0
  82. package/dist/features/textures/lib/rain-drops.js +2 -1
  83. package/dist/features/textures/lib/rain-drops.js.map +2 -2
  84. package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
  85. package/dist/features/textures/lib/reaction-diffusion.js +9 -20
  86. package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
  87. package/dist/features/textures/lib/simulation.d.ts +10 -4
  88. package/dist/features/textures/lib/simulation.js +23 -13
  89. package/dist/features/textures/lib/simulation.js.map +2 -2
  90. package/dist/features/textures/lib/wasm/electric.js +8 -1
  91. package/dist/features/textures/lib/wasm/electric.js.map +2 -2
  92. package/dist/features/textures/lib/water-surface.js +1 -3
  93. package/dist/features/textures/lib/water-surface.js.map +2 -2
  94. package/dist/features/viz/index.d.ts +92 -5
  95. package/dist/features/viz/index.js +202 -4
  96. package/dist/features/viz/index.js.map +2 -2
  97. package/dist/features/viz/inspection/bar.d.ts +79 -0
  98. package/dist/features/viz/inspection/bar.js +49 -0
  99. package/dist/features/viz/inspection/bar.js.map +7 -0
  100. package/dist/features/viz/inspection/candle.d.ts +156 -0
  101. package/dist/features/viz/inspection/candle.js +120 -0
  102. package/dist/features/viz/inspection/candle.js.map +7 -0
  103. package/dist/features/viz/inspection/capture-types.d.ts +65 -0
  104. package/dist/features/viz/inspection/capture.d.ts +16 -0
  105. package/dist/features/viz/inspection/capture.js +49 -0
  106. package/dist/features/viz/inspection/capture.js.map +7 -0
  107. package/dist/features/viz/inspection/handler.d.ts +36 -0
  108. package/dist/features/viz/inspection/handler.js +91 -0
  109. package/dist/features/viz/inspection/handler.js.map +7 -0
  110. package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
  111. package/dist/features/viz/inspection/ohlc-bar.js +118 -0
  112. package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
  113. package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
  114. package/dist/features/viz/inspection/owned-ref.js +99 -0
  115. package/dist/features/viz/inspection/owned-ref.js.map +7 -0
  116. package/dist/features/viz/inspection/painted-point.d.ts +22 -0
  117. package/dist/features/viz/inspection/painted-point.js +29 -0
  118. package/dist/features/viz/inspection/painted-point.js.map +7 -0
  119. package/dist/features/viz/inspection/queries.d.ts +100 -0
  120. package/dist/features/viz/inspection/queries.js +192 -0
  121. package/dist/features/viz/inspection/queries.js.map +7 -0
  122. package/dist/features/viz/inspection/query-types.d.ts +177 -0
  123. package/dist/features/viz/inspection/volume.d.ts +104 -0
  124. package/dist/features/viz/inspection/volume.js +95 -0
  125. package/dist/features/viz/inspection/volume.js.map +7 -0
  126. package/dist/features/viz/inspection.d.ts +19 -0
  127. package/dist/features/viz/inspection.js +54 -0
  128. package/dist/features/viz/inspection.js.map +7 -0
  129. package/dist/features/viz/inspection.mjs +1 -0
  130. package/dist/features/viz/lib/area-series.d.ts +62 -0
  131. package/dist/features/viz/lib/area-series.js +120 -0
  132. package/dist/features/viz/lib/area-series.js.map +7 -0
  133. package/dist/features/viz/lib/axis-labels.d.ts +2 -0
  134. package/dist/features/viz/lib/axis-labels.js +41 -0
  135. package/dist/features/viz/lib/axis-labels.js.map +7 -0
  136. package/dist/features/viz/lib/axis-title.d.ts +23 -0
  137. package/dist/features/viz/lib/axis-title.js +24 -0
  138. package/dist/features/viz/lib/axis-title.js.map +7 -0
  139. package/dist/features/viz/lib/axis.d.ts +1 -1
  140. package/dist/features/viz/lib/axis.js +50 -50
  141. package/dist/features/viz/lib/axis.js.map +2 -2
  142. package/dist/features/viz/lib/bar-scale.d.ts +7 -0
  143. package/dist/features/viz/lib/bar-scale.js +34 -0
  144. package/dist/features/viz/lib/bar-scale.js.map +7 -0
  145. package/dist/features/viz/lib/bar-series.d.ts +3 -1
  146. package/dist/features/viz/lib/bar-series.js +21 -5
  147. package/dist/features/viz/lib/bar-series.js.map +2 -2
  148. package/dist/features/viz/lib/baseline-series.d.ts +55 -0
  149. package/dist/features/viz/lib/baseline-series.js +136 -0
  150. package/dist/features/viz/lib/baseline-series.js.map +7 -0
  151. package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
  152. package/dist/features/viz/lib/candlestick-series.js +150 -0
  153. package/dist/features/viz/lib/candlestick-series.js.map +7 -0
  154. package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
  155. package/dist/features/viz/lib/censored-point-series.js +129 -0
  156. package/dist/features/viz/lib/censored-point-series.js.map +7 -0
  157. package/dist/features/viz/lib/chart-lines.d.ts +41 -0
  158. package/dist/features/viz/lib/chart-lines.js +32 -0
  159. package/dist/features/viz/lib/chart-lines.js.map +7 -0
  160. package/dist/features/viz/lib/color-context.d.ts +4 -0
  161. package/dist/features/viz/lib/color-context.js +41 -0
  162. package/dist/features/viz/lib/color-context.js.map +7 -0
  163. package/dist/features/viz/lib/color-math.d.ts +4 -0
  164. package/dist/features/viz/lib/color-math.js +31 -0
  165. package/dist/features/viz/lib/color-math.js.map +7 -0
  166. package/dist/features/viz/lib/color-types.d.ts +53 -0
  167. package/dist/features/viz/lib/curve-definition.d.ts +49 -0
  168. package/dist/features/viz/lib/curve-definition.js +142 -0
  169. package/dist/features/viz/lib/curve-definition.js.map +7 -0
  170. package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
  171. package/dist/features/viz/lib/diverging-color-scale.js +51 -0
  172. package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
  173. package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
  174. package/dist/features/viz/lib/domain-navigation.js +77 -0
  175. package/dist/features/viz/lib/domain-navigation.js.map +7 -0
  176. package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
  177. package/dist/features/viz/lib/editable-chart-elements.js +733 -0
  178. package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
  179. package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
  180. package/dist/features/viz/lib/financial-aggregation.js +116 -0
  181. package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
  182. package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
  183. package/dist/features/viz/lib/financial-autoscale.js +61 -0
  184. package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
  185. package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
  186. package/dist/features/viz/lib/financial-comparison.js +98 -0
  187. package/dist/features/viz/lib/financial-comparison.js.map +7 -0
  188. package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
  189. package/dist/features/viz/lib/financial-geometry.js +67 -0
  190. package/dist/features/viz/lib/financial-geometry.js.map +7 -0
  191. package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
  192. package/dist/features/viz/lib/financial-indicators.js +135 -0
  193. package/dist/features/viz/lib/financial-indicators.js.map +7 -0
  194. package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
  195. package/dist/features/viz/lib/financial-oscillators.js +265 -0
  196. package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
  197. package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
  198. package/dist/features/viz/lib/graph/bipartite.js +250 -0
  199. package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
  200. package/dist/features/viz/lib/graph/chord.d.ts +44 -0
  201. package/dist/features/viz/lib/graph/chord.js +348 -0
  202. package/dist/features/viz/lib/graph/chord.js.map +7 -0
  203. package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
  204. package/dist/features/viz/lib/graph/dependency.js +140 -0
  205. package/dist/features/viz/lib/graph/dependency.js.map +7 -0
  206. package/dist/features/viz/lib/graph/force.d.ts +28 -0
  207. package/dist/features/viz/lib/graph/force.js +580 -0
  208. package/dist/features/viz/lib/graph/force.js.map +7 -0
  209. package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
  210. package/dist/features/viz/lib/graph/hierarchy.js +112 -0
  211. package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
  212. package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
  213. package/dist/features/viz/lib/graph/icicle.js +153 -0
  214. package/dist/features/viz/lib/graph/icicle.js.map +7 -0
  215. package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
  216. package/dist/features/viz/lib/graph/matrix.js +243 -0
  217. package/dist/features/viz/lib/graph/matrix.js.map +7 -0
  218. package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
  219. package/dist/features/viz/lib/graph/neighborhood.js +281 -0
  220. package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
  221. package/dist/features/viz/lib/graph/routes.d.ts +35 -0
  222. package/dist/features/viz/lib/graph/routes.js +101 -0
  223. package/dist/features/viz/lib/graph/routes.js.map +7 -0
  224. package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
  225. package/dist/features/viz/lib/graph/sankey.js +341 -0
  226. package/dist/features/viz/lib/graph/sankey.js.map +7 -0
  227. package/dist/features/viz/lib/graph/shared.d.ts +59 -0
  228. package/dist/features/viz/lib/graph/shared.js +301 -0
  229. package/dist/features/viz/lib/graph/shared.js.map +7 -0
  230. package/dist/features/viz/lib/graph/tree.d.ts +11 -0
  231. package/dist/features/viz/lib/graph/tree.js +232 -0
  232. package/dist/features/viz/lib/graph/tree.js.map +7 -0
  233. package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
  234. package/dist/features/viz/lib/graph/treemap.js +227 -0
  235. package/dist/features/viz/lib/graph/treemap.js.map +7 -0
  236. package/dist/features/viz/lib/graph/types.d.ts +1097 -0
  237. package/dist/features/viz/lib/hover-card.js +8 -9
  238. package/dist/features/viz/lib/hover-card.js.map +2 -2
  239. package/dist/features/viz/lib/hover-data.d.ts +1 -1
  240. package/dist/features/viz/lib/hover-data.js +6 -3
  241. package/dist/features/viz/lib/hover-data.js.map +2 -2
  242. package/dist/features/viz/lib/hover-types.d.ts +5 -5
  243. package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
  244. package/dist/features/viz/lib/interval-band-series.js +136 -0
  245. package/dist/features/viz/lib/interval-band-series.js.map +7 -0
  246. package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
  247. package/dist/features/viz/lib/interval-diamond-series.js +122 -0
  248. package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
  249. package/dist/features/viz/lib/interval-series.d.ts +79 -0
  250. package/dist/features/viz/lib/interval-series.js +158 -0
  251. package/dist/features/viz/lib/interval-series.js.map +7 -0
  252. package/dist/features/viz/lib/layout-pie.js +9 -13
  253. package/dist/features/viz/lib/layout-pie.js.map +2 -2
  254. package/dist/features/viz/lib/line-series.d.ts +1 -1
  255. package/dist/features/viz/lib/line-series.js +47 -28
  256. package/dist/features/viz/lib/line-series.js.map +2 -2
  257. package/dist/features/viz/lib/linear-scale-component.d.ts +7 -0
  258. package/dist/features/viz/lib/linear-scale-component.js +18 -0
  259. package/dist/features/viz/lib/linear-scale-component.js.map +7 -0
  260. package/dist/features/viz/lib/linear-scale.js +1 -1
  261. package/dist/features/viz/lib/linear-scale.js.map +2 -2
  262. package/dist/features/viz/lib/log-scale-component.d.ts +7 -0
  263. package/dist/features/viz/lib/log-scale-component.js +19 -0
  264. package/dist/features/viz/lib/log-scale-component.js.map +7 -0
  265. package/dist/features/viz/lib/log-scale.d.ts +2 -0
  266. package/dist/features/viz/lib/log-scale.js +53 -0
  267. package/dist/features/viz/lib/log-scale.js.map +7 -0
  268. package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
  269. package/dist/features/viz/lib/monotone-curve.js +63 -0
  270. package/dist/features/viz/lib/monotone-curve.js.map +7 -0
  271. package/dist/features/viz/lib/nearest.d.ts +9 -9
  272. package/dist/features/viz/lib/nearest.js.map +1 -1
  273. package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
  274. package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
  275. package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
  276. package/dist/features/viz/lib/numeric-ticks.d.ts +38 -0
  277. package/dist/features/viz/lib/numeric-ticks.js +54 -0
  278. package/dist/features/viz/lib/numeric-ticks.js.map +7 -0
  279. package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
  280. package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
  281. package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
  282. package/dist/features/viz/lib/paired-series.d.ts +44 -0
  283. package/dist/features/viz/lib/paired-series.js +93 -0
  284. package/dist/features/viz/lib/paired-series.js.map +7 -0
  285. package/dist/features/viz/lib/pie-layout.js +2 -1
  286. package/dist/features/viz/lib/pie-layout.js.map +2 -2
  287. package/dist/features/viz/lib/plot-series.js +11 -6
  288. package/dist/features/viz/lib/plot-series.js.map +2 -2
  289. package/dist/features/viz/lib/plot-types.d.ts +4 -3
  290. package/dist/features/viz/lib/point-scale-component.d.ts +7 -0
  291. package/dist/features/viz/lib/point-scale-component.js +19 -0
  292. package/dist/features/viz/lib/point-scale-component.js.map +7 -0
  293. package/dist/features/viz/lib/point-scale.d.ts +2 -0
  294. package/dist/features/viz/lib/point-scale.js +45 -0
  295. package/dist/features/viz/lib/point-scale.js.map +7 -0
  296. package/dist/features/viz/lib/point-series.d.ts +1 -1
  297. package/dist/features/viz/lib/point-series.js +36 -9
  298. package/dist/features/viz/lib/point-series.js.map +2 -2
  299. package/dist/features/viz/lib/point-types.d.ts +5 -2
  300. package/dist/features/viz/lib/reference-band.d.ts +16 -0
  301. package/dist/features/viz/lib/reference-band.js +30 -0
  302. package/dist/features/viz/lib/reference-band.js.map +7 -0
  303. package/dist/features/viz/lib/scale-adjust.js +9 -4
  304. package/dist/features/viz/lib/scale-adjust.js.map +2 -2
  305. package/dist/features/viz/lib/scale-context.d.ts +5 -4
  306. package/dist/features/viz/lib/scale-context.js +15 -11
  307. package/dist/features/viz/lib/scale-context.js.map +2 -2
  308. package/dist/features/viz/lib/scale-provider.d.ts +2 -0
  309. package/dist/features/viz/lib/scale-provider.js +13 -0
  310. package/dist/features/viz/lib/scale-provider.js.map +7 -0
  311. package/dist/features/viz/lib/scale-ticks.d.ts +5 -0
  312. package/dist/features/viz/lib/scale-ticks.js +64 -0
  313. package/dist/features/viz/lib/scale-ticks.js.map +7 -0
  314. package/dist/features/viz/lib/scale-view.d.ts +4 -0
  315. package/dist/features/viz/lib/scale-view.js +21 -0
  316. package/dist/features/viz/lib/scale-view.js.map +7 -0
  317. package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
  318. package/dist/features/viz/lib/sequential-color-scale.js +49 -0
  319. package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
  320. package/dist/features/viz/lib/series-position.d.ts +12 -0
  321. package/dist/features/viz/lib/series-position.js +44 -0
  322. package/dist/features/viz/lib/series-position.js.map +7 -0
  323. package/dist/features/viz/lib/step-curves.d.ts +19 -0
  324. package/dist/features/viz/lib/step-curves.js +53 -0
  325. package/dist/features/viz/lib/step-curves.js.map +7 -0
  326. package/dist/features/viz/lib/symlog-scale-component.d.ts +7 -0
  327. package/dist/features/viz/lib/symlog-scale-component.js +19 -0
  328. package/dist/features/viz/lib/symlog-scale-component.js.map +7 -0
  329. package/dist/features/viz/lib/symlog-scale.d.ts +2 -0
  330. package/dist/features/viz/lib/symlog-scale.js +38 -0
  331. package/dist/features/viz/lib/symlog-scale.js.map +7 -0
  332. package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
  333. package/dist/features/viz/lib/threshold-color-scale.js +59 -0
  334. package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
  335. package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
  336. package/dist/features/viz/lib/trading-time-mapping.js +89 -0
  337. package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
  338. package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
  339. package/dist/features/viz/lib/trading-time-scale.js +96 -0
  340. package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
  341. package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
  342. package/dist/features/viz/lib/trajectory-series.js +111 -0
  343. package/dist/features/viz/lib/trajectory-series.js.map +7 -0
  344. package/dist/features/viz/lib/types.d.ts +114 -21
  345. package/dist/features/viz/lib/use-bar-scale.d.ts +8 -0
  346. package/dist/features/viz/lib/use-bar-scale.js +9 -0
  347. package/dist/features/viz/lib/use-bar-scale.js.map +7 -0
  348. package/dist/features/viz/lib/use-continuous-scale.d.ts +8 -0
  349. package/dist/features/viz/lib/use-continuous-scale.js +14 -0
  350. package/dist/features/viz/lib/use-continuous-scale.js.map +7 -0
  351. package/dist/features/viz/lib/use-linear-scale.d.ts +8 -0
  352. package/dist/features/viz/lib/use-linear-scale.js +9 -0
  353. package/dist/features/viz/lib/use-linear-scale.js.map +7 -0
  354. package/dist/features/viz/lib/use-log-scale.d.ts +8 -0
  355. package/dist/features/viz/lib/use-log-scale.js +9 -0
  356. package/dist/features/viz/lib/use-log-scale.js.map +7 -0
  357. package/dist/features/viz/lib/use-point-scale.d.ts +8 -0
  358. package/dist/features/viz/lib/use-point-scale.js +9 -0
  359. package/dist/features/viz/lib/use-point-scale.js.map +7 -0
  360. package/dist/features/viz/lib/use-symlog-scale.d.ts +8 -0
  361. package/dist/features/viz/lib/use-symlog-scale.js +9 -0
  362. package/dist/features/viz/lib/use-symlog-scale.js.map +7 -0
  363. package/dist/features/viz/lib/use-utc-scale.d.ts +8 -0
  364. package/dist/features/viz/lib/use-utc-scale.js +9 -0
  365. package/dist/features/viz/lib/use-utc-scale.js.map +7 -0
  366. package/dist/features/viz/lib/utc-labels.d.ts +12 -0
  367. package/dist/features/viz/lib/utc-labels.js +27 -0
  368. package/dist/features/viz/lib/utc-labels.js.map +7 -0
  369. package/dist/features/viz/lib/utc-scale-component.d.ts +7 -0
  370. package/dist/features/viz/lib/utc-scale-component.js +18 -0
  371. package/dist/features/viz/lib/utc-scale-component.js.map +7 -0
  372. package/dist/features/viz/lib/utc-scale.d.ts +21 -0
  373. package/dist/features/viz/lib/utc-scale.js +124 -0
  374. package/dist/features/viz/lib/utc-scale.js.map +7 -0
  375. package/dist/features/viz/lib/volume-series.d.ts +59 -0
  376. package/dist/features/viz/lib/volume-series.js +117 -0
  377. package/dist/features/viz/lib/volume-series.js.map +7 -0
  378. package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
  379. package/dist/features/viz/lib/weighted-point-series.js +169 -0
  380. package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
  381. package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
  382. package/dist/filters/backdrop-contrast-gpu.js +33 -0
  383. package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
  384. package/dist/filters/backdrop-contrast.d.ts +21 -0
  385. package/dist/filters/backdrop-contrast.js +61 -0
  386. package/dist/filters/backdrop-contrast.js.map +7 -0
  387. package/dist/filters/displacement.js +1 -1
  388. package/dist/filters/displacement.js.map +2 -2
  389. package/dist/filters/emboss-gpu.d.ts +4 -0
  390. package/dist/filters/emboss-gpu.js +39 -0
  391. package/dist/filters/emboss-gpu.js.map +7 -0
  392. package/dist/filters/emboss.d.ts +32 -0
  393. package/dist/filters/emboss.js +104 -0
  394. package/dist/filters/emboss.js.map +7 -0
  395. package/dist/filters/filter-executor.d.ts +11 -4
  396. package/dist/filters/filter-executor.js +104 -49
  397. package/dist/filters/filter-executor.js.map +2 -2
  398. package/dist/filters/reflected-light.js +1 -1
  399. package/dist/filters/reflected-light.js.map +2 -2
  400. package/dist/filters/reflection-gpu.d.ts +3 -1
  401. package/dist/filters/reflection-gpu.js +5 -2
  402. package/dist/filters/reflection-gpu.js.map +2 -2
  403. package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
  404. package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
  405. package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
  406. package/dist/filters/render-emboss-boundary.d.ts +13 -0
  407. package/dist/filters/render-emboss-boundary.js +131 -0
  408. package/dist/filters/render-emboss-boundary.js.map +7 -0
  409. package/dist/filters.d.ts +9 -5
  410. package/dist/filters.js +4 -0
  411. package/dist/filters.js.map +2 -2
  412. package/dist/index.d.ts +10 -6
  413. package/dist/index.js +18 -2
  414. package/dist/index.js.map +2 -2
  415. package/dist/internal.d.ts +4 -0
  416. package/dist/internal.js +6 -0
  417. package/dist/internal.js.map +2 -2
  418. package/dist/layout-kernel.d.ts +12 -0
  419. package/dist/layout-kernel.js +11 -0
  420. package/dist/layout-kernel.js.map +7 -0
  421. package/dist/layout-kernel.mjs +1 -0
  422. package/dist/lib/animation/definition.d.ts +5 -3
  423. package/dist/lib/animation/definition.js +29 -4
  424. package/dist/lib/animation/definition.js.map +2 -2
  425. package/dist/lib/animation/playback.d.ts +8 -0
  426. package/dist/lib/animation/playback.js +33 -11
  427. package/dist/lib/animation/playback.js.map +2 -2
  428. package/dist/lib/animation/spring.d.ts +3 -1
  429. package/dist/lib/animation/spring.js.map +2 -2
  430. package/dist/lib/animation/types.d.ts +29 -73
  431. package/dist/lib/backend/types.d.ts +13 -1
  432. package/dist/lib/backend/types.js.map +2 -2
  433. package/dist/lib/components/arc-geometry.js +2 -1
  434. package/dist/lib/components/arc-geometry.js.map +2 -2
  435. package/dist/lib/components/g.js +2 -0
  436. package/dist/lib/components/g.js.map +2 -2
  437. package/dist/lib/components/html-box.js +2 -1
  438. package/dist/lib/components/html-box.js.map +2 -2
  439. package/dist/lib/components/img.js +3 -3
  440. package/dist/lib/components/img.js.map +2 -2
  441. package/dist/lib/components/layer.js +98 -16
  442. package/dist/lib/components/layer.js.map +3 -3
  443. package/dist/lib/components/text.d.ts +16 -0
  444. package/dist/lib/components/text.js +131 -24
  445. package/dist/lib/components/text.js.map +2 -2
  446. package/dist/lib/define-primitive.d.ts +4 -2
  447. package/dist/lib/define-primitive.js +3 -1
  448. package/dist/lib/define-primitive.js.map +2 -2
  449. package/dist/lib/element/metadata.d.ts +9 -0
  450. package/dist/lib/element/metadata.js +19 -0
  451. package/dist/lib/element/metadata.js.map +2 -2
  452. package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
  453. package/dist/lib/element/resolve-primitive-inputs.js +17 -4
  454. package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
  455. package/dist/lib/events/event-facade.d.ts +18 -0
  456. package/dist/lib/events/event-facade.js +28 -2
  457. package/dist/lib/events/event-facade.js.map +2 -2
  458. package/dist/lib/events/hit-test.js +2 -1
  459. package/dist/lib/events/hit-test.js.map +2 -2
  460. package/dist/lib/events/propagation.d.ts +2 -1
  461. package/dist/lib/events/propagation.js +22 -16
  462. package/dist/lib/events/propagation.js.map +2 -2
  463. package/dist/lib/events/registrations.d.ts +10 -0
  464. package/dist/lib/events/registrations.js +160 -5
  465. package/dist/lib/events/registrations.js.map +2 -2
  466. package/dist/lib/execute-render.js +25 -1
  467. package/dist/lib/execute-render.js.map +2 -2
  468. package/dist/lib/filter/filter-region.js +3 -10
  469. package/dist/lib/filter/filter-region.js.map +2 -2
  470. package/dist/lib/focus/focus-manager.d.ts +8 -1
  471. package/dist/lib/focus/focus-manager.js +87 -43
  472. package/dist/lib/focus/focus-manager.js.map +2 -2
  473. package/dist/lib/focus/geometry.d.ts +2 -0
  474. package/dist/lib/focus/geometry.js +6 -0
  475. package/dist/lib/focus/geometry.js.map +2 -2
  476. package/dist/lib/geometry/path-bend-guide.js +1 -1
  477. package/dist/lib/geometry/path-bend-guide.js.map +2 -2
  478. package/dist/lib/geometry/path-geometry.js +12 -11
  479. package/dist/lib/geometry/path-geometry.js.map +2 -2
  480. package/dist/lib/geometry/path-transforms.js +17 -21
  481. package/dist/lib/geometry/path-transforms.js.map +2 -2
  482. package/dist/lib/geometry/path-warp-bezier.js +3 -1
  483. package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
  484. package/dist/lib/geometry/path-warp.js +1 -1
  485. package/dist/lib/geometry/path-warp.js.map +2 -2
  486. package/dist/lib/global-state.js +2 -0
  487. package/dist/lib/global-state.js.map +2 -2
  488. package/dist/lib/hooks/use-animated-value.d.ts +11 -21
  489. package/dist/lib/hooks/use-animated-value.js +23 -70
  490. package/dist/lib/hooks/use-animated-value.js.map +3 -3
  491. package/dist/lib/hooks/use-playback.js +1 -0
  492. package/dist/lib/hooks/use-playback.js.map +2 -2
  493. package/dist/lib/html/html-events.d.ts +32 -0
  494. package/dist/lib/html/html-events.js +179 -0
  495. package/dist/lib/html/html-events.js.map +7 -0
  496. package/dist/lib/html/html-service.d.ts +8 -2
  497. package/dist/lib/html/html-service.js +198 -65
  498. package/dist/lib/html/html-service.js.map +2 -2
  499. package/dist/lib/html/overlay-config.js +7 -6
  500. package/dist/lib/html/overlay-config.js.map +2 -2
  501. package/dist/lib/html/types.d.ts +29 -2
  502. package/dist/lib/layout/absolute.d.ts +11 -5
  503. package/dist/lib/layout/absolute.js +329 -55
  504. package/dist/lib/layout/absolute.js.map +3 -3
  505. package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
  506. package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
  507. package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
  508. package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
  509. package/dist/lib/layout/allocation-checkpoint.js +463 -0
  510. package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
  511. package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
  512. package/dist/lib/layout/allocation-dependencies.js +90 -0
  513. package/dist/lib/layout/allocation-dependencies.js.map +7 -0
  514. package/dist/lib/layout/allocation-revision.d.ts +13 -0
  515. package/dist/lib/layout/allocation-revision.js +67 -0
  516. package/dist/lib/layout/allocation-revision.js.map +7 -0
  517. package/dist/lib/layout/box-insets.d.ts +17 -0
  518. package/dist/lib/layout/box-insets.js +138 -0
  519. package/dist/lib/layout/box-insets.js.map +7 -0
  520. package/dist/lib/layout/box-sizing.d.ts +16 -0
  521. package/dist/lib/layout/box-sizing.js +77 -0
  522. package/dist/lib/layout/box-sizing.js.map +7 -0
  523. package/dist/lib/layout/box.js +42 -12
  524. package/dist/lib/layout/box.js.map +2 -2
  525. package/dist/lib/layout/canvas-measurement.d.ts +13 -0
  526. package/dist/lib/layout/canvas-measurement.js +57 -0
  527. package/dist/lib/layout/canvas-measurement.js.map +7 -0
  528. package/dist/lib/layout/context.d.ts +35 -6
  529. package/dist/lib/layout/context.js +72 -3
  530. package/dist/lib/layout/context.js.map +2 -2
  531. package/dist/lib/layout/define-layout-component.d.ts +23 -0
  532. package/dist/lib/layout/define-layout-component.js +84 -0
  533. package/dist/lib/layout/define-layout-component.js.map +7 -0
  534. package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
  535. package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
  536. package/dist/lib/layout/flex-baseline-mode.js +7 -0
  537. package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
  538. package/dist/lib/layout/flex.d.ts +50 -15
  539. package/dist/lib/layout/flex.js +2124 -195
  540. package/dist/lib/layout/flex.js.map +3 -3
  541. package/dist/lib/layout/flow.js +225 -49
  542. package/dist/lib/layout/flow.js.map +2 -2
  543. package/dist/lib/layout/geometry-publication.d.ts +53 -0
  544. package/dist/lib/layout/geometry-publication.js +244 -0
  545. package/dist/lib/layout/geometry-publication.js.map +7 -0
  546. package/dist/lib/layout/grid-kernel.d.ts +63 -0
  547. package/dist/lib/layout/grid-kernel.js +168 -0
  548. package/dist/lib/layout/grid-kernel.js.map +7 -0
  549. package/dist/lib/layout/grid.d.ts +63 -4
  550. package/dist/lib/layout/grid.js +767 -171
  551. package/dist/lib/layout/grid.js.map +3 -3
  552. package/dist/lib/layout/measure.d.ts +55 -3
  553. package/dist/lib/layout/measure.js +448 -15
  554. package/dist/lib/layout/measure.js.map +2 -2
  555. package/dist/lib/layout/overlay.js +81 -23
  556. package/dist/lib/layout/overlay.js.map +2 -2
  557. package/dist/lib/layout/participation.d.ts +27 -0
  558. package/dist/lib/layout/participation.js +188 -0
  559. package/dist/lib/layout/participation.js.map +7 -0
  560. package/dist/lib/layout/place-child.js +1 -1
  561. package/dist/lib/layout/place-child.js.map +2 -2
  562. package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
  563. package/dist/lib/layout/positioning-diagnostics.js +13 -2
  564. package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
  565. package/dist/lib/layout/prepared-root.d.ts +121 -0
  566. package/dist/lib/layout/prepared-root.js +360 -0
  567. package/dist/lib/layout/prepared-root.js.map +7 -0
  568. package/dist/lib/layout/standalone-kernel.d.ts +60 -0
  569. package/dist/lib/layout/standalone-kernel.js +722 -0
  570. package/dist/lib/layout/standalone-kernel.js.map +7 -0
  571. package/dist/lib/layout/topology.d.ts +21 -0
  572. package/dist/lib/layout/topology.js +113 -0
  573. package/dist/lib/layout/topology.js.map +7 -0
  574. package/dist/lib/layout/types.d.ts +5 -0
  575. package/dist/lib/layout/wasm/artifact.d.ts +1 -0
  576. package/dist/lib/layout/wasm/artifact.js +5 -0
  577. package/dist/lib/layout/wasm/artifact.js.map +7 -0
  578. package/dist/lib/layout/wasm/bytes.d.ts +1 -0
  579. package/dist/lib/layout/wasm/bytes.js +5 -0
  580. package/dist/lib/layout/wasm/bytes.js.map +7 -0
  581. package/dist/lib/layout/wasm/embedded.d.ts +2 -0
  582. package/dist/lib/layout/wasm/embedded.js +12 -0
  583. package/dist/lib/layout/wasm/embedded.js.map +7 -0
  584. package/dist/lib/layout/wasm/layout.wasm +0 -0
  585. package/dist/lib/layout/wasm/module.d.ts +8 -0
  586. package/dist/lib/layout/wasm/module.js +70 -0
  587. package/dist/lib/layout/wasm/module.js.map +7 -0
  588. package/dist/lib/layout/wasm/region.d.ts +267 -0
  589. package/dist/lib/layout/wasm/region.js +1018 -0
  590. package/dist/lib/layout/wasm/region.js.map +7 -0
  591. package/dist/lib/manipulation/controller.js +4 -7
  592. package/dist/lib/manipulation/controller.js.map +2 -2
  593. package/dist/lib/manipulation/frame.js +1 -1
  594. package/dist/lib/manipulation/frame.js.map +2 -2
  595. package/dist/lib/manipulation/handles.js +32 -33
  596. package/dist/lib/manipulation/handles.js.map +2 -2
  597. package/dist/lib/manipulation/solve.js +12 -10
  598. package/dist/lib/manipulation/solve.js.map +2 -2
  599. package/dist/lib/mount-pibbl.js +1 -0
  600. package/dist/lib/mount-pibbl.js.map +2 -2
  601. package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
  602. package/dist/lib/mount-prepared-pibbl.js +29 -0
  603. package/dist/lib/mount-prepared-pibbl.js.map +7 -0
  604. package/dist/lib/mount-request.d.ts +8 -0
  605. package/dist/lib/mount-request.js +41 -0
  606. package/dist/lib/mount-request.js.map +7 -0
  607. package/dist/lib/pibbl.d.ts +21 -13
  608. package/dist/lib/pibbl.js +18 -16
  609. package/dist/lib/pibbl.js.map +2 -2
  610. package/dist/lib/recording/recording.d.ts +43 -0
  611. package/dist/lib/recording/recording.js +555 -0
  612. package/dist/lib/recording/recording.js.map +7 -0
  613. package/dist/lib/recording/types.d.ts +118 -0
  614. package/dist/lib/recording/wasm-bytes.d.ts +1 -0
  615. package/dist/lib/recording/wasm-bytes.js +5 -0
  616. package/dist/lib/recording/wasm-bytes.js.map +7 -0
  617. package/dist/lib/recording/worker-source.d.ts +1 -0
  618. package/dist/lib/recording/worker-source.js +5 -0
  619. package/dist/lib/recording/worker-source.js.map +7 -0
  620. package/dist/lib/render-layer/controller.d.ts +9 -3
  621. package/dist/lib/render-layer/controller.js +259 -110
  622. package/dist/lib/render-layer/controller.js.map +2 -2
  623. package/dist/lib/render-transaction.d.ts +12 -2
  624. package/dist/lib/render-transaction.js +69 -1
  625. package/dist/lib/render-transaction.js.map +2 -2
  626. package/dist/lib/render.js +32 -8
  627. package/dist/lib/render.js.map +2 -2
  628. package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
  629. package/dist/lib/scheduler/realm-scheduler.js +55 -26
  630. package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
  631. package/dist/lib/scheduler/renderer-participant.js +1 -0
  632. package/dist/lib/scheduler/renderer-participant.js.map +2 -2
  633. package/dist/lib/series-inspection-frame.d.ts +18 -0
  634. package/dist/lib/series-inspection-frame.js +70 -0
  635. package/dist/lib/series-inspection-frame.js.map +7 -0
  636. package/dist/lib/signals/edge.d.ts +7 -4
  637. package/dist/lib/signals/edge.js +25 -3
  638. package/dist/lib/signals/edge.js.map +2 -2
  639. package/dist/lib/signals/graph.d.ts +16 -2
  640. package/dist/lib/signals/graph.js +54 -12
  641. package/dist/lib/signals/graph.js.map +2 -2
  642. package/dist/lib/signals/input-provision.d.ts +15 -0
  643. package/dist/lib/signals/input-provision.js +53 -3
  644. package/dist/lib/signals/input-provision.js.map +2 -2
  645. package/dist/lib/signals/render-consumer.d.ts +3 -0
  646. package/dist/lib/signals/render-consumer.js +22 -14
  647. package/dist/lib/signals/render-consumer.js.map +2 -2
  648. package/dist/lib/style/positioning.d.ts +50 -2
  649. package/dist/lib/style/positioning.js +28 -4
  650. package/dist/lib/style/positioning.js.map +2 -2
  651. package/dist/lib/style/resolve-built-in.d.ts +4 -3
  652. package/dist/lib/style/resolve-built-in.js +17 -3
  653. package/dist/lib/style/resolve-built-in.js.map +2 -2
  654. package/dist/lib/style/resolve-dispatch.d.ts +3 -0
  655. package/dist/lib/style/resolve-dispatch.js +77 -4
  656. package/dist/lib/style/resolve-dispatch.js.map +2 -2
  657. package/dist/lib/style/resolve-length.d.ts +2 -0
  658. package/dist/lib/style/resolve-length.js +13 -9
  659. package/dist/lib/style/resolve-length.js.map +2 -2
  660. package/dist/lib/style/sizing-length.d.ts +51 -0
  661. package/dist/lib/style/sizing-length.js +77 -0
  662. package/dist/lib/style/sizing-length.js.map +7 -0
  663. package/dist/lib/style/types.d.ts +63 -25
  664. package/dist/lib/surface/root-surface.js +10 -6
  665. package/dist/lib/surface/root-surface.js.map +2 -2
  666. package/dist/lib/textures/texture.js +10 -8
  667. package/dist/lib/textures/texture.js.map +2 -2
  668. package/dist/lib/transitions/capture.js +4 -1
  669. package/dist/lib/transitions/capture.js.map +2 -2
  670. package/dist/lib/transitions/embers-physics.js +17 -10
  671. package/dist/lib/transitions/embers-physics.js.map +2 -2
  672. package/dist/lib/types.d.ts +110 -1
  673. package/dist/sync.d.ts +16 -0
  674. package/dist/sync.js +13 -0
  675. package/dist/sync.js.map +7 -0
  676. package/dist/sync.mjs +1 -0
  677. package/package.json +43 -6
  678. package/dist/features/viz/lib/scale.d.ts +0 -11
  679. package/dist/features/viz/lib/scale.js +0 -80
  680. package/dist/features/viz/lib/scale.js.map +0 -7
  681. package/dist/features/viz/lib/use-scale.d.ts +0 -20
  682. package/dist/features/viz/lib/use-scale.js +0 -10
  683. package/dist/features/viz/lib/use-scale.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/features/viz/lib/axis.tsx"],
4
- "sourcesContent": ["import { Path, Text, resolveSignalValue } from \"@pibbl/core\";\nimport type { AxisProps, BandCategory, ResolvedScale } from \"./types.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { width, opacity } from \"./paint.js\";\n\ntype Tick = number | string;\n\nfunction ticks(scale: ResolvedScale, props: AxisProps): readonly Tick[] {\n if (props.tickValues !== undefined && props.tickCount !== undefined)\n throw new TypeError(\"Axis tickValues and tickCount are mutually exclusive.\");\n const explicit = props.tickValues === undefined\n ? undefined\n : resolveSignalValue(props.tickValues);\n if (explicit !== undefined) {\n if (!Array.isArray(explicit) || explicit.length > 100)\n throw new RangeError(\"Axis tickValues must be an array with at most 100 values.\");\n const seen = new Set<Tick>();\n for (const value of explicit) {\n if (seen.has(value)) throw new RangeError(\"Axis tickValues must not contain duplicates.\");\n seen.add(value);\n if (scale.type === \"linear\") {\n if (typeof value !== \"number\" || !Number.isFinite(value))\n throw new TypeError(\"Axis tickValues for a linear scale must be finite numbers.\");\n const [a, b] = scale.domain;\n if (value < Math.min(a, b) || value > Math.max(a, b))\n throw new RangeError(\"Axis tickValues must be within the scale domain.\");\n } else if (\n (typeof value !== \"string\" &&\n (typeof value !== \"number\" || !Number.isFinite(value))) ||\n scale.map(value as BandCategory) === undefined\n ) {\n throw new RangeError(\"Axis tickValues must be known band categories.\");\n }\n }\n return explicit;\n }\n const count = resolveSignalValue(props.tickCount ?? 5);\n if (!Number.isInteger(count) || count < 0 || count > 100)\n throw new RangeError(\"Axis tickCount must be an integer from 0 to 100.\");\n if (count === 0) return [];\n if (scale.type === \"linear\")\n return count === 1 ? [scale.domain[0]] : scale.ticks(count);\n const n = scale.domain.length;\n if (n === 0) return [];\n if (count === 1) return [scale.domain[0]];\n const m = Math.min(count, n);\n if (m === 1) return [scale.domain[0]];\n return Array.from(\n { length: m },\n (_, index) => scale.domain[Math.round((index * (n - 1)) / (m - 1))]!,\n );\n}\n\nfunction position(scale: ResolvedScale, value: Tick): number {\n return scale.type === \"band\"\n ? scale.map(value as BandCategory)! + scale.bandwidth / 2\n : scale.map(value as number);\n}\n\n/**\n * Draws ticks and labels using a named scale and the configured orientation and style.\n *\n * @param props - Scale, orientation, tick, label, and styling options. See {@link AxisProps}.\n * @returns Pibbl nodes drawing the axis.\n *\n * @see {@link AxisProps}\n */\nexport function Axis(props: AxisProps) {\n if (\n props.position !== \"bottom\" &&\n props.position !== \"left\" &&\n props.position !== \"top\" &&\n props.position !== \"right\"\n )\n throw new TypeError(\"Axis position must be bottom, left, top, or right.\");\n const source = lookupScale(props.scale, \"Axis\");\n if (!source) throw new TypeError(\"Axis requires a scale ID.\");\n const scale = source.get();\n const style = resolveSignalValue(props.style) ?? {};\n const stroke = resolveSignalValue(style.stroke) ?? \"#64748b\";\n const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 1, \"Axis\");\n const fill = resolveSignalValue(style.fill) ?? \"#64748b\";\n const font = resolveSignalValue(style.font) ?? \"12px sans-serif\";\n const alpha = opacity(resolveSignalValue(style.opacity) ?? 1, \"Axis\");\n const horizontal = props.position === \"bottom\" || props.position === \"top\";\n const outward = props.position === \"bottom\" || props.position === \"right\" ? 1 : -1;\n const baseline = horizontal\n ? props.position === \"bottom\" ? scale.frame.height : 0\n : props.position === \"right\" ? scale.frame.width : 0;\n const selected = ticks(scale, props);\n const path = new Path2D();\n if (horizontal) {\n path.moveTo(scale.range[0], baseline);\n path.lineTo(scale.range[1], baseline);\n } else {\n path.moveTo(baseline, scale.range[0]);\n path.lineTo(baseline, scale.range[1]);\n }\n const labels = selected.map((value, index) => {\n const p = position(scale, value);\n if (horizontal) {\n path.moveTo(p, baseline);\n path.lineTo(p, baseline + outward * 6);\n } else {\n path.moveTo(baseline, p);\n path.lineTo(baseline + outward * 6, p);\n }\n const label = props.tickFormat\n ? props.tickFormat(value, index)\n : typeof value === \"number\"\n ? String(Number(value.toPrecision(6)))\n : value;\n if (typeof label !== \"string\")\n throw new TypeError(\"Axis tickFormat must return a string.\");\n return (\n <Text\n key={index}\n pointerEvents=\"none\"\n style={{\n left: horizontal ? p : baseline + outward * 10,\n top: horizontal ? baseline + outward * 10 : p,\n fill,\n font,\n opacity: alpha,\n textAlign: horizontal ? \"center\" : outward < 0 ? \"right\" : \"left\",\n textBaseline: horizontal ? outward > 0 ? \"top\" : \"bottom\" : \"middle\",\n }}\n >\n {label}\n </Text>\n );\n });\n return [\n <Path\n key=\"axis\"\n pointerEvents=\"none\"\n style={{ d: path, stroke, strokeWidth, opacity: alpha }}\n />,\n labels,\n ];\n}\n"],
5
- "mappings": "AAmHM;AAnHN,SAAS,MAAM,MAAM,0BAA0B;AAE/C,SAAS,mBAAmB;AAC5B,SAAS,OAAO,eAAe;AAI/B,SAAS,MAAM,OAAsB,OAAmC;AACtE,MAAI,MAAM,eAAe,UAAa,MAAM,cAAc;AACxD,UAAM,IAAI,UAAU,uDAAuD;A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{ Path, Text, resolveSignalValue, useCanvasContext } from \"@pibbl/core\";\nimport type { AxisProps } from \"./types.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { width, opacity } from \"./paint.js\";\n\nimport { fitAxisLabel } from \"./axis-labels.js\";\n\nimport { ticks, position } from \"./scale-ticks.js\";\n\n/**\n * Draws ticks and labels using a named scale and the configured orientation and style.\n *\n * @param props - Scale, orientation, tick, label, and styling options. See {@link AxisProps}.\n * @returns Pibbl nodes drawing the axis.\n *\n * @see {@link AxisProps}\n */\nexport function Axis(props: AxisProps) {\n if (\n props.position !== \"bottom\" &&\n props.position !== \"left\" &&\n props.position !== \"top\" &&\n props.position !== \"right\"\n )\n throw new TypeError(\"Axis position must be bottom, left, top, or right.\");\n const source = lookupScale(props.scale, \"Axis\");\n if (!source) throw new TypeError(\"Axis requires a scale ID.\");\n const scale = source.get();\n const style = resolveSignalValue(props.style) ?? {};\n const stroke = resolveSignalValue(style.stroke) ?? \"#64748b\";\n const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 1, \"Axis\");\n const fill = resolveSignalValue(style.fill) ?? \"#64748b\";\n const font = resolveSignalValue(style.font) ?? \"12px sans-serif\";\n const alpha = opacity(resolveSignalValue(style.opacity) ?? 1, \"Axis\");\n const horizontal = props.position === \"bottom\" || props.position === \"top\";\n const outward = props.position === \"bottom\" || props.position === \"right\" ? 1 : -1;\n const baseline = horizontal\n ? props.position === \"bottom\" ? scale.frame.height : 0\n : props.position === \"right\" ? scale.frame.width : 0;\n const selected = ticks(scale, props);\n const context = useCanvasContext();\n const overlap = resolveSignalValue(props.labelOverlap ?? \"allow\");\n const gap = resolveSignalValue(props.labelGap ?? 8);\n if (overlap !== \"allow\" && overlap !== \"skip\") throw new TypeError(\"Axis labelOverlap must be allow or skip.\");\n if (!Number.isFinite(gap) || gap < 0) throw new RangeError(\"Axis labelGap must be finite and nonnegative.\");\n const overflow = resolveSignalValue(props.labelOverflow ?? \"allow\");\n const maxWidth = props.labelMaxWidth === undefined ? undefined : resolveSignalValue(props.labelMaxWidth);\n const maxLines = resolveSignalValue(props.labelMaxLines ?? 2);\n const lineHeightInput = props.labelLineHeight === undefined ? undefined : resolveSignalValue(props.labelLineHeight);\n if (![\"allow\", \"wrap\", \"truncate\"].includes(overflow)) throw new TypeError(\"Axis labelOverflow must be allow, wrap, or truncate.\");\n if ((overflow !== \"allow\" && maxWidth === undefined) || (maxWidth !== undefined && (!Number.isFinite(maxWidth) || maxWidth <= 0))) throw new RangeError(\"Axis labelMaxWidth must be positive and finite for wrap/truncate.\");\n if (!Number.isInteger(maxLines) || maxLines < 1 || maxLines > 20) throw new RangeError(\"Axis labelMaxLines must be an integer from 1 to 20.\");\n if (lineHeightInput !== undefined && (!Number.isFinite(lineHeightInput) || lineHeightInput <= 0)) throw new RangeError(\"Axis labelLineHeight must be positive and finite.\");\n let lineHeight = 0;\n const lines: (readonly string[])[] = [];\n const occupied: { start: number; end: number }[] = [];\n const visible = new Set<number>();\n const texts = selected.map((value, index) => {\n const label = props.tickFormat ? props.tickFormat(value, index)\n : (scale.type === \"utc\" || scale.type === \"trading-time\") ? scale.formatTick(value as number)\n : typeof value === \"number\" ? String(Number(value.toPrecision(6))) : value;\n if (typeof label !== \"string\") throw new TypeError(\"Axis tickFormat must return a string.\");\n return label;\n });\n // Endpoints have priority; sort by physical position for reversed ranges too.\n const order = selected.map((value, index) => ({ index, p: position(scale, value) })).sort((a, b) => a.p - b.p);\n const priority = order.length > 1 ? [order[0], order[order.length - 1], ...order.slice(1, -1)] : order;\n context.save();\n try {\n context.font = font;\n const fontMetrics = context.measureText(\"Mg\");\n lineHeight = lineHeightInput ?? Math.ceil(fontMetrics.actualBoundingBoxAscent + fontMetrics.actualBoundingBoxDescent + 4);\n for (const text of texts) lines.push(fitAxisLabel(context, text, maxWidth ?? Infinity, overflow, maxLines));\n for (const { index, p } of priority) {\n const metrics = lines[index].map(text => context.measureText(text));\n const size = horizontal ? Math.max(...metrics.map(m => m.width)) : (lines[index].length - 1) * lineHeight + Math.max(...metrics.map(m => m.actualBoundingBoxAscent + m.actualBoundingBoxDescent));\n const interval = { start: p - size / 2, end: p + size / 2 };\n if (overlap === \"allow\" || occupied.every(other => interval.end + gap <= other.start || interval.start >= other.end + gap)) {\n visible.add(index); occupied.push(interval);\n }\n }\n } finally { context.restore(); }\n const path = new Path2D();\n if (horizontal) {\n path.moveTo(scale.range[0], baseline);\n path.lineTo(scale.range[1], baseline);\n } else {\n path.moveTo(baseline, scale.range[0]);\n path.lineTo(baseline, scale.range[1]);\n }\n const labels = selected.map((value, index) => {\n const p = position(scale, value);\n if (horizontal) {\n path.moveTo(p, baseline);\n path.lineTo(p, baseline + outward * 6);\n } else {\n path.moveTo(baseline, p);\n path.lineTo(baseline + outward * 6, p);\n }\n if (!visible.has(index)) return null;\n return lines[index].map((label, lineIndex) => (\n <Text\n key={`${index}:${lineIndex}`}\n pointerEvents=\"none\"\n style={{\n left: horizontal ? p : baseline + outward * 10,\n top: horizontal ? baseline + outward * 10 + (outward > 0 ? lineIndex : lineIndex - lines[index].length + 1) * lineHeight : p + (lineIndex - (lines[index].length - 1) / 2) * lineHeight,\n fill,\n font,\n opacity: alpha,\n textAlign: horizontal ? \"center\" : outward < 0 ? \"right\" : \"left\",\n textBaseline: horizontal ? outward > 0 ? \"top\" : \"bottom\" : \"middle\",\n }}\n >\n {label}\n </Text>\n ));\n });\n return [\n <Path\n key=\"axis\"\n pointerEvents=\"none\"\n style={{ d: path, stroke, strokeWidth, opacity: alpha }}\n />,\n labels,\n ];\n}\n"],
5
+ "mappings": "AAqGM;AArGN,SAAS,MAAM,MAAM,oBAAoB,wBAAwB;AAEjE,SAAS,mBAAmB;AAC5B,SAAS,OAAO,eAAe;AAE/B,SAAS,oBAAoB;AAE7B,SAAS,OAAO,gBAAgB;AAUzB,SAAS,KAAK,OAAkB;AACrC,MACE,MAAM,aAAa,YACnB,MAAM,aAAa,UACnB,MAAM,aAAa,SACnB,MAAM,aAAa;AAEnB,UAAM,I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,WAAW,UAAU,GAAG,CAAC;AAAA,IACvC;AACA,QAAI,CAAC,QAAQ,IAAI,KAAK,EAAG,QAAO;AAChC,WAAO,MAAM,KAAK,EAAE,IAAI,CAAC,OAAO,cAC9B;AAAA,MAAC;AAAA;AAAA,QAEC,eAAc;AAAA,QACd,OAAO;AAAA,UACL,MAAM,aAAa,IAAI,WAAW,UAAU;AAAA,UAC5C,KAAK,aAAa,WAAW,UAAU,MAAM,UAAU,IAAI,YAAY,YAAY,MAAM,KAAK,EAAE,SAAS,KAAK,aAAa,KAAK,aAAa,MAAM,KAAK,EAAE,SAAS,KAAK,KAAK;AAAA,UAC7K;AAAA,UACA;AAAA,UACA,SAAS;AAAA,UACT,WAAW,aAAa,WAAW,UAAU,IAAI,UAAU;AAAA,UAC3D,cAAc,aAAa,UAAU,IAAI,QAAQ,WAAW;AAAA,QAC9D;AAAA,QAEC;AAAA;AAAA,MAZI,GAAG,KAAK,IAAI,SAAS;AAAA,IAa5B,CACD;AAAA,EACH,CAAC;AACD,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QAEC,eAAc;AAAA,QACd,OAAO,EAAE,GAAG,MAAM,QAAQ,aAAa,SAAS,MAAM;AAAA;AAAA,MAFlD;AAAA,IAGN;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,7 @@
1
+ import type { BarScaleProps } from "./types.js";
2
+ /**
3
+ * Provides categorical bands, including nested groups sized to a parent band.
4
+ * @param props - Categories, spacing, range, and children. See {@link BarScaleProps}.
5
+ * @returns Descendant content within the scale scope.
6
+ */
7
+ export declare function BarScale(props: BarScaleProps): import("@pibbl/core").PibblNode;
@@ -0,0 +1,34 @@
1
+ import { resolveSignalValue, useComputed, useLayoutBox } from "@pibbl/core";
2
+ import { resolveBandScale } from "./band-scale.js";
3
+ import { captureScaleLookup } from "./scale-context.js";
4
+ import { useScaleProvider } from "./scale-provider.js";
5
+ function BarScale(props) {
6
+ const { width, height } = useLayoutBox();
7
+ const lookup = captureScaleLookup("BarScale bandwidthOf");
8
+ function resolveParent() {
9
+ const range = resolveSignalValue(props.range);
10
+ if (typeof range !== "object" || range === null || !("bandwidthOf" in range)) return void 0;
11
+ const parent2 = lookup(range.bandwidthOf)?.get();
12
+ if (!parent2 || parent2.type !== "band") throw new TypeError("BarScale bandwidthOf requires an ancestor band scale.");
13
+ return parent2;
14
+ }
15
+ const parent = useComputed(resolveParent, [props.range, lookup]).get();
16
+ useScaleProvider(props.id, "band", () => {
17
+ const currentParent = resolveParent();
18
+ const range = currentParent ? [0, currentParent.bandwidth] : resolveSignalValue(props.range);
19
+ return resolveBandScale(
20
+ resolveSignalValue(props.domain),
21
+ range,
22
+ resolveSignalValue(props.reverse ?? false),
23
+ width,
24
+ height,
25
+ resolveSignalValue(props.paddingInner ?? 0),
26
+ resolveSignalValue(props.paddingOuter ?? 0)
27
+ );
28
+ }, [parent, props.domain, props.range, props.reverse, props.paddingInner, props.paddingOuter, width, height]);
29
+ return props.children;
30
+ }
31
+ export {
32
+ BarScale
33
+ };
34
+ //# sourceMappingURL=bar-scale.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/bar-scale.ts"],
4
+ "sourcesContent": ["import { resolveSignalValue, useComputed, useLayoutBox } from \"@pibbl/core\";\nimport type { BarScaleProps, ScaleRange } from \"./types.js\";\nimport { resolveBandScale } from \"./band-scale.js\";\nimport { captureScaleLookup } from \"./scale-context.js\";\nimport { useScaleProvider } from \"./scale-provider.js\";\n/**\n * Provides categorical bands, including nested groups sized to a parent band.\n * @param props - Categories, spacing, range, and children. See {@link BarScaleProps}.\n * @returns Descendant content within the scale scope.\n */\nexport function BarScale(props: BarScaleProps) {\n const { width, height } = useLayoutBox();\n const lookup = captureScaleLookup(\"BarScale bandwidthOf\");\n function resolveParent() {\n const range = resolveSignalValue(props.range);\n if (typeof range !== \"object\" || range === null || !(\"bandwidthOf\" in range)) return undefined;\n const parent = lookup(range.bandwidthOf)?.get();\n if (!parent || parent.type !== \"band\") throw new TypeError(\"BarScale bandwidthOf requires an ancestor band scale.\");\n return parent;\n }\n const parent = useComputed(resolveParent, [props.range, lookup]).get();\n useScaleProvider(props.id, \"band\", () => {\n const currentParent = resolveParent();\n const range: ScaleRange = currentParent ? [0, currentParent.bandwidth] : resolveSignalValue(props.range) as ScaleRange;\n return resolveBandScale(resolveSignalValue(props.domain), range,\n resolveSignalValue(props.reverse ?? false), width, height,\n resolveSignalValue(props.paddingInner ?? 0), resolveSignalValue(props.paddingOuter ?? 0));\n }, [parent, props.domain, props.range, props.reverse, props.paddingInner, props.paddingOuter, width, height]);\n return props.children;\n}\n"],
5
+ "mappings": "AAAA,SAAS,oBAAoB,aAAa,oBAAoB;AAE9D,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AAM1B,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,OAAO,OAAO,IAAI,aAAa;AACvC,QAAM,SAAS,mBAAmB,sBAAsB;AACxD,WAAS,gBAAgB;AACvB,UAAM,QAAQ,mBAAmB,MAAM,KAAK;AAC5C,QAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,iBAAiB,OAAQ,QAAO;AACrF,UAAMA,UAAS,OAAO,MAAM,WAAW,GAAG,IAAI;AAC9C,QAAI,CAACA,WAAUA,QAAO,SAAS,OAAQ,OAAM,IAAI,UAAU,uDAAuD;AAClH,WAAOA;AAAA,EACT;AACA,QAAM,SAAS,YAAY,eAAe,CAAC,MAAM,OAAO,MAAM,CAAC,EAAE,IAAI;AACrE,mBAAiB,MAAM,IAAI,QAAQ,MAAM;AACvC,UAAM,gBAAgB,cAAc;AACpC,UAAM,QAAoB,gBAAgB,CAAC,GAAG,cAAc,SAAS,IAAI,mBAAmB,MAAM,KAAK;AACvG,WAAO;AAAA,MAAiB,mBAAmB,MAAM,MAAM;AAAA,MAAG;AAAA,MACxD,mBAAmB,MAAM,WAAW,KAAK;AAAA,MAAG;AAAA,MAAO;AAAA,MACnD,mBAAmB,MAAM,gBAAgB,CAAC;AAAA,MAAG,mBAAmB,MAAM,gBAAgB,CAAC;AAAA,IAAC;AAAA,EAC5F,GAAG,CAAC,QAAQ,MAAM,QAAQ,MAAM,OAAO,MAAM,SAAS,MAAM,cAAc,MAAM,cAAc,OAAO,MAAM,CAAC;AAC5G,SAAO,MAAM;AACf;",
6
+ "names": ["parent"]
7
+ }
@@ -63,6 +63,8 @@ interface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipat
63
63
  * Application data supplied to the component or reported by the event. See {@link SignalValue}.
64
64
  */
65
65
  readonly data: SignalValue<readonly D[]>;
66
+ /** Optional committed bar capture; rendering alone performs no inspection searches. */
67
+ readonly inspection?: import("../inspection/bar.js").BarInspectionRef<D>;
66
68
  /** Selects `"vertical"`, `"horizontal"` for orientation. See {@link BarSeriesBaseProps}. */
67
69
  readonly orientation?: "vertical" | "horizontal";
68
70
  /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */
@@ -147,4 +149,4 @@ export type BarSeriesProps<D> = BarSeriesBaseProps<D> & ({
147
149
  *
148
150
  * @see {@link BarSeriesProps}
149
151
  */
150
- export declare function BarSeries<D>({ data: input, orientation, category: categoryInput, value: valueInput, valueStart, valueEnd, categoryScale, valueScale, baseline, group, groupScale, defined, style: styleInput, pointerEvents, ...events }: BarSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
152
+ export declare function BarSeries<D>({ data: input, orientation, category: categoryInput, value: valueInput, valueStart, valueEnd, categoryScale, valueScale, baseline, group, groupScale, defined, style: styleInput, pointerEvents, inspection, ...events }: BarSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -8,7 +8,8 @@ import {
8
8
  } from "@pibbl/core";
9
9
  import { withHooksForbidden } from "@pibbl/core/internal";
10
10
  import { lookupScale } from "./scale-context.js";
11
- import { useScale } from "./use-scale.js";
11
+ import { useContinuousScale } from "./use-continuous-scale.js";
12
+ import { useBarScale } from "./use-bar-scale.js";
12
13
  import { pointAccessor, pointData, finiteCoordinate } from "./point-data.js";
13
14
  import { opacity, width } from "./paint.js";
14
15
  import { barFill } from "./bar-fill.js";
@@ -27,11 +28,12 @@ function BarSeries({
27
28
  defined,
28
29
  style: styleInput,
29
30
  pointerEvents,
31
+ inspection,
30
32
  ...events
31
33
  }) {
32
- const categories = useScale(categoryScale, "band").get();
33
- const values = useScale(valueScale).get();
34
- const groups = lookupScale(groupScale, "BarSeries groupScale", "band")?.get();
34
+ const categories = useBarScale(categoryScale).get();
35
+ const values = useContinuousScale(valueScale).get();
36
+ const groups = lookupScale(groupScale, "BarSeries groupScale")?.get();
35
37
  if (group === void 0 !== (groupScale === void 0))
36
38
  throw new TypeError("BarSeries requires group and groupScale together.");
37
39
  if (groups && groups.type !== "band")
@@ -97,6 +99,7 @@ function BarSeries({
97
99
  }
98
100
  const shared = typeof specified === "function" ? void 0 : normalize(specified ?? {}, false);
99
101
  const nodes = [];
102
+ const captured = inspection ? [] : void 0;
100
103
  for (let i = 0; i < data.length; i++) {
101
104
  const datum = data[i];
102
105
  if (defined && !defined(datum, i, data)) continue;
@@ -123,6 +126,18 @@ function BarSeries({
123
126
  throw new RangeError("BarSeries value extent must be finite.");
124
127
  if (extent === 0) continue;
125
128
  const vertical = orientation === "vertical";
129
+ const markFill = fill(from, v);
130
+ captured?.push(Object.freeze({
131
+ datum,
132
+ sourceIndex: i,
133
+ category: c,
134
+ group: g ?? void 0,
135
+ valueStart: from,
136
+ valueEnd: v,
137
+ boundsLocal: Object.freeze({ x: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end), y: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2, width: vertical ? bandwidth : extent, height: vertical ? extent : bandwidth }),
138
+ fill: !!markFill,
139
+ strokeWidthLocal: stroke ? strokeWidth : 0
140
+ }));
126
141
  nodes.push(
127
142
  /* @__PURE__ */ jsx(
128
143
  Rectangle,
@@ -133,7 +148,7 @@ function BarSeries({
133
148
  top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,
134
149
  width: vertical ? bandwidth : extent,
135
150
  height: vertical ? extent : bandwidth,
136
- fill: fill(from, v),
151
+ fill: markFill,
137
152
  stroke,
138
153
  strokeWidth,
139
154
  opacity: alpha,
@@ -144,6 +159,7 @@ function BarSeries({
144
159
  )
145
160
  );
146
161
  }
162
+ if (inspection) inspection.capture(captured);
147
163
  return /* @__PURE__ */ jsx(Group, { ...events, children: nodes });
148
164
  }
149
165
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/features/viz/lib/bar-series.tsx"],
4
- "sourcesContent": ["import {\n Group,\n isSignal,\n Rectangle,\n resolveSignalValue,\n useCanvasContext,\n} from \"@pibbl/core\";\nimport type {\n PibblEventHandlers,\n PibblEventParticipationOptions,\n PibblNode,\n FillStyle,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport { lookupScale } from \"./scale-context.js\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { BandCategory, LineAccessor, ScaleId } from \"./types.js\";\nimport { useScale } from \"./use-scale.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { opacity, width } from \"./paint.js\";\n/**\n * A data property or callback that extracts a category, with nullish values treated as missing.\n *\n * @param datum - Datum whose category is being read.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns The category, or null/undefined to indicate a missing category. See\n * {@link BandCategory} .\n *\n * @see {@link BandCategory}\n * @see {@link BarSeriesProps}\n */\nexport type BarCategoryAccessor<D> =\n | {\n [K in keyof D]-?: D[K] extends BandCategory | null | undefined\n ? K\n : never;\n }[keyof D]\n | ((\n datum: D,\n index: number,\n data: readonly D[],\n ) => BandCategory | null | undefined);\nimport { barFill, type BarThresholdFill } from \"./bar-fill.js\";\nexport type { BarThresholdFill } from \"./bar-fill.js\";\n/**\n * Supported geometry and presentation properties for BarSeries.\n *\n * @see {@link FillStyle}\n * @see {@link BarThresholdFill}\n * @see {@link StrokeStyle}\n * @see {@link BarStyleResolver}\n */\nexport interface BarSeriesStyle {\n /** Width allocated to one categorical band. See {@link BarSeriesStyle}. */\n readonly bandwidth?: number | \"auto\";\n /** Paint used for the interior. See {@link FillStyle}, {@link BarThresholdFill}. */\n readonly fill?: FillStyle | BarThresholdFill;\n /** Paint used for the outline. See {@link StrokeStyle}. */\n readonly stroke?: StrokeStyle;\n /** Width of the painted outline. See {@link BarSeriesStyle}. */\n readonly strokeWidth?: number;\n /** Opacity of the painted result. See {@link BarSeriesStyle}. */\n readonly opacity?: number;\n /** Cursor shown while this target owns pointer presentation. See {@link BarSeriesStyle}. */\n readonly cursor?: string;\n}\n/**\n * Computes bar styling from the datum, index, and source data.\n *\n * @param datum - Datum being styled.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns Style for this datum's bar. See {@link BarSeriesStyle}.\n *\n * @see {@link BarSeriesStyle}\n */\nexport type BarStyleResolver<D> = (\n datum: D,\n index: number,\n data: readonly D[],\n) => BarSeriesStyle;\n/**\n * Shared data, category/value scales, orientation, filtering, and styling for bar variants.\n *\n * @see {@link BarCategoryAccessor}\n * @see {@link BarSeriesStyle}\n * @see {@link BarSeriesProps}\n */\ninterface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {\n /**\n * Application data supplied to the component or reported by the event. See {@link SignalValue}.\n */\n readonly data: SignalValue<readonly D[]>;\n /** Selects `\"vertical\"`, `\"horizontal\"` for orientation. See {@link BarSeriesBaseProps}. */\n readonly orientation?: \"vertical\" | \"horizontal\";\n /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */\n readonly category: BarCategoryAccessor<D>;\n /** Band scale used to place categories. See {@link ScaleId}. */\n readonly categoryScale: ScaleId;\n /** Numeric scale used to map bar values. See {@link ScaleId}. */\n readonly valueScale: ScaleId;\n /**\n * Selects the records that participate in the bar series. See {@link BarSeriesProps}.\n * @param datum - Record to test.\n * @param index - Zero-based index in the source array.\n * @param data - Complete source data array.\n * @returns Whether this record should contribute a bar.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /**\n * Declared presentation and layout properties. See {@link SignalValue}, {@link SignalStyle},\n * {@link BarSeriesStyle}, {@link BarStyleResolver}.\n */\n readonly style?: SignalValue<SignalStyle<BarSeriesStyle> | BarStyleResolver<D>>;\n}\n/**\n * Authored inputs for BarSeries, including the declared data and presentation options.\n *\n * @see {@link LineAccessor}\n * @see {@link SignalValue}\n * @see {@link BarCategoryAccessor}\n * @see {@link ScaleId}\n * @see {@link BarSeries}\n */\nexport type BarSeriesProps<D> = BarSeriesBaseProps<D> &\n (\n | {\n /** Value associated with this sample, input, or result. See {@link LineAccessor}. */\n readonly value: LineAccessor<D>;\n /** Numeric value from which each ordinary bar starts. See {@link SignalValue}. */\n readonly baseline?: SignalValue<number>;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueStart?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueEnd?: never;\n }\n | {\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly value?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly baseline?: never;\n /** Accessor for the beginning of a range bar. See {@link LineAccessor}. */\n readonly valueStart: LineAccessor<D>;\n /** Accessor for the end of a range bar. See {@link LineAccessor}. */\n readonly valueEnd: LineAccessor<D>;\n }\n ) &\n (\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarCategoryAccessor}. */\n readonly group: BarCategoryAccessor<D>;\n /** Band scale used to place subgroups within a category. See {@link ScaleId}. */\n readonly groupScale: ScaleId;\n }\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarSeriesProps}. */\n readonly group?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly groupScale?: never;\n }\n );\n/**\n * Value bars in source order; rectangles supply ordinary paint and event geometry.\n *\n * @param props - Data, category and value accessors, scales, grouping, and styling. See\n * {@link BarSeriesProps} .\n * @returns Pibbl nodes drawing the bars.\n *\n * @see {@link BarSeriesProps}\n */\nexport function BarSeries<D>({\n data: input,\n orientation = \"vertical\",\n category: categoryInput,\n value: valueInput,\n valueStart,\n valueEnd,\n categoryScale,\n valueScale,\n baseline,\n group,\n groupScale,\n defined,\n style: styleInput,\n pointerEvents,\n ...events\n}: BarSeriesProps<D>) {\n const categories = useScale(categoryScale, \"band\").get();\n const values = useScale(valueScale).get();\n const groups = lookupScale(groupScale, \"BarSeries groupScale\", \"band\")?.get();\n if ((group === undefined) !== (groupScale === undefined))\n throw new TypeError(\"BarSeries requires group and groupScale together.\");\n if (groups && groups.type !== \"band\")\n throw new TypeError(\"BarSeries groupScale requires a band scale.\");\n const groupValue =\n typeof group === \"function\"\n ? group\n : (datum: D) =>\n group === undefined\n ? undefined\n : (datum[group] as BandCategory | null | undefined);\n const slotWidth =\n groups?.type === \"band\" ? groups.bandwidth : categories.bandwidth;\n if (orientation !== \"vertical\" && orientation !== \"horizontal\")\n throw new TypeError(\"BarSeries orientation must be vertical or horizontal.\");\n const data = pointData(resolveSignalValue(input), \"BarSeries\");\n const category =\n typeof categoryInput === \"function\"\n ? categoryInput\n : (datum: D) =>\n datum[categoryInput] as BandCategory | null | undefined;\n const ranged = valueStart !== undefined || valueEnd !== undefined;\n if (\n ranged\n ? valueInput !== undefined ||\n baseline !== undefined ||\n valueStart === undefined ||\n valueEnd === undefined\n : valueInput === undefined\n )\n throw new TypeError(\n \"BarSeries requires either value with optional baseline, or both valueStart and valueEnd without value or baseline.\",\n );\n const value = pointAccessor((ranged ? valueEnd : valueInput)!);\n const startValue = ranged ? pointAccessor(valueStart!) : undefined;\n const baselineValue = resolveSignalValue(baseline ?? 0);\n const sharedBase = ranged ? undefined : values.map(baselineValue);\n const specified = resolveSignalValue(styleInput);\n const ctx = useCanvasContext();\n function normalize(input: unknown, callback: boolean) {\n if (!input || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"BarSeries style must be an object.\");\n if (\n callback &&\n Object.getPrototypeOf(input) !== Object.prototype &&\n Object.getPrototypeOf(input) !== null\n )\n throw new TypeError(\n \"BarSeries datum style must be a plain synchronous object.\",\n );\n const style: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (\n ![\n \"bandwidth\",\n \"fill\",\n \"stroke\",\n \"strokeWidth\",\n \"opacity\",\n \"cursor\",\n ].includes(key)\n )\n throw new TypeError(`BarSeries: unsupported style field ${key}.`);\n const value = (input as Record<string, unknown>)[key];\n if (callback && isSignal(value))\n throw new TypeError(\n \"BarSeries datum styles require plain values; read signals explicitly.\",\n );\n style[key] = callback ? value : resolveSignalValue(value);\n }\n const resolved = style as BarSeriesStyle;\n if (resolved.cursor !== undefined && typeof resolved.cursor !== \"string\")\n throw new TypeError(\"BarSeries cursor must be a string.\");\n return {\n bandwidth:\n resolved.bandwidth === undefined || resolved.bandwidth === \"auto\"\n ? slotWidth\n : width(resolved.bandwidth, \"BarSeries bandwidth\"),\n fill: barFill(ctx, resolved.fill ?? \"#2563eb\", (value) =>\n values.map(value),\n orientation,\n ),\n stroke: resolved.stroke,\n strokeWidth: width(resolved.strokeWidth ?? 1, \"BarSeries strokeWidth\"),\n alpha: opacity(resolved.opacity ?? 1, \"BarSeries\"),\n cursor: resolved.cursor,\n };\n }\n const shared =\n typeof specified === \"function\"\n ? undefined\n : normalize(specified ?? {}, false);\n const nodes: PibblNode[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const c = category(datum, i, data),\n v = value(datum, i, data),\n from = startValue ? startValue(datum, i, data) : baselineValue;\n if (c == null || !finiteCoordinate(v) || !finiteCoordinate(from)) continue;\n const categoryStart = categories.map(c);\n const g = groups ? groupValue(datum, i, data) : undefined;\n const offset = groups ? (g == null ? undefined : groups.map(g)) : 0;\n if (categoryStart === undefined || offset === undefined || slotWidth === 0)\n continue;\n const start = categoryStart + offset;\n const { bandwidth, fill, stroke, strokeWidth, alpha, cursor } =\n shared ??\n normalize(\n withHooksForbidden(\"BarSeries style callback\", () =>\n (specified as BarStyleResolver<D>)(datum, i, data),\n ),\n true,\n );\n if (bandwidth === 0) continue;\n const base = sharedBase ?? values.map(from);\n const end = values.map(v);\n const extent = Math.abs(end - base);\n if (!Number.isFinite(extent))\n throw new RangeError(\"BarSeries value extent must be finite.\");\n if (extent === 0) continue;\n const vertical = orientation === \"vertical\";\n nodes.push(\n <Rectangle\n key={i}\n pointerEvents={pointerEvents}\n style={{\n left: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end),\n top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,\n width: vertical ? bandwidth : extent,\n height: vertical ? extent : bandwidth,\n fill: fill(from, v),\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor,\n }}\n />,\n );\n }\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
- "mappings": "AA2UM;AA3UN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAG5B,SAAS,gBAAgB;AACzB,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,SAAS,aAAa;AAwB/B,SAAS,eAAsC;AA+IxC,SAAS,UAAa;AAAA,EAC3B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,aAAa,SAAS,eAAe,MAAM,EAAE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Rectangle,\n resolveSignalValue,\n useCanvasContext,\n} from \"@pibbl/core\";\nimport type {\n PibblEventHandlers,\n PibblEventParticipationOptions,\n PibblNode,\n FillStyle,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport { lookupScale } from \"./scale-context.js\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { BandCategory, LineAccessor, ScaleId } from \"./types.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\nimport { useBarScale } from \"./use-bar-scale.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { opacity, width } from \"./paint.js\";\n/**\n * A data property or callback that extracts a category, with nullish values treated as missing.\n *\n * @param datum - Datum whose category is being read.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns The category, or null/undefined to indicate a missing category. See\n * {@link BandCategory} .\n *\n * @see {@link BandCategory}\n * @see {@link BarSeriesProps}\n */\nexport type BarCategoryAccessor<D> =\n | {\n [K in keyof D]-?: D[K] extends BandCategory | null | undefined\n ? K\n : never;\n }[keyof D]\n | ((\n datum: D,\n index: number,\n data: readonly D[],\n ) => BandCategory | null | undefined);\nimport { barFill, type BarThresholdFill } from \"./bar-fill.js\";\nexport type { BarThresholdFill } from \"./bar-fill.js\";\n/**\n * Supported geometry and presentation properties for BarSeries.\n *\n * @see {@link FillStyle}\n * @see {@link BarThresholdFill}\n * @see {@link StrokeStyle}\n * @see {@link BarStyleResolver}\n */\nexport interface BarSeriesStyle {\n /** Width allocated to one categorical band. See {@link BarSeriesStyle}. */\n readonly bandwidth?: number | \"auto\";\n /** Paint used for the interior. See {@link FillStyle}, {@link BarThresholdFill}. */\n readonly fill?: FillStyle | BarThresholdFill;\n /** Paint used for the outline. See {@link StrokeStyle}. */\n readonly stroke?: StrokeStyle;\n /** Width of the painted outline. See {@link BarSeriesStyle}. */\n readonly strokeWidth?: number;\n /** Opacity of the painted result. See {@link BarSeriesStyle}. */\n readonly opacity?: number;\n /** Cursor shown while this target owns pointer presentation. See {@link BarSeriesStyle}. */\n readonly cursor?: string;\n}\n/**\n * Computes bar styling from the datum, index, and source data.\n *\n * @param datum - Datum being styled.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns Style for this datum's bar. See {@link BarSeriesStyle}.\n *\n * @see {@link BarSeriesStyle}\n */\nexport type BarStyleResolver<D> = (\n datum: D,\n index: number,\n data: readonly D[],\n) => BarSeriesStyle;\n/**\n * Shared data, category/value scales, orientation, filtering, and styling for bar variants.\n *\n * @see {@link BarCategoryAccessor}\n * @see {@link BarSeriesStyle}\n * @see {@link BarSeriesProps}\n */\ninterface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {\n /**\n * Application data supplied to the component or reported by the event. See {@link SignalValue}.\n */\n readonly data: SignalValue<readonly D[]>;\n /** Optional committed bar capture; rendering alone performs no inspection searches. */\n readonly inspection?: import(\"../inspection/bar.js\").BarInspectionRef<D>;\n /** Selects `\"vertical\"`, `\"horizontal\"` for orientation. See {@link BarSeriesBaseProps}. */\n readonly orientation?: \"vertical\" | \"horizontal\";\n /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */\n readonly category: BarCategoryAccessor<D>;\n /** Band scale used to place categories. See {@link ScaleId}. */\n readonly categoryScale: ScaleId;\n /** Numeric scale used to map bar values. See {@link ScaleId}. */\n readonly valueScale: ScaleId;\n /**\n * Selects the records that participate in the bar series. See {@link BarSeriesProps}.\n * @param datum - Record to test.\n * @param index - Zero-based index in the source array.\n * @param data - Complete source data array.\n * @returns Whether this record should contribute a bar.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /**\n * Declared presentation and layout properties. See {@link SignalValue}, {@link SignalStyle},\n * {@link BarSeriesStyle}, {@link BarStyleResolver}.\n */\n readonly style?: SignalValue<SignalStyle<BarSeriesStyle> | BarStyleResolver<D>>;\n}\n/**\n * Authored inputs for BarSeries, including the declared data and presentation options.\n *\n * @see {@link LineAccessor}\n * @see {@link SignalValue}\n * @see {@link BarCategoryAccessor}\n * @see {@link ScaleId}\n * @see {@link BarSeries}\n */\nexport type BarSeriesProps<D> = BarSeriesBaseProps<D> &\n (\n | {\n /** Value associated with this sample, input, or result. See {@link LineAccessor}. */\n readonly value: LineAccessor<D>;\n /** Numeric value from which each ordinary bar starts. See {@link SignalValue}. */\n readonly baseline?: SignalValue<number>;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueStart?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueEnd?: never;\n }\n | {\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly value?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly baseline?: never;\n /** Accessor for the beginning of a range bar. See {@link LineAccessor}. */\n readonly valueStart: LineAccessor<D>;\n /** Accessor for the end of a range bar. See {@link LineAccessor}. */\n readonly valueEnd: LineAccessor<D>;\n }\n ) &\n (\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarCategoryAccessor}. */\n readonly group: BarCategoryAccessor<D>;\n /** Band scale used to place subgroups within a category. See {@link ScaleId}. */\n readonly groupScale: ScaleId;\n }\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarSeriesProps}. */\n readonly group?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly groupScale?: never;\n }\n );\n/**\n * Value bars in source order; rectangles supply ordinary paint and event geometry.\n *\n * @param props - Data, category and value accessors, scales, grouping, and styling. See\n * {@link BarSeriesProps} .\n * @returns Pibbl nodes drawing the bars.\n *\n * @see {@link BarSeriesProps}\n */\nexport function BarSeries<D>({\n data: input,\n orientation = \"vertical\",\n category: categoryInput,\n value: valueInput,\n valueStart,\n valueEnd,\n categoryScale,\n valueScale,\n baseline,\n group,\n groupScale,\n defined,\n style: styleInput,\n pointerEvents,\n inspection,\n ...events\n}: BarSeriesProps<D>) {\n const categories = useBarScale(categoryScale).get();\n const values = useContinuousScale(valueScale).get();\n const groups = lookupScale(groupScale, \"BarSeries groupScale\")?.get();\n if ((group === undefined) !== (groupScale === undefined))\n throw new TypeError(\"BarSeries requires group and groupScale together.\");\n if (groups && groups.type !== \"band\")\n throw new TypeError(\"BarSeries groupScale requires a band scale.\");\n const groupValue =\n typeof group === \"function\"\n ? group\n : (datum: D) =>\n group === undefined\n ? undefined\n : (datum[group] as BandCategory | null | undefined);\n const slotWidth =\n groups?.type === \"band\" ? groups.bandwidth : categories.bandwidth;\n if (orientation !== \"vertical\" && orientation !== \"horizontal\")\n throw new TypeError(\"BarSeries orientation must be vertical or horizontal.\");\n const data = pointData(resolveSignalValue(input), \"BarSeries\");\n const category =\n typeof categoryInput === \"function\"\n ? categoryInput\n : (datum: D) =>\n datum[categoryInput] as BandCategory | null | undefined;\n const ranged = valueStart !== undefined || valueEnd !== undefined;\n if (\n ranged\n ? valueInput !== undefined ||\n baseline !== undefined ||\n valueStart === undefined ||\n valueEnd === undefined\n : valueInput === undefined\n )\n throw new TypeError(\n \"BarSeries requires either value with optional baseline, or both valueStart and valueEnd without value or baseline.\",\n );\n const value = pointAccessor((ranged ? valueEnd : valueInput)!);\n const startValue = ranged ? pointAccessor(valueStart!) : undefined;\n const baselineValue = resolveSignalValue(baseline ?? 0);\n const sharedBase = ranged ? undefined : values.map(baselineValue);\n const specified = resolveSignalValue(styleInput);\n const ctx = useCanvasContext();\n function normalize(input: unknown, callback: boolean) {\n if (!input || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"BarSeries style must be an object.\");\n if (\n callback &&\n Object.getPrototypeOf(input) !== Object.prototype &&\n Object.getPrototypeOf(input) !== null\n )\n throw new TypeError(\n \"BarSeries datum style must be a plain synchronous object.\",\n );\n const style: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (\n ![\n \"bandwidth\",\n \"fill\",\n \"stroke\",\n \"strokeWidth\",\n \"opacity\",\n \"cursor\",\n ].includes(key)\n )\n throw new TypeError(`BarSeries: unsupported style field ${key}.`);\n const value = (input as Record<string, unknown>)[key];\n if (callback && isSignal(value))\n throw new TypeError(\n \"BarSeries datum styles require plain values; read signals explicitly.\",\n );\n style[key] = callback ? value : resolveSignalValue(value);\n }\n const resolved = style as BarSeriesStyle;\n if (resolved.cursor !== undefined && typeof resolved.cursor !== \"string\")\n throw new TypeError(\"BarSeries cursor must be a string.\");\n return {\n bandwidth:\n resolved.bandwidth === undefined || resolved.bandwidth === \"auto\"\n ? slotWidth\n : width(resolved.bandwidth, \"BarSeries bandwidth\"),\n fill: barFill(ctx, resolved.fill ?? \"#2563eb\", (value) =>\n values.map(value),\n orientation,\n ),\n stroke: resolved.stroke,\n strokeWidth: width(resolved.strokeWidth ?? 1, \"BarSeries strokeWidth\"),\n alpha: opacity(resolved.opacity ?? 1, \"BarSeries\"),\n cursor: resolved.cursor,\n };\n }\n const shared =\n typeof specified === \"function\"\n ? undefined\n : normalize(specified ?? {}, false);\n const nodes: PibblNode[] = [];\n const captured: import(\"../inspection/bar.js\").CapturedBarMark<D>[] | undefined = inspection ? [] : undefined;\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const c = category(datum, i, data),\n v = value(datum, i, data),\n from = startValue ? startValue(datum, i, data) : baselineValue;\n if (c == null || !finiteCoordinate(v) || !finiteCoordinate(from)) continue;\n const categoryStart = categories.map(c);\n const g = groups ? groupValue(datum, i, data) : undefined;\n const offset = groups ? (g == null ? undefined : groups.map(g)) : 0;\n if (categoryStart === undefined || offset === undefined || slotWidth === 0)\n continue;\n const start = categoryStart + offset;\n const { bandwidth, fill, stroke, strokeWidth, alpha, cursor } =\n shared ??\n normalize(\n withHooksForbidden(\"BarSeries style callback\", () =>\n (specified as BarStyleResolver<D>)(datum, i, data),\n ),\n true,\n );\n if (bandwidth === 0) continue;\n const base = sharedBase ?? values.map(from);\n const end = values.map(v);\n const extent = Math.abs(end - base);\n if (!Number.isFinite(extent))\n throw new RangeError(\"BarSeries value extent must be finite.\");\n if (extent === 0) continue;\n const vertical = orientation === \"vertical\";\n const markFill = fill(from,v);\n captured?.push(Object.freeze({datum,sourceIndex:i,category:c,group:g ?? undefined,valueStart:from,valueEnd:v,\n boundsLocal:Object.freeze({x:vertical?start+(slotWidth-bandwidth)/2:Math.min(base,end),y:vertical?Math.min(base,end):start+(slotWidth-bandwidth)/2,width:vertical?bandwidth:extent,height:vertical?extent:bandwidth}),\n fill:!!markFill,strokeWidthLocal:stroke?strokeWidth:0}));\n nodes.push(\n <Rectangle\n key={i}\n pointerEvents={pointerEvents}\n style={{\n left: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end),\n top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,\n width: vertical ? bandwidth : extent,\n height: vertical ? extent : bandwidth,\n fill: markFill,\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor,\n }}\n />,\n );\n }\n if (inspection) inspection.capture(captured!);\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
+ "mappings": "AAoVM;AApVN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAG5B,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,SAAS,aAAa;AAwB/B,SAAS,eAAsC;AAiJxC,SAAS,UAAa;AAAA,EAC3B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,Q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cAAY;AAAA,IAAC,CAAC,CAAC;AACzD,UAAM;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,OAAO;AAAA,YACL,MAAM,WAAW,SAAS,YAAY,aAAa,IAAI,KAAK,IAAI,MAAM,GAAG;AAAA,YACzE,KAAK,WAAW,KAAK,IAAI,MAAM,GAAG,IAAI,SAAS,YAAY,aAAa;AAAA,YACxE,OAAO,WAAW,YAAY;AAAA,YAC9B,QAAQ,WAAW,SAAS;AAAA,YAC5B,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,UACF;AAAA;AAAA,QAZK;AAAA,MAaP;AAAA,IACF;AAAA,EACF;AACA,MAAI,WAAY,YAAW,QAAQ,QAAS;AAC5C,SAAO,oBAAC,SAAO,GAAG,QAAS,iBAAM;AACnC;",
6
6
  "names": ["input", "value"]
7
7
  }
@@ -0,0 +1,55 @@
1
+ import type { FillStyle, PibblEventHandlers, PibblEventParticipationOptions, SignalValue, StrokeStyle } from "@pibbl/core";
2
+ import type { SignalStyle } from "@pibbl/core/internal";
3
+ import type { LineAccessor, LineSeriesProps, ScaleId } from "./types.js";
4
+ /** Shared paint for one side of a baseline. See {@link BaselineSeries}. */
5
+ export interface BaselineSideStyle {
6
+ /** Area fill for this side of the baseline. */
7
+ readonly fill?: FillStyle;
8
+ /** Line stroke for this side of the baseline. */
9
+ readonly stroke?: StrokeStyle;
10
+ }
11
+ /** Shared presentation for a linear baseline series. See {@link BaselineSeries}. */
12
+ export interface BaselineSeriesStyle {
13
+ /** Paint for y values greater than or equal to baseline. */
14
+ readonly above?: BaselineSideStyle;
15
+ /** Paint for y values less than baseline. */
16
+ readonly below?: BaselineSideStyle;
17
+ /** Opacity for both area fills; defaults to 0.2. */
18
+ readonly fillOpacity?: number;
19
+ /** Width for both line strokes; defaults to 2. */
20
+ readonly strokeWidth?: number;
21
+ /** Cursor while a painted series path owns targeting. */
22
+ readonly cursor?: string;
23
+ }
24
+ /** A linear connected series split into independently painted regions at baseline crossings. See
25
+ * {@link BaselineSeries}.
26
+ */
27
+ export interface BaselineSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
28
+ /** Application records or a signal of records; source order is retained. */
29
+ readonly data: SignalValue<readonly D[]>;
30
+ /** Property key or callback extracting horizontal coordinates. */
31
+ readonly x: LineAccessor<D>;
32
+ /** Property key or callback extracting vertical coordinates. */
33
+ readonly y: LineAccessor<D>;
34
+ /** Numeric or trading-time horizontal scale identity. */
35
+ readonly xScale: ScaleId;
36
+ /** Linear vertical scale identity. */
37
+ readonly yScale: ScaleId;
38
+ /** Finite data-space division between the above and below presentations. */
39
+ readonly baseline: SignalValue<number>;
40
+ /** Excludes a record before its accessors run. */
41
+ readonly defined?: LineSeriesProps<D>["defined"];
42
+ /** Optional committed original-record capture on the standard numeric inspection foundation. */
43
+ readonly inspection?: import("../inspection/capture-types.js").NumericInspectionRef<D>;
44
+ /** Shared above/below paint and interaction presentation. */
45
+ readonly style?: SignalValue<SignalStyle<BaselineSeriesStyle>>;
46
+ }
47
+ /**
48
+ * Draws a linear connected series with independently painted regions above and below a baseline.
49
+ * Equal values belong to the above stroke; zero-area spans never receive a fill. Gaps split runs,
50
+ * and optional inspection captures only original records.
51
+ * @param props - Records, a numeric or trading-time x scale, linear price y scale, baseline, event props, and shared side paint.
52
+ * @returns Filled and stroked Pibbl paths in source paint order.
53
+ * @see {@link LineSeriesProps}
54
+ */
55
+ export declare function BaselineSeries<D>({ data: dataInput, x: xInput, y: yInput, xScale: xId, yScale: yId, baseline: baselineInput, defined, inspection, style: styleInput, ...eventProps }: BaselineSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -0,0 +1,136 @@
1
+ import { Fragment, jsx } from "@pibbl/core/jsx-runtime";
2
+ import { Path, resolveSignalValue } from "@pibbl/core";
3
+ import { useInternalValueMemoSlot, validateTexturePaint } from "@pibbl/core/internal";
4
+ import { useNumericPosition } from "./series-position.js";
5
+ import { opacity, width } from "./paint.js";
6
+ import { finiteCoordinate, pointAccessor, pointData } from "./point-data.js";
7
+ function fill(value, receiver) {
8
+ if (typeof value === "string" || value instanceof CanvasGradient || value instanceof CanvasPattern)
9
+ return value;
10
+ try {
11
+ validateTexturePaint(value);
12
+ return value;
13
+ } catch {
14
+ throw new TypeError(`${receiver}: invalid fill.`);
15
+ }
16
+ }
17
+ function side(value, baseline) {
18
+ return value >= baseline ? "above" : "below";
19
+ }
20
+ function BaselineSeries({
21
+ data: dataInput,
22
+ x: xInput,
23
+ y: yInput,
24
+ xScale: xId,
25
+ yScale: yId,
26
+ baseline: baselineInput,
27
+ defined,
28
+ inspection,
29
+ style: styleInput,
30
+ ...eventProps
31
+ }) {
32
+ const xScale = useNumericPosition(xId), yScale = useNumericPosition(yId);
33
+ if (yScale.type !== "linear")
34
+ throw new TypeError("BaselineSeries requires LinearScale for yScale.");
35
+ const x = useInternalValueMemoSlot("vizBaselineXAccessor", () => pointAccessor(xInput), [xInput]);
36
+ const y = useInternalValueMemoSlot("vizBaselineYAccessor", () => pointAccessor(yInput), [yInput]);
37
+ const data = pointData(resolveSignalValue(dataInput), "BaselineSeries");
38
+ const baseline = resolveSignalValue(baselineInput);
39
+ if (typeof baseline !== "number" || !Number.isFinite(baseline))
40
+ throw new RangeError("BaselineSeries baseline must be finite.");
41
+ const baselineY = yScale.map(baseline);
42
+ if (!Number.isFinite(baselineY)) throw new RangeError("BaselineSeries baseline must map to a finite coordinate.");
43
+ const style = resolveSignalValue(styleInput) ?? {};
44
+ if (style === null || typeof style !== "object" || Array.isArray(style))
45
+ throw new TypeError("BaselineSeries style must be an object.");
46
+ const above = resolveSignalValue(style.above) ?? {}, below = resolveSignalValue(style.below) ?? {};
47
+ const aboveFill = fill(resolveSignalValue(above.fill) ?? "#087f8c", "BaselineSeries above");
48
+ const belowFill = fill(resolveSignalValue(below.fill) ?? "#d9674c", "BaselineSeries below");
49
+ const aboveStroke = resolveSignalValue(above.stroke) ?? "#087f8c";
50
+ const belowStroke = resolveSignalValue(below.stroke) ?? "#d9674c";
51
+ const fillOpacity = opacity(resolveSignalValue(style.fillOpacity) ?? 0.2, "BaselineSeries fill");
52
+ const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 2, "BaselineSeries stroke");
53
+ const cursor = resolveSignalValue(style.cursor);
54
+ if (cursor !== void 0 && typeof cursor !== "string") throw new TypeError("BaselineSeries cursor must be a string.");
55
+ const pieces = [];
56
+ const captured = inspection ? [] : void 0;
57
+ let previous;
58
+ let run = 0;
59
+ const breakRun = () => {
60
+ previous = void 0;
61
+ run++;
62
+ };
63
+ const segment = (first, second) => {
64
+ const firstSide = side(first.domainY, baseline), secondSide = side(second.domainY, baseline);
65
+ const points = [
66
+ { point: first, side: firstSide }
67
+ ];
68
+ if (firstSide !== secondSide) {
69
+ const firstDistance = Math.abs(first.domainY - baseline);
70
+ const secondDistance = Math.abs(second.domainY - baseline);
71
+ const amount = firstDistance > secondDistance ? 1 / (1 + secondDistance / firstDistance) : firstDistance / secondDistance / (1 + firstDistance / secondDistance);
72
+ points.push({
73
+ point: { x: first.x + (second.x - first.x) * amount, y: baselineY, domainY: baseline },
74
+ side: firstSide
75
+ });
76
+ points.push({
77
+ point: { x: first.x + (second.x - first.x) * amount, y: baselineY, domainY: baseline },
78
+ side: secondSide
79
+ });
80
+ }
81
+ points.push({ point: second, side: secondSide });
82
+ for (let index = 1; index < points.length; index++) {
83
+ const start = points[index - 1], end = points[index];
84
+ const kind = start.side;
85
+ const a = start.point, b = end.point;
86
+ const stroke = new Path2D();
87
+ stroke.moveTo(a.x, a.y);
88
+ stroke.lineTo(b.x, b.y);
89
+ if (a.y === baselineY && b.y === baselineY) {
90
+ pieces.push({ side: kind, fill: void 0, stroke });
91
+ continue;
92
+ }
93
+ const fill2 = new Path2D();
94
+ fill2.moveTo(a.x, baselineY);
95
+ fill2.lineTo(a.x, a.y);
96
+ fill2.lineTo(b.x, b.y);
97
+ fill2.lineTo(b.x, baselineY);
98
+ fill2.closePath();
99
+ pieces.push({ side: kind, fill: fill2, stroke });
100
+ }
101
+ };
102
+ for (let index = 0; index < data.length; index++) {
103
+ const datum = data[index];
104
+ if (defined && !defined(datum, index, data)) {
105
+ breakRun();
106
+ continue;
107
+ }
108
+ const domainX = x(datum, index, data), domainY = y(datum, index, data);
109
+ if (!finiteCoordinate(domainX) || !finiteCoordinate(domainY)) {
110
+ breakRun();
111
+ continue;
112
+ }
113
+ const mappedX = xScale.map(domainX), mappedY = yScale.map(domainY);
114
+ if (!Number.isFinite(mappedX) || !Number.isFinite(mappedY)) {
115
+ breakRun();
116
+ continue;
117
+ }
118
+ const point = { datum, domainX, domainY, x: mappedX, y: mappedY };
119
+ captured?.push(Object.freeze({ datum, sourceIndex: index, domainX: point.domainX, domainY: point.domainY, anchorLocal: Object.freeze({ x: point.x, y: point.y }), run }));
120
+ if (previous) segment(previous, point);
121
+ previous = point;
122
+ }
123
+ if (inspection) inspection.capture({ observations: captured, xScale, yScale });
124
+ return /* @__PURE__ */ jsx(Fragment, { children: pieces.flatMap((piece, index) => {
125
+ const fill2 = piece.side === "above" ? aboveFill : belowFill;
126
+ const stroke = piece.side === "above" ? aboveStroke : belowStroke;
127
+ return [
128
+ ...piece.fill ? [/* @__PURE__ */ jsx(Path, { ...eventProps, style: { d: piece.fill, fill: fill2, opacity: fillOpacity, cursor } }, `${index}:fill`)] : [],
129
+ /* @__PURE__ */ jsx(Path, { ...eventProps, style: { d: piece.stroke, stroke, strokeWidth, cursor } }, `${index}:stroke`)
130
+ ];
131
+ }) });
132
+ }
133
+ export {
134
+ BaselineSeries
135
+ };
136
+ //# sourceMappingURL=baseline-series.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/baseline-series.tsx"],
4
+ "sourcesContent": ["import { Path, resolveSignalValue } from \"@pibbl/core\";\nimport type {\n FillStyle,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { useInternalValueMemoSlot, validateTexturePaint } from \"@pibbl/core/internal\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { LineAccessor, LineSeriesProps, ScaleId } from \"./types.js\";\nimport { useNumericPosition } from \"./series-position.js\";\nimport { opacity, width } from \"./paint.js\";\nimport { finiteCoordinate, pointAccessor, pointData } from \"./point-data.js\";\n\n/** Shared paint for one side of a baseline. See {@link BaselineSeries}. */\nexport interface BaselineSideStyle {\n /** Area fill for this side of the baseline. */\n readonly fill?: FillStyle;\n /** Line stroke for this side of the baseline. */\n readonly stroke?: StrokeStyle;\n}\n\n/** Shared presentation for a linear baseline series. See {@link BaselineSeries}. */\nexport interface BaselineSeriesStyle {\n /** Paint for y values greater than or equal to baseline. */\n readonly above?: BaselineSideStyle;\n /** Paint for y values less than baseline. */\n readonly below?: BaselineSideStyle;\n /** Opacity for both area fills; defaults to 0.2. */\n readonly fillOpacity?: number;\n /** Width for both line strokes; defaults to 2. */\n readonly strokeWidth?: number;\n /** Cursor while a painted series path owns targeting. */\n readonly cursor?: string;\n}\n\n/** A linear connected series split into independently painted regions at baseline crossings. See\n * {@link BaselineSeries}.\n */\nexport interface BaselineSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Application records or a signal of records; source order is retained. */\n readonly data: SignalValue<readonly D[]>;\n /** Property key or callback extracting horizontal coordinates. */\n readonly x: LineAccessor<D>;\n /** Property key or callback extracting vertical coordinates. */\n readonly y: LineAccessor<D>;\n /** Numeric or trading-time horizontal scale identity. */\n readonly xScale: ScaleId;\n /** Linear vertical scale identity. */\n readonly yScale: ScaleId;\n /** Finite data-space division between the above and below presentations. */\n readonly baseline: SignalValue<number>;\n /** Excludes a record before its accessors run. */\n readonly defined?: LineSeriesProps<D>[\"defined\"];\n /** Optional committed original-record capture on the standard numeric inspection foundation. */\n readonly inspection?: import(\"../inspection/capture-types.js\").NumericInspectionRef<D>;\n /** Shared above/below paint and interaction presentation. */\n readonly style?: SignalValue<SignalStyle<BaselineSeriesStyle>>;\n}\n\ninterface Point<D> {\n readonly datum: D;\n readonly domainX: number;\n readonly domainY: number;\n readonly x: number;\n readonly y: number;\n}\n\ninterface Piece {\n readonly side: \"above\" | \"below\";\n readonly fill: Path2D | undefined;\n readonly stroke: Path2D;\n}\n\nfunction fill(value: unknown, receiver: string): FillStyle {\n if (typeof value === \"string\" || value instanceof CanvasGradient || value instanceof CanvasPattern)\n return value;\n try {\n validateTexturePaint(value as never);\n return value as FillStyle;\n } catch {\n throw new TypeError(`${receiver}: invalid fill.`);\n }\n}\n\nfunction side(value: number, baseline: number): \"above\" | \"below\" {\n return value >= baseline ? \"above\" : \"below\";\n}\n\n/**\n * Draws a linear connected series with independently painted regions above and below a baseline.\n * Equal values belong to the above stroke; zero-area spans never receive a fill. Gaps split runs,\n * and optional inspection captures only original records.\n * @param props - Records, a numeric or trading-time x scale, linear price y scale, baseline, event props, and shared side paint.\n * @returns Filled and stroked Pibbl paths in source paint order.\n * @see {@link LineSeriesProps}\n */\nexport function BaselineSeries<D>({\n data: dataInput,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n baseline: baselineInput,\n defined,\n inspection,\n style: styleInput,\n ...eventProps\n}: BaselineSeriesProps<D>) {\n const xScale = useNumericPosition(xId), yScale = useNumericPosition(yId);\n if (yScale.type !== \"linear\")\n throw new TypeError(\"BaselineSeries requires LinearScale for yScale.\");\n const x = useInternalValueMemoSlot(\"vizBaselineXAccessor\", () => pointAccessor(xInput), [xInput]);\n const y = useInternalValueMemoSlot(\"vizBaselineYAccessor\", () => pointAccessor(yInput), [yInput]);\n const data = pointData(resolveSignalValue(dataInput), \"BaselineSeries\");\n const baseline = resolveSignalValue(baselineInput);\n if (typeof baseline !== \"number\" || !Number.isFinite(baseline))\n throw new RangeError(\"BaselineSeries baseline must be finite.\");\n const baselineY = yScale.map(baseline);\n if (!Number.isFinite(baselineY)) throw new RangeError(\"BaselineSeries baseline must map to a finite coordinate.\");\n const style = resolveSignalValue(styleInput) ?? {};\n if (style === null || typeof style !== \"object\" || Array.isArray(style))\n throw new TypeError(\"BaselineSeries style must be an object.\");\n const above = resolveSignalValue(style.above) ?? {}, below = resolveSignalValue(style.below) ?? {};\n const aboveFill = fill(resolveSignalValue(above.fill) ?? \"#087f8c\", \"BaselineSeries above\");\n const belowFill = fill(resolveSignalValue(below.fill) ?? \"#d9674c\", \"BaselineSeries below\");\n const aboveStroke = resolveSignalValue(above.stroke) ?? \"#087f8c\";\n const belowStroke = resolveSignalValue(below.stroke) ?? \"#d9674c\";\n const fillOpacity = opacity(resolveSignalValue(style.fillOpacity) ?? 0.2, \"BaselineSeries fill\");\n const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 2, \"BaselineSeries stroke\");\n const cursor = resolveSignalValue(style.cursor);\n if (cursor !== undefined && typeof cursor !== \"string\") throw new TypeError(\"BaselineSeries cursor must be a string.\");\n\n const pieces: Piece[] = [];\n const captured: import(\"../inspection/capture-types.js\").CapturedNumericObservation<D>[] | undefined = inspection ? [] : undefined;\n let previous: Point<D> | undefined;\n let run = 0;\n const breakRun = () => { previous = undefined; run++; };\n const segment = (first: Point<D>, second: Point<D>) => {\n const firstSide = side(first.domainY, baseline), secondSide = side(second.domainY, baseline);\n const points: { point: Point<D> | { x: number; y: number; domainY: number }; side: \"above\" | \"below\" }[] = [\n { point: first, side: firstSide },\n ];\n if (firstSide !== secondSide) {\n const firstDistance = Math.abs(first.domainY - baseline);\n const secondDistance = Math.abs(second.domainY - baseline);\n const amount = firstDistance > secondDistance\n ? 1 / (1 + secondDistance / firstDistance)\n : (firstDistance / secondDistance) / (1 + firstDistance / secondDistance);\n points.push({\n point: { x: first.x + (second.x - first.x) * amount, y: baselineY, domainY: baseline },\n side: firstSide,\n });\n points.push({\n point: { x: first.x + (second.x - first.x) * amount, y: baselineY, domainY: baseline },\n side: secondSide,\n });\n }\n points.push({ point: second, side: secondSide });\n for (let index = 1; index < points.length; index++) {\n const start = points[index - 1]!, end = points[index]!;\n const kind = start.side;\n const a = start.point, b = end.point;\n const stroke = new Path2D();\n stroke.moveTo(a.x, a.y);\n stroke.lineTo(b.x, b.y);\n if (a.y === baselineY && b.y === baselineY) {\n pieces.push({ side: kind, fill: undefined, stroke });\n continue;\n }\n const fill = new Path2D();\n fill.moveTo(a.x, baselineY);\n fill.lineTo(a.x, a.y);\n fill.lineTo(b.x, b.y);\n fill.lineTo(b.x, baselineY);\n fill.closePath();\n pieces.push({ side: kind, fill, stroke });\n }\n };\n for (let index = 0; index < data.length; index++) {\n const datum = data[index]!;\n if (defined && !defined(datum, index, data)) { breakRun(); continue; }\n const domainX = x(datum, index, data), domainY = y(datum, index, data);\n if (!finiteCoordinate(domainX) || !finiteCoordinate(domainY)) { breakRun(); continue; }\n const mappedX = xScale.map(domainX), mappedY = yScale.map(domainY);\n if (!Number.isFinite(mappedX) || !Number.isFinite(mappedY)) { breakRun(); continue; }\n const point: Point<D> = { datum, domainX, domainY, x: mappedX, y: mappedY };\n captured?.push(Object.freeze({ datum, sourceIndex: index, domainX: point.domainX, domainY: point.domainY, anchorLocal: Object.freeze({ x: point.x, y: point.y }), run }));\n if (previous) segment(previous, point);\n previous = point;\n }\n if (inspection) inspection.capture({ observations: captured!, xScale, yScale });\n return (\n <>\n {pieces.flatMap((piece, index) => {\n const fill = piece.side === \"above\" ? aboveFill : belowFill;\n const stroke = piece.side === \"above\" ? aboveStroke : belowStroke;\n return [\n ...(piece.fill ? [<Path key={`${index}:fill`} {...eventProps} style={{ d: piece.fill, fill, opacity: fillOpacity, cursor }} />] : []),\n <Path key={`${index}:stroke`} {...eventProps} style={{ d: piece.stroke, stroke, strokeWidth, cursor }} />,\n ];\n })}\n </>\n );\n}\n"],
5
+ "mappings": "AAmMI,mBAKwB,WALxB;AAnMJ,SAAS,MAAM,0BAA0B;AAQzC,SAAS,0BAA0B,4BAA4B;AAG/D,SAAS,0BAA0B;AACnC,SAAS,SAAS,aAAa;AAC/B,SAAS,kBAA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AiB,OAAO,KAAK,CAAC,iBAAiB,OAAO,GAAG;AAAE,eAAS;AAAG;AAAA,IAAU;AACtF,UAAM,UAAU,OAAO,IAAI,OAAO,GAAG,UAAU,OAAO,IAAI,OAAO;AACjE,QAAI,CAAC,OAAO,SAAS,OAAO,KAAK,CAAC,OAAO,SAAS,OAAO,GAAG;AAAE,eAAS;AAAG;AAAA,IAAU;AACpF,UAAM,QAAkB,EAAE,OAAO,SAAS,SAAS,GAAG,SAAS,GAAG,QAAQ;AAC1E,cAAU,KAAK,OAAO,OAAO,EAAE,OAAO,aAAa,OAAO,SAAS,MAAM,SAAS,SAAS,MAAM,SAAS,aAAa,OAAO,OAAO,EAAE,GAAG,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACxK,QAAI,SAAU,SAAQ,UAAU,KAAK;AACrC,eAAW;AAAA,EACb;AACA,MAAI,WAAY,YAAW,QAAQ,EAAE,cAAc,UAAW,QAAQ,OAAO,CAAC;AAC9E,SACE,gCACG,iBAAO,QAAQ,CAAC,OAAO,UAAU;AAChC,UAAMA,QAAO,MAAM,SAAS,UAAU,YAAY;AAClD,UAAM,SAAS,MAAM,SAAS,UAAU,cAAc;AACtD,WAAO;AAAA,MACL,GAAI,MAAM,OAAO,CAAC,oBAAC,QAA4B,GAAG,YAAY,OAAO,EAAE,GAAG,MAAM,MAAM,MAAAA,OAAM,SAAS,aAAa,OAAO,KAA5F,GAAG,KAAK,OAAuF,CAAE,IAAI,CAAC;AAAA,MACnI,oBAAC,QAA8B,GAAG,YAAY,OAAO,EAAE,GAAG,MAAM,QAAQ,QAAQ,aAAa,OAAO,KAAzF,GAAG,KAAK,SAAoF;AAAA,IACzG;AAAA,EACF,CAAC,GACH;AAEJ;",
6
+ "names": ["fill"]
7
+ }
@@ -0,0 +1,62 @@
1
+ import { type FillStyle, type StrokeStyle, type SignalValue, type PibblEventHandlers, type PibblEventParticipationOptions, type PibblNode } from "@pibbl/core";
2
+ import type { LineAccessor, ScaleId } from "./types.js";
3
+ import type { CandleInspectionRef } from "../inspection/candle.js";
4
+ /** Open/close body paint, independent from wick paint.
5
+ * @see {@link CandlestickSeries}
6
+ */
7
+ export interface CandleBodyStyle {
8
+ /** Interior; default teal for close >= open, coral otherwise. Empty string disables fill. */ readonly fill?: FillStyle;
9
+ /** Optional body outline. */ readonly stroke?: StrokeStyle;
10
+ /** Nonnegative local outline width; default 1. */ readonly strokeWidth?: number;
11
+ }
12
+ /** High/low wick paint.
13
+ * @see {@link CandlestickSeries}
14
+ */
15
+ export interface CandleWickStyle {
16
+ /** Wick paint; default dark teal. Empty string disables wick paint. */ readonly stroke?: StrokeStyle;
17
+ /** Nonnegative local width; default 1. */ readonly strokeWidth?: number;
18
+ }
19
+ /** Accepted named body/wick presentation for OHLC marks.
20
+ * @see {@link CandlestickSeries}
21
+ */
22
+ export interface CandlestickSeriesStyle {
23
+ /** Positive local body width, or automatic 70% spacing capped at 12; singleton fallback 8. */ readonly bandwidth?: number | "auto";
24
+ /** Independent open/close body appearance. */ readonly body?: CandleBodyStyle;
25
+ /** Independent high/low wick appearance. */ readonly wick?: CandleWickStyle;
26
+ /** Opacity zero through one; default 1. */ readonly opacity?: number;
27
+ /** Cursor while the series owns targeting. */ readonly cursor?: string;
28
+ }
29
+ /** Source-ordered OHLC records with named accessors and optional shared inspection.
30
+ * @see {@link CandlestickSeries}
31
+ */
32
+ export interface CandlestickSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
33
+ /** Original records/signal; never sorted or mutated. */ readonly data: SignalValue<readonly D[]>;
34
+ /** UTC-millisecond property or callback. */ readonly time: LineAccessor<D>;
35
+ /** Open price property or callback. */ readonly open: LineAccessor<D>;
36
+ /** High price property or callback. */ readonly high: LineAccessor<D>;
37
+ /** Low price property or callback. */ readonly low: LineAccessor<D>;
38
+ /** Close price property or callback. */ readonly close: LineAccessor<D>;
39
+ /** Numeric/UTC/trading horizontal mapping identity. */ readonly xScale: ScaleId;
40
+ /** Independent numeric price mapping identity. */ readonly yScale: ScaleId;
41
+ /** Tests original rows before accessor evaluation.
42
+ * @param datum - Original row.
43
+ * @param index - Source index including skipped rows.
44
+ * @param data - Original complete array.
45
+ * @returns Whether the candle participates.
46
+ */ readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;
47
+ /** Named body/wick appearance or a hook-free datum resolver.
48
+ * @param datum - Original row.
49
+ * @param index - Original source index.
50
+ * @param data - Complete source array.
51
+ * @returns Plain named candle styles.
52
+ */ readonly style?: SignalValue<CandlestickSeriesStyle> | ((datum: D, index: number, data: readonly D[]) => CandlestickSeriesStyle);
53
+ /** Optional capture on the ordinary inspection foundation; no queries while painting. */ readonly inspection?: CandleInspectionRef<D>;
54
+ }
55
+ /**
56
+ * Paints OHLC bodies and wicks, preserving source order and skipping complete missing candles.
57
+ * Finite malformed OHLC rejects; equal open/close paints a one-local-unit doji.
58
+ * @param props - Named OHLC accessors, scales, styles and optional inspection.
59
+ * @returns Ordinary Pibbl composition; disjoint equal styles share paint paths.
60
+ * @see {@link CandlestickSeriesProps}
61
+ */
62
+ export declare function CandlestickSeries<D>({ data: input, time: timeInput, open: openInput, high: highInput, low: lowInput, close: closeInput, xScale, yScale, defined, style: styleInput, inspection, pointerEvents, ...events }: CandlestickSeriesProps<D>): PibblNode;