@atom.io/spa 0.0.6 → 0.0.7

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 (78) hide show
  1. package/README.md +282 -10
  2. package/README.mdx +65 -5
  3. package/dist/astro-application.d.ts +1 -1
  4. package/dist/astro-client.d.ts +1 -1
  5. package/dist/astro-client.js +2 -2
  6. package/dist/astro-resumability-client.d.ts +1 -1
  7. package/dist/astro-server.js +1 -1
  8. package/dist/{astro-shared-B9wvGIkk.d.ts → astro-shared-DZp1x8RQ.d.ts} +2 -2
  9. package/dist/{astro-shared-B9wvGIkk.d.ts.map → astro-shared-DZp1x8RQ.d.ts.map} +1 -1
  10. package/dist/astro.d.ts +1 -1
  11. package/dist/{capabilities-_zOwNJ-2.d.ts → capabilities-DNcnGRv_.d.ts} +7 -3
  12. package/dist/capabilities-DNcnGRv_.d.ts.map +1 -0
  13. package/dist/capabilities-nOIitQ-_.js.map +1 -1
  14. package/dist/client.min.js +1 -1
  15. package/dist/{core-DjFJ0aIJ.js → core-B4rJ0xdc.js} +22 -12
  16. package/dist/core-B4rJ0xdc.js.map +1 -0
  17. package/dist/development/astro-client.js +2 -2
  18. package/dist/development/astro-server.js +1 -1
  19. package/dist/development/capabilities-nOIitQ-_.js.map +1 -1
  20. package/dist/development/{core-DxPiKryn.js → core-BHA7I1nf.js} +24 -14
  21. package/dist/development/core-BHA7I1nf.js.map +1 -0
  22. package/dist/development/{dom-BWy4dDss.js → dom-DQ0M3rLL.js} +2 -2
  23. package/dist/development/{dom-BWy4dDss.js.map → dom-DQ0M3rLL.js.map} +1 -1
  24. package/dist/development/floating.js +1 -1
  25. package/dist/development/index.js +4 -4
  26. package/dist/development/konva.js +1 -1
  27. package/dist/development/motion.js +413 -24
  28. package/dist/development/motion.js.map +1 -1
  29. package/dist/development/renderer.js +1 -1
  30. package/dist/development/{server-renderer-C7lGVhpo.js → server-renderer-DCLoMdOX.js} +2 -2
  31. package/dist/development/{server-renderer-C7lGVhpo.js.map → server-renderer-DCLoMdOX.js.map} +1 -1
  32. package/dist/development/server.js +1 -1
  33. package/dist/development/{src-WSHJxR9b.js → src-DoQgCX-O.js} +2 -2
  34. package/dist/development/{src-WSHJxR9b.js.map → src-DoQgCX-O.js.map} +1 -1
  35. package/dist/development/three.js +76 -23
  36. package/dist/development/three.js.map +1 -1
  37. package/dist/{dom-BrPrxO97.js → dom-D8g3roX9.js} +2 -2
  38. package/dist/{dom-BrPrxO97.js.map → dom-D8g3roX9.js.map} +1 -1
  39. package/dist/floating.d.ts +1 -1
  40. package/dist/floating.js +1 -1
  41. package/dist/{index-BFIjI7gF.d.ts → index-BFnXIfOj.d.ts} +3 -3
  42. package/dist/{index-BFIjI7gF.d.ts.map → index-BFnXIfOj.d.ts.map} +1 -1
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.js +4 -4
  45. package/dist/{jsx-runtime-BhiCZOYZ.d.ts → jsx-runtime-DQnpyT_g.d.ts} +2 -2
  46. package/dist/{jsx-runtime-BhiCZOYZ.d.ts.map → jsx-runtime-DQnpyT_g.d.ts.map} +1 -1
  47. package/dist/jsx-runtime.d.ts +1 -1
  48. package/dist/konva.d.ts +3 -3
  49. package/dist/konva.js +1 -1
  50. package/dist/motion.d.ts +39 -16
  51. package/dist/motion.d.ts.map +1 -1
  52. package/dist/motion.js +413 -24
  53. package/dist/motion.js.map +1 -1
  54. package/dist/renderer.d.ts +1 -1
  55. package/dist/renderer.js +1 -1
  56. package/dist/{server-renderer-D-uRg04V.js → server-renderer-D0rsFL_-.js} +2 -2
  57. package/dist/{server-renderer-D-uRg04V.js.map → server-renderer-D0rsFL_-.js.map} +1 -1
  58. package/dist/server.d.ts +1 -1
  59. package/dist/server.js +1 -1
  60. package/dist/size.json +12 -12
  61. package/dist/{src-DWIqXCiz.js → src-Bme1kz2b.js} +2 -2
  62. package/dist/{src-DWIqXCiz.js.map → src-Bme1kz2b.js.map} +1 -1
  63. package/dist/three.d.ts +27 -8
  64. package/dist/three.d.ts.map +1 -1
  65. package/dist/three.js +76 -23
  66. package/dist/three.js.map +1 -1
  67. package/package.json +6 -5
  68. package/src/capabilities.ts +2 -0
  69. package/src/core.ts +26 -12
  70. package/src/index.ts +1 -0
  71. package/src/motion-layout.ts +363 -0
  72. package/src/motion-transition.ts +92 -0
  73. package/src/motion-tween.ts +19 -2
  74. package/src/motion.ts +204 -76
  75. package/src/three.ts +134 -39
  76. package/dist/capabilities-_zOwNJ-2.d.ts.map +0 -1
  77. package/dist/core-DjFJ0aIJ.js.map +0 -1
  78. package/dist/development/core-DxPiKryn.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"three.js","names":[],"sources":["../../src/three-events.ts","../../src/three.ts"],"sourcesContent":["import * as THREE from \"three\"\n\nexport interface ThreePointerEvent<N extends THREE.Object3D = THREE.Object3D> {\n\ttype: string\n\tnativeEvent: PointerEvent\n\ttarget: THREE.Object3D\n\tcurrentTarget: N\n\tintersection: THREE.Intersection\n\tray: THREE.Ray\n\tpointerId: number\n\tbutton: number\n\tbuttons: number\n\tclientX: number\n\tclientY: number\n\tstopPropagation(): void\n\tpreventDefault(): void\n\tsetPointerCapture(): void\n\treleasePointerCapture(): void\n\thasPointerCapture(): boolean\n}\nexport type ThreeEventHandler<N extends THREE.Object3D = THREE.Object3D> = (\n\tevent: ThreePointerEvent<N>,\n) => void\nexport interface ThreeEventAttributes<\n\tN extends THREE.Object3D = THREE.Object3D,\n> {\n\tonPointerDown?: ThreeEventHandler<N>\n\tonPointerUp?: ThreeEventHandler<N>\n\tonPointerMove?: ThreeEventHandler<N>\n\tonPointerEnter?: ThreeEventHandler<N>\n\tonPointerLeave?: ThreeEventHandler<N>\n\tonPointerOver?: ThreeEventHandler<N>\n\tonPointerOut?: ThreeEventHandler<N>\n\tonPointerCancel?: ThreeEventHandler<N>\n\tonClick?: ThreeEventHandler<N>\n}\ntype Hit = { node: THREE.Object3D; intersection: THREE.Intersection }\ntype Handler = ThreeEventHandler\nconst suspended = new WeakSet<THREE.Object3D>()\nexport function suspendThree(node: THREE.Object3D): () => void {\n\tsuspended.add(node)\n\tfor (const manager of managers) manager.remove(node)\n\treturn () => {\n\t\tsuspended.delete(node)\n\t}\n}\nconst listeners = new WeakMap<THREE.Object3D, Map<string, Set<Handler>>>()\nconst managers = new Set<{ remove(node: THREE.Object3D): void }>()\n\nexport function listenThree(\n\tnode: THREE.Object3D,\n\ttype: string,\n\thandler: Handler,\n): () => void {\n\tconst events = listeners.get(node) ?? new Map<string, Set<Handler>>()\n\tlisteners.set(node, events)\n\tconst handlers = events.get(type) ?? new Set<Handler>()\n\tevents.set(type, handlers)\n\thandlers.add(handler)\n\treturn () => {\n\t\thandlers.delete(handler)\n\t\tif (!handlers.size) events.delete(type)\n\t}\n}\nexport function forgetThree(node: THREE.Object3D): void {\n\tconst errors: unknown[] = []\n\tfor (const manager of managers) {\n\t\ttry {\n\t\t\tmanager.remove(node)\n\t\t} catch (error) {\n\t\t\terrors.push(error)\n\t\t}\n\t}\n\tlisteners.delete(node)\n\tif (errors.length) throw new AggregateError(errors)\n}\n\nexport interface ThreeEventManager {\n\tupdate(): void\n\t/** Release hover, press, and capture state for a removed subtree. */\n\tremove(node: THREE.Object3D): void\n\tdispose(): void\n}\n\n/** Attach raycast pointer routing to a canvas; usable with borrowed scene roots. */\nexport function createThreeEvents(\n\tcanvas: HTMLCanvasElement,\n\tscene: THREE.Object3D,\n\tcamera: () => THREE.Camera,\n\tonError: (error: unknown) => void = (error) => {\n\t\tthrow error\n\t},\n): ThreeEventManager {\n\tconst raycaster = new THREE.Raycaster()\n\tconst pointer = new THREE.Vector2()\n\tconst hovering = new Map<number, Hit>()\n\tconst pressed = new Map<number, Hit>()\n\tconst captures = new Map<number, Hit>()\n\tconst last = new Map<number, PointerEvent>()\n\tlet dead = false\n\tconst path = (node: THREE.Object3D) => {\n\t\tconst nodes: THREE.Object3D[] = []\n\t\tfor (let at: THREE.Object3D | null = node; at; at = at.parent) {\n\t\t\tnodes.push(at)\n\t\t\tif (at === scene) return nodes\n\t\t}\n\t\treturn []\n\t}\n\tconst contains = (node: THREE.Object3D, child: THREE.Object3D) => {\n\t\tfor (let at: THREE.Object3D | null = child; at; at = at.parent)\n\t\t\tif (at === node) return true\n\t\treturn false\n\t}\n\tconst eligible = (intersection: THREE.Intersection) => {\n\t\tconst nodes = path(intersection.object)\n\t\tif (\n\t\t\t!nodes.length ||\n\t\t\tnodes.some((node) => !node.visible || suspended.has(node))\n\t\t)\n\t\t\treturn false\n\t\tconst material = (intersection.object as THREE.Mesh).material\n\t\treturn (\n\t\t\t!material ||\n\t\t\t(Array.isArray(material)\n\t\t\t\t? material[intersection.face?.materialIndex ?? 0]?.visible !== false\n\t\t\t\t: material.visible)\n\t\t)\n\t}\n\tconst pick = (event: PointerEvent): Hit | undefined => {\n\t\tconst bounds = canvas.getBoundingClientRect()\n\t\tif (!bounds.width || !bounds.height) return undefined\n\t\tconst active = camera()\n\t\tscene.updateWorldMatrix(true, true)\n\t\tactive.updateWorldMatrix(true, false)\n\t\tpointer.set(\n\t\t\t((event.clientX - bounds.left) / bounds.width) * 2 - 1,\n\t\t\t1 - ((event.clientY - bounds.top) / bounds.height) * 2,\n\t\t)\n\t\traycaster.layers.mask = active.layers.mask\n\t\traycaster.setFromCamera(pointer, active)\n\t\tif (\n\t\t\tevent.clientX < bounds.left ||\n\t\t\tevent.clientX > bounds.right ||\n\t\t\tevent.clientY < bounds.top ||\n\t\t\tevent.clientY > bounds.bottom\n\t\t)\n\t\t\treturn undefined\n\t\tconst intersection = raycaster.intersectObject(scene, true).find(eligible)\n\t\treturn intersection ? { node: intersection.object, intersection } : undefined\n\t}\n\tconst nativeCapture = (id: number) => {\n\t\tif (canvas.hasPointerCapture?.(id)) canvas.releasePointerCapture(id)\n\t}\n\tconst dispatch = (\n\t\ttype: string,\n\t\thit: Hit,\n\t\tnativeEvent: PointerEvent,\n\t\tnodes = path(hit.node),\n\t) => {\n\t\tlet stopped = false\n\t\tfor (const node of nodes) {\n\t\t\tif (dead) break\n\t\t\tconst event: ThreePointerEvent = {\n\t\t\t\ttype,\n\t\t\t\tnativeEvent,\n\t\t\t\ttarget: hit.node,\n\t\t\t\tcurrentTarget: node,\n\t\t\t\tintersection: hit.intersection,\n\t\t\t\tray: raycaster.ray.clone(),\n\t\t\t\tpointerId: nativeEvent.pointerId,\n\t\t\t\tbutton: nativeEvent.button,\n\t\t\t\tbuttons: nativeEvent.buttons,\n\t\t\t\tclientX: nativeEvent.clientX,\n\t\t\t\tclientY: nativeEvent.clientY,\n\t\t\t\tstopPropagation() {\n\t\t\t\t\tstopped = true\n\t\t\t\t},\n\t\t\t\tpreventDefault() {\n\t\t\t\t\tnativeEvent.preventDefault()\n\t\t\t\t},\n\t\t\t\tsetPointerCapture() {\n\t\t\t\t\tcanvas.setPointerCapture(nativeEvent.pointerId)\n\t\t\t\t\tcaptures.set(nativeEvent.pointerId, {\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tintersection: hit.intersection,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\treleasePointerCapture() {\n\t\t\t\t\tif (captures.get(nativeEvent.pointerId)?.node === node) {\n\t\t\t\t\t\tcaptures.delete(nativeEvent.pointerId)\n\t\t\t\t\t\tnativeCapture(nativeEvent.pointerId)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thasPointerCapture() {\n\t\t\t\t\treturn captures.get(nativeEvent.pointerId)?.node === node\n\t\t\t\t},\n\t\t\t}\n\t\t\tfor (const handler of [...(listeners.get(node)?.get(type) ?? [])])\n\t\t\t\tif (!dead && listeners.get(node)?.get(type)?.has(handler)) handler(event)\n\t\t\tif (stopped) break\n\t\t}\n\t}\n\tconst hover = (event: PointerEvent, next?: Hit) => {\n\t\tconst previous = hovering.get(event.pointerId)\n\t\tif (previous?.node === next?.node) {\n\t\t\tif (next) hovering.set(event.pointerId, next)\n\t\t\treturn\n\t\t}\n\t\tconst oldPath = previous ? path(previous.node) : []\n\t\tconst newPath = next ? path(next.node) : []\n\t\t// Publish state first so handlers may remove nodes or dispose this manager safely.\n\t\tif (next) hovering.set(event.pointerId, next)\n\t\telse hovering.delete(event.pointerId)\n\t\tif (previous) {\n\t\t\tdispatch(`pointerout`, previous, event)\n\t\t\tfor (const node of oldPath)\n\t\t\t\tif (!newPath.includes(node))\n\t\t\t\t\tdispatch(`pointerleave`, previous, event, [node])\n\t\t}\n\t\tif (next && path(next.node).length) {\n\t\t\tdispatch(`pointerover`, next, event)\n\t\t\tfor (const node of newPath.reverse())\n\t\t\t\tif (!oldPath.includes(node))\n\t\t\t\t\tdispatch(`pointerenter`, next, event, [node])\n\t\t}\n\t}\n\tconst cancel = (event: PointerEvent) => {\n\t\tconst hit = captures.get(event.pointerId) ?? pressed.get(event.pointerId)\n\t\tcaptures.delete(event.pointerId)\n\t\tpressed.delete(event.pointerId)\n\t\ttry {\n\t\t\tif (hit) dispatch(`pointercancel`, hit, event)\n\t\t} finally {\n\t\t\tnativeCapture(event.pointerId)\n\t\t}\n\t}\n\tconst handle = (event: PointerEvent) => {\n\t\ttry {\n\t\t\tif (event.type === `lostpointercapture`) {\n\t\t\t\tcancel(event)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.type === `pointercancel`) {\n\t\t\t\tcancel(event)\n\t\t\t\thover(event)\n\t\t\t\tlast.delete(event.pointerId)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.type === `pointerleave`) {\n\t\t\t\tlast.set(event.pointerId, event)\n\t\t\t\thover(event)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlast.set(event.pointerId, event)\n\t\t\tconst hit = pick(event)\n\t\t\thover(event, hit)\n\t\t\tif (dead) return\n\t\t\tconst capture = captures.get(event.pointerId)\n\t\t\tif (capture && hit && contains(capture.node, hit.node))\n\t\t\t\tcapture.intersection = hit.intersection\n\t\t\tconst delivery = capture ?? hit\n\t\t\tif (event.type === `pointerdown`) {\n\t\t\t\tif (hit) {\n\t\t\t\t\tpressed.set(event.pointerId, hit)\n\t\t\t\t\tcanvas.setPointerCapture?.(event.pointerId)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.type === `pointerup`) {\n\t\t\t\tconst down = pressed.get(event.pointerId)\n\t\t\t\tpressed.delete(event.pointerId)\n\t\t\t\ttry {\n\t\t\t\t\t// Capture may belong to an ancestor of the original hit.\n\t\t\t\t\tif (down && !capture && down.node !== hit?.node)\n\t\t\t\t\t\tdispatch(`pointercancel`, down, event)\n\t\t\t\t\tif (delivery) dispatch(`pointerup`, delivery, event)\n\t\t\t\t\tif (down && down.node === hit?.node && event.button === 0)\n\t\t\t\t\t\tdispatch(`click`, hit, event)\n\t\t\t\t} finally {\n\t\t\t\t\tcaptures.delete(event.pointerId)\n\t\t\t\t\tnativeCapture(event.pointerId)\n\t\t\t\t\tif (event.pointerType === `touch`) {\n\t\t\t\t\t\thover(event)\n\t\t\t\t\t\tlast.delete(event.pointerId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (delivery) dispatch(event.type, delivery, event)\n\t\t} catch (error) {\n\t\t\tonError(error)\n\t\t}\n\t}\n\tconst events = [\n\t\t`pointerdown`,\n\t\t`pointerup`,\n\t\t`pointermove`,\n\t\t`pointerleave`,\n\t\t`pointercancel`,\n\t\t`lostpointercapture`,\n\t] as const\n\tfor (const type of events) canvas.addEventListener(type, handle)\n\tconst manager = {\n\t\t/** Re-pick stationary pointers after camera, geometry, or transforms change. */\n\t\tupdate() {\n\t\t\tif (dead) return\n\t\t\ttry {\n\t\t\t\tfor (const event of last.values())\n\t\t\t\t\tif (event.type !== `pointerleave`) hover(event, pick(event))\n\t\t\t} catch (error) {\n\t\t\t\tonError(error)\n\t\t\t}\n\t\t},\n\t\tremove(node: THREE.Object3D) {\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const [id, hit] of hovering)\n\t\t\t\tif (contains(node, hit.node)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\thover(last.get(id)!)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tfor (const [id, hit] of [...pressed, ...captures])\n\t\t\t\tif (contains(node, hit.node)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcancel(last.get(id)!)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (errors.length) throw new AggregateError(errors)\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tfor (const type of events) canvas.removeEventListener(type, handle)\n\t\t\tfor (const id of new Set([...pressed.keys(), ...captures.keys()]))\n\t\t\t\tnativeCapture(id)\n\t\t\thovering.clear()\n\t\t\tpressed.clear()\n\t\t\tcaptures.clear()\n\t\t\tlast.clear()\n\t\t\tmanagers.delete(manager)\n\t\t},\n\t}\n\tmanagers.add(manager)\n\treturn manager\n}\n","import { fail, isPresent, owner } from \"./core.ts\"\nimport type { ThreeEventAttributes, ThreeEventHandler } from \"./three-events.ts\"\nimport {\n\tcreateThreeEvents,\n\tforgetThree,\n\tlistenThree,\n\tsuspendThree,\n} from \"./three-events.ts\"\n\nexport type {\n\tThreeEventAttributes,\n\tThreeEventHandler,\n\tThreeEventManager,\n\tThreePointerEvent,\n} from \"./three-events.ts\"\nexport { createThreeEvents } from \"./three-events.ts\"\nimport * as THREE from \"three\"\n\nimport type { Children, SpaElement } from \"./index.ts\"\nimport { onCleanup, onMount } from \"./index.ts\"\nimport type { CapabilityAttributes } from \"./jsx-runtime.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\nimport {\n\tbindScene,\n\tcreateSceneRenderer,\n\tonSceneFrame,\n\tsceneComponent,\n} from \"./renderer.ts\"\n\ntype Resource = THREE.Object3D | THREE.BufferGeometry | THREE.Material\ntype Vector3 = readonly [number, number, number]\nexport interface ObjectProps<N extends THREE.Object3D = THREE.Object3D>\n\textends CapabilityAttributes<`three`>, ThreeEventAttributes<N> {\n\tchildren?: Children\n\tposition?: Vector3\n\trotation?: Vector3\n\tscale?: Vector3 | number\n\tvisible?: boolean\n\tname?: string\n\tref?: (object: N | null) => void\n}\nconst constructors = {\n\tGroup: THREE.Group,\n\tMesh: THREE.Mesh,\n\tPerspectiveCamera: THREE.PerspectiveCamera,\n\tAmbientLight: THREE.AmbientLight,\n\tDirectionalLight: THREE.DirectionalLight,\n\tBoxGeometry: THREE.BoxGeometry,\n\tSphereGeometry: THREE.SphereGeometry,\n\tPlaneGeometry: THREE.PlaneGeometry,\n\tMeshStandardMaterial: THREE.MeshStandardMaterial,\n\tMeshBasicMaterial: THREE.MeshBasicMaterial,\n\tMeshNormalMaterial: THREE.MeshNormalMaterial,\n}\nconst meshDefaults = new WeakMap<\n\tTHREE.Mesh,\n\t{ geometry: THREE.BufferGeometry; material: THREE.Material }\n>()\nconst borrowedMeshDefaults = new WeakMap<\n\tTHREE.Mesh,\n\t{\n\t\tgeometry: THREE.BufferGeometry\n\t\tmaterial: THREE.Material | THREE.Material[]\n\t}\n>()\nconst constructorArgs = new WeakMap<Resource, unknown[]>()\nconst eventHandlers = new WeakMap<Resource, Map<string, () => void>>()\nconst defaults = new WeakMap<Resource, Map<string, any>>()\nfunction writeProperty(node: Resource, key: string, value: any): void {\n\tconst target = node as any\n\tif (!(key in target)) throw new Error(`spa/three: unknown property ${key}`)\n\tconst current = target[key]\n\tif (current?.isColor) current.set(value)\n\telse if (Array.isArray(value) && typeof current?.set === `function`)\n\t\tcurrent.set(...value)\n\telse if (key === `scale` && typeof value === `number`) current.setScalar(value)\n\telse if (current?.copy && value?.constructor === current.constructor)\n\t\tcurrent.copy(value)\n\telse target[key] = value\n\tif (node instanceof THREE.PerspectiveCamera) node.updateProjectionMatrix()\n}\nconst renderer = createSceneRenderer<Resource>({\n\ttarget(node) {\n\t\treturn {\n\t\t\tkind: `three`,\n\t\t\tnode,\n\t\t\t...(node instanceof THREE.Object3D\n\t\t\t\t? {\n\t\t\t\t\t\tsuspend: () => suspendThree(node),\n\t\t\t\t\t\tlisten: (type: string, listener: () => void) =>\n\t\t\t\t\t\t\tlistenThree(node, type, listener),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tread(key) {\n\t\t\t\tconst value = (node as any)[key]\n\t\t\t\treturn value?.isColor\n\t\t\t\t\t? value.getStyle()\n\t\t\t\t\t: value?.isVector3 || value?.isEuler\n\t\t\t\t\t\t? [value.x, value.y, value.z]\n\t\t\t\t\t\t: value\n\t\t\t},\n\t\t\twrite(key, value) {\n\t\t\t\twriteProperty(node, key, value)\n\t\t\t},\n\t\t}\n\t},\n\tcreate(type, props) {\n\t\tconst Constructor = constructors[type as keyof typeof constructors]\n\t\tif (!Constructor) throw new Error(`spa/three: unknown node ${type}`)\n\t\tconst node = new (Constructor as any)(...(props[`args`] ?? [])) as Resource\n\t\t// Mesh's implicit resources are replaced by owned JSX resources below.\n\t\tif (node instanceof THREE.Mesh)\n\t\t\tmeshDefaults.set(node, {\n\t\t\t\tgeometry: node.geometry,\n\t\t\t\tmaterial: node.material as THREE.Material,\n\t\t\t})\n\t\tconstructorArgs.set(node, [...(props[`args`] ?? [])])\n\t\tdefaults.set(node, new Map())\n\t\teventHandlers.set(node, new Map())\n\t\treturn node\n\t},\n\tupdate(node, props, previous) {\n\t\tif (!equalArgs(constructorArgs.get(node)!, props[`args`]))\n\t\t\tthrow new Error(\n\t\t\t\t`spa/three: change the component key to replace constructor args`,\n\t\t\t)\n\t\tconst target = node as any\n\t\tconst saved = defaults.get(node)!\n\t\tfor (const key of new Set([\n\t\t\t...Object.keys(previous),\n\t\t\t...Object.keys(props),\n\t\t])) {\n\t\t\tif (\n\t\t\t\t/^(key|children|ref|args)$/.test(key) ||\n\t\t\t\tObject.is(props[key], previous[key])\n\t\t\t)\n\t\t\t\tcontinue\n\t\t\tif (key.startsWith(`on`)) {\n\t\t\t\tif (\n\t\t\t\t\t!(node instanceof THREE.Object3D) ||\n\t\t\t\t\t!/^on(Pointer(Down|Up|Move|Enter|Leave|Over|Out|Cancel)|Click)$/.test(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(`spa/three: unknown event ${key}`)\n\t\t\t\tconst handlers = eventHandlers.get(node)!\n\t\t\t\thandlers.get(key)?.()\n\t\t\t\thandlers.delete(key)\n\t\t\t\tif (props[key])\n\t\t\t\t\thandlers.set(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tlistenThree(\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tkey.slice(2).toLowerCase(),\n\t\t\t\t\t\t\tprops[key] as ThreeEventHandler,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!(key in target)) throw new Error(`spa/three: unknown property ${key}`)\n\t\t\tconst current = target[key]\n\t\t\tif (!saved.has(key))\n\t\t\t\tsaved.set(key, current?.clone ? current.clone() : current)\n\t\t\tconst value = props[key] === undefined ? saved.get(key) : props[key]\n\t\t\twriteProperty(node, key, value)\n\t\t}\n\t\tif (node instanceof THREE.PerspectiveCamera) node.updateProjectionMatrix()\n\t},\n\tchildren(parent, children, activeChildren) {\n\t\tif (!(parent instanceof THREE.Object3D)) {\n\t\t\tif (children.length)\n\t\t\t\tthrow new Error(`spa/three: resources cannot contain children`)\n\t\t\treturn\n\t\t}\n\t\tconst objects = children.filter(\n\t\t\t(child): child is THREE.Object3D => child instanceof THREE.Object3D,\n\t\t)\n\t\tfor (const child of [...parent.children])\n\t\t\tif (!objects.includes(child)) parent.remove(child)\n\t\tfor (const child of objects) if (child.parent !== parent) parent.add(child)\n\t\tparent.children.splice(0, parent.children.length, ...objects)\n\t\tconst resources = children.filter(\n\t\t\t(child) => !(child instanceof THREE.Object3D),\n\t\t)\n\t\tif (resources.length && !(parent instanceof THREE.Mesh))\n\t\t\tthrow new Error(`spa/three: geometry and material require a Mesh parent`)\n\t\tif (parent instanceof THREE.Mesh) {\n\t\t\tconst geometries = resources.filter(\n\t\t\t\t(child) => child instanceof THREE.BufferGeometry,\n\t\t\t)\n\t\t\tconst materials = resources.filter(\n\t\t\t\t(child) => child instanceof THREE.Material,\n\t\t\t)\n\t\t\tconst activeGeometries = activeChildren.filter(\n\t\t\t\t(child) => child instanceof THREE.BufferGeometry,\n\t\t\t)\n\t\t\tconst activeMaterials = activeChildren.filter(\n\t\t\t\t(child) => child instanceof THREE.Material,\n\t\t\t)\n\t\t\tif (activeGeometries.length > 1 || activeMaterials.length > 1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/three: each Mesh accepts one geometry and one material`,\n\t\t\t\t)\n\t\t\tconst owned = meshDefaults.get(parent)\n\t\t\tlet baseline = owned ?? borrowedMeshDefaults.get(parent)\n\t\t\tif (!baseline) {\n\t\t\t\tbaseline = { geometry: parent.geometry, material: parent.material }\n\t\t\t\tborrowedMeshDefaults.set(parent, baseline)\n\t\t\t}\n\t\t\t// Retention owns outgoing resources without occupying incoming attachment slots.\n\t\t\tparent.geometry =\n\t\t\t\tactiveGeometries[0] ??\n\t\t\t\tgeometries.find((geometry) => geometry === parent.geometry) ??\n\t\t\t\tgeometries.at(-1) ??\n\t\t\t\tbaseline.geometry\n\t\t\tparent.material =\n\t\t\t\tactiveMaterials[0] ??\n\t\t\t\tmaterials.find((material) => material === parent.material) ??\n\t\t\t\tmaterials.at(-1) ??\n\t\t\t\tbaseline.material\n\t\t\tif (!owned && children.length === 0) borrowedMeshDefaults.delete(parent)\n\t\t}\n\t},\n\tdestroy(node) {\n\t\teventHandlers.get(node)!.clear()\n\t\tif (node instanceof THREE.Object3D) {\n\t\t\ttry {\n\t\t\t\tforgetThree(node)\n\t\t\t} finally {\n\t\t\t\tnode.removeFromParent()\n\t\t\t\tif (node instanceof THREE.Mesh) {\n\t\t\t\t\tconst owned = meshDefaults.get(node)!\n\t\t\t\t\towned.geometry.dispose()\n\t\t\t\t\towned.material.dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t} else node.dispose()\n\t},\n})\nfunction equalArgs(a: unknown[], b: unknown[] = []): boolean {\n\treturn (\n\t\ta.length === b.length &&\n\t\ta.every((value, index) => Object.is(value, b[index]))\n\t)\n}\n\nexport interface CanvasProps {\n\tchildren?: Children\n\twidth?: number\n\theight?: number\n\tcamera?: THREE.Camera\n\tonFrame?: (state: {\n\t\tscene: THREE.Scene\n\t\tcamera: THREE.Camera\n\t\trenderer: THREE.WebGLRenderer\n\t\tdelta: number\n\t\ttime: number\n\t}) => void\n}\n/** Browser-only scene boundary. The camera prop is borrowed and never disposed. */\nexport function Canvas(props: CanvasProps): SpaElement {\n\tlet canvas: HTMLCanvasElement | null = null\n\tonMount(() => {\n\t\tconst webgl = new THREE.WebGLRenderer({ canvas: canvas!, antialias: true })\n\t\tonCleanup(() => {\n\t\t\twebgl.dispose()\n\t\t})\n\t\tconst scene = new THREE.Scene()\n\t\tconst camera = new THREE.PerspectiveCamera(50, 1, 0.1, 1000)\n\t\tcamera.position.z = 5\n\t\tbindScene(\n\t\t\t() => [props.width ?? 800, props.height ?? 600] as const,\n\t\t\t([width, height]) => {\n\t\t\t\twebgl.setSize(width, height)\n\t\t\t\tcamera.aspect = width / height\n\t\t\t\tcamera.updateProjectionMatrix()\n\t\t\t},\n\t\t)\n\t\trenderer.mount(() => props.children, scene)\n\t\tconst scope = owner!\n\t\tconst root = scope._root\n\t\tconst events = createThreeEvents(\n\t\t\tcanvas!,\n\t\t\tscene,\n\t\t\t() => props.camera ?? camera,\n\t\t\t(error) => {\n\t\t\t\ttry {\n\t\t\t\t\tfail(root, error)\n\t\t\t\t} catch (failure) {\n\t\t\t\t\troot.error(failure)\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\t\tonCleanup(() => {\n\t\t\tevents.dispose()\n\t\t})\n\t\tlet last: number | undefined\n\t\tonSceneFrame((time) => {\n\t\t\tconst active = props.camera ?? camera\n\t\t\tconst delta = last === undefined ? 0 : (time - last) / 1000\n\t\t\tlast = time\n\t\t\tif (isPresent(scope))\n\t\t\t\tprops.onFrame?.({\n\t\t\t\t\tscene,\n\t\t\t\t\tcamera: active,\n\t\t\t\t\trenderer: webgl,\n\t\t\t\t\tdelta,\n\t\t\t\t\ttime: time / 1000,\n\t\t\t\t})\n\t\t\tevents.update()\n\t\t\twebgl.render(scene, active)\n\t\t}, true)\n\t})\n\treturn jsx(`canvas`, {\n\t\tref: (element: HTMLCanvasElement | null) => {\n\t\t\tcanvas = element\n\t\t},\n\t})\n}\nexport const Group = sceneComponent<ObjectProps>(`Group`)\nexport const Mesh = sceneComponent<ObjectProps<THREE.Mesh>>(`Mesh`)\nexport const PerspectiveCamera = sceneComponent<\n\tObjectProps<THREE.PerspectiveCamera> & {\n\t\targs?: ConstructorParameters<typeof THREE.PerspectiveCamera>\n\t\tfov?: number\n\t\taspect?: number\n\t\tnear?: number\n\t\tfar?: number\n\t}\n>(`PerspectiveCamera`)\nexport const AmbientLight = sceneComponent<\n\tObjectProps<THREE.Light> & {\n\t\tcolor?: THREE.ColorRepresentation\n\t\tintensity?: number\n\t}\n>(`AmbientLight`)\nexport const DirectionalLight = sceneComponent<\n\tObjectProps<THREE.Light> & {\n\t\tcolor?: THREE.ColorRepresentation\n\t\tintensity?: number\n\t}\n>(`DirectionalLight`)\nexport const BoxGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.BoxGeometry>\n\tref?: (node: THREE.BoxGeometry | null) => void\n}>(`BoxGeometry`)\nexport const SphereGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.SphereGeometry>\n\tref?: (node: THREE.SphereGeometry | null) => void\n}>(`SphereGeometry`)\nexport const PlaneGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.PlaneGeometry>\n\tref?: (node: THREE.PlaneGeometry | null) => void\n}>(`PlaneGeometry`)\nexport const MeshStandardMaterial = sceneComponent<\n\tTHREE.MeshStandardMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshStandardMaterial | null) => void\n\t\t}\n>(`MeshStandardMaterial`)\nexport const MeshBasicMaterial = sceneComponent<\n\tTHREE.MeshBasicMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshBasicMaterial | null) => void\n\t\t}\n>(`MeshBasicMaterial`)\nexport const MeshNormalMaterial = sceneComponent<\n\tTHREE.MeshNormalMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshNormalMaterial | null) => void\n\t\t}\n>(`MeshNormalMaterial`)\nexport { renderer as threeRenderer }\n"],"mappings":";;;;;AAsCA,MAAM,4BAAY,IAAI,QAAwB;AAC9C,SAAgB,aAAa,MAAkC;CAC9D,UAAU,IAAI,IAAI;CAClB,KAAK,MAAM,WAAW,UAAU,QAAQ,OAAO,IAAI;CACnD,aAAa;EACZ,UAAU,OAAO,IAAI;CACtB;AACD;AACA,MAAM,4BAAY,IAAI,QAAmD;AACzE,MAAM,2BAAW,IAAI,IAA4C;AAEjE,SAAgB,YACf,MACA,MACA,SACa;CACb,MAAM,SAAS,UAAU,IAAI,IAAI,qBAAK,IAAI,IAA0B;CACpE,UAAU,IAAI,MAAM,MAAM;CAC1B,MAAM,WAAW,OAAO,IAAI,IAAI,qBAAK,IAAI,IAAa;CACtD,OAAO,IAAI,MAAM,QAAQ;CACzB,SAAS,IAAI,OAAO;CACpB,aAAa;EACZ,SAAS,OAAO,OAAO;EACvB,IAAI,CAAC,SAAS,MAAM,OAAO,OAAO,IAAI;CACvC;AACD;AACA,SAAgB,YAAY,MAA4B;CACvD,MAAM,SAAoB,CAAC;CAC3B,KAAK,MAAM,WAAW,UACrB,IAAI;EACH,QAAQ,OAAO,IAAI;CACpB,SAAS,OAAO;EACf,OAAO,KAAK,KAAK;CAClB;CAED,UAAU,OAAO,IAAI;CACrB,IAAI,OAAO,QAAQ,MAAM,IAAI,eAAe,MAAM;AACnD;;AAUA,SAAgB,kBACf,QACA,OACA,QACA,WAAqC,UAAU;CAC9C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/B,CACD;EACA,SAAS,YAAY,MAAM,UAAU,KAAK;EAC1C,MAAM,QAAQ;EACd,MAAM,OAAO,MAAM;EACnB,MAAM,SAAS,kBACd,QACA,aACM,MAAM,UAAU,SACrB,UAAU;GACV,IAAI;IACH,KAAK,MAAM,KAAK;GACjB,SAAS,SAAS;IACjB,KAAK,MAAM,OAAO;GACnB;EACD,CACD;EACA,gBAAgB;GACf,OAAO,QAAQ;EAChB,CAAC;EACD,IAAI;EACJ,cAAc,SAAS;GACtB,MAAM,SAAS,MAAM,UAAU;GAC/B,MAAM,QAAQ,SAAS,KAAA,IAAY,KAAK,OAAO,QAAQ;GACvD,OAAO;GACP,IAAI,UAAU,KAAK,GAClB,MAAM,UAAU;IACf;IACA,QAAQ;IACR,UAAU;IACV;IACA,MAAM,OAAO;GACd,CAAC;GACF,OAAO,OAAO;GACd,MAAM,OAAO,OAAO,MAAM;EAC3B,GAAG,IAAI;CACR,CAAC;CACD,OAAO,IAAI,UAAU,EACpB,MAAM,YAAsC;EAC3C,SAAS;CACV,EACD,CAAC;AACF;AACA,MAAa,QAAQ,eAA4B,OAAO;AACxD,MAAa,OAAO,eAAwC,MAAM;AAClE,MAAa,oBAAoB,eAQ/B,mBAAmB;AACrB,MAAa,eAAe,eAK1B,cAAc;AAChB,MAAa,mBAAmB,eAK9B,kBAAkB;AACpB,MAAa,cAAc,eAGxB,aAAa;AAChB,MAAa,iBAAiB,eAG3B,gBAAgB;AACnB,MAAa,gBAAgB,eAG1B,eAAe;AAClB,MAAa,uBAAuB,eAKlC,sBAAsB;AACxB,MAAa,oBAAoB,eAK/B,mBAAmB;AACrB,MAAa,qBAAqB,eAKhC,oBAAoB"}
