@pibbl/core 0.0.1 → 0.0.3-alpha.85.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 (374) 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.d.ts +115 -62
  27. package/dist/features/physics/2d.js +59 -28
  28. package/dist/features/physics/2d.js.map +2 -2
  29. package/dist/features/physics/lib/2d/query-types.d.ts +6 -0
  30. package/dist/features/physics/lib/2d/runtime/controller.d.ts +7 -6
  31. package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
  32. package/dist/features/physics/lib/2d/types.d.ts +8 -30
  33. package/dist/features/physics/lib/2d/world/queries.d.ts +7 -6
  34. package/dist/features/physics/lib/2d/world/queries.js.map +2 -2
  35. package/dist/features/sprites/formats/aseprite.d.ts +5 -0
  36. package/dist/features/sprites/formats/texture-packer.d.ts +5 -0
  37. package/dist/features/sprites/index.d.ts +6 -0
  38. package/dist/features/sprites/loader.d.ts +25 -0
  39. package/dist/features/sprites/model.d.ts +75 -0
  40. package/dist/features/sprites/sprite.d.ts +22 -0
  41. package/dist/features/textures/index.d.ts +12 -2
  42. package/dist/features/textures/index.js +33 -1
  43. package/dist/features/textures/index.js.map +2 -2
  44. package/dist/features/textures/lib/chemical-field.d.ts +56 -0
  45. package/dist/features/textures/lib/chemical-field.js +154 -0
  46. package/dist/features/textures/lib/chemical-field.js.map +7 -0
  47. package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
  48. package/dist/features/textures/lib/chemical-recipes.js +275 -0
  49. package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
  50. package/dist/features/textures/lib/definitions.d.ts +3 -18
  51. package/dist/features/textures/lib/definitions.js +15 -20
  52. package/dist/features/textures/lib/definitions.js.map +2 -2
  53. package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
  54. package/dist/features/textures/lib/geometric-patterns.js +305 -0
  55. package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
  56. package/dist/features/textures/lib/gray-scott.d.ts +55 -0
  57. package/dist/features/textures/lib/gray-scott.js +39 -0
  58. package/dist/features/textures/lib/gray-scott.js.map +7 -0
  59. package/dist/features/textures/lib/patterns.d.ts +123 -0
  60. package/dist/features/textures/lib/patterns.js +344 -0
  61. package/dist/features/textures/lib/patterns.js.map +7 -0
  62. package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
  63. package/dist/features/textures/lib/reaction-diffusion.js +9 -20
  64. package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
  65. package/dist/features/textures/lib/simulation.d.ts +10 -4
  66. package/dist/features/textures/lib/simulation.js +23 -13
  67. package/dist/features/textures/lib/simulation.js.map +2 -2
  68. package/dist/features/viz/index.d.ts +79 -5
  69. package/dist/features/viz/index.js +145 -4
  70. package/dist/features/viz/index.js.map +2 -2
  71. package/dist/features/viz/inspection/bar.d.ts +79 -0
  72. package/dist/features/viz/inspection/bar.js +49 -0
  73. package/dist/features/viz/inspection/bar.js.map +7 -0
  74. package/dist/features/viz/inspection/candle.d.ts +156 -0
  75. package/dist/features/viz/inspection/candle.js +120 -0
  76. package/dist/features/viz/inspection/candle.js.map +7 -0
  77. package/dist/features/viz/inspection/capture-types.d.ts +65 -0
  78. package/dist/features/viz/inspection/capture.d.ts +16 -0
  79. package/dist/features/viz/inspection/capture.js +49 -0
  80. package/dist/features/viz/inspection/capture.js.map +7 -0
  81. package/dist/features/viz/inspection/handler.d.ts +36 -0
  82. package/dist/features/viz/inspection/handler.js +91 -0
  83. package/dist/features/viz/inspection/handler.js.map +7 -0
  84. package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
  85. package/dist/features/viz/inspection/ohlc-bar.js +118 -0
  86. package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
  87. package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
  88. package/dist/features/viz/inspection/owned-ref.js +99 -0
  89. package/dist/features/viz/inspection/owned-ref.js.map +7 -0
  90. package/dist/features/viz/inspection/painted-point.d.ts +22 -0
  91. package/dist/features/viz/inspection/painted-point.js +29 -0
  92. package/dist/features/viz/inspection/painted-point.js.map +7 -0
  93. package/dist/features/viz/inspection/queries.d.ts +100 -0
  94. package/dist/features/viz/inspection/queries.js +192 -0
  95. package/dist/features/viz/inspection/queries.js.map +7 -0
  96. package/dist/features/viz/inspection/query-types.d.ts +177 -0
  97. package/dist/features/viz/inspection/volume.d.ts +104 -0
  98. package/dist/features/viz/inspection/volume.js +95 -0
  99. package/dist/features/viz/inspection/volume.js.map +7 -0
  100. package/dist/features/viz/inspection.d.ts +19 -0
  101. package/dist/features/viz/inspection.js +54 -0
  102. package/dist/features/viz/inspection.js.map +7 -0
  103. package/dist/features/viz/inspection.mjs +1 -0
  104. package/dist/features/viz/lib/area-series.d.ts +62 -0
  105. package/dist/features/viz/lib/area-series.js +120 -0
  106. package/dist/features/viz/lib/area-series.js.map +7 -0
  107. package/dist/features/viz/lib/axis-labels.d.ts +2 -0
  108. package/dist/features/viz/lib/axis-labels.js +41 -0
  109. package/dist/features/viz/lib/axis-labels.js.map +7 -0
  110. package/dist/features/viz/lib/axis-title.d.ts +23 -0
  111. package/dist/features/viz/lib/axis-title.js +23 -0
  112. package/dist/features/viz/lib/axis-title.js.map +7 -0
  113. package/dist/features/viz/lib/axis.d.ts +1 -1
  114. package/dist/features/viz/lib/axis.js +50 -50
  115. package/dist/features/viz/lib/axis.js.map +2 -2
  116. package/dist/features/viz/lib/bar-scale.d.ts +7 -0
  117. package/dist/features/viz/lib/bar-scale.js +34 -0
  118. package/dist/features/viz/lib/bar-scale.js.map +7 -0
  119. package/dist/features/viz/lib/bar-series.d.ts +3 -1
  120. package/dist/features/viz/lib/bar-series.js +21 -5
  121. package/dist/features/viz/lib/bar-series.js.map +2 -2
  122. package/dist/features/viz/lib/baseline-series.d.ts +55 -0
  123. package/dist/features/viz/lib/baseline-series.js +136 -0
  124. package/dist/features/viz/lib/baseline-series.js.map +7 -0
  125. package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
  126. package/dist/features/viz/lib/candlestick-series.js +150 -0
  127. package/dist/features/viz/lib/candlestick-series.js.map +7 -0
  128. package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
  129. package/dist/features/viz/lib/censored-point-series.js +129 -0
  130. package/dist/features/viz/lib/censored-point-series.js.map +7 -0
  131. package/dist/features/viz/lib/chart-lines.d.ts +41 -0
  132. package/dist/features/viz/lib/chart-lines.js +32 -0
  133. package/dist/features/viz/lib/chart-lines.js.map +7 -0
  134. package/dist/features/viz/lib/color-context.d.ts +4 -0
  135. package/dist/features/viz/lib/color-context.js +41 -0
  136. package/dist/features/viz/lib/color-context.js.map +7 -0
  137. package/dist/features/viz/lib/color-math.d.ts +4 -0
  138. package/dist/features/viz/lib/color-math.js +31 -0
  139. package/dist/features/viz/lib/color-math.js.map +7 -0
  140. package/dist/features/viz/lib/color-types.d.ts +53 -0
  141. package/dist/features/viz/lib/curve-definition.d.ts +49 -0
  142. package/dist/features/viz/lib/curve-definition.js +148 -0
  143. package/dist/features/viz/lib/curve-definition.js.map +7 -0
  144. package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
  145. package/dist/features/viz/lib/diverging-color-scale.js +51 -0
  146. package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
  147. package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
  148. package/dist/features/viz/lib/domain-navigation.js +77 -0
  149. package/dist/features/viz/lib/domain-navigation.js.map +7 -0
  150. package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
  151. package/dist/features/viz/lib/editable-chart-elements.js +733 -0
  152. package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
  153. package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
  154. package/dist/features/viz/lib/financial-aggregation.js +116 -0
  155. package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
  156. package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
  157. package/dist/features/viz/lib/financial-autoscale.js +61 -0
  158. package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
  159. package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
  160. package/dist/features/viz/lib/financial-comparison.js +98 -0
  161. package/dist/features/viz/lib/financial-comparison.js.map +7 -0
  162. package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
  163. package/dist/features/viz/lib/financial-geometry.js +67 -0
  164. package/dist/features/viz/lib/financial-geometry.js.map +7 -0
  165. package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
  166. package/dist/features/viz/lib/financial-indicators.js +135 -0
  167. package/dist/features/viz/lib/financial-indicators.js.map +7 -0
  168. package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
  169. package/dist/features/viz/lib/financial-oscillators.js +265 -0
  170. package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
  171. package/dist/features/viz/lib/hover-data.d.ts +1 -1
  172. package/dist/features/viz/lib/hover-data.js +6 -3
  173. package/dist/features/viz/lib/hover-data.js.map +2 -2
  174. package/dist/features/viz/lib/hover-types.d.ts +5 -5
  175. package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
  176. package/dist/features/viz/lib/interval-band-series.js +136 -0
  177. package/dist/features/viz/lib/interval-band-series.js.map +7 -0
  178. package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
  179. package/dist/features/viz/lib/interval-diamond-series.js +124 -0
  180. package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
  181. package/dist/features/viz/lib/interval-series.d.ts +79 -0
  182. package/dist/features/viz/lib/interval-series.js +158 -0
  183. package/dist/features/viz/lib/interval-series.js.map +7 -0
  184. package/dist/features/viz/lib/line-series.d.ts +1 -1
  185. package/dist/features/viz/lib/line-series.js +47 -28
  186. package/dist/features/viz/lib/line-series.js.map +2 -2
  187. package/dist/features/viz/lib/linear-scale-component.d.ts +7 -0
  188. package/dist/features/viz/lib/linear-scale-component.js +18 -0
  189. package/dist/features/viz/lib/linear-scale-component.js.map +7 -0
  190. package/dist/features/viz/lib/linear-scale.js +1 -1
  191. package/dist/features/viz/lib/linear-scale.js.map +2 -2
  192. package/dist/features/viz/lib/log-scale-component.d.ts +7 -0
  193. package/dist/features/viz/lib/log-scale-component.js +19 -0
  194. package/dist/features/viz/lib/log-scale-component.js.map +7 -0
  195. package/dist/features/viz/lib/log-scale.d.ts +2 -0
  196. package/dist/features/viz/lib/log-scale.js +53 -0
  197. package/dist/features/viz/lib/log-scale.js.map +7 -0
  198. package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
  199. package/dist/features/viz/lib/monotone-curve.js +63 -0
  200. package/dist/features/viz/lib/monotone-curve.js.map +7 -0
  201. package/dist/features/viz/lib/nearest.d.ts +9 -9
  202. package/dist/features/viz/lib/nearest.js.map +1 -1
  203. package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
  204. package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
  205. package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
  206. package/dist/features/viz/lib/numeric-ticks.d.ts +38 -0
  207. package/dist/features/viz/lib/numeric-ticks.js +54 -0
  208. package/dist/features/viz/lib/numeric-ticks.js.map +7 -0
  209. package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
  210. package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
  211. package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
  212. package/dist/features/viz/lib/paired-series.d.ts +44 -0
  213. package/dist/features/viz/lib/paired-series.js +93 -0
  214. package/dist/features/viz/lib/paired-series.js.map +7 -0
  215. package/dist/features/viz/lib/plot-series.js +11 -6
  216. package/dist/features/viz/lib/plot-series.js.map +2 -2
  217. package/dist/features/viz/lib/plot-types.d.ts +4 -3
  218. package/dist/features/viz/lib/point-scale-component.d.ts +7 -0
  219. package/dist/features/viz/lib/point-scale-component.js +19 -0
  220. package/dist/features/viz/lib/point-scale-component.js.map +7 -0
  221. package/dist/features/viz/lib/point-scale.d.ts +2 -0
  222. package/dist/features/viz/lib/point-scale.js +45 -0
  223. package/dist/features/viz/lib/point-scale.js.map +7 -0
  224. package/dist/features/viz/lib/point-series.d.ts +1 -1
  225. package/dist/features/viz/lib/point-series.js +36 -9
  226. package/dist/features/viz/lib/point-series.js.map +2 -2
  227. package/dist/features/viz/lib/point-types.d.ts +5 -2
  228. package/dist/features/viz/lib/reference-band.d.ts +16 -0
  229. package/dist/features/viz/lib/reference-band.js +27 -0
  230. package/dist/features/viz/lib/reference-band.js.map +7 -0
  231. package/dist/features/viz/lib/scale-adjust.js +9 -4
  232. package/dist/features/viz/lib/scale-adjust.js.map +2 -2
  233. package/dist/features/viz/lib/scale-context.d.ts +5 -4
  234. package/dist/features/viz/lib/scale-context.js +15 -11
  235. package/dist/features/viz/lib/scale-context.js.map +2 -2
  236. package/dist/features/viz/lib/scale-provider.d.ts +2 -0
  237. package/dist/features/viz/lib/scale-provider.js +13 -0
  238. package/dist/features/viz/lib/scale-provider.js.map +7 -0
  239. package/dist/features/viz/lib/scale-ticks.d.ts +5 -0
  240. package/dist/features/viz/lib/scale-ticks.js +64 -0
  241. package/dist/features/viz/lib/scale-ticks.js.map +7 -0
  242. package/dist/features/viz/lib/scale-view.d.ts +4 -0
  243. package/dist/features/viz/lib/scale-view.js +21 -0
  244. package/dist/features/viz/lib/scale-view.js.map +7 -0
  245. package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
  246. package/dist/features/viz/lib/sequential-color-scale.js +49 -0
  247. package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
  248. package/dist/features/viz/lib/series-position.d.ts +12 -0
  249. package/dist/features/viz/lib/series-position.js +44 -0
  250. package/dist/features/viz/lib/series-position.js.map +7 -0
  251. package/dist/features/viz/lib/step-curves.d.ts +19 -0
  252. package/dist/features/viz/lib/step-curves.js +53 -0
  253. package/dist/features/viz/lib/step-curves.js.map +7 -0
  254. package/dist/features/viz/lib/symlog-scale-component.d.ts +7 -0
  255. package/dist/features/viz/lib/symlog-scale-component.js +19 -0
  256. package/dist/features/viz/lib/symlog-scale-component.js.map +7 -0
  257. package/dist/features/viz/lib/symlog-scale.d.ts +2 -0
  258. package/dist/features/viz/lib/symlog-scale.js +38 -0
  259. package/dist/features/viz/lib/symlog-scale.js.map +7 -0
  260. package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
  261. package/dist/features/viz/lib/threshold-color-scale.js +59 -0
  262. package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
  263. package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
  264. package/dist/features/viz/lib/trading-time-mapping.js +89 -0
  265. package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
  266. package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
  267. package/dist/features/viz/lib/trading-time-scale.js +96 -0
  268. package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
  269. package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
  270. package/dist/features/viz/lib/trajectory-series.js +111 -0
  271. package/dist/features/viz/lib/trajectory-series.js.map +7 -0
  272. package/dist/features/viz/lib/types.d.ts +114 -21
  273. package/dist/features/viz/lib/use-bar-scale.d.ts +8 -0
  274. package/dist/features/viz/lib/use-bar-scale.js +9 -0
  275. package/dist/features/viz/lib/use-bar-scale.js.map +7 -0
  276. package/dist/features/viz/lib/use-continuous-scale.d.ts +8 -0
  277. package/dist/features/viz/lib/use-continuous-scale.js +14 -0
  278. package/dist/features/viz/lib/use-continuous-scale.js.map +7 -0
  279. package/dist/features/viz/lib/use-linear-scale.d.ts +8 -0
  280. package/dist/features/viz/lib/use-linear-scale.js +9 -0
  281. package/dist/features/viz/lib/use-linear-scale.js.map +7 -0
  282. package/dist/features/viz/lib/use-log-scale.d.ts +8 -0
  283. package/dist/features/viz/lib/use-log-scale.js +9 -0
  284. package/dist/features/viz/lib/use-log-scale.js.map +7 -0
  285. package/dist/features/viz/lib/use-point-scale.d.ts +8 -0
  286. package/dist/features/viz/lib/use-point-scale.js +9 -0
  287. package/dist/features/viz/lib/use-point-scale.js.map +7 -0
  288. package/dist/features/viz/lib/use-symlog-scale.d.ts +8 -0
  289. package/dist/features/viz/lib/use-symlog-scale.js +9 -0
  290. package/dist/features/viz/lib/use-symlog-scale.js.map +7 -0
  291. package/dist/features/viz/lib/use-utc-scale.d.ts +8 -0
  292. package/dist/features/viz/lib/use-utc-scale.js +9 -0
  293. package/dist/features/viz/lib/use-utc-scale.js.map +7 -0
  294. package/dist/features/viz/lib/utc-labels.d.ts +12 -0
  295. package/dist/features/viz/lib/utc-labels.js +27 -0
  296. package/dist/features/viz/lib/utc-labels.js.map +7 -0
  297. package/dist/features/viz/lib/utc-scale-component.d.ts +7 -0
  298. package/dist/features/viz/lib/utc-scale-component.js +18 -0
  299. package/dist/features/viz/lib/utc-scale-component.js.map +7 -0
  300. package/dist/features/viz/lib/utc-scale.d.ts +21 -0
  301. package/dist/features/viz/lib/utc-scale.js +123 -0
  302. package/dist/features/viz/lib/utc-scale.js.map +7 -0
  303. package/dist/features/viz/lib/volume-series.d.ts +59 -0
  304. package/dist/features/viz/lib/volume-series.js +117 -0
  305. package/dist/features/viz/lib/volume-series.js.map +7 -0
  306. package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
  307. package/dist/features/viz/lib/weighted-point-series.js +169 -0
  308. package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
  309. package/dist/filters/emboss-gpu.d.ts +4 -0
  310. package/dist/filters/emboss-gpu.js +39 -0
  311. package/dist/filters/emboss-gpu.js.map +7 -0
  312. package/dist/filters/emboss.d.ts +32 -0
  313. package/dist/filters/emboss.js +106 -0
  314. package/dist/filters/emboss.js.map +7 -0
  315. package/dist/filters/reflection-gpu.d.ts +3 -1
  316. package/dist/filters/reflection-gpu.js +5 -2
  317. package/dist/filters/reflection-gpu.js.map +2 -2
  318. package/dist/filters/render-emboss-boundary.d.ts +13 -0
  319. package/dist/filters/render-emboss-boundary.js +131 -0
  320. package/dist/filters/render-emboss-boundary.js.map +7 -0
  321. package/dist/filters.d.ts +2 -0
  322. package/dist/filters.js +2 -0
  323. package/dist/filters.js.map +2 -2
  324. package/dist/index.d.ts +3 -1
  325. package/dist/index.js +3 -0
  326. package/dist/index.js.map +2 -2
  327. package/dist/internal.d.ts +2 -0
  328. package/dist/internal.js +4 -0
  329. package/dist/internal.js.map +2 -2
  330. package/dist/lib/animation/definition.d.ts +5 -3
  331. package/dist/lib/animation/definition.js +29 -4
  332. package/dist/lib/animation/definition.js.map +2 -2
  333. package/dist/lib/animation/playback.d.ts +8 -0
  334. package/dist/lib/animation/playback.js +33 -11
  335. package/dist/lib/animation/playback.js.map +2 -2
  336. package/dist/lib/animation/spring.d.ts +3 -1
  337. package/dist/lib/animation/spring.js.map +2 -2
  338. package/dist/lib/animation/types.d.ts +29 -73
  339. package/dist/lib/events/event-facade.d.ts +13 -0
  340. package/dist/lib/events/event-facade.js +23 -0
  341. package/dist/lib/events/event-facade.js.map +2 -2
  342. package/dist/lib/events/propagation.js +19 -14
  343. package/dist/lib/events/propagation.js.map +2 -2
  344. package/dist/lib/execute-render.js +13 -0
  345. package/dist/lib/execute-render.js.map +2 -2
  346. package/dist/lib/hooks/use-animated-value.d.ts +11 -21
  347. package/dist/lib/hooks/use-animated-value.js +23 -70
  348. package/dist/lib/hooks/use-animated-value.js.map +3 -3
  349. package/dist/lib/hooks/use-playback.js +1 -0
  350. package/dist/lib/hooks/use-playback.js.map +2 -2
  351. package/dist/lib/recording/recording.d.ts +43 -0
  352. package/dist/lib/recording/recording.js +555 -0
  353. package/dist/lib/recording/recording.js.map +7 -0
  354. package/dist/lib/recording/types.d.ts +118 -0
  355. package/dist/lib/recording/wasm-bytes.d.ts +1 -0
  356. package/dist/lib/recording/wasm-bytes.js +5 -0
  357. package/dist/lib/recording/wasm-bytes.js.map +7 -0
  358. package/dist/lib/recording/worker-source.d.ts +1 -0
  359. package/dist/lib/recording/worker-source.js +5 -0
  360. package/dist/lib/recording/worker-source.js.map +7 -0
  361. package/dist/lib/render-transaction.d.ts +5 -2
  362. package/dist/lib/render-transaction.js +23 -1
  363. package/dist/lib/render-transaction.js.map +2 -2
  364. package/dist/lib/series-inspection-frame.d.ts +18 -0
  365. package/dist/lib/series-inspection-frame.js +70 -0
  366. package/dist/lib/series-inspection-frame.js.map +7 -0
  367. package/dist/lib/types.d.ts +6 -0
  368. package/package.json +27 -5
  369. package/dist/features/viz/lib/scale.d.ts +0 -11
  370. package/dist/features/viz/lib/scale.js +0 -80
  371. package/dist/features/viz/lib/scale.js.map +0 -7
  372. package/dist/features/viz/lib/use-scale.d.ts +0 -20
  373. package/dist/features/viz/lib/use-scale.js +0 -10
  374. package/dist/features/viz/lib/use-scale.js.map +0 -7
