@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
@@ -5,7 +5,7 @@ import type { PibblElementSource } from '../element/metadata.js';
5
5
  import type { PibblNode, PibblNodeInput } from '../element/types.js';
6
6
  import type { PibblHitTestOutput } from '../events/paint-entry.js';
7
7
  import type { PibblEventFocusOptions, PibblEventHandlers } from '../events/types.js';
8
- import type { MeasureInput, MeasureResult, NormalizedStyle, PreservedSignalPropKey, PrimitiveProgramProps, ResolvedStyle, SpecifiedStyle, StyleResolutionContext, SystemStyle, Canvas, RenderingContext2D } from '../types.js';
8
+ import type { MeasureInput, IntrinsicMeasureInput, IntrinsicSizesResult, BaselineMeasureInput, BaselinesResult, MeasureResult, NormalizedStyle, PreservedSignalPropKey, PrimitiveProgramProps, ResolvedStyle, SpecifiedStyle, StyleResolutionContext, SystemStyle, Canvas, RenderingContext2D } from '../types.js';
9
9
  import type { RenderTargetSnapshot } from '../render-target.js';
10
10
  declare const PIBBL_BACKEND_TOKEN: unique symbol;
11
11
  /**
@@ -100,6 +100,18 @@ export interface PibblBackendPrimitiveDefinition<P = any, S extends SystemStyle
100
100
  * @returns Measured dimensions or an unsupported measurement result. See {@link MeasureResult}.
101
101
  */
102
102
  readonly measure?: (input: MeasureInput<PrimitiveProgramProps<P>, N>) => MeasureResult;
103
+ /**
104
+ * Pure intrinsic content provider. See {@link IntrinsicMeasureInput}.
105
+ * @param input - Resolved inputs and tagged availability. See {@link IntrinsicMeasureInput}.
106
+ * @returns Paired content sizes or unsupported. See {@link IntrinsicSizesResult}.
107
+ */
108
+ readonly measureIntrinsic?: (input: IntrinsicMeasureInput<PrimitiveProgramProps<P>, N>) => IntrinsicSizesResult;
109
+ /**
110
+ * Pure first/last baseline provider at the final content allocation.
111
+ * @param input - Resolved inputs and final local allocation. See {@link BaselineMeasureInput}.
112
+ * @returns Finite ordered offsets or unsupported. See {@link BaselinesResult}.
113
+ */
114
+ readonly measureBaselines?: (input: BaselineMeasureInput<PrimitiveProgramProps<P>, N>) => BaselinesResult;
103
115
  }
