@vibecook/ice 0.11.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 (381) 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-VGVDJZSP.js → chunk-DYK6KNLG.js} +13206 -7387
  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 +33 -12
  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-2TNVB2ON.js +0 -1163
  324. package/dist/chunk-2TNVB2ON.js.map +0 -1
  325. package/dist/chunk-OR5FNVUE.js.map +0 -1
  326. package/dist/chunk-Q665T4L7.js +0 -681
  327. package/dist/chunk-Q665T4L7.js.map +0 -1
  328. package/dist/chunk-VGVDJZSP.js.map +0 -1
  329. package/dist/ground.js +0 -1108
  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 -101
  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-contract.d.ts +0 -28
  348. package/dist/types/packages/ground/src/passes/grid-magnet-pass.d.ts +0 -2
  349. package/dist/types/packages/ground/src/passes/grid-magnet.d.ts +0 -31
  350. package/dist/types/packages/ground/src/passes/grid.d.ts +0 -10
  351. package/dist/types/packages/ground/src/passes/guides-collect.d.ts +0 -14
  352. package/dist/types/packages/ground/src/passes/guides.d.ts +0 -3
  353. package/dist/types/packages/ground/src/passes/magnet-collect.d.ts +0 -63
  354. package/dist/types/packages/ground/src/passes/soup-collect.d.ts +0 -35
  355. package/dist/types/packages/ground/src/passes/soup-mesh.d.ts +0 -8
  356. package/dist/types/packages/ground/src/passes/wires-collect.d.ts +0 -35
  357. package/dist/types/packages/ground/src/passes/wires.d.ts +0 -10
  358. package/dist/types/packages/ground/src/poles.d.ts +0 -47
  359. package/dist/types/packages/ground/src/renderer.d.ts +0 -15
  360. package/dist/types/packages/ice/src/ground.d.ts +0 -1
  361. package/dist/types/packages/ice/src/r3f.d.ts +0 -1
  362. package/dist/types/packages/kernel/src/eviction.d.ts +0 -23
  363. package/dist/types/packages/kernel/src/zoom-bands.d.ts +0 -19
  364. package/dist/types/packages/r3f/src/bridge.d.ts +0 -129
  365. package/dist/types/packages/r3f/src/composite-material.d.ts +0 -26
  366. package/dist/types/packages/r3f/src/compositor-pass.d.ts +0 -105
  367. package/dist/types/packages/r3f/src/dev-write-trap.d.ts +0 -30
  368. package/dist/types/packages/r3f/src/gl-root.d.ts +0 -96
  369. package/dist/types/packages/r3f/src/gl-router.d.ts +0 -70
  370. package/dist/types/packages/r3f/src/index.d.ts +0 -17
  371. package/dist/types/packages/r3f/src/island-state.d.ts +0 -112
  372. package/dist/types/packages/r3f/src/island.d.ts +0 -13
  373. package/dist/types/packages/r3f/src/pool.d.ts +0 -56
  374. package/dist/types/packages/r3f/src/preview-capture.d.ts +0 -19
  375. package/dist/types/packages/r3f/src/resource-registry.d.ts +0 -30
  376. package/dist/types/packages/r3f/src/self-sustain.d.ts +0 -39
  377. package/dist/types/packages/r3f/src/use-island-frame.d.ts +0 -39
  378. package/dist/types/packages/react/src/infinite-canvas.d.ts +0 -140
  379. package/dist/types/packages/react/src/preview-snapshots.d.ts +0 -17
  380. package/dist/types/packages/react/src/widget-preview.d.ts +0 -14
  381. package/dist/types/packages/react/src/widget-root.d.ts +0 -33
