@pibbl/core 0.0.2 → 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 (549) hide show
  1. package/THIRD_PARTY_NOTICES.txt +81 -0
  2. package/dist/features/physics/2d-testing.d.ts +1 -1
  3. package/dist/features/physics/2d-testing.js +2 -2
  4. package/dist/features/physics/2d-testing.js.map +2 -2
  5. package/dist/features/physics/lib/2d/canvas/components.js +25 -21
  6. package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
  7. package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
  8. package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
  9. package/dist/features/physics/lib/2d/collision/casts.js +4 -2
  10. package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
  11. package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
  12. package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
  13. package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
  14. package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
  15. package/dist/features/physics/lib/2d/shapes.js +8 -9
  16. package/dist/features/physics/lib/2d/shapes.js.map +2 -2
  17. package/dist/features/physics/lib/2d/world/rapier.js +22 -26
  18. package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
  19. package/dist/features/sprites/loader.js +6 -3
  20. package/dist/features/sprites/loader.js.map +2 -2
  21. package/dist/features/textures/index.d.ts +12 -2
  22. package/dist/features/textures/index.js +33 -1
  23. package/dist/features/textures/index.js.map +2 -2
  24. package/dist/features/textures/lib/chemical-field.d.ts +56 -0
  25. package/dist/features/textures/lib/chemical-field.js +154 -0
  26. package/dist/features/textures/lib/chemical-field.js.map +7 -0
  27. package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
  28. package/dist/features/textures/lib/chemical-recipes.js +275 -0
  29. package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
  30. package/dist/features/textures/lib/definitions.d.ts +3 -18
  31. package/dist/features/textures/lib/definitions.js +17 -24
  32. package/dist/features/textures/lib/definitions.js.map +2 -2
  33. package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
  34. package/dist/features/textures/lib/geometric-patterns.js +305 -0
  35. package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
  36. package/dist/features/textures/lib/gray-scott.d.ts +55 -0
  37. package/dist/features/textures/lib/gray-scott.js +37 -0
  38. package/dist/features/textures/lib/gray-scott.js.map +7 -0
  39. package/dist/features/textures/lib/palette.js +1 -3
  40. package/dist/features/textures/lib/palette.js.map +2 -2
  41. package/dist/features/textures/lib/patterns.d.ts +123 -0
  42. package/dist/features/textures/lib/patterns.js +344 -0
  43. package/dist/features/textures/lib/patterns.js.map +7 -0
  44. package/dist/features/textures/lib/rain-drops.js +2 -1
  45. package/dist/features/textures/lib/rain-drops.js.map +2 -2
  46. package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
  47. package/dist/features/textures/lib/reaction-diffusion.js +9 -20
  48. package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
  49. package/dist/features/textures/lib/simulation.d.ts +10 -4
  50. package/dist/features/textures/lib/simulation.js +23 -13
  51. package/dist/features/textures/lib/simulation.js.map +2 -2
  52. package/dist/features/textures/lib/wasm/electric.js +8 -1
  53. package/dist/features/textures/lib/wasm/electric.js.map +2 -2
  54. package/dist/features/textures/lib/water-surface.js +1 -3
  55. package/dist/features/textures/lib/water-surface.js.map +2 -2
  56. package/dist/features/viz/index.d.ts +68 -6
  57. package/dist/features/viz/index.js +164 -2
  58. package/dist/features/viz/index.js.map +2 -2
  59. package/dist/features/viz/inspection/bar.d.ts +79 -0
  60. package/dist/features/viz/inspection/bar.js +49 -0
  61. package/dist/features/viz/inspection/bar.js.map +7 -0
  62. package/dist/features/viz/inspection/candle.d.ts +156 -0
  63. package/dist/features/viz/inspection/candle.js +120 -0
  64. package/dist/features/viz/inspection/candle.js.map +7 -0
  65. package/dist/features/viz/inspection/capture-types.d.ts +65 -0
  66. package/dist/features/viz/inspection/capture.d.ts +16 -0
  67. package/dist/features/viz/inspection/capture.js +49 -0
  68. package/dist/features/viz/inspection/capture.js.map +7 -0
  69. package/dist/features/viz/inspection/handler.d.ts +36 -0
  70. package/dist/features/viz/inspection/handler.js +91 -0
  71. package/dist/features/viz/inspection/handler.js.map +7 -0
  72. package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
  73. package/dist/features/viz/inspection/ohlc-bar.js +118 -0
  74. package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
  75. package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
  76. package/dist/features/viz/inspection/owned-ref.js +99 -0
  77. package/dist/features/viz/inspection/owned-ref.js.map +7 -0
  78. package/dist/features/viz/inspection/painted-point.d.ts +22 -0
  79. package/dist/features/viz/inspection/painted-point.js +29 -0
  80. package/dist/features/viz/inspection/painted-point.js.map +7 -0
  81. package/dist/features/viz/inspection/queries.d.ts +100 -0
  82. package/dist/features/viz/inspection/queries.js +192 -0
  83. package/dist/features/viz/inspection/queries.js.map +7 -0
  84. package/dist/features/viz/inspection/query-types.d.ts +177 -0
  85. package/dist/features/viz/inspection/volume.d.ts +104 -0
  86. package/dist/features/viz/inspection/volume.js +95 -0
  87. package/dist/features/viz/inspection/volume.js.map +7 -0
  88. package/dist/features/viz/inspection.d.ts +19 -0
  89. package/dist/features/viz/inspection.js +54 -0
  90. package/dist/features/viz/inspection.js.map +7 -0
  91. package/dist/features/viz/inspection.mjs +1 -0
  92. package/dist/features/viz/lib/area-series.d.ts +62 -0
  93. package/dist/features/viz/lib/area-series.js +120 -0
  94. package/dist/features/viz/lib/area-series.js.map +7 -0
  95. package/dist/features/viz/lib/axis-title.js +2 -1
  96. package/dist/features/viz/lib/axis-title.js.map +2 -2
  97. package/dist/features/viz/lib/axis.js +1 -1
  98. package/dist/features/viz/lib/axis.js.map +2 -2
  99. package/dist/features/viz/lib/bar-series.d.ts +3 -1
  100. package/dist/features/viz/lib/bar-series.js +16 -1
  101. package/dist/features/viz/lib/bar-series.js.map +2 -2
  102. package/dist/features/viz/lib/baseline-series.d.ts +55 -0
  103. package/dist/features/viz/lib/baseline-series.js +136 -0
  104. package/dist/features/viz/lib/baseline-series.js.map +7 -0
  105. package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
  106. package/dist/features/viz/lib/candlestick-series.js +150 -0
  107. package/dist/features/viz/lib/candlestick-series.js.map +7 -0
  108. package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
  109. package/dist/features/viz/lib/censored-point-series.js +129 -0
  110. package/dist/features/viz/lib/censored-point-series.js.map +7 -0
  111. package/dist/features/viz/lib/color-context.d.ts +4 -0
  112. package/dist/features/viz/lib/color-context.js +41 -0
  113. package/dist/features/viz/lib/color-context.js.map +7 -0
  114. package/dist/features/viz/lib/color-math.d.ts +4 -0
  115. package/dist/features/viz/lib/color-math.js +31 -0
  116. package/dist/features/viz/lib/color-math.js.map +7 -0
  117. package/dist/features/viz/lib/color-types.d.ts +53 -0
  118. package/dist/features/viz/lib/curve-definition.d.ts +49 -0
  119. package/dist/features/viz/lib/curve-definition.js +142 -0
  120. package/dist/features/viz/lib/curve-definition.js.map +7 -0
  121. package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
  122. package/dist/features/viz/lib/diverging-color-scale.js +51 -0
  123. package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
  124. package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
  125. package/dist/features/viz/lib/domain-navigation.js +77 -0
  126. package/dist/features/viz/lib/domain-navigation.js.map +7 -0
  127. package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
  128. package/dist/features/viz/lib/editable-chart-elements.js +733 -0
  129. package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
  130. package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
  131. package/dist/features/viz/lib/financial-aggregation.js +116 -0
  132. package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
  133. package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
  134. package/dist/features/viz/lib/financial-autoscale.js +61 -0
  135. package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
  136. package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
  137. package/dist/features/viz/lib/financial-comparison.js +98 -0
  138. package/dist/features/viz/lib/financial-comparison.js.map +7 -0
  139. package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
  140. package/dist/features/viz/lib/financial-geometry.js +67 -0
  141. package/dist/features/viz/lib/financial-geometry.js.map +7 -0
  142. package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
  143. package/dist/features/viz/lib/financial-indicators.js +135 -0
  144. package/dist/features/viz/lib/financial-indicators.js.map +7 -0
  145. package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
  146. package/dist/features/viz/lib/financial-oscillators.js +265 -0
  147. package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
  148. package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
  149. package/dist/features/viz/lib/graph/bipartite.js +250 -0
  150. package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
  151. package/dist/features/viz/lib/graph/chord.d.ts +44 -0
  152. package/dist/features/viz/lib/graph/chord.js +348 -0
  153. package/dist/features/viz/lib/graph/chord.js.map +7 -0
  154. package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
  155. package/dist/features/viz/lib/graph/dependency.js +140 -0
  156. package/dist/features/viz/lib/graph/dependency.js.map +7 -0
  157. package/dist/features/viz/lib/graph/force.d.ts +28 -0
  158. package/dist/features/viz/lib/graph/force.js +580 -0
  159. package/dist/features/viz/lib/graph/force.js.map +7 -0
  160. package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
  161. package/dist/features/viz/lib/graph/hierarchy.js +112 -0
  162. package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
  163. package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
  164. package/dist/features/viz/lib/graph/icicle.js +153 -0
  165. package/dist/features/viz/lib/graph/icicle.js.map +7 -0
  166. package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
  167. package/dist/features/viz/lib/graph/matrix.js +243 -0
  168. package/dist/features/viz/lib/graph/matrix.js.map +7 -0
  169. package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
  170. package/dist/features/viz/lib/graph/neighborhood.js +281 -0
  171. package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
  172. package/dist/features/viz/lib/graph/routes.d.ts +35 -0
  173. package/dist/features/viz/lib/graph/routes.js +101 -0
  174. package/dist/features/viz/lib/graph/routes.js.map +7 -0
  175. package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
  176. package/dist/features/viz/lib/graph/sankey.js +341 -0
  177. package/dist/features/viz/lib/graph/sankey.js.map +7 -0
  178. package/dist/features/viz/lib/graph/shared.d.ts +59 -0
  179. package/dist/features/viz/lib/graph/shared.js +301 -0
  180. package/dist/features/viz/lib/graph/shared.js.map +7 -0
  181. package/dist/features/viz/lib/graph/tree.d.ts +11 -0
  182. package/dist/features/viz/lib/graph/tree.js +232 -0
  183. package/dist/features/viz/lib/graph/tree.js.map +7 -0
  184. package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
  185. package/dist/features/viz/lib/graph/treemap.js +227 -0
  186. package/dist/features/viz/lib/graph/treemap.js.map +7 -0
  187. package/dist/features/viz/lib/graph/types.d.ts +1097 -0
  188. package/dist/features/viz/lib/hover-card.js +8 -9
  189. package/dist/features/viz/lib/hover-card.js.map +2 -2
  190. package/dist/features/viz/lib/hover-data.d.ts +1 -1
  191. package/dist/features/viz/lib/hover-data.js +5 -2
  192. package/dist/features/viz/lib/hover-data.js.map +2 -2
  193. package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
  194. package/dist/features/viz/lib/interval-band-series.js +136 -0
  195. package/dist/features/viz/lib/interval-band-series.js.map +7 -0
  196. package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
  197. package/dist/features/viz/lib/interval-diamond-series.js +122 -0
  198. package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
  199. package/dist/features/viz/lib/interval-series.d.ts +79 -0
  200. package/dist/features/viz/lib/interval-series.js +158 -0
  201. package/dist/features/viz/lib/interval-series.js.map +7 -0
  202. package/dist/features/viz/lib/layout-pie.js +9 -13
  203. package/dist/features/viz/lib/layout-pie.js.map +2 -2
  204. package/dist/features/viz/lib/line-series.d.ts +1 -1
  205. package/dist/features/viz/lib/line-series.js +47 -28
  206. package/dist/features/viz/lib/line-series.js.map +2 -2
  207. package/dist/features/viz/lib/linear-scale.js +1 -1
  208. package/dist/features/viz/lib/linear-scale.js.map +2 -2
  209. package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
  210. package/dist/features/viz/lib/monotone-curve.js +63 -0
  211. package/dist/features/viz/lib/monotone-curve.js.map +7 -0
  212. package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
  213. package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
  214. package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
  215. package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
  216. package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
  217. package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
  218. package/dist/features/viz/lib/paired-series.d.ts +44 -0
  219. package/dist/features/viz/lib/paired-series.js +93 -0
  220. package/dist/features/viz/lib/paired-series.js.map +7 -0
  221. package/dist/features/viz/lib/pie-layout.js +2 -1
  222. package/dist/features/viz/lib/pie-layout.js.map +2 -2
  223. package/dist/features/viz/lib/plot-series.js +11 -6
  224. package/dist/features/viz/lib/plot-series.js.map +2 -2
  225. package/dist/features/viz/lib/plot-types.d.ts +4 -3
  226. package/dist/features/viz/lib/point-series.d.ts +1 -1
  227. package/dist/features/viz/lib/point-series.js +36 -9
  228. package/dist/features/viz/lib/point-series.js.map +2 -2
  229. package/dist/features/viz/lib/point-types.d.ts +5 -2
  230. package/dist/features/viz/lib/reference-band.js +4 -1
  231. package/dist/features/viz/lib/reference-band.js.map +2 -2
  232. package/dist/features/viz/lib/scale-context.d.ts +1 -1
  233. package/dist/features/viz/lib/scale-ticks.js +21 -6
  234. package/dist/features/viz/lib/scale-ticks.js.map +2 -2
  235. package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
  236. package/dist/features/viz/lib/sequential-color-scale.js +49 -0
  237. package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
  238. package/dist/features/viz/lib/series-position.d.ts +12 -0
  239. package/dist/features/viz/lib/series-position.js +44 -0
  240. package/dist/features/viz/lib/series-position.js.map +7 -0
  241. package/dist/features/viz/lib/step-curves.d.ts +19 -0
  242. package/dist/features/viz/lib/step-curves.js +53 -0
  243. package/dist/features/viz/lib/step-curves.js.map +7 -0
  244. package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
  245. package/dist/features/viz/lib/threshold-color-scale.js +59 -0
  246. package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
  247. package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
  248. package/dist/features/viz/lib/trading-time-mapping.js +89 -0
  249. package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
  250. package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
  251. package/dist/features/viz/lib/trading-time-scale.js +96 -0
  252. package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
  253. package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
  254. package/dist/features/viz/lib/trajectory-series.js +111 -0
  255. package/dist/features/viz/lib/trajectory-series.js.map +7 -0
  256. package/dist/features/viz/lib/types.d.ts +20 -4
  257. package/dist/features/viz/lib/use-continuous-scale.js +6 -1
  258. package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
  259. package/dist/features/viz/lib/utc-scale.js +11 -10
  260. package/dist/features/viz/lib/utc-scale.js.map +2 -2
  261. package/dist/features/viz/lib/volume-series.d.ts +59 -0
  262. package/dist/features/viz/lib/volume-series.js +117 -0
  263. package/dist/features/viz/lib/volume-series.js.map +7 -0
  264. package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
  265. package/dist/features/viz/lib/weighted-point-series.js +169 -0
  266. package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
  267. package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
  268. package/dist/filters/backdrop-contrast-gpu.js +33 -0
  269. package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
  270. package/dist/filters/backdrop-contrast.d.ts +21 -0
  271. package/dist/filters/backdrop-contrast.js +61 -0
  272. package/dist/filters/backdrop-contrast.js.map +7 -0
  273. package/dist/filters/displacement.js +1 -1
  274. package/dist/filters/displacement.js.map +2 -2
  275. package/dist/filters/emboss-gpu.d.ts +4 -0
  276. package/dist/filters/emboss-gpu.js +39 -0
  277. package/dist/filters/emboss-gpu.js.map +7 -0
  278. package/dist/filters/emboss.d.ts +32 -0
  279. package/dist/filters/emboss.js +104 -0
  280. package/dist/filters/emboss.js.map +7 -0
  281. package/dist/filters/filter-executor.d.ts +11 -4
  282. package/dist/filters/filter-executor.js +104 -49
  283. package/dist/filters/filter-executor.js.map +2 -2
  284. package/dist/filters/reflected-light.js +1 -1
  285. package/dist/filters/reflected-light.js.map +2 -2
  286. package/dist/filters/reflection-gpu.d.ts +3 -1
  287. package/dist/filters/reflection-gpu.js +5 -2
  288. package/dist/filters/reflection-gpu.js.map +2 -2
  289. package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
  290. package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
  291. package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
  292. package/dist/filters/render-emboss-boundary.d.ts +13 -0
  293. package/dist/filters/render-emboss-boundary.js +131 -0
  294. package/dist/filters/render-emboss-boundary.js.map +7 -0
  295. package/dist/filters.d.ts +9 -5
  296. package/dist/filters.js +4 -0
  297. package/dist/filters.js.map +2 -2
  298. package/dist/index.d.ts +9 -5
  299. package/dist/index.js +18 -2
  300. package/dist/index.js.map +2 -2
  301. package/dist/internal.d.ts +4 -0
  302. package/dist/internal.js +6 -0
  303. package/dist/internal.js.map +2 -2
  304. package/dist/layout-kernel.d.ts +12 -0
  305. package/dist/layout-kernel.js +11 -0
  306. package/dist/layout-kernel.js.map +7 -0
  307. package/dist/layout-kernel.mjs +1 -0
  308. package/dist/lib/backend/types.d.ts +13 -1
  309. package/dist/lib/backend/types.js.map +2 -2
  310. package/dist/lib/components/arc-geometry.js +2 -1
  311. package/dist/lib/components/arc-geometry.js.map +2 -2
  312. package/dist/lib/components/g.js +2 -0
  313. package/dist/lib/components/g.js.map +2 -2
  314. package/dist/lib/components/html-box.js +2 -1
  315. package/dist/lib/components/html-box.js.map +2 -2
  316. package/dist/lib/components/img.js +3 -3
  317. package/dist/lib/components/img.js.map +2 -2
  318. package/dist/lib/components/layer.js +98 -16
  319. package/dist/lib/components/layer.js.map +3 -3
  320. package/dist/lib/components/text.d.ts +16 -0
  321. package/dist/lib/components/text.js +131 -24
  322. package/dist/lib/components/text.js.map +2 -2
  323. package/dist/lib/define-primitive.d.ts +4 -2
  324. package/dist/lib/define-primitive.js +3 -1
  325. package/dist/lib/define-primitive.js.map +2 -2
  326. package/dist/lib/element/metadata.d.ts +9 -0
  327. package/dist/lib/element/metadata.js +19 -0
  328. package/dist/lib/element/metadata.js.map +2 -2
  329. package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
  330. package/dist/lib/element/resolve-primitive-inputs.js +17 -4
  331. package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
  332. package/dist/lib/events/event-facade.d.ts +18 -0
  333. package/dist/lib/events/event-facade.js +28 -2
  334. package/dist/lib/events/event-facade.js.map +2 -2
  335. package/dist/lib/events/hit-test.js +2 -1
  336. package/dist/lib/events/hit-test.js.map +2 -2
  337. package/dist/lib/events/propagation.d.ts +2 -1
  338. package/dist/lib/events/propagation.js +22 -16
  339. package/dist/lib/events/propagation.js.map +2 -2
  340. package/dist/lib/events/registrations.d.ts +10 -0
  341. package/dist/lib/events/registrations.js +160 -5
  342. package/dist/lib/events/registrations.js.map +2 -2
  343. package/dist/lib/execute-render.js +25 -1
  344. package/dist/lib/execute-render.js.map +2 -2
  345. package/dist/lib/filter/filter-region.js +3 -10
  346. package/dist/lib/filter/filter-region.js.map +2 -2
  347. package/dist/lib/focus/focus-manager.d.ts +8 -1
  348. package/dist/lib/focus/focus-manager.js +87 -43
  349. package/dist/lib/focus/focus-manager.js.map +2 -2
  350. package/dist/lib/focus/geometry.d.ts +2 -0
  351. package/dist/lib/focus/geometry.js +6 -0
  352. package/dist/lib/focus/geometry.js.map +2 -2
  353. package/dist/lib/geometry/path-bend-guide.js +1 -1
  354. package/dist/lib/geometry/path-bend-guide.js.map +2 -2
  355. package/dist/lib/geometry/path-geometry.js +12 -11
  356. package/dist/lib/geometry/path-geometry.js.map +2 -2
  357. package/dist/lib/geometry/path-transforms.js +17 -21
  358. package/dist/lib/geometry/path-transforms.js.map +2 -2
  359. package/dist/lib/geometry/path-warp-bezier.js +3 -1
  360. package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
  361. package/dist/lib/geometry/path-warp.js +1 -1
  362. package/dist/lib/geometry/path-warp.js.map +2 -2
  363. package/dist/lib/global-state.js +2 -0
  364. package/dist/lib/global-state.js.map +2 -2
  365. package/dist/lib/html/html-events.d.ts +32 -0
  366. package/dist/lib/html/html-events.js +179 -0
  367. package/dist/lib/html/html-events.js.map +7 -0
  368. package/dist/lib/html/html-service.d.ts +8 -2
  369. package/dist/lib/html/html-service.js +198 -65
  370. package/dist/lib/html/html-service.js.map +2 -2
  371. package/dist/lib/html/overlay-config.js +7 -6
  372. package/dist/lib/html/overlay-config.js.map +2 -2
  373. package/dist/lib/html/types.d.ts +29 -2
  374. package/dist/lib/layout/absolute.d.ts +11 -5
  375. package/dist/lib/layout/absolute.js +329 -55
  376. package/dist/lib/layout/absolute.js.map +3 -3
  377. package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
  378. package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
  379. package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
  380. package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
  381. package/dist/lib/layout/allocation-checkpoint.js +463 -0
  382. package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
  383. package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
  384. package/dist/lib/layout/allocation-dependencies.js +90 -0
  385. package/dist/lib/layout/allocation-dependencies.js.map +7 -0
  386. package/dist/lib/layout/allocation-revision.d.ts +13 -0
  387. package/dist/lib/layout/allocation-revision.js +67 -0
  388. package/dist/lib/layout/allocation-revision.js.map +7 -0
  389. package/dist/lib/layout/box-insets.d.ts +17 -0
  390. package/dist/lib/layout/box-insets.js +138 -0
  391. package/dist/lib/layout/box-insets.js.map +7 -0
  392. package/dist/lib/layout/box-sizing.d.ts +16 -0
  393. package/dist/lib/layout/box-sizing.js +77 -0
  394. package/dist/lib/layout/box-sizing.js.map +7 -0
  395. package/dist/lib/layout/box.js +42 -12
  396. package/dist/lib/layout/box.js.map +2 -2
  397. package/dist/lib/layout/canvas-measurement.d.ts +13 -0
  398. package/dist/lib/layout/canvas-measurement.js +57 -0
  399. package/dist/lib/layout/canvas-measurement.js.map +7 -0
  400. package/dist/lib/layout/context.d.ts +35 -6
  401. package/dist/lib/layout/context.js +72 -3
  402. package/dist/lib/layout/context.js.map +2 -2
  403. package/dist/lib/layout/define-layout-component.d.ts +23 -0
  404. package/dist/lib/layout/define-layout-component.js +84 -0
  405. package/dist/lib/layout/define-layout-component.js.map +7 -0
  406. package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
  407. package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
  408. package/dist/lib/layout/flex-baseline-mode.js +7 -0
  409. package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
  410. package/dist/lib/layout/flex.d.ts +50 -15
  411. package/dist/lib/layout/flex.js +2124 -195
  412. package/dist/lib/layout/flex.js.map +3 -3
  413. package/dist/lib/layout/flow.js +225 -49
  414. package/dist/lib/layout/flow.js.map +2 -2
  415. package/dist/lib/layout/geometry-publication.d.ts +53 -0
  416. package/dist/lib/layout/geometry-publication.js +244 -0
  417. package/dist/lib/layout/geometry-publication.js.map +7 -0
  418. package/dist/lib/layout/grid-kernel.d.ts +63 -0
  419. package/dist/lib/layout/grid-kernel.js +168 -0
  420. package/dist/lib/layout/grid-kernel.js.map +7 -0
  421. package/dist/lib/layout/grid.d.ts +63 -4
  422. package/dist/lib/layout/grid.js +767 -171
  423. package/dist/lib/layout/grid.js.map +3 -3
  424. package/dist/lib/layout/measure.d.ts +55 -3
  425. package/dist/lib/layout/measure.js +448 -15
  426. package/dist/lib/layout/measure.js.map +2 -2
  427. package/dist/lib/layout/overlay.js +81 -23
  428. package/dist/lib/layout/overlay.js.map +2 -2
  429. package/dist/lib/layout/participation.d.ts +27 -0
  430. package/dist/lib/layout/participation.js +188 -0
  431. package/dist/lib/layout/participation.js.map +7 -0
  432. package/dist/lib/layout/place-child.js +1 -1
  433. package/dist/lib/layout/place-child.js.map +2 -2
  434. package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
  435. package/dist/lib/layout/positioning-diagnostics.js +13 -2
  436. package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
  437. package/dist/lib/layout/prepared-root.d.ts +121 -0
  438. package/dist/lib/layout/prepared-root.js +360 -0
  439. package/dist/lib/layout/prepared-root.js.map +7 -0
  440. package/dist/lib/layout/standalone-kernel.d.ts +60 -0
  441. package/dist/lib/layout/standalone-kernel.js +722 -0
  442. package/dist/lib/layout/standalone-kernel.js.map +7 -0
  443. package/dist/lib/layout/topology.d.ts +21 -0
  444. package/dist/lib/layout/topology.js +113 -0
  445. package/dist/lib/layout/topology.js.map +7 -0
  446. package/dist/lib/layout/types.d.ts +5 -0
  447. package/dist/lib/layout/wasm/artifact.d.ts +1 -0
  448. package/dist/lib/layout/wasm/artifact.js +5 -0
  449. package/dist/lib/layout/wasm/artifact.js.map +7 -0
  450. package/dist/lib/layout/wasm/bytes.d.ts +1 -0
  451. package/dist/lib/layout/wasm/bytes.js +5 -0
  452. package/dist/lib/layout/wasm/bytes.js.map +7 -0
  453. package/dist/lib/layout/wasm/embedded.d.ts +2 -0
  454. package/dist/lib/layout/wasm/embedded.js +12 -0
  455. package/dist/lib/layout/wasm/embedded.js.map +7 -0
  456. package/dist/lib/layout/wasm/layout.wasm +0 -0
  457. package/dist/lib/layout/wasm/module.d.ts +8 -0
  458. package/dist/lib/layout/wasm/module.js +70 -0
  459. package/dist/lib/layout/wasm/module.js.map +7 -0
  460. package/dist/lib/layout/wasm/region.d.ts +267 -0
  461. package/dist/lib/layout/wasm/region.js +1018 -0
  462. package/dist/lib/layout/wasm/region.js.map +7 -0
  463. package/dist/lib/manipulation/controller.js +4 -7
  464. package/dist/lib/manipulation/controller.js.map +2 -2
  465. package/dist/lib/manipulation/frame.js +1 -1
  466. package/dist/lib/manipulation/frame.js.map +2 -2
  467. package/dist/lib/manipulation/handles.js +32 -33
  468. package/dist/lib/manipulation/handles.js.map +2 -2
  469. package/dist/lib/manipulation/solve.js +12 -10
  470. package/dist/lib/manipulation/solve.js.map +2 -2
  471. package/dist/lib/mount-pibbl.js +1 -0
  472. package/dist/lib/mount-pibbl.js.map +2 -2
  473. package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
  474. package/dist/lib/mount-prepared-pibbl.js +29 -0
  475. package/dist/lib/mount-prepared-pibbl.js.map +7 -0
  476. package/dist/lib/mount-request.d.ts +8 -0
  477. package/dist/lib/mount-request.js +41 -0
  478. package/dist/lib/mount-request.js.map +7 -0
  479. package/dist/lib/pibbl.d.ts +21 -13
  480. package/dist/lib/pibbl.js +18 -16
  481. package/dist/lib/pibbl.js.map +2 -2
  482. package/dist/lib/recording/recording.d.ts +43 -0
  483. package/dist/lib/recording/recording.js +555 -0
  484. package/dist/lib/recording/recording.js.map +7 -0
  485. package/dist/lib/recording/types.d.ts +118 -0
  486. package/dist/lib/recording/wasm-bytes.d.ts +1 -0
  487. package/dist/lib/recording/wasm-bytes.js +5 -0
  488. package/dist/lib/recording/wasm-bytes.js.map +7 -0
  489. package/dist/lib/recording/worker-source.d.ts +1 -0
  490. package/dist/lib/recording/worker-source.js +5 -0
  491. package/dist/lib/recording/worker-source.js.map +7 -0
  492. package/dist/lib/render-layer/controller.d.ts +9 -3
  493. package/dist/lib/render-layer/controller.js +259 -110
  494. package/dist/lib/render-layer/controller.js.map +2 -2
  495. package/dist/lib/render-transaction.d.ts +12 -2
  496. package/dist/lib/render-transaction.js +69 -1
  497. package/dist/lib/render-transaction.js.map +2 -2
  498. package/dist/lib/render.js +32 -8
  499. package/dist/lib/render.js.map +2 -2
  500. package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
  501. package/dist/lib/scheduler/realm-scheduler.js +55 -26
  502. package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
  503. package/dist/lib/scheduler/renderer-participant.js +1 -0
  504. package/dist/lib/scheduler/renderer-participant.js.map +2 -2
  505. package/dist/lib/series-inspection-frame.d.ts +18 -0
  506. package/dist/lib/series-inspection-frame.js +70 -0
  507. package/dist/lib/series-inspection-frame.js.map +7 -0
  508. package/dist/lib/signals/edge.d.ts +7 -4
  509. package/dist/lib/signals/edge.js +25 -3
  510. package/dist/lib/signals/edge.js.map +2 -2
  511. package/dist/lib/signals/graph.d.ts +16 -2
  512. package/dist/lib/signals/graph.js +54 -12
  513. package/dist/lib/signals/graph.js.map +2 -2
  514. package/dist/lib/signals/input-provision.d.ts +15 -0
  515. package/dist/lib/signals/input-provision.js +53 -3
  516. package/dist/lib/signals/input-provision.js.map +2 -2
  517. package/dist/lib/signals/render-consumer.d.ts +3 -0
  518. package/dist/lib/signals/render-consumer.js +22 -14
  519. package/dist/lib/signals/render-consumer.js.map +2 -2
  520. package/dist/lib/style/positioning.d.ts +50 -2
  521. package/dist/lib/style/positioning.js +28 -4
  522. package/dist/lib/style/positioning.js.map +2 -2
  523. package/dist/lib/style/resolve-built-in.d.ts +4 -3
  524. package/dist/lib/style/resolve-built-in.js +17 -3
  525. package/dist/lib/style/resolve-built-in.js.map +2 -2
  526. package/dist/lib/style/resolve-dispatch.d.ts +3 -0
  527. package/dist/lib/style/resolve-dispatch.js +77 -4
  528. package/dist/lib/style/resolve-dispatch.js.map +2 -2
  529. package/dist/lib/style/resolve-length.d.ts +2 -0
  530. package/dist/lib/style/resolve-length.js +13 -9
  531. package/dist/lib/style/resolve-length.js.map +2 -2
  532. package/dist/lib/style/sizing-length.d.ts +51 -0
  533. package/dist/lib/style/sizing-length.js +77 -0
  534. package/dist/lib/style/sizing-length.js.map +7 -0
  535. package/dist/lib/style/types.d.ts +63 -25
  536. package/dist/lib/surface/root-surface.js +10 -6
  537. package/dist/lib/surface/root-surface.js.map +2 -2
  538. package/dist/lib/textures/texture.js +10 -8
  539. package/dist/lib/textures/texture.js.map +2 -2
  540. package/dist/lib/transitions/capture.js +4 -1
  541. package/dist/lib/transitions/capture.js.map +2 -2
  542. package/dist/lib/transitions/embers-physics.js +17 -10
  543. package/dist/lib/transitions/embers-physics.js.map +2 -2
  544. package/dist/lib/types.d.ts +110 -1
  545. package/dist/sync.d.ts +16 -0
  546. package/dist/sync.js +13 -0
  547. package/dist/sync.js.map +7 -0
  548. package/dist/sync.mjs +1 -0
  549. package/package.json +26 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/layout/measure.ts"],