1
+ {"version":3,"file":"three.js","names":[],"sources":["../../src/three-events.ts","../../src/three.ts"],"sourcesContent":["import * as THREE from \"three\"\n\nexport interface ThreePointerEvent<N extends THREE.Object3D = THREE.Object3D> {\n\ttype: string\n\tnativeEvent: PointerEvent\n\ttarget: THREE.Object3D\n\tcurrentTarget: N\n\tintersection: THREE.Intersection\n\tray: THREE.Ray\n\tpointerId: number\n\tbutton: number\n\tbuttons: number\n\tclientX: number\n\tclientY: number\n\tstopPropagation(): void\n\tpreventDefault(): void\n\tsetPointerCapture(): void\n\treleasePointerCapture(): void\n\thasPointerCapture(): boolean\n}\nexport type ThreeEventHandler<N extends THREE.Object3D = THREE.Object3D> = (\n\tevent: ThreePointerEvent<N>,\n) => void\nexport interface ThreeEventAttributes<\n\tN extends THREE.Object3D = THREE.Object3D,\n> {\n\tonPointerDown?: ThreeEventHandler<N>\n\tonPointerUp?: ThreeEventHandler<N>\n\tonPointerMove?: ThreeEventHandler<N>\n\tonPointerEnter?: ThreeEventHandler<N>\n\tonPointerLeave?: ThreeEventHandler<N>\n\tonPointerOver?: ThreeEventHandler<N>\n\tonPointerOut?: ThreeEventHandler<N>\n\tonPointerCancel?: ThreeEventHandler<N>\n\tonClick?: ThreeEventHandler<N>\n}\ntype Hit = { node: THREE.Object3D; intersection: THREE.Intersection }\ntype Handler = ThreeEventHandler\nconst suspended = new WeakSet<THREE.Object3D>()\nexport function suspendThree(node: THREE.Object3D): () => void {\n\tsuspended.add(node)\n\tfor (const manager of managers) manager.remove(node)\n\treturn () => {\n\t\tsuspended.delete(node)\n\t}\n}\nconst listeners = new WeakMap<THREE.Object3D, Map<string, Set<Handler>>>()\nconst managers = new Set<{ remove(node: THREE.Object3D): void }>()\n\nexport function listenThree(\n\tnode: THREE.Object3D,\n\ttype: string,\n\thandler: Handler,\n): () => void {\n\tconst events = listeners.get(node) ?? new Map<string, Set<Handler>>()\n\tlisteners.set(node, events)\n\tconst handlers = events.get(type) ?? new Set<Handler>()\n\tevents.set(type, handlers)\n\thandlers.add(handler)\n\treturn () => {\n\t\thandlers.delete(handler)\n\t\tif (!handlers.size) events.delete(type)\n\t}\n}\nexport function forgetThree(node: THREE.Object3D): void {\n\tconst errors: unknown[] = []\n\tfor (const manager of managers) {\n\t\ttry {\n\t\t\tmanager.remove(node)\n\t\t} catch (error) {\n\t\t\terrors.push(error)\n\t\t}\n\t}\n\tlisteners.delete(node)\n\tif (errors.length) throw new AggregateError(errors)\n}\n\nexport interface ThreeEventManager {\n\tupdate(): void\n\t/** Release hover, press, and capture state for a removed subtree. */\n\tremove(node: THREE.Object3D): void\n\tdispose(): void\n}\n\n/** Attach raycast pointer routing to a canvas; usable with borrowed scene roots. */\nexport function createThreeEvents(\n\tcanvas: HTMLCanvasElement,\n\tscene: THREE.Object3D,\n\tcamera: () => THREE.Camera,\n\tonError: (error: unknown) => void = (error) => {\n\t\tthrow error\n\t},\n): ThreeEventManager {\n\tconst raycaster = new THREE.Raycaster()\n\tconst pointer = new THREE.Vector2()\n\tconst hovering = new Map<number, Hit>()\n\tconst pressed = new Map<number, Hit>()\n\tconst captures = new Map<number, Hit>()\n\tconst last = new Map<number, PointerEvent>()\n\tlet dead = false\n\tconst path = (node: THREE.Object3D) => {\n\t\tconst nodes: THREE.Object3D[] = []\n\t\tfor (let at: THREE.Object3D | null = node; at; at = at.parent) {\n\t\t\tnodes.push(at)\n\t\t\tif (at === scene) return nodes\n\t\t}\n\t\treturn []\n\t}\n\tconst contains = (node: THREE.Object3D, child: THREE.Object3D) => {\n\t\tfor (let at: THREE.Object3D | null = child; at; at = at.parent)\n\t\t\tif (at === node) return true\n\t\treturn false\n\t}\n\tconst eligible = (intersection: THREE.Intersection) => {\n\t\tconst nodes = path(intersection.object)\n\t\tif (\n\t\t\t!nodes.length ||\n\t\t\tnodes.some((node) => !node.visible || suspended.has(node))\n\t\t)\n\t\t\treturn false\n\t\tconst material = (intersection.object as THREE.Mesh).material\n\t\treturn (\n\t\t\t!material ||\n\t\t\t(Array.isArray(material)\n\t\t\t\t? material[intersection.face?.materialIndex ?? 0]?.visible !== false\n\t\t\t\t: material.visible)\n\t\t)\n\t}\n\tconst pick = (event: PointerEvent): Hit | undefined => {\n\t\tconst bounds = canvas.getBoundingClientRect()\n\t\tif (!bounds.width || !bounds.height) return undefined\n\t\tconst active = camera()\n\t\tscene.updateWorldMatrix(true, true)\n\t\tactive.updateWorldMatrix(true, false)\n\t\tpointer.set(\n\t\t\t((event.clientX - bounds.left) / bounds.width) * 2 - 1,\n\t\t\t1 - ((event.clientY - bounds.top) / bounds.height) * 2,\n\t\t)\n\t\traycaster.layers.mask = active.layers.mask\n\t\traycaster.setFromCamera(pointer, active)\n\t\tif (\n\t\t\tevent.clientX < bounds.left ||\n\t\t\tevent.clientX > bounds.right ||\n\t\t\tevent.clientY < bounds.top ||\n\t\t\tevent.clientY > bounds.bottom\n\t\t)\n\t\t\treturn undefined\n\t\tconst intersection = raycaster.intersectObject(scene, true).find(eligible)\n\t\treturn intersection ? { node: intersection.object, intersection } : undefined\n\t}\n\tconst nativeCapture = (id: number) => {\n\t\tif (canvas.hasPointerCapture?.(id)) canvas.releasePointerCapture(id)\n\t}\n\tconst dispatch = (\n\t\ttype: string,\n\t\thit: Hit,\n\t\tnativeEvent: PointerEvent,\n\t\tnodes = path(hit.node),\n\t) => {\n\t\tlet stopped = false\n\t\tfor (const node of nodes) {\n\t\t\tif (dead) break\n\t\t\tconst event: ThreePointerEvent = {\n\t\t\t\ttype,\n\t\t\t\tnativeEvent,\n\t\t\t\ttarget: hit.node,\n\t\t\t\tcurrentTarget: node,\n\t\t\t\tintersection: hit.intersection,\n\t\t\t\tray: raycaster.ray.clone(),\n\t\t\t\tpointerId: nativeEvent.pointerId,\n\t\t\t\tbutton: nativeEvent.button,\n\t\t\t\tbuttons: nativeEvent.buttons,\n\t\t\t\tclientX: nativeEvent.clientX,\n\t\t\t\tclientY: nativeEvent.clientY,\n\t\t\t\tstopPropagation() {\n\t\t\t\t\tstopped = true\n\t\t\t\t},\n\t\t\t\tpreventDefault() {\n\t\t\t\t\tnativeEvent.preventDefault()\n\t\t\t\t},\n\t\t\t\tsetPointerCapture() {\n\t\t\t\t\tcanvas.setPointerCapture(nativeEvent.pointerId)\n\t\t\t\t\tcaptures.set(nativeEvent.pointerId, {\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tintersection: hit.intersection,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\treleasePointerCapture() {\n\t\t\t\t\tif (captures.get(nativeEvent.pointerId)?.node === node) {\n\t\t\t\t\t\tcaptures.delete(nativeEvent.pointerId)\n\t\t\t\t\t\tnativeCapture(nativeEvent.pointerId)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thasPointerCapture() {\n\t\t\t\t\treturn captures.get(nativeEvent.pointerId)?.node === node\n\t\t\t\t},\n\t\t\t}\n\t\t\tfor (const handler of [...(listeners.get(node)?.get(type) ?? [])])\n\t\t\t\tif (!dead && listeners.get(node)?.get(type)?.has(handler)) handler(event)\n\t\t\tif (stopped) break\n\t\t}\n\t}\n\tconst hover = (event: PointerEvent, next?: Hit) => {\n\t\tconst previous = hovering.get(event.pointerId)\n\t\tif (previous?.node === next?.node) {\n\t\t\tif (next) hovering.set(event.pointerId, next)\n\t\t\treturn\n\t\t}\n\t\tconst oldPath = previous ? path(previous.node) : []\n\t\tconst newPath = next ? path(next.node) : []\n\t\t// Publish state first so handlers may remove nodes or dispose this manager safely.\n\t\tif (next) hovering.set(event.pointerId, next)\n\t\telse hovering.delete(event.pointerId)\n\t\tif (previous) {\n\t\t\tdispatch(`pointerout`, previous, event)\n\t\t\tfor (const node of oldPath)\n\t\t\t\tif (!newPath.includes(node))\n\t\t\t\t\tdispatch(`pointerleave`, previous, event, [node])\n\t\t}\n\t\tif (next && path(next.node).length) {\n\t\t\tdispatch(`pointerover`, next, event)\n\t\t\tfor (const node of newPath.reverse())\n\t\t\t\tif (!oldPath.includes(node))\n\t\t\t\t\tdispatch(`pointerenter`, next, event, [node])\n\t\t}\n\t}\n\tconst cancel = (event: PointerEvent) => {\n\t\tconst hit = captures.get(event.pointerId) ?? pressed.get(event.pointerId)\n\t\tcaptures.delete(event.pointerId)\n\t\tpressed.delete(event.pointerId)\n\t\ttry {\n\t\t\tif (hit) dispatch(`pointercancel`, hit, event)\n\t\t} finally {\n\t\t\tnativeCapture(event.pointerId)\n\t\t}\n\t}\n\tconst handle = (event: PointerEvent) => {\n\t\ttry {\n\t\t\tif (event.type === `lostpointercapture`) {\n\t\t\t\tcancel(event)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.type === `pointercancel`) {\n\t\t\t\tcancel(event)\n\t\t\t\thover(event)\n\t\t\t\tlast.delete(event.pointerId)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.type === `pointerleave`) {\n\t\t\t\tlast.set(event.pointerId, event)\n\t\t\t\thover(event)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlast.set(event.pointerId, event)\n\t\t\tconst hit = pick(event)\n\t\t\thover(event, hit)\n\t\t\tif (dead) return\n\t\t\tconst capture = captures.get(event.pointerId)\n\t\t\tif (capture && hit && contains(capture.node, hit.node))\n\t\t\t\tcapture.intersection = hit.intersection\n\t\t\tconst delivery = capture ?? hit\n\t\t\tif (event.type === `pointerdown`) {\n\t\t\t\tif (hit) {\n\t\t\t\t\tpressed.set(event.pointerId, hit)\n\t\t\t\t\tcanvas.setPointerCapture?.(event.pointerId)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.type === `pointerup`) {\n\t\t\t\tconst down = pressed.get(event.pointerId)\n\t\t\t\tpressed.delete(event.pointerId)\n\t\t\t\ttry {\n\t\t\t\t\t// Capture may belong to an ancestor of the original hit.\n\t\t\t\t\tif (down && !capture && down.node !== hit?.node)\n\t\t\t\t\t\tdispatch(`pointercancel`, down, event)\n\t\t\t\t\tif (delivery) dispatch(`pointerup`, delivery, event)\n\t\t\t\t\tif (down && down.node === hit?.node && event.button === 0)\n\t\t\t\t\t\tdispatch(`click`, hit, event)\n\t\t\t\t} finally {\n\t\t\t\t\tcaptures.delete(event.pointerId)\n\t\t\t\t\tnativeCapture(event.pointerId)\n\t\t\t\t\tif (event.pointerType === `touch`) {\n\t\t\t\t\t\thover(event)\n\t\t\t\t\t\tlast.delete(event.pointerId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (delivery) dispatch(event.type, delivery, event)\n\t\t} catch (error) {\n\t\t\tonError(error)\n\t\t}\n\t}\n\tconst events = [\n\t\t`pointerdown`,\n\t\t`pointerup`,\n\t\t`pointermove`,\n\t\t`pointerleave`,\n\t\t`pointercancel`,\n\t\t`lostpointercapture`,\n\t] as const\n\tfor (const type of events) canvas.addEventListener(type, handle)\n\tconst manager = {\n\t\t/** Re-pick stationary pointers after camera, geometry, or transforms change. */\n\t\tupdate() {\n\t\t\tif (dead) return\n\t\t\ttry {\n\t\t\t\tfor (const event of last.values())\n\t\t\t\t\tif (event.type !== `pointerleave`) hover(event, pick(event))\n\t\t\t} catch (error) {\n\t\t\t\tonError(error)\n\t\t\t}\n\t\t},\n\t\tremove(node: THREE.Object3D) {\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const [id, hit] of hovering)\n\t\t\t\tif (contains(node, hit.node)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\thover(last.get(id)!)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tfor (const [id, hit] of [...pressed, ...captures])\n\t\t\t\tif (contains(node, hit.node)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcancel(last.get(id)!)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (errors.length) throw new AggregateError(errors)\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tfor (const type of events) canvas.removeEventListener(type, handle)\n\t\t\tfor (const id of new Set([...pressed.keys(), ...captures.keys()]))\n\t\t\t\tnativeCapture(id)\n\t\t\thovering.clear()\n\t\t\tpressed.clear()\n\t\t\tcaptures.clear()\n\t\t\tlast.clear()\n\t\t\tmanagers.delete(manager)\n\t\t},\n\t}\n\tmanagers.add(manager)\n\treturn manager\n}\n","import { fail, isPresent, owner } from \"./core.ts\"\nimport type { ThreeEventAttributes, ThreeEventHandler } from \"./three-events.ts\"\nimport {\n\tcreateThreeEvents,\n\tforgetThree,\n\tlistenThree,\n\tsuspendThree,\n} from \"./three-events.ts\"\n\nexport type {\n\tThreeEventAttributes,\n\tThreeEventHandler,\n\tThreeEventManager,\n\tThreePointerEvent,\n} from \"./three-events.ts\"\nexport { createThreeEvents } from \"./three-events.ts\"\nimport * as THREE from \"three\"\n\nimport type { Children, SpaElement } from \"./index.ts\"\nimport { onCleanup, onMount } from \"./index.ts\"\nimport type { CapabilityAttributes } from \"./jsx-runtime.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\nimport {\n\tbindScene,\n\tcreateSceneRenderer,\n\tonSceneFrame,\n\tsceneComponent,\n} from \"./renderer.ts\"\n\ntype Resource = THREE.Object3D | THREE.BufferGeometry | THREE.Material\ntype Vector3 = readonly [number, number, number]\nexport interface ObjectProps<N extends THREE.Object3D = THREE.Object3D>\n\textends CapabilityAttributes<`three`>, ThreeEventAttributes<N> {\n\tchildren?: Children\n\tposition?: Vector3\n\trotation?: Vector3\n\tscale?: Vector3 | number\n\tvisible?: boolean\n\tname?: string\n\tref?: (object: N | null) => void\n}\nconst constructors = {\n\tGroup: THREE.Group,\n\tMesh: THREE.Mesh,\n\tPerspectiveCamera: THREE.PerspectiveCamera,\n\tAmbientLight: THREE.AmbientLight,\n\tDirectionalLight: THREE.DirectionalLight,\n\tBoxGeometry: THREE.BoxGeometry,\n\tSphereGeometry: THREE.SphereGeometry,\n\tPlaneGeometry: THREE.PlaneGeometry,\n\tMeshStandardMaterial: THREE.MeshStandardMaterial,\n\tMeshBasicMaterial: THREE.MeshBasicMaterial,\n\tMeshNormalMaterial: THREE.MeshNormalMaterial,\n}\nconst meshDefaults = new WeakMap<\n\tTHREE.Mesh,\n\t{\n\t\tgeometry: THREE.BufferGeometry\n\t\tmaterial: THREE.Material | THREE.Material[]\n\t\townsGeometry: boolean\n\t\townsMaterial: boolean\n\t}\n>()\nconst borrowedMeshDefaults = new WeakMap<\n\tTHREE.Mesh,\n\t{\n\t\tgeometry: THREE.BufferGeometry\n\t\tmaterial: THREE.Material | THREE.Material[]\n\t}\n>()\nconst constructorArgs = new WeakMap<Resource, unknown[]>()\nconst eventHandlers = new WeakMap<Resource, Map<string, () => void>>()\nconst defaults = new WeakMap<Resource, Map<string, any>>()\nfunction writeProperty(node: Resource, key: string, value: any): void {\n\tconst target = node as any\n\tif (!(key in target)) throw new Error(`spa/three: unknown property ${key}`)\n\tconst current = target[key]\n\tif (current?.isColor) current.set(value)\n\telse if (Array.isArray(value) && typeof current?.set === `function`)\n\t\tcurrent.set(...value)\n\telse if (key === `scale` && typeof value === `number`) current.setScalar(value)\n\telse if (current?.copy && value?.constructor === current.constructor)\n\t\tcurrent.copy(value)\n\telse target[key] = value\n\tif (node instanceof THREE.PerspectiveCamera) node.updateProjectionMatrix()\n}\nconst renderer = createSceneRenderer<Resource>({\n\ttarget(node) {\n\t\treturn {\n\t\t\tkind: `three`,\n\t\t\tnode,\n\t\t\t...(node instanceof THREE.Object3D\n\t\t\t\t? {\n\t\t\t\t\t\tsuspend: () => suspendThree(node),\n\t\t\t\t\t\tlisten: (type: string, listener: () => void) =>\n\t\t\t\t\t\t\tlistenThree(node, type, listener),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tread(key) {\n\t\t\t\tconst value = (node as any)[key]\n\t\t\t\treturn value?.isColor\n\t\t\t\t\t? value.getStyle()\n\t\t\t\t\t: value?.isVector3 || value?.isEuler\n\t\t\t\t\t\t? [value.x, value.y, value.z]\n\t\t\t\t\t\t: value\n\t\t\t},\n\t\t\twrite(key, value) {\n\t\t\t\twriteProperty(node, key, value)\n\t\t\t},\n\t\t}\n\t},\n\tcreate(type, props) {\n\t\tconst Constructor = constructors[type as keyof typeof constructors]\n\t\tif (!Constructor) throw new Error(`spa/three: unknown node ${type}`)\n\t\tconst node = new (Constructor as any)(...(props[`args`] ?? [])) as Resource\n\t\t// Mesh's implicit resources are replaced by owned JSX resources below.\n\t\tif (node instanceof THREE.Mesh)\n\t\t\tmeshDefaults.set(node, {\n\t\t\t\tgeometry: node.geometry,\n\t\t\t\tmaterial: node.material,\n\t\t\t\townsGeometry: props[`args`]?.[0] === undefined,\n\t\t\t\townsMaterial: props[`args`]?.[1] === undefined,\n\t\t\t})\n\t\tconstructorArgs.set(node, [...(props[`args`] ?? [])])\n\t\tdefaults.set(node, new Map())\n\t\teventHandlers.set(node, new Map())\n\t\treturn node\n\t},\n\tupdate(node, props, previous) {\n\t\tif (!equalArgs(constructorArgs.get(node)!, props[`args`]))\n\t\t\tthrow new Error(\n\t\t\t\t`spa/three: change the component key to replace constructor args`,\n\t\t\t)\n\t\tconst target = node as any\n\t\tconst saved = defaults.get(node)!\n\t\tfor (const key of new Set([\n\t\t\t...Object.keys(previous),\n\t\t\t...Object.keys(props),\n\t\t])) {\n\t\t\tif (\n\t\t\t\t/^(key|children|ref|args)$/.test(key) ||\n\t\t\t\tObject.is(props[key], previous[key])\n\t\t\t)\n\t\t\t\tcontinue\n\t\t\tif (key.startsWith(`on`)) {\n\t\t\t\tif (\n\t\t\t\t\t!(node instanceof THREE.Object3D) ||\n\t\t\t\t\t!/^on(Pointer(Down|Up|Move|Enter|Leave|Over|Out|Cancel)|Click)$/.test(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(`spa/three: unknown event ${key}`)\n\t\t\t\tconst handlers = eventHandlers.get(node)!\n\t\t\t\thandlers.get(key)?.()\n\t\t\t\thandlers.delete(key)\n\t\t\t\tif (props[key])\n\t\t\t\t\thandlers.set(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tlistenThree(\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tkey.slice(2).toLowerCase(),\n\t\t\t\t\t\t\tprops[key] as ThreeEventHandler,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!(key in target)) throw new Error(`spa/three: unknown property ${key}`)\n\t\t\tconst current = target[key]\n\t\t\tif (!saved.has(key))\n\t\t\t\tsaved.set(key, current?.clone ? current.clone() : current)\n\t\t\tconst value = props[key] === undefined ? saved.get(key) : props[key]\n\t\t\twriteProperty(node, key, value)\n\t\t}\n\t\tif (node instanceof THREE.PerspectiveCamera) node.updateProjectionMatrix()\n\t},\n\tchildren(parent, children, activeChildren) {\n\t\tif (!(parent instanceof THREE.Object3D)) {\n\t\t\tif (children.length)\n\t\t\t\tthrow new Error(`spa/three: resources cannot contain children`)\n\t\t\treturn\n\t\t}\n\t\tconst objects = children.filter(\n\t\t\t(child): child is THREE.Object3D => child instanceof THREE.Object3D,\n\t\t)\n\t\tfor (const child of [...parent.children])\n\t\t\tif (!objects.includes(child)) parent.remove(child)\n\t\tfor (const child of objects) if (child.parent !== parent) parent.add(child)\n\t\tparent.children.splice(0, parent.children.length, ...objects)\n\t\tconst resources = children.filter(\n\t\t\t(child) => !(child instanceof THREE.Object3D),\n\t\t)\n\t\tif (resources.length && !(parent instanceof THREE.Mesh))\n\t\t\tthrow new Error(`spa/three: geometry and material require a Mesh parent`)\n\t\tif (parent instanceof THREE.Mesh) {\n\t\t\tconst geometries = resources.filter(\n\t\t\t\t(child) => child instanceof THREE.BufferGeometry,\n\t\t\t)\n\t\t\tconst materials = resources.filter(\n\t\t\t\t(child) => child instanceof THREE.Material,\n\t\t\t)\n\t\t\tconst activeGeometries = activeChildren.filter(\n\t\t\t\t(child) => child instanceof THREE.BufferGeometry,\n\t\t\t)\n\t\t\tconst activeMaterials = activeChildren.filter(\n\t\t\t\t(child) => child instanceof THREE.Material,\n\t\t\t)\n\t\t\tif (activeGeometries.length > 1 || activeMaterials.length > 1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/three: each Mesh accepts one geometry and one material`,\n\t\t\t\t)\n\t\t\tconst owned = meshDefaults.get(parent)\n\t\t\tlet baseline = owned ?? borrowedMeshDefaults.get(parent)\n\t\t\tif (!baseline) {\n\t\t\t\tbaseline = { geometry: parent.geometry, material: parent.material }\n\t\t\t\tborrowedMeshDefaults.set(parent, baseline)\n\t\t\t}\n\t\t\t// Retention owns outgoing resources without occupying incoming attachment slots.\n\t\t\tparent.geometry =\n\t\t\t\tactiveGeometries[0] ??\n\t\t\t\tgeometries.find((geometry) => geometry === parent.geometry) ??\n\t\t\t\tgeometries.at(-1) ??\n\t\t\t\tbaseline.geometry\n\t\t\tparent.material =\n\t\t\t\tactiveMaterials[0] ??\n\t\t\t\tmaterials.find((material) => material === parent.material) ??\n\t\t\t\tmaterials.at(-1) ??\n\t\t\t\tbaseline.material\n\t\t\tif (!owned && children.length === 0) borrowedMeshDefaults.delete(parent)\n\t\t}\n\t},\n\tdestroy(node) {\n\t\teventHandlers.get(node)!.clear()\n\t\tif (node instanceof THREE.Object3D) {\n\t\t\ttry {\n\t\t\t\tforgetThree(node)\n\t\t\t} finally {\n\t\t\t\tnode.removeFromParent()\n\t\t\t\tif (node instanceof THREE.Mesh) {\n\t\t\t\t\tconst owned = meshDefaults.get(node)!\n\t\t\t\t\tif (owned.ownsGeometry) owned.geometry.dispose()\n\t\t\t\t\tif (owned.ownsMaterial) (owned.material as THREE.Material).dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t} else node.dispose()\n\t},\n})\nfunction equalArgs(a: unknown[], b: unknown[] = []): boolean {\n\treturn (\n\t\ta.length === b.length &&\n\t\ta.every(\n\t\t\t(value, index) =>\n\t\t\t\tObject.is(value, b[index]) ||\n\t\t\t\t(Array.isArray(value) &&\n\t\t\t\t\tArray.isArray(b[index]) &&\n\t\t\t\t\tequalArgs(value, b[index])),\n\t\t)\n\t)\n}\n\nexport interface CanvasState {\n\tscene: THREE.Scene\n\tcamera: THREE.Camera\n\trenderer: THREE.WebGLRenderer\n}\nexport interface CanvasResizeState extends CanvasState {\n\twidth: number\n\theight: number\n\tdpr: number\n}\nexport interface CanvasProps {\n\tchildren?: Children\n\twidth?: number\n\theight?: number\n\tcamera?: THREE.Camera\n\t/** Constructor-time options. Canvas always supplies its own DOM canvas. */\n\trendererOptions?: Omit<THREE.WebGLRendererParameters, `canvas`>\n\t/** The returned renderer belongs exclusively to Canvas and is disposed with it. */\n\tcreateRenderer?: (\n\t\toptions: THREE.WebGLRendererParameters,\n\t) => THREE.WebGLRenderer\n\t/** A fixed ratio, or a device-pixel-ratio clamp. Defaults to 1. */\n\tdpr?: number | readonly [min: number, max: number]\n\t/** Runs after sizing and scene mounting, before the first draw. May return cleanup. */\n\tonCreated?: (state: CanvasState) => void | (() => void)\n\t/** Supplied cameras keep their projection; update it explicitly here if desired. */\n\tonResize?: (state: CanvasResizeState) => void\n\tonFrame?: (state: CanvasState & { delta: number; time: number }) => void\n}\n/** Browser-only scene boundary. The camera prop is borrowed and never disposed. */\nexport function Canvas(props: CanvasProps): SpaElement {\n\tlet canvas: HTMLCanvasElement | null = null\n\tonMount(() => {\n\t\tconst parameters: THREE.WebGLRendererParameters = {\n\t\t\tantialias: true,\n\t\t\t...props.rendererOptions,\n\t\t\tcanvas: canvas!,\n\t\t}\n\t\tconst webgl = props.createRenderer\n\t\t\t? props.createRenderer(parameters)\n\t\t\t: new THREE.WebGLRenderer(parameters)\n\t\tonCleanup(() => {\n\t\t\twebgl.dispose()\n\t\t})\n\t\tif (webgl.domElement !== canvas)\n\t\t\tthrow new Error(`spa/three: renderer must use the supplied Canvas element`)\n\t\tconst scene = new THREE.Scene()\n\t\tconst camera = new THREE.PerspectiveCamera(50, 1, 0.1, 1000)\n\t\tcamera.position.z = 5\n\t\tconst view = canvas.ownerDocument.defaultView!\n\t\tconst size = () => ({\n\t\t\twidth: props.width ?? 800,\n\t\t\theight: props.height ?? 600,\n\t\t\tdpr: props.dpr ?? 1,\n\t\t\tactive: props.camera ?? camera,\n\t\t})\n\t\tconst resize = ({ width, height, dpr, active }: ReturnType<typeof size>) => {\n\t\t\tconst range = typeof dpr === `number` ? [dpr, dpr] : dpr\n\t\t\tif (\n\t\t\t\t![width, height, ...range].every(\n\t\t\t\t\t(value) => Number.isFinite(value) && value > 0,\n\t\t\t\t) ||\n\t\t\t\trange[0] > range[1]\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/three: dimensions and DPR must be positive with an ordered DPR range`,\n\t\t\t\t)\n\t\t\tconst ratio = Math.max(\n\t\t\t\trange[0],\n\t\t\t\tMath.min(range[1], view.devicePixelRatio || 1),\n\t\t\t)\n\t\t\twebgl.setPixelRatio(ratio)\n\t\t\twebgl.setSize(width, height)\n\t\t\tcamera.aspect = width / height\n\t\t\tcamera.updateProjectionMatrix()\n\t\t\tprops.onResize?.({\n\t\t\t\tscene,\n\t\t\t\tcamera: active,\n\t\t\t\trenderer: webgl,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tdpr: ratio,\n\t\t\t})\n\t\t}\n\t\tbindScene(size, resize)\n\t\tconst resized = () => {\n\t\t\ttry {\n\t\t\t\tresize(size())\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tfail(ownerRoot, error)\n\t\t\t\t} catch (failure) {\n\t\t\t\t\townerRoot.error(failure)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst ownerRoot = owner!._root\n\t\tview.addEventListener(`resize`, resized)\n\t\tonCleanup(() => {\n\t\t\tview.removeEventListener(`resize`, resized)\n\t\t})\n\t\trenderer.mount(() => props.children, scene)\n\t\tconst scope = owner!\n\t\tconst root = scope._root\n\t\tconst events = createThreeEvents(\n\t\t\tcanvas,\n\t\t\tscene,\n\t\t\t() => props.camera ?? camera,\n\t\t\t(error) => {\n\t\t\t\ttry {\n\t\t\t\t\tfail(root, error)\n\t\t\t\t} catch (failure) {\n\t\t\t\t\troot.error(failure)\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\t\tonCleanup(() => {\n\t\t\tevents.dispose()\n\t\t})\n\t\t// Scene mounting queues child refs and mount hooks; setup must follow them.\n\t\tonMount(() => {\n\t\t\tconst cleanup = props.onCreated?.({\n\t\t\t\tscene,\n\t\t\t\tcamera: props.camera ?? camera,\n\t\t\t\trenderer: webgl,\n\t\t\t})\n\t\t\tif (cleanup) onCleanup(cleanup)\n\t\t\tlet last: number | undefined\n\t\t\tonSceneFrame((time) => {\n\t\t\t\tconst active = props.camera ?? camera\n\t\t\t\tconst delta = last === undefined ? 0 : (time - last) / 1000\n\t\t\t\tlast = time\n\t\t\t\tif (isPresent(scope))\n\t\t\t\t\tprops.onFrame?.({\n\t\t\t\t\t\tscene,\n\t\t\t\t\t\tcamera: active,\n\t\t\t\t\t\trenderer: webgl,\n\t\t\t\t\t\tdelta,\n\t\t\t\t\t\ttime: time / 1000,\n\t\t\t\t\t})\n\t\t\t\tevents.update()\n\t\t\t\twebgl.render(scene, active)\n\t\t\t}, true)\n\t\t})\n\t})\n\treturn jsx(`canvas`, {\n\t\tref: (element: HTMLCanvasElement | null) => {\n\t\t\tcanvas = element\n\t\t},\n\t})\n}\nexport const Group = sceneComponent<ObjectProps>(`Group`)\nexport const Mesh = sceneComponent<\n\tObjectProps<THREE.Mesh> & {\n\t\targs?: ConstructorParameters<typeof THREE.Mesh>\n\t}\n>(`Mesh`)\nexport const PerspectiveCamera = sceneComponent<\n\tObjectProps<THREE.PerspectiveCamera> & {\n\t\targs?: ConstructorParameters<typeof THREE.PerspectiveCamera>\n\t\tfov?: number\n\t\taspect?: number\n\t\tnear?: number\n\t\tfar?: number\n\t}\n>(`PerspectiveCamera`)\nexport const AmbientLight = sceneComponent<\n\tObjectProps<THREE.Light> & {\n\t\tcolor?: THREE.ColorRepresentation\n\t\tintensity?: number\n\t}\n>(`AmbientLight`)\nexport const DirectionalLight = sceneComponent<\n\tObjectProps<THREE.Light> & {\n\t\tcolor?: THREE.ColorRepresentation\n\t\tintensity?: number\n\t}\n>(`DirectionalLight`)\nexport const BoxGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.BoxGeometry>\n\tref?: (node: THREE.BoxGeometry | null) => void\n}>(`BoxGeometry`)\nexport const SphereGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.SphereGeometry>\n\tref?: (node: THREE.SphereGeometry | null) => void\n}>(`SphereGeometry`)\nexport const PlaneGeometry = sceneComponent<{\n\targs?: ConstructorParameters<typeof THREE.PlaneGeometry>\n\tref?: (node: THREE.PlaneGeometry | null) => void\n}>(`PlaneGeometry`)\nexport const MeshStandardMaterial = sceneComponent<\n\tTHREE.MeshStandardMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshStandardMaterial | null) => void\n\t\t}\n>(`MeshStandardMaterial`)\nexport const MeshBasicMaterial = sceneComponent<\n\tTHREE.MeshBasicMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshBasicMaterial | null) => void\n\t\t}\n>(`MeshBasicMaterial`)\nexport const MeshNormalMaterial = sceneComponent<\n\tTHREE.MeshNormalMaterialParameters &\n\t\tCapabilityAttributes<`three`> & {\n\t\t\tref?: (node: THREE.MeshNormalMaterial | null) => void\n\t\t}\n>(`MeshNormalMaterial`)\nexport { renderer as threeRenderer }\n"],"mappings":";;;;;AAsCA,MAAM,4BAAY,IAAI,QAAwB;AAC9C,SAAgB,aAAa,MAAkC;CAC9D,UAAU,IAAI,IAAI;CAClB,KAAK,MAAM,WAAW,UAAU,QAAQ,OAAO,IAAI;CACnD,aAAa;EACZ,UAAU,OAAO,IAAI;CACtB;AACD;AACA,MAAM,4BAAY,IAAI,QAAmD;AACzE,MAAM,2BAAW,IAAI,IAA4C;AAEjE,SAAgB,YACf,MACA,MACA,SACa;CACb,MAAM,SAAS,UAAU,IAAI,IAAI,qBAAK,IAAI,IAA0B;CACpE,UAAU,IAAI,MAAM,MAAM;CAC1B,MAAM,WAAW,OAAO,IAAI,IAAI,qBAAK,IAAI,IAAa;CACtD,OAAO,IAAI,MAAM,QAAQ;CACzB,SAAS,IAAI,OAAO;CACpB,aAAa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B,cAAc;AAChB,MAAa,mBAAmB,eAK9B,kBAAkB;AACpB,MAAa,cAAc,eAGxB,aAAa;AAChB,MAAa,iBAAiB,eAG3B,gBAAgB;AACnB,MAAa,gBAAgB,eAG1B,eAAe;AAClB,MAAa,uBAAuB,eAKlC,sBAAsB;AACxB,MAAa,oBAAoB,eAK/B,mBAAmB;AACrB,MAAa,qBAAqB,eAKhC,oBAAoB"}
@@ -1,5 +1,5 @@
1
1
  import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
