sygnal 7.0.0 → 7.2.0-preview.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 (343) hide show
  1. package/CHANGELOG.md +632 -0
  2. package/dist/agent-ui.cjs.js +592 -0
  3. package/dist/agent-ui.cjs.js.map +1 -0
  4. package/dist/agent-ui.esm.js +582 -0
  5. package/dist/agent-ui.esm.js.map +1 -0
  6. package/dist/api.cjs.js +63 -0
  7. package/dist/api.cjs.js.map +1 -0
  8. package/dist/api.esm.js +2 -0
  9. package/dist/api.esm.js.map +1 -0
  10. package/dist/astro/index.cjs.js +968 -4
  11. package/dist/astro/index.cjs.js.map +1 -1
  12. package/dist/astro/index.mjs +968 -4
  13. package/dist/astro/index.mjs.map +1 -1
  14. package/dist/astro/server.cjs.js +73 -45
  15. package/dist/astro/server.cjs.js.map +1 -1
  16. package/dist/astro/server.mjs +73 -45
  17. package/dist/astro/server.mjs.map +1 -1
  18. package/dist/canvas.cjs.js +2919 -0
  19. package/dist/canvas.cjs.js.map +1 -0
  20. package/dist/canvas.esm.js +2866 -0
  21. package/dist/canvas.esm.js.map +1 -0
  22. package/dist/devtools.cjs.js +38 -6
  23. package/dist/devtools.cjs.js.map +1 -1
  24. package/dist/devtools.esm.js +38 -6
  25. package/dist/devtools.esm.js.map +1 -1
  26. package/dist/diagnostics.cjs.js +224 -20
  27. package/dist/diagnostics.cjs.js.map +1 -1
  28. package/dist/diagnostics.esm.js +224 -20
  29. package/dist/diagnostics.esm.js.map +1 -1
  30. package/dist/guide/accessibility.md +1 -1
  31. package/dist/guide/ai-compose.md +150 -0
  32. package/dist/guide/behaviors.md +2 -1
  33. package/dist/guide/collaborative-state.md +265 -0
  34. package/dist/guide/element-commands.md +36 -2
  35. package/dist/guide/forms-reference.md +5 -5
  36. package/dist/guide/forms.md +3 -2
  37. package/dist/guide/http.md +28 -1
  38. package/dist/guide/islands.md +240 -0
  39. package/dist/guide/recipes/code-editor.md +1 -1
  40. package/dist/guide/renderers/agent-ui.md +138 -0
  41. package/dist/guide/renderers/custom-targets.md +126 -0
  42. package/dist/guide/renderers/overview.md +120 -0
  43. package/dist/guide/renderers/react-native.md +128 -0
  44. package/dist/guide/renderers/terminal.md +306 -0
  45. package/dist/guide/renderers/three.md +332 -0
  46. package/dist/guide/renderers/write-once.md +137 -0
  47. package/dist/guide/resources.md +2 -0
  48. package/dist/guide/sandboxed-components.md +223 -0
  49. package/dist/guide/timers.md +32 -5
  50. package/dist/guide/typed-apis.md +442 -0
  51. package/dist/guide/ui/accordion.md +11 -0
  52. package/dist/guide/ui/combobox.md +112 -8
  53. package/dist/guide/ui/dialog.md +96 -20
  54. package/dist/guide/ui/menu.md +57 -5
  55. package/dist/guide/ui/overview.md +8 -4
  56. package/dist/guide/ui/popover.md +69 -9
  57. package/dist/guide/ui/select.md +54 -4
  58. package/dist/guide/ui/tabs.md +1 -1
  59. package/dist/guide/ui/tooltip.md +7 -5
  60. package/dist/guide/virtual-collections.md +3 -0
  61. package/dist/guide/widgets.md +90 -1
  62. package/dist/host.cjs.js +2181 -0
  63. package/dist/host.cjs.js.map +1 -0
  64. package/dist/host.esm.js +2146 -0
  65. package/dist/host.esm.js.map +1 -0
  66. package/dist/index.cjs.js +3948 -586
  67. package/dist/index.cjs.js.map +1 -1
  68. package/dist/index.d.ts +584 -44
  69. package/dist/index.esm.js +3918 -586
  70. package/dist/index.esm.js.map +1 -1
  71. package/dist/primitives.cjs.js +143 -0
  72. package/dist/primitives.cjs.js.map +1 -0
  73. package/dist/primitives.esm.js +133 -0
  74. package/dist/primitives.esm.js.map +1 -0
  75. package/dist/react-native.cjs.js +248 -0
  76. package/dist/react-native.cjs.js.map +1 -0
  77. package/dist/react-native.esm.js +244 -0
  78. package/dist/react-native.esm.js.map +1 -0
  79. package/dist/replay.cjs.js +39 -0
  80. package/dist/replay.cjs.js.map +1 -0
  81. package/dist/replay.esm.js +2 -0
  82. package/dist/replay.esm.js.map +1 -0
  83. package/dist/sandbox-build.cjs.js +140 -0
  84. package/dist/sandbox-build.cjs.js.map +1 -0
  85. package/dist/sandbox-build.esm.js +137 -0
  86. package/dist/sandbox-build.esm.js.map +1 -0
  87. package/dist/sandbox-kernel.esm.js +212 -0
  88. package/dist/sandbox-kernel.esm.js.map +1 -0
  89. package/dist/sandbox-worker.cjs.js +857 -0
  90. package/dist/sandbox-worker.cjs.js.map +1 -0
  91. package/dist/sandbox-worker.esm.js +854 -0
  92. package/dist/sandbox-worker.esm.js.map +1 -0
  93. package/dist/sandbox.cjs.js +1425 -0
  94. package/dist/sandbox.cjs.js.map +1 -0
  95. package/dist/sandbox.esm.js +1406 -0
  96. package/dist/sandbox.esm.js.map +1 -0
  97. package/dist/sygnal.min.js +1 -1
  98. package/dist/sygnal.min.js.map +1 -1
  99. package/dist/terminal.cjs.js +1314 -0
  100. package/dist/terminal.cjs.js.map +1 -0
  101. package/dist/terminal.esm.js +1304 -0
  102. package/dist/terminal.esm.js.map +1 -0
  103. package/dist/three.cjs.js +1111 -0
  104. package/dist/three.cjs.js.map +1 -0
  105. package/dist/three.esm.js +1079 -0
  106. package/dist/three.esm.js.map +1 -0
  107. package/dist/ui-combobox.cjs.js +256 -18
  108. package/dist/ui-combobox.cjs.js.map +1 -1
  109. package/dist/ui-combobox.esm.js +256 -18
  110. package/dist/ui-combobox.esm.js.map +1 -1
  111. package/dist/ui-menu.cjs.js +150 -16
  112. package/dist/ui-menu.cjs.js.map +1 -1
  113. package/dist/ui-menu.esm.js +151 -17
  114. package/dist/ui-menu.esm.js.map +1 -1
  115. package/dist/ui-select.cjs.js +95 -9
  116. package/dist/ui-select.cjs.js.map +1 -1
  117. package/dist/ui-select.esm.js +95 -9
  118. package/dist/ui-select.esm.js.map +1 -1
  119. package/dist/ui.cjs.js +679 -173
  120. package/dist/ui.cjs.js.map +1 -1
  121. package/dist/ui.esm.js +679 -175
  122. package/dist/ui.esm.js.map +1 -1
  123. package/dist/vike/config/package.json +1 -1
  124. package/dist/vite/plugin.cjs.js +968 -4
  125. package/dist/vite/plugin.cjs.js.map +1 -1
  126. package/dist/vite/plugin.mjs +968 -4
  127. package/dist/vite/plugin.mjs.map +1 -1
  128. package/dist/worker-page.cjs.js +669 -0
  129. package/dist/worker-page.cjs.js.map +1 -0
  130. package/dist/worker-page.esm.js +665 -0
  131. package/dist/worker-page.esm.js.map +1 -0
  132. package/dist/worker.cjs.js +377 -0
  133. package/dist/worker.cjs.js.map +1 -0
  134. package/dist/worker.esm.js +374 -0
  135. package/dist/worker.esm.js.map +1 -0
  136. package/dist/yjs-testing.cjs.js +98 -0
  137. package/dist/yjs-testing.cjs.js.map +1 -0
  138. package/dist/yjs-testing.esm.js +77 -0
  139. package/dist/yjs-testing.esm.js.map +1 -0
  140. package/dist/yjs.cjs.js +923 -0
  141. package/dist/yjs.cjs.js.map +1 -0
  142. package/dist/yjs.esm.js +900 -0
  143. package/dist/yjs.esm.js.map +1 -0
  144. package/dist/zag.cjs.js +11 -1
  145. package/dist/zag.cjs.js.map +1 -1
  146. package/dist/zag.esm.js +11 -1
  147. package/dist/zag.esm.js.map +1 -1
  148. package/llms/ai.md +65 -0
  149. package/llms/collaboration.md +5 -0
  150. package/llms/graphics.md +10 -0
  151. package/llms/renderers.md +7 -0
  152. package/llms/replay.md +5 -0
  153. package/llms/sandbox.md +5 -0
  154. package/llms/typed-apis.md +5 -0
  155. package/llms/ui.md +10 -0
  156. package/llms-full.txt +444 -0
  157. package/llms.txt +37 -35
  158. package/package.json +139 -3
  159. package/src/agent-ui/mcp.ts +152 -0
  160. package/src/agent-ui/snapshot.ts +212 -0
  161. package/src/agent-ui.d.ts +106 -0
  162. package/src/agent-ui.ts +249 -0
  163. package/src/ai.d.ts +95 -2
  164. package/src/api.d.ts +303 -0
  165. package/src/api.ts +9 -0
  166. package/src/canvas/Canvas.ts +585 -0
  167. package/src/canvas/backend.ts +627 -0
  168. package/src/canvas/geometry.ts +187 -0
  169. package/src/canvas/gesture.ts +23 -0
  170. package/src/canvas/image.ts +197 -0
  171. package/src/canvas/kit.ts +130 -0
  172. package/src/canvas/paint.ts +260 -0
  173. package/src/canvas/pointer.ts +25 -0
  174. package/src/canvas/snap.ts +68 -0
  175. package/src/canvas/svg.ts +99 -0
  176. package/src/canvas.d.ts +373 -0
  177. package/src/canvas.ts +46 -0
  178. package/src/core/actions.ts +14 -3
  179. package/src/core/cell.ts +12 -4
  180. package/src/core/debug.ts +8 -3
  181. package/src/core/hooks.ts +16 -2
  182. package/src/core/hosts/collection.ts +1 -1
  183. package/src/core/hosts/switchable.ts +26 -8
  184. package/src/core/instance.ts +98 -45
  185. package/src/core/markers/portal.ts +4 -0
  186. package/src/core/registry.ts +4 -0
  187. package/src/core/runtime.ts +34 -25
  188. package/src/core/statics.ts +5 -5
  189. package/src/cycle/dom/EventDelegator.ts +37 -33
  190. package/src/cycle/dom/MainDOMSource.ts +16 -14
  191. package/src/cycle/dom/enrichEventStream.ts +13 -9
  192. package/src/cycle/dom/fromEvent.ts +6 -10
  193. package/src/cycle/dom/index.ts +11 -7
  194. package/src/cycle/dom/isolate.ts +13 -6
  195. package/src/cycle/dom/makeDOMDriver.ts +6 -2
  196. package/src/cycle/dom/utils.ts +9 -2
  197. package/src/cycle/run/adapt.ts +4 -12
  198. package/src/devtools.d.ts +9 -0
  199. package/src/devtools.ts +2 -1
  200. package/src/extra/ai/compose/catalog.ts +2 -1
  201. package/src/extra/ai/compose/decisions.ts +1 -2
  202. package/src/extra/ai/compose/generated.ts +234 -0
  203. package/src/extra/ai/compose/index.ts +6 -2
  204. package/src/extra/ai/compose/layout.ts +3 -1
  205. package/src/extra/ai/compose/llm.ts +7 -3
  206. package/src/extra/ai/compose/types.ts +2 -2
  207. package/src/extra/ai/transports/shared.ts +3 -1
  208. package/src/extra/api/contract.ts +485 -0
  209. package/src/extra/api/index.ts +26 -0
  210. package/src/extra/behaviors.ts +3 -3
  211. package/src/extra/controlled.ts +44 -0
  212. package/src/extra/copyAsTest.ts +22 -0
  213. package/src/extra/devtools.ts +5 -3
  214. package/src/extra/devtoolsActions.ts +8 -0
  215. package/src/extra/devtoolsNext.ts +1 -1
  216. package/src/extra/diagnostics/checks/actionLog.ts +8 -3
  217. package/src/extra/diagnostics/checks/behaviors.ts +25 -0
  218. package/src/extra/diagnostics/checks/elementCommands.ts +17 -5
  219. package/src/extra/diagnostics/checks/index.ts +1 -1
  220. package/src/extra/diagnostics/checks/next.ts +78 -4
  221. package/src/extra/diagnostics/checks/props.ts +6 -1
  222. package/src/extra/diagnostics/checks/replies.ts +11 -7
  223. package/src/extra/diagnostics/checks/timers.ts +8 -2
  224. package/src/extra/diagnostics/checks/virtual.ts +11 -0
  225. package/src/extra/diagnostics/codes.ts +51 -1
  226. package/src/extra/elementCommands.ts +20 -4
  227. package/src/extra/fetchDriver.ts +4 -1
  228. package/src/extra/fetchEventSource.ts +6 -2
  229. package/src/extra/field.ts +29 -0
  230. package/src/extra/form.ts +42 -16
  231. package/src/extra/frame.ts +54 -0
  232. package/src/extra/keymap.ts +41 -0
  233. package/src/extra/pager.ts +2 -0
  234. package/src/extra/persist.ts +2 -1
  235. package/src/extra/pointer.ts +262 -0
  236. package/src/extra/processForm.ts +34 -1
  237. package/src/extra/replay/address.ts +49 -0
  238. package/src/extra/replay/entropy.ts +99 -0
  239. package/src/extra/replay/format.ts +263 -0
  240. package/src/extra/replay/index.ts +8 -0
  241. package/src/extra/replay/inert.ts +22 -0
  242. package/src/extra/replay/recorder.ts +247 -0
  243. package/src/extra/replay/replayer.ts +234 -0
  244. package/src/extra/replay/report.ts +126 -0
  245. package/src/extra/replay/schema.ts +52 -0
  246. package/src/extra/replay/version.ts +3 -0
  247. package/src/extra/router.ts +7 -3
  248. package/src/extra/selection.ts +2 -0
  249. package/src/extra/socketDriver.ts +51 -6
  250. package/src/extra/ssr.ts +128 -42
  251. package/src/extra/testing.ts +295 -39
  252. package/src/extra/timers.ts +96 -7
  253. package/src/extra/undo.ts +2 -0
  254. package/src/extra/virtual.ts +25 -2
  255. package/src/extra/widget.ts +106 -17
  256. package/src/host/actions.ts +383 -0
  257. package/src/host/delegation.ts +101 -0
  258. package/src/host/dom.ts +553 -0
  259. package/src/host/driver.ts +185 -0
  260. package/src/host/selector.ts +119 -0
  261. package/src/host/style.ts +51 -0
  262. package/src/host.d.ts +298 -0
  263. package/src/host.ts +46 -0
  264. package/src/index.d.ts +302 -38
  265. package/src/index.ts +15 -3
  266. package/src/pragma/blocks.ts +211 -0
  267. package/src/pragma/index.ts +44 -10
  268. package/src/primitives.d.ts +54 -0
  269. package/src/primitives.ts +136 -0
  270. package/src/react-native.d.ts +57 -0
  271. package/src/react-native.ts +285 -0
  272. package/src/react-peers.d.ts +21 -3
  273. package/src/replay.d.ts +185 -0
  274. package/src/replay.ts +6 -0
  275. package/src/sandbox/build.ts +119 -0
  276. package/src/sandbox/create.ts +187 -0
  277. package/src/sandbox/engine.ts +267 -0
  278. package/src/sandbox/generated.ts +195 -0
  279. package/src/sandbox/kernel.ts +180 -0
  280. package/src/sandbox/mirror.ts +269 -0
  281. package/src/sandbox/protocol.ts +128 -0
  282. package/src/sandbox/quickjs.ts +74 -0
  283. package/src/sandbox/ssr.ts +41 -0
  284. package/src/sandbox/widget.ts +60 -0
  285. package/src/sandbox/worker-entry.ts +59 -0
  286. package/src/sandbox/worker.ts +137 -0
  287. package/src/sandbox-build.d.ts +12 -0
  288. package/src/sandbox-build.ts +6 -0
  289. package/src/sandbox.d.ts +299 -0
  290. package/src/sandbox.ts +25 -0
  291. package/src/shared.ts +12 -0
  292. package/src/terminal/paint.ts +712 -0
  293. package/src/terminal.d.ts +167 -0
  294. package/src/terminal.ts +530 -0
  295. package/src/three/assets.ts +170 -0
  296. package/src/three/host.ts +36 -0
  297. package/src/three/scene.ts +217 -0
  298. package/src/three/target.ts +252 -0
  299. package/src/three.d.ts +221 -0
  300. package/src/three.ts +30 -0
  301. package/src/ui/accordion.ts +21 -7
  302. package/src/ui/dialog.ts +192 -90
  303. package/src/ui/disclosure.ts +2 -0
  304. package/src/ui/dom.ts +30 -0
  305. package/src/ui/layers.ts +132 -0
  306. package/src/ui/popover.ts +120 -21
  307. package/src/ui/shared.ts +98 -12
  308. package/src/ui/stack.ts +18 -0
  309. package/src/ui/tabs.ts +2 -0
  310. package/src/ui/toaster.ts +16 -15
  311. package/src/ui/tooltip.ts +24 -8
  312. package/src/ui/tooltips.ts +26 -14
  313. package/src/ui/zag/combobox.ts +180 -13
  314. package/src/ui/zag/menu.ts +97 -17
  315. package/src/ui/zag/select.ts +15 -4
  316. package/src/ui/zag/shared.ts +60 -8
  317. package/src/ui-combobox.d.ts +16 -1
  318. package/src/ui-menu.d.ts +22 -7
  319. package/src/ui-zag-types.d.ts +13 -5
  320. package/src/ui.d.ts +62 -7
  321. package/src/ui.ts +2 -2
  322. package/src/vite/api.ts +186 -0
  323. package/src/vite/compile.ts +280 -0
  324. package/src/vite/plugin.d.ts +34 -0
  325. package/src/vite/plugin.ts +78 -4
  326. package/src/vite/sandbox.ts +16 -0
  327. package/src/worker/page.ts +396 -0
  328. package/src/worker/protocol.ts +48 -0
  329. package/src/worker/target.ts +282 -0
  330. package/src/worker-page.d.ts +42 -0
  331. package/src/worker-page.ts +12 -0
  332. package/src/worker.d.ts +65 -0
  333. package/src/worker.ts +16 -0
  334. package/src/yjs/driver.ts +253 -0
  335. package/src/yjs/mapping.ts +389 -0
  336. package/src/yjs/shared.ts +138 -0
  337. package/src/yjs/testing.ts +91 -0
  338. package/src/yjs-testing.d.ts +34 -0
  339. package/src/yjs-testing.ts +7 -0
  340. package/src/yjs.d.ts +109 -0
  341. package/src/yjs.ts +18 -0
  342. package/src/zag.d.ts +2 -0
  343. package/src/zag.ts +8 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"three.esm.js","sources":["../src/extra/controlled.ts","../src/extra/frame.ts","../src/three/target.ts","../src/extra/pointer.ts","../src/three/scene.ts","../src/three/host.ts","../src/three/assets.ts"],"sourcesContent":["/**\n * canvas-three Q3 (experimental in 7.2): the controlled imperative value of a widget that declares\n * `value` (extra/widget.ts). Both the app (the `value` prop, from state) and the widget (the user\n * types, orbits, pans) change the value; no echo loops, no stale overwrites.\n * Research: dev-plans/research/canvas-three (§6).\n *\n * 1. The first prop is the baseline (the widget was made with it): not written.\n * 2. A render writes only when the prop changed since the last render: a re-render for anything\n * else never pushes an old value over newer input.\n * 3. A changed prop equal to a value the widget reported (`local`) is its echo, perhaps a late\n * one: not written; the echoes up to it are dropped.\n * 4. Any other changed prop is the app's (a reset, a clamp, a load): written, pending echoes dropped.\n * 5. settle(prop), when the app had its turn after a local change: a prop that never moved (the\n * model rejected the edit) is written back (`strict`).\n */\nexport function controlled(write: (v: any) => void, equals: (a: any, b: any) => boolean = Object.is) {\n let q: any[] = [], last: any, has = 0, cur: any, dirty = 0\n const put = (v: any) => { q = []; cur = v; write(v); st.writes++ }\n const st = {writes: 0, echoes: 0, reverts: 0}\n return {\n st,\n local(v: any) {\n q.push(v)\n if (q.length > 64) q.shift()\n cur = v\n dirty = 1\n },\n prop(v: any) {\n if (!has) return void (has = 1, last = cur = v)\n if (equals(v, last)) return\n last = v\n dirty = 0\n const i = q.findIndex(x => equals(x, v))\n if (i >= 0) q.splice(0, i + 1), st.echoes++\n else if (equals(v, cur)) q = []\n else put(v)\n },\n settle(v: any) {\n if (!dirty) return\n dirty = 0\n if (equals(v, last) && !equals(v, cur)) put(v), st.reverts++\n },\n }\n}\n","/**\n * The frame phase (canvas-game B2): a `frame` timer delivers its actions from inside a\n * requestAnimationFrame callback, and the flush they cause runs in that callback's microtasks. A\n * widget that paints on requestAnimationFrame and asks for one from that flush gets the next\n * frame, and the frame after skips (the next request is for the one after): it painted every\n * other frame. So the timer driver marks the frame (`frameBegin` before its actions,\n * `frameEnd` after), and a widget asks `atFrameEnd(paint)` first: inside a frame, the paint runs at\n * the end of this frame's microtasks (after the flush), in the frame the state changed.\n *\n * The state is on a global symbol: the timer driver (main bundle) and sygnal/canvas,\n * sygnal/three (their own bundles) share it without an export. 0 B in the core.\n */\ntype Phase = {depth: number, count: number, paints: Set<() => void>, ends: Set<() => void>}\nconst K = Symbol.for('sygnal.frame')\nconst phase = (): Phase => (globalThis as any)[K] || ((globalThis as any)[K] = {depth: 0, count: 0, paints: new Set(), ends: new Set()})\n\n/** frame actions are about to be delivered (the timer driver's animation frame callback) */\nexport function frameBegin() { phase().depth++ }\n\n/** inside a frame (its actions, the flush they cause, its paints): renderComponent's settle() ignores it */\nexport const inFrame = () => phase().depth > 0\n\n/** frames ended so far, and a listener for each frame's end (renderComponent's t.frames) */\nexport const frameCount = () => phase().count\nexport function onFrameEnd(f: () => void): () => void {\n const e = phase().ends\n e.add(f)\n return () => e.delete(f)\n}\n\n/**\n * after the frame's actions: a microtask (queued after the flush their state writes scheduled)\n * that runs the paints widgets asked for meanwhile\n */\nexport function frameEnd() {\n queueMicrotask(() => {\n const f = phase()\n if (--f.depth > 0) return\n f.depth = 0\n const ps = [...f.paints]\n f.paints.clear()\n for (const p of ps) try { p() } catch (e) { queueMicrotask(() => { throw e }) }\n f.count++\n for (const e of [...f.ends]) e()\n })\n}\n\n/** a widget's paint: queued for the end of the current frame (true), or not inside one (false: request a frame as usual) */\nexport function atFrameEnd(paint: () => void): boolean {\n const f = phase()\n if (!f.depth) return false\n f.paints.add(paint)\n return true\n}\n","/**\n * sygnal/three: the three.js target, a patched element tree (vnodes with `.elm`) mapped to THREE objects.\n *\n * - Tags: any THREE export, lowercased (`<mesh>`, `<group>`, `<boxGeometry>`,\n * `<meshStandardMaterial>`, `<perspectiveCamera>`, `<directionalLight>`); `extend({ OrbitControls })`\n * adds more. A tag the catalog doesn't know (a component's wrapper div, a Collection's) is\n * transparent: its children attach to the nearest object above it.\n * - `args` are the constructor's arguments; a change of `args` makes a new object (its children\n * and attachments move over), as react-three-fiber does.\n * - Every other prop is written to the object: a value with `.set` (Vector3, Euler, Color, Quaternion)\n * is set from an array, a number (`scale={2}`: setScalar) or a color string; anything else is\n * assigned. A prop that disappears goes back to the class's default.\n * - Children: an Object3D child is added to its parent Object3D. A geometry attaches as the\n * parent's `geometry`, a material as its `material`, anything else by `attach=\"map\"`. On removal\n * the previous value is put back.\n * - Disposal: an object the target made (from a tag) is disposed when its element goes, unless\n * `dispose={null}`. Objects passed in as props (`geometry={shared}`) are the app's: never disposed.\n * - `animate={{ rotation: (t, dt, obj) => [0, t, 0] }}`: per-frame values, outside state and the\n * render flush (frame() calls them; no vnode, no patch, no app work per frame).\n * - `hit={false}`: raycasts pass through the object (CSS pointer-events: none).\n * - `<primitive object={obj}>`: an object of the app's (never disposed by the target);\n * `<primitive asset>`: a loaded one (`<Model>` / `<Texture>`, three/assets.ts): the asset's\n * clone or value, released (and freed with its last user) when the element goes.\n * - `capture` / `draggable`: read by the pointer router (`prop(el, k)`), never written.\n * - pick(x, y) (normalized device coordinates) → the topmost hit's element, with plain-data\n * intersection fields for the event (point, distance, uv, normal, faceIndex) plus `object`;\n * `skip`: an element whose objects the ray passes through (a dragged one, for dragover).\n */\nimport * as THREE from 'three'\n\nconst catalog = new Map<string, any>()\nfor (const k of Object.keys(THREE)) {\n const v = (THREE as any)[k]\n if (typeof v == 'function' && /^[A-Z]/.test(k)) catalog.set(k.toLowerCase(), v)\n}\n// <primitive>: the object is given (object=) or loaded (asset=), not constructed\nconst PRIMITIVE = function Primitive() {}\ncatalog.set('primitive', PRIMITIVE)\nexport const extend = (objects: Record<string, any>) => { for (const k in objects) catalog.set(k.toLowerCase(), objects[k]) }\n\n// the target's own props (and the element's), never written to the object\nconst OWN = /^(args|attach|animate|dispose|makeDefault|hit|object|asset|capture|draggable|className|class|id|key|hook|style|role|tabIndex|title|hidden|ref)$|^(aria|data)-/\n\nexport interface Rec {\n el: any; obj: any; ctor: any; args: any[] | undefined\n props: Record<string, any>; v: any; seen: number\n attached?: {target: any, key: string, prev: any}\n animate?: Record<string, (t: number, dt: number, obj: any) => any>\n}\n\nconst tagOf = (sel: string) => /^[^#.]*/.exec(sel)![0].toLowerCase()\nconst propsOf = (v: any) => {\n const d = v.data || {}, out: any = {}\n // a tag the pragma takes for SVG (<line>) gets its props as attrs, with their values as written\n for (const src of [d.attrs, d.props]) if (src) for (const k in src) if (!OWN.test(k)) out[k] = src[k]\n for (const src of [d.attrs, d.props]) if (src) for (const k of TARGET) if (k in src) out[k] = src[k]\n return out\n}\nconst TARGET = ['args', 'attach', 'animate', 'dispose', 'makeDefault', 'hit', 'object', 'asset', 'capture', 'draggable']\n// a primitive's identity is its object (or asset): a new one makes a new element object, as new args do\nconst argsOf = (ctor: any, p: any) => ctor === PRIMITIVE ? [p.asset || p.object] : p.args\nconst sameArr = (a: any, b: any) => a === b || (Array.isArray(a) && Array.isArray(b) && a.length == b.length && a.every((x, i) => x === b[i]))\n\nexport function applyProp(obj: any, k: string, v: any) {\n const cur = obj[k]\n // a method named as a prop is called with the value as its arguments (lookAt={[0, 0, 0]})\n if (typeof cur == 'function') return Array.isArray(v) ? cur.apply(obj, v) : cur.call(obj, v)\n if (cur && typeof cur.set == 'function' && typeof cur != 'function') {\n if (Array.isArray(v)) cur.set(...v)\n else if (typeof v == 'number' && cur.setScalar) cur.setScalar(v)\n else if (v && typeof v == 'object' && cur.copy && v.constructor === cur.constructor) cur.copy(v)\n else cur.set(v)\n } else obj[k] = v\n}\n\nexport interface ThreeStats { syncs: number; created: number; applied: number; disposed: number; frames: number; animatedWrites: number; picks: number }\n\nexport function createThreeTarget() {\n const scene = new THREE.Scene()\n const root: Rec = {el: null, obj: scene, ctor: THREE.Scene, args: undefined, props: {}, v: null, seen: 0}\n const fallback = new THREE.PerspectiveCamera(50, 1, 0.1, 1000)\n fallback.position.set(0, 0, 5)\n let camera: any = null, aspect = 1\n const recs = new Map<any, Rec>(), byObj = new WeakMap<any, Rec>(), animated = new Set<Rec>(), defaults = new Map<any, any>()\n const raycaster = new THREE.Raycaster()\n const stats: ThreeStats = {syncs: 0, created: 0, applied: 0, disposed: 0, frames: 0, animatedWrites: 0, picks: 0}\n let gen = 0\n\n const dflt = (ctor: any) => {\n if (!defaults.has(ctor)) { let d = null; try { d = new ctor() } catch (_) {} defaults.set(ctor, d) }\n return defaults.get(ctor)\n }\n const make = (r: Rec, props: any) => {\n r.obj = r.ctor === PRIMITIVE ? (props.asset ? props.asset.take() : props.object) : new r.ctor(...(props.args || []))\n if (!r.obj) throw new Error('<primitive> needs an object')\n r.args = argsOf(r.ctor, props)\n byObj.set(r.obj, r)\n stats.created++\n if (r.obj.isCamera && (props.makeDefault || !camera)) camera = r.obj, fit()\n }\n const dispose = (r: Rec) => {\n const o = r.obj\n // the app's object is never disposed; an asset's, by the asset when its last user goes\n if (r.ctor === PRIMITIVE) r.args?.[0]?.release?.()\n else if (r.props.dispose !== null && typeof o.dispose == 'function') o.dispose(), stats.disposed++\n }\n const detach = (r: Rec) => {\n const o = r.obj\n o.isObject3D && o.parent?.remove(o)\n if (r.attached && r.attached.target[r.attached.key] === o) r.attached.target[r.attached.key] = r.attached.prev\n r.attached = undefined\n if (o === camera) camera = null\n }\n const remove = (r: Rec) => {\n detach(r)\n recs.delete(r.el)\n animated.delete(r)\n dispose(r)\n }\n const apply = (r: Rec, props: any) => {\n const o = r.obj, old = r.props\n // a key `animate` drove and no longer does: its static prop applies again (or the default)\n const stopped = old.animate ? Object.keys(old.animate).filter(k => !props.animate || !(k in props.animate)) : []\n for (const k of [...Object.keys(old), ...stopped]) if (!(k in props) && !OWN.test(k) && k != 'args') {\n const d = dflt(r.ctor === PRIMITIVE ? o.constructor : r.ctor)\n if (d && k in d) { const x = d[k]; x && typeof x.clone == 'function' ? applyProp(o, k, x.clone()) : (o[k] = x) }\n else delete o[k]\n }\n for (const k in props) {\n if (OWN.test(k) || k == 'args' || (sameArr(props[k], old[k]) && !stopped.includes(k))) continue\n applyProp(o, k, props[k])\n stats.applied++\n }\n r.props = props\n r.animate = props.animate\n props.animate ? animated.add(r) : animated.delete(r)\n if (o.isCamera) fit(o)\n }\n // an object goes into its parent: an Object3D as a child, anything else attached\n const place = (r: Rec, parent: Rec) => {\n const o = r.obj, p = parent.obj\n if (o.isObject3D && p.isObject3D) { if (o.parent !== p) p.add(o); return }\n const key = r.props.attach || (o.isBufferGeometry ? 'geometry' : o.isMaterial ? 'material' : o.isFog ? 'fog' : null)\n if (!key || (r.attached && r.attached.target === p && p[key] === o)) return\n if (r.attached) detach(r)\n r.attached = {target: p, key, prev: p[key]}\n p[key] = o\n }\n const walk = (kids: any[] | undefined, parent: Rec) => {\n if (kids) for (const k of kids) {\n if (!k || !k.sel) continue\n const ctor = catalog.get(tagOf(k.sel))\n if (!ctor) { walk(k.children, parent); continue }\n let r = recs.get(k.elm)\n const props = propsOf(k)\n if (!r || r.ctor !== ctor) {\n if (r) remove(r)\n r = {el: k.elm, obj: null, ctor, args: undefined, props: {}, v: null, seen: 0}\n make(r, props)\n recs.set(k.elm, r)\n } else if (!sameArr(r.args, argsOf(ctor, props))) {\n // new constructor arguments: a new object; its children and attachments move over in the walk below\n const old = r.obj, kids3 = old.isObject3D ? [...old.children] : []\n detach(r)\n dispose(r)\n make(r, props)\n for (const c of kids3) r.obj.add(c)\n r.props = {}, r.v = null\n }\n r.seen = gen\n if (r.v !== k) apply(r, props), r.v = k\n place(r, parent)\n walk(k.children, r)\n }\n }\n const cast = (x: number, y: number) => {\n const cam = camera || fallback\n scene.updateMatrixWorld()\n cam.updateMatrixWorld()\n raycaster.setFromCamera(new THREE.Vector2(x, y), cam)\n return cam\n }\n const fit = (c: any = camera) => {\n if (c?.isPerspectiveCamera && !('aspect' in (byObj.get(c)?.props || {}))) c.aspect = aspect\n c?.updateProjectionMatrix?.()\n }\n\n return {\n scene,\n stats,\n animated,\n camera: () => camera || fallback,\n /** after each patch of the island: its children container's vnode */\n sync(container: any) {\n stats.syncs++\n gen++\n walk(container?.children, root)\n for (const r of [...recs.values()]) if (r.seen !== gen) remove(r)\n },\n setSize(w: number, h: number) { aspect = w / h; fit(); fit(fallback) },\n /** per-frame values (`animate` props): no vnode, no patch */\n frame(t: number, dt: number) {\n stats.frames++\n for (const r of animated) for (const k in r.animate!) {\n const v = r.animate![k](t, dt, r.obj)\n if (v !== undefined) applyProp(r.obj, k, v), stats.animatedWrites++\n }\n },\n /** the topmost element under (x, y) in normalized device coordinates (-1..1, y up) */\n pick(x: number, y: number, skip?: any) {\n stats.picks++\n cast(x, y)\n const s = skip && recs.get(skip)?.obj\n for (const h of raycaster.intersectObject(scene, true)) {\n let o: any = h.object, r: Rec | undefined, visible = true\n for (let a: any = o; a; a = a.parent) if (!a.visible || a === s) visible = false\n if (!visible) continue\n while (o && !(r = byObj.get(o))) o = o.parent\n if (!r || r.props.hit === false) continue\n return {\n el: r.el, object: h.object, distance: h.distance, point: h.point.toArray(),\n uv: h.uv?.toArray(), normal: h.face?.normal.toArray(), faceIndex: h.faceIndex, ndc: [x, y],\n }\n }\n return null\n },\n /** the pointer's ray at (x, y), normalized device coordinates, and the camera's direction (drag planes) */\n ray(x: number, y: number) {\n const cam = cast(x, y), r = raycaster.ray\n return {origin: r.origin.toArray(), direction: r.direction.toArray(), forward: cam.getWorldDirection(new THREE.Vector3()).toArray()}\n },\n /** a target prop of an element (`capture`, `draggable`), as the view wrote it */\n prop: (el: any, k: string) => recs.get(el)?.props[k],\n /** where an element's object is on screen, in normalized device coordinates (tests, a11y focus rings) */\n project(el: any): [number, number] | null {\n const r = recs.get(el)\n if (!r?.obj.isObject3D) return null\n scene.updateMatrixWorld()\n const cam = camera || fallback\n cam.updateMatrixWorld()\n const box = new THREE.Box3().setFromObject(r.obj)\n const c = box.isEmpty() ? r.obj.getWorldPosition(new THREE.Vector3()) : box.getCenter(new THREE.Vector3())\n c.project(cam)\n return [c.x, c.y]\n },\n objectOf: (el: any) => recs.get(el)?.obj,\n size: () => recs.size,\n dispose() { for (const r of [...recs.values()]) remove(r) },\n }\n}\n\nexport type ThreeTarget = ReturnType<typeof createThreeTarget>\n","/**\n * DOM-shaped events for picked scene nodes: the one pointer router of sygnal/three (raycasts) and\n * sygnal/canvas (2D hit tests). No core imports: each subpath bundles it.\n *\n * A scene node is an element: a real DOM element (an island inside a DOM app) or a sygnal/host\n * HostElement (a whole app on a host target). `fire()` makes the event the way that element's\n * document makes events, so the app's DOM driver delegates it like any other: `DOM.click('.cube')`\n * in an intent, isolation per component included.\n *\n * `pointerRouter(pick)` turns raw pointer input at (x, y) into the DOM's sequence on the topmost\n * picked element: pointerover/pointerenter, pointermove, pointerdown, pointerup, click (on the\n * nearest common ancestor of the down and up targets, as the DOM does), pointerout/pointerleave.\n * Only the topmost hit is a target and the event bubbles up the scene graph (DOM semantics, not\n * react-three-fiber's \"every intersection\" propagation).\n *\n * Pointer capture (the DOM's setPointerCapture): an element with a `capture` prop captures the\n * pointer that went down on it (or inside it), and `el.setPointerCapture(e.pointerId)` on a scene\n * element does the same from code. Until pointerup / pointercancel, pointermove and pointerup go\n * to that element wherever the pointer is (off the object, off the canvas), with\n * `gotpointercapture` / `lostpointercapture` around them. A captured event's `point` is on the\n * drag plane through the point the pointer went down on: `capture=\"xz\"` (the ground), `\"xy\"`,\n * `\"yz\"`, else (`capture`, setPointerCapture) facing the camera; `delta` is the move from that\n * point, `ray` the pointer's ray. No hover events while captured; a capture that moved more than\n * SLOP px clicks nothing (a drag is not a click: the one difference from the DOM).\n *\n * `draggable` (HTML drag and drop): after a SLOP px move from a pointerdown on it, `dragstart`\n * (cancelable), `drag` on it per move, `dragenter` / `dragover` / `dragleave` on the element\n * under the pointer (the ray passes through the dragged object), `drop` there if its last\n * dragover was canceled (preventDefault: processDrag's dropZone does), `dragend`. The events carry\n * a DataTransfer-shaped `dataTransfer` (one per drag) and the hit's fields. No pointer events and no\n * click during the drag, unless the element also captures (then it gets pointermove too: it can\n * follow the pointer while the drop target sees dragover).\n *\n * sygnal/canvas adds three options: `capture(hit)` captures a press implicitly (the DOM's touch\n * semantics: a canvas editor captures every press, `<Canvas capture=\"all\">`), `fields(x, y)` gives\n * captured events their coordinates where there is no drag plane (`world`, `screen`, `delta`), and\n * a pick may return `root` itself (the background): it is then a target like any element, and a\n * click whose down and up targets have no other common ancestor goes to it.\n */\n\nexport type Hit = {el: any, [k: string]: any}\n/** (x, y) → the topmost hit; `skip`: an element whose objects the pick passes through */\nexport type Pick = (x: number, y: number, skip?: any) => Hit | null\nexport type Ray = {origin: number[], direction: number[], forward?: number[], ndc?: number[]}\nexport interface RouterOptions {\n /** the pointer's ray at (x, y) (captured events' drag plane) */\n ray?(x: number, y: number): Ray | null\n /** an element's target prop (`capture`, `draggable`) */\n prop?(el: any, key: string): any\n /** a press's implicit capture: a capture kind (true, 'xz', …) captures the pressed element, else the `capture` prop decides */\n capture?(hit: Hit): any\n /** a captured event's fields at (x, y), after the drag plane's (a 2D scene: world, screen, delta) */\n fields?(x: number, y: number): Record<string, any> | null\n}\n\n/** how far (px) a pointer moves before a press is a drag */\nexport const SLOP = 3\n\n// fields every pointer event carries from the input (clientX, buttons, shiftKey, …)\nconst BASE = ['clientX', 'clientY', 'offsetX', 'offsetY', 'button', 'buttons', 'pointerId', 'pointerType', 'shiftKey', 'ctrlKey', 'altKey', 'metaKey']\n\n/** dispatch `type` on `el`; `extra` fields (point, distance, object, …) are added to the event */\nexport function fire(el: any, type: string, init: Record<string, any> = {}, extra: Record<string, any> = {}, bubbles = true): boolean {\n const win: any = el.ownerDocument?.defaultView || {}\n const base: any = {bubbles, cancelable: true}\n for (const k of BASE) if (init[k] !== undefined) base[k] = init[k]\n const E = (/^(pointer|gotp|lostp)/.test(type) && win.PointerEvent) || (/^drag|^drop$/.test(type) && win.DragEvent) || win.MouseEvent || win.Event\n const ev = new E(type, base)\n // a browser event's own fields are read-only getters: the scene's go on as own properties\n for (const k in extra) Object.defineProperty(ev, k, {value: extra[k], configurable: true, enumerable: true})\n return el.dispatchEvent(ev)\n}\n\nconst chain = (el: any, root: any): any[] => {\n const out: any[] = []\n for (let e = el; e && e !== root; e = e.parentNode) out.push(e)\n return out\n}\n\nexport interface PointerRouter {\n /** a native pointer event at scene coordinates (x, y): move, down, up, cancel, leave, or any other type (dblclick, contextmenu, wheel) */\n input(type: string, x: number, y: number, init?: Record<string, any>): Hit | null\n /** the hovered element (per the last input) */\n hovered(): any\n /** the element that has the pointer captured, if any */\n captured(): any\n /** whether a press on a draggable element, or its drag, is under way */\n dragging(): boolean\n /** capture the pointer to `el` (`kind`: its drag plane, else its `capture` prop) */\n capture(el: any, pointerId?: number, kind?: any): void\n release(el?: any): void\n}\n\nconst NORMALS: Record<string, number[]> = {xz: [0, 1, 0], xy: [0, 0, 1], yz: [1, 0, 0]}\nconst dot = (a: number[], b: number[]) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2]\nconst sub = (a: number[], b: number[]) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]]\n// where the ray meets the plane through `at` with normal `n` (null: parallel, or behind the camera)\nconst onPlane = (r: Ray, n: number[], at: number[]) => {\n const d = dot(n, r.direction)\n if (Math.abs(d) < 1e-9) return null\n const t = dot(n, sub(at, r.origin)) / d\n return t < 0 ? null : r.origin.map((o, i) => o + r.direction[i] * t)\n}\n// a DataTransfer-shaped object: the scene's drag doesn't go through the browser's\nconst transfer = () => {\n const data = new Map<string, string>()\n return {\n dropEffect: 'none', effectAllowed: 'all', files: [], items: [],\n get types() { return [...data.keys()] },\n setData: (t: string, v: string) => { data.set(t, String(v)) },\n getData: (t: string) => data.get(t) ?? '',\n clearData: (t?: string) => { t == null ? data.clear() : data.delete(t) },\n setDragImage() {},\n }\n}\nconst P = '__sp'\n// a hit's fields for an event (its element is the event's target)\nconst fields = (h: Hit | null) => { const {el, ...f} = h || {} as any; return f }\n\n/** `root`: the element enter/leave stop at (the island's children container) */\nexport function pointerRouter(pick: Pick, root: any, opts: RouterOptions = {}): PointerRouter {\n let over: Hit | null = null, down: any = null, at: number[] = [0, 0], grab: Hit | null = null\n // the capture: element, pointer, drag plane (normal, point), farthest move (px)\n let cap: {el: any, id: any, n?: number[], p?: number[], last?: number[], moved: number} | null = null\n // the HTML drag: source, started, element under the pointer, its last dragover canceled, dataTransfer\n let drag: {src: any, on: boolean, over: any, ok: boolean, dt: any} | null = null\n const prop = (el: any, k: string) => { const v = opts.prop?.(el, k); return v === false || v == null ? undefined : v }\n const closest = (el: any, k: string) => chain(el, root).find(e => prop(e, k) !== undefined)\n // the nearest common ancestor of a press's and a release's targets (the background when one was it)\n const common = (a: any, b: any) => { const cb = chain(b, root); return chain(a, root).find(e => cb.includes(e)) || (a === root || b === root ? root : undefined) }\n const hover = (hit: Hit | null, init: any) => {\n const a = over?.el, b = hit?.el\n if (a === b) { over = hit; return }\n const ca = chain(a, root), cb = chain(b, root)\n if (a) {\n fire(a, 'pointerout', init, over!)\n for (const e of ca) if (!cb.includes(e)) fire(e, 'pointerleave', init, over!, false)\n }\n over = hit\n if (b) {\n fire(b, 'pointerover', init, hit!)\n for (const e of cb.slice().reverse()) if (!ca.includes(e)) fire(e, 'pointerenter', init, hit!, false)\n }\n }\n const capture = (el: any, id: any = 1, kind?: any) => {\n if (cap?.el === el) return\n if (cap) release()\n kind ??= prop(el, 'capture')\n const r = opts.ray?.(at[0], at[1])\n cap = {el, id, n: NORMALS[kind] || r?.forward, p: grab?.point, moved: 0}\n fire(el, 'gotpointercapture', {pointerId: id})\n }\n const release = (init?: any) => {\n const c = cap\n cap = null\n if (c) fire(c.el, 'lostpointercapture', {...init, pointerId: c.id})\n }\n // setPointerCapture & co. on the scene's elements: the router's capture, not the browser's (which\n // would send the canvas's pointer to a hidden element)\n const patch = (el: any) => {\n for (const e of chain(el, root)) if (!e[P]) Object.defineProperties(e, {\n [P]: {value: 1},\n setPointerCapture: {value: (id: any) => capture(e, id ?? 1), configurable: true},\n releasePointerCapture: {value: () => { if (cap?.el === e) release() }, configurable: true},\n hasPointerCapture: {value: () => cap?.el === e, configurable: true},\n })\n }\n // a captured event's fields: the point on the drag plane, its move from the grab point, the ray\n const capFields = (x: number, y: number, init: any) => {\n const c = cap!, r = opts.ray?.(x, y)\n c.moved = Math.max(c.moved, Math.hypot(x - at[0], y - at[1]))\n const p = r && c.n && c.p && onPlane(r, c.n, c.p) || c.last\n c.last = p\n return {...(p && {point: p, delta: c.p ? sub(p, c.p) : [0, 0, 0]}), ...(r && {ray: {origin: r.origin, direction: r.direction}, ndc: r.ndc}), ...opts.fields?.(x, y), captured: true, pointerId: init.pointerId ?? c.id}\n }\n // the HTML drag's step; true: the input is the drag's (no pointer events for it)\n const dragStep = (type: string, x: number, y: number, init: any): boolean => {\n const d = drag!\n if (!d.on) {\n if (type != 'move') { drag = null; return false }\n if (Math.hypot(x - at[0], y - at[1]) <= SLOP) return false\n d.dt = transfer()\n if (!fire(d.src, 'dragstart', init, {...fields(grab), dataTransfer: d.dt})) { drag = null; return false }\n d.on = true\n }\n const hit = pick(x, y, d.src), t = hit?.el, ex = {...fields(hit), dataTransfer: d.dt}\n if (type == 'move') {\n fire(d.src, 'drag', init, {dataTransfer: d.dt})\n if (t !== d.over) {\n if (d.over) fire(d.over, 'dragleave', init, ex)\n if (t) fire(t, 'dragenter', init, ex)\n d.over = t\n }\n d.ok = !!t && !fire(t, 'dragover', init, ex)\n } else {\n if (type == 'up' && d.over && d.ok) d.dt.dropEffect = d.dt.effectAllowed == 'all' ? 'move' : d.dt.effectAllowed.replace(/^(copy|link|move).*/i, '$1'), fire(d.over, 'drop', init, ex)\n else if (d.over) fire(d.over, 'dragleave', init, ex)\n fire(d.src, 'dragend', init, {dataTransfer: d.dt})\n drag = null\n }\n return !cap\n }\n return {\n hovered: () => over?.el || null,\n captured: () => cap?.el || null,\n dragging: () => !!drag,\n capture,\n release: (el?: any) => { if (!el || cap?.el === el) release() },\n input(type, x, y, init = {}) {\n const end = type == 'up' || type == 'cancel'\n // a drag (draggable): its events instead of the pointer's\n const wasDrag = !!drag?.on\n if (drag && (type == 'move' || end) && dragStep(type, x, y, init)) {\n if (end) { down = null; hover(type == 'up' ? pick(x, y) : null, init) }\n return null\n }\n if (cap && (type == 'move' || end || type == 'leave')) {\n // captured: the pointer is the element's wherever it is (no hover events, nothing on leave)\n if (type == 'leave') return null\n const c = cap, ex = capFields(x, y, init)\n if (type == 'move') { fire(c.el, 'pointermove', init, ex); return null }\n fire(c.el, type == 'up' ? 'pointerup' : 'pointercancel', init, ex)\n release(init)\n const h = type == 'up' ? pick(x, y) : null\n // the click: on the common ancestor of the down target and the captured one, unless it was a drag\n if (h && down && c.moved <= SLOP && !wasDrag) {\n const target = common(down, c.el)\n if (target) fire(target, 'click', init, h.el == c.el ? h : ex)\n }\n down = null\n hover(h, init)\n return null\n }\n const hit = type == 'leave' || type == 'cancel' ? null : pick(x, y)\n if (type == 'leave' || type == 'move' || type == 'down' || end) hover(hit, init)\n if (!hit) { if (end) down = null; return null }\n const el = hit.el\n if (type == 'move') fire(el, 'pointermove', init, hit)\n else if (type == 'down') {\n at = [x, y], grab = hit, down = el\n patch(el)\n fire(el, 'pointerdown', init, hit)\n // implicit capture, else a `capture` prop (unless a handler captured it already)\n if (!cap) {\n const k = opts.capture?.(hit), c = k != null && k !== false ? el : closest(el, 'capture')\n if (c) capture(c, init.pointerId ?? 1, k != null && k !== false && k !== true ? k : undefined)\n }\n const d = closest(el, 'draggable')\n drag = d ? {src: d, on: false, over: null, ok: false, dt: null} : null\n } else if (type == 'up') {\n fire(el, 'pointerup', init, hit)\n // click goes to the nearest common ancestor of the down and up targets\n if (down && !wasDrag) {\n const target = common(down, el)\n if (target) fire(target, 'click', init, hit)\n }\n down = null\n } else if (type != 'leave' && type != 'cancel') fire(el, type, init, hit)\n return hit\n },\n }\n}\n","/**\n * sygnal/three <Scene>: a three.js island inside a DOM app: defineWidget({ children: true }) +\n * the three target + the pointer router.\n *\n * <Scene className=\"viewport\" width={640} height={400} background=\"#10141c\">\n * <ambientLight intensity={0.4} />\n * <Collection of={Cube} from=\"cubes\" /> // components inside: their own intents, isolation\n * </Scene>\n *\n * Props: width, height (else the host's size), background, frameloop ('demand' | 'always' |\n * 'never'), headless (no WebGLRenderer: picking and the scene graph only; the default in jsdom\n * and on a host document), camera + Orbit (a controlled camera: sygnal's controlled() helper; the\n * widget's own `value` protocol is for one `value` prop, the camera is a second one).\n *\n * Keyboard: the children are accessible (defineWidget's default): a mesh with `tabIndex={0}` and a\n * role is focusable, Enter / Space click it (with no intersection on the event), and the focus\n * ring is drawn where the object is (focus()).\n *\n * Dragging (extra/pointer.ts): `capture` / `setPointerCapture` keep a drag's pointer on its element\n * (the canvas captures the browser's pointer, so the drag goes on off the canvas), `draggable` the\n * HTML drag events (processDrag); camera controls sit out a gesture that captures or drags.\n *\n * Frame loop ('demand', react-three-fiber's term): a frame is drawn after a patch of the island,\n * and continuously while any element has an `animate` prop. A frame runs the `animate`\n * functions and draws; the app's state, views and the DOM patch are not involved.\n */\nimport * as THREE from 'three'\nimport {defineWidget} from '../index'\nimport {controlled} from '../extra/controlled'\nimport {atFrameEnd} from '../extra/frame'\nimport {createThreeTarget} from './target'\nimport {pointerRouter} from '../extra/pointer'\n\nconst isHeadless = (el: any) => {\n const win = el.ownerDocument?.defaultView\n return !win?.WebGL2RenderingContext || (typeof navigator != 'undefined' && /jsdom/i.test(navigator.userAgent))\n}\n\nexport const Scene = defineWidget({\n name: 'Scene',\n children: true,\n // three's <line> is an SVG tag to the pragma: plain here\n tags: ['line'],\n events: ['camerachange'],\n mount(el: any, props: any, emit: any) {\n const doc = el.ownerDocument\n const target = createThreeTarget()\n const headless = props.headless ?? isHeadless(el)\n let renderer: any = null, canvas: any\n let w = props.width || el.clientWidth || 300, h = props.height || el.clientHeight || 150\n if (!headless) {\n renderer = new THREE.WebGLRenderer({antialias: true})\n renderer.setPixelRatio(doc.defaultView.devicePixelRatio || 1)\n canvas = renderer.domElement\n } else canvas = doc.createElement('canvas')\n el.appendChild(canvas)\n const resize = (W: number, H: number) => {\n w = W, h = H\n target.setSize(w, h)\n renderer?.setSize(w, h)\n if (!renderer) canvas.width = w, canvas.height = h\n }\n resize(w, h)\n if (props.background) target.scene.background = new THREE.Color(props.background)\n\n // input: native pointer events on the canvas → raycasts → DOM-shaped events on the elements\n const ndc = (x: number, y: number) => [x / w * 2 - 1, -(y / h) * 2 + 1]\n const router = pointerRouter((x, y, skip) => target.pick(ndc(x, y)[0], ndc(x, y)[1], skip), el.firstChild, {\n ray: (x, y) => { const n = ndc(x, y); return {...target.ray(n[0], n[1]), ndc: n} },\n prop: target.prop,\n })\n // the keyboard focus ring: where the focused child's object is drawn\n const ring = doc.createElement('div')\n Object.assign(ring.style, {position: 'absolute', width: '56px', height: '56px', margin: '-28px 0 0 -28px', border: '2px solid #ffb547', borderRadius: '50%', pointerEvents: 'none', display: 'none'})\n if (!el.style.position) el.style.position = 'relative'\n el.appendChild(ring)\n // a gesture that captures or drags an object: the canvas holds the browser's pointer (moves off\n // the canvas still arrive), and the camera controls sit it out\n let held: any = null\n const hold = (e: any, end: boolean) => {\n const busy = !end && !!(router.captured() || router.dragging())\n if (busy && !held) {\n held = {orbit: orbit && orbit.enabled}\n if (orbit) orbit.enabled = false\n try { e.pointerId != null && canvas.setPointerCapture?.(e.pointerId) } catch (_) {}\n } else if (!busy && held) {\n if (orbit && held.orbit) orbit.enabled = true\n held = null\n }\n }\n const on = (type: string, kind: string) => {\n const f = (e: any) => {\n router.input(kind, e.offsetX, e.offsetY, e)\n // a capture released off the canvas: its pointerleave came while captured\n if (held && (kind == 'up' || kind == 'cancel') && (e.offsetX < 0 || e.offsetY < 0 || e.offsetX > w || e.offsetY > h)) router.input('leave', e.offsetX, e.offsetY, e)\n hold(e, kind == 'up' || kind == 'cancel')\n if (kind != 'leave') invalidate()\n }\n canvas.addEventListener(type, f)\n return () => canvas.removeEventListener(type, f)\n }\n const offs = [on('pointermove', 'move'), on('pointerdown', 'down'), on('pointerup', 'up'), on('pointercancel', 'cancel'), on('pointerleave', 'leave'), on('dblclick', 'dblclick'), on('contextmenu', 'contextmenu')]\n\n // the frame loop\n const raf = doc.defaultView?.requestAnimationFrame?.bind(doc.defaultView) || (globalThis as any).requestAnimationFrame\n const caf = doc.defaultView?.cancelAnimationFrame?.bind(doc.defaultView) || (globalThis as any).cancelAnimationFrame\n let frameloop = props.frameloop || 'demand', pending = 0, last = -1\n const stats = {renders: 0}\n const tick = (ms: number) => {\n pending = 0\n const t = ms / 1000, dt = last < 0 ? 0 : t - last\n last = t\n target.frame(t, dt)\n orbit?.update()\n renderer?.render(target.scene, target.camera())\n stats.renders++\n if (target.animated.size || frameloop == 'always') invalidate()\n }\n // inside a frame timer's frame (canvas-game B2): render at its end, in this frame; else the next frame\n const now = () => { if (pending) caf?.(pending); pending = 0; tick(doc.defaultView?.performance?.now?.() ?? (globalThis as any).performance.now()) }\n const invalidate = () => { if (frameloop != 'never' && !atFrameEnd(now) && !pending && raf) pending = raf(tick) }\n\n // a controlled camera (OrbitControls moves it; the app may set it): controlled.ts\n let orbit: any = null, cam: any = null\n const readCam = () => { const c = target.camera(); return {position: c.position.toArray(), target: orbit ? orbit.target.toArray() : [0, 0, 0]} }\n const writeCam = (v: any) => {\n const c = target.camera()\n c.position.set(...(v.position as [number, number, number]))\n orbit ? orbit.target.set(...(v.target || [0, 0, 0])) : c.lookAt(...((v.target || [0, 0, 0]) as [number, number, number]))\n orbit?.update()\n invalidate()\n }\n let camProp = props.camera, synced = false\n if (props.Orbit) cam = controlled(writeCam, (a: any, b: any) => JSON.stringify(a) == JSON.stringify(b))\n // after a sync: the scene's camera may be new (the first sync makes it); the controls follow it\n const afterSync = () => {\n if (props.Orbit && orbit?.object !== target.camera()) {\n orbit?.dispose()\n orbit = new props.Orbit(target.camera(), canvas)\n // the user moved the camera: one event per gesture (its end), not per frame\n orbit.addEventListener('change', invalidate)\n orbit.addEventListener('end', () => { const v = readCam(); cam.local(v); emit('camerachange', v) })\n }\n if (!synced) {\n synced = true\n // the camera starts where the prop says (the controlled value's baseline)\n if (camProp) { writeCam(camProp); cam?.prop(camProp) }\n }\n }\n\n const inst: any = {\n target, router, stats, canvas, el, ring, props,\n get headless() { return headless },\n invalidate, tick,\n /** raw input at canvas pixels (tests) */\n pointer: (kind: string, x: number, y: number, init?: any) => router.input(kind, x, y, init),\n /** where an element's object is, in canvas pixels */\n pixelOf(node: any) { const p = target.project(node); return p && [(p[0] + 1) / 2 * w, (1 - p[1]) / 2 * h] },\n /** a real click on an element: pointer down + up where its object is drawn, through the raycaster */\n click(node: any, init?: any) {\n const p = inst.pixelOf(node)\n if (!p) return null\n router.input('move', p[0], p[1], init)\n router.input('down', p[0], p[1], init)\n return router.input('up', p[0], p[1], init)\n },\n /** a drag: down on the element, moves (`steps`) to `to` (canvas pixels, or another element's place), up */\n drag(node: any, to: any, {steps = 5, ...init}: any = {}) {\n const a = inst.pixelOf(node), b = Array.isArray(to) ? to : inst.pixelOf(to)\n if (!a || !b) return null\n router.input('move', a[0], a[1], init)\n router.input('down', a[0], a[1], init)\n for (let i = 1; i <= steps; i++) router.input('move', a[0] + (b[0] - a[0]) * i / steps, a[1] + (b[1] - a[1]) * i / steps, init)\n return router.input('up', b[0], b[1], init)\n },\n resize,\n setFrameloop(f: string) { frameloop = f; invalidate() },\n setCamera(v: any) { camProp = v; if (synced) cam ? cam.prop(v) : writeCam(v) },\n afterSync,\n cam: () => cam,\n orbit: () => orbit,\n dispose() {\n pending && caf?.(pending)\n offs.forEach(f => f())\n orbit?.dispose()\n target.dispose()\n renderer?.dispose()\n canvas.remove()\n ring.remove()\n },\n }\n return inst\n },\n update(inst: any, props: any) {\n const prev = inst.props\n inst.props = props\n if (props.width != prev.width || props.height != prev.height) inst.resize(props.width || inst.el.clientWidth, props.height || inst.el.clientHeight)\n if (props.camera !== prev.camera && props.camera) inst.setCamera(props.camera)\n if (props.background !== prev.background) inst.target.scene.background = props.background ? new THREE.Color(props.background) : null\n if (props.frameloop !== prev.frameloop) inst.setFrameloop(props.frameloop || 'demand')\n inst.invalidate()\n },\n sync(inst: any, children: any) {\n inst.target.sync(children)\n inst.afterSync()\n inst.invalidate()\n },\n focus(inst: any, child: any) {\n const p = child && inst.pixelOf(child)\n inst.ring.style.display = p ? 'block' : 'none'\n if (p) Object.assign(inst.ring.style, {left: p[0] + 'px', top: p[1] + 'px'})\n },\n unmount: (inst: any) => inst.dispose(),\n})\n\n/** the Scene instance mounted on a host element (tests: `sceneOf(el).click(meshEl)`, `.pointer()`, `.tick()`) */\nexport const sceneOf = (el: any): any => el?.__sw?.i\n","/**\n * A whole app as a three.js scene on sygnal/host (no DOM at all: a game, a Node test, a worker).\n * The same target as <Scene>, reading the host driver's patched root vnode; input through the\n * same pointer router, as HostEvents. `DOM.click('.cube')` works as in the browser.\n *\n * const host = createThreeHost({ width: 640, height: 400 })\n * run(App, { DOM: host.driver })\n * host.click(host.doc.querySelector('.cube'))\n */\nimport {HostDocument, makeHostDriver} from '../host'\nimport {createThreeTarget} from './target'\nimport {pointerRouter} from '../extra/pointer'\n\nexport function createThreeHost({width = 300, height = 150, doc = new HostDocument()} = {}) {\n const target = createThreeTarget()\n target.setSize(width, height)\n let rootVnode: any = null\n // the root vnode as patched (props as the views wrote them, .elm set)\n const capture = {update: (_: any, v: any) => { if (v.elm === doc.body) rootVnode = v }}\n const driver = makeHostDriver(doc, {modules: [capture], onPatch: () => target.sync(rootVnode)})\n const ndc = (x: number, y: number) => [x / width * 2 - 1, -(y / height) * 2 + 1]\n const router = pointerRouter((x, y, skip) => target.pick(ndc(x, y)[0], ndc(x, y)[1], skip), doc.body, {\n ray: (x, y) => { const n = ndc(x, y); return {...target.ray(n[0], n[1]), ndc: n} },\n prop: target.prop,\n })\n const pixelOf = (el: any) => { const p = target.project(el); return p && [(p[0] + 1) / 2 * width, (1 - p[1]) / 2 * height] }\n return {\n doc, driver, target, router, pixelOf,\n pointer: (kind: string, x: number, y: number, init?: any) => router.input(kind, x, y, init),\n click(el: any) {\n const [x, y] = pixelOf(el)!\n router.input('down', x, y)\n return router.input('up', x, y)\n },\n }\n}\n","/**\n * sygnal/three assets: `<Model src>` and `<Texture src>`, loaded models and textures as tags.\n *\n * <Suspense fallback={<p>Loading…</p>}>\n * <Scene>\n * <Model src=\"/tree.glb\" className=\"tree\" position={[0, 0, -2]} />\n * <mesh><planeGeometry args={[8, 8]} /><meshStandardMaterial><Texture src=\"/grass.jpg\" /></meshStandardMaterial></mesh>\n * </Scene>\n * </Suspense>\n *\n * - The tags are controls (the pragma calls `__sygnalControl` while the view renders), so the\n * load starts in the view, before the scene exists: a Suspense boundary around the Scene (or\n * inside it) shows its fallback until every asset below it has arrived, and the Scene mounts\n * once with its assets. 0 B in the core: the loading placeholder is a `pres` marker (the\n * registry the core already has) that remembers its owner, and the owner renders again\n * (Inst.refresh, as lazy() does) when the load settles.\n * - While loading: `<sygnal-asset data-sygnal-lazy=\"loading\">` (what Suspense waits for, as a\n * lazy component's placeholder). Loaded: `<primitive>` with the asset: the target places a\n * clone of the model's scene (`<Model>`: one object per element; geometries and materials\n * shared) or the value itself (`<Texture>`: attached as `map` unless `attach` says otherwise).\n * Failed: the tag throws in the view, so the component's `onError` renders (SYG406), as for a\n * view that threw.\n * - Cache: per loader and URL, shared by every Scene and app on the page. An asset counts the\n * elements using it; when the last one goes (and no element takes it again in the same\n * microtask: a remount), its geometries, materials and textures are disposed and it leaves the\n * cache. `preload(src)` loads ahead; `clear(src)` forgets it (a failed load can be tried again).\n * - Loaders: `loader={OBJLoader}` (a class) or a configured instance (a GLTFLoader with DRACO);\n * by default .glb / .gltf use GLTFLoader (three's add-on, imported when first needed) and\n * `<Texture>` THREE.TextureLoader (sRGB, for color maps).\n */\nimport * as THREE from 'three'\nimport {__pres as pres} from '../index'\n\nconst SEL = 'sygnal-asset'\n\nexport interface Asset {\n src: string\n /** 0 loading, 1 loaded, 2 failed */\n s: 0 | 1 | 2\n value?: any\n error?: Error\n promise: Promise<void>\n /** the elements using it (the target's take / release) */\n users: number\n /** owners whose view rendered the placeholder: they render again when the load settles */\n owners: Set<any>\n model: boolean\n /** cleared from the cache while in use: freed when its last element goes */\n gone?: boolean\n take(): any\n release(): void\n}\n\nconst cache = new Map<any, Map<string, Asset>>()\nconst GLTF = 'gltf', IMAGE = 'image'\n\n// (a loader given or THREE's: at once, so a load starts in the render that asks for it)\nconst loaderFor = (model: boolean, src: string, loader: any): any => {\n if (loader) return typeof loader == 'function' ? new loader() : loader\n if (!model) return new THREE.TextureLoader()\n if (/\\.(glb|gltf)([?#]|$)/i.test(src)) return import('three/addons/loaders/GLTFLoader.js').then(m => new m.GLTFLoader())\n throw new Error(`no loader for this file: pass one, <Model src=\"${src}\" loader={OBJLoader} />`)\n}\nconst load = (l: any, src: string) => l.loadAsync ? l.loadAsync(src) : new Promise((res, rej) => l.load(src, res, undefined, rej))\n\nconst keyOf = (model: boolean, src: string, loader: any) => loader || (model && /\\.(glb|gltf)([?#]|$)/i.test(src) ? GLTF : model ? 'model' : IMAGE)\n\n// a GLTF result's scene, or the object a loader made (OBJLoader, FBXLoader: a Group)\nconst root = (v: any) => v?.scene?.isObject3D ? v.scene : v\n\nfunction free(v: any) {\n const seen = new Set<any>()\n const one = (x: any) => { if (x && !seen.has(x) && typeof x.dispose == 'function') seen.add(x), x.dispose() }\n const r = root(v)\n if (r?.isObject3D) r.traverse((o: any) => {\n one(o.geometry)\n for (const m of [].concat(o.material || [])) {\n for (const k in m as any) if ((m as any)[k]?.isTexture) one((m as any)[k])\n one(m)\n }\n })\n else one(v)\n}\n\n/** the cache entry for (src, loader), loading it the first time */\nexport function asset(model: boolean, src: string, loader?: any): Asset {\n if (typeof src != 'string' || !src) throw new Error(`<${model ? 'Model' : 'Texture'}> needs a src`)\n const k = keyOf(model, src, loader)\n let m = cache.get(k)\n if (!m) cache.set(k, m = new Map())\n let a = m.get(src)\n if (a) return a\n const settle = () => { a!.owners.forEach(o => o.refresh()); a!.owners.clear() }\n a = {\n src, s: 0, users: 0, owners: new Set(), model,\n promise: null as any,\n take() {\n a!.users++\n const r = root(a!.value)\n return model && r?.isObject3D ? r.clone() : a!.value\n },\n release() {\n // a remount (a new Scene, new `args`) takes it again in the same patch: wait a microtask\n if (--a!.users <= 0) queueMicrotask(() => {\n if (a!.users > 0 || m!.get(src) !== a && !a!.gone) return\n if (m!.get(src) === a) m!.delete(src)\n a!.gone = false\n free(a!.value)\n })\n },\n }\n m.set(src, a)\n let p: Promise<any>\n try {\n const l = loaderFor(model, src, loader)\n p = l.then ? l.then((x: any) => load(x, src)) : load(l, src)\n } catch (e) { p = Promise.reject(e) }\n a.promise = p\n .then((v: any) => {\n if (!model && !loader && v?.isTexture) v.colorSpace = THREE.SRGBColorSpace\n a!.value = v, a!.s = 1\n }, (e: any) => {\n a!.error = Object.assign(new Error(`could not load ${src}: ${e?.message || e}`), {cause: e}), a!.s = 2\n })\n .then(settle)\n return a\n}\n\n/** start loading ahead (on hover, at startup); resolves when it has loaded or failed */\nexport const preload = (src: string, loader?: any) => asset(!/\\.(png|jpe?g|webp|gif|avif|ktx2|hdr|exr)([?#]|$)/i.test(src), src, loader).promise\n\n/** forget a cached asset (all of them without a src): a failed load is tried again on the next render; one in use is freed when its last element goes */\nexport function clear(src?: string, loader?: any) {\n for (const [k, m] of cache) if (!loader || k === loader) for (const [s, a] of m) if (src == null || s === src) {\n m.delete(s)\n if (a.s == 1) a.users <= 0 ? free(a.value) : a.gone = true\n }\n}\n\n/** the placeholder's owner: it renders again when the load settles (pres: the core's reconcile walk) */\nconst wait = (n: any, owner: any) => {\n const a: Asset = n.data.a\n if (a.s == 0) a.owners.add(owner)\n else queueMicrotask(() => owner.refresh())\n return n\n}\n\nconst tag = (model: boolean, name: string) => {\n const T: any = () => { throw new Error(`<${name}> is a JSX tag`) }\n T.__sygnalControl = (data: any, children: any[], ce: any) => {\n const {src, loader, children: _, ...rest} = data || {}\n const a = asset(model, src, loader)\n if (a.s == 2) throw a.error\n if (a.s == 0) {\n pres[SEL] ||= wait\n return {sel: SEL, data: {attrs: {'data-sygnal-lazy': 'loading', 'data-src': src}, a}, children: [], text: undefined, elm: undefined, key: rest.key}\n }\n if (!model && rest.attach == null && a.value?.isTexture) rest.attach = 'map'\n return ce('primitive', {...rest, asset: a}, ...(children || []))\n }\n T.preload = (src: string, loader?: any) => asset(model, src, loader).promise\n T.clear = clear\n Object.defineProperty(T, 'name', {value: name})\n return T\n}\n\n/** a loaded model: GLTF (.glb, .gltf) by default, any loader with `loader`; one clone of its scene per element */\nexport const Model = tag(true, 'Model')\n/** a loaded texture (or any loader's value that attaches: an STL geometry, an HDR environment); `attach` defaults to `map` */\nexport const Texture = tag(false, 'Texture')\n"],"names":["pres"],"mappings":";;;;AAAA;;;;;;;;;;;;;;AAcG;AACG,SAAU,UAAU,CAAC,KAAuB,EAAE,MAAsC,GAAA,MAAM,CAAC,EAAE,EAAA;AACjG,IAAA,IAAI,CAAC,GAAU,EAAE,EAAE,IAAS,EAAE,GAAG,GAAG,CAAC,EAAE,GAAQ,EAAE,KAAK,GAAG,CAAC,CAAA;AAC1D,IAAA,MAAM,GAAG,GAAG,CAAC,CAAM,KAAO,EAAA,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAA,EAAE,CAAA;AAClE,IAAA,MAAM,EAAE,GAAG,EAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC,CAAA;IAC7C,OAAO;QACL,EAAE;AACF,QAAA,KAAK,CAAC,CAAM,EAAA;AACV,YAAA,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACT,YAAA,IAAI,CAAC,CAAC,MAAM,GAAG,EAAE;gBAAE,CAAC,CAAC,KAAK,EAAE,CAAA;YAC5B,GAAG,GAAG,CAAC,CAAA;YACP,KAAK,GAAG,CAAC,CAAA;SACV;AACD,QAAA,IAAI,CAAC,CAAM,EAAA;AACT,YAAA,IAAI,CAAC,GAAG;AAAE,gBAAA,OAAO,MAAM,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAA;AAC/C,YAAA,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC;gBAAE,OAAM;Y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MAAM,GAAG,KAAK,CAAA;QAC5E,OAAO,EAAE,CAAC,WAAW,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC,EAAE,IAAI,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAA;AAClE,KAAC,CAAA;IACD,CAAC,CAAC,OAAO,GAAG,CAAC,GAAW,EAAE,MAAY,KAAK,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,CAAA;AAC5E,IAAA,CAAC,CAAC,KAAK,GAAG,KAAK,CAAA;AACf,IAAA,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAC/C,IAAA,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAED;AACa,MAAA,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,OAAO,EAAC;AACvC;AACa,MAAA,OAAO,GAAG,GAAG,CAAC,KAAK,EAAE,SAAS;;;;"}
