@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
@@ -0,0 +1,301 @@
1
+ import { jsx, jsxs } from "@pibbl/core/jsx-runtime";
2
+ import {
3
+ Group,
4
+ Rectangle,
5
+ SvgPath,
6
+ Text,
7
+ resolveSignalValue,
8
+ resolveBox,
9
+ useLayoutBox
10
+ } from "@pibbl/core";
11
+ const boundsKeys = ["x", "y", "width", "height"];
12
+ const graphLayoutKeys = [
13
+ "rankGap",
14
+ "nodeGap",
15
+ "levelGap",
16
+ "siblingGap",
17
+ "cellGap",
18
+ "rowLabelWidth",
19
+ "columnLabelHeight",
20
+ "nodeWidth",
21
+ "columnGap",
22
+ "headerHeight",
23
+ "ringGap",
24
+ "bandWidth",
25
+ "padAngle",
26
+ "startAngle"
27
+ ];
28
+ function readAccessor(datum, accessor) {
29
+ return typeof accessor === "function" ? accessor(datum) : datum[accessor];
30
+ }
31
+ function validateBounds(bounds) {
32
+ for (let keyIndex = 0; keyIndex < boundsKeys.length; keyIndex++) {
33
+ const key = boundsKeys[keyIndex];
34
+ if (!Number.isFinite(bounds[key]) || (key === "width" || key === "height") && bounds[key] < 0)
35
+ throw new RangeError(
36
+ `Graph bounds.${key} must be finite${key === "width" || key === "height" ? " and nonnegative" : ""}.`
37
+ );
38
+ }
39
+ if (!Number.isFinite(bounds.x + bounds.width) || !Number.isFinite(bounds.y + bounds.height))
40
+ throw new RangeError("Graph bounds overflow.");
41
+ return bounds;
42
+ }
43
+ function validKey(key) {
44
+ if (typeof key !== "string" && typeof key !== "number" || typeof key === "number" && !Number.isFinite(key))
45
+ throw new TypeError("Graph keys must be strings or finite numbers.");
46
+ return key;
47
+ }
48
+ function useGraphFrame(input) {
49
+ const allocation = useLayoutBox();
50
+ const authored = resolveSignalValue(input) ?? {};
51
+ const merged = { ...authored };
52
+ for (const rule of authored.when ?? []) {
53
+ const q = rule.query;
54
+ if ((q.minWidth === void 0 || allocation.width >= q.minWidth) && (q.maxWidth === void 0 || allocation.width <= q.maxWidth) && (q.minHeight === void 0 || allocation.height >= q.minHeight) && (q.maxHeight === void 0 || allocation.height <= q.maxHeight))
55
+ Object.assign(merged, rule.style);
56
+ }
57
+ delete merged.when;
58
+ for (const key of Object.keys(merged))
59
+ merged[key] = resolveSignalValue(merged[key]);
60
+ if (merged.width === "auto" || merged.height === "auto")
61
+ throw new RangeError(
62
+ "Graph frames require definite width and height or a finite parent allocation."
63
+ );
64
+ const style = merged;
65
+ const box = resolveBox(
66
+ {
67
+ ...style,
68
+ width: style.width ?? allocation.width,
69
+ height: style.height ?? allocation.height
70
+ },
71
+ {
72
+ minWidth: 0,
73
+ minHeight: 0,
74
+ maxWidth: allocation.width,
75
+ maxHeight: allocation.height
76
+ }
77
+ );
78
+ const bounds = validateBounds({
79
+ x: 0,
80
+ y: 0,
81
+ width: box.borderBox.width,
82
+ height: box.borderBox.height
83
+ });
84
+ const groupStyle = { ...style, width: bounds.width, height: bounds.height };
85
+ for (let keyIndex = 0; keyIndex < graphLayoutKeys.length; keyIndex++) {
86
+ const key = graphLayoutKeys[keyIndex];
87
+ delete groupStyle[key];
88
+ }
89
+ return { bounds, style, groupStyle };
90
+ }
91
+ function resolveMarkStyle(geometry, input) {
92
+ return resolveSignalValue(
93
+ typeof input === "function" ? input(geometry) : input
94
+ );
95
+ }
96
+ function graphNodeGeometry(datum, key, bounds, label = String(key), detail) {
97
+ return {
98
+ key,
99
+ datum,
100
+ bounds,
101
+ label: {
102
+ text: label,
103
+ bounds: {
104
+ x: bounds.x + 10,
105
+ y: bounds.y + 4,
106
+ width: Math.max(0, bounds.width - 20),
107
+ height: detail ? bounds.height / 2 : Math.max(0, bounds.height - 8)
108
+ },
109
+ rotationDegrees: 0
110
+ },
111
+ detail: detail === void 0 ? null : {
112
+ text: detail,
113
+ bounds: {
114
+ x: bounds.x + 10,
115
+ y: bounds.y + bounds.height / 2,
116
+ width: Math.max(0, bounds.width - 20),
117
+ height: bounds.height / 2 - 4
118
+ },
119
+ rotationDegrees: 0
120
+ }
121
+ };
122
+ }
123
+ function defaultGraphNodeStyle(_node) {
124
+ return {
125
+ fill: "#edf5f2",
126
+ stroke: "#8eb6aa",
127
+ strokeWidth: 1,
128
+ cornerRadius: 7
129
+ };
130
+ }
131
+ function defaultGraphEdgeStyle(_edge) {
132
+ return { stroke: "#91a9a3", strokeWidth: 1.5 };
133
+ }
134
+ function defaultGraphLabelStyle(_label) {
135
+ return { fill: "#203d39", font: "13px sans-serif", textBaseline: "middle" };
136
+ }
137
+ function GraphNode({
138
+ node,
139
+ style,
140
+ children,
141
+ ...events
142
+ }) {
143
+ const { x, y, width, height } = node.bounds;
144
+ const {
145
+ keyboardFocusable,
146
+ keyboardNavigationBounds,
147
+ pointerEvents,
148
+ ...handlers
149
+ } = events;
150
+ return /* @__PURE__ */ jsxs(Group, { ...handlers, style: { translateX: x, translateY: y }, children: [
151
+ /* @__PURE__ */ jsx(
152
+ Rectangle,
153
+ {
154
+ keyboardFocusable: keyboardFocusable ?? Boolean(handlers.onClick || handlers.onKeyDown || handlers.onKeyUp),
155
+ keyboardNavigationBounds,
156
+ pointerEvents,
157
+ style: { ...resolveSignalValue(style), width, height }
158
+ }
159
+ ),
160
+ children
161
+ ] });
162
+ }
163
+ function GraphEdge({
164
+ edge,
165
+ style,
166
+ ...events
167
+ }) {
168
+ const paint = resolveSignalValue(style);
169
+ const {
170
+ keyboardFocusable,
171
+ keyboardNavigationBounds,
172
+ pointerEvents,
173
+ ...handlers
174
+ } = events;
175
+ return /* @__PURE__ */ jsxs(Group, { ...handlers, children: [
176
+ /* @__PURE__ */ jsx(
177
+ SvgPath,
178
+ {
179
+ keyboardFocusable: keyboardFocusable ?? Boolean(handlers.onClick || handlers.onKeyDown || handlers.onKeyUp),
180
+ keyboardNavigationBounds,
181
+ pointerEvents,
182
+ style: { ...paint, d: edge.path }
183
+ }
184
+ ),
185
+ edge.arrowPath && /* @__PURE__ */ jsx(
186
+ SvgPath,
187
+ {
188
+ pointerEvents,
189
+ style: {
190
+ ...paint,
191
+ fill: paint?.stroke ?? "#91a9a3",
192
+ d: edge.arrowPath
193
+ }
194
+ }
195
+ )
196
+ ] });
197
+ }
198
+ function GraphLabel({ label, style }) {
199
+ const { x, y, width, height } = label.bounds;
200
+ const paint = resolveSignalValue(style);
201
+ const align = resolveSignalValue(paint?.textAlign);
202
+ const anchor = align === "center" ? width / 2 : align === "right" || align === "end" ? width : 0;
203
+ return /* @__PURE__ */ jsx(
204
+ Group,
205
+ {
206
+ style: {
207
+ translateX: x + anchor,
208
+ translateY: y + height / 2,
209
+ rotationDegrees: label.rotationDegrees
210
+ },
211
+ children: /* @__PURE__ */ jsx(
212
+ Text,
213
+ {
214
+ pointerEvents: "none",
215
+ style: { textBaseline: "middle", fit: "ellipsis", ...paint, width },
216
+ children: label.text
217
+ }
218
+ )
219
+ }
220
+ );
221
+ }
222
+ function GraphView(props) {
223
+ const layout = resolveSignalValue(props.layout);
224
+ return /* @__PURE__ */ jsxs(Group, { style: props.style, children: [
225
+ layout.edges.map((edge) => /* @__PURE__ */ jsx(
226
+ Group,
227
+ {
228
+ onClick: (event) => props.onEdgeClick?.(edge, event),
229
+ children: props.renderEdge ? props.renderEdge(edge) : /* @__PURE__ */ jsx(
230
+ GraphEdge,
231
+ {
232
+ edge,
233
+ keyboardFocusable: Boolean(props.onEdgeClick),
234
+ style: {
235
+ ...defaultGraphEdgeStyle(edge),
236
+ ...resolveMarkStyle(edge, props.edgeStyle)
237
+ }
238
+ }
239
+ )
240
+ },
241
+ `e:${typeof edge.key}:${edge.key}`
242
+ )),
243
+ layout.nodes.map((node) => /* @__PURE__ */ jsx(
244
+ Group,
245
+ {
246
+ onClick: (event) => props.onNodeClick?.(node, event),
247
+ children: props.renderNode ? props.renderNode(node) : /* @__PURE__ */ jsxs(Group, { children: [
248
+ /* @__PURE__ */ jsx(
249
+ GraphNode,
250
+ {
251
+ node,
252
+ keyboardFocusable: Boolean(props.onNodeClick),
253
+ style: {
254
+ ...defaultGraphNodeStyle(node),
255
+ ...resolveMarkStyle(node, props.nodeStyle)
256
+ }
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsx(
260
+ GraphLabel,
261
+ {
262
+ label: node.label,
263
+ style: {
264
+ ...defaultGraphLabelStyle(node.label),
265
+ ...resolveMarkStyle(node, props.labelStyle)
266
+ }
267
+ }
268
+ ),
269
+ node.detail && /* @__PURE__ */ jsx(
270
+ GraphLabel,
271
+ {
272
+ label: node.detail,
273
+ style: {
274
+ ...defaultGraphLabelStyle(node.detail),
275
+ font: "11px sans-serif",
276
+ ...resolveMarkStyle(node, props.labelStyle)
277
+ }
278
+ }
279
+ )
280
+ ] })
281
+ },
282
+ `n:${typeof node.key}:${node.key}`
283
+ ))
284
+ ] });
285
+ }
286
+ export {
287
+ GraphEdge,
288
+ GraphLabel,
289
+ GraphNode,
290
+ GraphView,
291
+ defaultGraphEdgeStyle,
292
+ defaultGraphLabelStyle,
293
+ defaultGraphNodeStyle,
294
+ graphNodeGeometry,
295
+ readAccessor,
296
+ resolveMarkStyle,
297
+ useGraphFrame,
298
+ validKey,
299
+ validateBounds
300
+ };
301
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/features/viz/lib/graph/shared.tsx"],
4
+ "sourcesContent": ["import {\n Group,\n Rectangle,\n SvgPath,\n Text,\n resolveSignalValue,\n resolveBox,\n useLayoutBox,\n} from \"@pibbl/core\";\nimport type {\n GStyle,\n SystemStyle,\n PibblResponsiveStyle,\n PibblNode,\n} from \"@pibbl/core\";\nimport type {\n Accessor,\n Bounds,\n Style,\n MarkStyle,\n GraphNodeGeometry,\n GraphNodeProps,\n GraphEdgeGeometry,\n GraphEdgeProps,\n GraphLabelProps,\n GraphViewProps,\n LabelGeometry,\n NodeStyle,\n EdgeStyle,\n LabelStyle,\n VizKey,\n} from \"./types.js\";\nconst boundsKeys = [\"x\", \"y\", \"width\", \"height\"] as const;\nconst graphLayoutKeys = [\n \"rankGap\",\n \"nodeGap\",\n \"levelGap\",\n \"siblingGap\",\n \"cellGap\",\n \"rowLabelWidth\",\n \"columnLabelHeight\",\n \"nodeWidth\",\n \"columnGap\",\n \"headerHeight\",\n \"ringGap\",\n \"bandWidth\",\n \"padAngle\",\n \"startAngle\",\n ] as const;\n\n/** Read an application's typed property or accessor without normalizing away its record. */\nexport function readAccessor<D, V>(datum: D, accessor: Accessor<D, V>): V {\n return typeof accessor === \"function\"\n ? accessor(datum)\n : (datum[accessor] as V);\n}\n/** Validate a finite rectangle in local logical units. */\nexport function validateBounds(bounds: Bounds): Bounds {\n for (let keyIndex = 0; keyIndex < boundsKeys.length; keyIndex++) {\n const key = boundsKeys[keyIndex];\n if (\n !Number.isFinite(bounds[key]) ||\n ((key === \"width\" || key === \"height\") && bounds[key] < 0)\n )\n throw new RangeError(\n `Graph bounds.${key} must be finite${key === \"width\" || key === \"height\" ? \" and nonnegative\" : \"\"}.`,\n );\n }\n if (\n !Number.isFinite(bounds.x + bounds.width) ||\n !Number.isFinite(bounds.y + bounds.height)\n )\n throw new RangeError(\"Graph bounds overflow.\");\n return bounds;\n}\nexport function validKey(key: VizKey): VizKey {\n if (\n (typeof key !== \"string\" && typeof key !== \"number\") ||\n (typeof key === \"number\" && !Number.isFinite(key))\n )\n throw new TypeError(\"Graph keys must be strings or finite numbers.\");\n return key;\n}\n/** Resolve ordinary responsive frame style through public sizing and allocation. */\nexport function useGraphFrame<S extends GStyle>(\n input?: Style<S>,\n): { bounds: Bounds; style: S; groupStyle: GStyle } {\n const allocation = useLayoutBox();\n const authored = (resolveSignalValue(input) ?? {}) as PibblResponsiveStyle<S>;\n const merged = { ...authored } as Record<string, unknown>;\n for (const rule of authored.when ?? []) {\n const q = rule.query;\n if (\n (q.minWidth === undefined || allocation.width >= q.minWidth) &&\n (q.maxWidth === undefined || allocation.width <= q.maxWidth) &&\n (q.minHeight === undefined || allocation.height >= q.minHeight) &&\n (q.maxHeight === undefined || allocation.height <= q.maxHeight)\n )\n Object.assign(merged, rule.style);\n }\n delete merged.when;\n for (const key of Object.keys(merged))\n merged[key] = resolveSignalValue(merged[key]);\n if (merged.width === \"auto\" || merged.height === \"auto\")\n throw new RangeError(\n \"Graph frames require definite width and height or a finite parent allocation.\",\n );\n const style = merged as S;\n const box = resolveBox(\n {\n ...style,\n width: style.width ?? allocation.width,\n height: style.height ?? allocation.height,\n },\n {\n minWidth: 0,\n minHeight: 0,\n maxWidth: allocation.width,\n maxHeight: allocation.height,\n },\n );\n const bounds = validateBounds({\n x: 0,\n y: 0,\n width: box.borderBox.width,\n height: box.borderBox.height,\n });\n const groupStyle = { ...style, width: bounds.width, height: bounds.height };\n for (let keyIndex = 0; keyIndex < graphLayoutKeys.length; keyIndex++) {\n const key = graphLayoutKeys[keyIndex];\n delete (groupStyle as unknown as Record<string, unknown>)[key];\n }\n return { bounds, style, groupStyle };\n}\n/** Resolve a per-item paint callback without hiding its signal reads. */\nexport function resolveMarkStyle<G, S extends SystemStyle>(\n geometry: G,\n input?: MarkStyle<G, S>,\n): PibblResponsiveStyle<S> | undefined {\n return resolveSignalValue(\n typeof input === \"function\" ? input(geometry) : input,\n );\n}\n/** Build inspectable label regions and original-record node geometry. */\nexport function graphNodeGeometry<N>(\n datum: N,\n key: VizKey,\n bounds: Bounds,\n label = String(key),\n detail?: string,\n): GraphNodeGeometry<N> {\n return {\n key,\n datum,\n bounds,\n label: {\n text: label,\n bounds: {\n x: bounds.x + 10,\n y: bounds.y + 4,\n width: Math.max(0, bounds.width - 20),\n height: detail ? bounds.height / 2 : Math.max(0, bounds.height - 8),\n },\n rotationDegrees: 0,\n },\n detail:\n detail === undefined\n ? null\n : {\n text: detail,\n bounds: {\n x: bounds.x + 10,\n y: bounds.y + bounds.height / 2,\n width: Math.max(0, bounds.width - 20),\n height: bounds.height / 2 - 4,\n },\n rotationDegrees: 0,\n },\n };\n}\n/**\n * Return the built-in node paint as an ordinary reusable style.\n * @param _node - The node being painted. See {@link GraphNodeGeometry}.\n * @returns Default fill, stroke and corner radius. See {@link NodeStyle}.\n */\nexport function defaultGraphNodeStyle<N>(\n _node: GraphNodeGeometry<N>,\n): NodeStyle {\n return {\n fill: \"#edf5f2\",\n stroke: \"#8eb6aa\",\n strokeWidth: 1,\n cornerRadius: 7,\n };\n}\n/**\n * Return the built-in edge paint as an ordinary reusable style.\n * @param _edge - The edge being painted. See {@link GraphEdgeGeometry}.\n * @returns Default stroke and logical stroke width. See {@link EdgeStyle}.\n */\nexport function defaultGraphEdgeStyle<E>(\n _edge: GraphEdgeGeometry<E>,\n): EdgeStyle {\n return { stroke: \"#91a9a3\", strokeWidth: 1.5 };\n}\n/**\n * Return the built-in label paint as an ordinary reusable style.\n * @param _label - The label being painted. See {@link LabelGeometry}.\n * @returns Default Canvas font, fill and middle baseline. See {@link LabelStyle}.\n */\nexport function defaultGraphLabelStyle(_label: LabelGeometry): LabelStyle {\n return { fill: \"#203d39\", font: \"13px sans-serif\", textBaseline: \"middle\" };\n}\n/**\n * Draw a node box; children use node-local coordinates and ordinary Pibbl events.\n * @param props - Box geometry, paint and event handlers. See {@link GraphNodeProps}.\n * @returns A group containing the box and authored children. See {@link GraphNodeProps}.\n */\nexport function GraphNode<N>({\n node,\n style,\n children,\n ...events\n}: GraphNodeProps<N>): PibblNode {\n const { x, y, width, height } = node.bounds;\n const {\n keyboardFocusable,\n keyboardNavigationBounds,\n pointerEvents,\n ...handlers\n } = events;\n return (\n <Group {...handlers} style={{ translateX: x, translateY: y }}>\n <Rectangle\n keyboardFocusable={\n keyboardFocusable ??\n Boolean(handlers.onClick || handlers.onKeyDown || handlers.onKeyUp)\n }\n keyboardNavigationBounds={keyboardNavigationBounds}\n pointerEvents={pointerEvents}\n style={{ ...resolveSignalValue(style), width, height }}\n />\n {children}\n </Group>\n );\n}\n/**\n * Draw an edge path and optional arrow with ordinary path targeting.\n * @param props - Edge geometry, paint and event handlers. See {@link GraphEdgeProps}.\n * @returns Path content in diagram-local coordinates. See {@link GraphEdgeProps}.\n */\nexport function GraphEdge<E>({\n edge,\n style,\n ...events\n}: GraphEdgeProps<E>): PibblNode {\n const paint = resolveSignalValue(style);\n const {\n keyboardFocusable,\n keyboardNavigationBounds,\n pointerEvents,\n ...handlers\n } = events;\n return (\n <Group {...handlers}>\n <SvgPath\n keyboardFocusable={\n keyboardFocusable ??\n Boolean(handlers.onClick || handlers.onKeyDown || handlers.onKeyUp)\n }\n keyboardNavigationBounds={keyboardNavigationBounds}\n pointerEvents={pointerEvents}\n style={{ ...paint, d: edge.path }}\n />\n {edge.arrowPath && (\n <SvgPath\n pointerEvents={pointerEvents}\n style={{\n ...paint,\n fill: paint?.stroke ?? \"#91a9a3\",\n d: edge.arrowPath,\n }}\n />\n )}\n </Group>\n );\n}\n/**\n * Draw decorative label text at its supplied box and rotation.\n * @param props - Text geometry and optional text paint. See {@link GraphLabelProps}.\n * @returns A transformed decorative Text component. See {@link GraphLabelProps}.\n */\nexport function GraphLabel({ label, style }: GraphLabelProps): PibblNode {\n const { x, y, width, height } = label.bounds;\n const paint = resolveSignalValue(style);\n const align = resolveSignalValue(paint?.textAlign);\n const anchor =\n align === \"center\"\n ? width / 2\n : align === \"right\" || align === \"end\"\n ? width\n : 0;\n return (\n <Group\n style={{\n translateX: x + anchor,\n translateY: y + height / 2,\n rotationDegrees: label.rotationDegrees,\n }}\n >\n <Text\n pointerEvents=\"none\"\n style={{ textBaseline: \"middle\", fit: \"ellipsis\", ...paint, width }}\n >\n {label.text}\n </Text>\n </Group>\n );\n}\n/**\n * Render supplied graph geometry without layout, fitting, or simulation.\n * @param props - A snapshot or signal, item overrides and events. See {@link GraphViewProps}.\n * @returns An ordinary Pibbl composition preserving source paint order. See {@link GraphViewProps}.\n */\nexport function GraphView<N, E>(props: GraphViewProps<N, E>): PibblNode {\n const layout = resolveSignalValue(props.layout);\n return (\n <Group style={props.style}>\n {layout.edges.map((edge) => (\n <Group\n key={`e:${typeof edge.key}:${edge.key}`}\n onClick={(event) => props.onEdgeClick?.(edge, event)}\n >\n {props.renderEdge ? (\n props.renderEdge(edge)\n ) : (\n <GraphEdge\n edge={edge}\n keyboardFocusable={Boolean(props.onEdgeClick)}\n style={{\n ...defaultGraphEdgeStyle(edge),\n ...resolveMarkStyle(edge, props.edgeStyle),\n }}\n />\n )}\n </Group>\n ))}\n {layout.nodes.map((node) => (\n <Group\n key={`n:${typeof node.key}:${node.key}`}\n onClick={(event) => props.onNodeClick?.(node, event)}\n >\n {props.renderNode ? (\n props.renderNode(node)\n ) : (\n <Group>\n <GraphNode\n node={node}\n keyboardFocusable={Boolean(props.onNodeClick)}\n style={{\n ...defaultGraphNodeStyle(node),\n ...resolveMarkStyle(node, props.nodeStyle),\n }}\n />\n <GraphLabel\n label={node.label}\n style={{\n ...defaultGraphLabelStyle(node.label),\n ...resolveMarkStyle(node, props.labelStyle),\n }}\n />\n {node.detail && (\n <GraphLabel\n label={node.detail}\n style={{\n ...defaultGraphLabelStyle(node.detail),\n font: \"11px sans-serif\",\n ...resolveMarkStyle(node, props.labelStyle),\n }}\n />\n )}\n </Group>\n )}\n </Group>\n ))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;AAAA,cAC5C;AAAA;AAAA,UACF;AAAA,UACC,KAAK,UACJ;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,KAAK;AAAA,cACZ,OAAO;AAAA,gBACL,GAAG,uBAAuB,KAAK,MAAM;AAAA,gBACrC,MAAM;AAAA,gBACN,GAAG,iBAAiB,MAAM,MAAM,UAAU;AAAA,cAC5C;AAAA;AAAA,UACF;AAAA,WAEJ;AAAA;AAAA,MAhCG,KAAK,OAAO,KAAK,GAAG,IAAI,KAAK,GAAG;AAAA,IAkCvC,CACD;AAAA,KACH;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ import { type PibblNode } from "@pibbl/core";
2
+ import type { TidyTreeProps, TreeLayout, TreeOptions } from "./types.js";
3
+ /** Lay out a validated hierarchy with stable child order and variable node dimensions.
4
+ * @param root - Hierarchy root.
5
+ * @param options - Named hierarchy accessors and finite bounds.
6
+ * @returns Immutable node and edge geometry. @see {@link TreeLayout} */
7
+ export declare function layoutTree<D>(root: D, options: TreeOptions<D>): TreeLayout<D>;
8
+ /** Render a tidy hierarchy from ordinary data using default marks or caller compositions.
9
+ * @param props - Reactive hierarchy data, presentation, and frame style.
10
+ * @returns Canvas composition. @see {@link layoutTree} */
11
+ export declare function TidyTree<D>(props: TidyTreeProps<D>): PibblNode;
@@ -0,0 +1,232 @@
1
+ import { jsx, jsxs } from "@pibbl/core/jsx-runtime";
2
+ import { Group, resolveSignalValue } from "@pibbl/core";
3
+ import {
4
+ defaultGraphEdgeStyle,
5
+ defaultGraphLabelStyle,
6
+ defaultGraphNodeStyle,
7
+ GraphEdge,
8
+ GraphLabel,
9
+ GraphNode,
10
+ resolveMarkStyle,
11
+ useGraphFrame
12
+ } from "./shared.js";
13
+ import {
14
+ checkedBounds,
15
+ finiteGap,
16
+ finiteSize,
17
+ hierarchy,
18
+ hierarchyLabel
19
+ } from "./hierarchy.js";
20
+ function layoutTree(root, options) {
21
+ const bounds = checkedBounds(options.bounds, "layoutTree");
22
+ const siblingGap = finiteGap(options.siblingGap, 24, "layoutTree siblingGap");
23
+ const levelGap = finiteGap(options.levelGap, 48, "layoutTree levelGap");
24
+ const tree = hierarchy(root, options, "layoutTree");
25
+ const visible = (record) => record.collapsed ? [] : record.children;
26
+ const sizes = /* @__PURE__ */ new Map();
27
+ const spans = /* @__PURE__ */ new Map();
28
+ const depthHeights = [];
29
+ const measure = (record) => {
30
+ const size = finiteSize(record.datum, options.nodeSize, "layoutTree");
31
+ sizes.set(record, size);
32
+ depthHeights[record.depth] = Math.max(
33
+ depthHeights[record.depth] ?? 0,
34
+ size.height
35
+ );
36
+ const kids = visible(record);
37
+ const childSpan = kids.reduce(
38
+ (sum, child, index) => sum + measure(child) + (index ? siblingGap : 0),
39
+ 0
40
+ );
41
+ const span = Math.max(size.width, childSpan);
42
+ spans.set(record, span);
43
+ return span;
44
+ };
45
+ const totalWidth = measure(tree);
46
+ const totalHeight = depthHeights.reduce(
47
+ (sum, height, index) => sum + height + (index ? levelGap : 0),
48
+ 0
49
+ );
50
+ if (totalWidth > bounds.width || totalHeight > bounds.height)
51
+ throw new RangeError(
52
+ "layoutTree: bounds are too small for nodes and gaps."
53
+ );
54
+ const yAt = [];
55
+ let y = bounds.y;
56
+ for (let depth = 0; depth < depthHeights.length; depth++) {
57
+ yAt.push(y);
58
+ y += depthHeights[depth] + levelGap;
59
+ }
60
+ const positions = [];
61
+ const place = (record, left) => {
62
+ const span = spans.get(record);
63
+ const size = sizes.get(record);
64
+ const x = left + (span - size.width) / 2;
65
+ positions.push({ record, width: size.width, x });
66
+ let childLeft = left;
67
+ for (const child of visible(record)) {
68
+ place(child, childLeft);
69
+ childLeft += spans.get(child) + siblingGap;
70
+ }
71
+ };
72
+ place(tree, bounds.x + (bounds.width - totalWidth) / 2);
73
+ const nodes = positions.map(({ record, x }) => {
74
+ const size = sizes.get(record);
75
+ const box = Object.freeze({
76
+ x,
77
+ y: yAt[record.depth],
78
+ width: size.width,
79
+ height: size.height
80
+ });
81
+ return Object.freeze({
82
+ key: record.key,
83
+ datum: record.datum,
84
+ bounds: box,
85
+ label: hierarchyLabel(
86
+ record.datum,
87
+ options.label,
88
+ {
89
+ x: x + 10,
90
+ y: box.y + 10,
91
+ width: size.width - 20,
92
+ height: 18
93
+ },
94
+ String(record.key)
95
+ ),
96
+ detail: options.detail === void 0 ? null : hierarchyLabel(record.datum, options.detail, {
97
+ x: x + 10,
98
+ y: box.y + 31,
99
+ width: size.width - 20,
100
+ height: 16
101
+ }),
102
+ depth: record.depth,
103
+ parentKey: record.parent?.key ?? null,
104
+ hiddenChildren: record.hiddenChildren
105
+ });
106
+ });
107
+ const byKey = new Map(nodes.map((node) => [node.key, node]));
108
+ const edges = [];
109
+ for (const node of nodes)
110
+ if (node.parentKey !== null) {
111
+ const parent = byKey.get(node.parentKey);
112
+ const sourceAnchor = {
113
+ x: parent.bounds.x + parent.bounds.width / 2,
114
+ y: parent.bounds.y + parent.bounds.height
115
+ };
116
+ const targetAnchor = {
117
+ x: node.bounds.x + node.bounds.width / 2,
118
+ y: node.bounds.y
119
+ };
120
+ const bend = (sourceAnchor.y + targetAnchor.y) / 2;
121
+ const segments = Object.freeze([
122
+ { type: "move", ...sourceAnchor },
123
+ { type: "line", x: sourceAnchor.x, y: bend },
124
+ { type: "line", x: targetAnchor.x, y: bend },
125
+ { type: "line", ...targetAnchor }
126
+ ]);
127
+ edges.push(
128
+ Object.freeze({
129
+ key: `${String(parent.key)}\u2192${String(node.key)}`,
130
+ datum: { parent: parent.datum, child: node.datum },
131
+ sourceKey: parent.key,
132
+ targetKey: node.key,
133
+ route: Object.freeze({
134
+ sourceAnchor: Object.freeze(sourceAnchor),
135
+ targetAnchor: Object.freeze(targetAnchor),
136
+ segments,
137
+ arrowSegments: null
138
+ }),
139
+ path: `M ${sourceAnchor.x} ${sourceAnchor.y} L ${sourceAnchor.x} ${bend} L ${targetAnchor.x} ${bend} L ${targetAnchor.x} ${targetAnchor.y}`,
140
+ arrowPath: null
141
+ })
142
+ );
143
+ }
144
+ return Object.freeze({
145
+ bounds,
146
+ nodes: Object.freeze(nodes),
147
+ edges: Object.freeze(edges)
148
+ });
149
+ }
150
+ function TidyTree(props) {
151
+ const frame = useGraphFrame(props.style);
152
+ const root = resolveSignalValue(props.root);
153
+ if (frame.bounds.width === 0 || frame.bounds.height === 0)
154
+ return /* @__PURE__ */ jsx(Group, { style: frame.groupStyle, children: null });
155
+ const layout = layoutTree(root, {
156
+ ...props,
157
+ bounds: frame.bounds,
158
+ levelGap: frame.style.levelGap,
159
+ siblingGap: frame.style.siblingGap
160
+ });
161
+ return /* @__PURE__ */ jsxs(Group, { style: frame.groupStyle, children: [
162
+ layout.edges.map(
163
+ (edge) => props.renderEdge ? /* @__PURE__ */ jsx(
164
+ Group,
165
+ {
166
+ onClick: (event) => props.onEdgeClick?.(edge, event),
167
+ children: props.renderEdge(edge)
168
+ },
169
+ edge.key
170
+ ) : /* @__PURE__ */ jsx(
171
+ GraphEdge,
172
+ {
173
+ edge,
174
+ style: {
175
+ ...defaultGraphEdgeStyle(edge),
176
+ ...resolveMarkStyle(edge, props.edgeStyle)
177
+ },
178
+ onClick: (event) => props.onEdgeClick?.(edge, event)
179
+ },
180
+ edge.key
181
+ )
182
+ ),
183
+ layout.nodes.map(
184
+ (node) => props.renderNode ? /* @__PURE__ */ jsx(
185
+ Group,
186
+ {
187
+ onClick: (event) => props.onNodeClick?.(node, event),
188
+ children: props.renderNode(node)
189
+ },
190
+ node.key
191
+ ) : /* @__PURE__ */ jsxs(Group, { children: [
192
+ /* @__PURE__ */ jsx(
193
+ GraphNode,
194
+ {
195
+ node,
196
+ style: {
197
+ ...defaultGraphNodeStyle(node),
198
+ ...resolveMarkStyle(node, props.nodeStyle)
199
+ },
200
+ onClick: (event) => props.onNodeClick?.(node, event)
201
+ }
202
+ ),
203
+ /* @__PURE__ */ jsx(
204
+ GraphLabel,
205
+ {
206
+ label: node.label,
207
+ style: {
208
+ ...defaultGraphLabelStyle(node.label),
209
+ ...resolveMarkStyle(node, props.labelStyle)
210
+ }
211
+ }
212
+ ),
213
+ node.detail && /* @__PURE__ */ jsx(
214
+ GraphLabel,
215
+ {
216
+ label: node.detail,
217
+ style: {
218
+ ...defaultGraphLabelStyle(node.detail),
219
+ font: "11px sans-serif",
220
+ ...resolveMarkStyle(node, props.labelStyle)
221
+ }
222
+ }
223
+ )
224
+ ] }, node.key)
225
+ )
226
+ ] });
227
+ }
228
+ export {
229
+ TidyTree,
230
+ layoutTree
231
+ };
232
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/features/viz/lib/graph/tree.tsx"],
4
+ "sourcesContent": ["import { Group, resolveSignalValue, type PibblNode } from \"@pibbl/core\";\nimport {\n defaultGraphEdgeStyle,\n defaultGraphLabelStyle,\n defaultGraphNodeStyle,\n GraphEdge,\n GraphLabel,\n GraphNode,\n resolveMarkStyle,\n useGraphFrame,\n} from \"./shared.js\";\nimport type {\n GraphEdgeGeometry,\n TidyTreeProps,\n TreeEdge,\n TreeLayout,\n TreeNodeGeometry,\n TreeOptions,\n TreeStyle,\n} from \"./types.js\";\nimport {\n checkedBounds,\n finiteGap,\n finiteSize,\n hierarchy,\n hierarchyLabel,\n type HierarchyRecord,\n} from \"./hierarchy.js\";\n\ninterface Positioned<D> {\n record: HierarchyRecord<D>;\n width: number;\n x: number;\n}\n\n/** Lay out a validated hierarchy with stable child order and variable node dimensions.\n * @param root - Hierarchy root.\n * @param options - Named hierarchy accessors and finite bounds.\n * @returns Immutable node and edge geometry. @see {@link TreeLayout} */\nexport function layoutTree<D>(root: D, options: TreeOptions<D>): TreeLayout<D> {\n const bounds = checkedBounds(options.bounds, \"layoutTree\");\n const siblingGap = finiteGap(options.siblingGap, 24, \"layoutTree siblingGap\");\n const levelGap = finiteGap(options.levelGap, 48, \"layoutTree levelGap\");\n const tree = hierarchy(root, options, \"layoutTree\");\n const visible = (record: HierarchyRecord<D>) =>\n record.collapsed ? [] : record.children;\n const sizes = new Map<\n HierarchyRecord<D>,\n { width: number; height: number }\n >();\n const spans = new Map<HierarchyRecord<D>, number>();\n const depthHeights: number[] = [];\n const measure = (record: HierarchyRecord<D>): number => {\n const size = finiteSize(record.datum, options.nodeSize, \"layoutTree\");\n sizes.set(record, size);\n depthHeights[record.depth] = Math.max(\n depthHeights[record.depth] ?? 0,\n size.height,\n );\n const kids = visible(record);\n const childSpan = kids.reduce(\n (sum, child, index) => sum + measure(child) + (index ? siblingGap : 0),\n 0,\n );\n const span = Math.max(size.width, childSpan);\n spans.set(record, span);\n return span;\n };\n const totalWidth = measure(tree);\n const totalHeight = depthHeights.reduce(\n (sum, height, index) => sum + height + (index ? levelGap : 0),\n 0,\n );\n if (totalWidth > bounds.width || totalHeight > bounds.height)\n throw new RangeError(\n \"layoutTree: bounds are too small for nodes and gaps.\",\n );\n const yAt: number[] = [];\n let y = bounds.y;\n for (let depth = 0; depth < depthHeights.length; depth++) {\n yAt.push(y);\n y += depthHeights[depth] + levelGap;\n }\n const positions: Positioned<D>[] = [];\n const place = (record: HierarchyRecord<D>, left: number) => {\n const span = spans.get(record)!;\n const size = sizes.get(record)!;\n const x = left + (span - size.width) / 2;\n positions.push({ record, width: size.width, x });\n let childLeft = left;\n for (const child of visible(record)) {\n place(child, childLeft);\n childLeft += spans.get(child)! + siblingGap;\n }\n };\n place(tree, bounds.x + (bounds.width - totalWidth) / 2);\n const nodes = positions.map(({ record, x }) => {\n const size = sizes.get(record)!;\n const box = Object.freeze({\n x,\n y: yAt[record.depth],\n width: size.width,\n height: size.height,\n });\n return Object.freeze({\n key: record.key,\n datum: record.datum,\n bounds: box,\n label: hierarchyLabel(\n record.datum,\n options.label,\n {\n x: x + 10,\n y: box.y + 10,\n width: size.width - 20,\n height: 18,\n },\n String(record.key),\n ),\n detail:\n options.detail === undefined\n ? null\n : hierarchyLabel(record.datum, options.detail, {\n x: x + 10,\n y: box.y + 31,\n width: size.width - 20,\n height: 16,\n }),\n depth: record.depth,\n parentKey: record.parent?.key ?? null,\n hiddenChildren: record.hiddenChildren,\n } satisfies TreeNodeGeometry<D>);\n });\n const byKey = new Map(nodes.map((node) => [node.key, node]));\n const edges: GraphEdgeGeometry<TreeEdge<D>>[] = [];\n for (const node of nodes)\n if (node.parentKey !== null) {\n const parent = byKey.get(node.parentKey)!;\n const sourceAnchor = {\n x: parent.bounds.x + parent.bounds.width / 2,\n y: parent.bounds.y + parent.bounds.height,\n };\n const targetAnchor = {\n x: node.bounds.x + node.bounds.width / 2,\n y: node.bounds.y,\n };\n const bend = (sourceAnchor.y + targetAnchor.y) / 2;\n const segments = Object.freeze([\n { type: \"move\" as const, ...sourceAnchor },\n { type: \"line\" as const, x: sourceAnchor.x, y: bend },\n { type: \"line\" as const, x: targetAnchor.x, y: bend },\n { type: \"line\" as const, ...targetAnchor },\n ]);\n edges.push(\n Object.freeze({\n key: `${String(parent.key)}\u2192${String(node.key)}`,\n datum: { parent: parent.datum, child: node.datum },\n sourceKey: parent.key,\n targetKey: node.key,\n route: Object.freeze({\n sourceAnchor: Object.freeze(sourceAnchor),\n targetAnchor: Object.freeze(targetAnchor),\n segments,\n arrowSegments: null,\n }),\n path: `M ${sourceAnchor.x} ${sourceAnchor.y} L ${sourceAnchor.x} ${bend} L ${targetAnchor.x} ${bend} L ${targetAnchor.x} ${targetAnchor.y}`,\n arrowPath: null,\n }),\n );\n }\n return Object.freeze({\n bounds,\n nodes: Object.freeze(nodes),\n edges: Object.freeze(edges),\n });\n}\n\n/** Render a tidy hierarchy from ordinary data using default marks or caller compositions.\n * @param props - Reactive hierarchy data, presentation, and frame style.\n * @returns Canvas composition. @see {@link layoutTree} */\nexport function TidyTree<D>(props: TidyTreeProps<D>): PibblNode {\n const frame = useGraphFrame<TreeStyle>(props.style);\n const root = resolveSignalValue(props.root);\n if (frame.bounds.width === 0 || frame.bounds.height === 0)\n return <Group style={frame.groupStyle}>{null}</Group>;\n const layout = layoutTree(root, {\n ...props,\n bounds: frame.bounds,\n levelGap: frame.style.levelGap,\n siblingGap: frame.style.siblingGap,\n });\n return (\n <Group style={frame.groupStyle}>\n {layout.edges.map((edge) =>\n props.renderEdge ? (\n <Group\n key={edge.key}\n onClick={(event) => props.onEdgeClick?.(edge, event)}\n >\n {props.renderEdge(edge)}\n </Group>\n ) : (\n <GraphEdge\n key={edge.key}\n edge={edge}\n style={{\n ...defaultGraphEdgeStyle(edge),\n ...resolveMarkStyle(edge, props.edgeStyle),\n }}\n onClick={(event) => props.onEdgeClick?.(edge, event)}\n />\n ),\n )}\n {layout.nodes.map((node) =>\n props.renderNode ? (\n <Group\n key={node.key}\n onClick={(event) => props.onNodeClick?.(node, event)}\n >\n {props.renderNode(node)}\n </Group>\n ) : (\n <Group key={node.key}>\n <GraphNode\n node={node}\n style={{\n ...defaultGraphNodeStyle(node),\n ...resolveMarkStyle(node, props.nodeStyle),\n }}\n onClick={(event) => props.onNodeClick?.(node, event)}\n />\n <GraphLabel\n label={node.label}\n style={{\n ...defaultGraphLabelStyle(node.label),\n ...resolveMarkStyle(node, props.labelStyle),\n }}\n />\n {node.detail && (\n <GraphLabel\n label={node.detail}\n style={{\n ...defaultGraphLabelStyle(node.detail),\n font: \"11px sans-serif\",\n ...resolveMarkStyle(node, props.labelStyle),\n }}\n />\n )}\n </Group>\n ),\n )}\n </Group>\n );\n}\n"],
5
+ "mappings": "AAwLW,cAsCD,YAtCC;AAxLX,SAAS,OAAO,0BAA0C;AAC1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAYA,SAAS,WAAc,MAAS,SAAwC;AAC7E,QAAM,SAAS,cAAc,QAAQ,QAAQ,YAAY;AACzD,QAAM,aAAa,UAAU,QAAQ,YAAY,IAAI,uBAAuB;AAC5E,QAAM,WAAW,UAAU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A;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,OAAO;AAAA,cACL,GAAG,sBAAsB,IAAI;AAAA,cAC7B,GAAG,iBAAiB,MAAM,MAAM,SAAS;AAAA,YAC3C;AAAA,YACA,SAAS,CAAC,UAAU,MAAM,cAAc,MAAM,KAAK;AAAA;AAAA,QACrD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK;AAAA,YACZ,OAAO;AAAA,cACL,GAAG,uBAAuB,KAAK,KAAK;AAAA,cACpC,GAAG,iBAAiB,MAAM,MAAM,UAAU;AAAA,YAC5C;AAAA;AAAA,QACF;AAAA,QACC,KAAK,UACJ;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK;AAAA,YACZ,OAAO;AAAA,cACL,GAAG,uBAAuB,KAAK,MAAM;AAAA,cACrC,MAAM;AAAA,cACN,GAAG,iBAAiB,MAAM,MAAM,UAAU;AAAA,YAC5C;AAAA;AAAA,QACF;AAAA,WAxBQ,KAAK,GA0BjB;AAAA,IAEJ;AAAA,KACF;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ import type { NodeStyle } from "./types.js";
2
+ import { type PibblNode } from "@pibbl/core";
3
+ import type { PartitionCellGeometry, PartitionLayout, PartitionCellProps, TreemapOptions, TreemapProps } from "./types.js";
4
+ /** Return the built-in depth-aware partition paint.
5
+ * @param cell - Partition cell geometry.
6
+ * @returns Ordinary rectangle style. @see {@link PartitionCellGeometry} */
7
+ export declare function defaultPartitionCellStyle<D>(cell: PartitionCellGeometry<D>): NodeStyle;
8
+ /** Squarify weighted hierarchy leaves into stable, compact rectangles.
9
+ * @param root - Hierarchy root.
10
+ * @param options - Accessors, units, and finite bounds.
11
+ * @returns Immutable partition geometry. @see {@link PartitionLayout} */
12
+ export declare function layoutTreemap<D>(root: D, options: TreemapOptions<D>): PartitionLayout<D>;
13
+ /** Paint one partition cell at its immutable geometry.
14
+ * @param props - Cell geometry, paint, events, and optional global-coordinate children.
15
+ * @returns Canvas composition. @see {@link PartitionCellGeometry} */
16
+ export declare function TreemapCell<D>(props: PartitionCellProps<D>): PibblNode;
17
+ /** Render a squarified hierarchy with visible quantitative labels.
18
+ * @param props - Reactive hierarchy data and presentation.
19
+ * @returns Canvas composition. @see {@link layoutTreemap} */
20
+ export declare function Treemap<D>(props: TreemapProps<D>): PibblNode;