4
- "sourcesContent": ["import { getStyleMeasurementMode, withStyleMeasurement, rejectResponsiveMeasurement, UnsupportedResponsiveMeasurement } from '../style/responsive.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { EMPTY_STYLE } from '../style/empty-style.js';\nimport {\n takePreNormalizedStyle,\n withoutSystemFilter,\n} from '../style/resolve-dispatch.js';\nimport {\n createPrimitiveReceiverToken,\n getPrimitiveDefinition,\n getPrimitiveReceiverToken,\n getPolicyPreparationSource,\n} from '../element/metadata.js';\nimport { resolvePrimitiveInputs } from '../element/resolve-primitive-inputs.js';\nimport { recordLayoutMeasurement } from './diagnostics.js';\nimport type {\n CanvasMeasurementService,\n MeasureResult,\n} from '../types.js';\nimport type { PibblElement } from '../element/types.js';\nimport { prepareElementPolicies } from '../element/children.js';\nimport type { Constraints } from './types.js';\nimport { untracked, withSignalWriteForbidden } from '../signals/graph.js';\n\nexport type {\n CanvasMeasurementService,\n MeasureInput,\n MeasureResult,\n} from '../types.js';\n\n/**\n * Measures an element against finite constraints using the supplied Canvas measurement service.\n *\n * @param element - Element whose declared measurement capability is used. See {@link PibblElement}.\n * @param constraints - Available size constraints in logical units. See {@link Constraints}.\n * @param service - Canvas text measurement service. See {@link CanvasMeasurementService}.\n * @returns Measured dimensions, or an unsupported result with its reason. See\n * {@link MeasureResult} .\n *\n * @see {@link PibblElement}\n * @see {@link Constraints}\n * @see {@link CanvasMeasurementService}\n * @see {@link MeasureResult}\n */\nexport function measureElement(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n service: CanvasMeasurementService,\n): MeasureResult {\n const context: MeasurementContext = {\n active: new Set(),\n stack: [],\n };\n const mode = getStyleMeasurementMode() ? 'recursive' :\n GLOBAL_STATE.componentRefs ? 'mounted-intrinsic' : 'standalone-root';\n return withSignalWriteForbidden('Signal writes are forbidden during Pibbl measurement', () =>\n withStyleMeasurement(mode, () => withIsolatedRenderState(() =>\n measureElementInternal(element, constraints, service, context),\n )),\n );\n}\n\ninterface MeasurementContext {\n active: Set<PibblElement<any>>;\n stack: PibblElement<any>[];\n}\n\nfunction measureElementInternal(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n service: CanvasMeasurementService,\n context: MeasurementContext,\n): MeasureResult {\n element = prepareElementPolicies(element, 'measureElement');\n recordLayoutMeasurement();\n const type = element.type;\n const definition = getPrimitiveDefinition(type);\n const component = type.name || 'Anonymous';\n const preNormalized = takePreNormalizedStyle(element);\n const source = getPolicyPreparationSource(element) ??\n preNormalized?.source ??\n element;\n if (context.active.has(source)) {\n throw layoutDiagnostic({\n component,\n property: 'measurement',\n value: context.stack.map(item => item.type.name || 'Anonymous'),\n algorithm: 'measurement',\n constraints,\n reason: 'cyclic measurement dependency is not supported',\n });\n }\n if (!definition?.measure) {\n return {\n status: 'unsupported',\n reason: `${component} does not provide measurement`,\n };\n }\n\n context.active.add(source);\n context.stack.push(element);\n try {\n if (preNormalized?.query && getStyleMeasurementMode() !== 'standalone-root') {\n rejectResponsiveMeasurement(element);\n }\n const inputs = untracked(() => resolvePrimitiveInputs(element, definition, preNormalized, {\n width: constraints.maxWidth, height: constraints.maxHeight,\n }));\n const specifiedStyle = withoutSystemFilter(\n preNormalized?.style ?? inputs.style ?? EMPTY_STYLE,\n );\n const normalized = preNormalized ?\n specifiedStyle :\n definition.normalizeStyle ?\n definition.normalizeStyle(specifiedStyle) :\n specifiedStyle;\n const previousReceiverToken = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken =\n getPrimitiveReceiverToken(element) ?? createPrimitiveReceiverToken();\n let result: MeasureResult;\n try {\n result = withStyleMeasurement('recursive', () => definition.measure!({\n props: inputs.props,\n style: normalized,\n constraints,\n service,\n measureElement: (child, childConstraints) =>\n measureElementInternal(child, childConstraints, service, context),\n }));\n } finally {\n GLOBAL_STATE.primitiveReceiverToken = previousReceiverToken;\n }\n if (result.status === 'unsupported') return result;\n validateMeasuredSize(result.size.width, 'width', component, constraints);\n validateMeasuredSize(result.size.height, 'height', component, constraints);\n return result;\n } catch (error) {\n if (error instanceof UnsupportedResponsiveMeasurement) {\n return { status: 'unsupported', reason: error.message };\n }\n throw error;\n } finally {\n context.stack.pop();\n context.active.delete(source);\n }\n}\n\nfunction withIsolatedRenderState<T>(work: () => T): T {\n const snapshot = {\n currentPibblInstance: GLOBAL_STATE.currentPibblInstance,\n componentRefs: GLOBAL_STATE.componentRefs,\n canvas: GLOBAL_STATE.canvas,\n componentIsMounting: GLOBAL_STATE.componentIsMounting,\n componentHookIndex: GLOBAL_STATE.componentHookIndex,\n renderContext: GLOBAL_STATE.renderContext,\n primitiveReceiverToken: GLOBAL_STATE.primitiveReceiverToken,\n seenIds: GLOBAL_STATE.seenIds,\n seenKeys: GLOBAL_STATE.seenKeys,\n clippingStack: GLOBAL_STATE.clippingStack,\n layoutStack: GLOBAL_STATE.layoutStack,\n };\n GLOBAL_STATE.currentPibblInstance = undefined;\n GLOBAL_STATE.componentRefs = undefined;\n GLOBAL_STATE.canvas = undefined;\n GLOBAL_STATE.componentIsMounting = false;\n GLOBAL_STATE.componentHookIndex = 0;\n GLOBAL_STATE.renderContext = undefined;\n GLOBAL_STATE.primitiveReceiverToken = undefined;\n GLOBAL_STATE.seenIds = undefined;\n GLOBAL_STATE.seenKeys = undefined;\n GLOBAL_STATE.clippingStack = [];\n GLOBAL_STATE.layoutStack = undefined;\n try {\n return work();\n } finally {\n Object.assign(GLOBAL_STATE, snapshot);\n }\n}\n\nfunction validateMeasuredSize(\n value: number,\n property: 'width' | 'height',\n component: string,\n constraints: Readonly<Constraints>,\n): void {\n if (!Number.isFinite(value) || value < 0) {\n throw layoutDiagnostic({\n component,\n property,\n value,\n algorithm: 'measurement',\n constraints,\n reason: 'measured dimensions must be finite and nonnegative',\n });\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,yBAAyB,sBAAsB,6BAA6B,wCAAwC;AAC7H,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC,SAAS,+BAA+B;AAMxC,SAAS,8BAA8B;AAEvC,SAAS,WAAW,gCAAgC;AAsB7C,SAAS,eACd,SACA,aACA,SACe;AACf,QAAM,UAA8B;AAAA,IAClC,QAAQ,oBAAI,IAAI;AAAA,IAChB,OAAO,CAAC;AAAA,EACV;AACA,QAAM,OAAO,wBAAwB,IAAI,cACvC,a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AC9B,eAAa,cAAc;AAC3B,MAAI;AACF,WAAO,KAAK;AAAA,EACd,UAAE;AACA,WAAO,OAAO,cAAc,QAAQ;AAAA,EACtC;AACF;AAEA,SAAS,qBACP,OACA,UACA,WACA,aACM;AACN,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;",
4
+ "sourcesContent": ["import { bindCanvasMeasurementService, sameCanvasMeasurementService } from './canvas-measurement.js';\nimport { allocationMeasurement, declineUnrecordedAllocationMeasurement, declineUntracedAllocationQuery, allocationQueryReplayRevision, allocationQueryVolatilityRevision } from './allocation-checkpoint.js';\nimport { allocationOwner, setAllocationOwner } from './allocation-revision.js';\nimport { isFitContent } from '../style/sizing-length.js';\nimport { observeReceiverInputReads, captureReceiverInputProvision, replayReceiverInputProvision, withReceiverInputProvision, type ReceiverInputProvisionReceipt } from '../signals/input-provision.js';\nimport type { BoxStyle } from '../style/types.js';\nimport { hasPercentageBoxPadding } from './box-insets.js';\nimport { contentBoxStyle } from './box-sizing.js';\nimport { isLayoutComponent, placedLayoutComponentRoot } from './define-layout-component.js';\nimport { getStyleMeasurementMode, withStyleMeasurement, rejectResponsiveMeasurement, UnsupportedResponsiveMeasurement, type PreparedQuery } from '../style/responsive.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { withMeasurementLayoutOwner } from './wasm/region.js';\nimport { EMPTY_STYLE } from '../style/empty-style.js';\nimport {\n takePreNormalizedStyle,\n peekPreNormalizedStyle,\n withoutSystemFilter,\n} from '../style/resolve-dispatch.js';\nimport {\n createPrimitiveReceiverToken,\n getPrimitiveDefinition,\n getPrimitiveProgramProps,\n getPrimitiveReceiverToken,\n getElementMetadata,\n} from '../element/metadata.js';\nimport { resolvePrimitiveInputs } from '../element/resolve-primitive-inputs.js';\nimport { recordLayoutMeasurement } from './diagnostics.js';\nimport type {\n CanvasMeasurementService,\n MeasureResult,\n IntrinsicSizesResult,\n BaselinesResult,\n BaselineMeasureInput,\n SystemStyle,\n} from '../types.js';\nimport type { PibblElement } from '../element/types.js';\nimport { prepareElementPolicies } from '../element/children.js';\nimport type { Constraints, LayoutBox } from './types.js';\nimport { isSignal, trackSignalDependency, withSignalTracking, type SignalNode, withSignalDependencyRole, untracked, withSignalWriteForbidden } from '../signals/graph.js';\n\nexport type {\n CanvasMeasurementService,\n MeasureInput,\n MeasureResult,\n} from '../types.js';\n\n/**\n * Measures an element against logical size constraints using the supplied Canvas measurement service.\n *\n * @param element - Element whose declared measurement capability is used. See {@link PibblElement}.\n * @param constraints - Available size constraints in logical units. See {@link Constraints}.\n * @param service - Canvas text measurement service. See {@link CanvasMeasurementService}.\n * @returns Measured dimensions, or an unsupported result with its reason. See\n * {@link MeasureResult} .\n *\n * @see {@link PibblElement}\n * @see {@link Constraints}\n * @see {@link CanvasMeasurementService}\n * @see {@link MeasureResult}\n */\nexport function measureElement(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService): MeasureResult {\n const resolveService = bindCanvasMeasurementService(service);\n return allocationMeasurement(element, current => measureElementUncached(current, constraints, resolveService()));\n}\n\nfunction measureElementUncached(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n service: CanvasMeasurementService,\n): MeasureResult {\n const context: MeasurementContext = {\n active: new Set(),\n stack: [],\n };\n const mode = getStyleMeasurementMode() ? 'recursive' :\n GLOBAL_STATE.componentRefs ? 'mounted-intrinsic' : 'standalone-root';\n const owner = GLOBAL_STATE.currentPibblInstance?.interactionRoot ?? GLOBAL_STATE.currentPibblInstance;\n const evaluate = () => withSignalWriteForbidden('Signal writes are forbidden during Pibbl measurement', () =>\n withMeasurementLayoutOwner(owner, () => withStyleMeasurement(mode, () => withIsolatedRenderState(() =>\n measureElementInternal(element, constraints, service, context),\n ))),\n );\n const receiver = getPrimitiveReceiverToken(element);\n return receiver ? withReceiverInputProvision(GLOBAL_STATE.renderTransaction, receiver, () => withSignalDependencyRole('measurement', evaluate)) : evaluate();\n}\n\n/** @internal Passive snapshot owned and released by one layout region. */\nexport interface PrimitiveMeasurementEntry {\n readonly props: object;\n readonly key: string;\n readonly result: IntrinsicSizesResult | MeasureResult | BaselinesResult;\n readonly mode: 'intrinsic' | 'finite' | 'baseline';\n readonly dependencies: readonly SignalNode<unknown>[];\n readonly receiverDependencies?: readonly SignalNode<unknown>[];\n readonly dependencyVersions?: readonly number[];\n readonly inputSnapshot: readonly unknown[] | undefined;\n readonly receiverReceipts?: readonly ConstrainedMeasurementReceipt[];\n}\nfunction measurementDependenciesUnchanged(entry: Pick<PrimitiveMeasurementEntry, 'dependencies' | 'dependencyVersions'>): boolean {\n const versions = entry.dependencyVersions;\n if (!versions || versions.length !== entry.dependencies.length) return false;\n for (let index = 0; index < versions.length; index++) {\n const node = entry.dependencies[index]!;\n node.validate?.();\n if (node.version !== versions[index]) return false;\n }\n return true;\n}\nfunction measurementDependencyVersions(dependencies: readonly SignalNode<unknown>[]): number[] {\n const versions: number[] = [];\n for (let index = 0; index < dependencies.length; index++) versions.push(dependencies[index]!.version);\n return versions;\n}\ninterface PrimitiveMeasurementCache {\n readPrimitiveMeasurement(token: object, key: string): PrimitiveMeasurementEntry | undefined;\n writePrimitiveMeasurement(token: object, entry: PrimitiveMeasurementEntry): void;\n}\nconst intrinsicTransactions = new WeakMap<object, WeakMap<object, Map<string, PrimitiveMeasurementEntry>>>();\n\n// Conservative admission: mutable nested props or custom style records always\n// remeasure. Scalar snapshots also detect production-mode in-place scalar writes.\nfunction intrinsicInputSnapshot(element: PibblElement<any>): unknown[] | undefined {\n const props = getPrimitiveProgramProps<Record<string, unknown>>(element);\n const style = peekPreNormalizedStyle(element)?.style as Readonly<Record<string, unknown>> | undefined;\n const snapshot: unknown[] = [];\n for (const key of Object.keys(props)) {\n const value = props[key];\n if (value !== null && (typeof value === 'object' && !isSignal(value) || typeof value === 'function')) return;\n snapshot.push(key, value);\n }\n if (style) for (const key of Object.keys(style)) {\n const value = style[key];\n // This module-branded sizing record is immutable; snapshot its semantic limit\n // rather than its per-render identity. Other object-valued styles stay conservative.\n if (isFitContent(value) && Object.isFrozen(value)) {\n snapshot.push(key, isFitContent, value.limit);\n continue;\n }\n if (value !== null && (typeof value === 'object' || typeof value === 'function')) return;\n snapshot.push(key, value);\n }\n return snapshot;\n}\nfunction sameIntrinsicInputs(left: readonly unknown[] | undefined, right: readonly unknown[] | undefined): boolean {\n if (!left || !right || left.length !== right.length) return false;\n for (let index=0; index<left.length; index++) if (!Object.is(left[index], right[index])) return false;\n return true;\n}\n\ninterface PrimitiveMeasurementOptions {\n cache: PrimitiveMeasurementCache;\n token: object;\n key: string;\n recordMeasurement: () => void;\n}\n/** @internal Paired content contributions through the existing pure receiver transaction. */\nexport function measureIntrinsicElement(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, options?: PrimitiveMeasurementOptions): IntrinsicSizesResult {\n const resolveService = bindCanvasMeasurementService(service);\n return allocationMeasurement(element, current => measurePrimitiveInput(current, constraints, resolveService(), true, options));\n}\n/** @internal Finite custom measurement through the same receiver transaction and cache. */\nexport function measureConstrainedIntrinsicElement(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, options?: PrimitiveMeasurementOptions): MeasureResult {\n const resolveService = bindCanvasMeasurementService(service);\n return allocationMeasurement(element, current => measurePrimitiveInput(current, constraints, resolveService(), false, options));\n}\n/** @internal Parent-owned prepared row result with fresh receiver paths per query. */\nexport function measurePreparedLayoutElement(\n element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService,\n options: PrimitiveMeasurementOptions, snapshot: readonly unknown[], receivers: readonly object[],\n): MeasureResult {\n declineUnrecordedAllocationMeasurement();\n return measurePrimitiveInput(element, constraints, service, false, options, { snapshot, receivers });\n}\ninterface PreparedMeasurementInput {\n readonly snapshot: readonly unknown[];\n readonly receivers: readonly object[];\n}\n\n\ninterface PreparedBaselineOwner {\n readonly transaction: object;\n readonly receiver: object;\n readonly query: PreparedQuery;\n readonly width: number;\n readonly height: number;\n}\nconst preparedBaselineOwners = new WeakMap<PibblElement<any>, PreparedBaselineOwner>();\n/** @internal One-shot proof of a direct child's current finite Flex selection. */\nexport function setPreparedBaselineOwner(element: PibblElement<any>, owner: Readonly<LayoutBox>): void {\n const transaction = GLOBAL_STATE.renderTransaction;\n const receiver = getPrimitiveReceiverToken(element);\n const query = peekPreNormalizedStyle(element)?.query;\n if (!transaction || !receiver || !query || !Number.isFinite(owner.width) || !Number.isFinite(owner.height) ||\n query.basis.width !== owner.width || query.basis.height !== owner.height) return;\n preparedBaselineOwners.set(element, { transaction, receiver, query, width: owner.width, height: owner.height });\n}\n\n/** @internal Cache identity for a transparent, currently prepared primitive root. */\nexport interface BaselineMeasurementOptions extends PrimitiveMeasurementOptions {\n source?: PibblElement<any>;\n}\n\n/** @internal Pure first/last baseline query at one final content allocation. */\nexport function measureBaselineElement(element: PibblElement<any>, allocation: Readonly<LayoutBox>, service: CanvasMeasurementService, options?: BaselineMeasurementOptions): BaselinesResult {\n const resolveService = bindCanvasMeasurementService(service);\n const owner = preparedBaselineOwners.get(element);\n const ownerValid = owner && owner.transaction === GLOBAL_STATE.renderTransaction &&\n owner.receiver === getPrimitiveReceiverToken(element) && owner.query === peekPreNormalizedStyle(element)?.query;\n const ownerBox = ownerValid ? { x: 0, y: 0, width: owner.width, height: owner.height } : undefined;\n return allocationMeasurement(element, current => {\n if (ownerBox) setPreparedBaselineOwner(current, ownerBox);\n return measureBaselineElementUncached(current, allocation, resolveService(), options);\n }, true);\n}\n\nfunction measureBaselineElementUncached(\n element: PibblElement<any>,\n allocation: Readonly<LayoutBox>,\n service: CanvasMeasurementService,\n options?: BaselineMeasurementOptions,\n): BaselinesResult {\n // Responsive baselines require the existing current-owner proof and must\n // never bypass its validation through direct demand reuse.\n if (!options && !peekPreNormalizedStyle(element)?.query) {\n const mode = getStyleMeasurementMode() ? 'recursive' : GLOBAL_STATE.componentRefs ? 'mounted-intrinsic' : 'standalone-root';\n return exactDirectMeasurement(element, service, ['baseline', mode, allocation.width, allocation.height],\n () => measureBaselineElementWithCache(element, allocation, service));\n }\n return measureBaselineElementWithCache(element, allocation, service, options);\n}\n\nfunction measureBaselineElementWithCache(\n element: PibblElement<any>, allocation: Readonly<LayoutBox>, service: CanvasMeasurementService, options?: BaselineMeasurementOptions,\n): BaselinesResult {\n const transaction = GLOBAL_STATE.renderTransaction;\n const receiver = getPrimitiveReceiverToken(element);\n const mode = getStyleMeasurementMode() ? 'recursive' : GLOBAL_STATE.componentRefs ? 'mounted-intrinsic' : 'standalone-root';\n const key = `baseline:${options?.key ?? ''}`;\n const constraints = {\n minWidth: allocation.width, maxWidth: allocation.width,\n minHeight: allocation.height, maxHeight: allocation.height,\n };\n return withSignalWriteForbidden('Signal writes are forbidden during Pibbl measurement', () => withReceiverInputProvision(transaction, receiver, () => withSignalDependencyRole('measurement', () => {\n const source = options?.source ?? element;\n let inputSnapshot = intrinsicInputSnapshot(element);\n if (source !== element) {\n const sourceSnapshot = intrinsicInputSnapshot(source);\n if (!sourceSnapshot || !inputSnapshot) inputSnapshot = undefined;\n else {\n // The source props retain one wrapper occurrence; the complete scalar\n // root snapshot permits fresh JSX descriptions without retaining roots.\n sourceSnapshot.push(source.type, source.key, element.type, element.key, inputSnapshot.length);\n for (let index = 0; index < inputSnapshot.length; index++) sourceSnapshot.push(inputSnapshot[index]);\n inputSnapshot = sourceSnapshot;\n }\n }\n let receivers = transaction && intrinsicTransactions.get(transaction);\n let entries = options && receivers?.get(options.token);\n let entry = options && (entries?.get(key) ?? options.cache.readPrimitiveMeasurement(options.token, key));\n if (!entry || !measurementDependenciesUnchanged(entry) || entry.mode !== 'baseline' || entry.props !== source.props || !sameIntrinsicInputs(entry.inputSnapshot, inputSnapshot)) {\n options?.recordMeasurement();\n const dependencies: SignalNode<unknown>[] = [];\n const addDependency = (node: SignalNode<unknown>) => { if (!dependencies.includes(node)) dependencies.push(node); };\n const result = observeReceiverInputReads(addDependency, () => withSignalTracking({ addDependency }, () =>\n withStyleMeasurement(mode, () => withIsolatedRenderState(() =>\n measureBaselineInput(element, allocation, constraints, service),\n ))));\n entry = { props: source.props, key, result, mode: 'baseline', dependencies, dependencyVersions: measurementDependencyVersions(dependencies), inputSnapshot };\n if (options && transaction && inputSnapshot && result.status === 'measured') {\n if (!receivers) { receivers = new WeakMap(); intrinsicTransactions.set(transaction, receivers); }\n if (!entries) { entries = new Map(); receivers.set(options.token, entries); }\n entries.set(key, entry);\n const snapshot = entry;\n transaction.onFinish(success => { if (success) options.cache.writePrimitiveMeasurement(options.token, snapshot); });\n }\n }\n for (const node of entry.dependencies) trackSignalDependency(node, 'measurement');\n return entry.result as BaselinesResult;\n })));\n}\n\nfunction measureBaselineInput(\n original: PibblElement<any>,\n allocation: Readonly<LayoutBox>,\n constraints: Readonly<Constraints>,\n service: CanvasMeasurementService,\n): BaselinesResult {\n const element = prepareElementPolicies(original, 'measureBaselines');\n recordLayoutMeasurement();\n const definition = getPrimitiveDefinition(element.type);\n const component = element.type.name || 'Anonymous';\n if (isLayoutComponent(element.type)) {\n return { status: 'unsupported', reason: 'baseline providers currently require a direct custom primitive' };\n }\n if (!definition?.measureBaselines) {\n return { status: 'unsupported', reason: `${component} does not provide baseline measurement` };\n }\n const preNormalized = takePreNormalizedStyle(element);\n const preparedOwner = preparedBaselineOwners.get(element);\n preparedBaselineOwners.delete(element);\n if (preNormalized?.query && getStyleMeasurementMode() !== 'standalone-root') {\n // Only the direct Flex owner's already-selected style may cross this pure\n // boundary. Never evaluate responsive rules against the provider allocation.\n const query = preNormalized.query;\n if (getStyleMeasurementMode() !== 'mounted-intrinsic' || !preparedOwner ||\n preparedOwner.transaction !== GLOBAL_STATE.renderTransaction ||\n preparedOwner.receiver !== getPrimitiveReceiverToken(element) || preparedOwner.query !== query ||\n preparedOwner.width !== query.basis.width || preparedOwner.height !== query.basis.height) {\n rejectResponsiveMeasurement(element);\n }\n }\n const inputs = resolvePrimitiveInputs(element, definition, preNormalized, {\n width: allocation.width, height: allocation.height,\n });\n const specifiedStyle = withoutSystemFilter(preNormalized?.style ?? inputs.style ?? EMPTY_STYLE);\n let normalized = preNormalized ? specifiedStyle : definition.normalizeStyle ?\n definition.normalizeStyle(specifiedStyle) : specifiedStyle;\n if (hasPercentageBoxPadding(normalized as Readonly<BoxStyle>)) {\n return { status: 'unsupported', reason: 'percentage padding requires an actual finite Flex owner allocation' };\n }\n if ('boxSizing' in normalized && normalized.boxSizing !== undefined) {\n normalized = contentBoxStyle(normalized as Readonly<BoxStyle>, {\n width: allocation.width, height: allocation.height,\n context: { component, algorithm: 'baseline measurement', constraints },\n });\n }\n const previousReceiverToken = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken = getPrimitiveReceiverToken(element) ?? createPrimitiveReceiverToken();\n try {\n const result = definition.measureBaselines({\n props: inputs.props,\n style: normalized,\n allocation: { x: 0, y: 0, width: allocation.width, height: allocation.height },\n service,\n } as BaselineMeasureInput<Record<PropertyKey, unknown>, SystemStyle>);\n if (result.status === 'unsupported') return result;\n if (result.status !== 'measured' || !Number.isFinite(result.first) || !Number.isFinite(result.last) || result.first > result.last) {\n throw layoutDiagnostic({\n component, property: 'measureBaselines', value: result,\n algorithm: 'baseline measurement', constraints,\n reason: 'first and last baselines must be finite with first not after last',\n });\n }\n return { status: 'measured', first: result.first, last: result.last };\n } catch (error) {\n if (error instanceof UnsupportedResponsiveMeasurement) return { status: 'unsupported', reason: error.message };\n throw error;\n } finally {\n GLOBAL_STATE.primitiveReceiverToken = previousReceiverToken;\n }\n}\nfunction measurePrimitiveInput(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, intrinsic: true, options?: PrimitiveMeasurementOptions): IntrinsicSizesResult;\nfunction measurePrimitiveInput(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, intrinsic: false, options?: PrimitiveMeasurementOptions, prepared?: PreparedMeasurementInput): MeasureResult;\nfunction measurePrimitiveInput(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, intrinsic: boolean, options?: PrimitiveMeasurementOptions, prepared?: PreparedMeasurementInput): IntrinsicSizesResult | MeasureResult {\n const transaction = GLOBAL_STATE.renderTransaction;\n const receiver = getPrimitiveReceiverToken(element);\n const context: MeasurementContext = { active: new Set(), stack: [] };\n const mode = getStyleMeasurementMode() ? 'recursive' : GLOBAL_STATE.componentRefs ? 'mounted-intrinsic' : 'standalone-root';\n const key = `${intrinsic ? 'intrinsic' : 'finite'}:${options?.key ?? ''}`;\n const owner = GLOBAL_STATE.currentPibblInstance?.interactionRoot ?? GLOBAL_STATE.currentPibblInstance;\n return withSignalWriteForbidden('Signal writes are forbidden during Pibbl measurement', () => withMeasurementLayoutOwner(owner, () => withReceiverInputProvision(transaction, receiver, () => withSignalDependencyRole('measurement', () => {\n const inputSnapshot = prepared?.snapshot ?? intrinsicInputSnapshot(element);\n let receivers = transaction && intrinsicTransactions.get(transaction);\n let entries = options && receivers?.get(options.token);\n let entry = options && (entries?.get(key) ?? options.cache.readPrimitiveMeasurement(options.token, key));\n const entryMode = intrinsic ? 'intrinsic' : 'finite';\n if (!entry || !measurementDependenciesUnchanged(entry) || entry.mode !== entryMode || entry.props !== element.props || !sameIntrinsicInputs(entry.inputSnapshot, inputSnapshot) || prepared && entry.receiverReceipts === undefined) {\n options?.recordMeasurement();\n const dependencies: SignalNode<unknown>[] = [];\n const receiverDependencies: SignalNode<unknown>[] = [];\n let untracedReceiverReads = false;\n const trace: ConstrainedMeasurementTrace | undefined = prepared ? {\n cacheable: true, receipts: [], receivers: prepared.receivers,\n } : undefined;\n const evaluate = () => withStyleMeasurement(mode, () => withIsolatedRenderState(() => intrinsic ?\n measureElementInternal(element, constraints, service, context, true) :\n measureElementInternal(element, constraints, service, context, false, true),\n ));\n const addDependency = (node: SignalNode<unknown>) => {\n if (!dependencies.includes(node)) dependencies.push(node);\n if (!receiverDependencies.includes(node)) receiverDependencies.push(node);\n };\n const result = observeReceiverInputReads((node, _roles, inputReceiver) => {\n if (!dependencies.includes(node)) dependencies.push(node);\n if (inputReceiver === receiver && !receiverDependencies.includes(node)) receiverDependencies.push(node);\n if (inputReceiver !== receiver && !trace) untracedReceiverReads = true;\n }, () => withSignalTracking({ addDependency }, () =>\n trace ? withConstrainedMeasurementTrace(trace, evaluate) : evaluate()));\n entry = { props: element.props, key, result, mode: entryMode, dependencies, receiverDependencies, dependencyVersions: measurementDependencyVersions(dependencies), inputSnapshot,\n ...(trace?.cacheable ? { receiverReceipts: trace.receipts } : {}) };\n if (options && transaction && inputSnapshot && result.status === 'measured' && !untracedReceiverReads && (!trace || trace.cacheable)) {\n if (!receivers) { receivers = new WeakMap(); intrinsicTransactions.set(transaction, receivers); }\n if (!entries) { entries = new Map(); receivers.set(options.token, entries); }\n entries.set(key, entry);\n const snapshot = entry;\n transaction.onFinish(success => { if (success) options.cache.writePrimitiveMeasurement(options.token, snapshot); });\n }\n }\n if (prepared && entry.receiverReceipts) {\n for (let index = 0; index < entry.receiverReceipts.length; index++) {\n const captured = entry.receiverReceipts[index];\n replayReceiverInputProvision(transaction, prepared.receivers[captured.childIndex], captured.receipt);\n }\n }\n for (const node of entry.receiverDependencies ?? entry.dependencies) trackSignalDependency(node, 'measurement');\n return entry.result as IntrinsicSizesResult | MeasureResult;\n }))));\n}\n\ninterface MeasurementContext {\n active: Set<PibblElement<any>>;\n stack: PibblElement<any>[];\n}\n\n// Present only while a primitive measurement callback is evaluating. Flex uses this\n// continuation for its explicitly admitted paired structural child, so the child\n// shares the caller's cycle stack and receives provider inputs with measurement\n// dependency tracking. Ordinary `input.measureElement` remains unchanged.\nlet constrainedChildContext: MeasurementContext | undefined;\nlet constrainedChildService: CanvasMeasurementService | undefined;\ninterface ConstrainedMeasurementReceipt {\n readonly childIndex: number;\n readonly receipt: ReceiverInputProvisionReceipt;\n}\nexport interface ConstrainedMeasurementTrace {\n cacheable: boolean;\n readonly receipts: ConstrainedMeasurementReceipt[];\n readonly receivers: readonly object[];\n}\nlet constrainedMeasurementTrace: ConstrainedMeasurementTrace | undefined;\n/** @internal Binds one direct known-row provider trace without retaining receiver tokens. */\nexport function withConstrainedMeasurementTrace<T>(trace: ConstrainedMeasurementTrace, work: () => T): T {\n const previous = constrainedMeasurementTrace;\n constrainedMeasurementTrace = trace;\n try { return work(); }\n finally { constrainedMeasurementTrace = previous; }\n}\ninterface ExactDirectDemand {\n readonly type: Function;\n readonly service: CanvasMeasurementService;\n readonly key: readonly unknown[];\n readonly inputs: readonly unknown[];\n readonly receipt: ReceiverInputProvisionReceipt;\n readonly dependencies: readonly SignalNode<unknown>[];\n readonly dependencyVersions: readonly number[];\n readonly result: MeasureResult | BaselinesResult;\n}\nconst exactDirectDemands = new WeakMap<object, WeakMap<object, ExactDirectDemand>>();\n\n// A failed allocation equality barrier may demand the same pure query again.\n// Share only current transaction/receiver numeric demands, never an old program.\nfunction exactDirectMeasurement<T extends MeasureResult | BaselinesResult>(\n element: PibblElement<any>, service: CanvasMeasurementService, key: readonly unknown[], run: () => T, allowHit = true,\n): T {\n const transaction = GLOBAL_STATE.renderTransaction, receiver = getPrimitiveReceiverToken(element);\n if (!transaction || !receiver || Object.hasOwn(element.props, 'children') || isLayoutComponent(element.type)) return run();\n const inputs = peekPreNormalizedStyle(element) ? intrinsicInputSnapshot(element) : undefined;\n const demands = exactDirectDemands.get(transaction), prior = demands?.get(receiver);\n if (allowHit && inputs && prior && prior.type === element.type && sameCanvasMeasurementService(prior.service, service) &&\n sameIntrinsicInputs(prior.key, key) && sameIntrinsicInputs(prior.inputs, inputs) && measurementDependenciesUnchanged(prior)) {\n takePreNormalizedStyle(element);\n replayReceiverInputProvision(transaction, receiver, prior.receipt);\n return prior.result as T;\n }\n let direct = true;\n const receipt: { node: SignalNode<unknown>; roles: number }[] = [];\n const replayRevision = allocationQueryReplayRevision(), volatility = allocationQueryVolatilityRevision();\n const captured = observeReceiverInputReads((node, roles, owner) => {\n if (owner !== receiver) { direct = false; return; }\n const existing = receipt.find(entry => entry.node === node);\n if (existing) existing.roles |= roles;\n else receipt.push({ node, roles });\n }, () => captureReceiverInputProvision(transaction, receiver, run));\n if (inputs && direct && replayRevision === allocationQueryReplayRevision() && volatility === allocationQueryVolatilityRevision() && captured.receipt && captured.value.status === 'measured') {\n let current = demands;\n if (!current) {\n current = new WeakMap(); exactDirectDemands.set(transaction, current);\n transaction.onFinish(() => exactDirectDemands.delete(transaction));\n }\n const dependencies = receipt.map(entry => entry.node);\n current.set(receiver, { type: element.type, service, key, inputs, receipt, dependencies,\n dependencyVersions: measurementDependencyVersions(dependencies), result: captured.value });\n }\n return captured.value;\n}\n\nexport function measureConstrainedLayoutChild(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n childIndex?: number,\n): MeasureResult {\n const context = constrainedChildContext, service = constrainedChildService;\n if (!context || !service) throw new Error('Constrained structural measurement requires an active provider measurement.');\n const transaction = GLOBAL_STATE.renderTransaction;\n const receiver = getPrimitiveReceiverToken(element);\n const trace = constrainedMeasurementTrace;\n const run = () => withSignalDependencyRole('measurement', () =>\n measureElementInternal(element, constraints, service, context, false, true));\n // The structural tracer has no indexed leaf path for this native continuation.\n if (transaction && receiver && childIndex === undefined && !Object.hasOwn(element.props, 'children') && !isLayoutComponent(element.type)) {\n if (trace) trace.cacheable = false;\n const metadata = getElementMetadata(element);\n const source = metadata?.policyPreparationSource ?? metadata?.layoutDescriptionSource ?? peekPreNormalizedStyle(element)?.source ?? element;\n return exactDirectMeasurement(element, service,\n ['size', getStyleMeasurementMode(), constraints.minWidth, constraints.maxWidth, constraints.minHeight, constraints.maxHeight],\n run, !context.active.has(source));\n }\n if (!trace) return withReceiverInputProvision(transaction, receiver, run);\n if (childIndex === undefined || trace.receivers[childIndex] !== receiver) {\n trace.cacheable = false;\n return withReceiverInputProvision(transaction, receiver, run);\n }\n const captured = captureReceiverInputProvision(transaction, receiver, run);\n if (captured.receipt === undefined) trace.cacheable = false;\n else trace.receipts.push({ childIndex, receipt: captured.receipt });\n return captured.value;\n}\n\nfunction measureElementInternal(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, context: MeasurementContext, intrinsic: true): IntrinsicSizesResult;\nfunction measureElementInternal(element: PibblElement<any>, constraints: Readonly<Constraints>, service: CanvasMeasurementService, context: MeasurementContext, intrinsic?: false, providerInputs?: boolean): MeasureResult;\nfunction measureElementInternal(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n service: CanvasMeasurementService,\n context: MeasurementContext,\n intrinsic = false,\n providerInputs = false,\n): MeasureResult | IntrinsicSizesResult {\n element = prepareElementPolicies(element, 'measureElement');\n recordLayoutMeasurement();\n const type = element.type;\n const definition = getPrimitiveDefinition(type);\n const component = type.name || 'Anonymous';\n const preNormalized = takePreNormalizedStyle(element);\n const metadata = getElementMetadata(element);\n const source = metadata?.policyPreparationSource ?? metadata?.layoutDescriptionSource ??\n preNormalized?.source ??\n element;\n if (context.active.has(source)) {\n throw layoutDiagnostic({\n component,\n property: 'measurement',\n value: context.stack.map(item => item.type.name || 'Anonymous'),\n algorithm: 'measurement',\n constraints,\n reason: 'cyclic measurement dependency is not supported',\n });\n }\n if (isLayoutComponent(type)) {\n context.active.add(source);\n context.stack.push(element);\n try {\n // A declared layout description is the existing pure boundary. Preserve the\n // caller's measurement mode so a paired primitive root can contribute its\n // intrinsic result or receive provider inputs under the same transaction.\n const root = placedLayoutComponentRoot(element, preNormalized);\n return withReceiverInputProvision(GLOBAL_STATE.renderTransaction, getPrimitiveReceiverToken(root), () => intrinsic ?\n measureElementInternal(root, constraints, service, context, true) :\n measureElementInternal(root, constraints, service, context, false, providerInputs));\n } finally {\n context.stack.pop();\n context.active.delete(source);\n }\n }\n if (intrinsic ? !definition?.measureIntrinsic : !definition?.measure) {\n return {\n status: 'unsupported',\n reason: `${component} does not provide ${intrinsic ? 'intrinsic measurement' : 'measurement'}`,\n };\n }\n\n context.active.add(source);\n context.stack.push(element);\n try {\n if (preNormalized?.query && getStyleMeasurementMode() !== 'standalone-root') {\n rejectResponsiveMeasurement(element);\n }\n const readInputs = () => resolvePrimitiveInputs(element, definition!, preNormalized, {\n width: constraints.maxWidth, height: constraints.maxHeight,\n });\n const inputs = intrinsic || providerInputs ? readInputs() : untracked(readInputs);\n const specifiedStyle = withoutSystemFilter(\n preNormalized?.style ?? inputs.style ?? EMPTY_STYLE,\n );\n let normalized = preNormalized ?\n specifiedStyle :\n definition!.normalizeStyle ?\n definition!.normalizeStyle!(specifiedStyle) :\n specifiedStyle;\n if (hasPercentageBoxPadding(normalized as Readonly<BoxStyle>)) return { status: 'unsupported', reason: 'percentage padding requires an actual finite Flex owner allocation' };\n if ('boxSizing' in normalized && normalized.boxSizing !== undefined) normalized = contentBoxStyle(normalized as Readonly<BoxStyle>, { width: constraints.maxWidth, height: constraints.maxHeight, context: { component, algorithm: 'measurement', constraints } });\n const previousReceiverToken = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken =\n getPrimitiveReceiverToken(element) ?? createPrimitiveReceiverToken();\n let result: MeasureResult | IntrinsicSizesResult;\n const previousConstrainedChildContext = constrainedChildContext;\n const previousConstrainedChildService = constrainedChildService;\n if (!intrinsic) { constrainedChildContext = context; constrainedChildService = service; }\n try {\n result = withStyleMeasurement('recursive', () => intrinsic ? definition!.measureIntrinsic!({\n props: inputs.props, style: normalized, service,\n constraints: {\n width: Number.isFinite(constraints.maxWidth) ? { kind: 'bounded', min: constraints.minWidth, max: constraints.maxWidth } : { kind: 'unbounded', min: constraints.minWidth },\n height: Number.isFinite(constraints.maxHeight) ? { kind: 'bounded', min: constraints.minHeight, max: constraints.maxHeight } : { kind: 'unbounded', min: constraints.minHeight },\n },\n }) : definition!.measure!({\n props: inputs.props,\n style: normalized,\n constraints,\n service,\n measureElement: (child, childConstraints) => {\n // Public recursive queries have no direct-child receipt path. Preserve\n // their ordinary measurement behavior without caching this aggregate.\n if (constrainedMeasurementTrace) constrainedMeasurementTrace.cacheable = false;\n const receiver = getPrimitiveReceiverToken(child);\n const prepared = peekPreNormalizedStyle(child);\n // Known layout providers pass current normalized children with an\n // owned receiver path. Their props must join that receiver's receipt.\n // Arbitrary public descriptors have no such replayable input proof.\n if (!receiver || !prepared) declineUntracedAllocationQuery();\n return receiver ? withReceiverInputProvision(GLOBAL_STATE.renderTransaction, receiver, () => withSignalDependencyRole('measurement', () =>\n measureElementInternal(child, childConstraints, service, context, false, !!prepared))) : measureElementInternal(child, childConstraints, service, context);\n },\n }));\n } finally {\n constrainedChildContext = previousConstrainedChildContext;\n constrainedChildService = previousConstrainedChildService;\n GLOBAL_STATE.primitiveReceiverToken = previousReceiverToken;\n }\n if (result.status === 'unsupported') return result;\n if ('minContent' in result) {\n validateMeasuredSize(result.minContent.width, 'minContent.width', component, constraints);\n validateMeasuredSize(result.minContent.height, 'minContent.height', component, constraints);\n validateMeasuredSize(result.maxContent.width, 'maxContent.width', component, constraints);\n validateMeasuredSize(result.maxContent.height, 'maxContent.height', component, constraints);\n if (result.minContent.width > result.maxContent.width) throw layoutDiagnostic({ component, property: 'measureIntrinsic', value: result, algorithm: 'measurement', constraints, reason: 'min-content width must not exceed max-content width' });\n return result;\n }\n validateMeasuredSize(result.size.width, 'width', component, constraints);\n validateMeasuredSize(result.size.height, 'height', component, constraints);\n return result;\n } catch (error) {\n if (error instanceof UnsupportedResponsiveMeasurement) {\n return { status: 'unsupported', reason: error.message };\n }\n throw error;\n } finally {\n context.stack.pop();\n context.active.delete(source);\n }\n}\n\n/** @internal Shared pure measurement preparation; never lends a mounted render context. */\nexport function withIsolatedRenderState<T>(work: () => T): T {\n const previousAllocationOwner = setAllocationOwner(allocationOwner());\n const snapshot = {\n currentPibblInstance: GLOBAL_STATE.currentPibblInstance,\n componentRefs: GLOBAL_STATE.componentRefs,\n canvas: GLOBAL_STATE.canvas,\n componentIsMounting: GLOBAL_STATE.componentIsMounting,\n componentHookIndex: GLOBAL_STATE.componentHookIndex,\n renderContext: GLOBAL_STATE.renderContext,\n primitiveReceiverToken: GLOBAL_STATE.primitiveReceiverToken,\n seenIds: GLOBAL_STATE.seenIds,\n seenKeys: GLOBAL_STATE.seenKeys,\n clippingStack: GLOBAL_STATE.clippingStack,\n layoutStack: GLOBAL_STATE.layoutStack,\n };\n GLOBAL_STATE.currentPibblInstance = undefined;\n GLOBAL_STATE.componentRefs = undefined;\n GLOBAL_STATE.canvas = undefined;\n GLOBAL_STATE.componentIsMounting = false;\n GLOBAL_STATE.componentHookIndex = 0;\n GLOBAL_STATE.renderContext = undefined;\n GLOBAL_STATE.primitiveReceiverToken = undefined;\n GLOBAL_STATE.seenIds = undefined;\n GLOBAL_STATE.seenKeys = undefined;\n GLOBAL_STATE.clippingStack = [];\n GLOBAL_STATE.layoutStack = undefined;\n try {\n return work();\n } finally {\n Object.assign(GLOBAL_STATE, snapshot);\n setAllocationOwner(previousAllocationOwner);\n }\n}\n\nfunction validateMeasuredSize(\n value: number,\n property: string,\n component: string,\n constraints: Readonly<Constraints>,\n): void {\n if (!Number.isFinite(value) || value < 0) {\n throw layoutDiagnostic({\n component,\n property,\n value,\n algorithm: 'measurement',\n constraints,\n reason: 'measured dimensions must be finite and nonnegative',\n });\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,8BAA8B,oCAAoC;AAC3E,SAAS,uBAAuB,wCAAwC,gCAAgC,+BAA+B,yCAAyC;AAChL,SAAS,iBAAiB,0BAA0B;AACpD,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B,+BAA+B,8BAA8B,kCAAsE;AAEvK,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,yBAAyB,sBAAsB,6BAA6B,wCAA4D;AACjJ,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,kCA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AAyB;AACtC,eAAa,UAAU;AACvB,eAAa,WAAW;AACxB,eAAa,gBAAgB,CAAC;AAC9B,eAAa,cAAc;AAC3B,MAAI;AACF,WAAO,KAAK;AAAA,EACd,UAAE;AACA,WAAO,OAAO,cAAc,QAAQ;AACpC,uBAAmB,uBAAuB;AAAA,EAC5C;AACF;AAEA,SAAS,qBACP,OACA,UACA,WACA,aACM;AACN,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,8 @@
1
- import { preparedStyleValue, preparedStyleQuery } from "../style/responsive.js";
1
+ import { withAllocationCheckpoint, mountedAllocationCheckpointOwner } from "./allocation-checkpoint.js";
2
+ import { hasPercentageBoxPadding, resolveAllocatedInsets } from "./box-insets.js";
3
+ import { recordWasmAllocationPass, recordWasmAllocationItem, recordWasmAllocationCacheHit, nativeLayout } from "./wasm/region.js";
4
+ import { registerKnownLayoutPreflight, claimPreparedLayoutPlan, stagePreparedLayoutPlan, prepareKnownLayoutDescendants, preparePlacedKnownLayout } from "./prepared-root.js";
5
+ import { getStyleMeasurementMode, preparedStyleValue, preparedStyleQuery } from "../style/responsive.js";
2
6
  import { definePrimitive } from "../define-primitive.js";
3
7
  import { GLOBAL_STATE } from "../global-state.js";
4
8
  import { layoutDiagnostic } from "../style/diagnostics.js";
@@ -12,13 +16,16 @@ import {
12
16
  prepareDirectChildStyle,
13
17
  placeDirectChildren,
14
18
  resolveContainerBox,
15
- resolveDirectChildBox
19
+ resolveDirectChildBox,
20
+ measureUnionIntrinsic
16
21
  } from "./absolute.js";
17
- import { pushLayoutBox } from "./context.js";
22
+ import { pushLayoutBox, resolvePositionedContainingBox } from "./context.js";
18
23
  import { recordLayoutEvaluation } from "./diagnostics.js";
24
+ import { assertSupportedChildPosition } from "./positioning-diagnostics.js";
25
+ const OVERLAY_CONTAINING_BOX_STYLE = /* @__PURE__ */ Symbol("pibbl.overlay-containing-box-style");
19
26
  function renderOverlay(props, style, ctx) {
20
27
  wireStructuralEvents(props);
21
- const children = prepareLayoutChildren(props.children, "Overlay");
28
+ const ordinaryChildren = nativeLayout ? void 0 : prepareLayoutChildren(props.children, "Overlay");
22
29
  recordLayoutEvaluation();
23
30
  const content = style.box.contentBox;
24
31
  ctx.translate(content.x, content.y);
@@ -28,45 +35,96 @@ function renderOverlay(props, style, ctx) {
28
35
  width: content.width,
29
36
  height: content.height
30
37
  });
31
- const releaseLayout = pushLayoutBox(localContent);
38
+ const releaseLayout = pushLayoutBox(localContent, {
39
+ logicalOffset: content,
40
+ containingBlock: resolvePositionedContainingBox(
41
+ style[OVERLAY_CONTAINING_BOX_STYLE],
42
+ localContent,
43
+ "Overlay"
44
+ )
45
+ });
32
46
  GLOBAL_STATE.componentRefs.onAfterRender = releaseLayout;
47
+ const prepared = nativeLayout ? claimPreparedLayoutPlan(GLOBAL_STATE.componentRefs.element, localContent) : void 0;
48
+ const children = prepared?.children ?? ordinaryChildren ?? prepareLayoutChildren(props.children, "Overlay");
49
+ const placements = prepared?.placements ?? (nativeLayout ? withAllocationCheckpoint(mountedAllocationCheckpointOwner(), { children, content: localContent, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => prepareOverlayPlacements(children, localContent, style) }) : void 0);
50
+ let placementIndex = 0;
33
51
  let occurrence = 0;
34
52
  return placeDirectChildren(
35
53
  children,
36
54
  localContent,
37
- (child) => resolveOverlayChildPlacement(
38
- localContent,
39
- child,
40
- style,
41
- getChildPrimitiveReceiverToken(
42
- GLOBAL_STATE.renderTransaction,
43
- GLOBAL_STATE.primitiveReceiverToken,
44
- occurrence++
45
- )
46
- ),
55
+ (child, childOccurrence) => {
56
+ const placement = placements ? placements[placementIndex++] : resolveOverlayChildPlacement(localContent, child, style, getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, GLOBAL_STATE.primitiveReceiverToken, occurrence++));
57
+ if (nativeLayout && !prepared) preparePlacedKnownLayout(placement.element, childOccurrence);
58
+ return placement;
59
+ },
47
60
  style.overflow
48
61
  );
49
62
  }