@@ -0,0 +1,38 @@
1
+ import type { NumericDomain } from "./types.js";
2
+ /** Readable linear tick density. See {@link linearTicks}. */
3
+ export interface LinearTickOptions {
4
+ /** Target number of intervals, from 2 to 100; defaults to 5. */
5
+ readonly count?: number;
6
+ }
7
+ /**
8
+ * Generates bounded ticks at readable 1, 2, or 5 × powers-of-ten intervals.
9
+ * Endpoints are included only when aligned. Does not change scale geometry.
10
+ * @param domain - Distinct finite endpoints, ascending or descending.
11
+ * @param options - Target density; defaults to five intervals.
12
+ * @returns Frozen ticks in domain order. See {@link niceLinearDomain}.
13
+ */
14
+ export declare function linearTicks(domain: NumericDomain, options?: LinearTickOptions): readonly number[];
15
+ /**
16
+ * Expands a linear domain to readable tick boundaries, preserving direction.
17
+ * @param domain - Distinct finite numeric endpoints; never mutated.
18
+ * @param options - Target density; defaults to five intervals.
19
+ * @returns Frozen expanded endpoints. See {@link linearTicks}.
20
+ */
21
+ export declare function niceLinearDomain(domain: NumericDomain, options?: LinearTickOptions): NumericDomain;
22
+ /** Number formatting with explicit locale and literal unit affixes. See {@link formatNumber}. */
23
+ export interface NumberFormatOptions extends Intl.NumberFormatOptions {
24
+ /** Locale for formatting; defaults to en-US. */
25
+ readonly locale?: string;
26
+ /** Literal prefix; defaults to empty. */
27
+ readonly prefix?: string;
28
+ /** Literal suffix, including any desired space; defaults to empty. */
29
+ readonly suffix?: string;
30
+ }
31
+ /**
32
+ * Formats a finite number with Intl precision, currency, percent, or unit options.
33
+ * Rounded negative zero is displayed as positive zero.
34
+ * @param value - Finite numeric value.
35
+ * @param options - Intl options plus locale and literal affixes; default maximum fraction digits is 3.
36
+ * @returns Formatted text. Invalid Intl options retain native errors. See {@link NumberFormatOptions}.
37
+ */
38
+ export declare function formatNumber(value: number, options?: NumberFormatOptions): string;
@@ -0,0 +1,54 @@
1
+ function parameters(domain, options) {
2
+ const count = options.count ?? 5;
3
+ if (!Number.isInteger(count) || count < 2 || count > 100)
4
+ throw new RangeError("Linear tick count must be an integer from 2 to 100.");
5
+ if (!Array.isArray(domain) || domain.length !== 2 || !domain.every(Number.isFinite))
6
+ throw new RangeError("Linear tick domain requires two finite endpoints.");
7
+ const lo = Math.min(...domain), hi = Math.max(...domain);
8
+ const span = hi - lo;
9
+ if (!Number.isFinite(span) || span === 0)
10
+ throw new RangeError("Linear tick domain must have a finite nonzero span.");
11
+ const raw = span / count;
12
+ const power = 10 ** Math.floor(Math.log10(raw));
13
+ const error = raw / power;
14
+ let step = power * (error >= Math.sqrt(50) ? 10 : error >= Math.sqrt(10) ? 5 : error >= Math.sqrt(2) ? 2 : 1);
15
+ if (!Number.isFinite(step) || step === 0 || !Number.isSafeInteger(Math.floor(lo / step)) || !Number.isSafeInteger(Math.ceil(hi / step)))
16
+ throw new RangeError("Linear tick spacing exceeds numeric precision.");
17
+ if (Math.floor(hi / step) - Math.ceil(lo / step) + 1 > 100) {
18
+ const magnitude = 10 ** Math.floor(Math.log10(step));
19
+ const factor = step / magnitude;
20
+ step = magnitude * (factor < 1.5 ? 2 : factor < 3 ? 5 : 10);
21
+ }
22
+ return { lo, hi, step };
23
+ }
24
+ function clean(value) {
25
+ return Number(value.toPrecision(15)) || 0;
26
+ }
27
+ function linearTicks(domain, options = {}) {
28
+ const { lo, hi, step } = parameters(domain, options);
29
+ const start = Math.ceil(lo / step), end = Math.floor(hi / step);
30
+ const values = Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => clean((start + i) * step)).filter((v) => v >= lo && v <= hi);
31
+ return Object.freeze(domain[0] > domain[1] ? values.reverse() : values);
32
+ }
33
+ function niceLinearDomain(domain, options = {}) {
34
+ const { lo, hi, step } = parameters(domain, options);
35
+ const a = clean(Math.floor(lo / step) * step), b = clean(Math.ceil(hi / step) * step);
36
+ if (!Number.isFinite(a) || !Number.isFinite(b)) throw new RangeError("Nice linear domain exceeds finite numeric bounds.");
37
+ return Object.freeze(domain[0] > domain[1] ? [b, a] : [a, b]);
38
+ }
39
+ function formatNumber(value, options = {}) {
40
+ if (!Number.isFinite(value)) throw new RangeError("formatNumber value must be finite.");
41
+ const { locale = "en-US", prefix = "", suffix = "", ...intl } = options;
42
+ const formatter = new Intl.NumberFormat(locale, intl);
43
+ const parts = formatter.formatToParts(value);
44
+ const zeroDigit = Array.from(formatter.formatToParts(0).find((p) => p.type === "integer").value).at(-1);
45
+ const digits = parts.filter((p) => p.type === "integer" || p.type === "fraction");
46
+ const zero = digits.length > 0 && digits.every((p) => Array.from(p.value).every((digit) => digit === zeroDigit));
47
+ return prefix + formatter.format(zero ? 0 : value) + suffix;
48
+ }
49
+ export {
50
+ formatNumber,
51
+ linearTicks,
52
+ niceLinearDomain
53
+ };
54
+ //# sourceMappingURL=numeric-ticks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/numeric-ticks.ts"],
4
+ "sourcesContent": ["import type { NumericDomain } from \"./types.js\";\n\n/** Readable linear tick density. See {@link linearTicks}. */\nexport interface LinearTickOptions {\n /** Target number of intervals, from 2 to 100; defaults to 5. */\n readonly count?: number;\n}\nfunction parameters(domain: NumericDomain, options: LinearTickOptions) {\n const count = options.count ?? 5;\n if (!Number.isInteger(count) || count < 2 || count > 100)\n throw new RangeError(\"Linear tick count must be an integer from 2 to 100.\");\n if (!Array.isArray(domain) || domain.length !== 2 || !domain.every(Number.isFinite))\n throw new RangeError(\"Linear tick domain requires two finite endpoints.\");\n const lo = Math.min(...domain), hi = Math.max(...domain);\n const span = hi - lo;\n if (!Number.isFinite(span) || span === 0)\n throw new RangeError(\"Linear tick domain must have a finite nonzero span.\");\n const raw = span / count;\n const power = 10 ** Math.floor(Math.log10(raw));\n const error = raw / power;\n let step = power * (error >= Math.sqrt(50) ? 10 : error >= Math.sqrt(10) ? 5 : error >= Math.sqrt(2) ? 2 : 1);\n if (!Number.isFinite(step) || step === 0 || !Number.isSafeInteger(Math.floor(lo / step)) || !Number.isSafeInteger(Math.ceil(hi / step)))\n throw new RangeError(\"Linear tick spacing exceeds numeric precision.\");\n if (Math.floor(hi / step) - Math.ceil(lo / step) + 1 > 100) {\n const magnitude = 10 ** Math.floor(Math.log10(step));\n const factor = step / magnitude;\n step = magnitude * (factor < 1.5 ? 2 : factor < 3 ? 5 : 10);\n }\n return { lo, hi, step };\n}\nfunction clean(value: number) { return Number(value.toPrecision(15)) || 0; }\n/**\n * Generates bounded ticks at readable 1, 2, or 5 \u00D7 powers-of-ten intervals.\n * Endpoints are included only when aligned. Does not change scale geometry.\n * @param domain - Distinct finite endpoints, ascending or descending.\n * @param options - Target density; defaults to five intervals.\n * @returns Frozen ticks in domain order. See {@link niceLinearDomain}.\n */\nexport function linearTicks(domain: NumericDomain, options: LinearTickOptions = {}): readonly number[] {\n const { lo, hi, step } = parameters(domain, options);\n const start = Math.ceil(lo / step), end = Math.floor(hi / step);\n const values = Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => clean((start + i) * step)).filter(v => v >= lo && v <= hi);\n return Object.freeze(domain[0] > domain[1] ? values.reverse() : values);\n}\n/**\n * Expands a linear domain to readable tick boundaries, preserving direction.\n * @param domain - Distinct finite numeric endpoints; never mutated.\n * @param options - Target density; defaults to five intervals.\n * @returns Frozen expanded endpoints. See {@link linearTicks}.\n */\nexport function niceLinearDomain(domain: NumericDomain, options: LinearTickOptions = {}): NumericDomain {\n const { lo, hi, step } = parameters(domain, options);\n const a = clean(Math.floor(lo / step) * step), b = clean(Math.ceil(hi / step) * step);\n if (!Number.isFinite(a) || !Number.isFinite(b)) throw new RangeError(\"Nice linear domain exceeds finite numeric bounds.\");\n return Object.freeze(domain[0] > domain[1] ? [b, a] : [a, b]);\n}\n/** Number formatting with explicit locale and literal unit affixes. See {@link formatNumber}. */\nexport interface NumberFormatOptions extends Intl.NumberFormatOptions {\n /** Locale for formatting; defaults to en-US. */\n readonly locale?: string;\n /** Literal prefix; defaults to empty. */\n readonly prefix?: string;\n /** Literal suffix, including any desired space; defaults to empty. */\n readonly suffix?: string;\n}\n/**\n * Formats a finite number with Intl precision, currency, percent, or unit options.\n * Rounded negative zero is displayed as positive zero.\n * @param value - Finite numeric value.\n * @param options - Intl options plus locale and literal affixes; default maximum fraction digits is 3.\n * @returns Formatted text. Invalid Intl options retain native errors. See {@link NumberFormatOptions}.\n */\nexport function formatNumber(value: number, options: NumberFormatOptions = {}): string {\n if (!Number.isFinite(value)) throw new RangeError(\"formatNumber value must be finite.\");\n const { locale = \"en-US\", prefix = \"\", suffix = \"\", ...intl } = options;\n const formatter = new Intl.NumberFormat(locale, intl);\n const parts = formatter.formatToParts(value);\n const zeroDigit = Array.from(formatter.formatToParts(0).find(p => p.type === \"integer\")!.value).at(-1)!;\n const digits = parts.filter(p => p.type === \"integer\" || p.type === \"fraction\");\n const zero = digits.length > 0 && digits.every(p => Array.from(p.value).every(digit => digit === zeroDigit));\n return prefix + formatter.format(zero ? 0 : value) + suffix;\n}\n"],
5
+ "mappings": "AAOA,SAAS,WAAW,QAAuB,SAA4B;AACrE,QAAM,QAAQ,QAAQ,SAAS;AAC/B,MAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,QAAQ;AACnD,UAAM,IAAI,WAAW,qDAAqD;AAC5E,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,KAAK,CAAC,OAAO,MAAM,OAAO,QAAQ;AAChF,UAAM,IAAI,WAAW,mDAAmD;AAC1E,QAAM,KAAK,KAAK,IAAI,GAAG,MAAM,GAAG,KAAK,KAAK,IAAI,GAAG,MAAM;AACvD,QAAM,OAAO,KAAK;AAClB,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,SAAS;AACrC,UAAM,IAAI,WAAW,qDAAqD;AAC5E,QAAM,MAAM,OAAO;AACnB,QAAM,QAAQ,MAAM,KAAK,MAAM,KAAK,MAAM,GAAG,CAAC;AAC9C,QAAM,QAAQ,MAAM;AACpB,MAAI,OAAO,SAAS,SAAS,KAAK,KAAK,EAAE,IAAI,KAAK,SAAS,KAAK,KAAK,EAAE,IAAI,IAAI,SAAS,KAAK,KAAK,CAAC,IAAI,IAAI;AAC3G,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,SAAS,KAAK,CAAC,OAAO,cAAc,KAAK,MAAM,KAAK,I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DAAmD;AACxH,SAAO,OAAO,OAAO,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9D;AAiBO,SAAS,aAAa,OAAe,UAA+B,CAAC,GAAW;AACrF,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,OAAM,IAAI,WAAW,oCAAoC;AACtF,QAAM,EAAE,SAAS,SAAS,SAAS,IAAI,SAAS,IAAI,GAAG,KAAK,IAAI;AAChE,QAAM,YAAY,IAAI,KAAK,aAAa,QAAQ,IAAI;AACpD,QAAM,QAAQ,UAAU,cAAc,KAAK;AAC3C,QAAM,YAAY,MAAM,KAAK,UAAU,cAAc,CAAC,EAAE,KAAK,OAAK,EAAE,SAAS,SAAS,EAAG,KAAK,EAAE,GAAG,EAAE;AACrG,QAAM,SAAS,MAAM,OAAO,OAAK,EAAE,SAAS,aAAa,EAAE,SAAS,UAAU;AAC9E,QAAM,OAAO,OAAO,SAAS,KAAK,OAAO,MAAM,OAAK,MAAM,KAAK,EAAE,KAAK,EAAE,MAAM,WAAS,UAAU,SAAS,CAAC;AAC3G,SAAO,SAAS,UAAU,OAAO,OAAO,IAAI,KAAK,IAAI;AACvD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
1
+ import { type PibblEventHandlers, type PibblEventParticipationOptions, type PibblNode, type SignalValue, type StrokeStyle } from "@pibbl/core";
2
+ import type { OhlcBarInspectionRef } from "../inspection/ohlc-bar.js";
3
+ import type { LineAccessor, ScaleId } from "./types.js";
4
+ /** Shared stroke presentation for an OHLC bar.
5
+ * @see {@link OhlcBarSeries}
6
+ */
7
+ export interface OhlcBarSeriesStyle {
8
+ /** Positive total width, or automatic 70% spacing capped at 12; singleton fallback 8. */ readonly bandwidth?: number | "auto";
9
+ /** Stem and tick stroke; defaults to dark teal. Empty string disables painting. */ readonly stroke?: StrokeStyle;
10
+ /** Nonnegative local stroke width; default 1. */ readonly strokeWidth?: number;
11
+ /** Paint opacity from zero through one; default 1. */ readonly opacity?: number;
12
+ /** Cursor while the series owns targeting. */ readonly cursor?: string;
13
+ }
14
+ /** Source-ordered OHLC records rendered as a high/low stem with open/close ticks.
15
+ * @see {@link OhlcBarSeries}
16
+ */
17
+ export interface OhlcBarSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
18
+ /** Original records or signal; never sorted or mutated. */
19
+ readonly data: SignalValue<readonly D[]>;
20
+ /** UTC-millisecond property or callback. */
21
+ readonly time: LineAccessor<D>;
22
+ /** Opening price property or callback. */
23
+ readonly open: LineAccessor<D>;
24
+ /** High price property or callback. */
25
+ readonly high: LineAccessor<D>;
26
+ /** Low price property or callback. */
27
+ readonly low: LineAccessor<D>;
28
+ /** Closing price property or callback. */
29
+ readonly close: LineAccessor<D>;
30
+ /** Numeric, UTC, or trading-time horizontal mapping identity. */
31
+ readonly xScale: ScaleId;
32
+ /** Continuous price mapping identity. */
33
+ readonly yScale: ScaleId;
34
+ /** Tests original rows before accessor evaluation.
35
+ * @param datum - Original row.
36
+ * @param index - Source index including skipped rows.
37
+ * @param data - Complete source array.
38
+ * @returns Whether the bar participates.
39
+ */
40
+ readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;
41
+ /** Shared presentation or a hook-free original-row resolver.
42
+ * @param datum - Original row.
43
+ * @param index - Source index.
44
+ * @param data - Complete source array.
45
+ * @returns Plain OHLC-bar style.
46
+ */
47
+ readonly style?: SignalValue<OhlcBarSeriesStyle> | ((datum: D, index: number, data: readonly D[]) => OhlcBarSeriesStyle);
48
+ /** Optional committed capture; the renderer does not execute inspection queries. */ readonly inspection?: OhlcBarInspectionRef<D>;
49
+ }
50
+ /** Paints source-ordered OHLC bars with a high/low stem, left open tick, and right close tick.
51
+ * @param props - Original OHLC accessors, scales, styles, events, and optional capture.
52
+ * @returns Ordinary Pibbl composition; equal disjoint styles share paths.
53
+ * @see {@link OhlcBarSeriesProps}
54
+ */
55
+ export declare function OhlcBarSeries<D>({ data: input, time: timeInput, open: openInput, high: highInput, low: lowInput, close: closeInput, xScale, yScale, defined, style: styleInput, inspection, pointerEvents, ...events }: OhlcBarSeriesProps<D>): PibblNode;
@@ -0,0 +1,168 @@
1
+ import { jsx, jsxs } from "@pibbl/core/jsx-runtime";
2
+ import {
3
+ Group,
4
+ Path,
5
+ resolveSignalValue
6
+ } from "@pibbl/core";
7
+ import { withHooksForbidden } from "@pibbl/core/internal";
8
+ import { financialMarkWidth } from "./financial-geometry.js";
9
+ import { opacity, width } from "./paint.js";
10
+ import { finiteCoordinate, pointAccessor, pointData } from "./point-data.js";
11
+ import { useNumericPosition } from "./series-position.js";
12
+ import { useContinuousScale } from "./use-continuous-scale.js";
13
+ function OhlcBarSeries({
14
+ data: input,
15
+ time: timeInput,
16
+ open: openInput,
17
+ high: highInput,
18
+ low: lowInput,
19
+ close: closeInput,
20
+ xScale,
21
+ yScale,
22
+ defined,
23
+ style: styleInput,
24
+ inspection,
25
+ pointerEvents,
26
+ ...events
27
+ }) {
28
+ const xs = useNumericPosition(xScale), ys = useContinuousScale(yScale).get();
29
+ const data = pointData(resolveSignalValue(input), "OhlcBarSeries");
30
+ const time = pointAccessor(timeInput), open = pointAccessor(openInput), high = pointAccessor(highInput), low = pointAccessor(lowInput), close = pointAccessor(closeInput);
31
+ const rows = [];
32
+ for (let i = 0; i < data.length; i++) {
33
+ const datum = data[i];
34
+ if (defined && !defined(datum, i, data)) continue;
35
+ const t = time(datum, i, data), o = open(datum, i, data), h = high(datum, i, data), l = low(datum, i, data), c = close(datum, i, data);
36
+ if (!finiteCoordinate(t) || !finiteCoordinate(o) || !finiteCoordinate(h) || !finiteCoordinate(l) || !finiteCoordinate(c))
37
+ continue;
38
+ if (l > Math.min(o, c) || h < Math.max(o, c))
39
+ throw new RangeError(
40
+ `OhlcBarSeries: malformed OHLC at source index ${i}; require low <= open/close <= high.`
41
+ );
42
+ rows.push({
43
+ datum,
44
+ sourceIndex: i,
45
+ time: t,
46
+ open: o,
47
+ high: h,
48
+ low: l,
49
+ close: c,
50
+ x: xs.map(t)
51
+ });
52
+ }
53
+ const defaultWidth = financialMarkWidth(rows.map((row) => row.x));
54
+ const specified = typeof styleInput === "function" ? styleInput : resolveSignalValue(styleInput);
55
+ const marks = inspection ? [] : void 0;
56
+ const batches = [];
57
+ for (const row of rows) {
58
+ const style = typeof specified === "function" ? withHooksForbidden(
59
+ "OhlcBarSeries style callback",
60
+ () => specified(row.datum, row.sourceIndex, data)
61
+ ) : specified ?? {};
62
+ const markWidth = style.bandwidth === void 0 || style.bandwidth === "auto" ? defaultWidth : financialMarkWidth([], { width: style.bandwidth });
63
+ const halfWidth = markWidth / 2;
64
+ const stemLocal = Object.freeze({
65
+ x: row.x,
66
+ highY: ys.map(row.high),
67
+ lowY: ys.map(row.low)
68
+ });
69
+ const openTickLocal = Object.freeze({
70
+ x1: row.x - halfWidth,
71
+ x2: row.x,
72
+ y: ys.map(row.open)
73
+ });
74
+ const closeTickLocal = Object.freeze({
75
+ x1: row.x,
76
+ x2: row.x + halfWidth,
77
+ y: ys.map(row.close)
78
+ });
79
+ const stroke = style.stroke ?? "#173a35", strokeWidth = width(style.strokeWidth ?? 1, "OhlcBarSeries"), alpha = opacity(style.opacity ?? 1, "OhlcBarSeries");
80
+ marks?.push(
81
+ Object.freeze({
82
+ datum: row.datum,
83
+ sourceIndex: row.sourceIndex,
84
+ time: row.time,
85
+ open: row.open,
86
+ high: row.high,
87
+ low: row.low,
88
+ close: row.close,
89
+ anchorLocal: Object.freeze({ x: row.x, y: closeTickLocal.y }),
90
+ stemLocal,
91
+ openTickLocal,
92
+ closeTickLocal,
93
+ strokeWidthLocal: stroke && alpha > 0 ? strokeWidth : 0
94
+ })
95
+ );
96
+ if (alpha === 0 || !stroke) continue;
97
+ const xPad = strokeWidth / 2, minX = row.x - halfWidth - xPad, maxX = row.x + halfWidth + xPad;
98
+ let batch = batches.at(-1);
99
+ if (!batch || minX < batch.maxX && maxX > batch.minX || batch.stroke !== stroke || batch.strokeWidth !== strokeWidth || batch.opacity !== alpha || batch.cursor !== style.cursor) {
100
+ batch = {
101
+ stem: new Path2D(),
102
+ openTick: new Path2D(),
103
+ closeTick: new Path2D(),
104
+ stroke,
105
+ strokeWidth,
106
+ opacity: alpha,
107
+ cursor: style.cursor,
108
+ minX,
109
+ maxX
110
+ };
111
+ batches.push(batch);
112
+ }
113
+ batch.minX = Math.min(batch.minX, minX);
114
+ batch.maxX = Math.max(batch.maxX, maxX);
115
+ batch.stem.moveTo(stemLocal.x, stemLocal.highY);
116
+ batch.stem.lineTo(stemLocal.x, stemLocal.lowY);
117
+ batch.openTick.moveTo(openTickLocal.x1, openTickLocal.y);
118
+ batch.openTick.lineTo(openTickLocal.x2, openTickLocal.y);
119
+ batch.closeTick.moveTo(closeTickLocal.x1, closeTickLocal.y);
120
+ batch.closeTick.lineTo(closeTickLocal.x2, closeTickLocal.y);
121
+ }
122
+ inspection?.capture({ marks, xScale: xs, yScale: ys });
123
+ return /* @__PURE__ */ jsx(Group, { ...events, children: batches.map((batch, index) => /* @__PURE__ */ jsxs(Group, { children: [
124
+ /* @__PURE__ */ jsx(
125
+ Path,
126
+ {
127
+ pointerEvents,
128
+ style: {
129
+ d: batch.stem,
130
+ stroke: batch.stroke,
131
+ strokeWidth: batch.strokeWidth,
132
+ opacity: batch.opacity,
133
+ cursor: batch.cursor
134
+ }
135
+ }
136
+ ),
137
+ /* @__PURE__ */ jsx(
138
+ Path,
139
+ {
140
+ pointerEvents,
141
+ style: {
142
+ d: batch.openTick,
143
+ stroke: batch.stroke,
144
+ strokeWidth: batch.strokeWidth,
145
+ opacity: batch.opacity,
146
+ cursor: batch.cursor
147
+ }
148
+ }
149
+ ),
150
+ /* @__PURE__ */ jsx(
151
+ Path,
152
+ {
153
+ pointerEvents,
154
+ style: {
155
+ d: batch.closeTick,
156
+ stroke: batch.stroke,
157
+ strokeWidth: batch.strokeWidth,
158
+ opacity: batch.opacity,
159
+ cursor: batch.cursor
160
+ }
161
+ }
162
+ )
163
+ ] }, index)) });
164
+ }
165
+ export {
166
+ OhlcBarSeries
167
+ };
168
+ //# sourceMappingURL=ohlc-bar-series.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/ohlc-bar-series.tsx"],
4
+ "sourcesContent": ["import {\n Group,\n Path,\n resolveSignalValue,\n type PibblEventHandlers,\n type PibblEventParticipationOptions,\n type PibblNode,\n type SignalValue,\n type StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport type {\n OhlcBarInspectionRef,\n CapturedOhlcBarMark,\n} from \"../inspection/ohlc-bar.js\";\nimport { financialMarkWidth } from \"./financial-geometry.js\";\nimport { opacity, width } from \"./paint.js\";\nimport { finiteCoordinate, pointAccessor, pointData } from \"./point-data.js\";\nimport { useNumericPosition } from \"./series-position.js\";\nimport type { LineAccessor, ScaleId } from \"./types.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\n\n/** Shared stroke presentation for an OHLC bar.\n * @see {@link OhlcBarSeries}\n */\nexport interface OhlcBarSeriesStyle {\n /** Positive total width, or automatic 70% spacing capped at 12; singleton fallback 8. */ readonly bandwidth?:\n number | \"auto\";\n /** Stem and tick stroke; defaults to dark teal. Empty string disables painting. */ readonly stroke?: StrokeStyle;\n /** Nonnegative local stroke width; default 1. */ readonly strokeWidth?: number;\n /** Paint opacity from zero through one; default 1. */ readonly opacity?: number;\n /** Cursor while the series owns targeting. */ readonly cursor?: string;\n}\n\n/** Source-ordered OHLC records rendered as a high/low stem with open/close ticks.\n * @see {@link OhlcBarSeries}\n */\nexport interface OhlcBarSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Original records or signal; never sorted or mutated. */\n readonly data: SignalValue<readonly D[]>;\n /** UTC-millisecond property or callback. */\n readonly time: LineAccessor<D>;\n /** Opening price property or callback. */\n readonly open: LineAccessor<D>;\n /** High price property or callback. */\n readonly high: LineAccessor<D>;\n /** Low price property or callback. */\n readonly low: LineAccessor<D>;\n /** Closing price property or callback. */\n readonly close: LineAccessor<D>;\n /** Numeric, UTC, or trading-time horizontal mapping identity. */\n readonly xScale: ScaleId;\n /** Continuous price mapping identity. */\n readonly yScale: ScaleId;\n /** Tests original rows before accessor evaluation.\n * @param datum - Original row.\n * @param index - Source index including skipped rows.\n * @param data - Complete source array.\n * @returns Whether the bar participates.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /** Shared presentation or a hook-free original-row resolver.\n * @param datum - Original row.\n * @param index - Source index.\n * @param data - Complete source array.\n * @returns Plain OHLC-bar style.\n */\n readonly style?:\n | SignalValue<OhlcBarSeriesStyle>\n | ((datum: D, index: number, data: readonly D[]) => OhlcBarSeriesStyle);\n /** Optional committed capture; the renderer does not execute inspection queries. */ readonly inspection?: OhlcBarInspectionRef<D>;\n}\n\n/** Paints source-ordered OHLC bars with a high/low stem, left open tick, and right close tick.\n * @param props - Original OHLC accessors, scales, styles, events, and optional capture.\n * @returns Ordinary Pibbl composition; equal disjoint styles share paths.\n * @see {@link OhlcBarSeriesProps}\n */\nexport function OhlcBarSeries<D>({\n data: input,\n time: timeInput,\n open: openInput,\n high: highInput,\n low: lowInput,\n close: closeInput,\n xScale,\n yScale,\n defined,\n style: styleInput,\n inspection,\n pointerEvents,\n ...events\n}: OhlcBarSeriesProps<D>): PibblNode {\n const xs = useNumericPosition(xScale),\n ys = useContinuousScale(yScale).get();\n const data = pointData(resolveSignalValue(input), \"OhlcBarSeries\");\n const time = pointAccessor(timeInput),\n open = pointAccessor(openInput),\n high = pointAccessor(highInput),\n low = pointAccessor(lowInput),\n close = pointAccessor(closeInput);\n const rows: {\n datum: D;\n sourceIndex: number;\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n x: number;\n }[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const t = time(datum, i, data),\n o = open(datum, i, data),\n h = high(datum, i, data),\n l = low(datum, i, data),\n c = close(datum, i, data);\n if (\n !finiteCoordinate(t) ||\n !finiteCoordinate(o) ||\n !finiteCoordinate(h) ||\n !finiteCoordinate(l) ||\n !finiteCoordinate(c)\n )\n continue;\n if (l > Math.min(o, c) || h < Math.max(o, c))\n throw new RangeError(\n `OhlcBarSeries: malformed OHLC at source index ${i}; require low <= open/close <= high.`,\n );\n rows.push({\n datum,\n sourceIndex: i,\n time: t,\n open: o,\n high: h,\n low: l,\n close: c,\n x: xs.map(t),\n });\n }\n const defaultWidth = financialMarkWidth(rows.map((row) => row.x));\n const specified =\n typeof styleInput === \"function\"\n ? styleInput\n : resolveSignalValue(styleInput);\n const marks: CapturedOhlcBarMark<D>[] | undefined = inspection\n ? []\n : undefined;\n const batches: {\n stem: Path2D;\n openTick: Path2D;\n closeTick: Path2D;\n stroke: StrokeStyle;\n strokeWidth: number;\n opacity: number;\n cursor: string | undefined;\n minX: number;\n maxX: number;\n }[] = [];\n for (const row of rows) {\n const style =\n typeof specified === \"function\"\n ? withHooksForbidden(\"OhlcBarSeries style callback\", () =>\n specified(row.datum, row.sourceIndex, data),\n )\n : (specified ?? {});\n const markWidth =\n style.bandwidth === undefined || style.bandwidth === \"auto\"\n ? defaultWidth\n : financialMarkWidth([], { width: style.bandwidth });\n const halfWidth = markWidth / 2;\n const stemLocal = Object.freeze({\n x: row.x,\n highY: ys.map(row.high),\n lowY: ys.map(row.low),\n });\n const openTickLocal = Object.freeze({\n x1: row.x - halfWidth,\n x2: row.x,\n y: ys.map(row.open),\n });\n const closeTickLocal = Object.freeze({\n x1: row.x,\n x2: row.x + halfWidth,\n y: ys.map(row.close),\n });\n const stroke = style.stroke ?? \"#173a35\",\n strokeWidth = width(style.strokeWidth ?? 1, \"OhlcBarSeries\"),\n alpha = opacity(style.opacity ?? 1, \"OhlcBarSeries\");\n marks?.push(\n Object.freeze({\n datum: row.datum,\n sourceIndex: row.sourceIndex,\n time: row.time,\n open: row.open,\n high: row.high,\n low: row.low,\n close: row.close,\n anchorLocal: Object.freeze({ x: row.x, y: closeTickLocal.y }),\n stemLocal,\n openTickLocal,\n closeTickLocal,\n strokeWidthLocal: stroke && alpha > 0 ? strokeWidth : 0,\n }),\n );\n if (alpha === 0 || !stroke) continue;\n const xPad = strokeWidth / 2,\n minX = row.x - halfWidth - xPad,\n maxX = row.x + halfWidth + xPad;\n let batch = batches.at(-1);\n if (\n !batch ||\n (minX < batch.maxX && maxX > batch.minX) ||\n batch.stroke !== stroke ||\n batch.strokeWidth !== strokeWidth ||\n batch.opacity !== alpha ||\n batch.cursor !== style.cursor\n ) {\n batch = {\n stem: new Path2D(),\n openTick: new Path2D(),\n closeTick: new Path2D(),\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor: style.cursor,\n minX,\n maxX,\n };\n batches.push(batch);\n }\n batch.minX = Math.min(batch.minX, minX);\n batch.maxX = Math.max(batch.maxX, maxX);\n batch.stem.moveTo(stemLocal.x, stemLocal.highY);\n batch.stem.lineTo(stemLocal.x, stemLocal.lowY);\n batch.openTick.moveTo(openTickLocal.x1, openTickLocal.y);\n batch.openTick.lineTo(openTickLocal.x2, openTickLocal.y);\n batch.closeTick.moveTo(closeTickLocal.x1, closeTickLocal.y);\n batch.closeTick.lineTo(closeTickLocal.x2, closeTickLocal.y);\n }\n inspection?.capture({ marks: marks!, xScale: xs, yScale: ys });\n return (\n <Group {...events}>\n {batches.map((batch, index) => (\n <Group key={index}>\n <Path\n pointerEvents={pointerEvents}\n style={{\n d: batch.stem,\n stroke: batch.stroke,\n strokeWidth: batch.strokeWidth,\n opacity: batch.opacity,\n cursor: batch.cursor,\n }}\n />\n <Path\n pointerEvents={pointerEvents}\n style={{\n d: batch.openTick,\n stroke: batch.stroke,\n strokeWidth: batch.strokeWidth,\n opacity: batch.opacity,\n cursor: batch.cursor,\n }}\n />\n <Path\n pointerEvents={pointerEvents}\n style={{\n d: batch.closeTick,\n stroke: batch.stroke,\n strokeWidth: batch.strokeWidth,\n opacity: batch.opacity,\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OAAO,UAAU,GAAG,UAAU,IAAI;AAC7C,UAAM,SAAS,OAAO,cAAc,IAAI,cAAc,CAAC;AACvD,UAAM,SAAS,OAAO,cAAc,IAAI,cAAc,CAAC;AACvD,UAAM,UAAU,OAAO,eAAe,IAAI,eAAe,CAAC;AAC1D,UAAM,UAAU,OAAO,eAAe,IAAI,eAAe,CAAC;AAAA,EAC5D;AACA,cAAY,QAAQ,EAAE,OAAe,QAAQ,IAAI,QAAQ,GAAG,CAAC;AAC7D,SACE,oBAAC,SAAO,GAAG,QACR,kBAAQ,IAAI,CAAC,OAAO,UACnB,qBAAC,SACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,QAAQ,MAAM;AAAA,UACd,aAAa,MAAM;AAAA,UACnB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM;AAAA,QAChB;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,QAAQ,MAAM;AAAA,UACd,aAAa,MAAM;AAAA,UACnB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM;AAAA,QAChB;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,QAAQ,MAAM;AAAA,UACd,aAAa,MAAM;AAAA,UACnB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM;AAAA,QAChB;AAAA;AAAA,IACF;AAAA,OA9BU,KA+BZ,CACD,GACH;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,44 @@
1
+ import type { PibblEventHandlers, PibblEventParticipationOptions, SignalValue } from "@pibbl/core";
2
+ import type { SignalStyle } from "@pibbl/core/internal";
3
+ import type { LineAccessor, ScaleId, SeriesCoordinate } from "./types.js";
4
+ import type { TrajectorySeriesStyle } from "./trajectory-series.js";
5
+ /** Shared connector appearance for {@link PairedSeries}. */
6
+ export type PairedSeriesStyle = TrajectorySeriesStyle;
7
+ /** Authored wide-record inputs for {@link PairedSeries}. */
8
+ export interface PairedSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
9
+ /** Source records or a signal containing them. */
10
+ readonly data: SignalValue<readonly D[]>;
11
+ /** Numeric baseline or first-observation value. */
12
+ readonly before: LineAccessor<D>;
13
+ /** Numeric follow-up or second-observation value. */
14
+ readonly after: LineAccessor<D>;
15
+ /** Fixed x coordinate used for every `before` endpoint. */
16
+ readonly beforeX: SeriesCoordinate;
17
+ /** Fixed x coordinate used for every `after` endpoint. */
18
+ readonly afterX: SeriesCoordinate;
19
+ /** Scale mapping the two endpoint coordinates. */
20
+ readonly xScale: ScaleId;
21
+ /** Numeric scale mapping both endpoint values. */
22
+ readonly yScale: ScaleId;
23
+ /**
24
+ * Excludes a record before before/after accessors run.
25
+ * @param datum - Candidate source datum.
26
+ * @param index - Zero-based source index.
27
+ * @param data - Complete source data array.
28
+ * @returns Whether this record contributes a connector.
29
+ */
30
+ readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;
31
+ /** Shared connector style, including whole-object and shallow field signals. */
32
+ readonly style?: SignalValue<SignalStyle<PairedSeriesStyle>>;
33
+ }
34
+ /**
35
+ * Draws a connector for each complete wide-record before/after pair.
36
+ *
37
+ * The component does not manufacture point marks, calculate change, select a
38
+ * baseline, or impute missing observations. Compose `PointSeries` for endpoints.
39
+ *
40
+ * @param props - Wide records, endpoint accessors and coordinates, scales, and shared paint.
41
+ * @returns One batched ordinary Pibbl path containing source-ordered pair connectors.
42
+ * @see {@link PairedSeriesProps}
43
+ */
44
+ export declare function PairedSeries<D>({ data: input, before: beforeInput, after: afterInput, beforeX, afterX, xScale: xId, yScale: yId, defined, style: styleInput, ...events }: PairedSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -0,0 +1,93 @@
1
+ import { jsx } from "@pibbl/core/jsx-runtime";
2
+ import { Path, resolveSignalValue } from "@pibbl/core";
3
+ import { withHooksForbidden } from "@pibbl/core/internal";
4
+ import { pointAccessor, pointData } from "./point-data.js";
5
+ import { opacity, width } from "./paint.js";
6
+ import {
7
+ mapSeriesPosition,
8
+ useNumericPosition,
9
+ useSeriesPosition
10
+ } from "./series-position.js";
11
+ function style(input) {
12
+ if (input === null || typeof input !== "object" || Array.isArray(input))
13
+ throw new TypeError("PairedSeries: style must be an object.");
14
+ const value = input;
15
+ for (const field of Object.keys(value))
16
+ if (![
17
+ "stroke",
18
+ "strokeWidth",
19
+ "lineInteractionWidth",
20
+ "opacity",
21
+ "cursor"
22
+ ].includes(field))
23
+ throw new TypeError(`PairedSeries: unsupported style field ${field}.`);
24
+ const stroke = resolveSignalValue(value.stroke) ?? "#2563eb";
25
+ const strokeWidth = width(
26
+ resolveSignalValue(value.strokeWidth) ?? 2,
27
+ "PairedSeries strokeWidth"
28
+ );
29
+ const lineInteractionWidth = width(
30
+ resolveSignalValue(value.lineInteractionWidth) ?? strokeWidth,
31
+ "PairedSeries lineInteractionWidth"
32
+ );
33
+ const cursor = resolveSignalValue(value.cursor);
34
+ if (cursor !== void 0 && typeof cursor !== "string")
35
+ throw new TypeError("PairedSeries: cursor must be a string.");
36
+ return {
37
+ stroke,
38
+ strokeWidth,
39
+ lineInteractionWidth,
40
+ opacity: opacity(
41
+ resolveSignalValue(value.opacity) ?? 1,
42
+ "PairedSeries opacity"
43
+ ),
44
+ cursor
45
+ };
46
+ }
47
+ function PairedSeries({
48
+ data: input,
49
+ before: beforeInput,
50
+ after: afterInput,
51
+ beforeX,
52
+ afterX,
53
+ xScale: xId,
54
+ yScale: yId,
55
+ defined,
56
+ style: styleInput,
57
+ ...events
58
+ }) {
59
+ const xs = useSeriesPosition(xId);
60
+ const ys = useNumericPosition(yId);
61
+ const data = pointData(resolveSignalValue(input), "PairedSeries");
62
+ const before = pointAccessor(beforeInput);
63
+ const after = pointAccessor(afterInput);
64
+ const startX = mapSeriesPosition(xs, beforeX);
65
+ const endX = mapSeriesPosition(xs, afterX);
66
+ const resolved = style(resolveSignalValue(styleInput) ?? {});
67
+ const path = new Path2D();
68
+ if (startX !== void 0 && endX !== void 0)
69
+ for (let i = 0; i < data.length; i++) {
70
+ const datum = data[i];
71
+ const row = withHooksForbidden(
72
+ "PairedSeries: accessors cannot call hooks.",
73
+ () => {
74
+ if (defined && !defined(datum, i, data)) return void 0;
75
+ return {
76
+ before: before(datum, i, data),
77
+ after: after(datum, i, data)
78
+ };
79
+ }
80
+ );
81
+ if (!row) continue;
82
+ const startY = mapSeriesPosition(ys, row.before);
83
+ const endY = mapSeriesPosition(ys, row.after);
84
+ if (startY === void 0 || endY === void 0) continue;
85
+ path.moveTo(startX, startY);
86
+ path.lineTo(endX, endY);
87
+ }
88
+ return /* @__PURE__ */ jsx(Path, { ...events, style: { d: path, ...resolved } });
89
+ }
90
+ export {
91
+ PairedSeries
92
+ };
93
+ //# sourceMappingURL=paired-series.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/paired-series.tsx"],
4
+ "sourcesContent": ["import { Path, resolveSignalValue } from \"@pibbl/core\";\nimport type {\n PibblEventHandlers,\n PibblEventParticipationOptions,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { LineAccessor, ScaleId, SeriesCoordinate } from \"./types.js\";\nimport type { TrajectorySeriesStyle } from \"./trajectory-series.js\";\nimport { pointAccessor, pointData } from \"./point-data.js\";\nimport { opacity, width } from \"./paint.js\";\nimport {\n mapSeriesPosition,\n useNumericPosition,\n useSeriesPosition,\n} from \"./series-position.js\";\n\n/** Shared connector appearance for {@link PairedSeries}. */\nexport type PairedSeriesStyle = TrajectorySeriesStyle;\n\n/** Authored wide-record inputs for {@link PairedSeries}. */\nexport interface PairedSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Source records or a signal containing them. */\n readonly data: SignalValue<readonly D[]>;\n /** Numeric baseline or first-observation value. */\n readonly before: LineAccessor<D>;\n /** Numeric follow-up or second-observation value. */\n readonly after: LineAccessor<D>;\n /** Fixed x coordinate used for every `before` endpoint. */\n readonly beforeX: SeriesCoordinate;\n /** Fixed x coordinate used for every `after` endpoint. */\n readonly afterX: SeriesCoordinate;\n /** Scale mapping the two endpoint coordinates. */\n readonly xScale: ScaleId;\n /** Numeric scale mapping both endpoint values. */\n readonly yScale: ScaleId;\n /**\n * Excludes a record before before/after accessors run.\n * @param datum - Candidate source datum.\n * @param index - Zero-based source index.\n * @param data - Complete source data array.\n * @returns Whether this record contributes a connector.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /** Shared connector style, including whole-object and shallow field signals. */\n readonly style?: SignalValue<SignalStyle<PairedSeriesStyle>>;\n}\n\ninterface ResolvedPairedStyle {\n readonly stroke: StrokeStyle;\n readonly strokeWidth: number;\n readonly lineInteractionWidth: number;\n readonly opacity: number;\n readonly cursor?: string;\n}\n\nfunction style(input: unknown): ResolvedPairedStyle {\n if (input === null || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"PairedSeries: style must be an object.\");\n const value = input as Record<string, unknown>;\n for (const field of Object.keys(value))\n if (\n ![\n \"stroke\",\n \"strokeWidth\",\n \"lineInteractionWidth\",\n \"opacity\",\n \"cursor\",\n ].includes(field)\n )\n throw new TypeError(`PairedSeries: unsupported style field ${field}.`);\n const stroke = resolveSignalValue(value.stroke) ?? \"#2563eb\";\n const strokeWidth = width(\n (resolveSignalValue(value.strokeWidth) ?? 2) as number,\n \"PairedSeries strokeWidth\",\n );\n const lineInteractionWidth = width(\n (resolveSignalValue(value.lineInteractionWidth) ?? strokeWidth) as number,\n \"PairedSeries lineInteractionWidth\",\n );\n const cursor = resolveSignalValue(value.cursor);\n if (cursor !== undefined && typeof cursor !== \"string\")\n throw new TypeError(\"PairedSeries: cursor must be a string.\");\n return {\n stroke: stroke as StrokeStyle,\n strokeWidth,\n lineInteractionWidth,\n opacity: opacity(\n (resolveSignalValue(value.opacity) ?? 1) as number,\n \"PairedSeries opacity\",\n ),\n cursor,\n };\n}\n\n/**\n * Draws a connector for each complete wide-record before/after pair.\n *\n * The component does not manufacture point marks, calculate change, select a\n * baseline, or impute missing observations. Compose `PointSeries` for endpoints.\n *\n * @param props - Wide records, endpoint accessors and coordinates, scales, and shared paint.\n * @returns One batched ordinary Pibbl path containing source-ordered pair connectors.\n * @see {@link PairedSeriesProps}\n */\nexport function PairedSeries<D>({\n data: input,\n before: beforeInput,\n after: afterInput,\n beforeX,\n afterX,\n xScale: xId,\n yScale: yId,\n defined,\n style: styleInput,\n ...events\n}: PairedSeriesProps<D>) {\n const xs = useSeriesPosition(xId);\n const ys = useNumericPosition(yId);\n const data = pointData(resolveSignalValue(input), \"PairedSeries\");\n const before = pointAccessor(beforeInput);\n const after = pointAccessor(afterInput);\n const startX = mapSeriesPosition(xs, beforeX);\n const endX = mapSeriesPosition(xs, afterX);\n const resolved = style(resolveSignalValue(styleInput) ?? {});\n const path = new Path2D();\n if (startX !== undefined && endX !== undefined)\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n const row = withHooksForbidden(\n \"PairedSeries: accessors cannot call hooks.\",\n () => {\n if (defined && !defined(datum, i, data)) return undefined;\n return {\n before: before(datum, i, data),\n after: after(datum, i, data),\n };\n },\n );\n if (!row) continue;\n const startY = mapSeriesPosition(ys, row.before);\n const endY = mapSeriesPosition(ys, row.after);\n if (startY === undefined || endY === undefined) continue;\n path.moveTo(startX, startY);\n path.lineTo(endX, endY);\n }\n return <Path {...events} style={{ d: path, ...resolved }} />;\n}\n"],
5
+ "mappings": "AAqJS;AArJT,SAAS,MAAM,0BAA0B;AAOzC,SAAS,0BAA0B;AAInC,SAAS,eAAe,iBAAiB;AACzC,SAAS,SAAS,aAAa;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,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kB,IAAI,MAAM;AACzC,QAAM,WAAW,MAAM,mBAAmB,UAAU,KAAK,CAAC,CAAC;AAC3D,QAAM,OAAO,IAAI,OAAO;AACxB,MAAI,WAAW,UAAa,SAAS;AACnC,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,YAAM,QAAQ,KAAK,CAAC;AACpB,YAAM,MAAM;AAAA,QACV;AAAA,QACA,MAAM;AACJ,cAAI,WAAW,CAAC,QAAQ,OAAO,GAAG,IAAI,EAAG,QAAO;AAChD,iBAAO;AAAA,YACL,QAAQ,OAAO,OAAO,GAAG,IAAI;AAAA,YAC7B,OAAO,MAAM,OAAO,GAAG,IAAI;AAAA,UAC7B;AAAA,QACF;AAAA,MACF;AACA,UAAI,CAAC,IAAK;AACV,YAAM,SAAS,kBAAkB,IAAI,IAAI,MAAM;AAC/C,YAAM,OAAO,kBAAkB,IAAI,IAAI,KAAK;AAC5C,UAAI,WAAW,UAAa,SAAS,OAAW;AAChD,WAAK,OAAO,QAAQ,MAAM;AAC1B,WAAK,OAAO,MAAM,IAAI;AAAA,IACxB;AACF,SAAO,oBAAC,QAAM,GAAG,QAAQ,OAAO,EAAE,GAAG,MAAM,GAAG,SAAS,GAAG;AAC5D;",
6
+ "names": []
7
+ }
@@ -1,7 +1,11 @@
1
1
  import { jsx } from "@pibbl/core/jsx-runtime";