@@ -1,1163 +0,0 @@
1
- import {
2
- Camera,
3
- CursorVisual,
4
- Follows,
5
- Grab,
6
- HandleSpec,
7
- MeasuredSize,
8
- NO_MODS,
9
- Opacity,
10
- Position,
11
- PrefabId,
12
- PresenceInfo,
13
- SelectionBox,
14
- Size,
15
- compareStackOrder,
16
- createSiblingOrderIndex,
17
- defineQuery,
18
- widgets
19
- } from "./chunk-VGVDJZSP.js";
20
- import {
21
- planeCssTransform,
22
- worldToScreen
23
- } from "./chunk-OR5FNVUE.js";
24
-
25
- // ../dom/src/host.ts
26
- var CONTAINER_STYLE = {
27
- overflow: "hidden",
28
- touchAction: "none",
29
- userSelect: "none"
30
- };
31
- var PLANE_STYLE = {
32
- position: "absolute",
33
- left: "0",
34
- top: "0",
35
- transformOrigin: "0 0",
36
- willChange: "transform"
37
- };
38
- function createCanvasHost(container) {
39
- const view = container.ownerDocument.defaultView;
40
- const position = container.style.position !== "" ? container.style.position : view?.getComputedStyle(container).position ?? "";
41
- const promoteToRelative = position === "" || position === "static";
42
- if (promoteToRelative) container.style.position = "relative";
43
- const priorContainerStyle = Object.keys(CONTAINER_STYLE).map((prop) => {
44
- const cssName = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
45
- return [cssName, container.style.getPropertyValue(cssName)];
46
- });
47
- Object.assign(container.style, CONTAINER_STYLE);
48
- const contentPlane = container.ownerDocument.createElement("div");
49
- Object.assign(contentPlane.style, PLANE_STYLE);
50
- container.appendChild(contentPlane);
51
- return {
52
- container,
53
- contentPlane,
54
- dispose() {
55
- contentPlane.remove();
56
- if (promoteToRelative) container.style.removeProperty("position");
57
- for (const [cssName, prior] of priorContainerStyle) {
58
- if (prior !== "") container.style.setProperty(cssName, prior);
59
- else container.style.removeProperty(cssName);
60
- }
61
- }
62
- };
63
- }
64
-
65
- // ../dom/src/planes.ts
66
- var LIFTED_PLANE_STYLE = {
67
- position: "absolute",
68
- left: "0",
69
- top: "0",
70
- transformOrigin: "0 0",
71
- willChange: "transform",
72
- // The ONE explicit z in the plane sandwich (2026-07-19): in-container app
73
- // chrome may slot BETWEEN the planes with z-index 1 — resting widgets
74
- // slide under it while the dragged (promoted) widget floats over it. DOM
75
- // order alone leaves no gap for that; everything else stays order-stacked.
76
- zIndex: "2"
77
- };
78
- function createPlanes(host) {
79
- const lifted = host.container.ownerDocument.createElement("div");
80
- Object.assign(lifted.style, LIFTED_PLANE_STYLE);
81
- host.container.appendChild(lifted);
82
- return {
83
- content: host.contentPlane,
84
- lifted,
85
- // Without this a React StrictMode remount stacks a second P3
86
- // (2026-07-11 reflector-teardown sweep, with the grid-canvas fix).
87
- dispose() {
88
- lifted.remove();
89
- }
90
- };
91
- }
92
-
93
- // ../dom/src/reflectors/plane-transform.ts
94
- function createPlaneTransformReflector(host) {
95
- let writes = 0;
96
- return {
97
- name: "plane-transform",
98
- observe: { resources: [Camera] },
99
- flush(world) {
100
- const camera = world.getResource(Camera);
101
- if (camera === void 0) return;
102
- const { tx, ty, scale } = planeCssTransform(camera);
103
- const transform = `translate(${tx}px, ${ty}px) scale(${scale})`;
104
- host.contentPlane.style.transform = transform;
105
- if (host.liftedPlane !== void 0) host.liftedPlane.style.transform = transform;
106
- writes++;
107
- },
108
- transformWrites: () => writes
109
- };
110
- }
111
-
112
- // ../dom/src/reflectors/graybox.ts
113
- var grayboxQuery = defineQuery([Position, Size]);
114
- function fillFor(entity) {
115
- const n = entity;
116
- const hash = (Math.imul(n, 2654435761) >>> 0) % 360;
117
- return `hsl(${hash}, 55%, 55%)`;
118
- }
119
- function writeGeom(div, x, y, w, h) {
120
- div.style.left = `${x}px`;
121
- div.style.top = `${y}px`;
122
- div.style.width = `${w}px`;
123
- div.style.height = `${h}px`;
124
- }
125
- function createGrayboxReflector(host) {
126
- const divs = /* @__PURE__ */ new Map();
127
- const geom = /* @__PURE__ */ new Map();
128
- const seen = /* @__PURE__ */ new Set();
129
- const doc = host.container.ownerDocument;
130
- let styleWrites = 0;
131
- return {
132
- name: "graybox",
133
- observe: { queries: [{ q: grayboxQuery, cols: [Position, Size] }] },
134
- flush(world) {
135
- seen.clear();
136
- let fragment = null;
137
- world.query(grayboxQuery).each((batch) => {
138
- const px = batch.col(Position).x;
139
- const py = batch.col(Position).y;
140
- const sw = batch.col(Size).w;
141
- const sh = batch.col(Size).h;
142
- for (const r of batch) {
143
- const entity = batch.entity(r);
144
- seen.add(entity);
145
- const x = px[r];
146
- const y = py[r];
147
- const w = sw[r];
148
- const h = sh[r];
149
- const existing = divs.get(entity);
150
- if (existing === void 0) {
151
- const div = doc.createElement("div");
152
- div.style.position = "absolute";
153
- div.style.background = fillFor(entity);
154
- writeGeom(div, x, y, w, h);
155
- styleWrites++;
156
- divs.set(entity, div);
157
- geom.set(entity, { x, y, w, h });
158
- if (fragment === null) fragment = doc.createDocumentFragment();
159
- fragment.appendChild(div);
160
- continue;
161
- }
162
- const prev = geom.get(entity);
163
- if (prev === void 0) {
164
- writeGeom(existing, x, y, w, h);
165
- styleWrites++;
166
- geom.set(entity, { x, y, w, h });
167
- } else if (prev.x !== x || prev.y !== y || prev.w !== w || prev.h !== h) {
168
- writeGeom(existing, x, y, w, h);
169
- styleWrites++;
170
- prev.x = x;
171
- prev.y = y;
172
- prev.w = w;
173
- prev.h = h;
174
- }
175
- }
176
- });
177
- if (fragment !== null) host.contentPlane.appendChild(fragment);
178
- for (const [entity, div] of divs) {
179
- if (seen.has(entity)) continue;
180
- div.remove();
181
- divs.delete(entity);
182
- geom.delete(entity);
183
- }
184
- },
185
- styleWrites: () => styleWrites,
186
- nodeCount: () => divs.size
187
- };
188
- }
189
-
190
- // ../dom/src/input-ownership.ts
191
- var KEYBOARD_CLAIM_ATTR = "data-canvas-keyboard";
192
- var CLAIM_OWNS_ESCAPE = "escape";
193
- var NO_CLAIM = { claimed: false, ownsEscape: false };
194
- function isEditableTarget(target) {
195
- if (target === null || !(target instanceof HTMLElement)) return false;
196
- const tag = target.tagName;
197
- return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || target.isContentEditable;
198
- }
199
- function keyboardClaimOf(target) {
200
- if (!(target instanceof Element)) return NO_CLAIM;
201
- const marked = target.closest(`[${KEYBOARD_CLAIM_ATTR}]`);
202
- if (marked === null) return NO_CLAIM;
203
- return { claimed: true, ownsEscape: marked.getAttribute(KEYBOARD_CLAIM_ATTR) === CLAIM_OWNS_ESCAPE };
204
- }
205
- var SCROLL_OPT_OUT_SELECTOR = `[${KEYBOARD_CLAIM_ATTR}], [data-canvas-interactive], input, textarea, select, [contenteditable=""], [contenteditable="true"]`;
206
- var SCROLL_EPS = 1;
207
- function hasScrollRoom(el, dx, dy) {
208
- const style = el.ownerDocument.defaultView?.getComputedStyle(el);
209
- if (style === void 0 || style === null) return false;
210
- if (Math.abs(dy) >= Math.abs(dx)) {
211
- if (dy === 0) return false;
212
- const oy = style.overflowY;
213
- if (oy !== "auto" && oy !== "scroll") return false;
214
- if (el.scrollHeight <= el.clientHeight + SCROLL_EPS) return false;
215
- return dy > 0 ? el.scrollTop + el.clientHeight < el.scrollHeight - SCROLL_EPS : el.scrollTop > SCROLL_EPS;
216
- }
217
- if (dx === 0) return false;
218
- const ox = style.overflowX;
219
- if (ox !== "auto" && ox !== "scroll") return false;
220
- if (el.scrollWidth <= el.clientWidth + SCROLL_EPS) return false;
221
- return dx > 0 ? el.scrollLeft + el.clientWidth < el.scrollWidth - SCROLL_EPS : el.scrollLeft > SCROLL_EPS;
222
- }
223
- function wheelCede(target, container, dx, dy) {
224
- if (!(target instanceof Element)) return false;
225
- if (dx === 0 && dy === 0) return false;
226
- let sawScrollableRoom = false;
227
- for (let el = target; el !== null && el !== container; el = el.parentElement) {
228
- if (el instanceof HTMLElement && hasScrollRoom(el, dx, dy)) sawScrollableRoom = true;
229
- if (sawScrollableRoom && el.matches(SCROLL_OPT_OUT_SELECTOR)) return true;
230
- }
231
- return false;
232
- }
233
-
234
- // ../dom/src/reflectors/dom-widgets.ts
235
- var geometryQuery = defineQuery([Position, Size]);
236
- var measuredQuery = defineQuery([MeasuredSize]);
237
- var grabQuery = defineQuery([Grab]);
238
- var opacityQuery = defineQuery([Opacity]);
239
- function writeGeom2(el, x, y, w, h) {
240
- el.style.left = `${x}px`;
241
- el.style.top = `${y}px`;
242
- el.style.width = `${w}px`;
243
- el.style.height = `${h}px`;
244
- }
245
- function createDomWidgetsReflector(host, world, store) {
246
- const doc = host.contentPlane.ownerDocument;
247
- const hosts = /* @__PURE__ */ new Map();
248
- const order = createSiblingOrderIndex(world);
249
- let lastSnapshot;
250
- let geometryWrites = 0;
251
- let inert = false;
252
- let geometryDirty = false;
253
- let promoteDirty = false;
254
- let opacityDirty = false;
255
- let orderDirty = false;
256
- const unsubs = [
257
- world.reactive.observeQuery(geometryQuery, () => {
258
- geometryDirty = true;
259
- }, { cols: [Position, Size] }),
260
- // MeasuredSize rides its own observer: adding it to geometryQuery's cols
261
- // would require it in the query and drop widgets without the rider.
262
- world.reactive.observeQuery(measuredQuery, () => {
263
- geometryDirty = true;
264
- }, { cols: [MeasuredSize] }),
265
- world.reactive.observeQuery(grabQuery, () => {
266
- promoteDirty = true;
267
- }, { cols: [] }),
268
- // Opacity is an optional rider like MeasuredSize: membership (attach/detach)
269
- // and value changes both arm the flag; detach resets the host to the
270
- // default via the `?? 1` read.
271
- world.reactive.observeQuery(opacityQuery, () => {
272
- opacityDirty = true;
273
- }, { cols: [Opacity] }),
274
- // Within-plane stacking IS the frame's ChildOf sibling sequence (petition
275
- // 8, superseding the StackZ sort that fixed the 2026-07-18 comment-box
276
- // paint bug). The wake names the relation (Related grammar — pure
277
- // reorders fire it); the ordinal cache's stamp check in updateOrder
278
- // keeps other-frame churn cheap.
279
- order.observe(() => {
280
- orderDirty = true;
281
- })
282
- ];
283
- function promotable(e) {
284
- const type = world.get(e, PrefabId)?.id;
285
- return typeof type !== "string" || widgets.get(type)?.surface !== "gl";
286
- }
287
- function readGeom(e) {
288
- const p = world.get(e, Position);
289
- const measured = world.get(e, MeasuredSize);
290
- const s = measured !== void 0 && measured.w > 0 ? measured : world.get(e, Size);
291
- return { x: p?.x ?? 0, y: p?.y ?? 0, w: s?.w ?? 0, h: s?.h ?? 0 };
292
- }
293
- function readOpacity(e) {
294
- return world.get(e, Opacity)?.a ?? 1;
295
- }
296
- function createHost(e) {
297
- const el = doc.createElement("div");
298
- el.style.position = "absolute";
299
- el.setAttribute("data-ice-entity", String(e));
300
- const claimType = world.get(e, PrefabId)?.id;
301
- const claimWidget = typeof claimType === "string" ? widgets.get(claimType) : void 0;
302
- if (claimWidget?.keyboard === "exclusive") {
303
- el.setAttribute(KEYBOARD_CLAIM_ATTR, claimWidget.keyboardEscape === "widget" ? CLAIM_OWNS_ESCAPE : "");
304
- el.tabIndex = -1;
305
- el.style.outline = "none";
306
- }
307
- const content = doc.createElement("div");
308
- content.setAttribute("data-ice-content", "");
309
- content.style.width = "100%";
310
- content.style.height = "100%";
311
- el.appendChild(content);
312
- const g = readGeom(e);
313
- writeGeom2(el, g.x, g.y, g.w, g.h);
314
- geometryWrites++;
315
- const opacity = readOpacity(e);
316
- if (opacity !== 1) el.style.opacity = String(opacity);
317
- const lifted = world.has(e, Grab) && promotable(e);
318
- (lifted ? host.liftedPlane : host.contentPlane).appendChild(el);
319
- return { host: el, content, x: g.x, y: g.y, w: g.w, h: g.h, hidden: false, lifted, opacity };
320
- }
321
- function reconcile(snapshot) {
322
- let membershipChanged = false;
323
- const present = /* @__PURE__ */ new Set();
324
- for (const entry of snapshot) {
325
- present.add(entry.entity);
326
- let rec = hosts.get(entry.entity);
327
- if (rec === void 0) {
328
- rec = createHost(entry.entity);
329
- hosts.set(entry.entity, rec);
330
- membershipChanged = true;
331
- }
332
- if (entry.hidden !== rec.hidden) {
333
- rec.hidden = entry.hidden;
334
- rec.host.style.display = entry.hidden ? "none" : "";
335
- }
336
- }
337
- for (const [e, rec] of hosts) {
338
- if (present.has(e)) continue;
339
- rec.host.remove();
340
- hosts.delete(e);
341
- membershipChanged = true;
342
- }
343
- return membershipChanged;
344
- }
345
- function updateGeometry() {
346
- for (const [e, rec] of hosts) {
347
- const g = readGeom(e);
348
- if (g.x !== rec.x || g.y !== rec.y || g.w !== rec.w || g.h !== rec.h) {
349
- writeGeom2(rec.host, g.x, g.y, g.w, g.h);
350
- rec.x = g.x;
351
- rec.y = g.y;
352
- rec.w = g.w;
353
- rec.h = g.h;
354
- geometryWrites++;
355
- }
356
- }
357
- }
358
- function updateOrder() {
359
- const ordinals = order.ordinals();
360
- let allApplied = true;
361
- for (const plane of [host.contentPlane, host.liftedPlane]) {
362
- const active = doc.activeElement;
363
- if (active !== null && active !== doc.body && plane.contains(active)) {
364
- allApplied = false;
365
- continue;
366
- }
367
- const mine = [];
368
- for (const [e, rec] of hosts) {
369
- if (rec.host.parentNode !== plane) continue;
370
- mine.push({ el: rec.host, e });
371
- }
372
- if (mine.length < 2) continue;
373
- const target = [...mine].sort((a, b) => compareStackOrder(world, ordinals, a.e, b.e));
374
- let cursor = 0;
375
- let inOrder = true;
376
- for (let i = 0; i < plane.children.length; i++) {
377
- const child = plane.children.item(i);
378
- if (cursor >= target.length || child === null) break;
379
- if (child === target[cursor].el) cursor += 1;
380
- else if (mine.some((m) => m.el === child)) {
381
- inOrder = false;
382
- break;
383
- }
384
- }
385
- if (inOrder && cursor === target.length) continue;
386
- for (const m of target) plane.appendChild(m.el);
387
- }
388
- return allApplied;
389
- }
390
- function updateOpacity() {
391
- for (const [e, rec] of hosts) {
392
- const o = readOpacity(e);
393
- if (o !== rec.opacity) {
394
- rec.host.style.opacity = o === 1 ? "" : String(o);
395
- rec.opacity = o;
396
- }
397
- }
398
- }
399
- function updatePromote() {
400
- let anyLifted = false;
401
- for (const [e, rec] of hosts) {
402
- const grabbed = world.has(e, Grab);
403
- const shouldLift = grabbed && promotable(e);
404
- if (shouldLift) anyLifted = true;
405
- if (shouldLift !== rec.lifted) {
406
- rec.lifted = shouldLift;
407
- (shouldLift ? host.liftedPlane : host.contentPlane).appendChild(rec.host);
408
- orderDirty = true;
409
- }
410
- if (grabbed && !shouldLift) {
411
- if (rec.host.style.zIndex !== "1000") rec.host.style.zIndex = "1000";
412
- } else if (rec.host.style.zIndex !== "") {
413
- rec.host.style.zIndex = "";
414
- }
415
- }
416
- if (anyLifted !== inert) {
417
- inert = anyLifted;
418
- host.contentPlane.style.pointerEvents = inert ? "none" : "";
419
- host.liftedPlane.style.pointerEvents = inert ? "none" : "";
420
- }
421
- }
422
- return {
423
- name: "domWidgets",
424
- always: true,
425
- // store membership has no ECS stamp; the flush self-gates cheaply
426
- flush(_world) {
427
- const snapshot = store.getSnapshot();
428
- let membershipChanged = false;
429
- if (snapshot !== lastSnapshot) {
430
- lastSnapshot = snapshot;
431
- membershipChanged = reconcile(snapshot);
432
- }
433
- if (geometryDirty) {
434
- geometryDirty = false;
435
- updateGeometry();
436
- }
437
- if (opacityDirty) {
438
- opacityDirty = false;
439
- updateOpacity();
440
- }
441
- if (promoteDirty || membershipChanged) {
442
- promoteDirty = false;
443
- updatePromote();
444
- }
445
- if (orderDirty || membershipChanged) {
446
- orderDirty = !updateOrder();
447
- }
448
- },
449
- hostFor: (entity) => hosts.get(entity)?.content,
450
- hostCount: () => hosts.size,
451
- geometryWrites: () => geometryWrites,
452
- dispose() {
453
- for (const u of unsubs) u();
454
- unsubs.length = 0;
455
- }
456
- };
457
- }
458
-
459
- // ../dom/src/loop.ts
460
- function startRafLoop(engine) {
461
- let handle = 0;
462
- let stopped = false;
463
- let parked = false;
464
- const tick = (now) => {
465
- if (stopped) return;
466
- if (!engine.frame.claimStep()) {
467
- parked = true;
468
- handle = 0;
469
- return;
470
- }
471
- try {
472
- engine.step(now);
473
- } finally {
474
- if (!stopped) handle = requestAnimationFrame(tick);
475
- }
476
- };
477
- const wake = () => {
478
- if (stopped || !parked || engine.frame.isFrozen()) return;
479
- parked = false;
480
- handle = requestAnimationFrame(tick);
481
- };
482
- const unsubscribe = engine.frame.onChange(wake);
483
- handle = requestAnimationFrame(tick);
484
- return () => {
485
- stopped = true;
486
- unsubscribe();
487
- cancelAnimationFrame(handle);
488
- };
489
- }
490
-
491
- // ../dom/src/pointer-adapter.ts
492
- var asVerdict = (v) => typeof v === "object" ? v : { handled: v === true };
493
- var WHEEL_LINE_PX = 16;
494
- var INTERACTIVE_SELECTOR = 'input, textarea, select, button, a[href], [contenteditable=""], [contenteditable="true"], audio[controls], video[controls], [data-canvas-interactive]';
495
- function crossesInteractive(target, container) {
496
- if (!(target instanceof Element)) return false;
497
- const match = target.closest(INTERACTIVE_SELECTOR);
498
- return match !== null && container.contains(match);
499
- }
500
- function pointerIdOf(e) {
501
- if (e.pointerType === "touch") return `touch:${e.pointerId}`;
502
- if (e.pointerType === "pen") return "pen";
503
- return "mouse";
504
- }
505
- function deviceOf(e) {
506
- if (e.pointerType === "touch") return "touch";
507
- if (e.pointerType === "pen") return "pen";
508
- return "mouse";
509
- }
510
- function attachPointerAdapter(host, queue, opts = {}) {
511
- const { container } = host;
512
- const view = container.ownerDocument.defaultView;
513
- const { glRoute } = opts;
514
- let spaceHeld = false;
515
- const live = /* @__PURE__ */ new Map();
516
- const CAPTURE_SLOP_PX = 4;
517
- const capture = (pointerId) => {
518
- if (typeof container.setPointerCapture !== "function") return;
519
- try {
520
- container.setPointerCapture(pointerId);
521
- } catch {
522
- }
523
- };
524
- let lastMods = { shift: false, ctrl: false, alt: false, meta: false, space: false };
525
- const relative = (clientX, clientY) => {
526
- const rect = container.getBoundingClientRect();
527
- return { x: clientX - rect.left, y: clientY - rect.top };
528
- };
529
- const pointerMods = (e) => ({
530
- shift: e.shiftKey,
531
- ctrl: e.ctrlKey,
532
- alt: e.altKey,
533
- meta: e.metaKey,
534
- space: spaceHeld
535
- });
536
- const onPointerDown = (e) => {
537
- const id = pointerIdOf(e);
538
- const device = deviceOf(e);
539
- const { x, y } = relative(e.clientX, e.clientY);
540
- const native = crossesInteractive(e.target, container);
541
- const gl = asVerdict(glRoute?.("down", x, y, e));
542
- const glClaimed = gl.handled;
543
- live.set(id, { device, x, y, downX: x, downY: y, native, captured: glClaimed });
544
- if (glClaimed) capture(e.pointerId);
545
- const surfaceHandled = native || glClaimed;
546
- queue.enqueue({
547
- kind: "down",
548
- pointerId: id,
549
- device,
550
- screenX: x,
551
- screenY: y,
552
- buttons: e.buttons,
553
- mods: pointerMods(e),
554
- tMs: e.timeStamp,
555
- ...surfaceHandled ? { surfaceHandled: true } : {},
556
- // The down IS a hover-bearing fact: a touch's first event must seed the
557
- // pointer's OverInteractive truth (no prior moves exist to).
558
- overInteractive: surfaceHandled || gl.overInteractive === true
559
- });
560
- };
561
- const onPointerMove = (e) => {
562
- const id = pointerIdOf(e);
563
- const device = deviceOf(e);
564
- const { x, y } = relative(e.clientX, e.clientY);
565
- let seen = live.get(id);
566
- if (seen === void 0 && e.buttons !== 0 && !crossesInteractive(e.target, container)) {
567
- seen = { device, x, y, downX: x, downY: y, native: false, captured: false };
568
- live.set(id, seen);
569
- }
570
- if (seen !== void 0) {
571
- seen.x = x;
572
- seen.y = y;
573
- if (!seen.captured && !seen.native && e.buttons !== 0 && Math.hypot(x - seen.downX, y - seen.downY) > CAPTURE_SLOP_PX) {
574
- capture(e.pointerId);
575
- seen.captured = true;
576
- }
577
- }
578
- const gl = asVerdict(glRoute?.("move", x, y, e));
579
- queue.enqueue({
580
- kind: "move",
581
- pointerId: id,
582
- device,
583
- screenX: x,
584
- screenY: y,
585
- buttons: e.buttons,
586
- mods: pointerMods(e),
587
- tMs: e.timeStamp,
588
- ...gl.handled ? { surfaceHandled: true } : {},
589
- // Hover fact, every move: DOM chain check ∪ GL verdict. A gl-captured
590
- // move (island drag) counts — the widget owns the pointer right now.
591
- overInteractive: crossesInteractive(e.target, container) || gl.handled || gl.overInteractive === true
592
- });
593
- };
594
- const endPointer = (kind) => (e) => {
595
- const id = pointerIdOf(e);
596
- const device = deviceOf(e);
597
- const { x, y } = relative(e.clientX, e.clientY);
598
- live.delete(id);
599
- if (typeof container.releasePointerCapture === "function") {
600
- try {
601
- container.releasePointerCapture(e.pointerId);
602
- } catch {
603
- }
604
- }
605
- const gl = asVerdict(glRoute?.(kind, x, y, e));
606
- queue.enqueue({
607
- kind,
608
- pointerId: id,
609
- device,
610
- screenX: x,
611
- screenY: y,
612
- buttons: e.buttons,
613
- mods: pointerMods(e),
614
- ...gl.handled ? { surfaceHandled: true } : {}
615
- // No overInteractive stamp: a capture-retargeted up reads the container,
616
- // not the content under the pointer — the next real move re-truths it.
617
- });
618
- };
619
- const onPointerUp = endPointer("up");
620
- const onPointerCancel = endPointer("cancel");
621
- const onWheel = (e) => {
622
- const { x, y } = relative(e.clientX, e.clientY);
623
- const scale = e.deltaMode === 1 ? WHEEL_LINE_PX : 1;
624
- if (e.ctrlKey) {
625
- e.preventDefault();
626
- queue.enqueue({ kind: "wheel", pointerId: "mouse", device: "mouse", screenX: x, screenY: y, buttons: e.buttons, mods: pointerMods(e), wheel: { dx: 0, dy: 0, pinch: e.deltaY } });
627
- return;
628
- }
629
- const wheel = { dx: e.deltaX * scale, dy: e.deltaY * scale, pinch: 0 };
630
- if (wheelCede(e.target, container, e.deltaX, e.deltaY)) {
631
- queue.enqueue({ kind: "wheel", pointerId: "mouse", device: "mouse", screenX: x, screenY: y, buttons: e.buttons, mods: pointerMods(e), wheel, wheelHandled: true });
632
- return;
633
- }
634
- e.preventDefault();
635
- queue.enqueue({ kind: "wheel", pointerId: "mouse", device: "mouse", screenX: x, screenY: y, buttons: e.buttons, mods: pointerMods(e), wheel });
636
- };
637
- const emitKeyIfChanged = (e) => {
638
- const mods = { shift: e.shiftKey, ctrl: e.ctrlKey, alt: e.altKey, meta: e.metaKey, space: spaceHeld };
639
- if (mods.shift === lastMods.shift && mods.ctrl === lastMods.ctrl && mods.alt === lastMods.alt && mods.meta === lastMods.meta && mods.space === lastMods.space) {
640
- return;
641
- }
642
- lastMods = { ...mods };
643
- queue.enqueue({ kind: "key", pointerId: "", device: "mouse", screenX: 0, screenY: 0, buttons: 0, mods });
644
- };
645
- const isSpace = (e) => e.key === " " || e.code === "Space";
646
- const onKeyDown = (e) => {
647
- if (isSpace(e) && !e.defaultPrevented) {
648
- if (isEditableTarget(e.target)) {
649
- } else if (keyboardClaimOf(e.target).claimed) {
650
- e.preventDefault();
651
- } else {
652
- e.preventDefault();
653
- spaceHeld = true;
654
- }
655
- }
656
- emitKeyIfChanged(e);
657
- };
658
- const onKeyUp = (e) => {
659
- if (isSpace(e)) {
660
- if (!e.defaultPrevented && !isEditableTarget(e.target) && !keyboardClaimOf(e.target).claimed) {
661
- e.preventDefault();
662
- }
663
- spaceHeld = false;
664
- }
665
- emitKeyIfChanged(e);
666
- };
667
- const cancelAllInput = () => {
668
- for (const [id, s] of live) {
669
- queue.enqueue({ kind: "cancel", pointerId: id, device: s.device, screenX: s.x, screenY: s.y, buttons: 0, mods: { ...NO_MODS, space: spaceHeld } });
670
- }
671
- live.clear();
672
- spaceHeld = false;
673
- if (lastMods.space || lastMods.shift || lastMods.ctrl || lastMods.alt || lastMods.meta) {
674
- lastMods = { ...NO_MODS };
675
- queue.enqueue({
676
- kind: "key",
677
- pointerId: "",
678
- device: "mouse",
679
- screenX: 0,
680
- screenY: 0,
681
- buttons: 0,
682
- mods: { ...NO_MODS }
683
- });
684
- }
685
- };
686
- const onBlur = () => {
687
- cancelAllInput();
688
- };
689
- container.addEventListener("pointerdown", onPointerDown);
690
- container.addEventListener("pointermove", onPointerMove);
691
- container.addEventListener("pointerup", onPointerUp);
692
- container.addEventListener("pointercancel", onPointerCancel);
693
- container.addEventListener("wheel", onWheel, { passive: false });
694
- view?.addEventListener("keydown", onKeyDown);
695
- view?.addEventListener("keyup", onKeyUp);
696
- view?.addEventListener("blur", onBlur);
697
- return () => {
698
- cancelAllInput();
699
- container.removeEventListener("pointerdown", onPointerDown);
700
- container.removeEventListener("pointermove", onPointerMove);
701
- container.removeEventListener("pointerup", onPointerUp);
702
- container.removeEventListener("pointercancel", onPointerCancel);
703
- container.removeEventListener("wheel", onWheel);
704
- view?.removeEventListener("keydown", onKeyDown);
705
- view?.removeEventListener("keyup", onKeyUp);
706
- view?.removeEventListener("blur", onBlur);
707
- };
708
- }
709
-
710
- // ../dom/src/widget-focus.ts
711
- var FOCUS_PROXY_ATTR = "data-canvas-focus";
712
- var FOCUSABLE_SELECTOR = 'input, textarea, select, button, a[href], [contenteditable=""], [contenteditable="true"], [tabindex], audio[controls], video[controls], iframe';
713
- function focusNodeOf(claimHost) {
714
- const proxy = claimHost.querySelector(`[${FOCUS_PROXY_ATTR}]`);
715
- return proxy ?? claimHost;
716
- }
717
- function attachWidgetFocus(host, lookup) {
718
- const { container } = host;
719
- const doc = container.ownerDocument;
720
- const onPointerDown = (e) => {
721
- if (!(e.target instanceof Element)) return;
722
- const marked = e.target.closest(`[${KEYBOARD_CLAIM_ATTR}]`);
723
- if (!(marked instanceof HTMLElement) || !container.contains(marked)) return;
724
- const focusable = e.target.closest(FOCUSABLE_SELECTOR);
725
- if (focusable !== null && focusable !== marked && marked.contains(focusable)) return;
726
- const node = focusNodeOf(marked);
727
- if (doc.activeElement === node) return;
728
- e.preventDefault();
729
- node.focus({ preventScroll: true });
730
- };
731
- container.addEventListener("pointerdown", onPointerDown, true);
732
- return {
733
- focusWidget(entity) {
734
- const content = lookup.hostFor(entity);
735
- const hostEl = content?.parentElement;
736
- if (!(hostEl instanceof HTMLElement) || !hostEl.hasAttribute(KEYBOARD_CLAIM_ATTR)) return false;
737
- const node = focusNodeOf(hostEl);
738
- node.focus({ preventScroll: true });
739
- return doc.activeElement === node;
740
- },
741
- blurFocus() {
742
- const active = doc.activeElement;
743
- if (!(active instanceof HTMLElement || active instanceof SVGElement)) return false;
744
- if (active.closest(`[${KEYBOARD_CLAIM_ATTR}]`) === null) return false;
745
- active.blur();
746
- return true;
747
- },
748
- detach() {
749
- container.removeEventListener("pointerdown", onPointerDown, true);
750
- }
751
- };
752
- }
753
-
754
- // ../dom/src/reflectors/cursor.ts
755
- function createCursorReflector(host, readCursor) {
756
- let writes = 0;
757
- let last;
758
- return {
759
- name: "cursor",
760
- always: true,
761
- flush(_world) {
762
- const next = readCursor();
763
- if (next === last) return;
764
- last = next;
765
- host.container.style.cursor = next;
766
- writes++;
767
- },
768
- writes: () => writes
769
- };
770
- }
771
-
772
- // ../dom/src/reflectors/remote-cursors.ts
773
- var remoteCursorQ = defineQuery([Position, CursorVisual]);
774
- function createRemoteCursorsReflector(host, world) {
775
- const doc = host.container.ownerDocument;
776
- const plane = doc.createElement("div");
777
- Object.assign(plane.style, {
778
- position: "absolute",
779
- inset: "0",
780
- overflow: "hidden",
781
- pointerEvents: "none"
782
- });
783
- host.container.appendChild(plane);
784
- const pool = /* @__PURE__ */ new Map();
785
- const ensure = (e) => {
786
- let n = pool.get(e);
787
- if (n !== void 0) return n;
788
- const root = doc.createElement("div");
789
- Object.assign(root.style, {
790
- position: "absolute",
791
- left: "0",
792
- top: "0",
793
- willChange: "transform",
794
- pointerEvents: "none"
795
- });
796
- const arrow = doc.createElement("div");
797
- Object.assign(arrow.style, {
798
- width: "0",
799
- height: "0",
800
- borderLeft: "6px solid transparent",
801
- borderRight: "6px solid transparent",
802
- borderBottom: "14px solid currentColor",
803
- transform: "rotate(-32deg)"
804
- });
805
- const label = doc.createElement("div");
806
- Object.assign(label.style, {
807
- marginTop: "2px",
808
- marginLeft: "8px",
809
- padding: "1px 6px",
810
- borderRadius: "8px",
811
- font: "11px system-ui, sans-serif",
812
- color: "#fff",
813
- whiteSpace: "nowrap"
814
- });
815
- root.appendChild(arrow);
816
- root.appendChild(label);
817
- plane.appendChild(root);
818
- n = { root, label, color: "", name: "", x: Number.NaN, y: Number.NaN };
819
- pool.set(e, n);
820
- return n;
821
- };
822
- const reflector = {
823
- name: "remoteCursors",
824
- observe: {
825
- resources: [Camera],
826
- queries: [{ q: remoteCursorQ, cols: [Position, CursorVisual] }]
827
- },
828
- flush: (w) => {
829
- const cam = w.getResource(Camera) ?? { x: 0, y: 0, zoom: 1 };
830
- const seen = /* @__PURE__ */ new Set();
831
- w.query(remoteCursorQ).each((b) => {
832
- for (const r of b) {
833
- const e = b.entity(r);
834
- if (w.get(e, CursorVisual)?.kind !== "remote") continue;
835
- seen.add(e);
836
- const p = w.read(e, Position);
837
- const s = worldToScreen(p.x, p.y, cam);
838
- const n = ensure(e);
839
- if (n.x !== s.x || n.y !== s.y) {
840
- n.root.style.transform = `translate(${s.x}px, ${s.y}px)`;
841
- n.x = s.x;
842
- n.y = s.y;
843
- }
844
- const peer = w.getRelation(e, Follows);
845
- const info = peer !== void 0 ? w.get(peer, PresenceInfo) : void 0;
846
- const color = info?.color ?? "#7a8aa0";
847
- const name = info?.name ?? "";
848
- if (n.color !== color) {
849
- n.root.style.color = color;
850
- n.label.style.background = color;
851
- n.color = color;
852
- }
853
- if (n.name !== name) {
854
- n.label.textContent = name;
855
- n.label.style.display = name === "" ? "none" : "block";
856
- n.name = name;
857
- }
858
- }
859
- });
860
- for (const [e, n] of pool) {
861
- if (!seen.has(e)) {
862
- n.root.remove();
863
- pool.delete(e);
864
- }
865
- }
866
- }
867
- };
868
- return {
869
- reflector,
870
- destroy() {
871
- pool.clear();
872
- plane.remove();
873
- }
874
- };
875
- }
876
-
877
- // ../dom/src/reflectors/chrome.ts
878
- var HANDLE_DRAW_PX = 8;
879
- var boxQ = defineQuery([SelectionBox]);
880
- var handleQ = defineQuery([HandleSpec, Position, Size]);
881
- function makeNode(doc, extra) {
882
- const node = doc.createElement("div");
883
- Object.assign(node.style, { position: "absolute", boxSizing: "border-box", pointerEvents: "none" }, extra);
884
- return node;
885
- }
886
- function createChromeReflector(host, _world, marqueeBuffer) {
887
- const doc = host.container.ownerDocument;
888
- const plane = makeNode(doc, { left: "0", top: "0", width: "0", height: "0" });
889
- host.container.appendChild(plane);
890
- const boxNodes = /* @__PURE__ */ new Map();
891
- const handleNodes = /* @__PURE__ */ new Map();
892
- let marqueeNode = null;
893
- const boxCache = /* @__PURE__ */ new Map();
894
- const handleCache = /* @__PURE__ */ new Map();
895
- let marqueeCache = null;
896
- let drewLast = false;
897
- const seenBox = /* @__PURE__ */ new Set();
898
- const seenHandle = /* @__PURE__ */ new Set();
899
- let writes = 0;
900
- const writeRect = (node, left, top, w, h) => {
901
- node.style.left = `${left}px`;
902
- node.style.top = `${top}px`;
903
- node.style.width = `${w}px`;
904
- node.style.height = `${h}px`;
905
- writes++;
906
- };
907
- return {
908
- name: "chrome",
909
- always: true,
910
- observe: {
911
- queries: [
912
- { q: boxQ, cols: [SelectionBox] },
913
- { q: handleQ, cols: [Position, Size] }
914
- ],
915
- resources: [Camera]
916
- },
917
- flush(w) {
918
- const cam = w.getResource(Camera);
919
- if (cam === void 0) return;
920
- const marqueeRect = marqueeBuffer.rect;
921
- const hasContent = marqueeRect !== null || w.firstOf(boxQ) !== void 0 || w.firstOf(handleQ) !== void 0;
922
- if (!hasContent && !drewLast) return;
923
- seenBox.clear();
924
- seenHandle.clear();
925
- w.query(boxQ).each((batch) => {
926
- const bx = batch.col(SelectionBox).x;
927
- const by = batch.col(SelectionBox).y;
928
- const bw = batch.col(SelectionBox).w;
929
- const bh = batch.col(SelectionBox).h;
930
- for (const r of batch) {
931
- const e = batch.entity(r);
932
- seenBox.add(e);
933
- const tl = worldToScreen(bx[r], by[r], cam);
934
- const sw = bw[r] * cam.zoom;
935
- const sh = bh[r] * cam.zoom;
936
- const key = `${tl.x}:${tl.y}:${sw}:${sh}:${cam.zoom}`;
937
- let node = boxNodes.get(e);
938
- if (node === void 0) {
939
- node = makeNode(doc, { border: "1px solid #4a90d9" });
940
- node.dataset.chrome = "box";
941
- boxNodes.set(e, node);
942
- plane.appendChild(node);
943
- }
944
- if (boxCache.get(e) !== key) {
945
- writeRect(node, tl.x, tl.y, sw, sh);
946
- node.style.borderRadius = `calc(var(--ic-selection-radius, 0px) * ${cam.zoom})`;
947
- boxCache.set(e, key);
948
- }
949
- }
950
- });
951
- for (const [e, node] of boxNodes) {
952
- if (seenBox.has(e)) continue;
953
- node.remove();
954
- boxNodes.delete(e);
955
- boxCache.delete(e);
956
- }
957
- w.query(handleQ).each((batch) => {
958
- const px = batch.col(Position).x;
959
- const py = batch.col(Position).y;
960
- const sw = batch.col(Size).w;
961
- const sh = batch.col(Size).h;
962
- for (const r of batch) {
963
- const e = batch.entity(r);
964
- seenHandle.add(e);
965
- const cx = px[r] + sw[r] / 2;
966
- const cy = py[r] + sh[r] / 2;
967
- const sc = worldToScreen(cx, cy, cam);
968
- const left = sc.x - HANDLE_DRAW_PX / 2;
969
- const top = sc.y - HANDLE_DRAW_PX / 2;
970
- const key = `${left}:${top}`;
971
- let node = handleNodes.get(e);
972
- if (node === void 0) {
973
- node = makeNode(doc, {
974
- width: `${HANDLE_DRAW_PX}px`,
975
- height: `${HANDLE_DRAW_PX}px`,
976
- background: "#fff",
977
- border: "1px solid #4a90d9"
978
- });
979
- node.dataset.chrome = "handle";
980
- handleNodes.set(e, node);
981
- plane.appendChild(node);
982
- }
983
- if (handleCache.get(e) !== key) {
984
- node.style.left = `${left}px`;
985
- node.style.top = `${top}px`;
986
- writes++;
987
- handleCache.set(e, key);
988
- }
989
- }
990
- });
991
- for (const [e, node] of handleNodes) {
992
- if (seenHandle.has(e)) continue;
993
- node.remove();
994
- handleNodes.delete(e);
995
- handleCache.delete(e);
996
- }
997
- if (marqueeRect !== null) {
998
- const tl = worldToScreen(marqueeRect.x, marqueeRect.y, cam);
999
- const mw = marqueeRect.w * cam.zoom;
1000
- const mh = marqueeRect.h * cam.zoom;
1001
- const key = `${tl.x}:${tl.y}:${mw}:${mh}`;
1002
- if (marqueeNode === null) {
1003
- marqueeNode = makeNode(doc, { border: "1px dashed #4a90d9", background: "rgba(74,144,217,0.1)" });
1004
- marqueeNode.dataset.chrome = "marquee";
1005
- plane.appendChild(marqueeNode);
1006
- }
1007
- if (marqueeCache !== key) {
1008
- writeRect(marqueeNode, tl.x, tl.y, mw, mh);
1009
- marqueeCache = key;
1010
- }
1011
- } else if (marqueeNode !== null) {
1012
- marqueeNode.remove();
1013
- marqueeNode = null;
1014
- marqueeCache = null;
1015
- }
1016
- drewLast = boxNodes.size > 0 || handleNodes.size > 0 || marqueeNode !== null;
1017
- },
1018
- writes: () => writes,
1019
- // The P4 overlay plane is this factory's insertion — unregistering the
1020
- // reflector alone leaves it behind (2026-07-11 teardown sweep).
1021
- dispose() {
1022
- plane.remove();
1023
- }
1024
- };
1025
- }
1026
-
1027
- // ../dom/src/measure-adapter.ts
1028
- function isHidden(el) {
1029
- if (el.offsetParent !== null) return false;
1030
- const display = el.ownerDocument.defaultView?.getComputedStyle(el).display;
1031
- return display === "none";
1032
- }
1033
- function attachMeasureAdapter(hostFor, queue) {
1034
- const byElement = /* @__PURE__ */ new Map();
1035
- const byEntity = /* @__PURE__ */ new Map();
1036
- const ro = new ResizeObserver((entries) => {
1037
- for (const entry of entries) {
1038
- const el = entry.target;
1039
- const entity = byElement.get(el);
1040
- if (entity === void 0) continue;
1041
- if (isHidden(el)) continue;
1042
- const box = entry.borderBoxSize?.[0];
1043
- const w = box !== void 0 ? box.inlineSize : entry.contentRect.width;
1044
- const h = box !== void 0 ? box.blockSize : entry.contentRect.height;
1045
- if (w === 0 && h === 0) continue;
1046
- queue.enqueue({ entity, w, h });
1047
- }
1048
- });
1049
- return {
1050
- observe(entity) {
1051
- const el = hostFor(entity);
1052
- if (el === void 0) return;
1053
- const prev = byEntity.get(entity);
1054
- if (prev !== void 0 && prev !== el) {
1055
- ro.unobserve(prev);
1056
- byElement.delete(prev);
1057
- }
1058
- byElement.set(el, entity);
1059
- byEntity.set(entity, el);
1060
- ro.observe(el);
1061
- },
1062
- unobserve(entity) {
1063
- const el = byEntity.get(entity);
1064
- if (el === void 0) return;
1065
- ro.unobserve(el);
1066
- byElement.delete(el);
1067
- byEntity.delete(entity);
1068
- },
1069
- dispose() {
1070
- ro.disconnect();
1071
- byElement.clear();
1072
- byEntity.clear();
1073
- }
1074
- };
1075
- }
1076
-
1077
- // ../dom/src/measure-wiring.ts
1078
- function defaultMeasure(el) {
1079
- return { w: el.offsetWidth, h: el.offsetHeight };
1080
- }
1081
- function wireMeasurement(store, hosts, queue, opts = {}) {
1082
- const adapter = attachMeasureAdapter((e) => hosts.hostFor(e), queue);
1083
- const measure = opts.measure ?? defaultMeasure;
1084
- const state = /* @__PURE__ */ new Map();
1085
- let scheduled = false;
1086
- let disposed = false;
1087
- const forceRemeasure = (e) => {
1088
- const el = hosts.hostFor(e);
1089
- if (el === void 0) return;
1090
- const { w, h } = measure(el);
1091
- if (w <= 0 && h <= 0) return;
1092
- queue.enqueue({ entity: e, w, h });
1093
- };
1094
- const reconcile = () => {
1095
- if (disposed) return;
1096
- const snapshot = store.getSnapshot();
1097
- const present = /* @__PURE__ */ new Set();
1098
- for (const entry of snapshot) {
1099
- present.add(entry.entity);
1100
- const prev = state.get(entry.entity);
1101
- if (entry.hidden) {
1102
- if (prev === "visible") adapter.unobserve(entry.entity);
1103
- state.set(entry.entity, "hidden");
1104
- } else {
1105
- if (prev === void 0) {
1106
- adapter.observe(entry.entity);
1107
- } else if (prev === "hidden") {
1108
- adapter.observe(entry.entity);
1109
- forceRemeasure(entry.entity);
1110
- }
1111
- state.set(entry.entity, "visible");
1112
- }
1113
- }
1114
- for (const [e, s] of [...state]) {
1115
- if (present.has(e)) continue;
1116
- if (s === "visible") adapter.unobserve(e);
1117
- state.delete(e);
1118
- }
1119
- };
1120
- const onStoreChange = () => {
1121
- if (scheduled || disposed) return;
1122
- scheduled = true;
1123
- queueMicrotask(() => {
1124
- scheduled = false;
1125
- reconcile();
1126
- });
1127
- };
1128
- const unsub = store.subscribe(onStoreChange);
1129
- onStoreChange();
1130
- return () => {
1131
- disposed = true;
1132
- unsub();
1133
- adapter.dispose();
1134
- state.clear();
1135
- };
1136
- }
1137
-
1138
- // ../dom/src/index.ts
1139
- var DOM_VERSION = "0.0.0";
1140
-
1141
- export {
1142
- createCanvasHost,
1143
- createPlanes,
1144
- createPlaneTransformReflector,
1145
- createGrayboxReflector,
1146
- KEYBOARD_CLAIM_ATTR,
1147
- CLAIM_OWNS_ESCAPE,
1148
- isEditableTarget,
1149
- keyboardClaimOf,
1150
- wheelCede,
1151
- createDomWidgetsReflector,
1152
- startRafLoop,
1153
- attachPointerAdapter,
1154
- FOCUS_PROXY_ATTR,
1155
- attachWidgetFocus,
1156
- createCursorReflector,
1157
- createRemoteCursorsReflector,
1158
- createChromeReflector,
1159
- attachMeasureAdapter,
1160
- wireMeasurement,
1161
- DOM_VERSION
1162
- };
1163
- //# sourceMappingURL=chunk-2TNVB2ON.js.map