50
63
  const Overlay = definePrimitive(renderOverlay, {
51
64
  childInput: "structural",
52
- resolveStyle: (style, context) => ({
53
- box: resolveContainerBox(style, context, "Overlay", "overlay"),
54
- overflow: style.overflow ?? "visible",
55
- alignItems: style.alignItems ?? "stretch",
56
- justifyItems: style.justifyItems ?? "stretch"
57
- })
65
+ resolveStyle: (style, context) => {
66
+ if (nativeLayout && hasPercentageBoxPadding(style)) {
67
+ style = resolveAllocatedInsets(style, {
68
+ width: context.percentageBasis.width,
69
+ context: { ...context, component: "Overlay", algorithm: "overlay" }
70
+ });
71
+ }
72
+ return {
73
+ box: resolveContainerBox(style, context, "Overlay", "overlay"),
74
+ [OVERLAY_CONTAINING_BOX_STYLE]: style,
75
+ overflow: style.overflow ?? "visible",
76
+ alignItems: style.alignItems ?? "stretch",
77
+ justifyItems: style.justifyItems ?? "stretch"
78
+ };
79
+ },
80
+ measureIntrinsic: (input) => measureUnionIntrinsic(input, "Overlay")
81
+ });
82
+ function prepareOverlayPlacements(children, content, alignment) {
83
+ recordWasmAllocationPass();
84
+ const placements = new Array(children.length);
85
+ for (let index = 0; index < children.length; index++) {
86
+ recordWasmAllocationItem();
87
+ placements[index] = resolveOverlayChildPlacement(content, children[index], alignment, getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, GLOBAL_STATE.primitiveReceiverToken, index));
88
+ }
89
+ return placements;
90
+ }
91
+ if (nativeLayout) registerKnownLayoutPreflight(Overlay, (element, style, content, receiver, slot) => {
92
+ const previous = GLOBAL_STATE.primitiveReceiverToken;
93
+ GLOBAL_STATE.primitiveReceiverToken = receiver;
94
+ const releaseLayout = pushLayoutBox(content, {
95
+ containingBlock: resolvePositionedContainingBox(
96
+ style,
97
+ content,
98
+ "Overlay"
99
+ )
100
+ });
101
+ try {
102
+ const children = prepareLayoutChildren(element.props.children, "Overlay");
103
+ const plan = { content, children, placements: withAllocationCheckpoint(slot, { children, content, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => prepareOverlayPlacements(children, content, style) }) };
104
+ prepareKnownLayoutDescendants(plan, slot);
105
+ stagePreparedLayoutPlan(slot, plan);
106
+ } finally {
107
+ releaseLayout();
108
+ GLOBAL_STATE.primitiveReceiverToken = previous;
109
+ }
58
110
  });