2
2
  import { Group, resolveSignalValue } from "@pibbl/core";
3
- import { pointAccessor, pointData, finiteCoordinate } from "./point-data.js";
4
- import { useScale } from "./use-scale.js";
3
+ import { pointData } from "./point-data.js";
4
+ import {
5
+ useSeriesPosition,
6
+ seriesAccessor,
7
+ mapSeriesPosition
8
+ } from "./series-position.js";
5
9
  function PlotRow({
6
10
  datum,
7
11
  index,
@@ -21,19 +25,20 @@ function PlotSeries({
21
25
  render,
22
26
  ...events
23
27
  }) {
24
- const xs = useScale(xId).get(), ys = useScale(yId).get();
28
+ const xs = useSeriesPosition(xId), ys = useSeriesPosition(yId);
25
29
  const data = pointData(resolveSignalValue(input), "PlotSeries");
26
30
  if (typeof render !== "function")
27
31
  throw new TypeError("PlotSeries: render must be a synchronous function.");
28
- const x = pointAccessor(xInput), y = pointAccessor(yInput);
32
+ const x = seriesAccessor(xInput), y = seriesAccessor(yInput);
29
33
  const keys = /* @__PURE__ */ new Set();
30
34
  const nodes = [];
31
35
  for (let i = 0; i < data.length; i++) {
32
36
  const datum = data[i];
33
37
  if (defined && !defined(datum, i, data)) continue;
34
38
  const xv = x(datum, i, data), yv = y(datum, i, data);
35
- if (!finiteCoordinate(xv) || !finiteCoordinate(yv)) continue;
36
- const px = xs.map(xv), py = ys.map(yv);
39
+ const mappedX = mapSeriesPosition(xs, xv), mappedY = mapSeriesPosition(ys, yv);
40
+ if (mappedX === void 0 || mappedY === void 0) continue;
41
+ const px = mappedX, py = mappedY;
37
42
  const key = keyBy === void 0 ? i : typeof keyBy === "function" ? keyBy(datum, i, data) : datum[keyBy];
38
43
  if (typeof key !== "string" && typeof key !== "number")
39
44
  throw new TypeError("PlotSeries: keyBy must return a string or number.");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/features/viz/lib/plot-series.tsx"],
4
- "sourcesContent": ["import { Group, resolveSignalValue } from \"@pibbl/core\";\nimport type { PibblNode } from \"@pibbl/core\";\nimport type { PlotSeriesProps } from \"./plot-types.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { useScale } from \"./use-scale.js\";\nfunction PlotRow<D>({\n datum,\n index,\n data,\n render,\n}: {\n datum: D;\n index: number;\n data: readonly D[];\n render: PlotSeriesProps<D>[\"render\"];\n}): PibblNode {\n return render(datum, index, data);\n}\n/**\n * Places keyed custom Pibbl subtrees at local data coordinates.\n *\n * @param props - Data, coordinate accessors, scales, keys, and per-datum renderer. See\n * {@link PlotSeriesProps} .\n * @returns Pibbl nodes placing each rendered datum at its mapped coordinates. See {@link PibblNode}.\n *\n * @see {@link PlotSeriesProps}\n * @see {@link PibblNode}\n */\nexport function PlotSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n defined,\n keyBy,\n render,\n ...events\n}: PlotSeriesProps<D>): PibblNode {\n const xs = useScale(xId).get(),\n ys = useScale(yId).get();\n const data = pointData(resolveSignalValue(input), \"PlotSeries\");\n if (typeof render !== \"function\")\n throw new TypeError(\"PlotSeries: render must be a synchronous function.\");\n const x = pointAccessor(xInput),\n y = pointAccessor(yInput);\n const keys = new Set<string>();\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 xv = x(datum, i, data),\n yv = y(datum, i, data);\n if (!finiteCoordinate(xv) || !finiteCoordinate(yv)) continue;\n const px = xs.map(xv),\n py = ys.map(yv);\n const key =\n keyBy === undefined\n ? i\n : typeof keyBy === \"function\"\n ? keyBy(datum, i, data)\n : datum[keyBy];\n if (typeof key !== \"string\" && typeof key !== \"number\")\n throw new TypeError(\"PlotSeries: keyBy must return a string or number.\");\n const normalized = String(key);\n if (keys.has(normalized))\n throw new Error(`PlotSeries: duplicate key \"${normalized}\".`);\n keys.add(normalized);\n nodes.push(\n <Group key={normalized} style={{ translateX: px, translateY: py }}>\n <PlotRow datum={datum} index={i} data={data} render={render} />\n </Group>,\n );\n }\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
- "mappings": "AAsEQ;AAtER,SAAS,OAAO,0BAA0B;AAG1C,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,gBAAgB;AACzB,SAAS,QAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKc;AACZ,SAAO,OAAO,OAAO,OAAO,IAAI;AAClC;AAWO,SAAS,WAAc;AAAA,EAC5B,MAAM;AAAA,EACN,GAAG;AAAA,EACH,GAAG;AAAA,EACH,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;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{ PibblNode } from \"@pibbl/core\";\nimport type { PlotSeriesProps } from \"./plot-types.js\";\nimport { pointData } from \"./point-data.js\";\nimport {\n useSeriesPosition,\n seriesAccessor,\n mapSeriesPosition,\n} from \"./series-position.js\";\nfunction PlotRow<D>({\n datum,\n index,\n data,\n render,\n}: {\n datum: D;\n index: number;\n data: readonly D[];\n render: PlotSeriesProps<D>[\"render\"];\n}): PibblNode {\n return render(datum, index, data);\n}\n/**\n * Places keyed custom Pibbl subtrees at local data coordinates.\n *\n * @param props - Data, coordinate accessors, scales, keys, and per-datum renderer. See\n * {@link PlotSeriesProps} .\n * @returns Pibbl nodes placing each rendered datum at its mapped coordinates. See {@link PibblNode}.\n *\n * @see {@link PlotSeriesProps}\n * @see {@link PibblNode}\n */\nexport function PlotSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n defined,\n keyBy,\n render,\n ...events\n}: PlotSeriesProps<D>): PibblNode {\n const xs = useSeriesPosition(xId),\n ys = useSeriesPosition(yId);\n const data = pointData(resolveSignalValue(input), \"PlotSeries\");\n if (typeof render !== \"function\")\n throw new TypeError(\"PlotSeries: render must be a synchronous function.\");\n const x = seriesAccessor(xInput),\n y = seriesAccessor(yInput);\n const keys = new Set<string>();\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 xv = x(datum, i, data),\n yv = y(datum, i, data);\n const mappedX = mapSeriesPosition(xs, xv),\n mappedY = mapSeriesPosition(ys, yv);\n if (mappedX === undefined || mappedY === undefined) continue;\n const px = mappedX,\n py = mappedY;\n const key =\n keyBy === undefined\n ? i\n : typeof keyBy === \"function\"\n ? keyBy(datum, i, data)\n : datum[keyBy];\n if (typeof key !== \"string\" && typeof key !== \"number\")\n throw new TypeError(\"PlotSeries: keyBy must return a string or number.\");\n const normalized = String(key);\n if (keys.has(normalized))\n throw new Error(`PlotSeries: duplicate key \"${normalized}\".`);\n keys.add(normalized);\n nodes.push(\n <Group key={normalized} style={{ translateX: px, translateY: py }}>\n <PlotRow datum={datum} index={i} data={data} render={render} />\n </Group>,\n );\n }\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
+ "mappings": "AA4EQ;AA5ER,SAAS,OAAO,0BAA0B;AAG1C,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKc;AACZ,SAAO,OAAO,OAAO,OAAO,IAAI;AAClC;AAWO,SAAS,WAAc;AAAA,EAC5B,MAAM;AAAA,EACN,GAAG;AAAA,EACH,GAAG;AAAA,EACH,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,KAAK,kBAAkB,GAAG,GAC9B,KAAK,kBAAkB,GAAG;AAC5B,QAAM,OAAO,UAAU,mBAAmB,KAAK,GAAG,YAAY;AAC9D,MAAI,OAAO,WAAW;AACpB,UAAM,IAAI,UAAU,oDAAoD;AAC1E,QAAM,IAAI,eAAe,MAAM,GAC7B,IAAI,eAAe,MAAM;AAC3B,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,QAAqB,CAAC;AAC5B,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,QAAQ,KAAK,CAAC;AACpB,QAAI,WAAW,CAAC,QAAQ,OAAO,GAAG,IAAI,EAAG;AACzC,UAAM,KAAK,EAAE,OAAO,GAAG,IAAI,GACzB,KAAK,EAAE,OAAO,GAAG,IAAI;AACvB,UAAM,UAAU,kBAAkB,IAAI,EAAE,GACtC,UAAU,kBAAkB,IAAI,EAAE;AACpC,QAAI,YAAY,UAAa,YAAY,OAAW;AACpD,UAAM,KAAK,SACT,KAAK;AACP,UAAM,MACJ,UAAU,SACN,IACA,OAAO,UAAU,aACf,MAAM,OAAO,GAAG,IAAI,IACpB,MAAM,KAAK;AACnB,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ;AAC5C,YAAM,IAAI,UAAU,mDAAmD;AACzE,UAAM,aAAa,OAAO,GAAG;AAC7B,QAAI,KAAK,IAAI,UAAU;AACrB,YAAM,IAAI,MAAM,8BAA8B,UAAU,IAAI;AAC9D,SAAK,IAAI,UAAU;AACnB,UAAM;AAAA,MACJ,oBAAC,SAAuB,OAAO,EAAE,YAAY,IAAI,YAAY,GAAG,GAC9D,8BAAC,WAAQ,OAAc,OAAO,GAAG,MAAY,QAAgB,KADnD,UAEZ;AAAA,IACF;AAAA,EACF;AACA,SAAO,oBAAC,SAAO,GAAG,QAAS,iBAAM;AACnC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import type { PlotSeries } from "./plot-series.js";
2
2
  import type { PieOptions } from "./pie-slices.js";
3
- import type { PibblEventHandlers, PibblNode, SignalValue } from "@pibbl/core";
4
3
  import type { PointAccessor } from "./point-types.js";
4
+ import type { SeriesAccessor } from "./types.js";
5
+ import type { PibblEventHandlers, PibblNode, SignalValue } from "@pibbl/core";
5
6
  import type { ScaleId } from "./types.js";
6
7
  /**
7
8
  * A property or callback that provides stable identity for a plotted datum.
@@ -34,9 +35,9 @@ export interface PlotSeriesProps<D> extends PibblEventHandlers {
34
35
  */
35
36
  readonly data: SignalValue<readonly D[]>;
36
37
  /** Property key or callback extracting the horizontal domain coordinate. See {@link PointAccessor}. */
37
- readonly x: PointAccessor<D>;
38
+ readonly x: SeriesAccessor<D>;
38
39
  /** Property key or callback extracting the vertical domain coordinate. See {@link PointAccessor}. */
39
- readonly y: PointAccessor<D>;
40
+ readonly y: SeriesAccessor<D>;
40
41
  /** The scale used to map horizontal data coordinates. See {@link ScaleId}. */
41
42
  readonly xScale: ScaleId;
42
43
  /** The scale used to map vertical data coordinates. See {@link ScaleId}. */
@@ -0,0 +1,7 @@
1
+ import type { PointScaleProps } from "./types.js";
2
+ /**
3
+ * Provides a named point mapping to descendant visualization components.
4
+ * @param props - Identity, domain, range, and padding. See {@link PointScaleProps}.
5
+ * @returns Descendant content within the scale scope.
6
+ */
7
+ export declare function PointScale(props: PointScaleProps): import("@pibbl/core").PibblNode;