104
116
  /**
105
117
  * Inputs used to begin a backend frame.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/backend/types.ts"],
4
- "sourcesContent": ["import type { registerNestedInteractionResolver, useBackendEventTarget } from '../../internal.js';\nimport type { mountBackendPibbl } from '../mount-pibbl.js';\nimport type { defineBackendPrimitive } from '../define-primitive.js';\nimport type { PibblElementSource } from '../element/metadata.js';\nimport type { PibblNode, PibblNodeInput } from '../element/types.js';\nimport type { PibblHitTestOutput } from '../events/paint-entry.js';\nimport type { PibblEventFocusOptions, PibblEventHandlers } from '../events/types.js';\nimport type {\n MeasureInput,\n MeasureResult,\n NormalizedStyle,\n PreservedSignalPropKey,\n PrimitiveProgramProps,\n ResolvedStyle,\n SpecifiedStyle,\n StyleResolutionContext,\n SystemStyle,\n Canvas,\n RenderingContext2D,\n} from '../types.js';\nimport type { RenderTargetSnapshot } from '../render-target.js';\n\ndeclare const PIBBL_BACKEND_TOKEN: unique symbol;\n\n/**\n * Opaque identity for one official Pibbl rendering backend.\n *\n * @see {@link createBackendToken}\n * @see {@link PibblBackendDriver}\n * @see {@link PibblBackendPrimitiveDefinition}\n */\nexport interface PibblBackendToken {\n readonly [PIBBL_BACKEND_TOKEN]: true;\n}\n\nconst backendNames = new WeakMap<PibblBackendToken, string>();\n\n/**\n * Creates a package-private backend identity for an official Pibbl renderer.\n *\n * @param name - Diagnostic name identifying the backend.\n * @returns A unique backend identity token. See {@link PibblBackendToken}.\n *\n * @see {@link PibblBackendToken}\n */\nexport function createBackendToken(name: string): PibblBackendToken {\n if (!name.trim()) {\n throw new Error('Pibbl backend names must be nonempty.');\n }\n const token = Object.freeze({}) as PibblBackendToken;\n backendNames.set(token, name);\n return token;\n}\n\n/** @internal Used only for diagnostics and dispatch inside core. */\nexport function getBackendTokenName(token: PibblBackendToken): string {\n return backendNames.get(token) ?? 'unknown';\n}\n\n/**\n * Executable primitive rendering program recognized by the backend.\n *\n * @param props - Resolved non-style component inputs. See {@link PrimitiveProgramProps}.\n * @param style - Resolved primitive style. See {@link ResolvedStyle}.\n * @param environment - Backend environment for the active frame.\n * @returns Child nodes to traverse, or no children. See {@link PibblNodeInput}.\n *\n * @see {@link SystemStyle}\n * @see {@link PrimitiveProgramProps}\n * @see {@link ResolvedStyle}\n * @see {@link PibblNodeInput}\n * @see {@link PibblBackendPrimitiveDefinition}\n * @see {@link defineBackendPrimitive}\n */\nexport type PibblBackendPrimitiveProgram<\n P = any,\n R extends SystemStyle = SystemStyle,\n E = any,\n> = (\n props: Readonly<PrimitiveProgramProps<P>>,\n style: ResolvedStyle<R>,\n environment: E,\n) => PibblNodeInput | void;\n\n/**\n * Rendering, style, and measurement definition of a backend primitive.\n *\n * @see {@link SystemStyle}\n * @see {@link PibblBackendToken}\n * @see {@link PibblBackendPrimitiveProgram}\n * @see {@link SpecifiedStyle}\n * @see {@link NormalizedStyle}\n * @see {@link StyleResolutionContext}\n * @see {@link ResolvedStyle}\n * @see {@link MeasureInput}\n * @see {@link PrimitiveProgramProps}\n * @see {@link MeasureResult}\n * @see {@link PibblBackendPrimitiveInput}\n */\nexport interface PibblBackendPrimitiveDefinition<\n P = any,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n E = any,\n> {\n /** Identity of the backend that accepts this primitive. See {@link PibblBackendToken}. */\n readonly backend: PibblBackendToken;\n /**\n * Names props whose signal identity is preserved for the primitive program. See\n * {@link PreservedSignalPropKey}.\n */\n readonly preserveSignalProps?: readonly PreservedSignalPropKey<P>[];\n /**\n * Declares how the primitive receives and resolves its children. See\n * {@link PibblBackendPrimitiveDefinition}.\n */\n readonly childInput?: 'structural' | 'text';\n /** Executable primitive program used by the backend. See {@link PibblBackendPrimitiveProgram}. */\n readonly program: PibblBackendPrimitiveProgram<P, R, E>;\n /**\n * Applies primitive defaults and shorthand normalization before layout resolution. See\n * {@link SpecifiedStyle}, {@link NormalizedStyle}.\n * @param style - Specified style values before normalization. See {@link SpecifiedStyle}.\n * @returns Normalized style with the primitive's shorthand and defaults applied. See\n * {@link NormalizedStyle} .\n */\n readonly normalizeStyle?: (style: SpecifiedStyle<S>) => NormalizedStyle<N>;\n /**\n * Resolves normalized style using the current layout context. See {@link NormalizedStyle},\n * {@link StyleResolutionContext}, {@link ResolvedStyle}.\n * @param style - Normalized style to resolve. See {@link NormalizedStyle}.\n * @param context - Layout and diagnostic context for resolution. See\n * {@link StyleResolutionContext} .\n * @returns Resolved style ready for rendering. See {@link ResolvedStyle}.\n */\n readonly resolveStyle?: (\n style: NormalizedStyle<N>,\n context: Readonly<StyleResolutionContext>,\n ) => ResolvedStyle<R>;\n /**\n * Measures declared primitive inputs without painting or retaining draw commands. See\n * {@link MeasureInput}, {@link PrimitiveProgramProps}, {@link MeasureResult}.\n * @param input - Props, normalized style, constraints, and nested measurement services. See\n * {@link MeasureInput} , {@link PrimitiveProgramProps} .\n * @returns Measured dimensions or an unsupported measurement result. See {@link MeasureResult}.\n */\n readonly measure?: (input: MeasureInput<PrimitiveProgramProps<P>, N>) => MeasureResult;\n}\n\n/**\n * Inputs used to begin a backend frame.\n *\n * @see {@link Canvas}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendFrameInput {\n /** Canvas surface associated with this resource or mount. See {@link Canvas}. */\n readonly canvas: Canvas;\n /** Canvas width in logical units. See {@link PibblBackendFrameInput}. */\n readonly logicalWidth: number;\n /** Canvas height in logical units. See {@link PibblBackendFrameInput}. */\n readonly logicalHeight: number;\n /** Width of the backing raster in physical pixels. See {@link PibblBackendFrameInput}. */\n readonly backingWidth: number;\n /** Height of the backing raster in physical pixels. See {@link PibblBackendFrameInput}. */\n readonly backingHeight: number;\n /** Timestamp associated with this render frame. See {@link PibblBackendFrameInput}. */\n readonly renderTimestamp: number;\n}\n\n/**\n * The backend rendering context for one scheduled frame.\n *\n * @see {@link RenderingContext2D}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendFrame<E> {\n /** Backend environment used while evaluating the frame. See {@link PibblBackendFrame}. */\n readonly environment: E;\n /** Canvas 2D context used for the current frame. See {@link RenderingContext2D}. */\n readonly context2D?: RenderingContext2D;\n /** Current drawing target owned by the backend frame. See {@link RenderTargetSnapshot}. */\n readonly renderTarget?: RenderTargetSnapshot;\n /**\n * World transform establishing the backend frame's logical coordinate basis. See\n * {@link PibblBackendFrame}.\n */\n readonly worldBaseTransform?: DOMMatrix;\n}\n\n/**\n * Resolved inputs delivered to a backend primitive program.\n *\n * @see {@link PibblElementSource}\n * @see {@link PibblBackendPrimitiveDefinition}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendPrimitiveInput {\n /** Component name retained for diagnostics. See {@link PibblBackendPrimitiveInput}. */\n readonly componentName: string;\n /** Authoring source location retained for diagnostics. See {@link PibblElementSource}. */\n readonly source?: PibblElementSource;\n /**\n * Primitive definition used to resolve and render the supplied inputs. See\n * {@link PibblBackendPrimitiveDefinition}.\n */\n readonly definition: PibblBackendPrimitiveDefinition;\n /**\n * Component props supplied to evaluation or measurement. See {@link PibblBackendPrimitiveInput}.\n */\n readonly props: Readonly<Record<PropertyKey, unknown>>;\n /** Declared presentation and layout properties. See {@link PibblBackendPrimitiveInput}. */\n readonly style: Readonly<Record<PropertyKey, unknown>>;\n /**\n * Transform applied to the primitive's presented Canvas geometry. See\n * {@link PibblBackendPrimitiveInput}.\n */\n readonly presentationTransform2D?: DOMMatrix;\n}\n\n/**\n * A mounted backend's frame execution and cleanup operations.\n *\n * @see {@link Canvas}\n * @see {@link PibblNode}\n * @see {@link PibblNestedResolverInput}\n * @see {@link mountBackendPibbl}\n */\nexport interface PibblBackendMount {\n /** Canvas surface associated with this resource or mount. See {@link Canvas}. */\n readonly canvas: Canvas;\n /**\n * Updates the backend surface to the supplied dimensions. See {@link PibblBackendMount}.\n * @param logicalWidth - New logical viewport width.\n * @param logicalHeight - New logical viewport height.\n */\n resize(logicalWidth: number, logicalHeight: number): void;\n /**\n * Renders the current data or resources using the supplied context. See {@link PibblBackendMount}\n * .\n * @param root - Node tree to render. See {@link PibblNode}.\n * @param timestamp - Frame timestamp in milliseconds.\n */\n render(root: PibblNode, timestamp: number): void;\n /**\n * Requests future work from the owning scheduler. See {@link PibblBackendMount}.\n * @param updateParents - Whether ancestor compositions also need to be scheduled.\n */\n requestFrame(updateParents: boolean): void;\n /** Releases resources owned by this mounted object. See {@link PibblBackendMount}. */\n dispose(): void;\n}\n\n/**\n * Version-coupled rendering backend lifecycle used by official integrations.\n *\n * @see {@link PibblBackendToken}\n * @see {@link PibblBackendFrameInput}\n * @see {@link PibblBackendFrame}\n * @see {@link PibblBackendPrimitiveInput}\n * @see {@link PibblNodeInput}\n * @see {@link PibblBackendMountOptions}\n */\nexport interface PibblBackendDriver<E> {\n /** Identity token distinguishing this backend driver. See {@link PibblBackendToken}. */\n readonly token: PibblBackendToken;\n /** Name identifying this backend, emitter, or parameter. See {@link PibblBackendDriver}. */\n readonly name: string;\n /**\n * Begins backend work for one shared scheduler frame. See {@link PibblBackendFrame}.\n * @param input - Root surface, timestamp, and logical dimensions for this render. See\n * {@link PibblBackendFrameInput} .\n * @returns Frame state, or undefined when no frame should be rendered. See\n * {@link PibblBackendFrame} .\n */\n beginFrame(input: PibblBackendFrameInput): PibblBackendFrame<E> | undefined;\n /**\n * Enters a component's backend evaluation scope. See {@link PibblBackendDriver}.\n * @param frame - Frame whose component environment should become active. See\n * {@link PibblBackendFrame} .\n * @returns A cleanup function restoring the previous environment.\n */\n enterComponent(frame: PibblBackendFrame<E>): () => void;\n /**\n * Runs a primitive's drawing program in the current backend frame. See {@link PibblBackendDriver}\n * .\n * @param frame - Active backend frame. See {@link PibblBackendFrame}.\n * @param input - Primitive descriptor and resolved rendering inputs. See\n * {@link PibblBackendPrimitiveInput} .\n * @param runProgram - Runtime callback used to invoke the primitive program. See\n * {@link PibblNodeInput} .\n */\n runPrimitive(\n frame: PibblBackendFrame<E>,\n input: PibblBackendPrimitiveInput,\n runProgram: (invoke: () => PibblNodeInput | void) => void,\n ): void;\n /**\n * Completes the backend frame and its pending composition work. See {@link PibblBackendDriver}.\n * @param frame - Frame returned by beginFrame. See {@link PibblBackendFrame}.\n * @param success - Whether traversal completed successfully.\n */\n finishFrame(frame: PibblBackendFrame<E>, success: boolean): void;\n /** Releases resources owned by this mounted object. See {@link PibblBackendDriver}. */\n dispose(): void;\n}\n\n/**\n * Canvas, configuration, and ownership inputs used to create a backend mount.\n *\n * @see {@link Canvas}\n * @see {@link PibblBackendDriver}\n * @see {@link mountBackendPibbl}\n */\nexport interface PibblBackendMountOptions<E> {\n /** Owning parent runtime instance. See {@link Canvas}. */\n readonly parent: Canvas;\n /** Canvas width in logical units. See {@link PibblBackendMountOptions}. */\n readonly logicalWidth: number;\n /** Canvas height in logical units. See {@link PibblBackendMountOptions}. */\n readonly logicalHeight: number;\n /** Backend driver responsible for this mount. See {@link PibblBackendDriver}. */\n readonly driver: PibblBackendDriver<E>;\n}\n\n/**\n * Backend target registration options with logical interaction geometry.\n *\n * @see {@link useBackendEventTarget}\n */\nexport interface PibblBackendEventTargetOptions extends PibblEventFocusOptions {\n /**\n * Cursor shown while this target owns pointer presentation. See\n * {@link PibblBackendEventTargetOptions}.\n */\n readonly cursor?: string;\n /** Defers backend-owned focus geometry until its visual generation commits. */\n readonly deferKeyboardNavigationGeometry?: boolean;\n}\n\n/**\n * Context supplied when resolving nested content through a backend.\n *\n * @see {@link PibblBackendMount}\n * @see {@link PibblHitTestOutput}\n * @see {@link registerNestedInteractionResolver}\n */\nexport interface PibblNestedResolverInput {\n /** Nested child content to resolve. See {@link PibblBackendMount}. */\n readonly child: PibblBackendMount;\n /** Logical region constraining the content or query. See {@link PibblNestedResolverInput}. */\n readonly bounds: Path2D;\n /** Whether this content participates in pointer targeting. See {@link PibblNestedResolverInput}. */\n readonly pointerEvents: 'auto' | 'none';\n /**\n * Resolves nested content in the current local coordinate system. See\n * {@link PibblNestedResolverInput}.\n * @param localX - Horizontal position in resolver-local coordinates.\n * @param localY - Vertical position in resolver-local coordinates.\n * @param output - Mutable hit-test result to populate. See {@link PibblHitTestOutput}.\n */\n resolveLocal(localX: number, localY: number, output: PibblHitTestOutput): void;\n}\n\n/** @internal */\nexport function backendMismatchError(\n componentName: string,\n required: PibblBackendToken,\n active: PibblBackendDriver<unknown>,\n source?: PibblElementSource,\n): Error {\n const requiredName = getBackendTokenName(required);\n const prefix = `${componentName} requires the ${requiredName} backend and ` +\n `cannot render in the ${active.name} root.`;\n return new Error(withJSXSource(prefix, source));\n}\n\nfunction withJSXSource(message: string, source?: PibblElementSource): string {\n return source ?\n `${message} JSX source: ${source.fileName}:${source.lineNumber}:${source.columnNumber}.` :\n message;\n}\n\nexport type { PibblEventHandlers };\n"],
5
- "mappings": "AAmCA,MAAM,eAAe,oBAAI,QAAmC;AAUrD,SAAS,mBAAmB,MAAiC;AAClE,MAAI,CAAC,KAAK,KAAK,GAAG;AAChB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,QAAM,QAAQ,OAAO,OAAO,CAAC,CAAC;AAC9B,eAAa,IAAI,OAAO,IAAI;AAC5B,SAAO;AACT;AAGO,SAAS,oBAAoB,OAAkC;AACpE,SAAO,aAAa,IAAI,KAAK,KAAK;AACpC;AAqTO,SAAS,qBACd,eACA,UACA,QACA,QACO;AACP,QAAM,eAAe,oBAAoB,QAAQ;AACjD,QAAM,SAAS,GAAG,aAAa,iBAAiB,YAAY,qCAClC,OAAO,IAAI;AACrC,SAAO,IAAI,MAAM,cAAc,QAAQ,MAAM,CAAC;AAChD;AAEA,SAAS,cAAc,SAAiB,QAAqC;AAC3E,SAAO,SACH,GAAG,OAAO,gBAAgB,OAAO,QAAQ,IAAI,OAAO,UAAU,IAAI,OAAO,YAAY,MACvF;AACJ;",
4
+ "sourcesContent": ["import type { registerNestedInteractionResolver, useBackendEventTarget } from '../../internal.js';\nimport type { mountBackendPibbl } from '../mount-pibbl.js';\nimport type { defineBackendPrimitive } from '../define-primitive.js';\nimport type { PibblElementSource } from '../element/metadata.js';\nimport type { PibblNode, PibblNodeInput } from '../element/types.js';\nimport type { PibblHitTestOutput } from '../events/paint-entry.js';\nimport type { PibblEventFocusOptions, PibblEventHandlers } from '../events/types.js';\nimport type {\n MeasureInput,\n IntrinsicMeasureInput,\n IntrinsicSizesResult,\n BaselineMeasureInput,\n BaselinesResult,\n MeasureResult,\n NormalizedStyle,\n PreservedSignalPropKey,\n PrimitiveProgramProps,\n ResolvedStyle,\n SpecifiedStyle,\n StyleResolutionContext,\n SystemStyle,\n Canvas,\n RenderingContext2D,\n} from '../types.js';\nimport type { RenderTargetSnapshot } from '../render-target.js';\n\ndeclare const PIBBL_BACKEND_TOKEN: unique symbol;\n\n/**\n * Opaque identity for one official Pibbl rendering backend.\n *\n * @see {@link createBackendToken}\n * @see {@link PibblBackendDriver}\n * @see {@link PibblBackendPrimitiveDefinition}\n */\nexport interface PibblBackendToken {\n readonly [PIBBL_BACKEND_TOKEN]: true;\n}\n\nconst backendNames = new WeakMap<PibblBackendToken, string>();\n\n/**\n * Creates a package-private backend identity for an official Pibbl renderer.\n *\n * @param name - Diagnostic name identifying the backend.\n * @returns A unique backend identity token. See {@link PibblBackendToken}.\n *\n * @see {@link PibblBackendToken}\n */\nexport function createBackendToken(name: string): PibblBackendToken {\n if (!name.trim()) {\n throw new Error('Pibbl backend names must be nonempty.');\n }\n const token = Object.freeze({}) as PibblBackendToken;\n backendNames.set(token, name);\n return token;\n}\n\n/** @internal Used only for diagnostics and dispatch inside core. */\nexport function getBackendTokenName(token: PibblBackendToken): string {\n return backendNames.get(token) ?? 'unknown';\n}\n\n/**\n * Executable primitive rendering program recognized by the backend.\n *\n * @param props - Resolved non-style component inputs. See {@link PrimitiveProgramProps}.\n * @param style - Resolved primitive style. See {@link ResolvedStyle}.\n * @param environment - Backend environment for the active frame.\n * @returns Child nodes to traverse, or no children. See {@link PibblNodeInput}.\n *\n * @see {@link SystemStyle}\n * @see {@link PrimitiveProgramProps}\n * @see {@link ResolvedStyle}\n * @see {@link PibblNodeInput}\n * @see {@link PibblBackendPrimitiveDefinition}\n * @see {@link defineBackendPrimitive}\n */\nexport type PibblBackendPrimitiveProgram<\n P = any,\n R extends SystemStyle = SystemStyle,\n E = any,\n> = (\n props: Readonly<PrimitiveProgramProps<P>>,\n style: ResolvedStyle<R>,\n environment: E,\n) => PibblNodeInput | void;\n\n/**\n * Rendering, style, and measurement definition of a backend primitive.\n *\n * @see {@link SystemStyle}\n * @see {@link PibblBackendToken}\n * @see {@link PibblBackendPrimitiveProgram}\n * @see {@link SpecifiedStyle}\n * @see {@link NormalizedStyle}\n * @see {@link StyleResolutionContext}\n * @see {@link ResolvedStyle}\n * @see {@link MeasureInput}\n * @see {@link PrimitiveProgramProps}\n * @see {@link MeasureResult}\n * @see {@link PibblBackendPrimitiveInput}\n */\nexport interface PibblBackendPrimitiveDefinition<\n P = any,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n E = any,\n> {\n /** Identity of the backend that accepts this primitive. See {@link PibblBackendToken}. */\n readonly backend: PibblBackendToken;\n /**\n * Names props whose signal identity is preserved for the primitive program. See\n * {@link PreservedSignalPropKey}.\n */\n readonly preserveSignalProps?: readonly PreservedSignalPropKey<P>[];\n /**\n * Declares how the primitive receives and resolves its children. See\n * {@link PibblBackendPrimitiveDefinition}.\n */\n readonly childInput?: 'structural' | 'text';\n /** Executable primitive program used by the backend. See {@link PibblBackendPrimitiveProgram}. */\n readonly program: PibblBackendPrimitiveProgram<P, R, E>;\n /**\n * Applies primitive defaults and shorthand normalization before layout resolution. See\n * {@link SpecifiedStyle}, {@link NormalizedStyle}.\n * @param style - Specified style values before normalization. See {@link SpecifiedStyle}.\n * @returns Normalized style with the primitive's shorthand and defaults applied. See\n * {@link NormalizedStyle} .\n */\n readonly normalizeStyle?: (style: SpecifiedStyle<S>) => NormalizedStyle<N>;\n /**\n * Resolves normalized style using the current layout context. See {@link NormalizedStyle},\n * {@link StyleResolutionContext}, {@link ResolvedStyle}.\n * @param style - Normalized style to resolve. See {@link NormalizedStyle}.\n * @param context - Layout and diagnostic context for resolution. See\n * {@link StyleResolutionContext} .\n * @returns Resolved style ready for rendering. See {@link ResolvedStyle}.\n */\n readonly resolveStyle?: (\n style: NormalizedStyle<N>,\n context: Readonly<StyleResolutionContext>,\n ) => ResolvedStyle<R>;\n /**\n * Measures declared primitive inputs without painting or retaining draw commands. See\n * {@link MeasureInput}, {@link PrimitiveProgramProps}, {@link MeasureResult}.\n * @param input - Props, normalized style, constraints, and nested measurement services. See\n * {@link MeasureInput} , {@link PrimitiveProgramProps} .\n * @returns Measured dimensions or an unsupported measurement result. See {@link MeasureResult}.\n */\n readonly measure?: (input: MeasureInput<PrimitiveProgramProps<P>, N>) => MeasureResult;\n /**\n * Pure intrinsic content provider. See {@link IntrinsicMeasureInput}.\n * @param input - Resolved inputs and tagged availability. See {@link IntrinsicMeasureInput}.\n * @returns Paired content sizes or unsupported. See {@link IntrinsicSizesResult}.\n */\n readonly measureIntrinsic?: (input: IntrinsicMeasureInput<PrimitiveProgramProps<P>, N>) => IntrinsicSizesResult;\n /**\n * Pure first/last baseline provider at the final content allocation.\n * @param input - Resolved inputs and final local allocation. See {@link BaselineMeasureInput}.\n * @returns Finite ordered offsets or unsupported. See {@link BaselinesResult}.\n */\n readonly measureBaselines?: (input: BaselineMeasureInput<PrimitiveProgramProps<P>, N>) => BaselinesResult;\n}\n\n/**\n * Inputs used to begin a backend frame.\n *\n * @see {@link Canvas}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendFrameInput {\n /** Canvas surface associated with this resource or mount. See {@link Canvas}. */\n readonly canvas: Canvas;\n /** Canvas width in logical units. See {@link PibblBackendFrameInput}. */\n readonly logicalWidth: number;\n /** Canvas height in logical units. See {@link PibblBackendFrameInput}. */\n readonly logicalHeight: number;\n /** Width of the backing raster in physical pixels. See {@link PibblBackendFrameInput}. */\n readonly backingWidth: number;\n /** Height of the backing raster in physical pixels. See {@link PibblBackendFrameInput}. */\n readonly backingHeight: number;\n /** Timestamp associated with this render frame. See {@link PibblBackendFrameInput}. */\n readonly renderTimestamp: number;\n}\n\n/**\n * The backend rendering context for one scheduled frame.\n *\n * @see {@link RenderingContext2D}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendFrame<E> {\n /** Backend environment used while evaluating the frame. See {@link PibblBackendFrame}. */\n readonly environment: E;\n /** Canvas 2D context used for the current frame. See {@link RenderingContext2D}. */\n readonly context2D?: RenderingContext2D;\n /** Current drawing target owned by the backend frame. See {@link RenderTargetSnapshot}. */\n readonly renderTarget?: RenderTargetSnapshot;\n /**\n * World transform establishing the backend frame's logical coordinate basis. See\n * {@link PibblBackendFrame}.\n */\n readonly worldBaseTransform?: DOMMatrix;\n}\n\n/**\n * Resolved inputs delivered to a backend primitive program.\n *\n * @see {@link PibblElementSource}\n * @see {@link PibblBackendPrimitiveDefinition}\n * @see {@link PibblBackendDriver}\n */\nexport interface PibblBackendPrimitiveInput {\n /** Component name retained for diagnostics. See {@link PibblBackendPrimitiveInput}. */\n readonly componentName: string;\n /** Authoring source location retained for diagnostics. See {@link PibblElementSource}. */\n readonly source?: PibblElementSource;\n /**\n * Primitive definition used to resolve and render the supplied inputs. See\n * {@link PibblBackendPrimitiveDefinition}.\n */\n readonly definition: PibblBackendPrimitiveDefinition;\n /**\n * Component props supplied to evaluation or measurement. See {@link PibblBackendPrimitiveInput}.\n */\n readonly props: Readonly<Record<PropertyKey, unknown>>;\n /** Declared presentation and layout properties. See {@link PibblBackendPrimitiveInput}. */\n readonly style: Readonly<Record<PropertyKey, unknown>>;\n /**\n * Transform applied to the primitive's presented Canvas geometry. See\n * {@link PibblBackendPrimitiveInput}.\n */\n readonly presentationTransform2D?: DOMMatrix;\n}\n\n/**\n * A mounted backend's frame execution and cleanup operations.\n *\n * @see {@link Canvas}\n * @see {@link PibblNode}\n * @see {@link PibblNestedResolverInput}\n * @see {@link mountBackendPibbl}\n */\nexport interface PibblBackendMount {\n /** Canvas surface associated with this resource or mount. See {@link Canvas}. */\n readonly canvas: Canvas;\n /**\n * Updates the backend surface to the supplied dimensions. See {@link PibblBackendMount}.\n * @param logicalWidth - New logical viewport width.\n * @param logicalHeight - New logical viewport height.\n */\n resize(logicalWidth: number, logicalHeight: number): void;\n /**\n * Renders the current data or resources using the supplied context. See {@link PibblBackendMount}\n * .\n * @param root - Node tree to render. See {@link PibblNode}.\n * @param timestamp - Frame timestamp in milliseconds.\n */\n render(root: PibblNode, timestamp: number): void;\n /**\n * Requests future work from the owning scheduler. See {@link PibblBackendMount}.\n * @param updateParents - Whether ancestor compositions also need to be scheduled.\n */\n requestFrame(updateParents: boolean): void;\n /** Releases resources owned by this mounted object. See {@link PibblBackendMount}. */\n dispose(): void;\n}\n\n/**\n * Version-coupled rendering backend lifecycle used by official integrations.\n *\n * @see {@link PibblBackendToken}\n * @see {@link PibblBackendFrameInput}\n * @see {@link PibblBackendFrame}\n * @see {@link PibblBackendPrimitiveInput}\n * @see {@link PibblNodeInput}\n * @see {@link PibblBackendMountOptions}\n */\nexport interface PibblBackendDriver<E> {\n /** Identity token distinguishing this backend driver. See {@link PibblBackendToken}. */\n readonly token: PibblBackendToken;\n /** Name identifying this backend, emitter, or parameter. See {@link PibblBackendDriver}. */\n readonly name: string;\n /**\n * Begins backend work for one shared scheduler frame. See {@link PibblBackendFrame}.\n * @param input - Root surface, timestamp, and logical dimensions for this render. See\n * {@link PibblBackendFrameInput} .\n * @returns Frame state, or undefined when no frame should be rendered. See\n * {@link PibblBackendFrame} .\n */\n beginFrame(input: PibblBackendFrameInput): PibblBackendFrame<E> | undefined;\n /**\n * Enters a component's backend evaluation scope. See {@link PibblBackendDriver}.\n * @param frame - Frame whose component environment should become active. See\n * {@link PibblBackendFrame} .\n * @returns A cleanup function restoring the previous environment.\n */\n enterComponent(frame: PibblBackendFrame<E>): () => void;\n /**\n * Runs a primitive's drawing program in the current backend frame. See {@link PibblBackendDriver}\n * .\n * @param frame - Active backend frame. See {@link PibblBackendFrame}.\n * @param input - Primitive descriptor and resolved rendering inputs. See\n * {@link PibblBackendPrimitiveInput} .\n * @param runProgram - Runtime callback used to invoke the primitive program. See\n * {@link PibblNodeInput} .\n */\n runPrimitive(\n frame: PibblBackendFrame<E>,\n input: PibblBackendPrimitiveInput,\n runProgram: (invoke: () => PibblNodeInput | void) => void,\n ): void;\n /**\n * Completes the backend frame and its pending composition work. See {@link PibblBackendDriver}.\n * @param frame - Frame returned by beginFrame. See {@link PibblBackendFrame}.\n * @param success - Whether traversal completed successfully.\n */\n finishFrame(frame: PibblBackendFrame<E>, success: boolean): void;\n /** Releases resources owned by this mounted object. See {@link PibblBackendDriver}. */\n dispose(): void;\n}\n\n/**\n * Canvas, configuration, and ownership inputs used to create a backend mount.\n *\n * @see {@link Canvas}\n * @see {@link PibblBackendDriver}\n * @see {@link mountBackendPibbl}\n */\nexport interface PibblBackendMountOptions<E> {\n /** Owning parent runtime instance. See {@link Canvas}. */\n readonly parent: Canvas;\n /** Canvas width in logical units. See {@link PibblBackendMountOptions}. */\n readonly logicalWidth: number;\n /** Canvas height in logical units. See {@link PibblBackendMountOptions}. */\n readonly logicalHeight: number;\n /** Backend driver responsible for this mount. See {@link PibblBackendDriver}. */\n readonly driver: PibblBackendDriver<E>;\n}\n\n/**\n * Backend target registration options with logical interaction geometry.\n *\n * @see {@link useBackendEventTarget}\n */\nexport interface PibblBackendEventTargetOptions extends PibblEventFocusOptions {\n /**\n * Cursor shown while this target owns pointer presentation. See\n * {@link PibblBackendEventTargetOptions}.\n */\n readonly cursor?: string;\n /** Defers backend-owned focus geometry until its visual generation commits. */\n readonly deferKeyboardNavigationGeometry?: boolean;\n}\n\n/**\n * Context supplied when resolving nested content through a backend.\n *\n * @see {@link PibblBackendMount}\n * @see {@link PibblHitTestOutput}\n * @see {@link registerNestedInteractionResolver}\n */\nexport interface PibblNestedResolverInput {\n /** Nested child content to resolve. See {@link PibblBackendMount}. */\n readonly child: PibblBackendMount;\n /** Logical region constraining the content or query. See {@link PibblNestedResolverInput}. */\n readonly bounds: Path2D;\n /** Whether this content participates in pointer targeting. See {@link PibblNestedResolverInput}. */\n readonly pointerEvents: 'auto' | 'none';\n /**\n * Resolves nested content in the current local coordinate system. See\n * {@link PibblNestedResolverInput}.\n * @param localX - Horizontal position in resolver-local coordinates.\n * @param localY - Vertical position in resolver-local coordinates.\n * @param output - Mutable hit-test result to populate. See {@link PibblHitTestOutput}.\n */\n resolveLocal(localX: number, localY: number, output: PibblHitTestOutput): void;\n}\n\n/** @internal */\nexport function backendMismatchError(\n componentName: string,\n required: PibblBackendToken,\n active: PibblBackendDriver<unknown>,\n source?: PibblElementSource,\n): Error {\n const requiredName = getBackendTokenName(required);\n const prefix = `${componentName} requires the ${requiredName} backend and ` +\n `cannot render in the ${active.name} root.`;\n return new Error(withJSXSource(prefix, source));\n}\n\nfunction withJSXSource(message: string, source?: PibblElementSource): string {\n return source ?\n `${message} JSX source: ${source.fileName}:${source.lineNumber}:${source.columnNumber}.` :\n message;\n}\n\nexport type { PibblEventHandlers };\n"],
5
+ "mappings": "AAuCA,MAAM,eAAe,oBAAI,QAAmC;AAUrD,SAAS,mBAAmB,MAAiC;AAClE,MAAI,CAAC,KAAK,KAAK,GAAG;AAChB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,QAAM,QAAQ,OAAO,OAAO,CAAC,CAAC;AAC9B,eAAa,IAAI,OAAO,IAAI;AAC5B,SAAO;AACT;AAGO,SAAS,oBAAoB,OAAkC;AACpE,SAAO,aAAa,IAAI,KAAK,KAAK;AACpC;AAiUO,SAAS,qBACd,eACA,UACA,QACA,QACO;AACP,QAAM,eAAe,oBAAoB,QAAQ;AACjD,QAAM,SAAS,GAAG,aAAa,iBAAiB,YAAY,qCAClC,OAAO,IAAI;AACrC,SAAO,IAAI,MAAM,cAAc,QAAQ,MAAM,CAAC;AAChD;AAEA,SAAS,cAAc,SAAiB,QAAqC;AAC3E,SAAO,SACH,GAAG,OAAO,gBAAgB,OAAO,QAAQ,IAAI,OAAO,UAAU,IAAI,OAAO,YAAY,MACvF;AACJ;",
6
6
  "names": []