59
111
  function placeOverlayChild(container, child, alignment = {}) {
60
112
  return resolveOverlayChildPlacement(container, child, alignment).box;
61
113
  }
62
114
  function resolveOverlayChildPlacement(container, child, alignment = {}, receiverToken) {
63
115
  const prepared = prepareDirectChildStyle(child, receiverToken, container);
64
- const item = preparedStyleValue(prepared);
116
+ let item = preparedStyleValue(prepared);
117
+ if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === void 0 && hasPercentageBoxPadding(item)) {
118
+ item = resolveAllocatedInsets(item, { width: container.width, context: { component: child.type.name || "Anonymous", algorithm: "overlay" } });
119
+ }
120
+ assertSupportedChildPosition("Overlay", child, item, false, false);
65
121
  const resolved = resolveDirectChildBox(
66
122
  container,
67
123
  child,
68
124
  "overlay",
69
- item
125
+ item,
126
+ void 0,
127
+ receiverToken
70
128
  );
71
129
  const declaredBox = resolved.borderBox;
72
130
  const horizontal = resolveItemAlignment(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/layout/overlay.ts"],
4
- "sourcesContent": ["import { preparedStyleValue, preparedStyleQuery } from '../style/responsive.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from '../components/structural-events.js';\nimport type { BoxStyle, LayoutItemStyle, ResolvedBoxStyle } from '../style/types.js';\nimport type {\n PibblNodeInput,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport type { PibblElement } from '../element/types.js';\nimport { getChildPrimitiveReceiverToken } from '../element/metadata.js';\nimport {\n childWithUsedSize,\n prepareLayoutChildren,\n prepareDirectChildStyle,\n placeDirectChildren,\n resolveContainerBox,\n resolveDirectChildBox,\n} from './absolute.js';\nimport { pushLayoutBox } from './context.js';\nimport { recordLayoutEvaluation } from './diagnostics.js';\nimport type { LayoutBox } from './types.js';\n\ntype OverlayAlignment = 'start' | 'center' | 'end' | 'stretch';\n\n/**\n * Supported geometry and presentation properties for Overlay.\n *\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Overlay}\n */\nexport interface OverlayStyle extends BoxStyle, LayoutItemStyle {\n /** Default alignment of children on the cross or block axis. See {@link OverlayAlignment}. */\n alignItems?: OverlayAlignment;\n /** Default inline-axis alignment of grid or overlay children. See {@link OverlayAlignment}. */\n justifyItems?: OverlayAlignment;\n}\n\n/**\n * Authored inputs for Overlay, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Overlay}\n */\nexport interface OverlayProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\ninterface ResolvedOverlayStyle extends SystemStyle {\n box: ResolvedBoxStyle;\n overflow: 'visible' | 'clip';\n alignItems: OverlayAlignment;\n justifyItems: OverlayAlignment;\n}\n\nfunction renderOverlay(\n props: OverlayProps,\n style: Readonly<ResolvedOverlayStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n const children = prepareLayoutChildren(props.children, 'Overlay');\n recordLayoutEvaluation();\n const content = style.box.contentBox;\n ctx.translate(content.x, content.y);\n const localContent = Object.freeze({\n x: 0,\n y: 0,\n width: content.width,\n height: content.height,\n });\n const releaseLayout = pushLayoutBox(localContent);\n GLOBAL_STATE.componentRefs!.onAfterRender = releaseLayout;\n\n let occurrence = 0;\n return placeDirectChildren(\n children,\n localContent,\n child => resolveOverlayChildPlacement(\n localContent,\n child,\n style,\n getChildPrimitiveReceiverToken(\n GLOBAL_STATE.renderTransaction,\n GLOBAL_STATE.primitiveReceiverToken,\n occurrence++,\n ),\n ),\n style.overflow,\n );\n}\n\n/**\n * Describes overlay layout 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 OverlayProps}\n * @see {@link OverlayStyle}\n */\nexport const Overlay = definePrimitive<\n OverlayProps,\n OverlayStyle,\n OverlayStyle,\n ResolvedOverlayStyle\n>(renderOverlay, {\n childInput: 'structural',\n resolveStyle: (style, context) => ({\n box: resolveContainerBox(style, context, 'Overlay', 'overlay'),\n overflow: style.overflow ?? 'visible',\n alignItems: style.alignItems ?? 'stretch',\n justifyItems: style.justifyItems ?? 'stretch',\n }),\n});\n\nexport function placeOverlayChild(\n container: Readonly<LayoutBox>,\n child: PibblElement<any>,\n alignment: Readonly<Pick<OverlayStyle, 'alignItems' | 'justifyItems'>> = {},\n): LayoutBox {\n return resolveOverlayChildPlacement(container, child, alignment).box;\n}\n\nfunction resolveOverlayChildPlacement(\n container: Readonly<LayoutBox>,\n child: PibblElement<any>,\n alignment: Readonly<Pick<OverlayStyle, 'alignItems' | 'justifyItems'>> = {},\n receiverToken?: object,\n): { box: LayoutBox; element: PibblElement<any> } {\n const prepared = prepareDirectChildStyle(child, receiverToken, container);\n const item = preparedStyleValue(prepared) as Readonly<\n BoxStyle & LayoutItemStyle\n >;\n const resolved = resolveDirectChildBox(\n container,\n child,\n 'overlay',\n item,\n );\n const declaredBox = resolved.borderBox;\n const horizontal = resolveItemAlignment(\n item.justifySelf,\n alignment.justifyItems ?? 'stretch',\n child,\n container,\n 'justifySelf',\n );\n const vertical = resolveItemAlignment(\n item.alignSelf,\n alignment.alignItems ?? 'stretch',\n child,\n container,\n 'alignSelf',\n );\n const x = alignAxis(\n container.x,\n container.width,\n declaredBox.width,\n horizontal,\n );\n const y = alignAxis(\n container.y,\n container.height,\n declaredBox.height,\n vertical,\n );\n const box = {\n x,\n y,\n width: horizontal === 'stretch' ?\n Math.max(0, container.width) :\n declaredBox.width,\n height: vertical === 'stretch' ?\n Math.max(0, container.height) :\n declaredBox.height,\n };\n const horizontalPadding = declaredBox.width - resolved.contentBox.width;\n const verticalPadding = declaredBox.height - resolved.contentBox.height;\n return {\n box,\n element: childWithUsedSize(\n child,\n item,\n Math.max(0, box.width - horizontalPadding),\n Math.max(0, box.height - verticalPadding),\n receiverToken,\n preparedStyleQuery(prepared),\n ),\n };\n}\n\nfunction resolveItemAlignment(\n item: LayoutItemStyle['alignSelf'] | LayoutItemStyle['justifySelf'],\n fallback: OverlayAlignment,\n child: PibblElement<any>,\n container: Readonly<LayoutBox>,\n property: 'alignSelf' | 'justifySelf',\n): OverlayAlignment {\n if (item === undefined || item === 'auto') return fallback;\n if (item === 'start' || item === 'center' || item === 'end' || item === 'stretch') {\n return item;\n }\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property,\n value: item,\n algorithm: 'overlay',\n constraints: {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n },\n reason: 'uses an unsupported overlay alignment value',\n });\n}\n\nfunction alignAxis(\n start: number,\n available: number,\n size: number,\n alignment: OverlayAlignment,\n): number {\n switch (alignment) {\n case 'center': return start + (available - size) / 2;\n case 'end': return start + available - size;\n default: return start;\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC;AAAA,EAEE;AAAA,OACK;AAQP,SAAS,sCAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAqCvC,SAAS,cACP,OACA,OACA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AACH;AAEA,SAAS,UACP,OACA,WACA,MACA,WACQ;AACR,UAAQ,WAAW;AAAA,IACjB,KAAK;AAAU,aAAO,SAAS,YAAY,QAAQ;AAAA,IACnD,KAAK;AAAO,aAAO,QAAQ,YAAY;AAAA,IACvC;AAAS,aAAO;AAAA,EAClB;AACF;",
4
+ "sourcesContent": ["import { withAllocationCheckpoint, mountedAllocationCheckpointOwner } from './allocation-checkpoint.js';\nimport { hasPercentageBoxPadding, resolveAllocatedInsets } from './box-insets.js';\nimport { recordWasmAllocationPass, recordWasmAllocationItem, recordWasmAllocationCacheHit, nativeLayout } from './wasm/region.js';\nimport { registerKnownLayoutPreflight, claimPreparedLayoutPlan, stagePreparedLayoutPlan, prepareKnownLayoutDescendants, preparePlacedKnownLayout, type PreparedLayoutPlan } from './prepared-root.js';\nimport { getStyleMeasurementMode, preparedStyleValue, preparedStyleQuery } from '../style/responsive.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from '../components/structural-events.js';\nimport type { BoxStyle, LayoutItemStyle, ResolvedBoxStyle } from '../style/types.js';\nimport type {\n PibblNodeInput,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport type { PibblElement } from '../element/types.js';\nimport { getChildPrimitiveReceiverToken } from '../element/metadata.js';\nimport {\n childWithUsedSize,\n prepareLayoutChildren,\n prepareDirectChildStyle,\n placeDirectChildren,\n resolveContainerBox,\n resolveDirectChildBox,\n measureUnionIntrinsic,\n} from './absolute.js';\nimport { pushLayoutBox, resolvePositionedContainingBox } from './context.js';\nimport { recordLayoutEvaluation } from './diagnostics.js';\nimport { assertSupportedChildPosition } from './positioning-diagnostics.js';\nimport type { LayoutBox } from './types.js';\n\ntype OverlayAlignment = 'start' | 'center' | 'end' | 'stretch';\n\n/**\n * Supported geometry and presentation properties for Overlay.\n *\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Overlay}\n */\nexport interface OverlayStyle extends BoxStyle, LayoutItemStyle {\n /** Default alignment of children on the cross or block axis. See {@link OverlayAlignment}. */\n alignItems?: OverlayAlignment;\n /** Default inline-axis alignment of grid or overlay children. See {@link OverlayAlignment}. */\n justifyItems?: OverlayAlignment;\n}\n\n/**\n * Authored inputs for Overlay, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Overlay}\n */\nexport interface OverlayProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n// Parent input is private metadata, not a recursively validated resolved value.\nconst OVERLAY_CONTAINING_BOX_STYLE = Symbol('pibbl.overlay-containing-box-style');\n\ninterface ResolvedOverlayStyle extends SystemStyle {\n box: ResolvedBoxStyle;\n [OVERLAY_CONTAINING_BOX_STYLE]: Readonly<OverlayStyle>;\n overflow: 'visible' | 'clip';\n alignItems: OverlayAlignment;\n justifyItems: OverlayAlignment;\n}\n\nfunction renderOverlay(\n props: OverlayProps,\n style: Readonly<ResolvedOverlayStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n const ordinaryChildren = nativeLayout ? undefined : prepareLayoutChildren(props.children, 'Overlay');\n recordLayoutEvaluation();\n const content = style.box.contentBox;\n ctx.translate(content.x, content.y);\n const localContent = Object.freeze({\n x: 0,\n y: 0,\n width: content.width,\n height: content.height,\n });\n const releaseLayout = pushLayoutBox(localContent, {\n logicalOffset: content,\n containingBlock: resolvePositionedContainingBox(\n style[OVERLAY_CONTAINING_BOX_STYLE],\n localContent,\n 'Overlay',\n ),\n });\n GLOBAL_STATE.componentRefs!.onAfterRender = releaseLayout;\n\n const prepared = nativeLayout ? claimPreparedLayoutPlan(GLOBAL_STATE.componentRefs!.element, localContent) : undefined;\n const children = prepared?.children ?? ordinaryChildren ?? prepareLayoutChildren(props.children, 'Overlay');\n const placements = prepared?.placements ?? (nativeLayout ? withAllocationCheckpoint(mountedAllocationCheckpointOwner(), { children, content: localContent, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => prepareOverlayPlacements(children, localContent, style) }) : undefined);\n let placementIndex = 0;\n let occurrence = 0;\n return placeDirectChildren(\n children,\n localContent,\n (child, childOccurrence) => {\n const placement = placements ? placements[placementIndex++] : resolveOverlayChildPlacement(localContent, child, style, getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, GLOBAL_STATE.primitiveReceiverToken, occurrence++));\n if (nativeLayout && !prepared) preparePlacedKnownLayout(placement.element, childOccurrence);\n return placement;\n },\n style.overflow,\n );\n}\n\n/**\n * Describes overlay layout 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 OverlayProps}\n * @see {@link OverlayStyle}\n */\nexport const Overlay = definePrimitive<\n OverlayProps,\n OverlayStyle,\n OverlayStyle,\n ResolvedOverlayStyle\n>(renderOverlay, {\n childInput: 'structural',\n resolveStyle: (style, context) => {\n if (nativeLayout && hasPercentageBoxPadding(style)) {\n style = resolveAllocatedInsets(style, { width: context.percentageBasis.width,\n context: { ...context, component: 'Overlay', algorithm: 'overlay' } });\n }\n return {\n box: resolveContainerBox(style, context, 'Overlay', 'overlay'),\n [OVERLAY_CONTAINING_BOX_STYLE]: style,\n overflow: style.overflow ?? 'visible',\n alignItems: style.alignItems ?? 'stretch',\n justifyItems: style.justifyItems ?? 'stretch',\n };\n },\n measureIntrinsic: (input) => measureUnionIntrinsic(input, 'Overlay'),\n});\n\nfunction prepareOverlayPlacements(children: readonly PibblElement<any>[], content: Readonly<LayoutBox>, alignment: Readonly<Pick<OverlayStyle, 'alignItems' | 'justifyItems'>>): { box: LayoutBox; element: PibblElement<any> }[] {\n recordWasmAllocationPass();\n const placements = new Array<{ box: LayoutBox; element: PibblElement<any> }>(children.length);\n for (let index = 0; index < children.length; index++) {\n recordWasmAllocationItem();\n placements[index] = resolveOverlayChildPlacement(content, children[index], alignment, getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, GLOBAL_STATE.primitiveReceiverToken, index));\n }\n return placements;\n}\nif (nativeLayout) registerKnownLayoutPreflight(Overlay, (element, style, content, receiver, slot) => {\n // The registry owns this structural slot; Overlay needs no numeric arena.\n const previous = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken = receiver;\n const releaseLayout = pushLayoutBox(content, {\n containingBlock: resolvePositionedContainingBox(\n style as Readonly<OverlayStyle>,\n content,\n 'Overlay',\n ),\n });\n try {\n const children = prepareLayoutChildren(element.props.children, 'Overlay');\n const plan: PreparedLayoutPlan = { content, children, placements: withAllocationCheckpoint(slot, { children, content, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => prepareOverlayPlacements(children, content, style as Readonly<OverlayStyle>) }) };\n prepareKnownLayoutDescendants(plan, slot);\n stagePreparedLayoutPlan(slot, plan);\n } finally {\n releaseLayout();\n GLOBAL_STATE.primitiveReceiverToken = previous;\n }\n});\n\nexport function placeOverlayChild(\n container: Readonly<LayoutBox>,\n child: PibblElement<any>,\n alignment: Readonly<Pick<OverlayStyle, 'alignItems' | 'justifyItems'>> = {},\n): LayoutBox {\n return resolveOverlayChildPlacement(container, child, alignment).box;\n}\n\nfunction resolveOverlayChildPlacement(\n container: Readonly<LayoutBox>,\n child: PibblElement<any>,\n alignment: Readonly<Pick<OverlayStyle, 'alignItems' | 'justifyItems'>> = {},\n receiverToken?: object,\n): { box: LayoutBox; element: PibblElement<any> } {\n const prepared = prepareDirectChildStyle(child, receiverToken, container);\n let item = preparedStyleValue(prepared) as Readonly<\n BoxStyle & LayoutItemStyle\n >;\n if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === undefined && hasPercentageBoxPadding(item)) {\n item = resolveAllocatedInsets(item, { width: container.width, context: { component: child.type.name || 'Anonymous', algorithm: 'overlay' } });\n }\n assertSupportedChildPosition('Overlay', child, item, false, false);\n const resolved = resolveDirectChildBox(\n container,\n child,\n 'overlay',\n item,\n undefined,\n receiverToken,\n );\n const declaredBox = resolved.borderBox;\n const horizontal = resolveItemAlignment(\n item.justifySelf,\n alignment.justifyItems ?? 'stretch',\n child,\n container,\n 'justifySelf',\n );\n const vertical = resolveItemAlignment(\n item.alignSelf,\n alignment.alignItems ?? 'stretch',\n child,\n container,\n 'alignSelf',\n );\n const x = alignAxis(\n container.x,\n container.width,\n declaredBox.width,\n horizontal,\n );\n const y = alignAxis(\n container.y,\n container.height,\n declaredBox.height,\n vertical,\n );\n const box = {\n x,\n y,\n width: horizontal === 'stretch' ?\n Math.max(0, container.width) :\n declaredBox.width,\n height: vertical === 'stretch' ?\n Math.max(0, container.height) :\n declaredBox.height,\n };\n const horizontalPadding = declaredBox.width - resolved.contentBox.width;\n const verticalPadding = declaredBox.height - resolved.contentBox.height;\n return {\n box,\n element: childWithUsedSize(\n child,\n item,\n Math.max(0, box.width - horizontalPadding),\n Math.max(0, box.height - verticalPadding),\n receiverToken,\n preparedStyleQuery(prepared),\n ),\n };\n}\n\nfunction resolveItemAlignment(\n item: LayoutItemStyle['alignSelf'] | LayoutItemStyle['justifySelf'],\n fallback: OverlayAlignment,\n child: PibblElement<any>,\n container: Readonly<LayoutBox>,\n property: 'alignSelf' | 'justifySelf',\n): OverlayAlignment {\n if (item === undefined || item === 'auto') return fallback;\n if (item === 'start' || item === 'center' || item === 'end' || item === 'stretch') {\n return item;\n }\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property,\n value: item,\n algorithm: 'overlay',\n constraints: {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n },\n reason: 'uses an unsupported overlay alignment value',\n });\n}\n\nfunction alignAxis(\n start: number,\n available: number,\n size: number,\n alignment: OverlayAlignment,\n): number {\n switch (alignment) {\n case 'center': return start + (available - size) / 2;\n case 'end': return start + available - size;\n default: return start;\n }\n}\n"],
5
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;AAAA,MACpB,WAAW;AAAA,MACX,WAAW,UAAU;AAAA,IACvB;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AACH;AAEA,SAAS,UACP,OACA,WACA,MACA,WACQ;AACR,UAAQ,WAAW;AAAA,IACjB,KAAK;AAAU,aAAO,SAAS,YAAY,QAAQ;AAAA,IACnD,KAAK;AAAO,aAAO,QAAQ,YAAY;AAAA,IACvC;AAAS,aAAO;AAAA,EAClB;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,27 @@
1
+ import { type PreparedStyleInput } from '../style/resolve-dispatch.js';
2
+ import type { PibblElement } from '../element/types.js';
3
+ import type { PibblComponentRefs, PibblInstance } from '../types.js';
4
+ export declare function registerContentsTransform(type: Function): void;
5
+ export declare function isContentsTransform(type: Function): boolean;
6
+ export interface LayoutSuspensionResource {
7
+ suspendLayout(): void;
8
+ }
9
+ export declare function registerLayoutSuspensionResource(refs: PibblComponentRefs<any>, resource: LayoutSuspensionResource): void;
10
+ export declare function unregisterLayoutSuspensionResource(refs: PibblComponentRefs<any>, resource: LayoutSuspensionResource): void;
11
+ export declare function isLayoutComponentSuspended(refs: PibblComponentRefs<any>): boolean;
12
+ export declare function isLayoutInstanceSuspended(owner: PibblInstance): boolean;
13
+ export declare function resumeLayoutComponent(refs: PibblComponentRefs<any>): void;
14
+ /** Reads only the structural visibility input; hidden inputs never require measurement. */
15
+ export declare function layoutParticipation(element: PibblElement<any>, preparedStyle?: PreparedStyleInput | null): 'normal' | 'hidden' | 'contents';
16
+ export interface LayoutParticipationSource {
17
+ readonly element: PibblElement<any>;
18
+ readonly hidden: boolean;
19
+ readonly children?: readonly LayoutParticipationSource[];
20
+ }
21
+ /** Contents may expose only declared structural children, never an opaque component program. */
22
+ export declare function contentsChildren(element: PibblElement<any>): readonly PibblElement<any>[];
23
+ export declare function participatingLayoutChildren(source: readonly PibblElement<any>[]): readonly PibblElement<any>[];
24
+ export declare function layoutParticipationPlan(children: readonly PibblElement<any>[]): readonly LayoutParticipationSource[] | undefined;
25
+ /** Records mount ownership once; retaining a hidden subtree never scans unrelated mounts. */
26
+ export declare function registerLayoutComponentMount(refs: PibblComponentRefs<any>): void;
27
+ export declare function retainHiddenLayoutDescendants(refs: PibblComponentRefs<any>): void;
@@ -0,0 +1,188 @@
1
+ import { peekPreNormalizedStyle } from "../style/resolve-dispatch.js";
2
+ import { materializeContainerChildren } from "../element/children.js";
3
+ import { isKnownLayoutType } from "./prepared-root.js";
4
+ import { getSpecifiedStyle } from "../element/metadata.js";
5
+ import { GLOBAL_STATE } from "../global-state.js";
6
+ import { isSignal, getSignalNode, withSignalDependencyRole } from "../signals/graph.js";
7
+ const contentsTransforms = /* @__PURE__ */ new WeakSet();
8
+ function registerContentsTransform(type) {
9
+ contentsTransforms.add(type);
10
+ }
11
+ function isContentsTransform(type) {
12
+ return contentsTransforms.has(type);
13
+ }
14
+ const suspensionResources = /* @__PURE__ */ new WeakMap();
15
+ function registerLayoutSuspensionResource(refs, resource) {
16
+ let resources = suspensionResources.get(refs);
17
+ if (!resources) {
18
+ resources = /* @__PURE__ */ new Set();
19
+ suspensionResources.set(refs, resources);
20
+ }
21
+ resources.add(resource);
22
+ }
23
+ function unregisterLayoutSuspensionResource(refs, resource) {
24
+ const resources = suspensionResources.get(refs);
25
+ resources?.delete(resource);
26
+ if (resources?.size === 0) suspensionResources.delete(refs);
27
+ }
28
+ const suspendedComponents = /* @__PURE__ */ new WeakSet();
29
+ function isLayoutComponentSuspended(refs) {
30
+ return !refs.teardowns.closed && suspendedComponents.has(refs);
31
+ }
32
+ function isLayoutInstanceSuspended(owner) {
33
+ let current = owner;
34
+ while (current) {
35
+ if (current.eventParent && isLayoutComponentSuspended(current.eventParent)) return true;
36
+ current = current.parent ? GLOBAL_STATE.pibblInstances.get(current.parent) : void 0;
37
+ }
38
+ return false;
39
+ }
40
+ function resumeLayoutComponent(refs) {
41
+ suspendedComponents.delete(refs);
42
+ }
43
+ function participationStyle(element, preparedStyle) {
44
+ const prepared = preparedStyle === void 0 ? peekPreNormalizedStyle(element) : preparedStyle;
45
+ if (prepared) return prepared.style;
46
+ const specified = getSpecifiedStyle(element);
47
+ if (!isSignal(specified)) return specified;
48
+ const node = getSignalNode(specified);
49
+ node.validate?.();
50
+ const current = node.value;
51
+ return current && typeof current === "object" && current.layoutParticipation !== void 0 ? specified.get() : current;
52
+ }
53
+ const mountedChildren = /* @__PURE__ */ new WeakMap();
54
+ function layoutParticipation(element, preparedStyle) {
55
+ const style = participationStyle(element, preparedStyle);
56
+ const input = style && typeof style === "object" ? style.layoutParticipation : void 0;
57
+ const value = isSignal(input) ? withSignalDependencyRole("layout", () => input.get()) : input;
58
+ if (value === void 0 || value === "normal") return "normal";
59
+ if (value === "hidden" || value === "contents") return value;
60
+ throw new TypeError(`${element.type.name || "Component"} style.layoutParticipation must be normal, hidden, or contents.`);
61
+ }
62
+ const participationPlans = /* @__PURE__ */ new WeakMap();
63
+ function contentsChildren(element) {
64
+ if (!isContentsTransform(element.type) && !isKnownLayoutType(element.type)) {
65
+ throw new TypeError(`${element.type.name || "Component"} contents participation requires a built-in layout or Group with declared structural children.`);
66
+ }
67
+ const style = participationStyle(element);
68
+ if (style && typeof style === "object") {
69
+ const values = style;
70
+ rejectContentsBoxProperty(values, "width", element);
71
+ rejectContentsBoxProperty(values, "height", element);
72
+ rejectContentsBoxProperty(values, "minWidth", element);
73
+ rejectContentsBoxProperty(values, "maxWidth", element);
74
+ rejectContentsBoxProperty(values, "minHeight", element);
75
+ rejectContentsBoxProperty(values, "maxHeight", element);
76
+ rejectContentsBoxProperty(values, "boxSizing", element);
77
+ rejectContentsBoxProperty(values, "padding", element);
78
+ rejectContentsBoxProperty(values, "paddingStart", element);
79
+ rejectContentsBoxProperty(values, "paddingEnd", element);
80
+ rejectContentsBoxProperty(values, "borderWidth", element);
81
+ rejectContentsBoxProperty(values, "borderStartWidth", element);
82
+ rejectContentsBoxProperty(values, "borderEndWidth", element);
83
+ rejectContentsBoxProperty(values, "overflow", element);
84
+ rejectContentsBoxProperty(values, "filter", element);
85
+ rejectContentsBoxProperty(values, "position", element);
86
+ rejectContentsBoxProperty(values, "left", element);
87
+ rejectContentsBoxProperty(values, "right", element);
88
+ rejectContentsBoxProperty(values, "top", element);
89
+ rejectContentsBoxProperty(values, "bottom", element);
90
+ rejectContentsBoxProperty(values, "insetStart", element);
91
+ rejectContentsBoxProperty(values, "insetEnd", element);
92
+ rejectContentsBoxProperty(values, "margin", element);
93
+ rejectContentsBoxProperty(values, "marginTop", element);
94
+ rejectContentsBoxProperty(values, "marginRight", element);
95
+ rejectContentsBoxProperty(values, "marginBottom", element);
96
+ rejectContentsBoxProperty(values, "marginLeft", element);
97
+ rejectContentsBoxProperty(values, "marginStart", element);
98
+ rejectContentsBoxProperty(values, "marginEnd", element);
99
+ }
100
+ const input = element.props.children;
101
+ return materializeContainerChildren(input, element);
102
+ }
103
+ function participatingLayoutChildren(source) {
104
+ let needsPlan = false;
105
+ for (const element of source) if (layoutParticipation(element) !== "normal") {
106
+ needsPlan = true;
107
+ break;
108
+ }
109
+ if (!needsPlan) return source;
110
+ const leaves = [];
111
+ const visiting = /* @__PURE__ */ new Set();
112
+ const build = (sequence) => {
113
+ const result = [];
114
+ for (const element of sequence) {
115
+ const participation = layoutParticipation(element);
116
+ if (participation === "hidden") result.push({ element, hidden: true });
117
+ else if (participation === "contents") {
118
+ if (visiting.has(element)) throw new TypeError("Contents layout descriptors form a cycle.");
119
+ visiting.add(element);
120
+ try {
121
+ result.push({ element, hidden: false, children: build(contentsChildren(element)) });
122
+ } finally {
123
+ visiting.delete(element);
124
+ }
125
+ } else {
126
+ leaves.push(element);
127
+ result.push({ element, hidden: false });
128
+ }
129
+ }
130
+ return result;
131
+ };
132
+ participationPlans.set(leaves, build(source));
133
+ return leaves;
134
+ }
135
+ function layoutParticipationPlan(children) {
136
+ return participationPlans.get(children);
137
+ }
138
+ function registerLayoutComponentMount(refs) {
139
+ const parent = refs.parent;
140
+ if (!parent) return;
141
+ let children = mountedChildren.get(parent);
142
+ if (!children) {
143
+ children = /* @__PURE__ */ new Set();
144
+ mountedChildren.set(parent, children);
145
+ }
146
+ children.add(refs);
147
+ const owned = children;
148
+ refs.teardowns.add(() => {
149
+ owned.delete(refs);
150
+ if (!owned.size && mountedChildren.get(parent) === owned) mountedChildren.delete(parent);
151
+ mountedChildren.delete(refs);
152
+ });
153
+ }
154
+ function retainHiddenLayoutDescendants(refs) {
155
+ suspendedComponents.add(refs);
156
+ refs.renderGeneration = GLOBAL_STATE.currentPibblInstance.renderGeneration;
157
+ const resources = suspensionResources.get(refs);
158
+ if (resources) for (const resource of resources) resource.suspendLayout();
159
+ const children = mountedChildren.get(refs);
160
+ if (!children) return;
161
+ for (const child of children) {
162
+ if (child.teardowns.closed) continue;
163
+ GLOBAL_STATE.seenIds.add(child.id);
164
+ retainHiddenLayoutDescendants(child);
165
+ }
166
+ }
167
+ function rejectContentsBoxProperty(style, property, element) {
168
+ const input = style[property];
169
+ if ((isSignal(input) ? input.get() : input) !== void 0) {
170
+ throw new TypeError(`${element.type.name} style.${property} requires a box and is incompatible with contents participation.`);
171
+ }
172
+ }
173
+ export {
174
+ contentsChildren,
175
+ isContentsTransform,
176
+ isLayoutComponentSuspended,
177
+ isLayoutInstanceSuspended,
178
+ layoutParticipation,
179
+ layoutParticipationPlan,
180
+ participatingLayoutChildren,
181
+ registerContentsTransform,
182
+ registerLayoutComponentMount,
183
+ registerLayoutSuspensionResource,
184
+ resumeLayoutComponent,
185
+ retainHiddenLayoutDescendants,
186
+ unregisterLayoutSuspensionResource
187
+ };
188
+ //# sourceMappingURL=participation.js.map