- import { a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot, x as within } from "./core-DjFJ0aIJ.js";
2
+ import { S as within, a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot } from "./core-B4rJ0xdc.js";
3
3
  import { Fragment, merge } from "./jsx-runtime.js";
4
4
  // src/dom.ts
5
5
  const HTML = `http://www.w3.org/1999/xhtml`;
@@ -232,4 +232,4 @@ function hydrate(setup, host, options = {}) {
232
232
  }
233
233
  export { render as n, hydrate as t };
234
234
 
235
- //# sourceMappingURL=dom-BrPrxO97.js.map
235
+ //# sourceMappingURL=dom-D8g3roX9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom-BrPrxO97.js","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EAC7B;CACD;AACD;AAEA,SAAS,KACR,MACA,QACA,QACA,OACA,QACO;CACP,IACC,UACA,EAAE,KAAK,aAAa,KAAK,CAAC,KAAK,aAAa,OAAO,MAAM,aAAa,IACrE;EACD,MAAM,QAAQ,OAAO;EACrB,IACC,CAAC,SACD,MAAM,aAAa,KAAK,YACxB,MAAM,aAAa,KAAK,YACvB,MAAkB,iBAAkB,KAAiB,gBACrD,KAAK,aAAa,KAAK,MAAM,cAAc,KAAK,WAChD;GACD,OAAO,OAAO,MAAM,KAAK;GACzB,OAAO,aAAa,MAAM,KAAK;GAC/B,OAAO,OAAO,OAAO,eAAe;GACnC,OAA6B,OAAO;EACtC,OAAO;GACN,OAAO;GACP,OAAO,OAAO,MAAM;EACrB;CACD,OAAO,OAAO,aAAa,MAAM,SAAS,OAAO,OAAO,MAAM;CAC9D,MAAM,UAAU,UAAU;EACxB,KAAoB,OAAO;CAC7B,CAAC;CACD,OAAO;AACR;AACA,SAAS,QACR,OACA,QACA,QACA,OACA,QACO;CACP,OAAO,KACN,OAAO,cAAe,cAAc,KAAK,GACzC,QACA,QACA,OACA,MACD;AACD;AACA,SAAS,SACR,SACA,KACA,OACA,UACO;CACP,IAAI,uBAAuB,KAAK,GAAG,GAAG;CACtC,IAAI,QAAQ,eAAe,QAAQ,cAAc,cAAc;CAC/D,IACC,wEAAwE,KACvE,GACD,GAEA,MAAM,IAAI,MAAmD,KAAA,CAAS;CACvE,IAAI,IAAI,WAAW,IAAI,GAAG;E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AM,OAAO,MAAM,SAAS,KAAK;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
1
+ {"version":3,"file":"dom-D8g3roX9.js","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EAC7B;CACD;AACD;AAEA,SAAS,KACR,MACA,QACA,QACA,OACA,QACO;CACP,IACC,UACA,EAAE,KAAK,aAAa,KAAK,CAAC,KAAK,aAAa,OAAO,MAAM,aAAa,IACrE;EACD,MAAM,QAAQ,OAAO;EACrB,IACC,CAAC,SACD,MAAM,aAAa,KAAK,YACxB,MAAM,aAAa,KAAK,YACvB,MAAkB,iBAAkB,KAAiB,gBACrD,KAAK,aAAa,KAAK,MAAM,cAAc,KAAK,WAChD;GACD,OAAO,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Q,aAAa,KAAK,OAAO,WAAW,WAAW,IAAI,IACxD,OAAO,UAAU,MAAM,CAAC,IACxB,KAAA;CACJ,MAAM,OAAO,WAAW,OAAO;CAC/B,IAAI,WAAW,KAAA,KAAa,QAAQ,aAAa,KAAA,GAChD,KAAK,UAAU;CAChB,IAAI;EACH,QAAQ,KAAK,KAAK,WAAW,MAAM,MAAM,MAAM,MAAM;EACrD,OAAO,YAAY;GAClB,MACC,QAAQ,KAAK,GACb,MACA,MACA,MACA,KAAK,iBAAiB,MAAM,MAAM,MAClC,MACD;EACD,CAAC;EACD,QAAQ,MAAM,MAAM,MAAM,MAAM,MAAM;EACtC,OAAO,MAAM;EACb,KAAK,MAAM;CACZ,SAAS,OAAO;EACf,KAAK,MAAM,KAAK;CACjB;CACA,OAAO;EACN,eAAe;GACd,QAAQ,IAAI;EACb;EACA,OAAO,KAAK;CACb;AACD;AACA,SAAgB,OACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,KAAK;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
@@ -1,4 +1,4 @@
1
- import { t as Capability } from "./capabilities-_zOwNJ-2.js";
1
+ import { t as Capability } from "./capabilities-DNcnGRv_.js";
2
2
  import { AutoUpdateOptions, Middleware, Placement, ReferenceElement, Strategy } from "@floating-ui/dom";
3
3
  export interface FloatingAttributes<Kind extends string = `dom`> {
4
4
  [`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never;
package/dist/floating.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as fail, l as onMount, x as within } from "./core-DjFJ0aIJ.js";
1
+ import { S as within, i as fail, l as onMount } from "./core-B4rJ0xdc.js";
2
2
  import { autoUpdate, computePosition } from "@floating-ui/dom";
3
3
  // src/floating.ts
4
4
  const allowed = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
- import { a as Children, i as Accessor, s as RootOptions } from "./capabilities-_zOwNJ-2.js";
2
- import "./jsx-runtime-BhiCZOYZ.js";
1
+ import { a as Children, i as Accessor, s as RootOptions } from "./capabilities-DNcnGRv_.js";
2
+ import "./jsx-runtime-DQnpyT_g.js";
3
3
  import { Loadable, ReadableFamilyToken, ReadableToken, ViewOf } from "atom.io";
4
4
  import { Canonical } from "atom.io/foundations/canonical";
5
5
  interface SpaRoot {
@@ -21,4 +21,4 @@ declare function useLoadable<T, K extends Canonical, E>(token: ReadableFamilyTok
21
21
  error?: E;
22
22
  }>;
23
23
  export { render as a, hydrate as i, useLoadable as n, SpaRoot as r, LoadableValue as t };
24
- //# sourceMappingURL=index-BFIjI7gF.d.ts.map
24
+ //# sourceMappingURL=index-BFnXIfOj.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BFIjI7gF.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;UA6XiB;EAChB;EACA;;iBAyDe,OACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;iBAGa,QACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;KCxbS,cAAc;EAAO;EAAkB,OAAO;;iBAE1C,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,KACrC,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,KACX,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,IACvC,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ;;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,IACb,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ"}
1
+ {"version":3,"file":"index-BFnXIfOj.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;UA6XiB;EAChB;EACA;;iBAyDe,OACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;iBAGa,QACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;KCxbS,cAAc;EAAO;EAAkB,OAAO;;iBAE1C,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,KACrC,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,KACX,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,IACvC,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ;;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,IACb,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as useTimeline, a as Children, c as SpaElement, d as onMount, f as useGetter, g as useStore, h as useSetter, i as Accessor, l as TimelineControls, m as useRef, n as CapabilityBinding, o as Component, p as useId, r as CapabilityTarget, s as RootOptions, t as Capability, u as onCleanup, v as useTransaction } from "./capabilities-_zOwNJ-2.js";
2
- import { a as render, i as hydrate, n as useLoadable, r as SpaRoot, t as LoadableValue } from "./index-BFIjI7gF.js";
3
- import { n as Fragment } from "./jsx-runtime-BhiCZOYZ.js";
4
- export { type Accessor, type Capability, type CapabilityBinding, type CapabilityTarget, type Children, type Component, Fragment, type LoadableValue, type RootOptions, type SpaElement, type SpaRoot, type TimelineControls, hydrate, onCleanup, onMount, render, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
1
+ import { _ as useStore, a as Children, c as SpaElement, d as onMount, f as useDisposal, g as useSetter, h as useRef, i as Accessor, l as TimelineControls, m as useId, n as CapabilityBinding, o as Component, p as useGetter, r as CapabilityTarget, s as RootOptions, t as Capability, u as onCleanup, v as useTimeline, y as useTransaction } from "./capabilities-DNcnGRv_.js";
2
+ import { a as render, i as hydrate, n as useLoadable, r as SpaRoot, t as LoadableValue } from "./index-BFnXIfOj.js";
3
+ import { n as Fragment } from "./jsx-runtime-DQnpyT_g.js";
4
+ export { type Accessor, type Capability, type CapabilityBinding, type CapabilityTarget, type Children, type Component, Fragment, type LoadableValue, type RootOptions, type SpaElement, type SpaRoot, type TimelineControls, hydrate, onCleanup, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as useSetter, b as useTransaction, c as onCleanup, g as useRef, h as useId, l as onMount, m as useGetter, v as useStore, y as useTimeline } from "./core-DjFJ0aIJ.js";
1
+ import { _ as useRef, b as useTimeline, c as onCleanup, g as useId, h as useGetter, l as onMount, m as useDisposal, v as useSetter, x as useTransaction, y as useStore } from "./core-B4rJ0xdc.js";
2
2
  import { Fragment } from "./jsx-runtime.js";
3
- import { n as render, t as hydrate } from "./dom-BrPrxO97.js";
4
- import { t as useLoadable } from "./src-DWIqXCiz.js";
5
- export { Fragment, hydrate, onCleanup, onMount, render, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
3
+ import { n as render, t as hydrate } from "./dom-D8g3roX9.js";
4
+ import { t as useLoadable } from "./src-Bme1kz2b.js";
5
+ export { Fragment, hydrate, onCleanup, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
@@ -1,4 +1,4 @@
1
- import { a as Children, c as SpaElement, o as Component } from "./capabilities-_zOwNJ-2.js";
1
+ import { a as Children, c as SpaElement, o as Component } from "./capabilities-DNcnGRv_.js";
2
2
  /** Native events retain their target; only currentTarget is the attached element. */
3
3
  type TargetedEvent<E extends Element, T extends Event = Event> = Omit<T, `currentTarget`> & {
4
4
  readonly currentTarget: E;
@@ -964,4 +964,4 @@ declare namespace JSX {
964
964
  }
965
965
  }
966
966
  export { jsxDEV as a, AriaAttributes as c, EventHandler as d, HTMLAttributes as f, TargetedEvent as h, jsx as i, DOMAttributes as l, SVGAttributes as m, Fragment as n, jsxs as o, Ref as p, JSX as r, merge as s, CapabilityAttributes as t, EventAttributes as u };
967
- //# sourceMappingURL=jsx-runtime-BhiCZOYZ.d.ts.map
967
+ //# sourceMappingURL=jsx-runtime-DQnpyT_g.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime-BhiCZOYZ.d.ts","names":[],"sources":["../src/jsx-types.d.ts","../src/jsx-runtime.ts"],"mappings":";;KAIY,cAAc,UAAU,SAAS,UAAU,QAAQ,SAAS,KACvE;WAEc,eAAe;;KAClB,aAAa,UAAU,SAAS,UAAU,QAAQ,UAC7D,OAAO,cAAc,GAAG;KAEb,IAAI,UAAU,YAAY,SAAS;KAE1C,WAAW,QAAQ,WAAW,KAAK,EAAE;;UAGhC;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAEI,UAAU,oBACZ,IACA,WAAW,MACV,gBAAgB,aAAa,WAAW;KACvC,cAAc,UAAU,WAAW,UAAU,mBAC/C,2BACA,UAAU,mBACT,2BACA,UAAU,kBACT,0BACA,UAAU,sBACT,8BACA,UAAU,gBACT,wBACA,UAAU,aACT,qBACA;KACI,gBAAgB,UAAU,cAEpC,WAAW,cAAc,oBAAoB,UAAU,yBACpD,aAAa,GAAG,QAAQ,cAAc,GAAG,IAAI;KAG7C;KACO,iBAAiB;GAC3B;GACA,gBAAgB;GAChB;GACA;GACA;GACA,cAAc;GACd,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,iBAAiB;GACjB;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA,kBAAkB;GAClB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,eAAe;GACf,mBAAmB;GACnB,yBAAyB;GACzB;GACA;GACA;GACA;GACA,iBAAiB;GACjB,kBAAkB;GAClB;GAWA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA;;KAGU,cAAc,UAAU,WAAW,8BAC9C,gBAAgB,KAChB,iBACA;EACC,UAAU;EACV;EACA,KAAK,IAAI;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;QACO;;;KAIJ,YAAY,KAAK,WAAW,QAC/B,WAAW,KAAK,mBAAmB,UAAU,cAC3C,EAAE;KAIM,eAAe,UAAU,cAAc,eAClD,cAAc,KACb;EACC;EACA;EAOA;EACA;EACA;EACA;EACA;EACA;EAQA;EACA;EACA;EACA;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGE;KACA;KAUA;KACA;EACJ;EACA;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA;;;UAIS;EACT,GAAG;EACH,MAAM;IACL;IACA;IACA;;EAED,OAAO;EACP;IAAQ;IAAc;;EACtB;IAAc;;EACd,QAAQ;IACP;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;;EAED;IAAU,QAAQ;IAAgB,OAAO;;EACzC;IAAO;;EACP;IAAY;;EACZ;IAAQ,OAAO;;EACf;IAAO;IAAc;;EACrB;IAAW;IAAc;;EACzB;IAAU;IAAe;;EACzB;IACC,QAAQ;IACR;IACA;IACA,OAAO;;EAER;IAAY;IAAmB;IAAc;;EAC7C;IACC;KACC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED;IAAQ;;EACR;IACC;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA,OAAO;;EAER;IACC;IACA,aAAa;IACb;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA;IACA,OAAO;;EAER,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA,cAAc;IACd;IACA;IACA,QAAQ;IACR;IACA,KAAK;IACL;IACA,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM;IACN;IACA,OAAO;IACP,OAAO;;EAER;IAAO;IAAc;;EACrB;IAAS;IAAa;IAAiB;;EACvC;IAAM;;EACN;IACC;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;IACA;;EAED;IAAO;;EACP;IACC;IACA;IACA;KACC;IACD;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;;EAED;IACC;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,OAAO;;EAER;IAAM;IAAmB;IAAe;;EACxC;IAAY;IAAmB;;EAC/B;IACC;IACA;IACA;IACA,OAAO;;EAER;IAAU;IAAa;IAAiB;IAAc;;EACtD;IAAY;IAAa;;EACzB;IAAK;;EACL;IACC;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAQ;;EACR;IACC,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAS;IAAkB;IAAe;IAAe;;EACzD;IAAS,aAAa;IAAgB,aAAa;;EACnD,IAAI;EACJ;IACC;IACA;IACA;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,IAAI;EACJ;IAAQ;;EACR;IACC;IACA;IACA;IACA;IACA;;EAED,OAAO;IACN;IACA,QAAQ;IACR;IACA;IACA,OAAO;;;KAIG,2BACV,aAAa,wBAAwB,eACrC,sBAAsB,SAErB,kBAAkB,oBAChB,YAAY,kBAAkB;;KAKvB,cAAc,UAAU,aAAa,cAAc,cAAc,KAC5E;EACC;GACC;GACA;EACD;GACC;GACA;GACA,mBAAmB;EACpB;GACC;GACA;EACD;GACC;GACA;GACA;EACD;EACA;EACA;GACC;EACD;GACC,iBAAiB;GACjB;EACD;GACC;GACA,kBAAkB;GAClB;GACA,cAAc;GACd,qBAAqB;GACrB;GACA;GACA;GACA,gBAAgB;GAChB;GACA,mBAAmB;GACnB;GACA;GACA;GACA;EACD;EACA,SAAS;EACT;GACC;GACA;GACA;GACA;GACA,iBAAiB;EAClB;GACC,qBAAqB;GACrB,sBAAsB;GACtB;GACA;GACA,sBAAsB;GACtB,mBAAmB;GACnB,iBAAiB;GACjB;GACA;GACA;EACD;GACC;GACA;GACA;EACD;GACC,iBAAiB;GACjB;;KAGE;EACJ,GAAG;EACH,GAAG;EACH,OAAO;EACP,QAAQ;;KAEJ;EAAe;EAAiB;;KAChC;EAAY;GAAe;;KAC3B,qBAAqB;EAAW;;KAChC,eAAe;EACnB;EACA;EACA,OAAO;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL;EACA,aAAa;EACb,WAAW;EACX;EACA;EACA;EACA;EACA,MAAM;EACN,IAAI;EACJ,IAAI;EACJ;EACA;;KAEI;EACJ,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,YAAY;EACZ;;UAES;EACT,GAAG;IACF;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,eAAe;IACd;IACA;IACA,QAAQ;IACR;;EAED,kBAAkB;IACjB;;EAED;IACC,IAAI;IACJ,IAAI;IACJ,GAAG;IACH;;EAED;IAAY;;EACZ;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,SAAS;IAAuB;IAAY;IAAa;;EACzD,eAAe;IACd;IACA;IACA;;EAED,qBAAqB;IAAuB;;EAC5C,aAAa;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,kBAAkB;IACjB;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA,eAAe;;EAEhB,mBAAmB;IAClB;IACA;IACA;IACA,kBAAkB;;EAEnB,mBAAmB;IAClB;IACA;IACA;IACA;IACA;;EAED;IAAkB;IAAiB;;EACnC,cAAc;IACb,IAAI;IACJ,IAAI;IACJ,cAAc;;EAEf,SAAS;EACT;IACC;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,SAAS;EACT,SAAS;EACT,gBAAgB;IACf;IACA,cAAc;IACd;;EAED,SAAS,qBACR;IAAY;IAA6B,aAAa;;EACvD,SAAS;EACT;IAAe;;EACf,cAAc;IACb;IACA;IACA,QAAQ;;EAET,UAAU;IACT;IACA,IAAI;IACJ,IAAI;;EAEL;IAAgB;IAAW;IAAW;;EACtC,oBAAoB;IACnB;IACA;IACA;IACA;IACA,kBAAkB;;EAEnB;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,QAAQ;IAAuB;;EAC/B,cAAc;IACb,eAAe;IACf;IACA;IACA;IACA;;EAED,QAAQ;IAAW;IAAqB;;EACxC,eAAe;EACf,OAAO,SACN;IACC;IACA,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x-runtime.ts"],"mappings":";;KAIY,cAAc,UAAU,SAAS,UAAU,QAAQ,SAAS,KACvE;WAEc,eAAe;;KAClB,aAAa,UAAU,SAAS,UAAU,QAAQ,UAC7D,OAAO,cAAc,GAAG;KAEb,IAAI,UAAU,YAAY,SAAS;KAE1C,WAAW,QAAQ,WAAW,KAAK,EAAE;;UAGhC;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAEI,UAAU,oBACZ,IACA,WAAW,MACV,gBAAgB,aAAa,WAAW;KACvC,cAAc,UAAU,WAAW,UAAU,mBAC/C,2BACA,UAAU,mBACT,2BACA,UAAU,kBACT,0BACA,UAAU,sBACT,8BACA,UAAU,gBACT,wBACA,UAAU,aACT,qBACA;KACI,gBAAgB,UAAU,cAEpC,WAAW,cAAc,oBAAoB,UAAU,yBACpD,aAAa,GAAG,QAAQ,cAAc,GAAG,IAAI;KAG7C;KACO,iBAAiB;GAC3B;GACA,gBAAgB;GAChB;GACA;GACA;GACA,cAAc;GACd,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,iBAAiB;GACjB;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA,kBAAkB;GAClB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,eAAe;GACf,mBAAmB;GACnB,yBAAyB;GACzB;GACA;GACA;GACA;GACA,iBAAiB;GACjB,kBAAkB;GAClB;GAWA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA;;KAGU,cAAc,UAAU,WAAW,8BAC9C,gBAAgB,KAChB,iBACA;EACC,UAAU;EACV;EACA,KAAK,IAAI;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;QACO;;;KAIJ,YAAY,KAAK,WAAW,QAC/B,WAAW,KAAK,mBAAmB,UAAU,cAC3C,EAAE;KAIM,eAAe,UAAU,cAAc,eAClD,cAAc,KACb;EACC;EACA;EAOA;EACA;EACA;EACA;EACA;EACA;EAQA;EACA;EACA;EACA;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGE;KACA;KAUA;KACA;EACJ;EACA;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA;;;UAIS;EACT,GAAG;EACH,MAAM;IACL;IACA;IACA;;EAED,OAAO;EACP;IAAQ;IAAc;;EACtB;IAAc;;EACd,QAAQ;IACP;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;;EAED;IAAU,QAAQ;IAAgB,OAAO;;EACzC;IAAO;;EACP;IAAY;;EACZ;IAAQ,OAAO;;EACf;IAAO;IAAc;;EACrB;IAAW;IAAc;;EACzB;IAAU;IAAe;;EACzB;IACC,QAAQ;IACR;IACA;IACA,OAAO;;EAER;IAAY;IAAmB;IAAc;;EAC7C;IACC;KACC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED;IAAQ;;EACR;IACC;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA,OAAO;;EAER;IACC;IACA,aAAa;IACb;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA;IACA,OAAO;;EAER,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA,cAAc;IACd;IACA;IACA,QAAQ;IACR;IACA,KAAK;IACL;IACA,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM;IACN;IACA,OAAO;IACP,OAAO;;EAER;IAAO;IAAc;;EACrB;IAAS;IAAa;IAAiB;;EACvC;IAAM;;EACN;IACC;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;IACA;;EAED;IAAO;;EACP;IACC;IACA;IACA;KACC;IACD;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;;EAED;IACC;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,OAAO;;EAER;IAAM;IAAmB;IAAe;;EACxC;IAAY;IAAmB;;EAC/B;IACC;IACA;IACA;IACA,OAAO;;EAER;IAAU;IAAa;IAAiB;IAAc;;EACtD;IAAY;IAAa;;EACzB;IAAK;;EACL;IACC;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAQ;;EACR;IACC,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAS;IAAkB;IAAe;IAAe;;EACzD;IAAS,aAAa;IAAgB,aAAa;;EACnD,IAAI;EACJ;IACC;IACA;IACA;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,IAAI;EACJ;IAAQ;;EACR;IACC;IACA;IACA;IACA;IACA;;EAED,OAAO;IACN;IACA,QAAQ;IACR;IACA;IACA,OAAO;;;KAIG,2BACV,aAAa,wBAAwB,eACrC,sBAAsB,SAErB,kBAAkB,oBAChB,YAAY,kBAAkB;;KAKvB,cAAc,UAAU,aAAa,cAAc,cAAc,KAC5E;EACC;GACC;GACA;EACD;GACC;GACA;GACA,mBAAmB;EACpB;GACC;GACA;EACD;GACC;GACA;GACA;EACD;EACA;EACA;GACC;EACD;GACC,iBAAiB;GACjB;EACD;GACC;GACA,kBAAkB;GAClB;GACA,cAAc;GACd,qBAAqB;GACrB;GACA;GACA;GACA,gBAAgB;GAChB;GACA,mBAAmB;GACnB;GACA;GACA;GACA;EACD;EACA,SAAS;EACT;GACC;GACA;GACA;GACA;GACA,iBAAiB;EAClB;GACC,qBAAqB;GACrB,sBAAsB;GACtB;GACA;GACA,sBAAsB;GACtB,mBAAmB;GACnB,iBAAiB;GACjB;GACA;GACA;EACD;GACC;GACA;GACA;EACD;GACC,iBAAiB;GACjB;;KAGE;EACJ,GAAG;EACH,GAAG;EACH,OAAO;EACP,QAAQ;;KAEJ;EAAe;EAAiB;;KAChC;EAAY;GAAe;;KAC3B,qBAAqB;EAAW;;KAChC,eAAe;EACnB;EACA;EACA,OAAO;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL;EACA,aAAa;EACb,WAAW;EACX;EACA;EACA;EACA;EACA,MAAM;EACN,IAAI;EACJ,IAAI;EACJ;EACA;;KAEI;EACJ,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,YAAY;EACZ;;UAES;EACT,GAAG;IACF;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,eAAe;IACd;IACA;IACA,QAAQ;IACR;;EAED,kBAAkB;IACjB;;EAED;IACC,IAAI;IACJ,IAAI;IACJ,GAAG;IACH;;EAED;IAAY;;EACZ;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,SAAS;IAAuB;IAAY;IAAa;;EACzD,eAAe;IACd;IACA;IACA;;EAED,qBAAqB;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A;IACA;;EAED,MAAM;IAAW,IAAI;IAAgB,IAAI;IAAgB;;EACzD,QAAQ;IAAY;IAAc,aAAa;;EAC/C,KAAK;EACL;IAAQ,QAAQ;;EAChB;IAAS;IAAc;IAAe;;EACtC,KAAK,SAAS;IAAe;;EAC7B,QAAQ,SAAS;IAAe,MAAM;IAAgB,MAAM;;EAC5D,MAAM;EACN,UAAU;IACT,aAAa;IACb;IACA;IACA;IACA,YAAY;IACZ;;EAED,OAAO;EACP,KAAK,SAAS;EACd,MAAM;IAAe;;;KAEV,0BACV,aAAa,uBAAuB,cAAc,qBAAqB,SACtE,kBAAkB,mBAAmB,WAAW,iBAAiB;;;KAKxD,iBAAiB,wBAC5B,KAAK,4BAA4B;;UC93BjB,qBAAqB;cAEzB,WAAQ;EAAa,WAAW;MAAa;iBAE1C,IACf,MAAM,oBACN,OAAO,4BACP,gBACE;cAMU,aAAI;cACJ,eAAM;;iBAGH,SACZ,UAAU,6BAA6B,0BACxC;kBAqBc;OACJ,UAAU;OACV,oBAAoB,oBAAoB;YACnC;IAChB;;YAEgB;IAChB;;;YAGgB,0BAA0B;KACzC,6BAA6B,eAAe"}
@@ -1,2 +1,2 @@
1
- import { a as jsxDEV, c as AriaAttributes, d as EventHandler, f as HTMLAttributes, h as TargetedEvent, i as jsx, l as DOMAttributes, m as SVGAttributes, n as Fragment, o as jsxs, p as Ref, r as JSX, s as merge, t as CapabilityAttributes, u as EventAttributes } from "./jsx-runtime-BhiCZOYZ.js";
1
+ import { a as jsxDEV, c as AriaAttributes, d as EventHandler, f as HTMLAttributes, h as TargetedEvent, i as jsx, l as DOMAttributes, m as SVGAttributes, n as Fragment, o as jsxs, p as Ref, r as JSX, s as merge, t as CapabilityAttributes, u as EventAttributes } from "./jsx-runtime-DQnpyT_g.js";
2
2
  export { type AriaAttributes, CapabilityAttributes, type DOMAttributes, type EventAttributes, type EventHandler, Fragment, type HTMLAttributes, JSX, type Ref, type SVGAttributes, type TargetedEvent, jsx, jsxDEV, jsxs, merge };
package/dist/konva.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as Children, c as SpaElement } from "./capabilities-_zOwNJ-2.js";
1
+ import { a as Children, c as SpaElement } from "./capabilities-DNcnGRv_.js";
2
2
  import { SceneRenderer } from "./renderer.js";
3
- import "./index-BFIjI7gF.js";
4
- import { t as CapabilityAttributes } from "./jsx-runtime-BhiCZOYZ.js";
3
+ import "./index-BFnXIfOj.js";
4
+ import { t as CapabilityAttributes } from "./jsx-runtime-DQnpyT_g.js";
5
5
  import Konva from "konva";
6
6
  type Props<C, N> = C & CapabilityAttributes<`konva`> & {
7
7
  children?: Children;
package/dist/konva.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
- import { c as onCleanup, l as onMount, u as owner } from "./core-DjFJ0aIJ.js";
2
+ import { c as onCleanup, l as onMount, u as owner } from "./core-B4rJ0xdc.js";
3
3
  import { jsx } from "./jsx-runtime.js";
4
4
  import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
5
5
  import Konva from "konva";
package/dist/motion.d.ts CHANGED
@@ -1,17 +1,8 @@
1
- import { t as Capability } from "./capabilities-_zOwNJ-2.js";
2
- export type MotionScalar = number | string;
3
- export type MotionDOMTarget = Partial<Record<keyof CSSStyleDeclaration | `x` | `y` | `z` | `scale` | `scaleX` | `scaleY` | `rotate` | `rotateX` | `rotateY` | `rotateZ` | `skewX` | `skewY` | `--${string}`, MotionScalar>>;
4
- export interface MotionThreeTarget {
5
- position?: readonly [number, number, number];
6
- rotation?: readonly [number, number, number];
7
- scale?: number | readonly [number, number, number];
8
- opacity?: number;
9
- intensity?: number;
10
- color?: string;
11
- }
12
- export type MotionTarget<Kind extends string> = Kind extends `dom` ? MotionDOMTarget : Kind extends `three` ? MotionThreeTarget : Record<string, MotionScalar>;
13
- /** Supported transition options; keep public declarations independent of optional peer types. */
14
- export interface MotionTransition {
1
+ import { t as Capability } from "./capabilities-DNcnGRv_.js";
2
+ export type MotionKeyframes = readonly [MotionScalar | null, MotionScalar, ...MotionScalar[]];
3
+ export type MotionEasing = `linear` | `easeIn` | `easeOut` | `easeInOut` | `circIn` | `circOut` | `circInOut` | `backIn` | `backOut` | `backInOut` | readonly [number, number, number, number];
4
+ /** Public options remain independent of optional Motion peer declarations. */
5
+ export interface MotionValueTransition {
15
6
  type?: `spring` | `tween`;
16
7
  stiffness?: number;
17
8
  damping?: number;
@@ -23,10 +14,40 @@ export interface MotionTransition {
23
14
  visualDuration?: number;
24
15
  duration?: number;
25
16
  delay?: number;
26
- ease?: `linear` | `easeIn` | `easeOut` | `easeInOut` | `circIn` | `circOut` | `circInOut` | `backIn` | `backOut` | `backInOut` | readonly [number, number, number, number];
17
+ times?: readonly number[];
18
+ ease?: MotionEasing | readonly MotionEasing[];
19
+ }
20
+ export interface MotionTransition extends MotionValueTransition {
21
+ default?: MotionValueTransition;
22
+ properties?: Readonly<Record<string, MotionValueTransition>>;
23
+ }
24
+ export interface MotionLayoutTransition {
25
+ type?: `spring` | `tween`;
26
+ duration?: number;
27
+ delay?: number;
28
+ ease?: `linear` | `easeIn` | `easeOut` | `easeInOut` | readonly [number, number, number, number];
29
+ stiffness?: number;
30
+ damping?: number;
31
+ mass?: number;
32
+ }
33
+ export type MotionScalar = number | string;
34
+ export type MotionDOMTarget = Partial<Record<keyof CSSStyleDeclaration | `x` | `y` | `z` | `scale` | `scaleX` | `scaleY` | `rotate` | `rotateX` | `rotateY` | `rotateZ` | `skewX` | `skewY` | `--${string}`, MotionScalar | MotionKeyframes>>;
35
+ export interface MotionThreeTarget {
36
+ position?: readonly [number, number, number];
37
+ rotation?: readonly [number, number, number];
38
+ scale?: number | readonly [number, number, number];
39
+ opacity?: number;
40
+ intensity?: number;
41
+ color?: string;
27
42
  }
43
+ export type MotionTarget<Kind extends string> = Kind extends `dom` ? MotionDOMTarget : Kind extends `three` ? MotionThreeTarget : Record<string, MotionScalar>;
28
44
  export interface MotionAttributes<Kind extends string = `dom`> {
29
- [`motion:initial`]?: MotionTarget<Kind> | false;
45
+ [`motion:layout`]?: Kind extends `dom` ? boolean | `position` | `size` : never;
46
+ [`motion:layoutId`]?: Kind extends `dom` ? string | number : never;
47
+ [`motion:layoutGroup`]?: Kind extends `dom` ? string | number : never;
48
+ [`motion:layoutScroll`]?: Kind extends `dom` ? boolean : never;
49
+ [`motion:layoutTransition`]?: Kind extends `dom` ? MotionLayoutTransition : never;
50
+ [`motion:initial`]?: (Kind extends `dom` ? Partial<Record<keyof MotionDOMTarget, MotionScalar>> : MotionTarget<Kind>) | false;
30
51
  [`motion:animate`]?: MotionTarget<Kind>;
31
52
  [`motion:exit`]?: MotionTarget<Kind>;
32
53
  [`motion:transition`]?: MotionTransition;
@@ -39,6 +60,8 @@ declare module "@atom.io/spa/jsx-runtime" {
39
60
  export interface MotionCapabilityOptions {
40
61
  /** Respect the user's reduced-motion preference by default. */
41
62
  reducedMotion?: `user` | `always` | `never`;
63
+ /** Default transition for layout projection; animated properties use motion:transition. */
64
+ layoutTransition?: MotionLayoutTransition;
42
65
  }
43
66
  /** Explicit, root-scoped motion:* integration. Importing it never registers globally. */
44
67
  export declare function motionCapability(options?: MotionCapabilityOptions): Capability;
@@ -1 +1 @@
1
- {"version":3,"file":"motion.d.ts","names":[],"sources":["../src/motion.ts"],"mappings":";YAoBY;YACA,kBAAkB,QAC7B,aACS,0JAcR;iBAGe;EAChB;EACA;EACA;EACA;EACA;EACA;;YAEW,aAAa,uBAAuB,qBAC7C,kBACA,uBACC,oBACA,eAAe;;iBAEF;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAagB,iBAAiB;GAChC,oBAAoB,aAAa;GACjC,oBAAoB,aAAa;GACjC,iBAAiB,aAAa;GAC9B,uBAAuB;GACvB,uBAAuB,aAAa;GACpC,qBAAqB,aAAa;;;YAMzB,qBACT,6BACS,iBAAiB;;iBAGX;;EAEhB;;;wBA6Ze,iBACf,UAAS,0BACP"}
1
+ {"version":3,"file":"motion.d.ts","names":[],"sources":["../src/motion.ts"],"mappings":";YAyBY,4BACX,qBACA,iBACG;YAEQ;;iBAaK;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,wBAAwB;;iBAEf,yBAAyB;EACzC,UAAU;EACV,aAAa,SAAS,eAAe;;iBAErB;EAChB;EACA;EACA;EACA;EAMA;EACA;EACA;;YAGW;YACA,kBAAkB,QAC7B,aACS,0JAcR,eAAe;iBAGA;EAChB;EACA;EACA;EACA;EACA;EACA;;YAEW,aAAa,uBAAuB,qBAC7C,kBACA,uBACC,oBACA,eAAe;iBACF,iBAAiB;GAChC,mBAAmB;GACnB,qBAAqB;GACrB,wBAAwB;GACxB,yBAAyB;GACzB,6BAA6B,qBAC3B;GAEF,qBACG,qBACC,QAAQ,aAAa,iBAAiB,iBACtC,aAAa;GAEjB,oBAAoB,aAAa;GACjC,iBAAiB,aAAa;GAC9B,uBAAuB;GACvB,uBAAuB,aAAa;GACpC,qBAAqB,aAAa;;;YAMzB,qBACT,6BACS,iBAAiB;;iBAGX;;EAEhB;;EAEA,mBAAmB;;;wBAkaJ,iBACf,UAAS,0BACP"}