@vibecook/ice 0.10.0 → 0.14.0

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 (380) hide show
  1. package/README.md +79 -50
  2. package/dist/chunk-BA7XJC27.js +2429 -0
  3. package/dist/chunk-BA7XJC27.js.map +1 -0
  4. package/dist/chunk-BKV4ZEU3.js +1 -0
  5. package/dist/chunk-BKV4ZEU3.js.map +1 -0
  6. package/dist/{chunk-5FQS7V2C.js → chunk-DYK6KNLG.js} +13303 -7485
  7. package/dist/chunk-DYK6KNLG.js.map +1 -0
  8. package/dist/chunk-ENIFIUEP.js +155 -0
  9. package/dist/chunk-ENIFIUEP.js.map +1 -0
  10. package/dist/chunk-IBWWLA6D.js +634 -0
  11. package/dist/chunk-IBWWLA6D.js.map +1 -0
  12. package/dist/{chunk-OR5FNVUE.js → chunk-JS6PG6YD.js} +398 -167
  13. package/dist/chunk-JS6PG6YD.js.map +1 -0
  14. package/dist/chunk-QXOCF56A.js +148 -0
  15. package/dist/chunk-QXOCF56A.js.map +1 -0
  16. package/dist/chunk-ZPUPBULB.js +7399 -0
  17. package/dist/chunk-ZPUPBULB.js.map +1 -0
  18. package/dist/desk-engine.js +36 -0
  19. package/dist/desk-engine.js.map +1 -0
  20. package/dist/desk-kit.js +244 -0
  21. package/dist/desk-kit.js.map +1 -0
  22. package/dist/desk-objects.js +12728 -0
  23. package/dist/desk-objects.js.map +1 -0
  24. package/dist/desk.js +469 -0
  25. package/dist/desk.js.map +1 -0
  26. package/dist/devtools.js +233 -189
  27. package/dist/devtools.js.map +1 -1
  28. package/dist/dom.js +7 -19
  29. package/dist/index.js +232 -20
  30. package/dist/kernel.js +53 -25
  31. package/dist/react.js +1045 -38
  32. package/dist/react.js.map +1 -1
  33. package/dist/types/packages/core/src/behavior/define-behavior.d.ts +11 -0
  34. package/dist/types/packages/core/src/behavior/runtime.d.ts +4 -0
  35. package/dist/types/packages/core/src/canvas/define-canvas-type.d.ts +86 -0
  36. package/dist/types/packages/core/src/canvas/define-container.d.ts +17 -0
  37. package/dist/types/packages/core/src/canvas/diagnostics.d.ts +27 -0
  38. package/dist/types/packages/core/src/canvas/engine-catalog.d.ts +70 -0
  39. package/dist/types/packages/core/src/canvas/extensions.d.ts +125 -0
  40. package/dist/types/packages/core/src/canvas/frame-behavior-host.d.ts +16 -0
  41. package/dist/types/packages/core/src/canvas/frame-preview.d.ts +79 -0
  42. package/dist/types/packages/core/src/canvas/frame-projection.d.ts +38 -0
  43. package/dist/types/packages/core/src/canvas/frame-view.d.ts +36 -0
  44. package/dist/types/packages/core/src/canvas/migrate.d.ts +14 -0
  45. package/dist/types/packages/core/src/canvas/placement.d.ts +30 -0
  46. package/dist/types/packages/core/src/canvas/presentation-transition.d.ts +100 -0
  47. package/dist/types/packages/core/src/canvas/runtime-extension-host.d.ts +16 -0
  48. package/dist/types/packages/core/src/canvas/session.d.ts +47 -0
  49. package/dist/types/packages/core/src/catalog/camera-derived.d.ts +16 -27
  50. package/dist/types/packages/core/src/catalog/desk.d.ts +326 -0
  51. package/dist/types/packages/core/src/catalog/gesture.d.ts +51 -0
  52. package/dist/types/packages/core/src/catalog/graph.d.ts +2 -2
  53. package/dist/types/packages/core/src/catalog/index.d.ts +2 -0
  54. package/dist/types/packages/core/src/catalog/pointer.d.ts +42 -0
  55. package/dist/types/packages/core/src/catalog/selection-presence.d.ts +7 -0
  56. package/dist/types/packages/core/src/catalog/settings-resources.d.ts +28 -2
  57. package/dist/types/packages/core/src/catalog/surface.d.ts +1 -0
  58. package/dist/types/packages/core/src/doc/doc-commit-sink.d.ts +18 -2
  59. package/dist/types/packages/core/src/doc/doc-kit.d.ts +21 -2
  60. package/dist/types/packages/core/src/doc/envelope.d.ts +5 -2
  61. package/dist/types/packages/core/src/doc/schema-migrate.d.ts +1 -1
  62. package/dist/types/packages/core/src/doc/version-gate.d.ts +21 -3
  63. package/dist/types/packages/core/src/engine/commit-sink.d.ts +10 -1
  64. package/dist/types/packages/core/src/engine/engine.d.ts +6 -0
  65. package/dist/types/packages/core/src/engine/frame-control.d.ts +74 -0
  66. package/dist/types/packages/core/src/engine/guests.d.ts +4 -1
  67. package/dist/types/packages/core/src/engine/world-doors.d.ts +12 -0
  68. package/dist/types/packages/core/src/facade/create-canvas-engine.d.ts +146 -13
  69. package/dist/types/packages/core/src/index.d.ts +34 -13
  70. package/dist/types/packages/core/src/input/queue.d.ts +3 -1
  71. package/dist/types/packages/core/src/interaction/install.d.ts +30 -0
  72. package/dist/types/packages/core/src/interaction/wakes.d.ts +24 -0
  73. package/dist/types/packages/core/src/nav/nav-geometry.d.ts +100 -0
  74. package/dist/types/packages/core/src/nav/nested-canvas.d.ts +47 -4
  75. package/dist/types/packages/core/src/ops/cascade.d.ts +2 -1
  76. package/dist/types/packages/core/src/ops/claims.d.ts +6 -0
  77. package/dist/types/packages/core/src/ops/insert.d.ts +4 -0
  78. package/dist/types/packages/core/src/ops/point-pick.d.ts +4 -1
  79. package/dist/types/packages/core/src/ops/sibling-order.d.ts +14 -4
  80. package/dist/types/packages/core/src/ops/tray.d.ts +48 -0
  81. package/dist/types/packages/core/src/presence/presence-kit.d.ts +5 -0
  82. package/dist/types/packages/core/src/schema/meta.d.ts +10 -0
  83. package/dist/types/packages/core/src/schema/prefab.d.ts +8 -0
  84. package/dist/types/packages/core/src/settings/defaults.d.ts +25 -6
  85. package/dist/types/packages/core/src/surface/gpu-device.d.ts +55 -0
  86. package/dist/types/packages/core/src/systems/camera-sim.d.ts +29 -0
  87. package/dist/types/packages/core/src/systems/chrome.d.ts +15 -23
  88. package/dist/types/packages/core/src/systems/drag-mods.d.ts +34 -0
  89. package/dist/types/packages/core/src/systems/held.d.ts +71 -0
  90. package/dist/types/packages/core/src/systems/insert-ghost.d.ts +2 -0
  91. package/dist/types/packages/core/src/systems/l0-input.d.ts +14 -0
  92. package/dist/types/packages/core/src/systems/l1-pick.d.ts +37 -1
  93. package/dist/types/packages/core/src/systems/l2-arbitrate.d.ts +18 -4
  94. package/dist/types/packages/core/src/systems/l3-behave.d.ts +4 -1
  95. package/dist/types/packages/core/src/systems/l3-claim.d.ts +7 -0
  96. package/dist/types/packages/core/src/systems/l3-connect.d.ts +1 -1
  97. package/dist/types/packages/core/src/systems/l3-drop.d.ts +30 -1
  98. package/dist/types/packages/core/src/systems/l3-marquee.d.ts +2 -1
  99. package/dist/types/packages/core/src/systems/l3-ports.d.ts +1 -1
  100. package/dist/types/packages/core/src/systems/l4-cursor.d.ts +5 -0
  101. package/dist/types/packages/core/src/systems/nav-flight.d.ts +85 -3
  102. package/dist/types/packages/core/src/systems/nav-tap.d.ts +44 -0
  103. package/dist/types/packages/core/src/systems/press-wheel.d.ts +11 -0
  104. package/dist/types/packages/core/src/systems/tray.d.ts +108 -0
  105. package/dist/types/packages/core/src/systems/zoom-through.d.ts +30 -0
  106. package/dist/types/packages/core/src/tools/define-tool.d.ts +10 -0
  107. package/dist/types/packages/core/src/widget/define-widget.d.ts +166 -63
  108. package/dist/types/packages/core/src/widget/equip.d.ts +14 -2
  109. package/dist/types/packages/core/src/widget/held-tools.d.ts +83 -0
  110. package/dist/types/packages/core/src/widget/menu-actions.d.ts +44 -0
  111. package/dist/types/packages/core/src/widget/mount-store.d.ts +21 -46
  112. package/dist/types/packages/core/src/widget/spawn.d.ts +1 -1
  113. package/dist/types/packages/desk/src/assets/blue-noise.gen.d.ts +10 -0
  114. package/dist/types/packages/desk/src/card/card.d.ts +103 -0
  115. package/dist/types/packages/desk/src/compose/ambient.d.ts +59 -0
  116. package/dist/types/packages/desk/src/compose/builder.d.ts +285 -0
  117. package/dist/types/packages/desk/src/compose/children.d.ts +3 -0
  118. package/dist/types/packages/desk/src/compose/index.d.ts +14 -0
  119. package/dist/types/packages/desk/src/compose/marks.d.ts +126 -0
  120. package/dist/types/packages/desk/src/compose/pick.d.ts +5 -0
  121. package/dist/types/packages/desk/src/compose/reflector.d.ts +111 -0
  122. package/dist/types/packages/desk/src/compose/tap.d.ts +5 -0
  123. package/dist/types/packages/desk/src/docs.d.ts +23 -0
  124. package/dist/types/packages/desk/src/engine/budget.d.ts +38 -0
  125. package/dist/types/packages/desk/src/engine/device.d.ts +54 -0
  126. package/dist/types/packages/desk/src/engine/index.d.ts +5 -0
  127. package/dist/types/packages/desk/src/engine/pipeline.d.ts +36 -0
  128. package/dist/types/packages/desk/src/engine/rasters.d.ts +66 -0
  129. package/dist/types/packages/desk/src/engine/records.d.ts +56 -0
  130. package/dist/types/packages/desk/src/engine/shader.d.ts +22 -0
  131. package/dist/types/packages/desk/src/engine/struct.d.ts +39 -0
  132. package/dist/types/packages/desk/src/engine/target.d.ts +26 -0
  133. package/dist/types/packages/desk/src/gpu-ablation.d.ts +61 -0
  134. package/dist/types/packages/desk/src/gpu-memory.d.ts +54 -0
  135. package/dist/types/packages/desk/src/gpu-profiler.d.ts +141 -0
  136. package/dist/types/packages/desk/src/gpu-wrap.d.ts +8 -0
  137. package/dist/types/packages/desk/src/ground.d.ts +388 -0
  138. package/dist/types/packages/desk/src/hold/focus.d.ts +53 -0
  139. package/dist/types/packages/desk/src/hold/pose.d.ts +132 -0
  140. package/dist/types/packages/desk/src/hold/shaders.d.ts +9 -0
  141. package/dist/types/packages/desk/src/host/editor.d.ts +18 -0
  142. package/dist/types/packages/desk/src/host/index.d.ts +9 -0
  143. package/dist/types/packages/desk/src/host/ink.d.ts +18 -0
  144. package/dist/types/packages/desk/src/host/layer.d.ts +430 -0
  145. package/dist/types/packages/desk/src/host/picture.d.ts +2 -0
  146. package/dist/types/packages/desk/src/host/surface.d.ts +5 -0
  147. package/dist/types/packages/desk/src/index.d.ts +13 -0
  148. package/dist/types/packages/desk/src/kind.d.ts +187 -0
  149. package/dist/types/packages/desk/src/kinds/world.d.ts +429 -0
  150. package/dist/types/packages/desk/src/kit/arrays.d.ts +88 -0
  151. package/dist/types/packages/desk/src/kit/blobs.d.ts +40 -0
  152. package/dist/types/packages/desk/src/kit/book.d.ts +2 -0
  153. package/dist/types/packages/desk/src/kit/editor.d.ts +103 -0
  154. package/dist/types/packages/desk/src/kit/eye.d.ts +37 -0
  155. package/dist/types/packages/desk/src/kit/hold.d.ts +1 -0
  156. package/dist/types/packages/desk/src/kit/index.d.ts +26 -0
  157. package/dist/types/packages/desk/src/kit/inside.d.ts +116 -0
  158. package/dist/types/packages/desk/src/kit/layer.d.ts +159 -0
  159. package/dist/types/packages/desk/src/kit/light.d.ts +3 -0
  160. package/dist/types/packages/desk/src/kit/mesh.d.ts +29 -0
  161. package/dist/types/packages/desk/src/kit/mips.d.ts +2 -0
  162. package/dist/types/packages/desk/src/kit/nav.d.ts +2 -0
  163. package/dist/types/packages/desk/src/kit/paper-tex.d.ts +5 -0
  164. package/dist/types/packages/desk/src/kit/physics.d.ts +44 -0
  165. package/dist/types/packages/desk/src/kit/place.d.ts +44 -0
  166. package/dist/types/packages/desk/src/kit/print.d.ts +30 -0
  167. package/dist/types/packages/desk/src/kit/raster.d.ts +34 -0
  168. package/dist/types/packages/desk/src/kit/sdf.d.ts +1 -0
  169. package/dist/types/packages/desk/src/kit/seeds.d.ts +11 -0
  170. package/dist/types/packages/desk/src/kit/services.d.ts +34 -0
  171. package/dist/types/packages/desk/src/kit/springs.d.ts +12 -0
  172. package/dist/types/packages/desk/src/kit/strokes.d.ts +93 -0
  173. package/dist/types/packages/desk/src/kit/text.d.ts +142 -0
  174. package/dist/types/packages/desk/src/kit/uniform.d.ts +8 -0
  175. package/dist/types/packages/desk/src/kit/view.d.ts +39 -0
  176. package/dist/types/packages/desk/src/kit/wgsl.d.ts +15 -0
  177. package/dist/types/packages/desk/src/lattice/line.d.ts +15 -0
  178. package/dist/types/packages/desk/src/lattice/lod.d.ts +52 -0
  179. package/dist/types/packages/desk/src/lattice/ruler.d.ts +88 -0
  180. package/dist/types/packages/desk/src/marks/assemble.d.ts +65 -0
  181. package/dist/types/packages/desk/src/marks/ease.d.ts +4 -0
  182. package/dist/types/packages/desk/src/marks/laser.d.ts +41 -0
  183. package/dist/types/packages/desk/src/marks/layout.d.ts +167 -0
  184. package/dist/types/packages/desk/src/marks/pass.d.ts +59 -0
  185. package/dist/types/packages/desk/src/marks/shaders.d.ts +12 -0
  186. package/dist/types/packages/desk/src/mat/grid.d.ts +50 -0
  187. package/dist/types/packages/desk/src/mat/lamp.d.ts +14 -0
  188. package/dist/types/packages/desk/src/mat/layout.d.ts +144 -0
  189. package/dist/types/packages/desk/src/mat/mat-pass.d.ts +83 -0
  190. package/dist/types/packages/desk/src/mat/night.d.ts +95 -0
  191. package/dist/types/packages/desk/src/mat/projector.d.ts +39 -0
  192. package/dist/types/packages/desk/src/mat/shaders.d.ts +17 -0
  193. package/dist/types/packages/desk/src/mat/tilt.d.ts +14 -0
  194. package/dist/types/packages/desk/src/nav/flight.d.ts +186 -0
  195. package/dist/types/packages/desk/src/nav/portal.d.ts +95 -0
  196. package/dist/types/packages/desk/src/object.d.ts +46 -0
  197. package/dist/types/packages/desk/src/pass-instrument.d.ts +89 -0
  198. package/dist/types/packages/desk/src/shaders.d.ts +12 -0
  199. package/dist/types/packages/desk/src/shaders.gen.d.ts +16 -0
  200. package/dist/types/packages/desk/src/submit-instrument.d.ts +36 -0
  201. package/dist/types/packages/desk/src/theme.d.ts +475 -0
  202. package/dist/types/packages/desk/src/tray/carry.d.ts +99 -0
  203. package/dist/types/packages/desk/src/tray/drawer.d.ts +113 -0
  204. package/dist/types/packages/desk/src/tray/flux.d.ts +46 -0
  205. package/dist/types/packages/desk/src/tray/index.d.ts +4 -0
  206. package/dist/types/packages/desk/src/tray/lattice.d.ts +71 -0
  207. package/dist/types/packages/desk/src/tray/layout.d.ts +7 -0
  208. package/dist/types/packages/desk/src/tray/look.d.ts +29 -0
  209. package/dist/types/packages/desk/src/tray/pass.d.ts +96 -0
  210. package/dist/types/packages/desk/src/tray/shaders.d.ts +10 -0
  211. package/dist/types/packages/desk/src/tray/specimens.d.ts +199 -0
  212. package/dist/types/packages/devtools/src/attach.d.ts +22 -8
  213. package/dist/types/packages/devtools/src/dock.d.ts +18 -14
  214. package/dist/types/packages/devtools/src/gpu-panel.d.ts +105 -0
  215. package/dist/types/packages/devtools/src/index.d.ts +5 -4
  216. package/dist/types/packages/dom/src/desk-host.d.ts +91 -0
  217. package/dist/types/packages/dom/src/host.d.ts +13 -14
  218. package/dist/types/packages/dom/src/index.d.ts +12 -10
  219. package/dist/types/packages/dom/src/loop.d.ts +18 -1
  220. package/dist/types/packages/dom/src/pointer-adapter.d.ts +5 -29
  221. package/dist/types/packages/dom/src/widget-focus.d.ts +17 -13
  222. package/dist/types/packages/ice/src/desk-engine.d.ts +2 -0
  223. package/dist/types/packages/ice/src/desk-kit.d.ts +6 -0
  224. package/dist/types/packages/ice/src/desk-objects.d.ts +5 -0
  225. package/dist/types/packages/ice/src/desk.d.ts +5 -0
  226. package/dist/types/packages/kernel/src/atlas-pack.d.ts +157 -0
  227. package/dist/types/packages/kernel/src/bezier.d.ts +0 -15
  228. package/dist/types/packages/kernel/src/coords.d.ts +0 -39
  229. package/dist/types/packages/kernel/src/index.d.ts +2 -2
  230. package/dist/types/packages/kernel/src/nav-flight.d.ts +6 -0
  231. package/dist/types/packages/kernel/src/tray.d.ts +155 -0
  232. package/dist/types/packages/objects/src/board/board-pass.d.ts +180 -0
  233. package/dist/types/packages/objects/src/board/board-pen.d.ts +36 -0
  234. package/dist/types/packages/objects/src/board/board.d.ts +104 -0
  235. package/dist/types/packages/objects/src/board/data.d.ts +31 -0
  236. package/dist/types/packages/objects/src/board/history.d.ts +33 -0
  237. package/dist/types/packages/objects/src/board/kind.d.ts +208 -0
  238. package/dist/types/packages/objects/src/board/layout.d.ts +102 -0
  239. package/dist/types/packages/objects/src/board/object.d.ts +7 -0
  240. package/dist/types/packages/objects/src/board/pen.d.ts +71 -0
  241. package/dist/types/packages/objects/src/board/shaders.d.ts +36 -0
  242. package/dist/types/packages/objects/src/board/stroke.d.ts +99 -0
  243. package/dist/types/packages/objects/src/board/theme.d.ts +150 -0
  244. package/dist/types/packages/objects/src/calendar/data.d.ts +97 -0
  245. package/dist/types/packages/objects/src/calendar/events.d.ts +58 -0
  246. package/dist/types/packages/objects/src/calendar/hand.d.ts +53 -0
  247. package/dist/types/packages/objects/src/calendar/host/input.d.ts +67 -0
  248. package/dist/types/packages/objects/src/calendar/host/print.d.ts +9 -0
  249. package/dist/types/packages/objects/src/calendar/kind.d.ts +297 -0
  250. package/dist/types/packages/objects/src/calendar/law.d.ts +151 -0
  251. package/dist/types/packages/objects/src/calendar/layout.d.ts +47 -0
  252. package/dist/types/packages/objects/src/calendar/month.d.ts +75 -0
  253. package/dist/types/packages/objects/src/calendar/object.d.ts +45 -0
  254. package/dist/types/packages/objects/src/calendar/pad.d.ts +42 -0
  255. package/dist/types/packages/objects/src/calendar/pass.d.ts +229 -0
  256. package/dist/types/packages/objects/src/calendar/print.d.ts +87 -0
  257. package/dist/types/packages/objects/src/calendar/printing.d.ts +80 -0
  258. package/dist/types/packages/objects/src/calendar/roll.d.ts +45 -0
  259. package/dist/types/packages/objects/src/calendar/shaders.d.ts +12 -0
  260. package/dist/types/packages/objects/src/calendar/sheet.d.ts +43 -0
  261. package/dist/types/packages/objects/src/calendar/tiles.d.ts +67 -0
  262. package/dist/types/packages/objects/src/calendar/turn.d.ts +73 -0
  263. package/dist/types/packages/objects/src/calendar/writing.d.ts +42 -0
  264. package/dist/types/packages/objects/src/index.d.ts +22 -0
  265. package/dist/types/packages/objects/src/kinds.d.ts +24 -0
  266. package/dist/types/packages/objects/src/minimat/inside.d.ts +17 -0
  267. package/dist/types/packages/objects/src/minimat/kind.d.ts +51 -0
  268. package/dist/types/packages/objects/src/minimat/layout.d.ts +83 -0
  269. package/dist/types/packages/objects/src/minimat/minimat.d.ts +179 -0
  270. package/dist/types/packages/objects/src/minimat/object.d.ts +8 -0
  271. package/dist/types/packages/objects/src/minimat/pass.d.ts +61 -0
  272. package/dist/types/packages/objects/src/minimat/shaders.d.ts +10 -0
  273. package/dist/types/packages/objects/src/minimat/theme.d.ts +98 -0
  274. package/dist/types/packages/objects/src/notebook/ink.d.ts +70 -0
  275. package/dist/types/packages/objects/src/notebook/kind.d.ts +236 -0
  276. package/dist/types/packages/objects/src/notebook/law.d.ts +129 -0
  277. package/dist/types/packages/objects/src/notebook/layout.d.ts +46 -0
  278. package/dist/types/packages/objects/src/notebook/leaf.d.ts +44 -0
  279. package/dist/types/packages/objects/src/notebook/mesh.d.ts +20 -0
  280. package/dist/types/packages/objects/src/notebook/motion.d.ts +107 -0
  281. package/dist/types/packages/objects/src/notebook/object.d.ts +8 -0
  282. package/dist/types/packages/objects/src/notebook/pages.d.ts +56 -0
  283. package/dist/types/packages/objects/src/notebook/pass.d.ts +197 -0
  284. package/dist/types/packages/objects/src/notebook/pick.d.ts +30 -0
  285. package/dist/types/packages/objects/src/notebook/raster.d.ts +28 -0
  286. package/dist/types/packages/objects/src/notebook/shaders.d.ts +11 -0
  287. package/dist/types/packages/objects/src/notebook/shape.d.ts +155 -0
  288. package/dist/types/packages/objects/src/notebook/theme.d.ts +76 -0
  289. package/dist/types/packages/objects/src/palette.d.ts +577 -0
  290. package/dist/types/packages/objects/src/paper/host/body.d.ts +30 -0
  291. package/dist/types/packages/objects/src/paper/kind.d.ts +81 -0
  292. package/dist/types/packages/objects/src/paper/layout.d.ts +73 -0
  293. package/dist/types/packages/objects/src/paper/object.d.ts +31 -0
  294. package/dist/types/packages/objects/src/paper/pages.d.ts +43 -0
  295. package/dist/types/packages/objects/src/paper/paper-pass.d.ts +86 -0
  296. package/dist/types/packages/objects/src/paper/paper.d.ts +117 -0
  297. package/dist/types/packages/objects/src/paper/shaders.d.ts +18 -0
  298. package/dist/types/packages/objects/src/paper/theme.d.ts +58 -0
  299. package/dist/types/packages/objects/src/paper/typing.d.ts +51 -0
  300. package/dist/types/packages/objects/src/paper/writing.d.ts +161 -0
  301. package/dist/types/packages/objects/src/photo/carry.d.ts +33 -0
  302. package/dist/types/packages/objects/src/photo/kind.d.ts +136 -0
  303. package/dist/types/packages/objects/src/photo/layout.d.ts +39 -0
  304. package/dist/types/packages/objects/src/photo/object.d.ts +5 -0
  305. package/dist/types/packages/objects/src/photo/photo-pass.d.ts +104 -0
  306. package/dist/types/packages/objects/src/photo/photo.d.ts +262 -0
  307. package/dist/types/packages/objects/src/photo/pictures.d.ts +152 -0
  308. package/dist/types/packages/objects/src/photo/sample.d.ts +9 -0
  309. package/dist/types/packages/objects/src/photo/shaders.d.ts +18 -0
  310. package/dist/types/packages/objects/src/preset.d.ts +44 -0
  311. package/dist/types/packages/objects/src/shaders.d.ts +3 -0
  312. package/dist/types/packages/objects/src/shaders.gen.d.ts +21 -0
  313. package/dist/types/packages/react/src/canvas-hooks.d.ts +12 -0
  314. package/dist/types/packages/react/src/desk.d.ts +56 -0
  315. package/dist/types/packages/react/src/engine-context.d.ts +2 -2
  316. package/dist/types/packages/react/src/frame-preview-boundary.d.ts +19 -0
  317. package/dist/types/packages/react/src/hooks.d.ts +9 -14
  318. package/dist/types/packages/react/src/index.d.ts +16 -9
  319. package/dist/types/packages/react/src/keymap.d.ts +21 -2
  320. package/dist/types/packages/react/src/selection-menu.d.ts +171 -0
  321. package/dist/types/packages/react/src/tray-bar.d.ts +124 -0
  322. package/package.json +64 -31
  323. package/dist/chunk-5FQS7V2C.js.map +0 -1
  324. package/dist/chunk-JWRHAM7L.js +0 -1163
  325. package/dist/chunk-JWRHAM7L.js.map +0 -1
  326. package/dist/chunk-MFTMPJUF.js +0 -681
  327. package/dist/chunk-MFTMPJUF.js.map +0 -1
  328. package/dist/chunk-OR5FNVUE.js.map +0 -1
  329. package/dist/ground.js +0 -1213
  330. package/dist/ground.js.map +0 -1
  331. package/dist/r3f.js +0 -1644
  332. package/dist/r3f.js.map +0 -1
  333. package/dist/types/packages/core/src/input/measure-queue.d.ts +0 -30
  334. package/dist/types/packages/core/src/settings/ground-config.d.ts +0 -103
  335. package/dist/types/packages/core/src/systems/measure-ingest.d.ts +0 -26
  336. package/dist/types/packages/devtools/src/gl-panel.d.ts +0 -69
  337. package/dist/types/packages/dom/src/measure-adapter.d.ts +0 -31
  338. package/dist/types/packages/dom/src/measure-wiring.d.ts +0 -49
  339. package/dist/types/packages/dom/src/planes.d.ts +0 -33
  340. package/dist/types/packages/dom/src/reflectors/chrome.d.ts +0 -33
  341. package/dist/types/packages/dom/src/reflectors/dom-widgets.d.ts +0 -59
  342. package/dist/types/packages/dom/src/reflectors/graybox.d.ts +0 -31
  343. package/dist/types/packages/dom/src/reflectors/plane-transform.d.ts +0 -38
  344. package/dist/types/packages/ground/src/index.d.ts +0 -69
  345. package/dist/types/packages/ground/src/layer.d.ts +0 -40
  346. package/dist/types/packages/ground/src/pass.d.ts +0 -41
  347. package/dist/types/packages/ground/src/passes/grid-classic.d.ts +0 -30
  348. package/dist/types/packages/ground/src/passes/grid-magnet.d.ts +0 -31
  349. package/dist/types/packages/ground/src/passes/grid.d.ts +0 -28
  350. package/dist/types/packages/ground/src/passes/guides-collect.d.ts +0 -14
  351. package/dist/types/packages/ground/src/passes/guides.d.ts +0 -3
  352. package/dist/types/packages/ground/src/passes/magnet-collect.d.ts +0 -63
  353. package/dist/types/packages/ground/src/passes/soup-collect.d.ts +0 -35
  354. package/dist/types/packages/ground/src/passes/soup-mesh.d.ts +0 -8
  355. package/dist/types/packages/ground/src/passes/wires-collect.d.ts +0 -35
  356. package/dist/types/packages/ground/src/passes/wires.d.ts +0 -10
  357. package/dist/types/packages/ground/src/poles.d.ts +0 -47
  358. package/dist/types/packages/ground/src/renderer.d.ts +0 -15
  359. package/dist/types/packages/ice/src/ground.d.ts +0 -1
  360. package/dist/types/packages/ice/src/r3f.d.ts +0 -1
  361. package/dist/types/packages/kernel/src/eviction.d.ts +0 -23
  362. package/dist/types/packages/kernel/src/zoom-bands.d.ts +0 -19
  363. package/dist/types/packages/r3f/src/bridge.d.ts +0 -129
  364. package/dist/types/packages/r3f/src/composite-material.d.ts +0 -26
  365. package/dist/types/packages/r3f/src/compositor-pass.d.ts +0 -105
  366. package/dist/types/packages/r3f/src/dev-write-trap.d.ts +0 -30
  367. package/dist/types/packages/r3f/src/gl-root.d.ts +0 -96
  368. package/dist/types/packages/r3f/src/gl-router.d.ts +0 -70
  369. package/dist/types/packages/r3f/src/index.d.ts +0 -17
  370. package/dist/types/packages/r3f/src/island-state.d.ts +0 -112
  371. package/dist/types/packages/r3f/src/island.d.ts +0 -13
  372. package/dist/types/packages/r3f/src/pool.d.ts +0 -56
  373. package/dist/types/packages/r3f/src/preview-capture.d.ts +0 -19
  374. package/dist/types/packages/r3f/src/resource-registry.d.ts +0 -30
  375. package/dist/types/packages/r3f/src/self-sustain.d.ts +0 -39
  376. package/dist/types/packages/r3f/src/use-island-frame.d.ts +0 -39
  377. package/dist/types/packages/react/src/infinite-canvas.d.ts +0 -140
  378. package/dist/types/packages/react/src/preview-snapshots.d.ts +0 -17
  379. package/dist/types/packages/react/src/widget-preview.d.ts +0 -14
  380. package/dist/types/packages/react/src/widget-root.d.ts +0 -33
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../react/src/hooks.ts","../../react/src/widget-root.tsx","../../react/src/engine-context.tsx","../../react/src/use-commit.ts","../../react/src/preview-snapshots.ts","../../react/src/widget-preview.tsx","../../react/src/use-tool.ts","../../react/src/use-presence.ts","../../react/src/keymap.ts","../../react/src/infinite-canvas.tsx","../../react/src/index.ts"],"sourcesContent":["/**\n * React hooks over the engine's Tier-3 reactivity (design-005 §2 hooks;\n * design-004 §2 frozen-hidden rule).\n *\n * Implemented directly on `world.reactive.observeValue` + `useSyncExternalStore`\n * rather than strata's own react module: core is react-free by law, so\n * strata/react cannot be re-exported through it — and the adapter is ~20\n * lines. Value semantics are strata Tier-3: equality-suppressed, fired at\n * notify(), never during the tick.\n *\n * FROZEN-HIDDEN: a widget inside a hidden (culled-but-kept-mounted) host must\n * not re-render on doc edits — `useWidgetProps` reads {@link WidgetHiddenContext}\n * (provided per-portal by WidgetRoot) and suspends its subscription while\n * hidden, serving the last snapshot; on show it resubscribes and refreshes.\n */\nimport {\n Selected,\n WidgetBreakpoint,\n defineQuery,\n widgets,\n type AnyBehaviorDef,\n type Component,\n type Entity,\n type World,\n} from \"@ice/core\";\nimport { createContext, useCallback, useContext, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n/** Per-portal hidden flag (WidgetRoot provides it; defaults to live). */\nexport const WidgetHiddenContext = createContext(false);\n\nconst selectedQ = defineQuery([Selected]);\n\n/** Shallow field equality — strata cells are flat field records. */\nfunction shallowEq(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false;\n const ka = Object.keys(a);\n const kb = Object.keys(b);\n if (ka.length !== kb.length) return false;\n for (const k of ka) {\n if (!Object.is((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])) return false;\n }\n return true;\n}\n\n/**\n * Tier-3 component value subscription (equality-suppressed). Snapshot\n * STABILITY is load-bearing: strata's `get()` materializes a fresh object per\n * read (SoA columns), and `useSyncExternalStore` treats a new reference as a\n * new snapshot — so reads go through a shallow-equality cache and only a real\n * field change yields a new reference.\n */\nexport function useWorldComponent<S>(world: World, entity: Entity, component: Component<S>): S | undefined {\n const hidden = useContext(WidgetHiddenContext);\n const last = useRef<S | undefined>(undefined);\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (hidden) return () => {}; // frozen while hidden — no wakeups, no renders\n return world.reactive.observeValue(entity, component, onChange);\n },\n [world, entity, component, hidden],\n );\n const getSnapshot = useCallback(() => {\n if (hidden) return last.current; // stable snapshot while frozen\n const v = world.isAlive(entity) ? world.get(entity, component) : undefined;\n if (!shallowEq(v, last.current)) last.current = v;\n return last.current;\n }, [world, entity, component, hidden]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/**\n * Typed props for one conflict group of a widget (design-005 §2). Group\n * component values come back whole; `p.json` fields are parsed. Identity is\n * stable per underlying group value (memo on the raw reference).\n */\nexport function useWidgetProps<T extends Record<string, unknown>>(\n world: World,\n entity: Entity,\n type: string,\n group = \"props\",\n): T | undefined {\n const widget = widgets.get(type);\n const g = widget?.groups.find((x) => x.name === group);\n if (widget === undefined || g === undefined) {\n throw new Error(`ice: useWidgetProps — unknown widget type/group \"${type}\"/\"${group}\".`);\n }\n const raw = useWorldComponent(world, entity, g.component) as Record<string, unknown> | undefined;\n return useMemo(() => {\n if (raw === undefined) return undefined;\n const out: Record<string, unknown> = {};\n for (const [name, spec] of Object.entries(g.fields)) {\n const v = raw[name];\n out[name] = spec.kind === \"json\" && typeof v === \"string\" ? parseJsonCell(v, spec.default) : v;\n }\n return out as T;\n }, [raw, g]);\n}\n\n/**\n * Live behavior data for one entity (design-009 §6, Tier-3 — the\n * `useWidgetProps` pattern). `p.json` fields come back parsed; the value is\n * `undefined` when the behavior is not attached, which is a legitimate render\n * state and not an error.\n *\n * READ-ONLY by construction. A face renders behavior state; it never writes it\n * (Law 10) — writes go through `ctx` inside the behavior's own hooks, or\n * through `engine.behaviors.attach` / a transaction from an app handler.\n */\nexport function useBehavior<T extends Record<string, unknown>>(\n world: World,\n entity: Entity,\n behavior: AnyBehaviorDef,\n): T | undefined {\n const raw = useWorldComponent(world, entity, behavior.component as Component) as\n | Record<string, unknown>\n | undefined;\n return useMemo(() => {\n if (raw === undefined) return undefined;\n const out: Record<string, unknown> = {};\n for (const [name, spec] of Object.entries(behavior.schema)) {\n const v = raw[name];\n out[name] = spec.kind === \"json\" && typeof v === \"string\" ? parseJsonCell(v, spec.default) : v;\n }\n return out as T;\n }, [raw, behavior]);\n}\n\n/**\n * A json cell is one CRDT string a remote peer may have written malformed —\n * decoding must never throw mid-render (2026-07-13 review). Fall back to the\n * spec's serialized default (engine-derived, always valid JSON), then null.\n */\nfunction parseJsonCell(cell: string, serializedDefault: string | undefined): unknown {\n try {\n return JSON.parse(cell);\n } catch {\n try {\n return JSON.parse(serializedDefault ?? \"null\");\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Selection membership (Tier-1 wake on Selected churn; O(1) snapshot).\n * Frozen-hidden like every widget hook: a selection change must not re-render\n * 256 hidden trees (review finding — design-004 §2 applies to ALL hooks).\n */\nexport function useSelected(world: World, entity: Entity): boolean {\n const hidden = useContext(WidgetHiddenContext);\n const last = useRef(false);\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (hidden) return () => {};\n return world.reactive.observeQuery(selectedQ, onChange);\n },\n [world, hidden],\n );\n const getSnapshot = useCallback(() => {\n if (hidden) return last.current;\n last.current = world.isAlive(entity) && world.hasTag(entity, Selected);\n return last.current;\n }, [world, entity, hidden]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/** LOD tier (design-004 §8); \"normal\" until the breakpoint system stamps one. */\nexport function useBreakpoint(world: World, entity: Entity): string {\n const bp = useWorldComponent(world, entity, WidgetBreakpoint);\n return (bp as { tier?: string } | undefined)?.tier ?? \"normal\";\n}\n","/**\n * WidgetRoot — portals from ONE app root (design-004 §2).\n *\n * Portal-list membership (mount/unmount/evict) is owned HERE, by React,\n * subscribed to the engine's mount store via `useSyncExternalStore`; the\n * imperative dom-widgets reflector owns only the host DIVs. Eviction is\n * decided engine-side (LRU derive) and merely consumed. Each mounted entry\n * portals its widget type's component (from the defineWidget registry) into\n * the host's content element; hidden entries stay mounted (React state\n * preserved — cull ≠ unmount) inside a `WidgetHiddenContext` so their prop\n * subscriptions freeze (design-004 §2).\n *\n * A host div may not exist yet on the very first snapshot after mount (the\n * host reflector runs in the same post-notify pass, ordered by reflector\n * registration) — entries without a host render nothing this pass and pick\n * up on the next notification.\n */\nimport { PrefabId, widgets, type Entity, type World, type WidgetMountStore } from \"@ice/core\";\nimport { createElement, type ComponentType, type ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useSyncExternalStore } from \"react\";\nimport { WidgetHiddenContext } from \"./hooks\";\n\nexport interface WidgetHosts {\n /** The dom-widgets reflector's lookup (content element per entity). */\n hostFor(entity: Entity): HTMLElement | undefined;\n}\n\nexport interface WidgetRootProps {\n readonly world: World;\n readonly store: WidgetMountStore;\n readonly hosts: WidgetHosts;\n}\n\nexport interface WidgetComponentProps {\n readonly entity: Entity;\n readonly world: World;\n}\n\nexport function WidgetRoot({ world, store, hosts }: WidgetRootProps): ReactElement {\n const entries = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);\n\n const portals: ReactElement[] = [];\n for (const entry of entries) {\n if (!world.isAlive(entry.entity)) continue;\n const type = world.get(entry.entity, PrefabId)?.id;\n const widget = typeof type === \"string\" ? widgets.get(type) : undefined;\n if (widget === undefined) continue;\n // dom widgets portal their component; gl widgets portal their optional\n // DOM CHROME — the host div lives in the content plane (P1), which stacks\n // UNDER the GL canvas (P2), so the card body renders beneath the island's\n // 3D content (v1's CardChrome sandwich — shared CSS with DOM cards).\n const view = widget.surface === \"dom\" ? widget.component : widget.chrome;\n if (view == null) continue;\n const target = hosts.hostFor(entry.entity);\n if (target === undefined) continue; // host lands next pass\n const View = view as ComponentType<WidgetComponentProps>;\n portals.push(\n createPortal(\n createElement(\n WidgetHiddenContext.Provider,\n { value: entry.hidden },\n createElement(View, { entity: entry.entity, world }),\n ),\n target,\n String(entry.entity),\n ),\n );\n }\n return createElement(\"div\", { \"data-ice-widget-root\": \"\" }, portals);\n}\n","/**\n * `<EngineProvider>` + engine access hooks (design-005 §5; the M6 field\n * amendment 2026-07-10 gap — grep \"useCommit\" in design-005).\n *\n * The whole React surface reaches the running canvas through ONE context\n * carrying the {@link CanvasEngine} facade (world + engine + stack + runtime +\n * ops + docs). Widgets never hand-roll store plumbing again: {@link useOps}\n * gives the engine-owned write paths, {@link useCommit} (its own module) the\n * sanctioned durable commit seam, and {@link useWorld} the read/observe escape\n * hatch. `<InfiniteCanvas>` provides this automatically; apps that mount\n * WidgetRoot themselves wrap it in `<EngineProvider>`.\n */\nimport { devGuardsEnabled, type CanvasEngine, type CanvasOps, type World } from \"@ice/core\";\nimport { createContext, useContext, useEffect, type ReactElement, type ReactNode } from \"react\";\n\nconst EngineContext = createContext<CanvasEngine | null>(null);\n\nexport interface EngineProviderProps {\n readonly engine: CanvasEngine;\n readonly children?: ReactNode;\n}\n\n/** Publish the canvas engine to the React subtree (WidgetRoot + userland hooks). */\nexport function EngineProvider({ engine, children }: EngineProviderProps): ReactElement {\n return <EngineContext.Provider value={engine}>{children}</EngineContext.Provider>;\n}\n\n/** The canvas engine for this subtree; throws with guidance outside a provider. */\nexport function useCanvasEngine(): CanvasEngine {\n const engine = useContext(EngineContext);\n if (engine === null) {\n throw new Error(\n \"ice: useCanvasEngine — no <EngineProvider>. Render widgets inside <InfiniteCanvas> (which provides it) or wrap your tree in <EngineProvider engine={...}>.\",\n );\n }\n return engine;\n}\n\n/** The engine-owned write paths (design-005 §4): setTool, deleteSelection, etc. */\nexport function useOps(): CanvasOps {\n return useCanvasEngine().ops;\n}\n\n/**\n * Take a stage background hold while `active` (ce.stage, 2026-07-19): the\n * overlay-lifecycle sugar — the disposer releases on deactivate AND unmount,\n * so a crashed/unmounted overlay can never wedge the canvas backgrounded.\n * `engine` is an explicit param (not context): overlays typically render as\n * SIBLINGS of <InfiniteCanvas>, outside the provider.\n */\nexport function useStageHold(engine: CanvasEngine, active: boolean, name: string): void {\n useEffect(() => {\n if (!active) return undefined;\n return engine.stage.background(name);\n }, [engine, active, name]);\n}\n\n/**\n * Freeze the engine while `active` (ce.frame, 2026-08-04) — {@link useStageHold}'s\n * stricter sibling, same lifecycle sugar: the effect cleanup IS the thaw, so an\n * overlay that unmounts (or crashes) can never wedge the engine parked.\n *\n * WHICH ONE. A stage hold quiets discretionary rendering over a world that\n * keeps stepping — right for chrome that RECEDES the canvas, where undo,\n * collab and tweens must still land visibly behind a partial overlay. A freeze\n * stops the loop outright — right for chrome that COVERS the canvas, where\n * every frame behind it is work nobody can see. Reaching for a freeze under a\n * partial overlay will look broken: the canvas is a photograph until thaw.\n */\nexport function useFrameFreeze(engine: CanvasEngine, active: boolean, name: string): void {\n useEffect(() => {\n if (!active) return undefined;\n return engine.frame.freeze(name);\n }, [engine, active, name]);\n}\n\nlet warnedUseWorld = false;\n\n/**\n * Escape hatch — the raw {@link World} for READS and Tier-3 OBSERVATION only.\n * Mutation goes through {@link useOps}/{@link useCommit} (a gesture-claimed,\n * one-tx-per-gesture durable write; direct world writes bypass sovereignty and\n * the guards). DEV-warns once on first use.\n */\nexport function useWorld(): World {\n const engine = useCanvasEngine();\n if (devGuardsEnabled() && !warnedUseWorld) {\n warnedUseWorld = true;\n console.warn(\n \"ice: useWorld() is a READ/OBSERVE escape hatch — never write to the world directly. Use useOps()/useCommit() for mutation (design-005 §5).\",\n );\n }\n return engine.world;\n}\n","/**\n * `useCommit` + `useUndoStatus` — the sanctioned widget durable-write path and\n * the undo/redo status subscription (design-005 §2 M6 field amendment,\n * 2026-07-10: \"widgets also need a SANCTIONED commit path\").\n *\n * A widget commits a prop edit through {@link useCommit}: it resolves the\n * CURRENT doc session (`engine.docs.current()`) and runs a\n * {@link guardedTransaction} against that session's store — one transaction per\n * call, eligibility-guarded, absolute writes only. The session is resolved at\n * CALL time (not hook time) so a widget rendered doc-less that gains a doc later\n * commits correctly without re-mounting.\n */\nimport { DurableUndoStatus, guardedTransaction, type GuardedTx, type GuardedTxOpts } from \"@ice/core\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\nimport { useCanvasEngine } from \"./engine-context\";\n\n/** A durable commit: run `fn` against the current doc session's store, one tx. */\nexport type Commit = (fn: (tx: GuardedTx) => void, opts?: GuardedTxOpts) => void;\n\n/**\n * The widget commit seam. The returned function throws with guidance when no\n * document is attached (commits need a durable store — call\n * `engine.docs.create()/open()/join()` first).\n */\nexport function useCommit(): Commit {\n const engine = useCanvasEngine();\n return useCallback(\n (fn, opts) => {\n const session = engine.docs.current();\n if (session === undefined) {\n throw new Error(\n \"ice: useCommit — no active document. Attach one with engine.docs.create()/open()/join() before committing widget edits.\",\n );\n }\n if (session.readOnly) {\n // The version gate said read-only: a raw store write here would edit —\n // and broadcast — a document the gate refused (2026-07-13 review).\n throw new Error(\"ice: useCommit — the document is read-only (version gate); widget edits are disabled.\");\n }\n guardedTransaction(session.store, engine.world, fn, opts);\n },\n [engine],\n );\n}\n\nexport interface UndoStatus {\n readonly canUndo: boolean;\n readonly canRedo: boolean;\n}\n\nconst NO_UNDO: UndoStatus = { canUndo: false, canRedo: false };\n\n/**\n * Undo/redo availability for the current document (drives toolbar\n * disablement) — the design-005 §5 path: the `DurableUndoStatus` RESOURCE\n * (strata plan-undo U2, re-exported through @ice/core) via\n * `observeResource`. A resource subscription is WORLD-level, so it survives\n * document swaps — no remount needed, the earlier onHistoryChange-per-store\n * caveat is gone. Fires at notify(), equality-suppressed; snapshot identity\n * is stable while the flags are unchanged.\n */\nexport function useUndoStatus(): UndoStatus {\n const engine = useCanvasEngine();\n const last = useRef<UndoStatus>(NO_UNDO);\n const subscribe = useCallback(\n (onChange: () => void) => engine.world.reactive.observeResource(DurableUndoStatus, onChange),\n [engine],\n );\n const getSnapshot = useCallback(() => {\n const status = engine.world.getResource(DurableUndoStatus);\n const canUndo = status?.canUndo ?? false;\n const canRedo = status?.canRedo ?? false;\n if (last.current.canUndo !== canUndo || last.current.canRedo !== canRedo) {\n last.current = { canUndo, canRedo };\n }\n return last.current;\n }, [engine]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","/**\n * The GL preview snapshot store (design-005 §2 preview contract, P2 —\n * 2026-07-19). react stays three-free by LAW, so the capture pipeline lives\n * in @ice/r3f and meets `<WidgetPreview>` HERE, at a dumb data seam: a\n * module-level map of widget type → captured image, with subscription so an\n * open palette re-renders the moment a capture lands.\n *\n * `PreviewImage` accepts a canvas alongside ImageBitmap so tests (and any\n * app-side prebuilt-cache policy — the P3 seam) can inject without a GPU.\n */\nexport type PreviewImage = ImageBitmap | HTMLCanvasElement;\n\nconst images = new Map<string, PreviewImage>();\nconst listeners = new Set<() => void>();\n\nexport function setPreviewSnapshot(type: string, image: PreviewImage): void {\n images.set(type, image);\n for (const l of listeners) l();\n}\n\nexport function getPreviewSnapshot(type: string): PreviewImage | undefined {\n return images.get(type);\n}\n\nexport function hasPreviewSnapshot(type: string): boolean {\n return images.has(type);\n}\n\nexport function subscribePreviewSnapshots(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n/** TEST-ONLY wipe (not on the barrel). */\nexport function __resetPreviewSnapshotsForTests(): void {\n images.clear();\n}\n","/**\n * `<WidgetPreview>` — the framework answer to \"give me the preview for type\n * X\" (design-005 §2 amendment, 2026-07-19). Palettes/trays stay app chrome\n * (design-004); THIS is the seam they consume, owning the whole fallback\n * chain so every app and every `defineWidget` author gets the same behavior:\n *\n * 1. the def's DECLARED preview (engine-free by contract — no world, no\n * entity, no ops; authored at `defaultSize`, scaled here);\n * 2. dom surfaces with no declaration: the REAL component with default (or\n * `preview.props`-curated) props, mounted against the framework's\n * internal preview sandbox — truthful by construction;\n * 3. the `fallback` prop (the app's silhouette), else a neutral placeholder.\n *\n * Every branch renders INERT (`inert` + pointer-events none) inside an error\n * boundary — a broken preview degrades to the fallback, it never kills the\n * palette. GL surfaces without a declared preview go straight to fallback in\n * P1 (the r3f snapshot pipeline is P2; a DOM mockup declaration is the\n * sanctioned escape hatch meanwhile).\n *\n * The sandbox: one lazy module-level engine (own in-memory doc, no adapters,\n * never stepped past two settle ticks) spawning ONE entity per previewed\n * type ON DEMAND. Preview entities never receive Selected/Grab/overlap tags,\n * so chrome renders permanently at rest — \"static\" is a property of the\n * sandbox, not a discipline widget authors must follow.\n */\nimport {\n createCanvasEngine,\n widgets,\n type CanvasEngine,\n type Entity,\n type WidgetType,\n type World,\n} from \"@ice/core\";\nimport {\n Component,\n useEffect,\n useRef,\n useSyncExternalStore,\n type ComponentType,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { EngineProvider } from \"./engine-context\";\nimport { getPreviewSnapshot, subscribePreviewSnapshots, type PreviewImage } from \"./preview-snapshots\";\n\n// --- the preview sandbox -----------------------------------------------------\n\ninterface PreviewSandbox {\n readonly ce: CanvasEngine;\n readonly entities: Map<string, Entity>;\n}\n\nlet sandbox: PreviewSandbox | null = null;\n\nfunction ensurePreviewEntity(def: WidgetType): Entity | undefined {\n if (sandbox === null) {\n const ce = createCanvasEngine();\n ce.docs.create();\n ce.world.sync();\n ce.step(16);\n sandbox = { ce, entities: new Map() };\n }\n const existing = sandbox.entities.get(def.type);\n if (existing !== undefined) return existing;\n try {\n const e = sandbox.ce.ops.spawnWidget(def.type, {\n x: 0,\n y: 0,\n undoable: false,\n ...(def.previewProps !== undefined ? { props: def.previewProps } : {}),\n });\n sandbox.ce.world.sync();\n sandbox.ce.step(32); // settle tick: equip stamps land before first render\n sandbox.entities.set(def.type, e);\n return e;\n } catch (err) {\n console.warn(`ice: WidgetPreview(\"${def.type}\") sandbox spawn failed — falling back.`, err);\n return undefined;\n }\n}\n\n/** TEST-ONLY sandbox wipe (mirrors __resetWidgetsForTests; not on the barrel). */\nexport function __resetPreviewSandboxForTests(): void {\n sandbox?.ce.dispose();\n sandbox = null;\n}\n\n// --- error containment ---------------------------------------------------------\n\nclass PreviewBoundary extends Component<{ fallback: ReactNode; children: ReactNode }, { failed: boolean }> {\n override state = { failed: false };\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n override componentDidCatch(error: unknown): void {\n console.warn(\"ice: a widget preview threw while rendering — showing the fallback.\", error);\n }\n override render(): ReactNode {\n return this.state.failed ? this.props.fallback : this.props.children;\n }\n}\n\n// --- the host ------------------------------------------------------------------\n\nexport interface WidgetPreviewProps {\n readonly type: string;\n /** The available box; the preview renders aspect-FITTED inside it. */\n readonly width: number;\n readonly height: number;\n /** App silhouette shown when no preview path applies (or one throws). */\n readonly fallback?: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\n/** Draws a captured snapshot (P2 pipeline / injected cache) at natural size. */\nfunction SnapshotLayer({ image }: { image: PreviewImage }): ReactElement {\n const ref = useRef<HTMLCanvasElement>(null);\n useEffect(() => {\n const canvas = ref.current;\n if (canvas === null) return;\n canvas.width = image.width;\n canvas.height = image.height;\n try {\n canvas.getContext(\"2d\")?.drawImage(image, 0, 0);\n } catch {\n // a torn-down ImageBitmap or a contextless test DOM — the layer stays blank\n }\n }, [image]);\n return (\n <canvas\n ref={ref}\n data-preview-snapshot=\"\"\n style={{ position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\" }}\n />\n );\n}\n\nfunction defaultPlaceholder(label: string): ReactElement {\n return (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n borderRadius: 12,\n background: \"rgba(127, 127, 127, 0.12)\",\n boxShadow: \"inset 0 0 0 1px rgba(127, 127, 127, 0.25)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: 11,\n color: \"rgba(127, 127, 127, 0.8)\",\n overflow: \"hidden\",\n }}\n >\n {label}\n </div>\n );\n}\n\nexport function WidgetPreview({ type, width, height, fallback, className, style }: WidgetPreviewProps): ReactElement {\n // Subscribed BEFORE any early return (hook order): an open palette\n // re-renders the moment the P2 capture pipeline lands this type's snapshot.\n const snapshot = useSyncExternalStore(subscribePreviewSnapshots, () => getPreviewSnapshot(type));\n const def = widgets.get(type);\n const safeFallback = fallback ?? defaultPlaceholder(type);\n if (def === undefined || def.defaultSize.w <= 0 || def.defaultSize.h <= 0) {\n return (\n <div className={className} style={{ width, height, ...style }}>\n {safeFallback}\n </div>\n );\n }\n\n const s = Math.min(width / def.defaultSize.w, height / def.defaultSize.h);\n const fitW = def.defaultSize.w * s;\n const fitH = def.defaultSize.h * s;\n\n // The inert, natural-size stage every preview branch renders on: authors\n // (and the real component) write at defaultSize; the host scales.\n const stage = (content: ReactNode): ReactElement => (\n <div className={className} style={{ width: fitW, height: fitH, overflow: \"hidden\", ...style }}>\n <div\n inert\n style={{\n width: def.defaultSize.w,\n height: def.defaultSize.h,\n transform: `scale(${s})`,\n transformOrigin: \"0 0\",\n pointerEvents: \"none\",\n userSelect: \"none\",\n }}\n >\n <PreviewBoundary fallback={safeFallback}>{content}</PreviewBoundary>\n </div>\n </div>\n );\n\n // 1. Author-declared preview: engine-free by contract — rendered bare.\n if (def.previewComponent !== null && def.previewComponent !== undefined) {\n const Declared = def.previewComponent as ComponentType;\n return stage(<Declared />);\n }\n\n // 2. gl surface with a captured snapshot (the P2 pipeline / an injected\n // cache): the widget's DOM chrome (if any) renders UNDERNEATH via the\n // sandbox — the live card's chrome-beneath-canvas sandwich, reproduced —\n // and the transparent 3D capture layers on top. ONE capture serves both\n // themes: the 3D content is theme-independent; theme lives in the chrome's\n // CSS.\n if (def.surface === \"gl\" && snapshot !== undefined) {\n let chromeLayer: ReactNode = null;\n if (def.chrome !== null && def.chrome !== undefined) {\n const entity = ensurePreviewEntity(def);\n if (entity !== undefined && sandbox !== null) {\n const Chrome = def.chrome as ComponentType<{ entity: Entity; world: World }>;\n chromeLayer = (\n <EngineProvider engine={sandbox.ce}>\n <div style={{ position: \"absolute\", inset: 0 }}>\n <Chrome entity={entity} world={sandbox.ce.world} />\n </div>\n </EngineProvider>\n );\n }\n }\n return stage(\n <div style={{ position: \"relative\", width: \"100%\", height: \"100%\" }}>\n {chromeLayer}\n <SnapshotLayer image={snapshot} />\n </div>,\n );\n }\n\n // 3. dom surface: the real component + default/curated props in the sandbox.\n if (def.surface === \"dom\" && def.component !== null && def.component !== undefined) {\n const entity = ensurePreviewEntity(def);\n if (entity !== undefined && sandbox !== null) {\n const View = def.component as ComponentType<{ entity: Entity; world: World }>;\n return stage(\n <EngineProvider engine={sandbox.ce}>\n <View entity={entity} world={sandbox.ce.world} />\n </EngineProvider>,\n );\n }\n }\n\n // 4. No path (gl before its capture lands, broken spawn): the fallback.\n return (\n <div className={className} style={{ width: fitW, height: fitH, ...style }}>\n {safeFallback}\n </div>\n );\n}\n","/**\n * `useTool` + `useToolState` — the active-tool subscription (design-005 §5).\n *\n * The active tool is the `ActiveTool` runtime resource (design-005 §4). Reads go\n * through strata's Tier-3 `observeResource` (fires only when the id actually\n * changes, at notify()); the setter is `ops.setTool`, which cancels active\n * gestures before the switch (the strata-example lesson, design-003 §8) — never\n * a raw resource write. The snapshot is a primitive string, so identity is\n * inherently stable.\n */\nimport { ActiveTool } from \"@ice/core\";\nimport { useCallback, useSyncExternalStore } from \"react\";\nimport { useCanvasEngine } from \"./engine-context\";\n\n/** `[activeToolId, setTool]`. `setTool` routes through `ops.setTool`. */\nexport function useTool(): [string, (id: string) => void] {\n const engine = useCanvasEngine();\n const subscribe = useCallback(\n (onChange: () => void) => engine.world.reactive.observeResource(ActiveTool, onChange),\n [engine],\n );\n const getSnapshot = useCallback(() => engine.world.getResource(ActiveTool)?.id ?? \"select\", [engine]);\n const active = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n const setTool = useCallback((id: string) => engine.ops.setTool(id), [engine]);\n return [active, setTool];\n}\n\n/** Sugar: is tool `id` the active one? (toolbar button pressed-state). */\nexport function useToolState(id: string): boolean {\n const [active] = useTool();\n return active === id;\n}\n","/**\n * `usePresencePeers` — the remote-collaborator roster (design-005 §5:\n * \"Not(Local) presence query\").\n *\n * Queries `PresencePeer` entities that are NOT `Local` (the local peer carries\n * `Local`, auto-applied by the ephemeral store and never transmitted) and pairs\n * each with its `PresenceInfo` (name/color). Wakes on Tier-1 query membership\n * churn (`observeQuery`) — peers joining/leaving. The snapshot is\n * MEMBERSHIP-KEYED: identity stays stable across unrelated re-renders, and info\n * is sampled when membership changes (steady-state presence info is set once at\n * join; a mid-session rename reflects on the next membership change).\n */\nimport { Local, Not, PresenceInfo, PresencePeer, defineQuery, type Entity } from \"@ice/core\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\nimport { useCanvasEngine } from \"./engine-context\";\n\nconst remotePeersQ = defineQuery([PresencePeer, Not(Local)]);\n\nexport interface PresencePeerView {\n readonly entity: Entity;\n /** The peer's `PresenceInfo` (strata \"string\" fields are nullable until set). */\n readonly info: { readonly name: string | null; readonly color: string | null } | undefined;\n}\n\n/** Remote presence peers (excludes the local peer); stable identity by membership. */\nexport function usePresencePeers(): readonly PresencePeerView[] {\n const engine = useCanvasEngine();\n const cache = useRef<{ key: string; value: readonly PresencePeerView[] }>({ key: \"\u0000\", value: [] });\n const subscribe = useCallback(\n (onChange: () => void) => engine.world.reactive.observeQuery(remotePeersQ, onChange),\n [engine],\n );\n const getSnapshot = useCallback(() => {\n const world = engine.world;\n const ids: Entity[] = [];\n world.query(remotePeersQ).each((b) => {\n for (const r of b) ids.push(b.entity(r));\n });\n const key = ids.join(\",\");\n if (key !== cache.current.key) {\n cache.current = {\n key,\n value: ids.map((entity) => ({ entity, info: world.get(entity, PresenceInfo) })),\n };\n }\n return cache.current.value;\n }, [engine]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","/**\n * The default keymap (design-005 §4 \"Keymap\"; design-003 §2 — NO system-side\n * keyboard logic, every entry resolves to an `ops.*`/`docs.*` call).\n *\n * Locked defaults:\n * ⌫/Delete → ops.deleteSelection\n * ⌘Z / Ctrl-Z → docs.undo\n * ⇧⌘Z / ⇧Ctrl-Z → docs.redo\n * ⌘D → ops.duplicateSelection\n * ⌘A → ops.selectAll\n * Esc → ops.cancelActiveGestures\n * Arrows → nudge the selection ±1px (⇧ = ±10px) — ONE tx per press\n * tool shortcuts → ops.setTool (v/h/c + any registered tool's shortcut)\n *\n * Space-hold pan is ALREADY owned by the pointer adapter (design-003 §2) — it is\n * NOT rebound here. `mod` = ⌘ on macOS, Ctrl elsewhere (metaKey || ctrlKey).\n *\n * The widget input contract (design-007, petition I1) — three gates, in order:\n * 1. `event.defaultPrevented` → the widget's own handler consumed the key\n * (\"preventDefault = handled by content\"); the engine never competes.\n * 2. The `data-canvas-keyboard` claim marker on the event-target chain (the\n * keydown target IS `document.activeElement` — browser focus is the one\n * page-global truth, so two engines on one page stand down together) →\n * EVERY entry cedes except Escape, the engine-reserved release gesture:\n * Escape blurs the claim (the NEXT press, with focus gone, falls through\n * to cancelActiveGestures). A widget that declared `keyboardEscape:\n * \"widget\"` receives even Escape — release is click-away or blurFocus().\n * This gate runs BEFORE the editable gate on purpose (2026-08-09 review):\n * a claim whose focus node is an editable proxy (the Ghosttea-style\n * hidden textarea, design-007 §6) must still get the Escape release —\n * editable-first would shadow it and silently turn every such widget\n * into `keyboardEscape: \"widget\"`.\n * 3. Editable target (input/textarea/select/contentEditable — the shared\n * 4-class predicate from @ice/dom) → ignored, so typing never triggers a\n * shortcut. Kept narrow so UNDECLARED widgets behave exactly as before.\n *\n * Overrides replace a default by its key-signature `key|mod|shift`; a signature\n * with no default is added. A matched entry `preventDefault()`s (the target was\n * already filtered to non-editable, so no typing is swallowed). An override on\n * Space warns at attach: the pointer adapter owns Space (the pan modifier,\n * design-003 §4.4) and preventDefaults it before gate 1 can let it through.\n */\nimport { Position, guardedTransaction, selectedEntities, tools, type CanvasEngine } from \"@ice/core\";\nimport { isEditableTarget, keyboardClaimOf } from \"@ice/dom\";\n\nexport interface KeymapEntry {\n /** `event.key` to match (case-insensitive; e.g. \"z\", \"Backspace\", \"ArrowUp\"). */\n readonly key: string;\n /** Require ⌘/Ctrl (default false → must NOT be held). */\n readonly mod?: boolean;\n /** Require ⇧ (default false → must NOT be held). */\n readonly shift?: boolean;\n /** Resolve to an engine write path — no keyboard logic beyond dispatch. */\n run(engine: CanvasEngine): void;\n}\n\ntype KeyTarget = Pick<Window, \"addEventListener\" | \"removeEventListener\">;\n\nconst signature = (key: string, mod?: boolean, shift?: boolean): string =>\n `${key.toLowerCase()}|${mod ? 1 : 0}|${shift ? 1 : 0}`;\n\n/** One nudge = one gesture-equivalent transaction (absolute Position writes). */\nfunction nudgeSelection(engine: CanvasEngine, dx: number, dy: number): void {\n const session = engine.docs.current();\n if (session === undefined) return;\n const selection = selectedEntities(engine.world).filter((e) => session.store.keyOf(e) !== undefined);\n if (selection.length === 0) return;\n guardedTransaction(session.store, engine.world, (tx) => {\n for (const e of selection) {\n const p = engine.world.get(e, Position);\n if (p === undefined) continue;\n tx.edit(e).set(Position, { x: p.x + dx, y: p.y + dy });\n }\n });\n}\n\nconst ARROWS: readonly [key: string, dx: number, dy: number][] = [\n [\"ArrowLeft\", -1, 0],\n [\"ArrowRight\", 1, 0],\n [\"ArrowUp\", 0, -1],\n [\"ArrowDown\", 0, 1],\n];\n\n/** The locked defaults + tool shortcuts (read from the registry at attach time). */\nfunction defaultEntries(): KeymapEntry[] {\n const entries: KeymapEntry[] = [\n { key: \"Backspace\", run: (e) => e.ops.deleteSelection() },\n { key: \"Delete\", run: (e) => e.ops.deleteSelection() },\n { key: \"z\", mod: true, run: (e) => e.docs.undo() },\n { key: \"z\", mod: true, shift: true, run: (e) => e.docs.redo() },\n { key: \"d\", mod: true, run: (e) => e.ops.duplicateSelection() },\n { key: \"a\", mod: true, run: (e) => e.ops.selectAll() },\n { key: \"Escape\", run: (e) => e.ops.cancelActiveGestures() },\n ];\n for (const [key, dx, dy] of ARROWS) {\n entries.push({ key, run: (e) => nudgeSelection(e, dx, dy) });\n entries.push({ key, shift: true, run: (e) => nudgeSelection(e, dx * 10, dy * 10) });\n }\n for (const tool of tools.all()) {\n if (tool.shortcut !== undefined) {\n const id = tool.id;\n entries.push({ key: tool.shortcut, run: (e) => e.ops.setTool(id) });\n }\n }\n return entries;\n}\n\nfunction resolveTarget(target?: KeyTarget): KeyTarget | undefined {\n if (target !== undefined) return target;\n return typeof window !== \"undefined\" ? window : undefined;\n}\n\n/**\n * Attach the default keymap (plus `overrides`) to `target` (default: `window`).\n * Returns a detach function. No-op (returns a no-op detach) when there is no\n * target — e.g. a headless environment with no `window`.\n */\nexport function attachKeymap(\n engine: CanvasEngine,\n target?: KeyTarget,\n overrides: readonly KeymapEntry[] = [],\n): () => void {\n const el = resolveTarget(target);\n if (el === undefined) return () => {};\n\n const map = new Map<string, KeymapEntry>();\n for (const entry of defaultEntries()) map.set(signature(entry.key, entry.mod, entry.shift), entry);\n for (const entry of overrides) {\n if (entry.key === \" \") {\n // Fail loud at attach, not silently at runtime: the adapter's window\n // listener registers first and preventDefaults Space (pan modifier),\n // so gate 1 makes this entry unreachable by construction.\n console.warn(\n \"ice: attachKeymap — an override on Space can never fire: the pointer adapter owns Space as the pan modifier (design-003 §4.4) and preventDefaults it before the keymap's handled-by-content gate.\",\n );\n }\n map.set(signature(entry.key, entry.mod, entry.shift), entry);\n }\n\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return; // gate 1 — handled by content\n const claim = keyboardClaimOf(event.target);\n if (claim.claimed) {\n // Gate 2 — exclusive standdown (BEFORE the editable gate, so editable\n // focus proxies keep the release gesture — header note). Escape stays\n // engine-reserved (blur, no gesture-cancel THIS press) unless the\n // widget owns it. Everything else flows to the widget,\n // un-preventDefaulted.\n if (event.key === \"Escape\" && !claim.ownsEscape) {\n event.preventDefault();\n // SVG nodes are focusable too (tabindex) and are not HTMLElement —\n // the release must never eat Escape without actually blurring.\n const t = event.target;\n if (t instanceof HTMLElement || t instanceof SVGElement) t.blur();\n }\n return;\n }\n if (isEditableTarget(event.target)) return; // gate 3 — typing\n const mod = event.metaKey || event.ctrlKey;\n const entry = map.get(signature(event.key, mod, event.shiftKey));\n if (entry === undefined) return;\n event.preventDefault();\n entry.run(engine);\n };\n\n el.addEventListener(\"keydown\", onKeyDown as EventListener);\n return () => el.removeEventListener(\"keydown\", onKeyDown as EventListener);\n}\n","/**\n * `<InfiniteCanvas>` — the one-line canvas mount (design-005 §5): planes +\n * adapters + reflectors + portal root, wired in node-board's PROVEN boot order\n * (apps/nodeboard/src/app.tsx). The app supplies a constructed {@link\n * CanvasEngine} (via `createCanvasEngine`); this component owns only the DOM\n * host, the reflector registrations, the pointer/keymap adapters, the rAF loop,\n * and the viewport sync — everything that must live next to a real container.\n *\n * Boot order (registration order = reflector flush order, mirrored exactly):\n * host → planes → reflectors[ planeTransform · ground(P0, app-injected) ·\n * domWidgets(P1/P3) · chrome(P4) · cursor · remoteCursors(P5) ] →\n * pointer adapter → measurement (optional) → keymap → rAF loop → viewport RO.\n *\n * The dom-widgets reflector is BOTH a reflector and the host lookup WidgetRoot\n * portals into; it is created before mount and stored in state so WidgetRoot\n * renders once the hosts exist.\n *\n * Lifecycle: this component does NOT own the engine — it never calls\n * `engine.dispose()` (the engine outlives the mount; the app owns it). Unmount\n * detaches every adapter, unregisters every reflector, stops the loop, and\n * disposes the host.\n *\n * Not handled here (by design):\n * - GL / R3F: the `@ice/r3f` wall forbids `@ice/react` importing three, so a\n * GL layer (GLViews) mounts APP-SIDE. Use {@link onReady} to receive the host\n * + planes and mount it yourself (like apps/glboard).\n * - The GROUND layer (P0: dot grid, wires, snap guides — @ice/ground, three's\n * WebGPURenderer) rides the same wall: pass its factory through the OPAQUE\n * {@link InfiniteCanvasProps.ground} prop (`ground={ground({...})}`); this\n * component types it structurally and never imports the package. No factory\n * ⇒ no ground layer (headless/test boots).\n * - Devtools: the import wall forbids `@ice/react` importing `@ice/devtools`.\n * Wire the panel app-side against `engine.engine` (also via {@link onReady}).\n * - Measurement: auto-sized widgets need a `MeasureQueue` passed to BOTH\n * `createCanvasEngine({ measureQueue })` (ingest side) and this component's\n * `measureQueue` prop (ResizeObserver side). Absent ⇒ measurement is skipped.\n */\nimport {\n Viewport,\n writeRuntimeResource,\n type CanvasEngine,\n type Entity,\n type GridConfig,\n type MeasureQueue,\n type ReflectorDef,\n type WirePreviewBuffer,\n type World,\n} from \"@ice/core\";\nimport {\n attachPointerAdapter,\n attachWidgetFocus,\n createCanvasHost,\n createChromeReflector,\n createCursorReflector,\n createDomWidgetsReflector,\n createPlaneTransformReflector,\n createPlanes,\n createRemoteCursorsReflector,\n startRafLoop,\n wireMeasurement,\n type CanvasHost,\n type DomWidgetsReflector,\n type GLRoute,\n type Planes,\n type WidgetFocusHandle,\n} from \"@ice/dom\";\nimport { useEffect, useRef, useState, type CSSProperties, type ReactElement, type ReactNode } from \"react\";\nimport { EngineProvider } from \"./engine-context\";\nimport { attachKeymap, type KeymapEntry } from \"./keymap\";\nimport { WidgetRoot } from \"./widget-root\";\n\n/** Handed to {@link InfiniteCanvasProps.onReady} for app-side GL/devtools wiring. */\nexport interface InfiniteCanvasHandle {\n readonly engine: CanvasEngine;\n readonly host: CanvasHost;\n readonly planes: Planes;\n /**\n * Programmatic widget focus (design-007 §2.3): `focusWidget(entity)` /\n * `blurFocus()` for `keyboard: \"exclusive\"` widgets. Focus is VIEW state\n * (design-007 §2.6) — it rides this handle, not `engine.ops` (a headless\n * engine correctly has no focus concept).\n */\n readonly focus: WidgetFocusHandle;\n}\n\n/**\n * STRUCTURAL mirror of `@ice/ground`'s GroundLayer/GroundFactory (the\n * `WidgetDef.component`-style opaque seam: react never imports the package —\n * the wall forbids three here). `@ice/ground.ground(...)` returns a function\n * assignable to this type.\n */\nexport interface GroundLayerHandle {\n readonly reflector: ReflectorDef & { available(): boolean };\n configureGrid(cfg: Partial<GridConfig>): void;\n dispose(): void;\n}\n\nexport type GroundLayerFactory = (ctx: {\n readonly host: { readonly container: HTMLElement; readonly contentPlane: HTMLElement };\n readonly world: World;\n readonly readWirePreview: () => WirePreviewBuffer;\n /**\n * Broad-phase rect query over the interaction stack's spatial index (the\n * magnet grid's widget sources, design-010 §3.2). Structural mirror of\n * `@ice/ground`'s ReadSpatial — kernel AABB/SpatialEntry shapes inlined.\n */\n readonly readSpatial: (bounds: {\n readonly minX: number;\n readonly minY: number;\n readonly maxX: number;\n readonly maxY: number;\n }) => ReadonlyArray<{ minX: number; minY: number; maxX: number; maxY: number; id: Entity }>;\n}) => GroundLayerHandle;\n\nexport interface InfiniteCanvasProps {\n /** A constructed engine (`createCanvasEngine(...)`); NOT disposed on unmount. */\n readonly engine: CanvasEngine;\n /**\n * The ResizeObserver side of widget measurement. Pass the SAME queue given to\n * `createCanvasEngine({ measureQueue })`. Absent ⇒ measurement skipped.\n */\n readonly measureQueue?: MeasureQueue;\n /** Called once after the host/reflectors/loop are live (app-side GL/devtools). */\n readonly onReady?: (handle: InfiniteCanvasHandle) => void;\n /**\n * The P0 ground layer (dot grid, wires, snap guides — one WebGPU canvas).\n * Pass `ground(opts)` from `@ice/ground`; received opaquely (see\n * {@link GroundLayerFactory}). Memoize in the caller — a new identity\n * re-boots the canvas mount effect. Absent ⇒ no ground layer renders.\n */\n readonly ground?: GroundLayerFactory;\n /**\n * Dot-grid tuning (theme dot color, spacing, fades). Applied live via the\n * ground layer's `configureGrid` — changing it never re-boots the canvas\n * (memoize in the caller to avoid redundant same-value redraws). No-op\n * when {@link ground} is absent.\n */\n readonly grid?: Partial<GridConfig>;\n /**\n * GL pointer routing (event-time island pick — @ice/r3f's\n * createGLPointerRouter). Provide from the FIRST render (a stub delegating\n * to a ref is fine — the real router usually arrives in onReady); the prop\n * is read through a ref, so later identity changes take effect without\n * re-attaching the adapter.\n */\n readonly glRoute?: GLRoute;\n /**\n * Keymap overrides plumbed to {@link attachKeymap} (design-007 §5 M-d — the\n * declared alternative to capture-phase `stopPropagation` folklore; retires\n * the widgetlab C-key hack). An entry replaces a default by its\n * `key|mod|shift` signature; conditional behavior belongs INSIDE `run`\n * (read engine state there — e.g. selection → comment, else the default's\n * action). BOUND ONCE at mount, like the adapter: entries should read live\n * state from the engine at run time, never close over render-time values.\n */\n readonly keymapOverrides?: readonly KeymapEntry[];\n readonly className?: string;\n readonly style?: CSSProperties;\n /** Overlays inside the viewport (toolbars, HUD) — rendered under the EngineProvider. */\n readonly children?: ReactNode;\n}\n\nexport function InfiniteCanvas({\n engine,\n measureQueue,\n onReady,\n ground,\n grid: gridConfig,\n glRoute,\n keymapOverrides,\n className,\n style,\n children,\n}: InfiniteCanvasProps): ReactElement {\n const containerRef = useRef<HTMLDivElement>(null);\n const [hosts, setHosts] = useState<DomWidgetsReflector | undefined>(undefined);\n // Keep onReady out of the effect deps (identity churn must not re-boot).\n const onReadyRef = useRef(onReady);\n onReadyRef.current = onReady;\n // The live ground handle (set by the mount effect); the grid-config effect\n // below re-tunes it without re-booting the canvas.\n const groundRef = useRef<GroundLayerHandle | null>(null);\n const gridConfigRef = useRef(gridConfig);\n gridConfigRef.current = gridConfig;\n // glRoute reads through a ref: the adapter captures ONE function at attach,\n // and the app's real router typically arrives post-mount (onReady).\n const glRouteRef = useRef(glRoute);\n glRouteRef.current = glRoute;\n // Overrides are bound once at mount (attachKeymap builds its map at attach);\n // the ref keeps identity churn from re-booting the canvas.\n const keymapOverridesRef = useRef(keymapOverrides);\n keymapOverridesRef.current = keymapOverrides;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n const { world, engine: core, stack, runtime } = engine;\n\n const host = createCanvasHost(container);\n const planes = createPlanes(host);\n const planeArgs = { contentPlane: planes.content, liftedPlane: planes.lifted };\n const domWidgets = createDomWidgetsReflector(planeArgs, world, runtime.store);\n const remoteCursors = createRemoteCursorsReflector(host, world);\n\n // Handles kept for teardown: unregistering only stops flushes — the DOM\n // these factories inserted (ground canvas, chrome plane) must be disposed\n // too, or a StrictMode remount stacks duplicates (the double-grid field\n // report, 2026-07-11).\n const groundLayer =\n ground?.({\n host,\n world,\n readWirePreview: () => stack.wirePreview,\n readSpatial: (bounds) => stack.index.search(bounds),\n }) ?? null;\n groundRef.current = groundLayer;\n if (groundLayer !== null && gridConfigRef.current !== undefined) {\n groundLayer.configureGrid(gridConfigRef.current);\n }\n const chrome = createChromeReflector(host, world, stack.marqueeBuffer);\n\n // Registration order = flush order — node-board's proven sequence.\n const unregister = [\n core.registerReflector(createPlaneTransformReflector(planeArgs)),\n ...(groundLayer !== null ? [core.registerReflector(groundLayer.reflector)] : []),\n core.registerReflector(domWidgets),\n core.registerReflector(chrome),\n core.registerReflector(createCursorReflector(host, stack.readCursor)),\n core.registerReflector(remoteCursors.reflector),\n ];\n\n const detachPointer = attachPointerAdapter(\n host,\n stack.queue,\n glRouteRef.current !== undefined\n ? // Pass the verdict through UNCOERCED: a rich GLRouteVerdict return\n // (hover-time overInteractive, 2026-07-18) must survive this seam.\n { glRoute: (kind, x, y, e) => glRouteRef.current?.(kind, x, y, e) ?? false }\n : {},\n );\n const detachMeasure =\n measureQueue !== undefined ? wireMeasurement(runtime.store, domWidgets, measureQueue) : undefined;\n const detachKeymap = attachKeymap(engine, undefined, keymapOverridesRef.current ?? []);\n // Click-to-focus acquisition for keyboard-claiming widgets + the\n // programmatic focus handle (design-007 §2.3; the reflector's hostFor\n // resolves entity → content, the driver walks to the marked host).\n const focus = attachWidgetFocus(host, domWidgets);\n\n const syncViewport = (): void => {\n const rect = container.getBoundingClientRect();\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio : 1;\n writeRuntimeResource(world, Viewport, { w: rect.width, h: rect.height, dpr });\n };\n syncViewport();\n let resizeObserver: ResizeObserver | undefined;\n if (typeof ResizeObserver !== \"undefined\") {\n resizeObserver = new ResizeObserver(syncViewport);\n resizeObserver.observe(container);\n }\n\n const stopLoop = startRafLoop(core);\n setHosts(domWidgets);\n onReadyRef.current?.({ engine, host, planes, focus });\n\n return () => {\n stopLoop();\n focus.detach();\n detachKeymap();\n detachMeasure?.();\n detachPointer();\n resizeObserver?.disconnect();\n for (const unreg of unregister) unreg();\n remoteCursors.destroy();\n groundLayer?.dispose();\n groundRef.current = null;\n domWidgets.dispose();\n chrome.dispose();\n planes.dispose();\n host.dispose();\n setHosts(undefined);\n };\n }, [engine, measureQueue, ground]);\n\n // Live grid re-tune — never re-boots the canvas (the mount effect above\n // deliberately omits `gridConfig` from its deps; initial config rides the\n // ref at creation).\n useEffect(() => {\n if (gridConfig !== undefined) groundRef.current?.configureGrid(gridConfig);\n }, [gridConfig]);\n\n return (\n <EngineProvider engine={engine}>\n <div ref={containerRef} className={className} style={{ width: \"100%\", height: \"100%\", ...style }} data-ice-canvas=\"\">\n {hosts !== undefined ? (\n <WidgetRoot world={engine.world} store={engine.runtime.store} hosts={hosts} />\n ) : null}\n {children}\n </div>\n </EngineProvider>\n );\n}\n","/**\n * @ice/react — widget content layer: portals from one root + Tier-3 hooks.\n * Import wall: @ice/dom → @ice/core down only — never three/@react-three\n * (enforced). react/react-dom are peers.\n */\nexport const REACT_VERSION = \"0.0.0\";\n\nexport {\n WidgetHiddenContext,\n useBreakpoint,\n useSelected,\n useBehavior,\n useWidgetProps,\n useWorldComponent,\n} from \"./hooks\";\nexport { WidgetRoot, type WidgetComponentProps, type WidgetHosts, type WidgetRootProps } from \"./widget-root\";\n\n// M10 React facade (design-005 §5): engine context, commit seam, hooks, keymap,\n// and the <InfiniteCanvas> mount.\nexport {\n EngineProvider,\n useCanvasEngine,\n useFrameFreeze,\n useOps,\n useStageHold,\n useWorld,\n type EngineProviderProps,\n} from \"./engine-context\";\nexport { useCommit, useUndoStatus, type Commit, type UndoStatus } from \"./use-commit\";\nexport { WidgetPreview, type WidgetPreviewProps } from \"./widget-preview\";\nexport {\n getPreviewSnapshot,\n hasPreviewSnapshot,\n setPreviewSnapshot,\n subscribePreviewSnapshots,\n type PreviewImage,\n} from \"./preview-snapshots\";\nexport { useTool, useToolState } from \"./use-tool\";\nexport { usePresencePeers, type PresencePeerView } from \"./use-presence\";\nexport { attachKeymap, type KeymapEntry } from \"./keymap\";\nexport {\n InfiniteCanvas,\n type GroundLayerFactory,\n type GroundLayerHandle,\n type InfiniteCanvasHandle,\n type InfiniteCanvasProps,\n} from \"./infinite-canvas\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,eAAe,aAAa,YAAY,SAAS,QAAQ,4BAA4B;AAGvF,IAAM,sBAAsB,cAAc,KAAK;AAEtD,IAAM,YAAY,YAAY,CAAC,QAAQ,CAAC;AAGxC,SAAS,UAAU,GAAY,GAAqB;AAClD,MAAI,OAAO,GAAG,GAAG,CAAC,EAAG,QAAO;AAC5B,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,KAAM,QAAO;AACvF,QAAM,KAAK,OAAO,KAAK,CAAC;AACxB,QAAM,KAAK,OAAO,KAAK,CAAC;AACxB,MAAI,GAAG,WAAW,GAAG,OAAQ,QAAO;AACpC,aAAW,KAAK,IAAI;AAClB,QAAI,CAAC,OAAO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AAc,MAAM,CAAC;AAKjC,EAAAA,WAAU,MAAM;AACd,QAAI,eAAe,OAAW,WAAU,SAAS,cAAc,UAAU;AAAA,EAC3E,GAAG,CAAC,UAAU,CAAC;AAEf,SACE,gBAAAH,KAAC,kBAAe,QACd,0BAAAC,MAAC,SAAI,KAAK,cAAc,WAAsB,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,GAAG,MAAM,GAAG,mBAAgB,IAC/G;AAAA,cAAU,SACT,gBAAAD,KAAC,cAAW,OAAO,OAAO,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAc,IAC1E;AAAA,IACH;AAAA,KACH,GACF;AAEJ;;;ACvSO,IAAM,gBAAgB;","names":["useSyncExternalStore","useSyncExternalStore","createContext","useContext","useCallback","useRef","useSyncExternalStore","useCallback","useRef","useSyncExternalStore","useEffect","useRef","useSyncExternalStore","jsx","useRef","useEffect","jsx","useSyncExternalStore","useCallback","useSyncExternalStore","useCallback","useSyncExternalStore","useCallback","useRef","useSyncExternalStore","useRef","useCallback","useSyncExternalStore","useEffect","useRef","jsx","jsxs","useRef","useEffect"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../kernel/src/shapes.ts","../../kernel/src/coords.ts","../../kernel/src/snap.ts","../../kernel/src/spatial-index.ts","../../kernel/src/zoom-bands.ts","../../kernel/src/eviction.ts","../../kernel/src/anchors.ts","../../kernel/src/bezier.ts","../../kernel/src/easing.ts","../../kernel/src/nav-flight.ts","../../kernel/src/layout.ts","../../kernel/src/index.ts"],"sourcesContent":["/** Plain geometric structs shared across the kernel. Ported from v1 `ecs/math.ts`. */\n\nexport interface Vec2 {\n x: number;\n y: number;\n}\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface AABB {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\nexport function rectToAABB(r: Rect): AABB {\n return { minX: r.x, minY: r.y, maxX: r.x + r.width, maxY: r.y + r.height };\n}\n\nexport function aabbToRect(a: AABB): Rect {\n return { x: a.minX, y: a.minY, width: a.maxX - a.minX, height: a.maxY - a.minY };\n}\n\nexport function intersectsAABB(a: AABB, b: AABB): boolean {\n return a.maxX >= b.minX && a.minX <= b.maxX && a.maxY >= b.minY && a.minY <= b.maxY;\n}\n\nexport function pointInAABB(px: number, py: number, a: AABB): boolean {\n return px >= a.minX && px <= a.maxX && py >= a.minY && py <= a.maxY;\n}\n\nexport function clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value));\n}\n","/**\n * THE coordinate seam (Law 13): every conversion between screen, world, and\n * island (widget-local GL) space lives here — including the ONE Y-flip.\n * v1 duplicated this math in three places; nothing outside this module may\n * re-derive it.\n *\n * Conventions:\n * - screen: CSS px, canvas-container-relative, Y-down. DPR never enters world\n * math (it exists only in GL uniforms / FBO sizing — see zoom-bands).\n * - world: world units, Y-down. `Camera.{x,y}` is the WORLD point at the\n * viewport's top-left; `zoom` is screen px per world unit.\n * - island: widget-local GL space — CENTER origin, Y-UP, world-unit scale.\n * (v1 VirtualWidget convention; the only Y-flip in the codebase.)\n */\nimport type { Rect, Vec2 } from \"./shapes\";\n\nexport interface CameraState {\n x: number;\n y: number;\n zoom: number;\n}\n\nexport function screenToWorld(screenX: number, screenY: number, camera: CameraState): Vec2 {\n return {\n x: screenX / camera.zoom + camera.x,\n y: screenY / camera.zoom + camera.y,\n };\n}\n\nexport function worldToScreen(worldX: number, worldY: number, camera: CameraState): Vec2 {\n return {\n x: (worldX - camera.x) * camera.zoom,\n y: (worldY - camera.y) * camera.zoom,\n };\n}\n\n/**\n * Zoom about a fixed screen point (v1 `zoomAtPoint`): the world point under\n * `(screenX, screenY)` stays under it after the zoom change.\n * Returns the new camera (does not mutate). Clamping is the caller's policy.\n */\nexport function zoomAtPoint(\n camera: CameraState,\n screenX: number,\n screenY: number,\n newZoom: number,\n): CameraState {\n const anchor = screenToWorld(screenX, screenY, camera);\n return {\n x: anchor.x - screenX / newZoom,\n y: anchor.y - screenY / newZoom,\n zoom: newZoom,\n };\n}\n\n/**\n * The DEFAULT framing camera (2026-07-18, James: \"do zoom to fit, but with a\n * upper and bottom cap … should feel natural\"): zoom-to-fit `content` (a\n * world-space bbox) with `pad` px of breathing room on every side, zoom\n * clamped into [minZoom, maxZoom] — the natural band: never so far in that\n * one small card fills the screen, never so far out that the board turns\n * into an ant farm. The content CENTER stays centered whether or not a cap\n * engages. Callers own the band policy (engine default: FIT_DEFAULTS ∩ the\n * session's hard CameraLimits) and must pass a real viewport.\n */\nexport function fitCamera(\n content: Rect,\n vpW: number,\n vpH: number,\n opts: { pad: number; minZoom: number; maxZoom: number },\n): CameraState {\n const fit = Math.min(vpW / (content.width + opts.pad * 2), vpH / (content.height + opts.pad * 2));\n const zoom = Math.min(opts.maxZoom, Math.max(opts.minZoom, fit));\n return {\n x: content.x + content.width / 2 - vpW / (2 * zoom),\n y: content.y + content.height / 2 - vpH / (2 * zoom),\n zoom,\n };\n}\n\n/**\n * Camera → the ONE per-plane CSS transform (design-002 §5 `planeTransform`).\n * Children are laid out in WORLD units inside the plane (left/top = world x/y),\n * the plane carries `transform: translate(tx px, ty px) scale(scale)` with\n * `transform-origin: 0 0` — so a child at world point p lands at\n * `p·zoom + t = (p − camera)·zoom`, i.e. exactly `worldToScreen(p)`.\n */\nexport function planeCssTransform(camera: CameraState): { tx: number; ty: number; scale: number } {\n return {\n tx: -camera.x * camera.zoom,\n ty: -camera.y * camera.zoom,\n scale: camera.zoom,\n };\n}\n\n/** World → island (center-origin, Y-up). THE Y-flip, direction one. */\nexport function worldToIsland(worldX: number, worldY: number, widget: Rect): Vec2 {\n return {\n x: worldX - (widget.x + widget.width / 2),\n y: -(worldY - (widget.y + widget.height / 2)),\n };\n}\n\n/** Island → world. THE Y-flip, direction two. */\nexport function islandToWorld(islandX: number, islandY: number, widget: Rect): Vec2 {\n return {\n x: widget.x + widget.width / 2 + islandX,\n y: widget.y + widget.height / 2 - islandY,\n };\n}\n\n// --- P2 composite scene (design-004 §1/§3) -------------------------------\n// The GL-views plane composites island quads in a Three scene whose axes are\n// world-unit X-right / Y-UP (Three convention). Same flip as island space,\n// applied at WORLD scale — these two helpers are the only place it exists.\n\n/**\n * Camera → the P2 composite ortho frustum + camera position (world units,\n * Y-up scene). `left/top` pin the viewport's top-left to `Camera.{x,y}`\n * exactly like `planeCssTransform` does for the DOM planes: the frustum spans\n * `viewport / zoom` world units and the camera sits at the world origin\n * offset, so a quad at `worldRectToComposite(rect)` lands on the same screen\n * pixels as a DOM host at `rect` under the plane transform.\n */\nexport function compositeCameraFrustum(\n camera: CameraState,\n viewportW: number,\n viewportH: number,\n): { left: number; right: number; top: number; bottom: number; x: number; y: number } {\n return {\n left: 0,\n right: viewportW / camera.zoom,\n top: 0,\n bottom: -(viewportH / camera.zoom),\n x: camera.x,\n y: -camera.y,\n };\n}\n\n/** World rect → composite-quad center + scale in the Y-up P2 scene. */\nexport function worldRectToComposite(rect: Rect): { x: number; y: number; sx: number; sy: number } {\n return {\n x: rect.x + rect.width / 2,\n y: -(rect.y + rect.height / 2),\n sx: rect.width,\n sy: rect.height,\n };\n}\n","/**\n * Snap guide computation (Figma-style), ported verbatim from v1\n * `ecs/spatial/snap.ts` (audited CLEAN-PORT):\n * Phase 1 — edge/center alignment (7 X + 7 Y candidate pairs per reference,\n * per-axis nearest-wins, ties within 0.01 accumulate guides)\n * Phase 2 — equal spacing (between-two-neighbors midpoint; extend-a-pattern),\n * same-perpendicular-band filter\n * Merge — alignment takes priority per axis; equal spacing fills the other;\n * indicators recomputed post-snap at threshold × 0.5.\n * Pure function over plain bounds. Candidate GATHERING (spatial index, tags,\n * Active scoping) is the caller's job — design-003 §5.2/§6.\n */\n\nexport interface SnapGuide {\n axis: \"x\" | \"y\";\n /** World-space coordinate of the alignment line */\n position: number;\n type: \"edge\" | \"center\";\n}\n\nexport interface EqualSpacingIndicator {\n axis: \"x\" | \"y\";\n /** The equal gap value (world units) */\n gap: number;\n /** Pairs of (from, to) marking each equal gap segment */\n segments: { from: number; to: number }[];\n /** Position on the perpendicular axis (for rendering) */\n perpPosition: number;\n}\n\nexport interface SnapResult {\n /** Snap-corrected delta (world units). Apply to entity position. */\n snapDx: number;\n snapDy: number;\n guides: SnapGuide[];\n spacings: EqualSpacingIndicator[];\n}\n\nexport interface EntityBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport function computeSnapGuides(\n dragged: EntityBounds,\n references: EntityBounds[],\n threshold: number,\n): SnapResult {\n const guides: SnapGuide[] = [];\n const spacings: EqualSpacingIndicator[] = [];\n let snapDx = 0;\n let snapDy = 0;\n\n const dLeft = dragged.x;\n const dRight = dragged.x + dragged.width;\n const dCenterX = dragged.x + dragged.width / 2;\n const dTop = dragged.y;\n const dBottom = dragged.y + dragged.height;\n const dCenterY = dragged.y + dragged.height / 2;\n\n let bestSnapX = Number.POSITIVE_INFINITY;\n let bestSnapY = Number.POSITIVE_INFINITY;\n let bestDx = 0;\n let bestDy = 0;\n const xGuides: SnapGuide[] = [];\n const yGuides: SnapGuide[] = [];\n\n // --- Phase 1: edge/center alignment ---\n for (const ref of references) {\n const rLeft = ref.x;\n const rRight = ref.x + ref.width;\n const rCenterX = ref.x + ref.width / 2;\n const rTop = ref.y;\n const rBottom = ref.y + ref.height;\n const rCenterY = ref.y + ref.height / 2;\n\n const xPairs: [number, number, \"edge\" | \"center\"][] = [\n [dLeft, rLeft, \"edge\"],\n [dLeft, rRight, \"edge\"],\n [dRight, rLeft, \"edge\"],\n [dRight, rRight, \"edge\"],\n [dCenterX, rCenterX, \"center\"],\n [dLeft, rCenterX, \"edge\"],\n [dRight, rCenterX, \"edge\"],\n ];\n for (const [dVal, rVal, type] of xPairs) {\n const dist = Math.abs(dVal - rVal);\n if (dist <= threshold) {\n const dx = rVal - dVal;\n if (dist < bestSnapX) {\n bestSnapX = dist;\n bestDx = dx;\n xGuides.length = 0;\n }\n if (dist <= bestSnapX + 0.01) {\n xGuides.push({ axis: \"x\", position: rVal, type });\n }\n }\n }\n\n const yPairs: [number, number, \"edge\" | \"center\"][] = [\n [dTop, rTop, \"edge\"],\n [dTop, rBottom, \"edge\"],\n [dBottom, rTop, \"edge\"],\n [dBottom, rBottom, \"edge\"],\n [dCenterY, rCenterY, \"center\"],\n [dTop, rCenterY, \"edge\"],\n [dBottom, rCenterY, \"edge\"],\n ];\n for (const [dVal, rVal, type] of yPairs) {\n const dist = Math.abs(dVal - rVal);\n if (dist <= threshold) {\n const dy = rVal - dVal;\n if (dist < bestSnapY) {\n bestSnapY = dist;\n bestDy = dy;\n yGuides.length = 0;\n }\n if (dist <= bestSnapY + 0.01) {\n yGuides.push({ axis: \"y\", position: rVal, type });\n }\n }\n }\n }\n\n // --- Phase 2: equal spacing ---\n const eqResult = computeEqualSpacing(dragged, references, threshold);\n\n // Merge: alignment snap takes priority; equal spacing fills the other axis.\n if (bestSnapX <= threshold) {\n snapDx = bestDx;\n } else if (eqResult.snapDx !== undefined) {\n snapDx = eqResult.snapDx;\n }\n if (bestSnapY <= threshold) {\n snapDy = bestDy;\n } else if (eqResult.snapDy !== undefined) {\n snapDy = eqResult.snapDy;\n }\n\n if (bestSnapX <= threshold) {\n const seen = new Set<number>();\n for (const g of xGuides) {\n if (!seen.has(g.position)) {\n seen.add(g.position);\n guides.push(g);\n }\n }\n }\n if (bestSnapY <= threshold) {\n const seen = new Set<number>();\n for (const g of yGuides) {\n if (!seen.has(g.position)) {\n seen.add(g.position);\n guides.push(g);\n }\n }\n }\n\n // Indicators recomputed against the SNAPPED bounds at half threshold.\n const snappedBounds: EntityBounds = {\n x: dragged.x + snapDx,\n y: dragged.y + snapDy,\n width: dragged.width,\n height: dragged.height,\n };\n const eqFinal = computeEqualSpacing(snappedBounds, references, threshold * 0.5);\n spacings.push(...eqFinal.indicators);\n\n return { snapDx, snapDy, guides, spacings };\n}\n\ninterface EqualSpacingResult {\n snapDx: number | undefined;\n snapDy: number | undefined;\n indicators: EqualSpacingIndicator[];\n}\n\nfunction computeEqualSpacing(\n dragged: EntityBounds,\n references: EntityBounds[],\n threshold: number,\n): EqualSpacingResult {\n const indicators: EqualSpacingIndicator[] = [];\n let snapDx: number | undefined;\n let snapDy: number | undefined;\n\n const xResult = checkAxisSpacing(dragged, references, threshold, \"x\");\n if (xResult) {\n snapDx = xResult.snap;\n indicators.push(...xResult.indicators);\n }\n const yResult = checkAxisSpacing(dragged, references, threshold, \"y\");\n if (yResult) {\n snapDy = yResult.snap;\n indicators.push(...yResult.indicators);\n }\n return { snapDx, snapDy, indicators };\n}\n\nfunction checkAxisSpacing(\n dragged: EntityBounds,\n references: EntityBounds[],\n threshold: number,\n axis: \"x\" | \"y\",\n): { snap: number; indicators: EqualSpacingIndicator[] } | null {\n const isX = axis === \"x\";\n const pos = (b: EntityBounds) => (isX ? b.x : b.y);\n const size = (b: EntityBounds) => (isX ? b.width : b.height);\n const perpPos = (b: EntityBounds) => (isX ? b.y : b.x);\n const perpSize = (b: EntityBounds) => (isX ? b.height : b.width);\n const end = (b: EntityBounds) => pos(b) + size(b);\n\n // Same-perpendicular-band filter.\n const neighbors = references.filter(\n (ref) =>\n perpPos(ref) < perpPos(dragged) + perpSize(dragged) &&\n perpPos(ref) + perpSize(ref) > perpPos(dragged),\n );\n if (neighbors.length < 1) return null;\n\n const sorted = [...neighbors].sort((a, b) => pos(a) - pos(b));\n\n // Existing gaps between consecutive references.\n const refGaps: { from: EntityBounds; to: EntityBounds; gap: number }[] = [];\n for (let i = 0; i < sorted.length - 1; i++) {\n const a = sorted[i];\n const b = sorted[i + 1];\n if (a === undefined || b === undefined) continue;\n const gap = pos(b) - end(a);\n if (gap > 0.1) refGaps.push({ from: a, to: b, gap });\n }\n\n let bestSnap: number | null = null;\n let bestIndicators: EqualSpacingIndicator[] = [];\n let bestDiff = Number.POSITIVE_INFINITY;\n\n // Case 1: between two neighbors — equalize left/right gaps.\n let leftN: EntityBounds | null = null;\n let rightN: EntityBounds | null = null;\n for (const ref of sorted) {\n if (end(ref) <= pos(dragged) + threshold) {\n if (!leftN || end(ref) > end(leftN)) leftN = ref;\n }\n if (pos(ref) >= end(dragged) - threshold) {\n if (!rightN || pos(ref) < pos(rightN)) rightN = ref;\n }\n }\n if (leftN && rightN) {\n const lGap = pos(dragged) - end(leftN);\n const rGap = pos(rightN) - end(dragged);\n const diff = Math.abs(lGap - rGap);\n if (diff <= threshold && diff < bestDiff) {\n const idealPos = (end(leftN) + pos(rightN) - size(dragged)) / 2;\n const snap = idealPos - pos(dragged);\n const equalGap = (pos(rightN) - end(leftN) - size(dragged)) / 2;\n if (equalGap > 0.1) {\n const perpY = computePerpCenter(dragged, [leftN, rightN], isX);\n bestSnap = snap;\n bestDiff = diff;\n bestIndicators = [\n {\n axis,\n gap: equalGap,\n segments: [\n { from: end(leftN), to: idealPos },\n { from: idealPos + size(dragged), to: pos(rightN) },\n ],\n perpPosition: perpY,\n },\n ];\n }\n }\n }\n\n // Case 2: extend an existing gap pattern (append right / prepend left).\n for (const refGap of refGaps) {\n const patternGap = refGap.gap;\n\n if (rightN === null || pos(refGap.to) >= end(dragged) - threshold * 2) {\n const chainEnd = refGap.to;\n const dragGap = pos(dragged) - end(chainEnd);\n const diff = Math.abs(dragGap - patternGap);\n if (diff <= threshold && diff < bestDiff) {\n const idealPos = end(chainEnd) + patternGap;\n const snap = idealPos - pos(dragged);\n const perpY = computePerpCenter(dragged, [refGap.from, refGap.to], isX);\n bestSnap = snap;\n bestDiff = diff;\n bestIndicators = [\n {\n axis,\n gap: patternGap,\n segments: [\n { from: end(refGap.from), to: pos(refGap.to) },\n { from: end(chainEnd), to: idealPos },\n ],\n perpPosition: perpY,\n },\n ];\n }\n }\n\n if (leftN === null || end(refGap.from) <= pos(dragged) + threshold * 2) {\n const chainStart = refGap.from;\n const dragGap = pos(chainStart) - end(dragged);\n const diff = Math.abs(dragGap - patternGap);\n if (diff <= threshold && diff < bestDiff) {\n const idealPos = pos(chainStart) - patternGap - size(dragged);\n const snap = idealPos - pos(dragged);\n const perpY = computePerpCenter(dragged, [refGap.from, refGap.to], isX);\n bestSnap = snap;\n bestDiff = diff;\n bestIndicators = [\n {\n axis,\n gap: patternGap,\n segments: [\n { from: idealPos + size(dragged), to: pos(chainStart) },\n { from: end(refGap.from), to: pos(refGap.to) },\n ],\n perpPosition: perpY,\n },\n ];\n }\n }\n }\n\n if (bestSnap !== null) return { snap: bestSnap, indicators: bestIndicators };\n return null;\n}\n\nfunction computePerpCenter(dragged: EntityBounds, refs: EntityBounds[], isX: boolean): number {\n const perpPos = (b: EntityBounds) => (isX ? b.y : b.x);\n const perpSize = (b: EntityBounds) => (isX ? b.height : b.width);\n const allBounds = [dragged, ...refs];\n const maxStart = Math.max(...allBounds.map(perpPos));\n const minEnd = Math.min(...allBounds.map((b) => perpPos(b) + perpSize(b)));\n if (minEnd < maxStart) {\n return perpPos(dragged) + perpSize(dragged) / 2;\n }\n return maxStart + (minEnd - maxStart) / 2;\n}\n","/**\n * Spatial index backed by an R-tree (rbush) — ported from v1 (audited CLEAN-PORT).\n * World-space AABBs for culling, hit-testing, and snap-candidate gathering\n * (Law 15: the ONLY hit path). The id↔entry map gives O(log n) removal by\n * passing rbush the exact stored reference (v1 \"Fix #8\").\n *\n * `rbush` is the kernel's single, named dependency exception: a zero-dep pure\n * data structure (see .dependency-cruiser.cjs).\n */\nimport RBushImport from \"rbush\";\nimport type { AABB } from \"./shapes\";\n\n// CJS/ESM interop — rbush exports differently depending on context (kept from v1).\ntype RBushModule = typeof RBushImport & { default?: typeof RBushImport };\nconst rbushModule = RBushImport as RBushModule;\nconst RBush = (\n typeof rbushModule.default === \"function\" ? rbushModule.default : RBushImport\n) as typeof RBushImport;\n\nexport interface SpatialEntry<Id> extends AABB {\n id: Id;\n}\n\nexport class SpatialIndex<Id> {\n private tree = new RBush<SpatialEntry<Id>>();\n private entries = new Map<Id, SpatialEntry<Id>>();\n\n upsert(id: Id, bounds: AABB): void {\n const existing = this.entries.get(id);\n if (existing) this.tree.remove(existing);\n const entry: SpatialEntry<Id> = { ...bounds, id };\n this.entries.set(id, entry);\n this.tree.insert(entry);\n }\n\n remove(id: Id): void {\n const existing = this.entries.get(id);\n if (existing) {\n this.tree.remove(existing);\n this.entries.delete(id);\n }\n }\n\n /** All entries intersecting the given AABB. */\n search(bounds: AABB): SpatialEntry<Id>[] {\n return this.tree.search(bounds);\n }\n\n /** Entries within `tolerance` of a point (z-priority is the caller's job). */\n searchPoint(x: number, y: number, tolerance = 0): SpatialEntry<Id>[] {\n return this.tree.search({\n minX: x - tolerance,\n minY: y - tolerance,\n maxX: x + tolerance,\n maxY: y + tolerance,\n });\n }\n\n clear(): void {\n this.tree.clear();\n this.entries.clear();\n }\n\n get size(): number {\n return this.entries.size;\n }\n}\n","/**\n * Hysteresis-banded zoom-resolution policy — ported from v1 `ZoomBands.ts`\n * (RFC-002). An island FBO is allocated at `widget bounds × dpr × band(zoom)`;\n * while zoom stays within `[band × 0.5, band × 2]` no repaint is needed.\n * Bands are powers of 2 (each covers a 4× display range).\n */\nexport const ZOOM_BANDS = [0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16] as const;\nconst MIN_BAND = 0.0625;\nconst MAX_BAND = 16;\n\n/** Smallest band ≥ zoom (clamped to the ladder). */\nexport function selectBand(zoom: number): number {\n if (zoom <= MIN_BAND) return MIN_BAND;\n if (zoom >= MAX_BAND) return MAX_BAND;\n for (const b of ZOOM_BANDS) {\n if (zoom <= b) return b;\n }\n return MAX_BAND;\n}\n\n/**\n * True when zoom left the `[band × 0.5, band × 2]` window of the band the\n * island was painted at. `paintedBand ≤ 0` = never painted (handled elsewhere).\n */\nexport function isOutOfBand(currentZoom: number, paintedBand: number): boolean {\n if (paintedBand <= 0) return false;\n const ratio = currentZoom / paintedBand;\n return ratio > 2 || ratio < 0.5;\n}\n\n/** FBO pixel size for a widget at a band (v1: `bounds × dpr × band`, min 1px). */\nexport function fboPixelSize(\n worldWidth: number,\n worldHeight: number,\n dpr: number,\n band: number,\n): { width: number; height: number } {\n return {\n width: Math.max(1, Math.round(worldWidth * dpr * band)),\n height: Math.max(1, Math.round(worldHeight * dpr * band)),\n };\n}\n","/**\n * FBO-pool eviction policy — ported from v1 `eviction.ts` (pure part of the\n * pool). Priority: Cold(0) < Warm(1) < Dormant(2); LRU within a phase;\n * Hot/Waking are never evicted even under an impossible budget.\n */\nexport type IslandPhase = \"Hot\" | \"Warm\" | \"Waking\" | \"Cold\" | \"Dormant\";\n\nexport interface EvictionCandidate<Id> {\n id: Id;\n phase: IslandPhase;\n bytes: number;\n lastUsedMs: number;\n}\n\nconst PHASE_PRIORITY: Record<IslandPhase, number> = {\n Cold: 0,\n Warm: 1,\n Dormant: 2,\n Waking: Number.POSITIVE_INFINITY,\n Hot: Number.POSITIVE_INFINITY,\n};\n\n/**\n * The island phase truth table (design-004 §3; v1 `computePhase` verbatim —\n * RFC-002 pinned it with tests). `active` is the nested-canvas membership\n * signal (always true until M8); `hasFbo` splits Warm (retained texture,\n * composite-ready) from Waking (must paint before compositing) — after an\n * eviction a re-entering island comes back as Waking, after a plain cull\n * round-trip it comes back Warm from the retained texture.\n */\nexport function computeIslandPhase(\n active: boolean,\n visible: boolean,\n animating: boolean,\n hasFbo: boolean,\n): IslandPhase {\n if (!active) return \"Dormant\";\n if (visible) {\n if (animating) return \"Hot\";\n return hasFbo ? \"Warm\" : \"Waking\";\n }\n // Culled OR not yet culled-classified: treat as Cold — never paint a widget\n // the engine hasn't placed in the viewport yet (v1 rule, kept).\n return \"Cold\";\n}\n\n/** Ordered ids to release so total bytes ≤ budget. Pure. */\nexport function selectEvictions<Id>(\n candidates: EvictionCandidate<Id>[],\n totalBytes: number,\n maxBytes: number,\n): Id[] {\n if (totalBytes <= maxBytes) return [];\n\n const eligible = candidates.filter((c) => Number.isFinite(PHASE_PRIORITY[c.phase]));\n eligible.sort((a, b) => {\n const p = PHASE_PRIORITY[a.phase] - PHASE_PRIORITY[b.phase];\n if (p !== 0) return p;\n return a.lastUsedMs - b.lastUsedMs;\n });\n\n const toEvict: Id[] = [];\n let remaining = totalBytes;\n for (const c of eligible) {\n if (remaining <= maxBytes) break;\n toEvict.push(c.id);\n remaining -= c.bytes;\n }\n return toEvict;\n}\n","/**\n * Port-anchor math (design-001 §5.3): wire geometry NEVER reads port entities —\n * anchors are pure functions over the widget rect + the port declaration, so\n * culled endpoints work by construction.\n */\nimport type { Rect, Vec2 } from \"./shapes\";\n\nexport type PortSide = \"n\" | \"e\" | \"s\" | \"w\";\n\nexport interface PortSlot {\n side: PortSide;\n /** 0-based position among the ports sharing this side. */\n index: number;\n /** Total ports on this side. */\n count: number;\n}\n\n/** World-space anchor point: ports distribute evenly along their side. */\nexport function portAnchor(widget: Rect, slot: PortSlot): Vec2 {\n const f = (slot.index + 1) / (slot.count + 1);\n switch (slot.side) {\n case \"n\":\n return { x: widget.x + widget.width * f, y: widget.y };\n case \"s\":\n return { x: widget.x + widget.width * f, y: widget.y + widget.height };\n case \"w\":\n return { x: widget.x, y: widget.y + widget.height * f };\n case \"e\":\n return { x: widget.x + widget.width, y: widget.y + widget.height * f };\n }\n}\n\n/** Outward unit direction of a side (wire tangent stubs, Y-down world). */\nexport function sideDirection(side: PortSide): Vec2 {\n switch (side) {\n case \"n\":\n return { x: 0, y: -1 };\n case \"s\":\n return { x: 0, y: 1 };\n case \"w\":\n return { x: -1, y: 0 };\n case \"e\":\n return { x: 1, y: 0 };\n }\n}\n","/**\n * Cubic-bezier wire geometry: construction from port anchors, conservative\n * AABB (for the spatial index), and sampled distance (for picking — wires rank\n * below widgets, design-003 §3).\n */\nimport { sideDirection, type PortSide } from \"./anchors\";\nimport type { AABB, Vec2 } from \"./shapes\";\n\nexport interface Cubic {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n x3: number;\n y3: number;\n}\n\n/**\n * Wire curve between two anchors: tangent stubs leave each port along its\n * side's outward direction, scaled with distance (min stub keeps short wires\n * readable).\n */\nexport function wireCubic(\n from: Vec2,\n fromSide: PortSide,\n to: Vec2,\n toSide: PortSide,\n stubScale = 0.4,\n minStub = 24,\n): Cubic {\n const dist = Math.hypot(to.x - from.x, to.y - from.y);\n const stub = Math.max(minStub, dist * stubScale);\n const df = sideDirection(fromSide);\n const dt = sideDirection(toSide);\n return {\n x0: from.x,\n y0: from.y,\n x1: from.x + df.x * stub,\n y1: from.y + df.y * stub,\n x2: to.x + dt.x * stub,\n y2: to.y + dt.y * stub,\n x3: to.x,\n y3: to.y,\n };\n}\n\n/** Point on the curve at t ∈ [0, 1] (Bernstein form). */\nexport function cubicPoint(c: Cubic, t: number): Vec2 {\n const u = 1 - t;\n const b0 = u * u * u;\n const b1 = 3 * u * u * t;\n const b2 = 3 * u * t * t;\n const b3 = t * t * t;\n return {\n x: b0 * c.x0 + b1 * c.x1 + b2 * c.x2 + b3 * c.x3,\n y: b0 * c.y0 + b1 * c.y1 + b2 * c.y2 + b3 * c.y3,\n };\n}\n\n/**\n * Conservative bounds: the control-point hull contains the curve (convex-hull\n * property). Cheap and index-friendly; exact extrema are unnecessary for\n * culling/picking prefilters.\n */\nexport function cubicAABB(c: Cubic): AABB {\n return {\n minX: Math.min(c.x0, c.x1, c.x2, c.x3),\n minY: Math.min(c.y0, c.y1, c.y2, c.y3),\n maxX: Math.max(c.x0, c.x1, c.x2, c.x3),\n maxY: Math.max(c.y0, c.y1, c.y2, c.y3),\n };\n}\n\nexport interface Tessellation {\n /** Flattened polyline, interleaved [x0,y0, x1,y1, …] in the cubic's own space. */\n points: Float32Array;\n /** Cumulative arc length at each polyline point (same unit; [0] = 0). */\n arcLength: Float32Array;\n}\n\n/**\n * Anti-Grain-Geometry flatness: the control points' summed deviation from the\n * chord, squared, against tolerance² × chord² (degenerate chords fall back to\n * raw control-point distance from p0).\n */\nfunction flatEnough(c: Cubic, tolSq: number): boolean {\n const dx = c.x3 - c.x0;\n const dy = c.y3 - c.y0;\n const chordSq = dx * dx + dy * dy;\n if (chordSq <= 1e-12) {\n const d1 = Math.hypot(c.x1 - c.x0, c.y1 - c.y0);\n const d2 = Math.hypot(c.x2 - c.x0, c.y2 - c.y0);\n return (d1 + d2) * (d1 + d2) <= tolSq;\n }\n const d1 = Math.abs((c.x1 - c.x0) * dy - (c.y1 - c.y0) * dx);\n const d2 = Math.abs((c.x2 - c.x0) * dy - (c.y2 - c.y0) * dx);\n return (d1 + d2) * (d1 + d2) <= tolSq * chordSq;\n}\n\n/** De Casteljau split at t = 0.5 → [left, right]. */\nfunction splitCubic(c: Cubic): [Cubic, Cubic] {\n const ax = (c.x0 + c.x1) / 2;\n const ay = (c.y0 + c.y1) / 2;\n const bx = (c.x1 + c.x2) / 2;\n const by = (c.y1 + c.y2) / 2;\n const cx = (c.x2 + c.x3) / 2;\n const cy = (c.y2 + c.y3) / 2;\n const abx = (ax + bx) / 2;\n const aby = (ay + by) / 2;\n const bcx = (bx + cx) / 2;\n const bcy = (by + cy) / 2;\n const mx = (abx + bcx) / 2;\n const my = (aby + bcy) / 2;\n return [\n { x0: c.x0, y0: c.y0, x1: ax, y1: ay, x2: abx, y2: aby, x3: mx, y3: my },\n { x0: mx, y0: my, x1: bcx, y1: bcy, x2: cx, y2: cy, x3: c.x3, y3: c.y3 },\n ];\n}\n\n/**\n * Adaptive cubic flattening + prefix arc length (2026-07-16, the @ice/ground\n * wires pass: stroke tessellation and dash placement both ride this). Emit\n * density follows curvature — flat spans emit one segment regardless of\n * length; tolerance is in the cubic's OWN space (the ground renderer passes\n * screen-px cubics with ~0.25 px tolerance, so density tracks zoom for free).\n * `maxDepth` bounds pathological inputs (2^depth segments worst case).\n */\nexport function tessellateCubic(c: Cubic, tolerance = 0.25, maxDepth = 16): Tessellation {\n const pts: number[] = [c.x0, c.y0];\n const tolSq = tolerance * tolerance;\n const walk = (cur: Cubic, depth: number): void => {\n if (depth >= maxDepth || flatEnough(cur, tolSq)) {\n pts.push(cur.x3, cur.y3);\n return;\n }\n const [l, r] = splitCubic(cur);\n walk(l, depth + 1);\n walk(r, depth + 1);\n };\n walk(c, 0);\n\n const n = pts.length / 2;\n const points = new Float32Array(pts);\n const arcLength = new Float32Array(n);\n let acc = 0;\n for (let i = 1; i < n; i++) {\n const dx = (pts[i * 2] as number) - (pts[i * 2 - 2] as number);\n const dy = (pts[i * 2 + 1] as number) - (pts[i * 2 - 1] as number);\n acc += Math.hypot(dx, dy);\n arcLength[i] = acc;\n }\n return { points, arcLength };\n}\n\n/** Distance from a point to a line segment. */\nexport function distanceToSegment(\n px: number,\n py: number,\n ax: number,\n ay: number,\n bx: number,\n by: number,\n): number {\n const dx = bx - ax;\n const dy = by - ay;\n const lenSq = dx * dx + dy * dy;\n let t = 0;\n if (lenSq > 0) {\n t = ((px - ax) * dx + (py - ay) * dy) / lenSq;\n t = Math.max(0, Math.min(1, t));\n }\n const cx = ax + t * dx;\n const cy = ay + t * dy;\n return Math.hypot(px - cx, py - cy);\n}\n\n/**\n * Min distance from a point to the curve via polyline sampling. 32 samples is\n * ample for hit thresholds of a few px; error shrinks with curve flatness.\n */\nexport function distanceToCubic(px: number, py: number, c: Cubic, samples = 32): number {\n let best = Number.POSITIVE_INFINITY;\n let prev = cubicPoint(c, 0);\n for (let i = 1; i <= samples; i++) {\n const cur = cubicPoint(c, i / samples);\n const d = distanceToSegment(px, py, prev.x, prev.y, cur.x, cur.y);\n if (d < best) best = d;\n prev = cur;\n }\n return best;\n}\n","/**\n * CSS-style cubic-bezier timing functions (pure math — kernel).\n *\n * `cubicBezierEase(x1, y1, x2, y2)` builds f(t): the exact curve CSS\n * `transition-timing-function: cubic-bezier(…)` runs, so GL surfaces can\n * match DOM transitions beat-for-beat (the composite-quad lift mirrors the\n * DOM card lift's spring, cubic-bezier(0.2, 0.9, 0.3, 1.2)). y outside [0,1]\n * (overshoot springs) is legal and expected; x1/x2 are clamped to [0,1] per\n * spec so x(u) stays monotone and invertible.\n */\n\n/** Bernstein sample with P0=0, P3=1 (one axis of the timing curve). */\nfunction sample(u: number, p1: number, p2: number): number {\n const v = 1 - u;\n return 3 * v * v * u * p1 + 3 * v * u * u * p2 + u * u * u;\n}\n\nexport function cubicBezierEase(x1: number, y1: number, x2: number, y2: number): (t: number) => number {\n const cx1 = Math.min(1, Math.max(0, x1));\n const cx2 = Math.min(1, Math.max(0, x2));\n const sampleDx = (u: number): number => {\n const v = 1 - u;\n return 3 * v * v * cx1 + 6 * v * u * (cx2 - cx1) + 3 * u * u * (1 - cx2);\n };\n\n return (t: number): number => {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n // Solve x(u) = t: Newton first (fast for well-behaved curves)…\n let u = t;\n for (let i = 0; i < 8; i++) {\n const err = sample(u, cx1, cx2) - t;\n if (Math.abs(err) < 1e-6) return sample(u, y1, y2);\n const d = sampleDx(u);\n if (d < 1e-6) break; // flat spot — Newton would explode\n u = Math.min(1, Math.max(0, u - err / d));\n }\n // …bisection fallback (x is monotone under the clamp).\n let lo = 0;\n let hi = 1;\n u = t;\n while (hi - lo > 1e-6) {\n if (sample(u, cx1, cx2) < t) lo = u;\n else hi = u;\n u = (lo + hi) / 2;\n }\n return sample(u, y1, y2);\n };\n}\n","/**\n * Nav-flight math (design-006 §2/§4 — the portal zoom, T1 camera-flight half).\n *\n * Pure math, no ECS/DOM. Conventions are coords.ts's (Law 13): camera {x,y} =\n * world point at the viewport top-left, zoom = screen px per world unit,\n * `screen = (world − cam)·zoom`.\n *\n * The portal embedding: a container's content coordinates are FRAME-LOCAL\n * (design-001 §5.1) — the transition DEFINES the embedding by mapping the\n * arrival camera's visible rect onto the container's body rect (`portalAffine`,\n * aspect-fit, centers aligned). With that affine fixed, both transition layers\n * ride ONE camera: the destination frame renders under `c(t)` directly; the\n * departed frame renders under `c(t) ∘ A` where A maps departed-frame coords\n * into destination-frame coords. Continuity at the cut is exact by\n * construction (`solveFlightStart`), and no drift is possible mid-flight —\n * there is no second clock.\n *\n * Numerics locked by the mock (2026-07-15, three rounds of field testing):\n * - the progress spring uses the CLOSED-FORM critically-damped solution —\n * semi-implicit Euler diverges once ω·dt nears 1 (a fast exit response on\n * one dropped frame sent the mock's camera to zoom 1501);\n * - the path interpolates zoom in LOG space (constant perceived zoom\n * velocity — van Wijk & Nuij) with the view center linear in 1/zoom, which\n * is exactly an anchored zoom whenever a fixed screen point exists;\n * - flights beyond `maxOctaves` must be depth-capped (`capFlightStart`):\n * sweeping a DOM plane's raster scale ~30× in one flight outruns\n * Chromium's async tile re-raster (stale/missing tiles, persisting at\n * rest) — the capped flight is presented as a crossfade-through-zoom.\n */\nimport type { CameraState } from \"./coords\";\nimport type { Rect } from \"./shapes\";\n\n/** Uniform scale + translate: `A(q) = o + q·s`. */\nexport interface PortalAffine {\n readonly s: number;\n readonly ox: number;\n readonly oy: number;\n}\n\n/** The world rect a camera shows through a viewport. */\nexport function visibleRect(cam: CameraState, vpW: number, vpH: number): Rect {\n return { x: cam.x, y: cam.y, width: vpW / cam.zoom, height: vpH / cam.zoom };\n}\n\n/**\n * The portal embedding: map `arrival` (the world rect the arrival camera will\n * show, in the CHILD frame's coords) onto `portal` (the container's body rect,\n * in the PARENT frame's coords). Aspect-FIT with centers aligned (design-006\n * §8.3 — the card chrome absorbs the letterbox).\n */\nexport function portalAffine(arrival: Rect, portal: Rect): PortalAffine {\n const s = Math.min(portal.width / arrival.width, portal.height / arrival.height);\n return {\n s,\n ox: portal.x + portal.width / 2 - (arrival.x + arrival.width / 2) * s,\n oy: portal.y + portal.height / 2 - (arrival.y + arrival.height / 2) * s,\n };\n}\n\nexport function invertAffine(a: PortalAffine): PortalAffine {\n return { s: 1 / a.s, ox: -a.ox / a.s, oy: -a.oy / a.s };\n}\n\n/** `(outer ∘ inner)(q) = outer(inner(q))` — for multi-level exit portals. */\nexport function composeAffine(outer: PortalAffine, inner: PortalAffine): PortalAffine {\n return { s: outer.s * inner.s, ox: outer.ox + inner.ox * outer.s, oy: outer.oy + inner.oy * outer.s };\n}\n\n/**\n * Continuity solve: the camera `c0` (in the DESTINATION frame) under which\n * departed-frame content mapped through `A` (departed → destination coords)\n * renders EXACTLY as it did under `camPre` (in the departed frame) the instant\n * before the cut. Derivation: a departed point q renders at\n * `(A(q) − c0)·z0 = q·(A.s·z0) + (A.o − c0)·z0`; matching `(q − camPre)·zPre`\n * coefficient-wise gives z0 and the origin below. Zoom limits deliberately do\n * NOT apply here — flight paths transit far outside the user-gesture band\n * (design-006 §3.1); only the ARRIVAL camera is clamped by the caller.\n */\nexport function solveFlightStart(A: PortalAffine, camPre: CameraState): CameraState {\n return {\n x: A.ox + camPre.x * A.s,\n y: A.oy + camPre.y * A.s,\n zoom: camPre.zoom / A.s,\n };\n}\n\n/** Zoom distance in octaves — the flight-length measure (design-006 §4/§5). */\nexport function flightOctaves(from: CameraState, to: CameraState): number {\n return Math.abs(Math.log2(to.zoom / from.zoom));\n}\n\n/**\n * Depth-cap a flight start (design-006 §5): beyond `maxOctaves`, clamp the\n * start zoom to `capFactor ×` the arrival zoom (dive direction preserved),\n * keeping the exact start's view CENTER — the portal anchor — so the motion\n * still comes from/goes to the right place. `capped: true` means the caller\n * must present the flight as a crossfade (frozen departing cover + incoming\n * fade-in): geometric continuity is unpresentable at that raster-scale swing.\n */\nexport function capFlightStart(\n exact: CameraState,\n arrival: CameraState,\n vpW: number,\n vpH: number,\n maxOctaves: number,\n capFactor: number,\n): { c0: CameraState; capped: boolean } {\n if (flightOctaves(exact, arrival) <= maxOctaves) return { c0: exact, capped: false };\n const zCap = exact.zoom > arrival.zoom ? arrival.zoom * capFactor : arrival.zoom / capFactor;\n return {\n c0: {\n x: exact.x + (vpW / 2) * (1 / exact.zoom - 1 / zCap),\n y: exact.y + (vpH / 2) * (1 / exact.zoom - 1 / zCap),\n zoom: zCap,\n },\n capped: true,\n };\n}\n\n/**\n * The flight path `c(p)`, p ∈ [0,1]: zoom log-lerped (constant perceived zoom\n * velocity); view CENTER linear in 1/zoom — exactly an anchored zoom whenever\n * a fixed screen point exists between the endpoints, a graceful blend\n * otherwise. Endpoints are exact: c(0) = c0, c(1) = c1.\n */\nexport function flightCamera(\n c0: CameraState,\n c1: CameraState,\n p: number,\n vpW: number,\n vpH: number,\n): CameraState {\n const zoom = Math.exp(Math.log(c0.zoom) + (Math.log(c1.zoom) - Math.log(c0.zoom)) * p);\n const inv0 = 1 / c0.zoom;\n const inv1 = 1 / c1.zoom;\n const inv = 1 / zoom;\n const w = Math.abs(inv1 - inv0) < 1e-12 ? p : (inv - inv0) / (inv1 - inv0);\n const cx = c0.x + vpW * inv0 * 0.5 + (c1.x + vpW * inv1 * 0.5 - (c0.x + vpW * inv0 * 0.5)) * w;\n const cy = c0.y + vpH * inv0 * 0.5 + (c1.y + vpH * inv1 * 0.5 - (c0.y + vpH * inv0 * 0.5)) * w;\n return { x: cx - vpW * inv * 0.5, y: cy - vpH * inv * 0.5, zoom };\n}\n\n/**\n * One step of the critically-damped progress spring toward 1, in CLOSED FORM:\n * with u = 1 − p, the exact solution is `u(t) = (u₀ + Bt)·e^(−ωt)`,\n * `B = −v₀ + ω·u₀`. Unconditionally stable at ANY dt — the discretized form\n * (semi-implicit Euler) diverges once ω·dt approaches 1, which one dropped\n * frame at a fast response reaches easily (mock-measured, 2026-07-15).\n * From rest (v=0) the approach is monotonic: p never overshoots 1.\n */\nexport function springStep(\n p: number,\n v: number,\n omega: number,\n dtSec: number,\n): { p: number; v: number } {\n const u = 1 - p;\n const B = -v + omega * u;\n const decay = Math.exp(-omega * dtSec);\n const u2 = (u + B * dtSec) * decay;\n const du2 = (B - omega * (u + B * dtSec)) * decay;\n return { p: 1 - u2, v: -du2 };\n}\n","/**\n * Pure auto-layout math (2026-07-17, James: cards dropped into a folder \"just\n * pile up on each other\" — and, later, an explicit desktop-style Clean Up).\n *\n * Two primitives, two products, one law each:\n * - `insertSlot` — place ONE newcomer near a drop hint without moving\n * anything: newcomers get a free slot, incumbents never move. Consumed by\n * the drop-consume path (l3-behave). Candidates are edge-aligned to the\n * incumbents (flush right/below/left/above with a gutter), so successive\n * drops grow aligned rows and columns instead of a global imposed grid.\n * - `packLayout` — bottom-left candidate packing for the explicit\n * \"Clean Up\" command (v2 2026-07-17, James: shelves were \"not really\n * efficient\" and selection packs \"overlay on top of unselected widgets\"):\n * items flow in reading order (current y, then x, then index) and each\n * takes the lowest-then-leftmost free spot, so small cards fill the air\n * beside tall ones instead of opening a new shelf. `obstacles` rects are\n * honored as immovable — a scoped pack flows AROUND bystanders. Still\n * \"my mess, straightened\": deterministic, anchored at the cluster's own\n * top-left, idempotent on packed input (pinned by test).\n * - `layerGraph` — the Unreal-Blueprint-style arrange for WIRED widgets:\n * Sugiyama-lite layered layout (longest-path ranks along edge direction,\n * barycenter ordering, columns left→right, vertically centered). Callers\n * lay out each connected component with this and pack the resulting\n * blocks with `packLayout`.\n *\n * Plain structs in, plain structs out (Law 13): no ECS, no DOM, no camera.\n * All coordinates live in ONE frame — callers convert (container-local for\n * folder drops, world for canvas clean-up) before and after.\n */\n\nexport interface LayoutRect {\n readonly x: number;\n readonly y: number;\n readonly w: number;\n readonly h: number;\n}\n\nexport interface LayoutSize {\n readonly w: number;\n readonly h: number;\n}\n\nexport interface LayoutPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** True when the rects are closer than `gutter` on BOTH axes (≥gutter on either axis = fine). */\nfunction crowds(a: LayoutRect, b: LayoutRect, gutter: number): boolean {\n return (\n a.x < b.x + b.w + gutter &&\n b.x < a.x + a.w + gutter &&\n a.y < b.y + b.h + gutter &&\n b.y < a.y + a.h + gutter\n );\n}\n\nfunction isFree(x: number, y: number, size: LayoutSize, incumbents: readonly LayoutRect[], gutter: number): boolean {\n const r = { x, y, w: size.w, h: size.h };\n for (const i of incumbents) {\n if (crowds(r, i, gutter)) return false;\n }\n return true;\n}\n\n/**\n * Nearest free slot to `hint` for a `size` newcomer among `incumbents`.\n *\n * The hint wins verbatim when it is already free (a deliberate drop into\n * empty space is user intent — don't second-guess it). Otherwise candidates\n * flush against each incumbent's edges (top- and far-aligned variants) are\n * ranked by squared distance to the hint; ties resolve to the first-seen\n * candidate (stable in incumbent order — deterministic across runs). The\n * fallback — a spot gutter-right of EVERYTHING — cannot crowd anyone, so a\n * slot always exists.\n */\nexport function insertSlot(\n incumbents: readonly LayoutRect[],\n size: LayoutSize,\n hint: LayoutPoint,\n gutter: number,\n): { x: number; y: number } {\n if (incumbents.length === 0 || isFree(hint.x, hint.y, size, incumbents, gutter)) {\n return { x: hint.x, y: hint.y };\n }\n let best: { x: number; y: number } | undefined;\n let bestD = Number.POSITIVE_INFINITY;\n for (const i of incumbents) {\n const candidates = [\n { x: i.x + i.w + gutter, y: i.y }, // right, top-aligned\n { x: i.x, y: i.y + i.h + gutter }, // below, left-aligned\n { x: i.x - size.w - gutter, y: i.y }, // left, top-aligned\n { x: i.x, y: i.y - size.h - gutter }, // above, left-aligned\n { x: i.x + i.w + gutter, y: i.y + i.h - size.h }, // right, bottom-aligned\n { x: i.x + i.w - size.w, y: i.y + i.h + gutter }, // below, right-aligned\n ];\n for (const c of candidates) {\n if (!isFree(c.x, c.y, size, incumbents, gutter)) continue;\n const d = (c.x - hint.x) ** 2 + (c.y - hint.y) ** 2;\n if (d < bestD) {\n bestD = d;\n best = c;\n }\n }\n }\n if (best !== undefined) return best;\n let maxRight = Number.NEGATIVE_INFINITY;\n for (const i of incumbents) maxRight = Math.max(maxRight, i.x + i.w);\n return { x: maxRight + gutter, y: hint.y };\n}\n\nexport interface PackOpts {\n readonly gutter: number;\n /** Pack origin; defaults to the items' current bbox top-left (the cluster stays put). */\n readonly origin?: LayoutPoint;\n /**\n * Band wrap width; defaults to a near-square derivation (√(total area × 1.6),\n * never narrower than the widest item). Soft: an item that fits nowhere\n * inside the band still places (lowest spot, band ignored) rather than\n * failing.\n */\n readonly maxWidth?: number;\n /**\n * Immovable rects the pack must flow AROUND (e.g. unselected widgets when\n * arranging a selection). Never returned, never moved, never crowded.\n */\n readonly obstacles?: readonly LayoutRect[];\n}\n\n/**\n * Bottom-left candidate packing: items in reading order of their CURRENT\n * positions (strict y, then x, then input index) each take the\n * lowest-then-leftmost free spot from the candidate set (the origin, plus\n * gutter-flush right-of and below-of every placed/obstacle rect, plus the\n * band-left row start under each). Dense with mixed sizes — small cards fill\n * the air beside tall ones — and obstacle-aware. Returns placements parallel\n * to the input array.\n */\nexport function packLayout(items: readonly LayoutRect[], opts: PackOpts): Array<{ x: number; y: number }> {\n if (items.length === 0) return [];\n const gutter = opts.gutter;\n\n let ox: number;\n let oy: number;\n if (opts.origin !== undefined) {\n ox = opts.origin.x;\n oy = opts.origin.y;\n } else {\n ox = Number.POSITIVE_INFINITY;\n oy = Number.POSITIVE_INFINITY;\n for (const it of items) {\n ox = Math.min(ox, it.x);\n oy = Math.min(oy, it.y);\n }\n }\n\n let maxWidth = opts.maxWidth;\n if (maxWidth === undefined) {\n let area = 0;\n let widest = 0;\n for (const it of items) {\n area += (it.w + gutter) * (it.h + gutter);\n widest = Math.max(widest, it.w);\n }\n maxWidth = Math.max(widest, Math.sqrt(area * 1.6));\n }\n\n const order = items\n .map((_, i) => i)\n .sort((a, b) => {\n const ia = items[a] as LayoutRect;\n const ib = items[b] as LayoutRect;\n return ia.y - ib.y || ia.x - ib.x || a - b;\n });\n\n // Feasibility set: obstacles first (they also seed candidates), then\n // every placed item as it lands.\n const placed: LayoutRect[] = [...(opts.obstacles ?? [])];\n const out = new Array<{ x: number; y: number }>(items.length);\n for (const idx of order) {\n const it = items[idx] as LayoutRect;\n const cands: LayoutPoint[] = [{ x: ox, y: oy }];\n for (const r of placed) {\n cands.push({ x: r.x + r.w + gutter, y: r.y }); // right, top-aligned\n cands.push({ x: r.x, y: r.y + r.h + gutter }); // below, left-aligned\n cands.push({ x: ox, y: r.y + r.h + gutter }); // band-left row start\n }\n let best: LayoutPoint | undefined;\n // Pass 1 honors the band; pass 2 drops it (an oversize item or a wall of\n // obstacles must still place — the below-everything candidate is always\n // free, so pass 2 cannot come up empty).\n for (const inBand of [true, false]) {\n for (const c of cands) {\n if (c.x < ox || c.y < oy) continue;\n if (inBand && c.x + it.w > ox + maxWidth) continue;\n if (!isFree(c.x, c.y, it, placed, gutter)) continue;\n if (best === undefined || c.y < best.y || (c.y === best.y && c.x < best.x)) best = c;\n }\n if (best !== undefined) break;\n }\n if (best === undefined) {\n // Defensive only (see pass-2 note above).\n let maxBottom = oy;\n for (const r of placed) maxBottom = Math.max(maxBottom, r.y + r.h);\n best = { x: ox, y: maxBottom + gutter };\n }\n out[idx] = { x: best.x, y: best.y };\n placed.push({ x: best.x, y: best.y, w: it.w, h: it.h });\n }\n return out;\n}\n\nexport interface LayerGraphOpts {\n /** Horizontal gap between columns (leave room for wires to breathe). */\n readonly gapX: number;\n /** Vertical gap between nodes inside a column. */\n readonly gapY: number;\n /**\n * Wrap the column run into stacked BANDS when the unwrapped width would\n * exceed this (carriage-return style: each band flows left→right, bands\n * stack top→down with a 2×gapY separator). Omit for a single band — a\n * graph is inherently wide and only wraps when the caller says the canvas\n * band demands it.\n */\n readonly maxWidth?: number;\n}\n\n/**\n * Layered graph layout (Sugiyama-lite) — the Unreal-Blueprint-style arrange\n * for wired widgets. Rank = longest path from the sources along edge\n * direction (a DFS drops back edges, so cycles are safe); columns flow\n * left→right; nodes stack top→down within a column. Ordering = alternating\n * barycenter sweeps with the BEST ordering kept (counted wire crossings),\n * then the classic transpose refinement (adjacent swaps that strictly\n * reduce crossings) — not provably minimal, but the standard practical\n * pair. Columns center vertically on their band's tallest. Placements are\n * relative to (0,0) — callers anchor the block. Deterministic: all\n * orderings tie-break on node index.\n */\nexport function layerGraph(\n nodes: readonly LayoutSize[],\n edges: readonly (readonly [number, number])[],\n opts: LayerGraphOpts,\n): Array<{ x: number; y: number }> {\n const n = nodes.length;\n if (n === 0) return [];\n\n // Drop self-edges; find back edges via iterative DFS (in index order).\n const outAdj: number[][] = Array.from({ length: n }, () => []);\n for (const [u, v] of edges) {\n if (u !== v && u >= 0 && u < n && v >= 0 && v < n) outAdj[u]?.push(v);\n }\n const kept: Array<[number, number]> = [];\n const state = new Array<0 | 1 | 2>(n).fill(0); // 0 unseen, 1 on stack, 2 done\n for (let root = 0; root < n; root++) {\n if (state[root] !== 0) continue;\n const stack: Array<{ u: number; i: number }> = [{ u: root, i: 0 }];\n state[root] = 1;\n while (stack.length > 0) {\n const top = stack[stack.length - 1] as { u: number; i: number };\n const adj = outAdj[top.u] as number[];\n if (top.i < adj.length) {\n const v = adj[top.i] as number;\n top.i += 1;\n if (state[v] === 1) continue; // back edge — dropped\n kept.push([top.u, v]);\n if (state[v] === 0) {\n state[v] = 1;\n stack.push({ u: v, i: 0 });\n }\n } else {\n state[top.u] = 2;\n stack.pop();\n }\n }\n }\n\n // Longest-path ranks over the kept DAG (topological relaxation).\n const keptOut: number[][] = Array.from({ length: n }, () => []);\n const indeg = new Array<number>(n).fill(0);\n for (const [u, v] of kept) {\n keptOut[u]?.push(v);\n indeg[v] = (indeg[v] as number) + 1;\n }\n const rank = new Array<number>(n).fill(0);\n const queue: number[] = [];\n for (let i = 0; i < n; i++) if (indeg[i] === 0) queue.push(i);\n for (let qi = 0; qi < queue.length; qi++) {\n const u = queue[qi] as number;\n for (const v of keptOut[u] as number[]) {\n rank[v] = Math.max(rank[v] as number, (rank[u] as number) + 1);\n indeg[v] = (indeg[v] as number) - 1;\n if (indeg[v] === 0) queue.push(v);\n }\n }\n\n const maxRank = Math.max(...rank);\n const layers: number[][] = Array.from({ length: maxRank + 1 }, () => []);\n for (let i = 0; i < n; i++) layers[rank[i] as number]?.push(i);\n\n // Barycenter ordering: neighbors (both directions) pull a node toward\n // their average slot in the adjacent fixed layer.\n const neighbors: number[][] = Array.from({ length: n }, () => []);\n for (const [u, v] of kept) {\n neighbors[u]?.push(v);\n neighbors[v]?.push(u);\n }\n const slot = new Array<number>(n).fill(0);\n const reSlot = (): void => {\n for (const layer of layers) {\n layer.forEach((node, s) => {\n slot[node] = s;\n });\n }\n };\n reSlot();\n\n /** Wire crossings across every adjacent layer pair, under the current slots. */\n const crossings = (): number => {\n let total = 0;\n for (let li = 0; li < maxRank; li++) {\n const pairs: Array<[number, number]> = [];\n for (const [u, v] of kept) {\n if (rank[u] === li && rank[v] === li + 1) pairs.push([slot[u] as number, slot[v] as number]);\n }\n for (let i = 0; i < pairs.length; i++) {\n for (let j = i + 1; j < pairs.length; j++) {\n const a = pairs[i] as [number, number];\n const b = pairs[j] as [number, number];\n if ((a[0] - b[0]) * (a[1] - b[1]) < 0) total += 1;\n }\n }\n }\n return total;\n };\n\n // Alternating barycenter sweeps; a sweep can WORSEN crossings, so the best\n // ordering seen is kept, not the last.\n const snapshot = (): number[][] => layers.map((l) => [...l]);\n const restore = (saved: number[][]): void => {\n saved.forEach((l, li) => {\n layers[li] = [...l];\n });\n reSlot();\n };\n let best = snapshot();\n let bestX = crossings();\n for (let sweep = 0; sweep < 4 && bestX > 0; sweep++) {\n const forward = sweep % 2 === 0;\n for (let li = forward ? 1 : maxRank - 1; forward ? li <= maxRank : li >= 0; li += forward ? 1 : -1) {\n const layer = layers[li] as number[];\n const bary = (node: number): number => {\n const ns = (neighbors[node] as number[]).filter((m) => Math.abs((rank[m] as number) - li) === 1);\n if (ns.length === 0) return slot[node] as number;\n return ns.reduce((sum, m) => sum + (slot[m] as number), 0) / ns.length;\n };\n layer.sort((a, b) => bary(a) - bary(b) || a - b);\n reSlot();\n }\n const x = crossings();\n if (x < bestX) {\n bestX = x;\n best = snapshot();\n }\n }\n restore(best);\n\n // Transpose refinement (the classic Sugiyama tail): adjacent swaps that\n // STRICTLY reduce crossings, until a quiet round. Catches the barycenter's\n // tie stalls.\n let improved = bestX > 0;\n for (let round = 0; round < 4 && improved; round++) {\n improved = false;\n for (const layer of layers) {\n for (let s = 0; s + 1 < layer.length; s++) {\n const a = layer[s] as number;\n const b = layer[s + 1] as number;\n layer[s] = b;\n layer[s + 1] = a;\n reSlot();\n const x = crossings();\n if (x < bestX) {\n bestX = x;\n improved = true;\n } else {\n layer[s] = a;\n layer[s + 1] = b;\n reSlot();\n }\n }\n }\n }\n\n // Coordinates. Column widths first; then the column run is partitioned\n // into bands (single band unless maxWidth demands wrapping); each band\n // flows left→right from x=0, stacks below the previous with a 2×gapY\n // separator, and centers its columns on the band's tallest.\n const colW = (layers as number[][]).map((layer) => {\n let widest = 0;\n for (const node of layer) widest = Math.max(widest, (nodes[node] as LayoutSize).w);\n return widest;\n });\n const colH = (layers as number[][]).map((layer) =>\n layer.reduce((sum, node, i) => sum + (nodes[node] as LayoutSize).h + (i > 0 ? opts.gapY : 0), 0),\n );\n\n const bands: number[][] = [];\n if (opts.maxWidth === undefined) {\n bands.push((layers as number[][]).map((_, li) => li));\n } else {\n let cur: number[] = [];\n let width = 0;\n for (let li = 0; li <= maxRank; li++) {\n const grown = (cur.length > 0 ? width + opts.gapX : 0) + (colW[li] as number);\n if (cur.length > 0 && grown > opts.maxWidth) {\n bands.push(cur);\n cur = [li];\n width = colW[li] as number;\n } else {\n cur.push(li);\n width = grown;\n }\n }\n if (cur.length > 0) bands.push(cur);\n }\n\n const out = new Array<{ x: number; y: number }>(n);\n let bandTop = 0;\n for (const band of bands) {\n let tallest = 0;\n for (const li of band) tallest = Math.max(tallest, colH[li] as number);\n let x = 0;\n for (const li of band) {\n let y = bandTop + (tallest - (colH[li] as number)) / 2;\n for (const node of layers[li] as number[]) {\n out[node] = { x, y };\n y += (nodes[node] as LayoutSize).h + opts.gapY;\n }\n x += (colW[li] as number) + opts.gapX;\n }\n bandTop += tallest + opts.gapY * 2;\n }\n return out;\n}\n","/**\n * @ice/kernel — pure math. Plain structs in, plain structs out.\n * Import wall: nothing but `rbush` (named exception — zero-dep R-tree).\n */\nexport const KERNEL_VERSION = \"0.0.0\";\n\nexport * from \"./shapes\";\nexport * from \"./coords\";\nexport * from \"./snap\";\nexport * from \"./spatial-index\";\nexport * from \"./zoom-bands\";\nexport * from \"./eviction\";\nexport * from \"./anchors\";\nexport * from \"./bezier\";\nexport * from \"./easing\";\nexport * from \"./nav-flight\";\nexport * from \"./layout\";\n"],"mappings":";AAqBO,SAAS,WAAW,GAAe;AACxC,SAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE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