7
7
  }
@@ -10,7 +10,8 @@ function arcBounds(cx, cy, radius, sweep) {
10
10
  };
11
11
  }
12
12
  const angles = [sweep.startAngle, sweep.endAngle];
13
- for (const cardinal of [0, Math.PI / 2, Math.PI, Math.PI * 1.5]) {
13
+ for (let cardinalIndex = 0; cardinalIndex < 4; cardinalIndex++) {
14
+ const cardinal = cardinalIndex * (Math.PI / 2);
14
15
  if (containsAngle(sweep, cardinal)) angles.push(cardinal);
15
16
  }
16
17
  const xs = angles.map((angle) => cx + radius * Math.cos(angle));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/arc-geometry.ts"],
4
- "sourcesContent": ["import type { LayoutBox } from \"../layout/types.js\";\nimport type { CircularSweep } from \"../geometry/circular-sweep.js\";\n\nconst fullTurn = Math.PI * 2;\n\nexport function arcBounds(\n cx: number,\n cy: number,\n radius: number,\n sweep: Readonly<CircularSweep>,\n): LayoutBox | undefined {\n if (radius <= 0 || sweep.sweep === 0) return undefined;\n if (sweep.fullCircle) {\n return {\n x: cx - radius,\n y: cy - radius,\n width: radius * 2,\n height: radius * 2,\n };\n }\n\n const angles = [sweep.startAngle, sweep.endAngle];\n for (const cardinal of [0, Math.PI / 2, Math.PI, Math.PI * 1.5]) {\n if (containsAngle(sweep, cardinal)) angles.push(cardinal);\n }\n const xs = angles.map((angle) => cx + radius * Math.cos(angle));\n const ys = angles.map((angle) => cy + radius * Math.sin(angle));\n const left = Math.min(...xs);\n const right = Math.max(...xs);\n const top = Math.min(...ys);\n const bottom = Math.max(...ys);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nexport function wedgeBounds(\n cx: number,\n cy: number,\n radius: number,\n sweep: Readonly<CircularSweep>,\n): LayoutBox | undefined {\n const bounds = arcBounds(cx, cy, radius, sweep);\n if (!bounds || sweep.fullCircle) return bounds;\n const left = Math.min(bounds.x, cx);\n const right = Math.max(bounds.x + bounds.width, cx);\n const top = Math.min(bounds.y, cy);\n const bottom = Math.max(bounds.y + bounds.height, cy);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nfunction containsAngle(sweep: Readonly<CircularSweep>, angle: number): boolean {\n const distance = sweep.counterclockwise\n ? positiveModulo(sweep.startAngle - angle, fullTurn)\n : positiveModulo(angle - sweep.startAngle, fullTurn);\n return distance <= Math.abs(sweep.sweep);\n}\n\nfunction positiveModulo(value: number, divisor: number): number {\n const result = value % divisor;\n if (result === 0) return 0;\n return result < 0 ? result + divisor : result;\n}\n"],
5
- "mappings": "AAGA,MAAM,WAAW,KAAK,KAAK;AAEpB,SAAS,UACd,IACA,IACA,QACA,OACuB;AACvB,MAAI,UAAU,KAAK,MAAM,UAAU,EAAG,QAAO;AAC7C,MAAI,MAAM,YAAY;AACpB,WAAO;AAAA,MACL,GAAG,KAAK;AAAA,MACR,GAAG,KAAK;AAAA,MACR,OAAO,SAAS;AAAA,MAChB,QAAQ,SAA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AAY,KAAK,IAAI,MAAM,KAAK;AACzC;AAEA,SAAS,eAAe,OAAe,SAAyB;AAC9D,QAAM,SAAS,QAAQ;AACvB,MAAI,WAAW,EAAG,QAAO;AACzB,SAAO,SAAS,IAAI,SAAS,UAAU;AACzC;",
4
+ "sourcesContent": ["import type { LayoutBox } from \"../layout/types.js\";\nimport type { CircularSweep } from \"../geometry/circular-sweep.js\";\n\nconst fullTurn = Math.PI * 2;\n\nexport function arcBounds(\n cx: number,\n cy: number,\n radius: number,\n sweep: Readonly<CircularSweep>,\n): LayoutBox | undefined {\n if (radius <= 0 || sweep.sweep === 0) return undefined;\n if (sweep.fullCircle) {\n return {\n x: cx - radius,\n y: cy - radius,\n width: radius * 2,\n height: radius * 2,\n };\n }\n\n const angles = [sweep.startAngle, sweep.endAngle];\n for (let cardinalIndex = 0; cardinalIndex < 4; cardinalIndex++) {\n const cardinal = cardinalIndex * (Math.PI / 2);\n if (containsAngle(sweep, cardinal)) angles.push(cardinal);\n }\n const xs = angles.map((angle) => cx + radius * Math.cos(angle));\n const ys = angles.map((angle) => cy + radius * Math.sin(angle));\n const left = Math.min(...xs);\n const right = Math.max(...xs);\n const top = Math.min(...ys);\n const bottom = Math.max(...ys);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nexport function wedgeBounds(\n cx: number,\n cy: number,\n radius: number,\n sweep: Readonly<CircularSweep>,\n): LayoutBox | undefined {\n const bounds = arcBounds(cx, cy, radius, sweep);\n if (!bounds || sweep.fullCircle) return bounds;\n const left = Math.min(bounds.x, cx);\n const right = Math.max(bounds.x + bounds.width, cx);\n const top = Math.min(bounds.y, cy);\n const bottom = Math.max(bounds.y + bounds.height, cy);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nfunction containsAngle(sweep: Readonly<CircularSweep>, angle: number): boolean {\n const distance = sweep.counterclockwise\n ? positiveModulo(sweep.startAngle - angle, fullTurn)\n : positiveModulo(angle - sweep.startAngle, fullTurn);\n return distance <= Math.abs(sweep.sweep);\n}\n\nfunction positiveModulo(value: number, divisor: number): number {\n const result = value % divisor;\n if (result === 0) return 0;\n return result < 0 ? result + divisor : result;\n}\n"],
5
+ "mappings": "AAGA,MAAM,WAAW,KAAK,KAAK;AAEpB,SAAS,UACd,IACA,IACA,QACA,OACuB;AACvB,MAAI,UAAU,KAAK,MAAM,UAAU,EAAG,QAAO;AAC7C,MAAI,MAAM,YAAY;AACpB,WAAO;AAAA,MACL,GAAG,KAAK;AAAA,MACR,GAAG,KAAK;AAAA,MACR,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS;AAAA,IACnB;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,MAAM,YAAY,MAAM,QAAQ;AAChD,WAAS,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB;AAC9D,UAAM,WAAW,iBAAiB,KAAK,KAAK;AAC5C,QAAI,cAAc,OAAO,QAAQ,EAAG,QAAO,KAAK,QAAQ;AAAA,EAC1D;AACA,QAAM,KAAK,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,KAAK,IAAI,KAAK,CAAC;AAC9D,QAAM,KAAK,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,KAAK,IAAI,KAAK,CAAC;AAC9D,QAAM,OAAO,KAAK,IAAI,GAAG,EAAE;AAC3B,QAAM,QAAQ,KAAK,IAAI,GAAG,EAAE;AAC5B,QAAM,MAAM,KAAK,IAAI,GAAG,EAAE;AAC1B,QAAM,SAAS,KAAK,IAAI,GAAG,EAAE;AAC7B,SAAO,EAAE,GAAG,MAAM,GAAG,KAAK,OAAO,QAAQ,MAAM,QAAQ,SAAS,IAAI;AACtE;AAEO,SAAS,YACd,IACA,IACA,QACA,OACuB;AACvB,QAAM,SAAS,UAAU,IAAI,IAAI,QAAQ,KAAK;AAC9C,MAAI,CAAC,UAAU,MAAM,WAAY,QAAO;AACxC,QAAM,OAAO,KAAK,IAAI,OAAO,GAAG,EAAE;AAClC,QAAM,QAAQ,KAAK,IAAI,OAAO,IAAI,OAAO,OAAO,EAAE;AAClD,QAAM,MAAM,KAAK,IAAI,OAAO,GAAG,EAAE;AACjC,QAAM,SAAS,KAAK,IAAI,OAAO,IAAI,OAAO,QAAQ,EAAE;AACpD,SAAO,EAAE,GAAG,MAAM,GAAG,KAAK,OAAO,QAAQ,MAAM,QAAQ,SAAS,IAAI;AACtE;AAEA,SAAS,cAAc,OAAgC,OAAwB;AAC7E,QAAM,WAAW,MAAM,mBACnB,eAAe,MAAM,aAAa,OAAO,QAAQ,IACjD,eAAe,QAAQ,MAAM,YAAY,QAAQ;AACrD,SAAO,YAAY,KAAK,IAAI,MAAM,KAAK;AACzC;AAEA,SAAS,eAAe,OAAe,SAAyB;AAC9D,QAAM,SAAS,QAAQ;AACvB,MAAI,WAAW,EAAG,QAAO;AACzB,SAAO,SAAS,IAAI,SAAS,UAAU;AACzC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { registerContentsTransform } from "../layout/participation.js";
1
2
  import { definePrimitive } from "../define-primitive.js";
2
3
  import {
3
4
  createGroupTransform,
@@ -18,6 +19,7 @@ const Group = definePrimitive(renderGroup, {
18
19
  setPrimitivePresentation(Group, (style) => ({
19
20
  transform: createGroupTransform(style)
20
21
  }));
22
+ registerContentsTransform(Group);
21
23
  export {
22
24
  Group
23
25
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/g.ts"],
4
- "sourcesContent": ["import type { PibblDragHandleStyle } from '../manipulation/handles.js';\nimport type { HtmlBoxStyle } from '../html/types.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { PibblNodeInput, SystemStyle } from '../types.js';\nimport type { PibblPhysics2DPropExtension } from '../types.js';\nimport {\n createGroupTransform,\n setPrimitivePresentation,\n} from '../primitive-presentation.js';\nimport { stripLayoutParticipation } from '../style/resolve-built-in.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from './structural-events.js';\nimport type {\n BoxStyle,\n LayoutItemStyle,\n ResolvedDrawingStyle,\n} from '../style/types.js';\n\n/**\n * Authored inputs for Group, including the declared data and presentation options.\n *\n * @see {@link PibblPhysics2DPropExtension}\n * @see {@link PibblNodeInput}\n * @see {@link Group}\n */\nexport interface GroupProps extends PibblStructuralEventProps, PibblPhysics2DPropExtension {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n/**\n * Transforms, layout participation, and shared style properties for Group.\n *\n * @see {@link SystemStyle}\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Group}\n * @see {@link PibblDragHandleStyle}\n * @see {@link HtmlBoxStyle}\n */\nexport interface GStyle extends SystemStyle, BoxStyle, LayoutItemStyle {\n /** Horizontal scale factor. See {@link GStyle}. */\n scaleX?: number;\n /** Vertical scale factor. See {@link GStyle}. */\n scaleY?: number;\n /** Clockwise rotation in degrees. */\n rotationDegrees?: number;\n /** Point around which the rotation is applied. See {@link GStyle}. */\n rotationOrigin?: [number, number];\n /** Horizontal translation in the current logical coordinate system. See {@link GStyle}. */\n translateX?: number;\n /** Vertical translation in the current logical coordinate system. See {@link GStyle}. */\n translateY?: number;\n /** Horizontal skew angle in degrees. */\n skewX?: number;\n /** Vertical skew angle in degrees. */\n skewY?: number;\n}\n\ntype ResolvedGStyle = ResolvedDrawingStyle<GStyle>;\n\nfunction renderGroup(\n props: GroupProps,\n) {\n wireStructuralEvents(props);\n return props.children;\n}\n\n/**\n * Describes a transformation group for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link GroupProps}\n * @see {@link GStyle}\n */\nexport const Group = definePrimitive<\n GroupProps,\n GStyle,\n GStyle,\n ResolvedGStyle\n>(renderGroup, {\n childInput: 'structural',\n resolveStyle: style => stripLayoutParticipation(style) as ResolvedGStyle,\n});\n\nsetPrimitivePresentation<ResolvedGStyle>(Group, style => ({\n transform: createGroupTransform(style),\n}));\n"],
5
- "mappings": "AAEA,SAAS,uBAAuB;AAGhC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC;AAAA,EAEE;AAAA,OACK;AAkDP,SAAS,YACP,OACA;AACA,uBAAqB,KAAK;AAC1B,SAAO,MAAM;AACf;AAYO,MAAM,QAAQ,gBAKnB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc,WAAS,yBAAyB,KAAK;AACvD,CAAC;AAED,yBAAyC,OAAO,YAAU;AAAA,EACxD,WAAW,qBAAqB,KAAK;AACvC,EAAE;",
4
+ "sourcesContent": ["import { registerContentsTransform } from '../layout/participation.js';\nimport type { PibblDragHandleStyle } from '../manipulation/handles.js';\nimport type { HtmlBoxStyle } from '../html/types.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { PibblNodeInput, SystemStyle } from '../types.js';\nimport type { PibblPhysics2DPropExtension } from '../types.js';\nimport {\n createGroupTransform,\n setPrimitivePresentation,\n} from '../primitive-presentation.js';\nimport { stripLayoutParticipation } from '../style/resolve-built-in.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from './structural-events.js';\nimport type {\n BoxStyle,\n LayoutItemStyle,\n ResolvedDrawingStyle,\n} from '../style/types.js';\n\n/**\n * Authored inputs for Group, including the declared data and presentation options.\n *\n * @see {@link PibblPhysics2DPropExtension}\n * @see {@link PibblNodeInput}\n * @see {@link Group}\n */\nexport interface GroupProps extends PibblStructuralEventProps, PibblPhysics2DPropExtension {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n/**\n * Transforms, layout participation, and shared style properties for Group.\n *\n * @see {@link SystemStyle}\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Group}\n * @see {@link PibblDragHandleStyle}\n * @see {@link HtmlBoxStyle}\n */\nexport interface GStyle extends SystemStyle, BoxStyle, LayoutItemStyle {\n /** Horizontal scale factor. See {@link GStyle}. */\n scaleX?: number;\n /** Vertical scale factor. See {@link GStyle}. */\n scaleY?: number;\n /** Clockwise rotation in degrees. */\n rotationDegrees?: number;\n /** Point around which the rotation is applied. See {@link GStyle}. */\n rotationOrigin?: [number, number];\n /** Horizontal translation in the current logical coordinate system. See {@link GStyle}. */\n translateX?: number;\n /** Vertical translation in the current logical coordinate system. See {@link GStyle}. */\n translateY?: number;\n /** Horizontal skew angle in degrees. */\n skewX?: number;\n /** Vertical skew angle in degrees. */\n skewY?: number;\n}\n\ntype ResolvedGStyle = ResolvedDrawingStyle<GStyle>;\n\nfunction renderGroup(\n props: GroupProps,\n) {\n wireStructuralEvents(props);\n return props.children;\n}\n\n/**\n * Describes a transformation group for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link GroupProps}\n * @see {@link GStyle}\n */\nexport const Group = definePrimitive<\n GroupProps,\n GStyle,\n GStyle,\n ResolvedGStyle\n>(renderGroup, {\n childInput: 'structural',\n resolveStyle: style => stripLayoutParticipation(style) as ResolvedGStyle,\n});\n\nsetPrimitivePresentation<ResolvedGStyle>(Group, style => ({\n transform: createGroupTransform(style),\n}));\n\nregisterContentsTransform(Group);\n"],
5
+ "mappings": "AAAA,SAAS,iCAAiC;AAG1C,SAAS,uBAAuB;AAGhC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC;AAAA,EAEE;AAAA,OACK;AAkDP,SAAS,YACP,OACA;AACA,uBAAqB,KAAK;AAC1B,SAAO,MAAM;AACf;AAYO,MAAM,QAAQ,gBAKnB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc,WAAS,yBAAyB,KAAK;AACvD,CAAC;AAED,yBAAyC,OAAO,YAAU;AAAA,EACxD,WAAW,qBAAqB,KAAK;AACvC,EAAE;AAEF,0BAA0B,KAAK;",
6
6
  "names": []
7
7
  }
@@ -13,7 +13,7 @@ function renderHtmlBox(props, style, ctx) {
13
13
  let slot = refs.refs[0];
14
14
  if (!slot || slot.disposed) {
15
15
  if (typeof props.mount !== "function") throw new TypeError("HtmlBox mount must be a function.");
16
- slot = { owner, mount: props.mount, disposed: false, region: { identity: {}, owner, content: void 0, rootBounds: void 0, active: true } };
16
+ slot = { component: refs, owner, mount: props.mount, disposed: false, region: { identity: {}, owner, content: void 0, rootBounds: void 0, active: true } };
17
17
  const stable = slot;
18
18
  stable.region = { ...stable.region, onFocusSnapshot(snapshot) {
19
19
  queueMicrotask(() => {
@@ -27,6 +27,7 @@ function renderHtmlBox(props, style, ctx) {
27
27
  if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError("HtmlBox opacity must be between 0 and 1.");
28
28
  service.register({
29
29
  slot,
30
+ handlers: props,
30
31
  data: props.data,
31
32
  matrix: getCurrentWorldTransform(),
32
33
  clips: snapshotClips(GLOBAL_STATE.clippingStack),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/html-box.ts"],
4
- "sourcesContent": ["import type { HtmlMountCallback } from '../html/types.js';\nimport type { ResolvedDrawingStyle } from '../style/types.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { resolveBox } from '../layout/box.js';\nimport type { LayoutBox } from '../layout/types.js';\nimport { createGroupTransform, setPrimitivePresentation } from '../primitive-presentation.js';\nimport { getCurrentWorldTransform } from '../render-target.js';\nimport { registerOpaquePrimitiveProps } from '../element/metadata.js';\nimport { requireHtmlService, snapshotClips } from '../html/html-service.js';\nimport type { HtmlBoxProps, HtmlBoxSlot, HtmlBoxStyle } from '../html/types.js';\nimport type { PibblRenderResult, PrimitiveInput, RenderingContext2D } from '../types.js';\nimport { stripLayoutParticipation } from '../style/resolve-built-in.js';\n\ntype Resolved = ResolvedDrawingStyle<HtmlBoxStyle> & {\n borderBox: Readonly<LayoutBox>; contentBox: Readonly<LayoutBox>; overflow: 'visible' | 'clip';\n};\n\nfunction renderHtmlBox(props: HtmlBoxProps<unknown>, style: Readonly<Resolved>, ctx: RenderingContext2D): void {\n const refs = GLOBAL_STATE.componentRefs!;\n const owner = GLOBAL_STATE.currentPibblInstance!;\n const service = requireHtmlService(owner);\n let slot = refs.refs[0] as HtmlBoxSlot | undefined;\n if (!slot || slot.disposed) {\n if (typeof props.mount !== 'function') throw new TypeError('HtmlBox mount must be a function.');\n slot = { owner, mount: props.mount, disposed: false, region: { identity: {}, owner, content: undefined, rootBounds: undefined, active: true } };\n const stable = slot;\n stable.region = { ...stable.region, onFocusSnapshot(snapshot) {\n queueMicrotask(() => { if (!stable.disposed) stable.callback?.(snapshot); });\n } };\n refs.refs[0] = slot;\n refs.teardowns.add(() => service.release(stable));\n }\n const opacity = style.opacity ?? 1;\n if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError('HtmlBox opacity must be between 0 and 1.');\n service.register({ slot, data: props.data, matrix: getCurrentWorldTransform(),\n clips: snapshotClips(GLOBAL_STATE.clippingStack), border: style.borderBox, content: style.contentBox,\n opacity: ctx.globalAlpha * opacity, interactive: props.pointerEvents !== 'none', overflow: style.overflow ?? 'clip', onFocusChange: props.onFocusChange });\n}\n\nconst primitive = definePrimitive<HtmlBoxProps<unknown>, HtmlBoxStyle, HtmlBoxStyle, Resolved>(renderHtmlBox, {\n resolveStyle(style, context) {\n const box = resolveBox({ ...style, width: style.width === undefined || style.width === 'auto' ? context.allocation.width : style.width,\n height: style.height === undefined || style.height === 'auto' ? context.allocation.height : style.height }, context.constraints, { component: 'HtmlBox' });\n return { ...stripLayoutParticipation(style), ...box, overflow: style.overflow ?? 'clip' } as Resolved;\n },\n});\n\nregisterOpaquePrimitiveProps(primitive, ['data']);\nsetPrimitivePresentation<Resolved>(primitive, style => ({ transform: createGroupTransform(style) }));\n\ntype HtmlBoxInput<Props> = Omit<PrimitiveInput<HtmlBoxProps<Props>, HtmlBoxStyle>, 'data' | 'mount'> & Pick<HtmlBoxProps<Props>, 'data' | 'mount'>;\ntype HtmlBoxComponent = {\n <Props>(props: HtmlBoxInput<Props>): PibblRenderResult;\n};\n/**\n * A persistent native HTML box projected into Pibbl layout, transforms and clips.\n *\n * @see {@link HtmlBoxProps}\n * @see {@link HtmlBoxStyle}\n * @see {@link HtmlMountCallback}\n */\nexport const HtmlBox = primitive as HtmlBoxComponent;\n"],
5
- "mappings": "AAEA,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAE3B,SAAS,sBAAsB,gCAAgC;AAC/D,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB,qBAAqB;AAGlD,SAAS,gCAAgC;AAMzC,SAAS,cAAc,OAA8B,OAA2B,KAA+B;AAC7G,QAAM,OAAO,aAAa;AAC1B,QAAM,QAAQ,aAAa;AAC3B,QAAM,UAAU,mBAAmB,KAAK;AACxC,MAAI,OAAO,KAAK,KAAK,CAAC;AACtB,MAAI,CAAC,QAAQ,KAAK,UAAU;AAC1B,QAAI,OAAO,MAAM,UAAU,WAAY,OAAM,IAAI,UAAU,mCAAmC;AAC9F,WAAO,EAAE,OAAO,OAAO,MAAM,OAAO,UAAU,OAAO,QAAQ,EAAE,UAAU,CAAC,GAAG,OAAO,SAAS,QAAW,YAAY,QAAW,QAAQ,KAAK,EAAE;AAC9I,UAAM,SAAS;AACf,WAAO,SAAS,EAAE,GAAG,OAAO,QAAQ,gBAAgB,UAAU;AAC5D,qBAAe,MAAM;AAAE,YAAI,CAAC,OAAO,SAAU,QAAO,WAAW,QAAQ;AAAA,MAAG,CAAC;AAAA,IAC7E,EAAE;AACF,SAAK,KAAK,CAAC,IAAI;AACf,SAAK,UAAU,IAAI,MAAM,QAAQ,QAAQ,MAAM,CAAC;AAAA,EAClD;AACA,QAAM,UAAU,MAAM,WAAW;AACjC,MAAI,CAAC,OAAO,SAAS,OAAO,KAAK,UAAU,KAAK,UAAU,EAAG,OAAM,IAAI,WAAW,0CAA0C;AAC5H,UAAQ,SAAS;AAAA,IAAE;AAAA,IAAM,MAAM,MAAM;AAAA,IAAM,QAAQ,yBAAyB;AAAA,IAC1E,OAAO,cAAc,aAAa,aAAa;AAAA,IAAG,QAAQ,MAAM;AAAA,IAAW,SAAS,MAAM;AAAA,IAC1F,SAAS,IAAI,cAAc;AAAA,IAAS,aAAa,MAAM,kBAAkB;AAAA,IAAQ,UAAU,MAAM,YAAY;AAAA,IAAQ,eAAe,MAAM;AAAA,EAAc,CAAC;AAC7J;AAEA,MAAM,YAAY,gBAA6E,eAAe;AAAA,EAC5G,aAAa,OAAO,SAAS;AAC3B,UAAM,MAAM,WAAW;AAAA,MAAE,GAAG;AAAA,MAAO,OAAO,MAAM,UAAU,UAAa,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,MAAM;AAAA,MAC/H,QAAQ,MAAM,WAAW,UAAa,MAAM,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM;AAAA,IAAO,GAAG,QAAQ,aAAa,EAAE,WAAW,UAAU,CAAC;AAC3J,WAAO,EAAE,GAAG,yBAAyB,KAAK,GAAG,GAAG,KAAK,UAAU,MAAM,YAAY,OAAO;AAAA,EAC1F;AACF,CAAC;AAED,6BAA6B,WAAW,CAAC,MAAM,CAAC;AAChD,yBAAmC,WAAW,YAAU,EAAE,WAAW,qBAAqB,KAAK,EAAE,EAAE;AAa5F,MAAM,UAAU;",
4
+ "sourcesContent": ["import type { HtmlMountCallback } from '../html/types.js';\nimport type { ResolvedDrawingStyle } from '../style/types.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { resolveBox } from '../layout/box.js';\nimport type { LayoutBox } from '../layout/types.js';\nimport { createGroupTransform, setPrimitivePresentation } from '../primitive-presentation.js';\nimport { getCurrentWorldTransform } from '../render-target.js';\nimport { registerOpaquePrimitiveProps } from '../element/metadata.js';\nimport { requireHtmlService, snapshotClips } from '../html/html-service.js';\nimport type { HtmlBoxProps, HtmlBoxSlot, HtmlBoxStyle } from '../html/types.js';\nimport type { PibblRenderResult, PrimitiveInput, RenderingContext2D } from '../types.js';\nimport { stripLayoutParticipation } from '../style/resolve-built-in.js';\n\ntype Resolved = ResolvedDrawingStyle<HtmlBoxStyle> & {\n borderBox: Readonly<LayoutBox>; contentBox: Readonly<LayoutBox>; overflow: 'visible' | 'clip';\n};\n\nfunction renderHtmlBox(props: HtmlBoxProps<unknown>, style: Readonly<Resolved>, ctx: RenderingContext2D): void {\n const refs = GLOBAL_STATE.componentRefs!;\n const owner = GLOBAL_STATE.currentPibblInstance!;\n const service = requireHtmlService(owner);\n let slot = refs.refs[0] as HtmlBoxSlot | undefined;\n if (!slot || slot.disposed) {\n if (typeof props.mount !== 'function') throw new TypeError('HtmlBox mount must be a function.');\n slot = { component: refs, owner, mount: props.mount, disposed: false, region: { identity: {}, owner, content: undefined, rootBounds: undefined, active: true } };\n const stable = slot;\n stable.region = { ...stable.region, onFocusSnapshot(snapshot) {\n queueMicrotask(() => { if (!stable.disposed) stable.callback?.(snapshot); });\n } };\n refs.refs[0] = slot;\n refs.teardowns.add(() => service.release(stable));\n }\n const opacity = style.opacity ?? 1;\n if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError('HtmlBox opacity must be between 0 and 1.');\n service.register({ slot, handlers: props, data: props.data, matrix: getCurrentWorldTransform(),\n clips: snapshotClips(GLOBAL_STATE.clippingStack), border: style.borderBox, content: style.contentBox,\n opacity: ctx.globalAlpha * opacity, interactive: props.pointerEvents !== 'none', overflow: style.overflow ?? 'clip', onFocusChange: props.onFocusChange });\n}\n\nconst primitive = definePrimitive<HtmlBoxProps<unknown>, HtmlBoxStyle, HtmlBoxStyle, Resolved>(renderHtmlBox, {\n resolveStyle(style, context) {\n const box = resolveBox({ ...style, width: style.width === undefined || style.width === 'auto' ? context.allocation.width : style.width,\n height: style.height === undefined || style.height === 'auto' ? context.allocation.height : style.height }, context.constraints, { component: 'HtmlBox' });\n return { ...stripLayoutParticipation(style), ...box, overflow: style.overflow ?? 'clip' } as Resolved;\n },\n});\n\nregisterOpaquePrimitiveProps(primitive, ['data']);\nsetPrimitivePresentation<Resolved>(primitive, style => ({ transform: createGroupTransform(style) }));\n\ntype HtmlBoxInput<Props> = Omit<PrimitiveInput<HtmlBoxProps<Props>, HtmlBoxStyle>, 'data' | 'mount'> & Pick<HtmlBoxProps<Props>, 'data' | 'mount'>;\ntype HtmlBoxComponent = {\n <Props>(props: HtmlBoxInput<Props>): PibblRenderResult;\n};\n/**\n * A persistent native HTML box projected into Pibbl layout, transforms and clips.\n *\n * @see {@link HtmlBoxProps}\n * @see {@link HtmlBoxStyle}\n * @see {@link HtmlMountCallback}\n */\nexport const HtmlBox = primitive as HtmlBoxComponent;\n"],
5
+ "mappings": "AAEA,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAE3B,SAAS,sBAAsB,gCAAgC;AAC/D,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB,qBAAqB;AAGlD,SAAS,gCAAgC;AAMzC,SAAS,cAAc,OAA8B,OAA2B,KAA+B;AAC7G,QAAM,OAAO,aAAa;AAC1B,QAAM,QAAQ,aAAa;AAC3B,QAAM,UAAU,mBAAmB,KAAK;AACxC,MAAI,OAAO,KAAK,KAAK,CAAC;AACtB,MAAI,CAAC,QAAQ,KAAK,UAAU;AAC1B,QAAI,OAAO,MAAM,UAAU,WAAY,OAAM,IAAI,UAAU,mCAAmC;AAC9F,WAAO,EAAE,WAAW,MAAM,OAAO,OAAO,MAAM,OAAO,UAAU,OAAO,QAAQ,EAAE,UAAU,CAAC,GAAG,OAAO,SAAS,QAAW,YAAY,QAAW,QAAQ,KAAK,EAAE;AAC/J,UAAM,SAAS;AACf,WAAO,SAAS,EAAE,GAAG,OAAO,QAAQ,gBAAgB,UAAU;AAC5D,qBAAe,MAAM;AAAE,YAA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ive } from "../define-primitive.js";
3
3
  import { useRectPath } from "../hooks/use-rect-path.js";
4
4
  import { useReaction } from "../hooks/use-reaction.js";
5
5
  import { useSignal } from "../hooks/use-signal.js";
6
- import { resolveLength } from "../style/resolve-length.js";
6
+ import { resolveScalarSizingLength } from "../style/sizing-length.js";
7
7
  import {
8
8
  resolveOptionalLength,
9
9
  stripLayoutParticipation
@@ -129,13 +129,13 @@ function measureImage({
129
129
  return {
130
130
  status: "measured",
131
131
  size: {
132
- width: resolveLength(
132
+ width: resolveScalarSizingLength(
133
133
  style.width,
134
134
  constraints.maxWidth,
135
135
  "width",
136
136
  context
137
137
  ),
138
- height: resolveLength(
138
+ height: resolveScalarSizingLength(
139
139
  style.height,
140
140
  constraints.maxHeight,
141
141
  "height",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/img.ts"],
4
- "sourcesContent": ["import { resolveTexturePaint } from '../textures/texture-protocol.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport type {\n PibblEventFocusOptions,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n} from '../events/types.js';\nimport { useRectPath } from '../hooks/use-rect-path.js';\nimport { useReaction } from '../hooks/use-reaction.js';\nimport { useSignal } from '../hooks/use-signal.js';\nimport type {\n PibblPhysics2DPropExtension,\n MeasureInput,\n MeasureResult,\n RenderingContext2D,\n StyleResolutionContext,\n} from '../types.js';\nimport { resolveLength } from '../style/resolve-length.js';\nimport {\n resolveOptionalLength,\n stripLayoutParticipation,\n} from '../style/resolve-built-in.js';\nimport { registerOpaqueStyleProperties } from '../style/resolve-dispatch.js';\nimport type { ImgStyle, ResolvedImgStyle } from '../style/types.js';\nimport { adjustRectangleToPixelGrid } from '../util/pixel-grid-adjustments.js';\nimport { wireCommonEvents } from '../util/wire-common-events.js';\n\n/**\n * Authored inputs for Image, including the declared data and presentation options.\n *\n * @see {@link PibblEventHandlers}\n * @see {@link PibblEventParticipationOptions}\n * @see {@link PibblPhysics2DPropExtension}\n * @see {@link Image}\n */\nexport interface ImageProps extends PibblEventHandlers, PibblEventFocusOptions, PibblEventParticipationOptions, PibblPhysics2DPropExtension {}\n\ninterface LoadedImage {\n src: string;\n element: HTMLImageElement;\n}\n\nfunction renderImage(\n props: ImageProps,\n style: Readonly<ResolvedImgStyle>,\n ctx: RenderingContext2D,\n) {\n let {\n src,\n x = 0,\n y = 0,\n width,\n height,\n stroke,\n strokeWidth,\n opacity,\n cursor,\n alignToPixelGrid,\n } = style;\n\n if (opacity !== undefined) {\n ctx.globalAlpha = ctx.globalAlpha * opacity;\n }\n\n const loadedImage = useSignal<LoadedImage | null>(null);\n const loadedImageValue = loadedImage.get();\n const image =\n loadedImageValue && loadedImageValue.src === src ?\n loadedImageValue.element : null;\n\n useReaction(() => {\n let active = true;\n const BrowserImage = globalThis.Image;\n const element = new BrowserImage();\n const settle = () => {\n active = false;\n element.onload = null;\n element.onerror = null;\n };\n\n element.onload = () => {\n if (!active) return;\n settle();\n loadedImage.set({ src, element });\n };\n element.onerror = () => {\n if (!active) return;\n settle();\n loadedImage.set(null);\n };\n element.src = src;\n\n return () => {\n active = false;\n element.onload = null;\n element.onerror = null;\n element.removeAttribute('src');\n };\n }, [src]);\n\n width = width ?? image?.naturalWidth ?? image?.width ?? 0;\n height = height ?? image?.naturalHeight ?? image?.height ?? 0;\n\n if (alignToPixelGrid) {\n ({ x, y, width, height } = adjustRectangleToPixelGrid(\n strokeWidth ?? 0,\n x,\n y,\n width,\n height,\n alignToPixelGrid,\n ));\n }\n\n const imagePath = useRectPath(x, y, width, height);\n\n if (image) {\n ctx.drawImage(image, x, y, width, height);\n }\n\n if (stroke && strokeWidth) {\n ctx.strokeStyle = resolveTexturePaint(stroke, ctx, { x, y, width, height });\n ctx.lineWidth = strokeWidth;\n ctx.stroke(imagePath);\n }\n\n wireCommonEvents(\n props,\n imagePath,\n true,\n strokeWidth ?? 0,\n cursor,\n { x, y, width, height },\n );\n}\n\n/**\n * Describes a Canvas image primitive for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link ImageProps}\n * @see {@link ImgStyle}\n */\nexport const Image = definePrimitive<\n ImageProps,\n ImgStyle,\n ImgStyle,\n ResolvedImgStyle\n>(renderImage, {\n resolveStyle: resolveImageStyle,\n measure: measureImage,\n});\nregisterOpaqueStyleProperties(Image, ['src', 'stroke', 'cursor']);\n\nfunction resolveImageStyle(\n style: Readonly<ImgStyle>,\n context: Readonly<StyleResolutionContext>,\n): ResolvedImgStyle {\n return {\n ...stripLayoutParticipation(style),\n x: 0,\n y: 0,\n width: resolveOptionalLength(\n style.width,\n context.percentageBasis.width,\n 'width',\n context,\n ),\n height: resolveOptionalLength(\n style.height,\n context.percentageBasis.height,\n 'height',\n context,\n ),\n } as ResolvedImgStyle;\n}\n\nfunction measureImage({\n style,\n constraints,\n}: MeasureInput<ImageProps, ImgStyle>): MeasureResult {\n if (\n style.width === undefined || style.width === 'auto' ||\n style.height === undefined || style.height === 'auto'\n ) {\n return {\n status: 'unsupported',\n reason: 'Image natural dimensions are unavailable during pure measurement',\n };\n }\n const context = {\n component: 'Image',\n algorithm: 'measurement' as const,\n constraints,\n };\n return {\n status: 'measured',\n size: {\n width: resolveLength(\n style.width,\n constraints.maxWidth,\n 'width',\n context,\n )!,\n height: resolveLength(\n style.height,\n constraints.maxHeight,\n 'height',\n context,\n )!,\n },\n };\n}\n"],
5
- "mappings": "AAAA,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAMhC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAQ1B,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qCAAqC;AAE9C,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AAiBjC,SAAS,YACP,OACA,OACA,KACA;AACA,MAAI;AAAA,IACF;AA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F;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { resolveTexturePaint } from '../textures/texture-protocol.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport type {\n PibblEventFocusOptions,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n} from '../events/types.js';\nimport { useRectPath } from '../hooks/use-rect-path.js';\nimport { useReaction } from '../hooks/use-reaction.js';\nimport { useSignal } from '../hooks/use-signal.js';\nimport type {\n PibblPhysics2DPropExtension,\n MeasureInput,\n MeasureResult,\n RenderingContext2D,\n StyleResolutionContext,\n} from '../types.js';\nimport { resolveScalarSizingLength } from '../style/sizing-length.js';\nimport {\n resolveOptionalLength,\n stripLayoutParticipation,\n} from '../style/resolve-built-in.js';\nimport { registerOpaqueStyleProperties } from '../style/resolve-dispatch.js';\nimport type { ImgStyle, ResolvedImgStyle } from '../style/types.js';\nimport { adjustRectangleToPixelGrid } from '../util/pixel-grid-adjustments.js';\nimport { wireCommonEvents } from '../util/wire-common-events.js';\n\n/**\n * Authored inputs for Image, including the declared data and presentation options.\n *\n * @see {@link PibblEventHandlers}\n * @see {@link PibblEventParticipationOptions}\n * @see {@link PibblPhysics2DPropExtension}\n * @see {@link Image}\n */\nexport interface ImageProps extends PibblEventHandlers, PibblEventFocusOptions, PibblEventParticipationOptions, PibblPhysics2DPropExtension {}\n\ninterface LoadedImage {\n src: string;\n element: HTMLImageElement;\n}\n\nfunction renderImage(\n props: ImageProps,\n style: Readonly<ResolvedImgStyle>,\n ctx: RenderingContext2D,\n) {\n let {\n src,\n x = 0,\n y = 0,\n width,\n height,\n stroke,\n strokeWidth,\n opacity,\n cursor,\n alignToPixelGrid,\n } = style;\n\n if (opacity !== undefined) {\n ctx.globalAlpha = ctx.globalAlpha * opacity;\n }\n\n const loadedImage = useSignal<LoadedImage | null>(null);\n const loadedImageValue = loadedImage.get();\n const image =\n loadedImageValue && loadedImageValue.src === src ?\n loadedImageValue.element : null;\n\n useReaction(() => {\n let active = true;\n const BrowserImage = globalThis.Image;\n const element = new BrowserImage();\n const settle = () => {\n active = false;\n element.onload = null;\n element.onerror = null;\n };\n\n element.onload = () => {\n if (!active) return;\n settle();\n loadedImage.set({ src, element });\n };\n element.onerror = () => {\n if (!active) return;\n settle();\n loadedImage.set(null);\n };\n element.src = src;\n\n return () => {\n active = false;\n element.onload = null;\n element.onerror = null;\n element.removeAttribute('src');\n };\n }, [src]);\n\n width = width ?? image?.naturalWidth ?? image?.width ?? 0;\n height = height ?? image?.naturalHeight ?? image?.height ?? 0;\n\n if (alignToPixelGrid) {\n ({ x, y, width, height } = adjustRectangleToPixelGrid(\n strokeWidth ?? 0,\n x,\n y,\n width,\n height,\n alignToPixelGrid,\n ));\n }\n\n const imagePath = useRectPath(x, y, width, height);\n\n if (image) {\n ctx.drawImage(image, x, y, width, height);\n }\n\n if (stroke && strokeWidth) {\n ctx.strokeStyle = resolveTexturePaint(stroke, ctx, { x, y, width, height });\n ctx.lineWidth = strokeWidth;\n ctx.stroke(imagePath);\n }\n\n wireCommonEvents(\n props,\n imagePath,\n true,\n strokeWidth ?? 0,\n cursor,\n { x, y, width, height },\n );\n}\n\n/**\n * Describes a Canvas image primitive for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link ImageProps}\n * @see {@link ImgStyle}\n */\nexport const Image = definePrimitive<\n ImageProps,\n ImgStyle,\n ImgStyle,\n ResolvedImgStyle\n>(renderImage, {\n resolveStyle: resolveImageStyle,\n measure: measureImage,\n});\nregisterOpaqueStyleProperties(Image, ['src', 'stroke', 'cursor']);\n\nfunction resolveImageStyle(\n style: Readonly<ImgStyle>,\n context: Readonly<StyleResolutionContext>,\n): ResolvedImgStyle {\n return {\n ...stripLayoutParticipation(style),\n x: 0,\n y: 0,\n width: resolveOptionalLength(\n style.width,\n context.percentageBasis.width,\n 'width',\n context,\n ),\n height: resolveOptionalLength(\n style.height,\n context.percentageBasis.height,\n 'height',\n context,\n ),\n } as ResolvedImgStyle;\n}\n\nfunction measureImage({\n style,\n constraints,\n}: MeasureInput<ImageProps, ImgStyle>): MeasureResult {\n if (\n style.width === undefined || style.width === 'auto' ||\n style.height === undefined || style.height === 'auto'\n ) {\n return {\n status: 'unsupported',\n reason: 'Image natural dimensions are unavailable during pure measurement',\n };\n }\n const context = {\n component: 'Image',\n algorithm: 'measurement' as const,\n constraints,\n };\n return {\n status: 'measured',\n size: {\n width: resolveScalarSizingLength(\n style.width,\n constraints.maxWidth,\n 'width',\n context,\n )!,\n height: resolveScalarSizingLength(\n style.height,\n constraints.maxHeight,\n 'height',\n context,\n )!,\n },\n };\n}\n"],
5
+ "mappings": "AAAA,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAMhC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAQ1B,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qCAAqC;AAE9C,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AAiBjC,SAAS,YACP,OACA,OACA,KACA;AACA,MAAI;AAAA,IACF;AAAA,IACA,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,MAAI,YAAY,QAAW;AACzB,QAAI,cAAc,IAAI,cAAc;AAAA,EACtC;AAEA,QAAM,cAAc,UAA8B,IAAI;AACtD,QAAM,mBAAmB,YAAY,IAAI;AACzC,QAAM,QACJ,oBAAoB,iBAAiB,QAAQ,MAC3C,iBAAiB,UAAU;AAE/B,cAAY,MAAM;AAChB,QAAI,SAAS;AACb,UAAM,eAAe,WAAW;AAChC,UAAM,UAAU,IAAI,aAAa;AACjC,UAAM,SAAS,MAAM;AACnB,eAAS;AACT,cAAQ,SAAS;AACjB,cAAQ,UAAU;AAAA,IACpB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AK;AAAA,IACjC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO;AAAA,MACL,MAAM;AAAA,MACN,QAAQ,gBAAgB;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,QAAQ,gBAAgB;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AACF,GAAsD;AACpD,MACE,MAAM,UAAU,UAAa,MAAM,UAAU,UAC7C,MAAM,WAAW,UAAa,MAAM,WAAW,QAC/C;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACA,QAAM,UAAU;AAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,IACX;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,OAAO;AAAA,QACL,MAAM;AAAA,QACN,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,15 @@
1
+ import { getLayoutDirection, hasParentLayoutAllocation } from "../layout/context.js";
2
+ import { registerLayoutSuspensionResource, unregisterLayoutSuspensionResource } from "../layout/participation.js";
3
+ import { isLayoutComponent, prepareLayoutComponent } from "../layout/define-layout-component.js";
4
+ import { isKnownLayoutType, registerKnownLayoutPreflight, preflightKnownLayout, attachPreparedLayoutSlot, stagePreparedBoundaryChildren, takePreparedBoundaryChildren, preparedBoundaryNeedsAllocationParent, retainPreparedBoundarySubtree } from "../layout/prepared-root.js";
5
+ import { prepareLayoutChildren, prepareDirectChildStyle, resolveContainerBox } from "../layout/absolute.js";
6
+ import { setPreNormalizedStyle } from "../style/resolve-dispatch.js";
7
+ import { getChildPrimitiveReceiverToken } from "../element/metadata.js";
8
+ import { preparedStyleValue, preparedStyleQuery } from "../style/responsive.js";
9
+ import { nativeLayout } from "../layout/wasm/region.js";
1
10
  import { definePrimitive } from "../define-primitive.js";
2
11
  import { materializeContainerChildren } from "../element/children.js";
3
- import { createElement } from "../element/create-element.js";
12
+ import { clonePibblElement, createElement } from "../element/create-element.js";
4
13
  import { Fragment } from "../element/fragment.js";
5
14
  import { executeRender } from "../execute-render.js";
6
15
  import {
@@ -21,7 +30,8 @@ import { getCurrentWorldTransform } from "../render-target.js";
21
30
  import { createLayerSurface } from "../surface/resolve-surface.js";
22
31
  import {
23
32
  completeInstanceRenderRevision,
24
- hasPendingInstanceRender
33
+ hasPendingInstanceRender,
34
+ setInstanceAllocationParent
25
35
  } from "../scheduler/realm-scheduler.js";
26
36
  import {
27
37
  haveSameLayerNodeTree,
@@ -32,14 +42,20 @@ import {
32
42
  } from "./structural-events.js";
33
43
  function renderLayer(props, style, ctx) {
34
44
  wireStructuralEvents(props);
35
- const materializedChildren = materializeContainerChildren(
36
- props.children,
37
- "Layer"
38
- );
39
- const nextRoot = createPrivateLayerRoot(materializedChildren);
40
45
  const canvas = GLOBAL_STATE.canvas;
41
46
  const { width = canvas.width, height = canvas.height } = style;
42
47
  const componentRefs = GLOBAL_STATE.componentRefs;
48
+ let preparedBoundary = componentRefs.element;
49
+ let preparedChildren = nativeLayout ? takePreparedBoundaryChildren(preparedBoundary) : void 0;
50
+ if (nativeLayout && !preparedChildren) {
51
+ const slot2 = preflightKnownLayout(preparedBoundary, style, { x: 0, y: 0, width, height }, GLOBAL_STATE.primitiveReceiverToken);
52
+ preparedBoundary = clonePibblElement(preparedBoundary);
53
+ attachPreparedLayoutSlot(preparedBoundary, slot2);
54
+ preparedChildren = takePreparedBoundaryChildren(preparedBoundary);
55
+ }
56
+ const materializedChildren = preparedChildren ?? materializeContainerChildren(props.children, "Layer");
57
+ const needsPreparedAllocationParent = nativeLayout && preparedBoundaryNeedsAllocationParent(preparedBoundary);
58
+ const nextRoot = createPrivateLayerRoot(materializedChildren);
43
59
  const parentInstance = getCurrentPibblInstance();
44
60
  const parentSurface = getSurfaceSnapshot(parentInstance);
45
61
  const layerSurface = createLayerSurface(
@@ -72,10 +88,17 @@ function renderLayer(props, style, ctx) {
72
88
  interactionLayer: interactionLayer2,
73
89
  logicalWidth: width,
74
90
  logicalHeight: height,
91
+ layoutDirection: void 0,
75
92
  focusRenderRevision: void 0,
76
93
  retainedTree: void 0
77
94
  };
95
+ const suspensionResource = {
96
+ suspendLayout: () => parentInstance.paintEntries.delete(interactionLayer2)
97
+ };
98
+ registerLayoutSuspensionResource(componentRefs, suspensionResource);
78
99
  componentRefs.teardowns.add(() => {
100
+ unregisterLayoutSuspensionResource(componentRefs, suspensionResource);
101
+ setInstanceAllocationParent(childInstance);
79
102
  childInstance.eventParent = void 0;
80
103
  parentInstance.paintEntries.delete(interactionLayer2);
81
104
  controller.dispose();
@@ -84,6 +107,12 @@ function renderLayer(props, style, ctx) {
84
107
  const slot = componentRefs.refs[0];
85
108
  const offscreenCanvas = slot.canvas;
86
109
  const layerPibbl = getPibblInstance(offscreenCanvas);
110
+ if (nativeLayout) setInstanceAllocationParent(
111
+ layerPibbl,
112
+ hasParentLayoutAllocation() || needsPreparedAllocationParent ? parentInstance : void 0
113
+ );
114
+ const layoutDirection = getLayoutDirection();
115
+ const directionChanged = slot.layoutDirection !== layoutDirection;
87
116
  const dimensionsChanged = slot.logicalWidth !== width || slot.logicalHeight !== height;
88
117
  const surfaceChanged = offscreenCanvas.width !== layerSurface.backingWidth || offscreenCanvas.height !== layerSurface.backingHeight;
89
118
  const { interactionLayer } = slot;
@@ -96,7 +125,7 @@ function renderLayer(props, style, ctx) {
96
125
  parentInstance.paintEntries.add(interactionLayer);
97
126
  const focusPolicy = parentInstance.eventRoot.focusPolicy;
98
127
  const focusRenderRevision = focusPolicy?.layerFocusRenderRevision?.(layerPibbl);
99
- const shouldRender = GLOBAL_STATE.componentIsMounting || dimensionsChanged || surfaceChanged || !haveSameLayerNodeTree(slot.retainedTree, nextRoot) || slot.focusRenderRevision !== focusRenderRevision || hasPendingInstanceRender(layerPibbl);
128
+ const shouldRender = GLOBAL_STATE.componentIsMounting || dimensionsChanged || directionChanged || surfaceChanged || !haveSameLayerNodeTree(slot.retainedTree, nextRoot) || slot.focusRenderRevision !== focusRenderRevision || hasPendingInstanceRender(layerPibbl);
100
129
  if (shouldRender) {
101
130
  if (layerPibbl.surface.kind !== "layer") {
102
131
  throw new Error("Pibbl layer mounted without a derived surface.");
@@ -108,15 +137,24 @@ function renderLayer(props, style, ctx) {
108
137
  slot.logicalWidth = width;
109
138
  slot.logicalHeight = height;
110
139
  const renderedRevision = layerPibbl.requestedRenderRevision;
111
- executeRender(
112
- offscreenCanvas,
113
- getCurrentPibblInstance().renderTimestamp,
114
- nextRoot,
115
- false
116
- );
117
- completeInstanceRenderRevision(layerPibbl, renderedRevision);
118
- slot.retainedTree = snapshotLayerNodeTree(nextRoot);
140
+ const previousRootLayoutDirection = layerPibbl.rootLayoutDirection;
141
+ layerPibbl.rootLayoutDirection = layoutDirection;
142
+ try {
143
+ executeRender(
144
+ offscreenCanvas,
145
+ getCurrentPibblInstance().renderTimestamp,
146
+ nextRoot,
147
+ false
148
+ );
149
+ completeInstanceRenderRevision(layerPibbl, renderedRevision);
150
+ slot.retainedTree = snapshotLayerNodeTree(nextRoot);
151
+ slot.layoutDirection = layoutDirection;
152
+ } catch (error) {
153
+ layerPibbl.rootLayoutDirection = previousRootLayoutDirection;
154
+ throw error;
155
+ }
119
156
  } else {
157
+ if (nativeLayout) retainPreparedBoundarySubtree(preparedBoundary);
120
158
  parentInstance.eventRoot.focusPolicy?.replayRetainedSubtree(layerPibbl);
121
159
  }
122
160
  const renderedFocusPolicy = parentInstance.eventRoot.focusPolicy;
@@ -138,6 +176,50 @@ const Layer = definePrimitive(renderLayer, {
138
176
  childInput: "structural",
139
177
  resolveStyle: resolveLayerStyle
140
178
  });
179
+ if (nativeLayout) registerKnownLayoutPreflight(Layer, (element, _style, content, receiver, slot) => {
180
+ const previous = GLOBAL_STATE.primitiveReceiverToken;
181
+ GLOBAL_STATE.primitiveReceiverToken = receiver;
182
+ try {
183
+ const children = prepareLayoutChildren(element.props.children, "Layer");
184
+ const placed = children.slice();
185
+ let occurrences;
186
+ for (let index = 0; index < children.length; index++) {
187
+ const child = children[index];
188
+ if (!isKnownLayoutType(child.type) && !isLayoutComponent(child.type)) continue;
189
+ let occurrence = 0;
190
+ if (child.key === void 0) {
191
+ occurrences ??= /* @__PURE__ */ new Map();
192
+ occurrence = occurrences.get(child.type) ?? 0;
193
+ occurrences.set(child.type, occurrence + 1);
194
+ }
195
+ const token = getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, receiver, index);
196
+ const root = isLayoutComponent(child.type) ? prepareLayoutComponent(child, { receiverToken: token }) : child;
197
+ if (!isKnownLayoutType(root.type)) continue;
198
+ const component = root.type.name || "Layout";
199
+ const prepared = prepareDirectChildStyle(child, token, content, true);
200
+ const style = preparedStyleValue(prepared);
201
+ const context = { component, algorithm: "render-dispatch", allocation: content, percentageBasis: content, constraints: { minWidth: 0, maxWidth: content.width, minHeight: 0, maxHeight: content.height } };
202
+ let width, height;
203
+ if (root.type === Layer) {
204
+ const layerStyle = resolveLayerStyle(style, context);
205
+ width = layerStyle.width;
206
+ height = layerStyle.height;
207
+ } else {
208
+ const box = resolveContainerBox(style, context, component, "render-dispatch");
209
+ width = box.contentBox.width;
210
+ height = box.contentBox.height;
211
+ }
212
+ const nested = preflightKnownLayout(child, style, { x: 0, y: 0, width, height }, token, occurrence, slot);
213
+ const clone = clonePibblElement(child);
214
+ setPreNormalizedStyle(clone, style, child, token, preparedStyleQuery(prepared));
215
+ attachPreparedLayoutSlot(clone, nested);
216
+ placed[index] = clone;
217
+ }
218
+ stagePreparedBoundaryChildren(slot, placed);
219
+ } finally {
220
+ GLOBAL_STATE.primitiveReceiverToken = previous;
221
+ }
222
+ });
141
223
  function resolveLayerStyle(style, context) {
142
224
  return {
143
225
  ...stripLayoutParticipation(style),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/layer.ts"],
4
- "sourcesContent": ["import { definePrimitive } from '../define-primitive.js';\nimport { materializeContainerChildren } from '../element/children.js';\nimport { createElement } from '../element/create-element.js';\nimport { Fragment, type FragmentProps } from '../element/fragment.js';\nimport { executeRender } from '../execute-render.js';\nimport {\n getPibblInstance,\n getCurrentPibblInstance,\n GLOBAL_STATE,\n} from '../global-state.js';\nimport { mountPibbl } from '../mount-pibbl.js';\nimport {\n PibblNodeInput,\n PibblInteractionLayer,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport { PibblPaintEntryKind } from '../events/paint-entry.js';\nimport {\n resolveRequiredLength,\n stripLayoutParticipation,\n} from '../style/resolve-built-in.js';\nimport type {\n BoxStyle,\n LayoutItemStyle,\n ResolvedDrawingStyle,\n} from '../style/types.js';\nimport {\n getSurfaceSnapshot,\n} from '../surface/transform.js';\nimport { getCurrentWorldTransform } from '../render-target.js';\nimport { createLayerSurface } from '../surface/resolve-surface.js';\nimport {\n completeInstanceRenderRevision,\n hasPendingInstanceRender,\n} from '../scheduler/realm-scheduler.js';\nimport type { PibblElement } from '../element/types.js';\nimport {\n haveSameLayerNodeTree,\n snapshotLayerNodeTree,\n type LayerNodeSnapshot,\n} from './layer-node-equality.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from './structural-events.js';\n\n/**\n * Authored inputs for Layer, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Layer}\n */\nexport interface LayerProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n/**\n * Supported geometry and presentation properties for Layer.\n *\n * @see {@link SystemStyle}\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Layer}\n */\nexport interface LayerStyle extends SystemStyle, BoxStyle, LayoutItemStyle {}\n\ntype ResolvedLayerStyle = ResolvedDrawingStyle<LayerStyle> & {\n width: number;\n height: number;\n};\n\ninterface LayerSlot {\n canvas: OffscreenCanvas;\n interactionLayer: PibblInteractionLayer;\n logicalWidth: number;\n logicalHeight: number;\n focusRenderRevision: number | undefined;\n retainedTree: LayerNodeSnapshot | undefined;\n}\n\nfunction renderLayer(\n props: LayerProps,\n style: Readonly<ResolvedLayerStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n const materializedChildren = materializeContainerChildren(\n props.children,\n 'Layer',\n );\n const nextRoot = createPrivateLayerRoot(materializedChildren);\n const canvas = GLOBAL_STATE.canvas!;\n const { width = canvas.width, height = canvas.height } = style;\n const componentRefs = GLOBAL_STATE.componentRefs!;\n const parentInstance = getCurrentPibblInstance();\n const parentSurface = getSurfaceSnapshot(parentInstance);\n const layerSurface = createLayerSurface(\n width,\n height,\n parentSurface.backingPixelsPerLogicalUnitX,\n parentSurface.backingPixelsPerLogicalUnitY,\n );\n if (GLOBAL_STATE.componentIsMounting) {\n const offscreenCanvas = new OffscreenCanvas(\n layerSurface.backingWidth,\n layerSurface.backingHeight,\n );\n const controller = mountPibbl(offscreenCanvas, nextRoot, {\n parent: canvas,\n surface: layerSurface,\n });\n const childInstance = getPibblInstance(offscreenCanvas);\n childInstance.eventParent = componentRefs;\n const interactionLayer: PibblInteractionLayer = {\n paintKind: PibblPaintEntryKind.NestedInstance,\n instance: childInstance,\n transform: new DOMMatrix(),\n clippingStack: [],\n bounds: createBounds(width, height),\n resolveLocal: undefined,\n };\n componentRefs.refs[0] = {\n canvas: offscreenCanvas,\n interactionLayer,\n logicalWidth: width,\n logicalHeight: height,\n focusRenderRevision: undefined,\n retainedTree: undefined,\n } satisfies LayerSlot;\n componentRefs.teardowns.add(() => {\n childInstance.eventParent = undefined;\n parentInstance.paintEntries.delete(interactionLayer);\n controller.dispose();\n });\n }\n\n const slot = componentRefs.refs[0] as LayerSlot;\n const offscreenCanvas = slot.canvas;\n const layerPibbl = getPibblInstance(offscreenCanvas);\n const dimensionsChanged = slot.logicalWidth !== width ||\n slot.logicalHeight !== height;\n const surfaceChanged =\n offscreenCanvas.width !== layerSurface.backingWidth ||\n offscreenCanvas.height !== layerSurface.backingHeight;\n\n const { interactionLayer } = slot;\n parentInstance.paintEntries.delete(interactionLayer);\n interactionLayer.transform = getCurrentWorldTransform();\n interactionLayer.clippingStack = Array.from(GLOBAL_STATE.clippingStack);\n if (dimensionsChanged) {\n interactionLayer.bounds = createBounds(width, height);\n }\n // Install the current bridge before entering the child render. Focus bounds\n // collected by the child must never see the previous frame's transform.\n parentInstance.paintEntries.add(interactionLayer);\n\n const focusPolicy = parentInstance.eventRoot.focusPolicy;\n const focusRenderRevision = focusPolicy?.layerFocusRenderRevision?.(layerPibbl);\n\n const shouldRender =\n GLOBAL_STATE.componentIsMounting ||\n dimensionsChanged ||\n surfaceChanged ||\n !haveSameLayerNodeTree(slot.retainedTree, nextRoot) ||\n slot.focusRenderRevision !== focusRenderRevision ||\n hasPendingInstanceRender(layerPibbl);\n if (shouldRender) {\n if (layerPibbl.surface.kind !== 'layer') {\n throw new Error('Pibbl layer mounted without a derived surface.');\n }\n layerPibbl.surface.snapshot = layerSurface;\n layerPibbl.surface.managed = true;\n offscreenCanvas.width = layerSurface.backingWidth;\n offscreenCanvas.height = layerSurface.backingHeight;\n slot.logicalWidth = width;\n slot.logicalHeight = height;\n\n const renderedRevision = layerPibbl.requestedRenderRevision;\n executeRender(\n offscreenCanvas,\n getCurrentPibblInstance().renderTimestamp,\n nextRoot,\n false,\n );\n completeInstanceRenderRevision(layerPibbl, renderedRevision);\n slot.retainedTree = snapshotLayerNodeTree(nextRoot);\n } else {\n parentInstance.eventRoot.focusPolicy?.replayRetainedSubtree(layerPibbl);\n }\n const renderedFocusPolicy = parentInstance.eventRoot.focusPolicy;\n slot.focusRenderRevision =\n renderedFocusPolicy?.layerFocusRenderRevision?.(layerPibbl);\n\n parentInstance.eventRoot.html?.recordLayer(parentInstance, layerPibbl, interactionLayer, ctx.globalAlpha, ctx.globalCompositeOperation);\n\n ctx.drawImage(\n offscreenCanvas,\n 0,\n 0,\n offscreenCanvas.width,\n offscreenCanvas.height,\n 0,\n 0,\n width,\n height,\n );\n\n}\n\n/**\n * Describes a retained offscreen composition layer.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link LayerProps}\n * @see {@link LayerStyle}\n */\nexport const Layer = definePrimitive<\n LayerProps,\n LayerStyle,\n LayerStyle,\n ResolvedLayerStyle\n>(renderLayer, {\n childInput: 'structural',\n resolveStyle: resolveLayerStyle,\n});\n\nfunction resolveLayerStyle(\n style: Readonly<LayerStyle>,\n context: Parameters<NonNullable<\n import('../types.js').PrimitiveCapabilities<\n LayerProps,\n LayerStyle,\n LayerStyle,\n ResolvedLayerStyle\n >['resolveStyle']\n >>[1],\n): ResolvedLayerStyle {\n return {\n ...stripLayoutParticipation(style),\n width: resolveRequiredLength(\n style.width ?? context.allocation.width,\n context.percentageBasis.width,\n 'width',\n context,\n ),\n height: resolveRequiredLength(\n style.height ?? context.allocation.height,\n context.percentageBasis.height,\n 'height',\n context,\n ),\n } as ResolvedLayerStyle;\n}\n\nfunction createPrivateLayerRoot(\n children: readonly PibblElement<any>[],\n): PibblElement<FragmentProps> {\n return createElement(Fragment, {\n key: 'pibbl-layer-root',\n children,\n });\n}\n\nfunction createBounds(width: number, height: number): Path2D {\n const bounds = new Path2D();\n bounds.rect(0, 0, width, height);\n return bounds;\n}\n"],
5
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,oCAAoC;AAC7C,SAAS,qBAAqB;AAC9B,SAAS,gBAAoC;AAC7C,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAO3B,SAAS,2BAA2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a,sBAAsB,UAAU;AAAA,EACxE;AACA,QAAM,sBAAsB,eAAe,UAAU;AACrD,OAAK,sBACH,qBAAqB,2BAA2B,UAAU;AAE5D,iBAAe,UAAU,MAAM,YAAY,gBAAgB,YAAY,kBAAkB,IAAI,aAAa,IAAI,wBAAwB;AAEtI,MAAI;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEF;AAYO,MAAM,QAAQ,gBAKnB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAChB,CAAC;AAED,SAAS,kBACP,OACA,SAQoB;AACpB,SAAO;AAAA,IACL,GAAG,yBAAyB,KAAK;AAAA,IACjC,OAAO;AAAA,MACL,MAAM,SAAS,QAAQ,WAAW;AAAA,MAClC,QAAQ,gBAAgB;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,UAAU,QAAQ,WAAW;AAAA,MACnC,QAAQ,gBAAgB;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,uBACP,UAC6B;AAC7B,SAAO,cAAc,UAAU;AAAA,IAC7B,KAAK;AAAA,IACL;AAAA,EACF,CAAC;AACH;AAEA,SAAS,aAAa,OAAe,QAAwB;AAC3D,QAAM,SAAS,IAAI,OAAO;AAC1B,SAAO,KAAK,GAAG,GAAG,OAAO,MAAM;AAC/B,SAAO;AACT;",
6
- "names": ["offscreenCanvas", "interactionLayer"]
4
+ "sourcesContent": ["import { getLayoutDirection, hasParentLayoutAllocation } from '../layout/context.js';\nimport { registerLayoutSuspensionResource, unregisterLayoutSuspensionResource } from '../layout/participation.js';\nimport { isLayoutComponent, prepareLayoutComponent } from '../layout/define-layout-component.js';\nimport { isKnownLayoutType, registerKnownLayoutPreflight, preflightKnownLayout, attachPreparedLayoutSlot, stagePreparedBoundaryChildren, takePreparedBoundaryChildren, preparedBoundaryNeedsAllocationParent, retainPreparedBoundarySubtree } from '../layout/prepared-root.js';\nimport { prepareLayoutChildren, prepareDirectChildStyle, resolveContainerBox } from '../layout/absolute.js';\nimport { setPreNormalizedStyle } from '../style/resolve-dispatch.js';\nimport { getChildPrimitiveReceiverToken } from '../element/metadata.js';\nimport { preparedStyleValue, preparedStyleQuery } from '../style/responsive.js';\nimport { nativeLayout } from '../layout/wasm/region.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { materializeContainerChildren } from '../element/children.js';\nimport { clonePibblElement, createElement } from '../element/create-element.js';\nimport { Fragment, type FragmentProps } from '../element/fragment.js';\nimport { executeRender } from '../execute-render.js';\nimport {\n getPibblInstance,\n getCurrentPibblInstance,\n GLOBAL_STATE,\n} from '../global-state.js';\nimport { mountPibbl } from '../mount-pibbl.js';\nimport {\n PibblNodeInput,\n PibblInteractionLayer,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport { PibblPaintEntryKind } from '../events/paint-entry.js';\nimport {\n resolveRequiredLength,\n stripLayoutParticipation,\n} from '../style/resolve-built-in.js';\nimport type {\n BoxStyle,\n LayoutItemStyle,\n ResolvedDrawingStyle,\n} from '../style/types.js';\nimport {\n getSurfaceSnapshot,\n} from '../surface/transform.js';\nimport { getCurrentWorldTransform } from '../render-target.js';\nimport { createLayerSurface } from '../surface/resolve-surface.js';\nimport {\n completeInstanceRenderRevision,\n hasPendingInstanceRender,\n setInstanceAllocationParent,\n} from '../scheduler/realm-scheduler.js';\nimport type { PibblElement } from '../element/types.js';\nimport {\n haveSameLayerNodeTree,\n snapshotLayerNodeTree,\n type LayerNodeSnapshot,\n} from './layer-node-equality.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from './structural-events.js';\n\n/**\n * Authored inputs for Layer, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Layer}\n */\nexport interface LayerProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n/**\n * Supported geometry and presentation properties for Layer.\n *\n * @see {@link SystemStyle}\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Layer}\n */\nexport interface LayerStyle extends SystemStyle, BoxStyle, LayoutItemStyle {}\n\ntype ResolvedLayerStyle = ResolvedDrawingStyle<LayerStyle> & {\n width: number;\n height: number;\n};\n\ninterface LayerSlot {\n canvas: OffscreenCanvas;\n interactionLayer: PibblInteractionLayer;\n logicalWidth: number;\n logicalHeight: number;\n /** Direction used for the currently retained child bitmap. */\n layoutDirection: 'ltr' | 'rtl' | undefined;\n focusRenderRevision: number | undefined;\n retainedTree: LayerNodeSnapshot | undefined;\n}\n\nfunction renderLayer(\n props: LayerProps,\n style: Readonly<ResolvedLayerStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n const canvas = GLOBAL_STATE.canvas!;\n const { width = canvas.width, height = canvas.height } = style;\n const componentRefs = GLOBAL_STATE.componentRefs!;\n let preparedBoundary = componentRefs.element;\n let preparedChildren = nativeLayout ? takePreparedBoundaryChildren(preparedBoundary) : undefined;\n if (nativeLayout && !preparedChildren) {\n const slot = preflightKnownLayout(preparedBoundary, style, { x: 0, y: 0, width, height }, GLOBAL_STATE.primitiveReceiverToken);\n // Keep transaction metadata off the application-owned reusable descriptor.\n preparedBoundary = clonePibblElement(preparedBoundary);\n attachPreparedLayoutSlot(preparedBoundary, slot);\n preparedChildren = takePreparedBoundaryChildren(preparedBoundary);\n }\n const materializedChildren = preparedChildren ?? materializeContainerChildren(props.children, 'Layer');\n const needsPreparedAllocationParent = nativeLayout && preparedBoundaryNeedsAllocationParent(preparedBoundary);\n const nextRoot = createPrivateLayerRoot(materializedChildren);\n const parentInstance = getCurrentPibblInstance();\n const parentSurface = getSurfaceSnapshot(parentInstance);\n const layerSurface = createLayerSurface(\n width,\n height,\n parentSurface.backingPixelsPerLogicalUnitX,\n parentSurface.backingPixelsPerLogicalUnitY,\n );\n if (GLOBAL_STATE.componentIsMounting) {\n const offscreenCanvas = new OffscreenCanvas(\n layerSurface.backingWidth,\n layerSurface.backingHeight,\n );\n const controller = mountPibbl(offscreenCanvas, nextRoot, {\n parent: canvas,\n surface: layerSurface,\n });\n const childInstance = getPibblInstance(offscreenCanvas);\n childInstance.eventParent = componentRefs;\n const interactionLayer: PibblInteractionLayer = {\n paintKind: PibblPaintEntryKind.NestedInstance,\n instance: childInstance,\n transform: new DOMMatrix(),\n clippingStack: [],\n bounds: createBounds(width, height),\n resolveLocal: undefined,\n };\n componentRefs.refs[0] = {\n canvas: offscreenCanvas,\n interactionLayer,\n logicalWidth: width,\n logicalHeight: height,\n layoutDirection: undefined,\n focusRenderRevision: undefined,\n retainedTree: undefined,\n } satisfies LayerSlot;\n const suspensionResource = {\n suspendLayout: () => parentInstance.paintEntries.delete(interactionLayer),\n };\n registerLayoutSuspensionResource(componentRefs, suspensionResource);\n componentRefs.teardowns.add(() => {\n unregisterLayoutSuspensionResource(componentRefs, suspensionResource);\n setInstanceAllocationParent(childInstance);\n childInstance.eventParent = undefined;\n parentInstance.paintEntries.delete(interactionLayer);\n controller.dispose();\n });\n }\n\n const slot = componentRefs.refs[0] as LayerSlot;\n const offscreenCanvas = slot.canvas;\n const layerPibbl = getPibblInstance(offscreenCanvas);\n if (nativeLayout) setInstanceAllocationParent(layerPibbl,\n hasParentLayoutAllocation() || needsPreparedAllocationParent ? parentInstance : undefined);\n const layoutDirection = getLayoutDirection();\n const directionChanged = slot.layoutDirection !== layoutDirection;\n const dimensionsChanged = slot.logicalWidth !== width ||\n slot.logicalHeight !== height;\n const surfaceChanged =\n offscreenCanvas.width !== layerSurface.backingWidth ||\n offscreenCanvas.height !== layerSurface.backingHeight;\n\n const { interactionLayer } = slot;\n parentInstance.paintEntries.delete(interactionLayer);\n interactionLayer.transform = getCurrentWorldTransform();\n interactionLayer.clippingStack = Array.from(GLOBAL_STATE.clippingStack);\n if (dimensionsChanged) {\n interactionLayer.bounds = createBounds(width, height);\n }\n // Install the current bridge before entering the child render. Focus bounds\n // collected by the child must never see the previous frame's transform.\n parentInstance.paintEntries.add(interactionLayer);\n\n const focusPolicy = parentInstance.eventRoot.focusPolicy;\n const focusRenderRevision = focusPolicy?.layerFocusRenderRevision?.(layerPibbl);\n\n const shouldRender =\n GLOBAL_STATE.componentIsMounting ||\n dimensionsChanged ||\n directionChanged ||\n surfaceChanged ||\n !haveSameLayerNodeTree(slot.retainedTree, nextRoot) ||\n slot.focusRenderRevision !== focusRenderRevision ||\n hasPendingInstanceRender(layerPibbl);\n if (shouldRender) {\n if (layerPibbl.surface.kind !== 'layer') {\n throw new Error('Pibbl layer mounted without a derived surface.');\n }\n layerPibbl.surface.snapshot = layerSurface;\n layerPibbl.surface.managed = true;\n offscreenCanvas.width = layerSurface.backingWidth;\n offscreenCanvas.height = layerSurface.backingHeight;\n slot.logicalWidth = width;\n slot.logicalHeight = height;\n\n const renderedRevision = layerPibbl.requestedRenderRevision;\n const previousRootLayoutDirection = layerPibbl.rootLayoutDirection;\n layerPibbl.rootLayoutDirection = layoutDirection;\n try {\n executeRender(\n offscreenCanvas,\n getCurrentPibblInstance().renderTimestamp,\n nextRoot,\n false,\n );\n completeInstanceRenderRevision(layerPibbl, renderedRevision);\n slot.retainedTree = snapshotLayerNodeTree(nextRoot);\n slot.layoutDirection = layoutDirection;\n } catch (error) {\n layerPibbl.rootLayoutDirection = previousRootLayoutDirection;\n throw error;\n }\n } else {\n if (nativeLayout) retainPreparedBoundarySubtree(preparedBoundary);\n parentInstance.eventRoot.focusPolicy?.replayRetainedSubtree(layerPibbl);\n }\n const renderedFocusPolicy = parentInstance.eventRoot.focusPolicy;\n slot.focusRenderRevision =\n renderedFocusPolicy?.layerFocusRenderRevision?.(layerPibbl);\n\n parentInstance.eventRoot.html?.recordLayer(parentInstance, layerPibbl, interactionLayer, ctx.globalAlpha, ctx.globalCompositeOperation);\n\n ctx.drawImage(\n offscreenCanvas,\n 0,\n 0,\n offscreenCanvas.width,\n offscreenCanvas.height,\n 0,\n 0,\n width,\n height,\n );\n\n}\n\n/**\n * Describes a retained offscreen composition layer.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link LayerProps}\n * @see {@link LayerStyle}\n */\nexport const Layer = definePrimitive<\n LayerProps,\n LayerStyle,\n LayerStyle,\n ResolvedLayerStyle\n>(renderLayer, {\n childInput: 'structural',\n resolveStyle: resolveLayerStyle,\n});\n\nif (nativeLayout) registerKnownLayoutPreflight(Layer, (element, _style, content, receiver, slot) => {\n const previous = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken = receiver;\n try {\n const children = prepareLayoutChildren(element.props.children, 'Layer');\n const placed = children.slice();\n let occurrences: Map<Function, number> | undefined;\n for (let index = 0; index < children.length; index++) {\n const child = children[index];\n // Layer is a raster boundary, not a layout algorithm for arbitrary children.\n if (!isKnownLayoutType(child.type) && !isLayoutComponent(child.type)) continue;\n let occurrence = 0;\n if (child.key === undefined) {\n occurrences ??= new Map(); occurrence = occurrences.get(child.type) ?? 0;\n occurrences.set(child.type, occurrence + 1);\n }\n const token = getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, receiver, index);\n const root = isLayoutComponent(child.type) ? prepareLayoutComponent(child, { receiverToken: token }) : child;\n if (!isKnownLayoutType(root.type)) continue;\n const component = root.type.name || 'Layout';\n const prepared = prepareDirectChildStyle(child, token, content, true);\n const style = preparedStyleValue(prepared);\n const context = { component, algorithm: 'render-dispatch' as const, allocation: content, percentageBasis: content, constraints: { minWidth: 0, maxWidth: content.width, minHeight: 0, maxHeight: content.height } };\n // A nested raster boundary uses Layer's actual dimensions, not box layout.\n let width: number, height: number;\n if (root.type === Layer) {\n const layerStyle = resolveLayerStyle(style, context);\n width = layerStyle.width!; height = layerStyle.height!;\n } else {\n const box = resolveContainerBox(style, context, component, 'render-dispatch');\n width = box.contentBox.width; height = box.contentBox.height;\n }\n const nested = preflightKnownLayout(child, style, { x: 0, y: 0, width, height }, token, occurrence, slot);\n const clone = clonePibblElement(child);\n setPreNormalizedStyle(clone, style, child, token, preparedStyleQuery(prepared));\n attachPreparedLayoutSlot(clone, nested); placed[index] = clone;\n }\n stagePreparedBoundaryChildren(slot, placed);\n } finally { GLOBAL_STATE.primitiveReceiverToken = previous; }\n});\n\nfunction resolveLayerStyle(\n style: Readonly<LayerStyle>,\n context: Parameters<NonNullable<\n import('../types.js').PrimitiveCapabilities<\n LayerProps,\n LayerStyle,\n LayerStyle,\n ResolvedLayerStyle\n >['resolveStyle']\n >>[1],\n): ResolvedLayerStyle {\n return {\n ...stripLayoutParticipation(style),\n width: resolveRequiredLength(\n style.width ?? context.allocation.width,\n context.percentageBasis.width,\n 'width',\n context,\n ),\n height: resolveRequiredLength(\n style.height ?? context.allocation.height,\n context.percentageBasis.height,\n 'height',\n context,\n ),\n } as ResolvedLayerStyle;\n}\n\nfunction createPrivateLayerRoot(\n children: readonly PibblElement<any>[],\n): PibblElement<FragmentProps> {\n return createElement(Fragment, {\n key: 'pibbl-layer-root',\n children,\n });\n}\n\nfunction createBounds(width: number, height: number): Path2D {\n const bounds = new Path2D();\n bounds.rect(0, 0, width, height);\n return bounds;\n}\n"],
5
+ "mappings": "AAAA,SAAS,oBAAoB,iCAAiC;AAC9D,SAAS,kCAAkC,0CAA0C;AACrF,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,mBAAmB,8BAA8B,sBAAsB,0BAA0B,+BAA+B,8BAA8B,uCAAuC,qCAAqC;AACnP,SAAS,uBAAuB,yBAAyB,2BAA2B;AACpF,SAAS,6BAA6B;AACtC,SAAS,sCAAsC;AAC/C,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oCAAoC;AAC7C,SAAS,mBAAmB,qBAAqB;AACjD,SAAS,gBAAoC;AAC7C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lers, PibblEventParticipationOptions } from '../events/types.js';
2
2
  import type { TextStyle } from '../style/types.js';
3
+ import { CanvasMeasurementService } from '../types.js';
3
4
  import type { PibblTextInput } from '../types.js';
4
5
  import type { PibblPhysics2DPropExtension } from '../types.js';
5
6
  /**
@@ -27,3 +28,18 @@ export interface TextProps extends PibblEventHandlers, PibblEventFocusOptions, P
27
28
  * @see {@link TextStyle}
28
29
  */
29
30
  export declare const Text: import("@pibbl/core").PibblPrimitiveComponent<TextProps, import("@pibbl/core").PrimitiveInput<TextProps, TextStyle>>;
31
+ /** @internal Measure a materialized value without bypassing receiver reads. */
32
+ export declare function measureLayoutTextNaturalRun(text: string, options: {
33
+ font: string;
34
+ service: CanvasMeasurementService;
35
+ }): number;
36
+ /** @internal Longest run under Text's existing ASCII-space wrapping contract. */
37
+ export declare function measureLayoutTextMinimumWidth(props: Readonly<TextProps>, options: {
38
+ font: string;
39
+ service: CanvasMeasurementService;
40
+ receiverToken?: object;
41
+ }): number;
42
+ /** @internal Prepare measured Text through its existing transaction/receiver ownership. */
43
+ export declare function prepareLayoutTextContent(props: Readonly<TextProps>, options: {
44
+ receiverToken?: object;
45
+ }): string;