@@ -23,6 +23,26 @@ function _interopNamespaceDefault(e) {
23
23
 
24
24
  var combobox__namespace = /*#__PURE__*/_interopNamespaceDefault(combobox);
25
25
 
26
+ var _a;
27
+ /*
28
+ * UI sweep round 4: the layer stack's entries alone (layers.ts adds the listeners that dismiss).
29
+ * One stack per page on a global, shared by sygnal/ui and the Zag parts' bundles, which each have
30
+ * their own copy of this file: a Zag part only adds and removes its layer (Zag dismisses it), so it
31
+ * doesn't carry the listeners, which only controlled layers (sygnal/ui's, installing them) need.
32
+ */
33
+ const G = globalThis;
34
+ const S = (G[_a = Symbol.for('sygnal.layers')] || (G[_a] = { stack: [] }));
35
+ /** `el` closed */
36
+ const pull = (el) => {
37
+ const i = S.stack.findIndex((l) => l.el === el);
38
+ i < 0 || S.stack.splice(i, 1);
39
+ };
40
+ /** `el` opened: on top of the stack (again) */
41
+ const add = (el, l) => {
42
+ pull(el);
43
+ S.stack.push({ el, ...l });
44
+ };
45
+
26
46
  /*
27
47
  * PLAN-5 2-Z: helpers the Zag-based parts (Menu, Select, Combobox) share. '../../zag' becomes the
28
48
  * external 'sygnal/zag' and '../../index' the external 'sygnal' in the 'sygnal/ui/menu', 'sygnal/ui/select' and 'sygnal/ui/combobox' builds.
@@ -44,18 +64,72 @@ const named = (bag, p, describe) => {
44
64
  delete a['aria-label'];
45
65
  return bag;
46
66
  };
47
- /** An item as the parts take it: a string, or { value, label?, disabled? } (Menu also { separator: true }) */
48
- const norm = (items) => (items || []).map((i) => (i && typeof i == 'object'
49
- ? { ...i, value: String(i.value ?? ''), label: i.label ?? String(i.value ?? '') }
67
+ /**
68
+ * The items as the parts take them: a string, or { value, label?, disabled? } (Menu also
69
+ * { separator: true } and its item kinds); a group (UI sweep round 2) { group, items } is its
70
+ * items, each with `group` (its label)
71
+ */
72
+ const norm = (items) => (items || []).flatMap((i) => (i && typeof i == 'object'
73
+ ? i.group != null && Array.isArray(i.items) ? norm(i.items).map((j) => ({ ...j, group: String(i.group) }))
74
+ : { ...i, value: String(i.value ?? ''), label: i.label ?? String(i.value ?? '') }
50
75
  : { value: String(i), label: String(i) }));
51
76
  /** A Select / Combobox value prop as Zag's string[] (undefined: uncontrolled; null or '': none) */
52
77
  const arr = (v) => v === undefined ? undefined : v == null || v === '' ? [] : Array.isArray(v) ? v.map(String) : [String(v)];
53
78
  /** The listbox collection options for Zag's collection() */
54
- const collectionOf = (z, items) => z.collection({ items, itemToValue: (i) => i.value, itemToString: (i) => i.label, isItemDisabled: (i) => !!i.disabled });
79
+ const collectionOf = (z, items) => z.collection({ items, itemToValue: (i) => i.value, itemToString: (i) => i.label, isItemDisabled: (i) => !!i.disabled,
80
+ // round 2: groups (Zag orders the items by group, as they are shown)
81
+ ...(items.some((i) => i.group != null) && { groupBy: (i) => i.group ?? '' }) });
55
82
  /** value-change's detail: the value (single) or the values (multiple) */
56
83
  const valueOut = (d, x) => (x.multiple ? d.value : d.value[0] ?? null);
57
- /** Item rows of a listbox (Select, Combobox): text + a ✓ indicator Zag hides when unselected */
58
- const options = (h, api) => api.collection.items.map((item) => h('div', { key: item.value, ...api.getItemProps({ item }) }, h('span', api.getItemTextProps({ item }), item.label), h('span', api.getItemIndicatorProps({ item }), '✓')));
84
+ /**
85
+ * Item rows of a listbox (Select, Combobox): text + a ✓ indicator Zag hides when unselected;
86
+ * grouped items (round 2) in a role="group" named by its label (items without a group first)
87
+ */
88
+ const options = (h, api) => {
89
+ const c = api.collection;
90
+ const row = (item) => h('div', { key: item.value, ...api.getItemProps({ item }) }, h('span', api.getItemTextProps({ item }), item.label), h('span', api.getItemIndicatorProps({ item }), '✓'));
91
+ if (!c.items.some((i) => i.group != null))
92
+ return c.items.map(row);
93
+ return c.group().flatMap(([g, items], k) => {
94
+ if (!g)
95
+ return items.map(row);
96
+ const id = 'g' + k + '-' + g.replace(/[^\w-]/g, '_');
97
+ return h('div', { key: 'group:' + g, ...api.getItemGroupProps({ id }) }, h('div', api.getItemGroupLabelProps({ htmlFor: id }), g), items.map(row));
98
+ });
99
+ };
100
+ /**
101
+ * The parts are form fields (the widget field contract, extra/field.ts): `value-change`'s detail
102
+ * is the field's value, and between picks the machine's value
103
+ */
104
+ const field = { event: 'value-change', read: (x) => valueOut({ value: x.api().value }, x) };
105
+ /**
106
+ * Round 2 (Radix's Popper): the positioner is `position: fixed` by default, so a clipping
107
+ * container (`overflow: hidden` / `auto`: a card, a scrolling panel, a <dialog>) doesn't cut the
108
+ * list off or flip it off-screen. An ancestor with a `transform`, `filter` or `contain` is then
109
+ * its containing block; `positioning={{ strategy: 'absolute' }}` (merged over the default) goes back
110
+ */
111
+ const placed = (p) => ({ ...p, positioning: { strategy: 'fixed', ...p.positioning } });
112
+ /**
113
+ * UI sweep round 4: an open part's content is a layer on sygnal/ui's layer stack (src/ui/stack.ts,
114
+ * shared through a global, so this bundle's copy and sygnal/ui's are one stack; layers.ts reads it). Zag dismisses it
115
+ * itself (its own @zag-js/dismissable layer: Escape, a press or a focus outside); on the stack it
116
+ * is a layer the stack doesn't dismiss (`ctl` false), anchored at the widget's host: so a
117
+ * controlled popover or dialog it opened in counts a press in it as inside, wherever the content
118
+ * renders (Radix's nested DismissableLayer), and Escape is the Zag part's while it is on top. Called
119
+ * from the render; the content exists after the patch, so the stack is updated in a microtask.
120
+ */
121
+ const layered = (x, open) => {
122
+ if (!!x.layer == open)
123
+ return;
124
+ x.layer = open || null;
125
+ queueMicrotask(() => {
126
+ const c = open && x.el?.querySelector?.('[data-part="content"]');
127
+ if (c && x.layer)
128
+ add(x.lc = c, { anchor: x.el });
129
+ else if (!x.layer && x.lc)
130
+ pull(x.lc), x.lc = null;
131
+ });
132
+ };
59
133
 
60
134
  /*
61
135
  * PLAN-5 2-Z (U-1): Combobox, a Zag combobox machine (WAI-ARIA editable combobox with a listbox
@@ -79,9 +153,12 @@ const options = (h, api) => api.collection.items.map((item) => h('div', { key: i
79
153
  * With `allowCustomValue` (single), the selected value is submitted unless the user typed since
80
154
  * the last selection; then the typed text (an item's exact label submits that item's value; G-435,
81
155
  * G-468).
156
+ * It is a widget field (extra/field.ts): the form behavior and processForm read its value; a form
157
+ * reset puts the first value back (ZS-4).
82
158
  *
83
159
  * Props: `label`, `items` (strings or { value, label?, disabled? }), `value` (controlled: a
84
- * string, an array when `multiple`, null for none), `defaultValue`, `placeholder`, `filter`, and
160
+ * string, an array when `multiple`, null for none), `defaultValue`, `placeholder`, `filter`,
161
+ * `loading` (7.2: the items are loading; a value no item has yet isn't custom text), and
85
162
  * Zag's combobox props (`multiple`, `name`, `form`, `disabled`, `readOnly`, `required`,
86
163
  * `invalid`, `allowCustomValue`, `openOnClick`, `inputBehavior`, `selectionBehavior`,
87
164
  * `closeOnSelect`, `loopFocus`, `positioning`, `open`, `id`). Events: `value-change` (the value,
@@ -97,13 +174,26 @@ const shown = (all, f, q) => {
97
174
  // the filter text: what the user typed; '' when the list closes
98
175
  const setText = (x, q) => { if (x.q !== q)
99
176
  x.q = q, x.refresh(); };
177
+ // Round 2 (React Aria's allowsCustomValue): with `allowCustomValue` (single), the typed text is
178
+ // committed when the focus leaves the combobox, or on Enter with no active option: text that is an
179
+ // item's label picks that item, other text is the value itself (a value no item has), '' is no
180
+ // value. It is reported with value-change like a pick; the input keeps showing it (`shows`).
181
+ const commit = (x, blur) => {
182
+ if (!x.custom || x.multiple || !x.t)
183
+ return;
184
+ const a = x.api(), q = a.inputValue, it = x.items.find((i) => i.label === q);
185
+ x.t = 0;
186
+ // leaving closes the list (Zag closes it on a pointer or focus outside, not on every blur)
187
+ blur && a.open && a.setOpen(false);
188
+ a.setValue(it ? [it.value] : q ? [q] : []);
189
+ };
100
190
  // G-411: forms get the value, not the label the input shows: the visible input has no name; one
101
191
  // hidden input per value (a single combobox: one, '' when empty) carries `name`.
102
- // G-435 / G-468: a single combobox with `allowCustomValue` submits the selected value unless the
103
- // user typed since the last selection (`x.t`: set by input-change, cleared by a selection, a value
104
- // change or a new controlled value that isn't empty: G-494); then the value of an item whose label the text is, else the
105
- // text itself. So `selectionBehavior` 'preserve' / 'clear', items relabelled after a pick and a
106
- // `defaultValue` before the items load all submit the value.
192
+ // G-435 / G-468: a single combobox with `allowCustomValue` submits the typed text while the user
193
+ // is typing (`x.t`: set by input-change, cleared by a selection, a commit, a value change or a new
194
+ // controlled value that isn't empty: G-494): the value of an item whose label the text is, else
195
+ // the text itself; otherwise the value. So `selectionBehavior` 'preserve' / 'clear', items
196
+ // relabelled after a pick and a `defaultValue` before the items load all submit the value.
107
197
  const submitted = (api, x) => {
108
198
  const v = api.value[0] ?? '';
109
199
  if (!x.custom || !x.t)
@@ -119,36 +209,182 @@ const hidden = (api, p, x) => {
119
209
  const attrs = p.form == null ? undefined : { form: p.form };
120
210
  return vs.map((value, i) => sygnal.createElement('input', { key: 'h' + i, type: 'hidden', name: p.name, attrs, disabled: !!p.disabled, value }));
121
211
  };
212
+ // ZS-3: the input shows the value's label (with allowCustomValue, a value no item has: its text)
213
+ // while nothing is typed and the list is closed. Zag writes it only when the value changes: not
214
+ // when the items arrive after the value (async loading) or relabel it, and it writes the picked
215
+ // label even when a controlled value refuses the pick ('' for a custom value). Single,
216
+ // selectionBehavior 'replace' (the default) only; checked after each render and each of Zag's
217
+ // own writes, once the app's flush has run (an accepted pick's value arrives then)
218
+ // 7.2: while `loading`, a value no item has yet isn't custom text: it shows nothing until its item
219
+ // arrives (React Aria: the input shows the selected item's text, '' while it isn't in the collection)
220
+ const shows = (a, x) => a.value.map((v) => x.items.find((i) => i.value === v)?.label ?? (x.custom && !x.loading ? v : '')).filter((l) => l).join(', ');
221
+ const sync = (api, p, x) => {
222
+ const off = (a) => x.multiple || x.t || a.open || (p.selectionBehavior ?? 'replace') != 'replace' || a.inputValue === shows(a, x);
223
+ api && off(api) || x.sq || (x.sq = 1, queueMicrotask(() => { x.sq = 0; const a = x.el.isConnected && x.api(); a && !off(a) && a.setInputValue(shows(a, x)); }));
224
+ };
225
+ // 7.2: the listbox is aria-busy while the items load (React Spectrum's loadingState)
226
+ const busy = (bag, x) => (x.loading && (bag.attrs['aria-busy'] = 'true'), bag);
227
+ // ZS-4: a form reset puts the first value back (as Zag's Select does: the controlled value's
228
+ // first, or defaultValue: value-change reports it) and the input shows its label; after the
229
+ // browser's own reset, which empties the visible input
230
+ const onReset = (x, input) => (e) => e.defaultPrevented || setTimeout(() => {
231
+ if (!input.isConnected)
232
+ return;
233
+ const c = x.machine.service.context;
234
+ c.set('value', c.initial('value') || []);
235
+ x.t = 0;
236
+ setText(x, '');
237
+ const a = x.api(), text = x.multiple ? '' : shows({ value: c.initial('value') || [] }, x);
238
+ a.setInputValue(text);
239
+ input.value = text;
240
+ });
241
+ // Round 2 (F-2): a multiple combobox's values as chips before the input (chips={false}: none),
242
+ // each with a remove button (Zag's clearValue(value)); Backspace in the empty input removes the
243
+ // last one, the `remove` command one by value. The buttons are out of the tab order and named by
244
+ // `removeLabel`.
245
+ // Round 3 (React Aria's TagGroup): the chips are a grid of rows, one tab stop (roving tabindex:
246
+ // the last focused chip, else the first). ArrowLeft at the start of the input focuses the last
247
+ // chip; ArrowLeft / ArrowRight move between chips (swapped when dir="rtl"), ArrowRight past the
248
+ // last returns to the input, Home / End the first / last; Delete / Backspace remove the focused
249
+ // chip and focus the next one (else the previous, else the input). A removal is announced in the
250
+ // status region (`removedMessage`); an addition is not: the option's aria-selected already is,
251
+ // and React Aria announces added tags only while the focus is in the group.
252
+ const labelOf = (x, v) => x.items.find((i) => i.value === v)?.label ?? v;
253
+ const remove = (x, v) => {
254
+ const a = x.api(), p = x.p;
255
+ if (p.disabled || p.readOnly || !a.value.length)
256
+ return;
257
+ a.clearValue(x.rq = v ?? a.value[a.value.length - 1]);
258
+ };
259
+ const rows = (x) => [...x.el.querySelectorAll('[data-part=item-chip]')];
260
+ const chipKey = (x, v) => (e) => {
261
+ const r = rows(x), i = r.findIndex((c) => c.dataset.value === v), rtl = x.p.dir == 'rtl';
262
+ const k = e.key == 'ArrowLeft' ? (rtl ? 1 : -1) : e.key == 'ArrowRight' ? (rtl ? -1 : 1) : 0;
263
+ const go = (j) => (j >= r.length ? x.api().focus() : r[Math.max(j, 0)].focus(), e.preventDefault());
264
+ if (k)
265
+ go(i + k);
266
+ else if (e.key == 'Home')
267
+ go(0);
268
+ else if (e.key == 'End')
269
+ go(r.length - 1);
270
+ else if ((e.key == 'Delete' || e.key == 'Backspace') && !x.p.disabled && !x.p.readOnly) {
271
+ e.preventDefault();
272
+ const n = r[i + 1] || r[i - 1];
273
+ remove(x, v);
274
+ // the neighbour's row is kept (keyed), whether the removal is in yet (a controlled value: after
275
+ // the app's flush)
276
+ n?.isConnected ? n.focus() : x.api().focus();
277
+ }
278
+ };
279
+ const chips = (api, p, x) => {
280
+ if (!x.multiple || p.chips === false || !api.value.length)
281
+ return null;
282
+ const say = p.removeLabel ?? ((l) => 'Remove ' + l), off = !!(p.disabled || p.readOnly);
283
+ // the tab stop: the focused (or last focused) chip while it is a value, else the first
284
+ const stop = api.value.includes(x.cf) ? x.cf : api.value[0], d = x.hint && { 'aria-describedby': x.hint };
285
+ return sygnal.createElement('div', { attrs: { 'data-scope': 'combobox', 'data-part': 'item-chips', role: 'grid', 'aria-label': p.chipsLabel ?? (p.label != null ? String(p.label) : 'Selected') } }, api.value.map((v) => {
286
+ const l = labelOf(x, v);
287
+ return sygnal.createElement('div', {
288
+ key: v,
289
+ attrs: { 'data-scope': 'combobox', 'data-part': 'item-chip', 'data-value': v, role: 'row', 'aria-label': l, tabindex: !p.disabled && v === stop ? '0' : '-1', 'data-disabled': off ? '' : undefined, ...(!off && d) },
290
+ on: { keydown: chipKey(x, v), focus: () => { x.cf !== v && (x.cf = v, x.draw()); } },
291
+ }, sygnal.createElement('div', { attrs: { role: 'gridcell', 'data-scope': 'combobox', 'data-part': 'item-chip-cell' } }, sygnal.createElement('span', { attrs: { 'data-scope': 'combobox', 'data-part': 'item-chip-text' } }, l), sygnal.createElement('button', {
292
+ attrs: { type: 'button', tabindex: '-1', 'data-scope': 'combobox', 'data-part': 'item-chip-remove', 'aria-label': typeof say == 'function' ? say(l) : say + ' ' + l },
293
+ props: { disabled: off },
294
+ // the focus stays where it is (the input, or the chip)
295
+ on: { mousedown: (e) => e.preventDefault(), click: () => remove(x, v) },
296
+ }, '×')));
297
+ }));
298
+ };
299
+ // the status region's text: a removal once its value is gone (announced; a zero-width space after
300
+ // every other one, so the same text twice is announced twice); `empty` while it shows
301
+ const status = (api, p, x, none) => {
302
+ if (x.rq != null && !api.value.includes(x.rq)) {
303
+ const m = p.removedMessage, l = labelOf(x, x.rq);
304
+ x.rq = null;
305
+ if (m !== false)
306
+ x.say = (typeof m == 'function' ? m(l) : l + ' removed') + ((x.n = !x.n) ? '' : '\u200b');
307
+ }
308
+ // shown text is not announced again when it comes back
309
+ return none ? (x.say = '', p.empty) : x.say || '';
310
+ };
311
+ // visually hidden, in the accessibility tree (the empty row's status region)
312
+ const SR = { position: 'absolute', width: '1px', height: '1px', margin: '-1px', padding: '0', border: '0', overflow: 'hidden', clip: 'rect(0 0 0 0)', whiteSpace: 'nowrap' };
122
313
  const Combobox = /*#__PURE__*/ zag.fromZag(combobox__namespace, (api, p, x) => {
123
314
  const input = named(api.getInputProps(), p, 1);
315
+ layered(x, api.open);
124
316
  delete input.attrs.name;
125
317
  delete input.attrs.form;
126
- return sygnal.createElement('div', api.getRootProps(), p.label != null && sygnal.createElement('label', api.getLabelProps(), p.label), sygnal.createElement('div', api.getControlProps(), sygnal.createElement('input', { ...input, placeholder: p.placeholder }), sygnal.createElement('button', api.getTriggerProps(), '▾')), sygnal.createElement('div', api.getPositionerProps(), sygnal.createElement('div', named(api.getContentProps(), p), options(sygnal.createElement, api))), hidden(api, p, x));
318
+ // Round 2: commit the typed text (allowCustomValue) when the focus leaves the combobox, or on
319
+ // Enter with no active option (Zag's handlers first)
320
+ const on = input.on, out = on.focusout, kd = on.keydown;
321
+ on.focusout = (e) => { out?.(e); x.el.contains(e.relatedTarget) || commit(x, 1); };
322
+ on.keydown = (e) => {
323
+ const none = x.api().highlightedValue == null, empty = e.target.value === '';
324
+ kd?.(e);
325
+ if (e.key == 'Enter' && none)
326
+ commit(x);
327
+ // F-2: Backspace in the empty input removes the last chip
328
+ else if (e.key == 'Backspace' && empty && x.multiple && p.chips !== false)
329
+ remove(x);
330
+ // Round 3: ArrowLeft (ArrowRight when rtl) at the start of the input: the last chip
331
+ else if (e.key == (p.dir == 'rtl' ? 'ArrowRight' : 'ArrowLeft') && !e.defaultPrevented && e.target.selectionStart === 0 && e.target.selectionEnd === 0) {
332
+ const r = x.multiple && rows(x);
333
+ r?.length && (e.preventDefault(), r[r.length - 1].focus());
334
+ }
335
+ };
336
+ x.p = p;
337
+ sync(api, p, x);
338
+ // ZS-4: the reset listener on the input's form (its ancestor, or the `form` attribute's)
339
+ const hook = {
340
+ insert: (v) => {
341
+ const f = x.form = p.form != null ? v.elm.ownerDocument.getElementById(p.form) : v.elm.closest('form');
342
+ f?.addEventListener('reset', x.reset = onReset(x, v.elm));
343
+ },
344
+ destroy: () => x.form?.removeEventListener('reset', x.reset),
345
+ };
346
+ // F-4: `empty` while the list is open with no items: a row after the listbox, and the status
347
+ // region's text (announced)
348
+ const none = api.open && !api.collection.items.length && p.empty != null && !x.loading;
349
+ // Round 3: one "Press Delete to remove" description the chips point at (removeHint={false}: none)
350
+ const tags = x.multiple && p.chips !== false;
351
+ x.hint = tags && p.removeHint !== false ? x.machine.service.prop('id') + '-chip-hint' : 0;
352
+ return sygnal.createElement('div', api.getRootProps(), p.label != null && sygnal.createElement('label', api.getLabelProps(), p.label), sygnal.createElement('div', api.getControlProps(), chips(api, p, x), sygnal.createElement('input', { ...input, placeholder: p.placeholder, hook }), sygnal.createElement('button', api.getTriggerProps(), '▾')), sygnal.createElement('div', api.getPositionerProps(), sygnal.createElement('div', busy(named(api.getContentProps(), p), x), options(sygnal.createElement, api)), p.empty != null && sygnal.createElement('div', { attrs: { 'data-scope': 'combobox', 'data-part': 'empty', hidden: !none } }, p.empty)), (p.empty != null || tags) && sygnal.createElement('div', { attrs: { role: 'status', 'data-scope': 'combobox', 'data-part': 'status' }, style: SR }, status(api, p, x, none)), x.hint && sygnal.createElement('span', { attrs: { id: x.hint, hidden: true } }, p.removeHint ?? 'Press Delete to remove.'), hidden(api, p, x));
127
353
  }, {
128
354
  name: 'Combobox',
129
355
  $own: 1,
356
+ field,
130
357
  ownProps: [...NAMING, 'name'],
131
- props: ({ items, label, placeholder, value, defaultValue, filter, 'aria-label': _l, 'aria-labelledby': _b, 'aria-describedby': _d, ...p }, x) => {
358
+ props: ({ items, label, placeholder, value, defaultValue, filter, empty, loading, chips: _c, removeLabel, chipsLabel, removedMessage, removeHint, 'aria-label': _l, 'aria-labelledby': _b, 'aria-describedby': _d, ...p }, x) => {
132
359
  x.multiple = !!p.multiple;
133
360
  x.custom = !!p.allowCustomValue;
361
+ x.loading = !!loading;
134
362
  x.items = norm(items);
135
363
  // G-468: a new controlled value ends the typing. G-494: not an empty one (an app that clears
136
364
  // its value on input-change: the typed text is still what is submitted)
137
365
  const v = arr(value), k = v && JSON.stringify(v);
138
366
  if (k !== x.v)
139
367
  x.v = k, v?.length && (x.t = 0);
368
+ // the first value (ZS-4), whether controlled; a controlled custom value (Round 2)
140
369
  return {
141
- ...p,
370
+ ...placed(p),
142
371
  collection: collectionOf(combobox__namespace, shown(x.items, filter, x.q || '')),
143
372
  value: v,
144
373
  defaultValue: arr(defaultValue),
145
374
  // typing only (not the label a selection writes): the filter text, and input-change
146
375
  // G-414: the app's own callbacks (p.onInputValueChange / p.onOpenChange) run first
147
- onInputValueChange: (d) => { p.onInputValueChange?.(d); if (d.reason == 'input-change')
148
- x.t = 1, setText(x, d.inputValue), x.dispatch('input-change', d.inputValue); },
376
+ // ZS-3: Zag's own writes (a value change's label, outside a render) are checked too, once
377
+ // they are in (after this callback)
378
+ onInputValueChange: (d) => {
379
+ p.onInputValueChange?.(d);
380
+ if (d.reason == 'input-change')
381
+ x.t = 1, setText(x, d.inputValue), x.dispatch('input-change', d.inputValue);
382
+ else
383
+ sync(0, x.p, x);
384
+ },
149
385
  onSelect: (d) => { x.t = 0; p.onSelect?.(d); },
150
386
  onValueChange: (d) => { x.t = 0; p.onValueChange?.(d); },
151
- onOpenChange: (d) => { p.onOpenChange?.(d); d.open || setText(x, ''); },
387
+ onOpenChange: (d) => { p.onOpenChange?.(d); d.open || (setText(x, ''), sync(0, x.p, x)); },
152
388
  };
153
389
  },
154
390
  events: {
@@ -160,6 +396,8 @@ const Combobox = /*#__PURE__*/ zag.fromZag(combobox__namespace, (api, p, x) => {
160
396
  open: (api) => api.setOpen(true),
161
397
  close: (api) => api.setOpen(false),
162
398
  clear: (api) => api.clearValue(),
399
+ // F-2: { remove: '.c', value } removes one value (without `value`: the last)
400
+ remove: (_, o, x) => remove(x, o.value),
163
401
  focus: (api) => api.focus(),
164
402
  },
165
403
  fallback: (p, hh) => hh('div', null, p.label != null && hh('label', null, p.label), hh('input', { placeholder: p.placeholder, disabled: true })),