@atom.io/spa 0.0.9 → 0.0.10
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.
- package/README.md +30 -10
- package/README.mdx +16 -5
- package/dist/BrandMarkScene-CBYk-RJ2.js +140 -0
- package/dist/BrandMarkScene-CBYk-RJ2.js.map +1 -0
- package/dist/astro-client.js +1 -1
- package/dist/astro-server.js +1 -1
- package/dist/brand-css.d.ts +2 -0
- package/dist/brand-model.d.ts +32 -0
- package/dist/brand-model.d.ts.map +1 -0
- package/dist/brand-model.js +120 -0
- package/dist/brand-model.js.map +1 -0
- package/dist/brand.css +37 -0
- package/dist/brand.d.ts +13 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +94 -0
- package/dist/brand.js.map +1 -0
- package/dist/client.min.js +1 -1
- package/dist/development/BrandMarkScene-BDdC7K5M.js +140 -0
- package/dist/development/BrandMarkScene-BDdC7K5M.js.map +1 -0
- package/dist/development/astro-client.js +1 -1
- package/dist/development/astro-server.js +1 -1
- package/dist/development/brand-model.js +120 -0
- package/dist/development/brand-model.js.map +1 -0
- package/dist/development/brand.css +37 -0
- package/dist/development/brand.js +94 -0
- package/dist/development/brand.js.map +1 -0
- package/dist/development/{dom-BRFv7FP_.js → dom-CEVtlaav.js} +4 -3
- package/dist/development/dom-CEVtlaav.js.map +1 -0
- package/dist/development/floating.js.map +1 -1
- package/dist/development/hot.js +2 -2
- package/dist/development/hot.js.map +1 -1
- package/dist/development/{identity-DwB8MTM1.js → identity-B8wTFkyW.js} +2 -2
- package/dist/development/{identity-DwB8MTM1.js.map → identity-B8wTFkyW.js.map} +1 -1
- package/dist/development/index.js +1 -1
- package/dist/development/konva.js +1 -1
- package/dist/development/motion.js +38 -19
- package/dist/development/motion.js.map +1 -1
- package/dist/development/renderer.js +1 -1
- package/dist/development/{server-renderer-u1-c5PGd.js → server-renderer-zAqEL1g1.js} +2 -2
- package/dist/development/{server-renderer-u1-c5PGd.js.map → server-renderer-zAqEL1g1.js.map} +1 -1
- package/dist/development/server.js +1 -1
- package/dist/development/three-CsZ6Od1C.js +527 -0
- package/dist/development/three-CsZ6Od1C.js.map +1 -0
- package/dist/development/three.js +1 -509
- package/dist/{dom--HZvmgqd.js → dom-DUpa3Sj2.js} +4 -3
- package/dist/dom-DUpa3Sj2.js.map +1 -0
- package/dist/floating.js.map +1 -1
- package/dist/hot.d.ts.map +1 -1
- package/dist/hot.js.map +1 -1
- package/dist/{identity-oFU5p-Qj.js → identity-ByJswZtF.js} +2 -2
- package/dist/{identity-oFU5p-Qj.js.map → identity-ByJswZtF.js.map} +1 -1
- package/dist/index-DdA39aMv.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/konva.js +1 -1
- package/dist/motion.d.ts +2 -0
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +38 -19
- package/dist/motion.js.map +1 -1
- package/dist/renderer.js +1 -1
- package/dist/{server-renderer-BYFDmqnM.js → server-renderer-D7CdyOMo.js} +2 -2
- package/dist/{server-renderer-BYFDmqnM.js.map → server-renderer-D7CdyOMo.js.map} +1 -1
- package/dist/server.js +1 -1
- package/dist/size.json +12 -12
- package/dist/three-DcYxRXPW.js +527 -0
- package/dist/three-DcYxRXPW.js.map +1 -0
- package/dist/three.d.ts +21 -0
- package/dist/three.d.ts.map +1 -1
- package/dist/three.js +1 -509
- package/package.json +39 -19
- package/src/BrandMark.module.css +25 -0
- package/src/BrandMark.tsx +106 -0
- package/src/BrandMarkScene.module.css +10 -0
- package/src/BrandMarkScene.tsx +116 -0
- package/src/brand-css.d.ts +2 -0
- package/src/brand-model.ts +177 -0
- package/src/brand.ts +3 -0
- package/src/dom.ts +8 -1
- package/src/hot.ts +3 -2
- package/src/lasertag.d.ts +1 -0
- package/src/motion-layout.ts +55 -26
- package/src/motion.ts +3 -0
- package/src/three.ts +69 -22
- package/dist/development/dom-BRFv7FP_.js.map +0 -1
- package/dist/development/three.js.map +0 -1
- package/dist/dom--HZvmgqd.js.map +0 -1
- package/dist/three.js.map +0 -1
package/dist/hot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hot.js","names":[],"sources":["../src/hot.ts"],"sourcesContent":["import { IMPLICIT } from \"atom.io/internal\"\n\nimport type { Component, Root, RootOptions } from \"./core.ts\"\nimport { onCleanup, owner } from \"./core.ts\"\n\ninterface Handle {\n\tdispose(): void\n\tflush(): void\n}\ntype Factory = (options: RootOptions, before: Node | null) => Handle\ninterface View {\n\tmodules: Set<string>\n\toptions: RootOptions\n\trefreshing: boolean\n\trefresh(): void\n\treport(error: unknown): void\n}\n\nfunction createHotRuntime() {\n\tconst components = new Map<string, { current: Component; proxy: Component }>()\n\tconst roots = new WeakMap<Root, View>()\n\tconst views = new Set<View>()\n\tlet mounting: View | undefined\n\tfunction track(root: Root): void {\n\t\tif (mounting) {\n\t\t\troots.set(root, mounting)\n\t\t\tmounting.options.idPrefix ??= root._prefix\n\t\t}\n\t}\n\tfunction onDispose(cleanup: () => void): void {\n\t\tconst view = roots.get(owner!._root)\n\t\tonCleanup(() => {\n\t\t\tif (!view?.refreshing) cleanup()\n\t\t})\n\t}\n\tfunction register<T extends Component>(\n\t\tid: string,\n\t\tname: string,\n\t\timplementation: T,\n\t): T {\n\t\tconst key = JSON.stringify([id, name])\n\t\tlet record = components.get(key)\n\t\tif (record) record.current = implementation\n\t\telse {\n\t\t\tconst created = {\n\t\t\t\tcurrent: implementation as Component,\n\t\t\t\tproxy: null! as Component,\n\t\t\t}\n\t\t\tcreated.proxy = Object.assign(\n\t\t\t\t(
|
|
1
|
+
{"version":3,"file":"hot.js","names":[],"sources":["../src/hot.ts"],"sourcesContent":["import { IMPLICIT } from \"atom.io/internal\"\n\nimport type { Component, Root, RootOptions } from \"./core.ts\"\nimport { onCleanup, owner } from \"./core.ts\"\n\ninterface Handle {\n\tdispose(): void\n\tflush(): void\n}\ntype Factory = (options: RootOptions, before: Node | null) => Handle\ninterface View {\n\tmodules: Set<string>\n\toptions: RootOptions\n\trefreshing: boolean\n\trefresh(): void\n\treport(error: unknown): void\n}\n\nfunction createHotRuntime() {\n\tconst components = new Map<string, { current: Component; proxy: Component }>()\n\tconst roots = new WeakMap<Root, View>()\n\tconst views = new Set<View>()\n\tlet mounting: View | undefined\n\tfunction track(root: Root): void {\n\t\tif (mounting) {\n\t\t\troots.set(root, mounting)\n\t\t\tmounting.options.idPrefix ??= root._prefix\n\t\t}\n\t}\n\tfunction onDispose(cleanup: () => void): void {\n\t\tconst view = roots.get(owner!._root)\n\t\tonCleanup(() => {\n\t\t\tif (!view?.refreshing) cleanup()\n\t\t})\n\t}\n\tfunction register<T extends Component>(\n\t\tid: string,\n\t\tname: string,\n\t\timplementation: T,\n\t): T {\n\t\tconst key = JSON.stringify([id, name])\n\t\tlet record = components.get(key)\n\t\tif (record) record.current = implementation\n\t\telse {\n\t\t\tconst created = {\n\t\t\t\tcurrent: implementation as Component,\n\t\t\t\tproxy: null! as Component,\n\t\t\t}\n\t\t\tcreated.proxy = Object.assign(\n\t\t\t\t(...args: Parameters<Component>) => {\n\t\t\t\t\tif (owner) {\n\t\t\t\t\t\tconst root = owner._root\n\t\t\t\t\t\tconst view = roots.get(root) ?? mounting\n\t\t\t\t\t\tif (view) {\n\t\t\t\t\t\t\troots.set(root, view)\n\t\t\t\t\t\t\tview.options.idPrefix ??= root._prefix\n\t\t\t\t\t\t\tview.modules.add(id)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Compiled JSX mount helpers can take options after their first argument.\n\t\t\t\t\treturn created.current(...args)\n\t\t\t\t},\n\t\t\t\t{ spa: true },\n\t\t\t)\n\t\t\trecord = created\n\t\t\tcomponents.set(key, record)\n\t\t}\n\t\treturn record.proxy as T\n\t}\n\tfunction manage(\n\t\tfactory: Factory,\n\t\toptions: RootOptions,\n\t\thost?: Element,\n\t): Handle {\n\t\tconst settings = { ...options, store: options.store ?? IMPLICIT.STORE }\n\t\tconst anchor = host?.ownerDocument.createComment(`spa-hot`)\n\t\tlet current: Handle\n\t\tlet errorNode: HTMLElement | undefined\n\t\tlet disposed = false\n\t\tconst placeAnchor = () => {\n\t\t\tif (!anchor || anchor.parentNode) return\n\t\t\tlet inside = false\n\t\t\tfor (const node of [...host!.childNodes]) {\n\t\t\t\tif (node.nodeType === 8 && node.nodeValue === `w:${settings.idPrefix}`)\n\t\t\t\t\tinside = true\n\t\t\t\tif (inside && node.nodeType === 8 && node.nodeValue === `/w`) {\n\t\t\t\t\thost!.insertBefore(anchor, node.nextSibling)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\thost!.append(anchor)\n\t\t}\n\t\tconst boot = () => {\n\t\t\tconst previous = mounting\n\t\t\tmounting = view\n\t\t\ttry {\n\t\t\t\tcurrent = factory(settings, anchor?.parentNode ? anchor : null)\n\t\t\t} finally {\n\t\t\t\tmounting = previous\n\t\t\t}\n\t\t}\n\t\tconst view: View = {\n\t\t\tmodules: new Set(),\n\t\t\toptions: settings,\n\t\t\trefreshing: false,\n\t\t\trefresh() {\n\t\t\t\tview.refreshing = true\n\t\t\t\ttry {\n\t\t\t\t\tplaceAnchor()\n\t\t\t\t\tcurrent.dispose()\n\t\t\t\t\terrorNode?.remove()\n\t\t\t\t\tboot()\n\t\t\t\t} finally {\n\t\t\t\t\tview.refreshing = false\n\t\t\t\t}\n\t\t\t},\n\t\t\treport(error) {\n\t\t\t\tconst target =\n\t\t\t\t\thost ?? (typeof document === `undefined` ? undefined : document.body)\n\t\t\t\tif (target) {\n\t\t\t\t\terrorNode = target.ownerDocument.createElement(`pre`)\n\t\t\t\t\terrorNode.setAttribute(`data-spa-hot-error`, ``)\n\t\t\t\t\terrorNode.textContent = `SPA hot refresh failed: ${String(error)}`\n\t\t\t\t\ttarget.insertBefore(errorNode, anchor?.parentNode ? anchor : null)\n\t\t\t\t}\n\t\t\t\toptions.onError?.(error)\n\t\t\t},\n\t\t}\n\t\tviews.add(view)\n\t\ttry {\n\t\t\tboot()\n\t\t} catch (error) {\n\t\t\tviews.delete(view)\n\t\t\tthrow error\n\t\t}\n\t\tif (view.modules.size) placeAnchor()\n\t\treturn {\n\t\t\tflush() {\n\t\t\t\tcurrent.flush()\n\t\t\t},\n\t\t\tdispose() {\n\t\t\t\tif (disposed) return\n\t\t\t\tdisposed = true\n\t\t\t\tviews.delete(view)\n\t\t\t\terrorNode?.remove()\n\t\t\t\tanchor?.remove()\n\t\t\t\tcurrent.dispose()\n\t\t\t},\n\t\t}\n\t}\n\tfunction refreshViews(id: string): void {\n\t\tfor (const view of [...views]) {\n\t\t\tif (!views.has(view) || !view.modules.has(id)) continue\n\t\t\ttry {\n\t\t\t\tview.refresh()\n\t\t\t} catch (error) {\n\t\t\t\tview.report(error)\n\t\t\t}\n\t\t}\n\t}\n\treturn { register, root: manage, refresh: refreshViews, track, onDispose }\n}\n\nconst runtime = import.meta.env.DEV ? createHotRuntime() : undefined\n\n/** Development protocol used by the Vite transform. */\nexport function registerComponent<T extends Component>(\n\tid: string,\n\tname: string,\n\timplementation: T,\n): T {\n\treturn runtime ? runtime.register(id, name, implementation) : implementation\n}\nexport function refresh(id: string): void {\n\truntime?.refresh(id)\n}\nexport function trackRoot(root: Root): void {\n\truntime?.track(root)\n}\n/** Release root lifetime resources, retaining them through development remounts. */\nexport function onRootDispose(cleanup: () => void): void {\n\tif (runtime) runtime.onDispose(cleanup)\n\telse onCleanup(cleanup)\n}\nexport function hotRoot(\n\tfactory: Factory,\n\toptions: RootOptions,\n\thost?: Element,\n): Handle {\n\treturn runtime ? runtime.root(factory, options, host) : factory(options, null)\n}\n"],"mappings":";;;;AAsKA,SAAgB,kBACf,IACA,MACA,gBACI;CACJ,OAA8D;AAC/D;AACA,SAAgB,QAAQ,IAAkB,CAE1C;AACA,SAAgB,UAAU,MAAkB,CAE5C;;AAEA,SAAgB,cAAc,SAA2B;CAEnD,UAAU,OAAO;AACvB;AACA,SAAgB,QACf,SACA,SACA,MACS;CACT,OAAwD,QAAQ,SAAS,IAAI;AAC9E"}
|
|
@@ -97,7 +97,7 @@ function trackKeys(value) {
|
|
|
97
97
|
return hasKey(value) ? () => value : value;
|
|
98
98
|
}
|
|
99
99
|
function identifyChildren(output, duplicate = `spa: duplicate key`) {
|
|
100
|
-
const values = [output].flat(
|
|
100
|
+
const values = [output].flat(1e400);
|
|
101
101
|
const seen = /* @__PURE__ */ new Set();
|
|
102
102
|
return values.map((value, index) => {
|
|
103
103
|
const key = childProps(value)?.[`key`];
|
|
@@ -118,4 +118,4 @@ function identifyChildren(output, duplicate = `spa: duplicate key`) {
|
|
|
118
118
|
}
|
|
119
119
|
export { validateCapabilities as a, capabilityProps as i, trackKeys as n, capabilityNamespace as r, identifyChildren as t };
|
|
120
120
|
|
|
121
|
-
//# sourceMappingURL=identity-
|
|
121
|
+
//# sourceMappingURL=identity-ByJswZtF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-
|
|
1
|
+
{"version":3,"file":"identity-ByJswZtF.js","names":[],"sources":["../src/capabilities.ts","../src/identity.ts"],"sourcesContent":["import type { Cleanup, Root, Scope } from \"./core.ts\"\nimport { isPresent, scopeCapabilities } from \"./core.ts\"\nimport type { ExitHandle, PresenceCoordinator } from \"./presence.ts\"\n\n/** Native renderers expose property access without importing capability engines. */\nexport interface CapabilityTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n\tread?(key: string): unknown\n\twrite?(key: string, value: unknown): void\n\tlisten?(event: string, listener: () => void): Cleanup\n}\nexport interface CapabilityBinding {\n\texit?(props: Record<string, unknown>): ExitHandle | undefined\n\tresume?(): void\n\t/** Inline CSS before native style replacement, for restoring capability-owned values. */\n\tupdate(props: Record<string, unknown>, previousStyle?: string): void\n\tdispose(): void\n}\nexport interface Capability {\n\tnamespace: string\n\t/** Prepare a synchronous update batch and return its commit callback. */\n\tbeforeUpdate?(root: Root): Cleanup\n\tpresence?(root: Root): PresenceCoordinator\n\tscheduleFrame?(callback: (time: number) => void): Cleanup\n\t/** SPA supplies ownership for integrations that measure after mount or report async errors. */\n\tattach(target: CapabilityTarget, scope?: Scope): CapabilityBinding\n}\ntype EventHandler = (this: unknown, ...args: unknown[]) => unknown\n\nexport function capabilityNamespace(key: string): string | undefined {\n\tconst colon = key.indexOf(`:`)\n\tif (colon < 0) return undefined\n\tconst namespace = key.slice(0, colon)\n\treturn /^(xml|xmlns|xlink)$/.test(namespace) ? undefined : namespace\n}\nfunction requireCapability(\n\tcapabilities: Map<string, Capability>,\n\tnamespace: string,\n) {\n\tconst capability = capabilities.get(namespace)\n\tif (!capability)\n\t\tthrow new Error(\n\t\t\t`spa: capability \"${namespace}\" is not registered for this root`,\n\t\t)\n\treturn capability\n}\nexport function validateCapabilities(\n\tscope: Scope,\n\tprops: Record<string, unknown>,\n): void {\n\tconst capabilities = scopeCapabilities(scope)\n\tfor (const key of Object.keys(props)) {\n\t\tconst namespace = capabilityNamespace(key)\n\t\tif (namespace) requireCapability(capabilities, namespace)\n\t}\n}\n\n/** Separate framework properties from native attributes and own their bindings. */\nexport function capabilityProps(\n\tscope: Scope,\n\ttarget: CapabilityTarget,\n\tread?: () => Record<string, any>,\n\tapplyNative?: (props: Record<string, any>) => string | undefined,\n): (props: Record<string, any>) => Record<string, any> {\n\tconst root = scope._root\n\tconst bindings = new Map<Capability, CapabilityBinding>()\n\tlet handlers: WeakMap<EventHandler, EventHandler> | undefined\n\tconst event = (handler: EventHandler) => {\n\t\tconst cache = (handlers ??= new WeakMap())\n\t\tlet wrapped = cache.get(handler)\n\t\tif (!wrapped) {\n\t\t\twrapped = function (this: unknown, ...args: unknown[]) {\n\t\t\t\t// Presence may activate after this listener mounts.\n\t\t\t\tif (!root._presence || isPresent(scope)) return handler.apply(this, args)\n\t\t\t}\n\t\t\tcache.set(handler, wrapped)\n\t\t}\n\t\treturn wrapped\n\t}\n\n\tif (root._presence) root._presence.target(scope, target)\n\telse (scope._targets ??= new Set()).add(target)\n\tconst cleanup: Cleanup = () => {\n\t\tconst errors: unknown[] = []\n\t\tfor (const binding of [...bindings.values()].reverse()) {\n\t\t\ttry {\n\t\t\t\tbinding.dispose()\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\t\tbindings.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t}\n\tscope._cleanups.add(cleanup)\n\treturn (props) => {\n\t\tconst capabilities = scopeCapabilities(scope)\n\t\tconst native: Record<string, any> = {}\n\t\tconst groups = new Map<Capability, Record<string, unknown>>()\n\t\tfor (const key of Object.keys(props)) {\n\t\t\tconst namespace = capabilityNamespace(key)\n\t\t\tif (!namespace) {\n\t\t\t\tconst value = props[key]\n\t\t\t\tnative[key] =\n\t\t\t\t\tkey.startsWith(`on`) && typeof value === `function`\n\t\t\t\t\t\t? event(value)\n\t\t\t\t\t\t: value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst capability = requireCapability(capabilities, namespace)\n\t\t\tconst group = groups.get(capability) ?? {}\n\t\t\tgroup[key.slice(namespace.length + 1)] = props[key]\n\t\t\tgroups.set(capability, group)\n\t\t}\n\t\tconst previousStyle = applyNative?.(native)\n\t\tfor (const [capability, values] of groups) {\n\t\t\tlet binding = bindings.get(capability)\n\t\t\tif (!binding) {\n\t\t\t\tbinding = capability.attach(target, scope)\n\t\t\t\tbindings.set(capability, binding)\n\t\t\t\troot._presence?.bind(\n\t\t\t\t\tscope,\n\t\t\t\t\tbinding,\n\t\t\t\t\tread ?? (() => props),\n\t\t\t\t\tcapability.namespace,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (previousStyle !== undefined) binding.update(values, previousStyle)\n\t\t\telse binding.update(values)\n\t\t}\n\t\tfor (const [capability, binding] of bindings)\n\t\t\tif (!groups.has(capability)) {\n\t\t\t\tbindings.delete(capability)\n\t\t\t\troot._presence?.unbind(binding)\n\t\t\t\tbinding.dispose()\n\t\t\t}\n\t\treturn native\n\t}\n}\n","import type { Canonical } from \"atom.io/foundations/canonical\"\nimport { packCanonical } from \"atom.io/foundations/canonical\"\n\nimport type { Children, SpaElement } from \"./core.ts\"\n\ntype Props = SpaElement[`props`]\ntype Key = Canonical | undefined\ntype Identity = string | number\n\nfunction childProps(value: Children): Props | undefined {\n\treturn (value as SpaElement | null)?.props\n}\n\nfunction hasKey(value: Children): boolean {\n\tif (Array.isArray(value)) return value.some(hasKey)\n\tconst props = childProps(value)\n\treturn props !== undefined && Object.hasOwn(props, `key`)\n}\n\n/** Direct output opts into key tracking when it first mounts. */\nexport function trackKeys(value: Children): Children {\n\treturn hasKey(value) ? () => value : value\n}\n\nexport function identifyChildren(\n\toutput: Children,\n\tduplicate = `spa: duplicate key`,\n): { value: Children; key: Key; id: Identity }[] {\n\tconst values = ([output] as unknown[]).flat(Infinity) as Children[]\n\tconst seen = new Set<string>()\n\treturn values.map((value, index) => {\n\t\tconst key: Key = childProps(value)?.[`key`]\n\t\tif (key === undefined) return { value, key, id: index }\n\t\tconst id = packCanonical(key)\n\t\tif (seen.has(id)) throw new Error(duplicate)\n\t\tseen.add(id)\n\t\treturn { value, key, id }\n\t})\n}\n"],"mappings":";;;AA+BA,SAAgB,oBAAoB,KAAiC;CACpE,MAAM,QAAQ,IAAI,QAAQ,GAAG;CAC7B,IAAI,QAAQ,GAAG,OAAO,KAAA;CACtB,MAAM,YAAY,IAAI,MAAM,GAAG,KAAK;CACpC,OAAO,sBAAsB,KAAK,SAAS,IAAI,KAAA,IAAY;AAC5D;AACA,SAAS,kBACR,cACA,WACC;CACD,MAAM,aAAa,aAAa,IAAI,SAAS;CAC7C,IAAI,CAAC,YACJ,MAAM,IAAI,MACT,oBAAoB,UAAU,kCAC/B;CACD,OAAO;AACR;AACA,SAAgB,qBACf,OACA,OACO;CACP,MAAM,eAAe,kBAAkB,KAAK;CAC5C,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACrC,MAAM,YAAY,oBAAoB,GAAG;EACzC,IAAI,WAAW,kBAAkB,cAAc,SAAS;CACzD;AACD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,GAAG;EAC5B,IAAI,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,MAAM,SAAS;EAC3C,KAAK,IAAI,EAAE;EACX,OAAO;GAAE;GAAO;GAAK;EAAG;CACzB,CAAC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-DdA39aMv.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index-DdA39aMv.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;UA+aiB;EAChB;EACA;;iBA4De,OACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;iBASa,QACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;KCnfS,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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as useSetter, E as useTransaction, S as useRef, T as useTimeline, b as useGetter, d as onCommit, f as onMount, t as RootBoundary, u as onCleanup, w as useStore, x as useId, y as useDisposal } from "./core-DD2giR6E.js";
|
|
2
|
-
import { n as render, t as hydrate } from "./dom
|
|
2
|
+
import { n as render, t as hydrate } from "./dom-DUpa3Sj2.js";
|
|
3
3
|
import { t as Fragment } from "./jsx-runtime-BGDPK50B.js";
|
|
4
4
|
import { t as useLoadable } from "./src-B2W_TA_X.js";
|
|
5
5
|
export { Fragment, RootBoundary as Root, hydrate, onCleanup, onCommit, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
|
package/dist/konva.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as capabilityProps } from "./identity-
|
|
1
|
+
import { i as capabilityProps } from "./identity-ByJswZtF.js";
|
|
2
2
|
import { f as onMount, p as owner, u as onCleanup } from "./core-DD2giR6E.js";
|
|
3
3
|
import { n as jsx } from "./jsx-runtime-BGDPK50B.js";
|
|
4
4
|
import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
|
package/dist/motion.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface MotionAttributes<Kind extends string = `dom`> {
|
|
|
46
46
|
[`motion:layoutId`]?: Kind extends `dom` ? string | number : never;
|
|
47
47
|
[`motion:layoutGroup`]?: Kind extends `dom` ? string | number : never;
|
|
48
48
|
[`motion:layoutScroll`]?: Kind extends `dom` ? boolean : never;
|
|
49
|
+
/** Measure descendants relative to this instantly positioned layout ancestor. */
|
|
50
|
+
[`motion:layoutRoot`]?: Kind extends `dom` ? boolean : never;
|
|
49
51
|
[`motion:layoutTransition`]?: Kind extends `dom` ? MotionLayoutTransition : never;
|
|
50
52
|
[`motion:initial`]?: (Kind extends `dom` ? Partial<Record<keyof MotionDOMTarget, MotionScalar>> : MotionTarget<Kind>) | false;
|
|
51
53
|
[`motion:animate`]?: MotionTarget<Kind>;
|
package/dist/motion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;;GAEzB,uBAAuB;GACvB,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;;;wBAmaJ,iBACf,UAAS,0BACP"}
|
package/dist/motion.js
CHANGED
|
@@ -21,7 +21,7 @@ function createLayoutController(root, options) {
|
|
|
21
21
|
const detach = entry.release;
|
|
22
22
|
entry.release = void 0;
|
|
23
23
|
entry.node = void 0;
|
|
24
|
-
entry.
|
|
24
|
+
entry.beginStyles = entry.measureStyles = entry.endStyles = entry.captureStyles = void 0;
|
|
25
25
|
detach?.();
|
|
26
26
|
};
|
|
27
27
|
const configure = (entry) => {
|
|
@@ -42,6 +42,7 @@ function createLayoutController(root, options) {
|
|
|
42
42
|
}
|
|
43
43
|
entry.node.setOptions({
|
|
44
44
|
layoutScroll: entry.props.scroll ?? false,
|
|
45
|
+
layoutRoot: entry.props.root ?? false,
|
|
45
46
|
animationType: typeof entry.props.animate === `string` ? entry.props.animate : `both`,
|
|
46
47
|
animate: entry.props.animate !== false && !reduced(),
|
|
47
48
|
transition: reduced() ? { duration: 0 } : transition
|
|
@@ -91,25 +92,26 @@ function createLayoutController(root, options) {
|
|
|
91
92
|
let visibility = ``;
|
|
92
93
|
let pointerEvents = ``;
|
|
93
94
|
let transform = ``;
|
|
95
|
+
let rendered = ``;
|
|
94
96
|
const transformTemplate = (_, projected) => `${projected === `none` ? `` : projected} ${transform}`.trim();
|
|
95
97
|
entry.captureStyles = () => {
|
|
96
98
|
style.cssText = element.style.cssText;
|
|
97
99
|
};
|
|
98
|
-
entry.
|
|
99
|
-
|
|
100
|
+
entry.beginStyles = () => {
|
|
101
|
+
rendered = element.style.cssText;
|
|
100
102
|
for (const name of styleNames) restore(name);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
};
|
|
104
|
+
entry.measureStyles = () => {
|
|
105
|
+
const authored = getComputedStyle(element);
|
|
106
|
+
opacity = authored.opacity || `1`;
|
|
107
|
+
visibility = authored.visibility;
|
|
108
|
+
pointerEvents = authored.pointerEvents;
|
|
109
|
+
transform = authored.transform;
|
|
110
|
+
if (!visual.values.has(`opacity`)) node.latestValues[`opacity`] = Number(opacity);
|
|
111
|
+
const origin = authored.transformOrigin.split(` `);
|
|
112
|
+
const width = element.offsetWidth, height = element.offsetHeight;
|
|
113
|
+
entry.size = `${width}:${height}`;
|
|
114
|
+
for (const [key, value] of [[`originX`, parseFloat(origin[0]) / (width || 1)], [`originY`, parseFloat(origin[1]) / (height || 1)]]) if (!visual.values.has(key) && Number.isFinite(value)) node.latestValues[key] = value;
|
|
113
115
|
const template = transform && transform !== `none` && !Object.keys(visual.latestValues).some((key) => /^(x|y|scale|rotate|skew)/.test(key)) ? transformTemplate : originalProps.transformTemplate;
|
|
114
116
|
if (visual.getProps().transformTemplate !== template) {
|
|
115
117
|
const next = { ...visual.getProps() };
|
|
@@ -118,6 +120,9 @@ function createLayoutController(root, options) {
|
|
|
118
120
|
visual.update(next, null);
|
|
119
121
|
}
|
|
120
122
|
};
|
|
123
|
+
entry.endStyles = () => {
|
|
124
|
+
element.style.cssText = rendered;
|
|
125
|
+
};
|
|
121
126
|
const applyProjectionStyles = node.applyProjectionStyles;
|
|
122
127
|
node.applyProjectionStyles = (targetStyle, styleProp) => {
|
|
123
128
|
applyProjectionStyles.call(node, targetStyle, {
|
|
@@ -155,14 +160,27 @@ function createLayoutController(root, options) {
|
|
|
155
160
|
};
|
|
156
161
|
observer?.observe(element);
|
|
157
162
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
};
|
|
164
|
+
const prepareAll = () => {
|
|
165
|
+
const active = ordered();
|
|
166
|
+
for (const entry of active) prepare(entry);
|
|
167
|
+
const begun = [];
|
|
168
|
+
try {
|
|
169
|
+
for (const entry of active) {
|
|
170
|
+
begun.push(entry);
|
|
171
|
+
entry.beginStyles();
|
|
172
|
+
}
|
|
173
|
+
for (const entry of active) entry.measureStyles();
|
|
174
|
+
} finally {
|
|
175
|
+
for (const entry of begun) entry.endStyles();
|
|
176
|
+
}
|
|
177
|
+
for (const entry of active) configure(entry);
|
|
178
|
+
return active;
|
|
161
179
|
};
|
|
162
180
|
const commit = () => {
|
|
163
181
|
try {
|
|
164
182
|
if (dead) return;
|
|
165
|
-
|
|
183
|
+
prepareAll();
|
|
166
184
|
const roots = new Set([...entries].flatMap((entry) => entry.node ? [entry.node.root ?? entry.node] : []));
|
|
167
185
|
for (const projection of roots) projection.didUpdate();
|
|
168
186
|
for (const entry of entries) if (entry.dead) {
|
|
@@ -615,6 +633,7 @@ const layoutKeys = {
|
|
|
615
633
|
layoutId: `id`,
|
|
616
634
|
layoutGroup: `group`,
|
|
617
635
|
layoutScroll: `scroll`,
|
|
636
|
+
layoutRoot: `root`,
|
|
618
637
|
layoutTransition: `transition`
|
|
619
638
|
};
|
|
620
639
|
function equal(a, b) {
|
package/dist/motion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motion.js","names":[],"sources":["../src/motion-layout.ts","../src/motion-transition.ts","../src/motion-tween.ts","../src/presence.ts","../src/motion.ts"],"sourcesContent":["import type { IProjectionNode, ValueTransition } from \"motion\"\nimport { acquireProjectionNode, visualElementStore } from \"motion\"\n\nimport type { CapabilityBinding } from \"./capabilities.ts\"\nimport type { Cleanup, Root, Scope } from \"./core.ts\"\nimport { fail, onMount, within } from \"./core.ts\"\nimport type {\n\tMotionCapabilityOptions,\n\tMotionLayoutTransition,\n} from \"./motion.ts\"\n\ninterface Props {\n\tanimate?: boolean | `position` | `size`\n\tid?: string | number\n\tgroup?: string | number\n\tscroll?: boolean\n\ttransition?: MotionLayoutTransition\n}\ninterface LayoutController {\n\tcommit(): void\n\tbeforeUpdate(): Cleanup\n\tattach(element: HTMLElement, scope: Scope): CapabilityBinding\n}\ninterface Entry {\n\telement: HTMLElement\n\tscope: Scope\n\tprops: Props\n\tmounted: boolean\n\tdead: boolean\n\tnode?: IProjectionNode | undefined\n\trelease?: Cleanup | undefined\n\trefreshStyles?: Cleanup | undefined\n\tcaptureStyles?: Cleanup | undefined\n\tidentity?: string\n\tsize?: string\n}\nlet serial = 0\n\nexport function createLayoutController(\n\troot: Root,\n\toptions: MotionCapabilityOptions,\n): LayoutController {\n\tconst prefix = serial++\n\tconst entries = new Set<Entry>()\n\tlet dead = false\n\tlet updating = false\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && Boolean(preference?.matches))\n\tconst report = (error: unknown) => {\n\t\ttry {\n\t\t\tfail(root, error)\n\t\t} catch (failure) {\n\t\t\troot.error(failure)\n\t\t}\n\t}\n\tconst ordered = () =>\n\t\t[...entries]\n\t\t\t.filter(\n\t\t\t\t(entry) => entry.mounted && !entry.dead && entry.element.isConnected,\n\t\t\t)\n\t\t\t.sort((a, b) =>\n\t\t\t\ta.element.compareDocumentPosition(b.element) &\n\t\t\t\tNode.DOCUMENT_POSITION_FOLLOWING\n\t\t\t\t\t? -1\n\t\t\t\t\t: 1,\n\t\t\t)\n\tconst release = (entry: Entry) => {\n\t\tconst detach = entry.release\n\t\tentry.release = undefined\n\t\tentry.node = undefined\n\t\tentry.refreshStyles = entry.captureStyles = undefined\n\t\tdetach?.()\n\t}\n\tconst configure = (entry: Entry) => {\n\t\tconst transition = entry.props.transition ??\n\t\t\toptions.layoutTransition ?? { duration: 0.3 }\n\t\tfor (const name of [\n\t\t\t`duration`,\n\t\t\t`delay`,\n\t\t\t`stiffness`,\n\t\t\t`damping`,\n\t\t\t`mass`,\n\t\t] as const) {\n\t\t\tconst value = transition[name]\n\t\t\tif (\n\t\t\t\tvalue !== undefined &&\n\t\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t\tvalue < 0 ||\n\t\t\t\t\t([`stiffness`, `damping`, `mass`].includes(name) && value === 0))\n\t\t\t)\n\t\t\t\tthrow new Error(`spa/motion: transitions must settle in finite time`)\n\t\t}\n\t\tentry.node!.setOptions({\n\t\t\tlayoutScroll: entry.props.scroll ?? false,\n\t\t\tanimationType:\n\t\t\t\ttypeof entry.props.animate === `string` ? entry.props.animate : `both`,\n\t\t\tanimate: entry.props.animate !== false && !reduced(),\n\t\t\ttransition: (reduced() ? { duration: 0 } : transition) as ValueTransition,\n\t\t})\n\t\tif (reduced()) entry.node!.finishAnimation()\n\t}\n\tconst prepare = (entry: Entry) => {\n\t\tconst { element, props } = entry\n\t\tconst identity = JSON.stringify([\n\t\t\tprefix,\n\t\t\tprops.group ?? ``,\n\t\t\tprops.id ?? null,\n\t\t\tprops.animate ?? true,\n\t\t])\n\t\tif (entry.node && entry.identity !== identity) release(entry)\n\t\tif (!entry.node) {\n\t\t\tconst attrs = [`data-layout`, `data-layout-id`].map(\n\t\t\t\t(name) => [name, element.getAttribute(name)] as const,\n\t\t\t)\n\t\t\tconst styleNames = [\n\t\t\t\t`transform`,\n\t\t\t\t`transform-origin`,\n\t\t\t\t`opacity`,\n\t\t\t\t`visibility`,\n\t\t\t\t`pointer-events`,\n\t\t\t]\n\t\t\tconst style = element.ownerDocument.createElement(`div`).style\n\t\t\tstyle.cssText = element.style.cssText\n\t\t\tconst restore = (name: string) => {\n\t\t\t\tconst value = style.getPropertyValue(name)\n\t\t\t\tif (value)\n\t\t\t\t\telement.style.setProperty(name, value, style.getPropertyPriority(name))\n\t\t\t\telse element.style.removeProperty(name)\n\t\t\t}\n\t\t\telement.removeAttribute(`data-layout`)\n\t\t\telement.removeAttribute(`data-layout-id`)\n\t\t\tif (props.animate !== false)\n\t\t\t\telement.setAttribute(\n\t\t\t\t\t`data-layout`,\n\t\t\t\t\ttypeof props.animate === `string` ? props.animate : `true`,\n\t\t\t\t)\n\t\t\tif (props.id !== undefined && props.animate !== false)\n\t\t\t\telement.setAttribute(\n\t\t\t\t\t`data-layout-id`,\n\t\t\t\t\tJSON.stringify([prefix, props.group ?? ``, props.id]),\n\t\t\t\t)\n\t\t\tconst [node, detach] = acquireProjectionNode(element)\n\t\t\tentry.node = node\n\t\t\tentry.identity = identity\n\t\t\tconst visual = node.options.visualElement!\n\t\t\tconst originalProps = visual.getProps()\n\t\t\tconst originalValues = { ...node.latestValues }\n\t\t\tlet opacity = `1`\n\t\t\tlet visibility = ``\n\t\t\tlet pointerEvents = ``\n\t\t\tlet transform = ``\n\t\t\tconst transformTemplate = (_: unknown, projected: string) =>\n\t\t\t\t`${projected === `none` ? `` : projected} ${transform}`.trim()\n\t\t\tentry.captureStyles = () => {\n\t\t\t\tstyle.cssText = element.style.cssText\n\t\t\t}\n\t\t\tentry.refreshStyles = () => {\n\t\t\t\t// Resolve authored CSS against today's dimensions, without reading back\n\t\t\t\t// the opacity and percentage origins written by projection itself.\n\t\t\t\tconst rendered = element.style.cssText\n\t\t\t\tfor (const name of styleNames) restore(name)\n\t\t\t\ttry {\n\t\t\t\t\tconst authored = getComputedStyle(element)\n\t\t\t\t\topacity = authored.opacity || `1`\n\t\t\t\t\tvisibility = authored.visibility\n\t\t\t\t\tpointerEvents = authored.pointerEvents\n\t\t\t\t\ttransform = authored.transform\n\t\t\t\t\tif (!visual.values.has(`opacity`))\n\t\t\t\t\t\tnode.latestValues[`opacity`] = Number(opacity)\n\t\t\t\t\tconst origin = authored.transformOrigin.split(` `)\n\t\t\t\t\tfor (const [key, value] of [\n\t\t\t\t\t\t[`originX`, parseFloat(origin[0]) / (element.offsetWidth || 1)],\n\t\t\t\t\t\t[`originY`, parseFloat(origin[1]) / (element.offsetHeight || 1)],\n\t\t\t\t\t] as const)\n\t\t\t\t\t\tif (!visual.values.has(key) && Number.isFinite(value))\n\t\t\t\t\t\t\tnode.latestValues[key] = value\n\t\t\t\t} finally {\n\t\t\t\t\telement.style.cssText = rendered\n\t\t\t\t}\n\t\t\t\t// Motion-owned transforms compose in projection; return to authored\n\t\t\t\t// transforms if that Motion binding is subsequently removed.\n\t\t\t\tconst template =\n\t\t\t\t\ttransform &&\n\t\t\t\t\ttransform !== `none` &&\n\t\t\t\t\t!Object.keys(visual.latestValues).some((key) =>\n\t\t\t\t\t\t/^(x|y|scale|rotate|skew)/.test(key),\n\t\t\t\t\t)\n\t\t\t\t\t\t? transformTemplate\n\t\t\t\t\t\t: originalProps.transformTemplate\n\t\t\t\tif (visual.getProps().transformTemplate !== template) {\n\t\t\t\t\tconst next = { ...visual.getProps() }\n\t\t\t\t\tif (template) next.transformTemplate = template\n\t\t\t\t\telse delete next.transformTemplate\n\t\t\t\t\tvisual.update(next, null)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst applyProjectionStyles = node.applyProjectionStyles\n\t\t\tnode.applyProjectionStyles = (targetStyle, styleProp) => {\n\t\t\t\tapplyProjectionStyles.call(node, targetStyle, {\n\t\t\t\t\t...styleProp,\n\t\t\t\t\tpointerEvents: styleProp?.[`pointerEvents`] ?? pointerEvents,\n\t\t\t\t})\n\t\t\t\tif (!targetStyle.visibility) targetStyle.visibility = visibility\n\t\t\t\tif (!targetStyle.opacity)\n\t\t\t\t\ttargetStyle.opacity = String(node.latestValues[`opacity`] ?? opacity)\n\t\t\t}\n\t\t\tentry.release = () => {\n\t\t\t\ttry {\n\t\t\t\t\tif (node.isLead()) node.finishAnimation()\n\t\t\t\t\tdetach()\n\t\t\t\t} finally {\n\t\t\t\t\tnode.applyProjectionStyles = applyProjectionStyles\n\t\t\t\t\tvisual.projection = undefined\n\t\t\t\t\tfor (const key of [`opacity`, `originX`, `originY`])\n\t\t\t\t\t\tif (!visual.values.has(key)) {\n\t\t\t\t\t\t\tif (originalValues[key] === undefined)\n\t\t\t\t\t\t\t\tReflect.deleteProperty(node.latestValues, key)\n\t\t\t\t\t\t\telse node.latestValues[key] = originalValues[key]\n\t\t\t\t\t\t}\n\t\t\t\t\tconst retained =\n\t\t\t\t\t\t!root._dead && !entry.scope._dead && visual.values.size > 0\n\t\t\t\t\tif (!retained) {\n\t\t\t\t\t\tvisual.unmount()\n\t\t\t\t\t\tvisualElementStore.delete(element)\n\t\t\t\t\t} else visual.update(originalProps, null)\n\t\t\t\t\tfor (const [name, value] of attrs) {\n\t\t\t\t\t\tif (value === null) element.removeAttribute(name)\n\t\t\t\t\t\telse element.setAttribute(name, value)\n\t\t\t\t\t}\n\t\t\t\t\tfor (const name of styleNames) restore(name)\n\t\t\t\t\tif (retained) visual.scheduleRender()\n\t\t\t\t}\n\t\t\t}\n\t\t\tobserver?.observe(element)\n\t\t}\n\t\tentry.refreshStyles!()\n\t\tconfigure(entry)\n\t\tentry.size = `${element.offsetWidth}:${element.offsetHeight}`\n\t}\n\tconst commit = () => {\n\t\ttry {\n\t\t\tif (dead) return\n\t\t\tfor (const entry of ordered()) prepare(entry)\n\t\t\tconst roots = new Set(\n\t\t\t\t[...entries].flatMap((entry) =>\n\t\t\t\t\tentry.node ? [entry.node.root ?? entry.node] : [],\n\t\t\t\t),\n\t\t\t)\n\t\t\tfor (const projection of roots) projection.didUpdate()\n\t\t\t// Mount replacements before dropping outgoing nodes so shared snapshots can hand off.\n\t\t\tfor (const entry of entries)\n\t\t\t\tif (entry.dead) {\n\t\t\t\t\tobserver?.unobserve(entry.element)\n\t\t\t\t\trelease(entry)\n\t\t\t\t\tentries.delete(entry)\n\t\t\t\t}\n\t\t} finally {\n\t\t\tupdating = false\n\t\t}\n\t}\n\tconst observer =\n\t\ttypeof ResizeObserver === `function`\n\t\t\t? new ResizeObserver((changes) => {\n\t\t\t\t\tif (dead || updating) return\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const change of changes) {\n\t\t\t\t\t\t\tconst entry = [...entries].find(\n\t\t\t\t\t\t\t\t(candidate) => candidate.element === change.target,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!entry?.node ||\n\t\t\t\t\t\t\t\tentry.size ===\n\t\t\t\t\t\t\t\t\t`${entry.element.offsetWidth}:${entry.element.offsetHeight}`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\tconst previous = entry.node.layout\n\t\t\t\t\t\t\tentry.node.willUpdate()\n\t\t\t\t\t\t\tif (previous) entry.node.snapshot = previous\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcommit()\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treport(error)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t: undefined\n\tconst mediaChanged = () => {\n\t\ttry {\n\t\t\tfor (const entry of entries) if (entry.node) configure(entry)\n\t\t} catch (error) {\n\t\t\treport(error)\n\t\t}\n\t}\n\tpreference?.addEventListener(`change`, mediaChanged)\n\troot._cleanups.add(() => {\n\t\tdead = true\n\t\tobserver?.disconnect()\n\t\tpreference?.removeEventListener(`change`, mediaChanged)\n\t\tconst errors: unknown[] = []\n\t\tfor (const entry of entries)\n\t\t\ttry {\n\t\t\t\trelease(entry)\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\tentries.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t})\n\treturn {\n\t\tcommit,\n\t\tbeforeUpdate(): Cleanup {\n\t\t\tupdating = true\n\t\t\tfor (const entry of ordered()) {\n\t\t\t\tprepare(entry)\n\t\t\t\tentry.node!.willUpdate()\n\t\t\t}\n\t\t\treturn commit\n\t\t},\n\t\tattach(element: HTMLElement, scope: Scope): CapabilityBinding {\n\t\t\tconst entry: Entry = {\n\t\t\t\telement,\n\t\t\t\tscope,\n\t\t\t\tprops: {},\n\t\t\t\tmounted: false,\n\t\t\t\tdead: false,\n\t\t\t}\n\t\t\tentries.add(entry)\n\t\t\twithin(scope, () => {\n\t\t\t\tonMount(() => {\n\t\t\t\t\tentry.mounted = true\n\t\t\t\t})\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tupdate(props, previousStyle) {\n\t\t\t\t\tentry.props = props\n\t\t\t\t\tif (previousStyle !== undefined) entry.captureStyles?.()\n\t\t\t\t},\n\t\t\t\texit() {\n\t\t\t\t\tif (entry.node) entry.node.isPresent = false\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\t\t\t\tresume() {\n\t\t\t\t\tif (entry.node) {\n\t\t\t\t\t\tentry.node.isPresent = true\n\t\t\t\t\t\tentry.node.promote()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tentry.dead = true\n\t\t\t\t\tif (!updating) {\n\t\t\t\t\t\tobserver?.unobserve(element)\n\t\t\t\t\t\trelease(entry)\n\t\t\t\t\t\tentries.delete(entry)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t}\n}\n","import type { ValueAnimationTransition } from \"motion\"\n\nimport type { MotionScalar, MotionTransition } from \"./motion.ts\"\n\nexport function finalFrame(value: any): MotionScalar {\n\treturn Array.isArray(value) ? value.at(-1) : value\n}\n/** Property options override default options, which override top-level options. */\nexport function propertyTransition(\n\tconfig: MotionTransition | undefined,\n\tkey: string,\n\tgoal?: unknown,\n): ValueAnimationTransition {\n\tconst { default: fallback, properties, ...base } = config ?? {}\n\tconst transition = { ...base, ...fallback, ...properties?.[key] }\n\tconst sequence = Array.isArray(goal)\n\tif (sequence) {\n\t\tif (\n\t\t\tgoal.length < 2 ||\n\t\t\tgoal.some(\n\t\t\t\t(value, index) =>\n\t\t\t\t\t!(\n\t\t\t\t\t\ttypeof value === `string` ||\n\t\t\t\t\t\t(typeof value === `number` && Number.isFinite(value)) ||\n\t\t\t\t\t\t(index === 0 && value === null)\n\t\t\t\t\t),\n\t\t\t)\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: keyframes require at least two scalar values; only the first may be null`,\n\t\t\t)\n\t\tif (transition.type === `spring` && goal.length > 2)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: multi-keyframe sequences require a tween transition`,\n\t\t\t)\n\t\ttransition.type ??= `tween`\n\t}\n\tif (!sequence && !config) transition.type ??= `spring`\n\tconst count = sequence ? goal.length : 2\n\tif (\n\t\ttransition.times &&\n\t\t(transition.times.length !== count ||\n\t\t\ttransition.times[0] !== 0 ||\n\t\t\ttransition.times.at(-1) !== 1 ||\n\t\t\ttransition.times.some(\n\t\t\t\t(at, index, times) =>\n\t\t\t\t\t!Number.isFinite(at) ||\n\t\t\t\t\tat < 0 ||\n\t\t\t\t\tat > 1 ||\n\t\t\t\t\t(index > 0 && at < times[index - 1]),\n\t\t\t))\n\t)\n\t\tthrow new Error(\n\t\t\t`spa/motion: times must match the keyframes and increase from 0 to 1`,\n\t\t)\n\tif (\n\t\tArray.isArray(transition.ease) &&\n\t\ttypeof transition.ease[0] !== `number` &&\n\t\ttransition.ease.length !== count - 1\n\t)\n\t\tthrow new Error(\n\t\t\t`spa/motion: segment easing must match the keyframe intervals`,\n\t\t)\n\tfor (const option of [\n\t\t`duration`,\n\t\t`delay`,\n\t\t`visualDuration`,\n\t\t`velocity`,\n\t\t`bounce`,\n\t\t`stiffness`,\n\t\t`damping`,\n\t\t`mass`,\n\t\t`restDelta`,\n\t\t`restSpeed`,\n\t] as const) {\n\t\tconst value = transition[option]\n\t\tif (\n\t\t\tvalue !== undefined &&\n\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t(option !== `velocity` && option !== `delay` && value < 0) ||\n\t\t\t\t(option === `bounce` && value >= 1) ||\n\t\t\t\t([`stiffness`, `damping`, `mass`, `restDelta`, `restSpeed`].includes(\n\t\t\t\t\toption,\n\t\t\t\t) &&\n\t\t\t\t\tvalue === 0))\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: animation requires a finite settling transition`,\n\t\t\t)\n\t}\n\treturn transition as ValueAnimationTransition\n}\n","import type { MotionValue, ValueAnimationTransition } from \"motion\"\nimport { animate, keyframes } from \"motion\"\n\nimport type { MotionScalar } from \"./motion.ts\"\n\nconst trajectories = new WeakMap<\n\tMotionValue<MotionScalar>,\n\t() => { position: number; velocity: number }\n>()\nconst scalar = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)$/i\nconst brake = (progress: number) => progress * (2 - progress)\nconst returnToTarget = (progress: number) =>\n\tprogress * progress * (3 - 2 * progress)\n\n/** Retarget a moving tween without changing its position or velocity at the join. */\nexport function animateTween(\n\tvalue: MotionValue<MotionScalar>,\n\tgoal: MotionScalar | readonly (MotionScalar | null)[],\n\ttransition: ValueAnimationTransition,\n\tinterrupted: boolean,\n): ReturnType<typeof animate> {\n\tif (Array.isArray(goal)) {\n\t\tvalue.stop()\n\t\ttrajectories.delete(value)\n\t\tlet frames = goal.map((frame) => frame ?? value.get())\n\t\tconst units = frames.map((frame) =>\n\t\t\ttypeof frame === `number` ? `` : scalar.exec(frame)?.[2],\n\t\t)\n\t\tconst unit = units.find((suffix) => suffix)\n\t\t// Synchronous animation bypasses Motion's DOM unit resolver. Keep compatible\n\t\t// scalar frames in one unit so numeric mixers never receive CSS strings.\n\t\tif (unit && units.every((suffix) => suffix === `` || suffix === unit))\n\t\t\tframes = frames.map((frame, index) =>\n\t\t\t\tunits[index] === `` ? `${frame}${unit}` : frame,\n\t\t\t)\n\t\treturn animate(value, frames, { ...transition, isSync: true })\n\t}\n\tif (interrupted) value.stop()\n\tconst current = value.get()\n\tconst from =\n\t\ttypeof current === `number` ? [``, current, ``] : scalar.exec(current)\n\tconst to =\n\t\ttypeof goal === `number` ? [``, goal, ``] : scalar.exec(goal as string)\n\tconst previous = trajectories.get(value)?.()\n\tconst velocity =\n\t\tprevious && from && Math.abs(previous.position - Number(from[1])) < 0.001\n\t\t\t? previous.velocity\n\t\t\t: value.getVelocity()\n\ttrajectories.delete(value)\n\tconst duration = transition.duration ?? 0.3\n\t// A duration/ease without an explicit type is also a Motion tween. Springs keep\n\t// Motion's own velocity-aware integration; discrete values keep native mixing.\n\tconst tween =\n\t\ttransition.type === `tween` ||\n\t\t(transition.type === undefined &&\n\t\t\t(transition.duration !== undefined || transition.ease !== undefined))\n\tconst moving =\n\t\tinterrupted &&\n\t\ttween &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tNumber.isFinite(velocity) &&\n\t\tvelocity !== 0 &&\n\t\tduration > 0\n\tconst braking = 0.2\n\tconst turn = from ? Number(from[1]) + (velocity * duration * braking) / 2 : 0\n\tconst waypoint = typeof current === `number` ? turn : `${turn}${from?.[2]}`\n\tconst frames = moving ? [current, waypoint, goal] : [current, goal]\n\t// Constant deceleration: dx/dt at t=0 is v, and at the waypoint is zero.\n\t// The return starts and ends at rest. Keyframes also handle goal === current.\n\tconst next = moving\n\t\t? {\n\t\t\t\t...transition,\n\t\t\t\ttype: `tween` as const,\n\t\t\t\tduration,\n\t\t\t\tdelay: 0,\n\t\t\t\ttimes: [0, braking, 1],\n\t\t\t\tease: [brake, returnToTarget],\n\t\t\t}\n\t\t: transition\n\t// Values are already resolved. Synchronous numeric tweens also keep cancelled,\n\t// not-yet-started resolver work from being revived by a timeline read.\n\tconst controls = animate(\n\t\tvalue,\n\t\tframes,\n\t\ttween && (moving || current !== goal) ? { ...next, isSync: true } : next,\n\t)\n\tif (\n\t\ttween &&\n\t\t(moving || current !== goal) &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tduration > 0\n\t) {\n\t\tconst curve = keyframes({\n\t\t\tkeyframes: moving\n\t\t\t\t? [Number(from[1]), turn, Number(to[1])]\n\t\t\t\t: [Number(from[1]), Number(to[1])],\n\t\t\tduration: duration * 1000,\n\t\t\ttimes: moving ? [0, braking, 1] : [0, 1],\n\t\t\tease: next.ease ?? `easeOut`,\n\t\t})\n\t\tconst sample = (at: number) => curve.next(at * 1000).value\n\n\t\t// Use the tween's own timeline. Frame-estimated MotionValue velocity becomes\n\t\t// noisy when stop/resume happen several times within the same render frame.\n\t\ttrajectories.set(value, () => {\n\t\t\tconst at = Math.max(0, Math.min(duration, controls.time))\n\t\t\tconst before = Math.max(0, at - 0.0001),\n\t\t\t\tafter = Math.min(duration, at + 0.0001)\n\t\t\treturn {\n\t\t\t\tposition: sample(at),\n\t\t\t\tvelocity:\n\t\t\t\t\tat <= 0 || at >= duration\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: (sample(after) - sample(before)) / (after - before),\n\t\t\t}\n\t\t})\n\t}\n\treturn controls\n}\n","import type { CapabilityBinding } from \"./capabilities.ts\"\nimport type { Cleanup, Root, Scope } from \"./core.ts\"\nimport {\n\tdispose,\n\tinvalidate,\n\tisPresent,\n\treportScopeError,\n\tuntrack,\n} from \"./core.ts\"\n\nexport interface ExitHandle {\n\tfinished: Promise<void>\n\tcancel(): void\n}\nexport interface ExitParticipant {\n\texit(): ExitHandle | undefined\n\tresume(): void\n}\nexport interface PresenceTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n}\nexport interface PresenceCollection<T, V> {\n\ttake(key: unknown, value: V): T | undefined\n\tremove(\n\t\trecord: T,\n\t\tkey: unknown,\n\t\teligible: boolean,\n\t\tindex: number,\n\t\tdone: Cleanup,\n\t): void\n\tmerge(records: T[]): T[]\n}\nexport interface PresenceCoordinator {\n\tcollection<T, V>(\n\t\tscope: (record: T) => Scope,\n\t\tcompatible: (record: T, value: V) => boolean,\n\t): PresenceCollection<T, V>\n\ttarget(scope: Scope, target: PresenceTarget): void\n\tbind(\n\t\tscope: Scope,\n\t\tbinding: CapabilityBinding,\n\t\tread: () => Record<string, unknown>,\n\t\tnamespace: string,\n\t): void\n\tunbind(binding: CapabilityBinding): void\n\tremove(scope: Scope, done: Cleanup): boolean\n\tresume(scope: Scope): void\n\tforget(scope: Scope): void\n}\ninterface Session {\n\tscope: Scope\n\tparticipant: ExitParticipant\n\thandle: ExitHandle\n\tdone: boolean\n\tcancelled: boolean\n}\ninterface Group {\n\tscope: Scope\n\tsessions: Session[]\n\tdone: Cleanup\n}\n\n/** Optional coordinator: only imported by integrations that support retention. */\nexport function createPresence(root: Root): PresenceCoordinator {\n\tconst releases = new Map<CapabilityBinding, Cleanup>()\n\t// Groups own absent ranges; sessions can be shared when a parent adopts a child exit.\n\tconst groups = new Map<Scope, Group>()\n\tconst sessions = new Set<Session>()\n\tconst active = new Map<ExitParticipant, Session>()\n\tconst suspended = new Map<PresenceTarget, { scope: Scope; restore: Cleanup }>()\n\tconst suspend = (target: PresenceTarget): Cleanup => {\n\t\tif (target.kind !== `dom`) return target.suspend!()\n\t\tconst node = target.node as HTMLElement\n\t\tconst inert = node.getAttribute(`inert`),\n\t\t\thidden = node.getAttribute(`aria-hidden`)\n\t\tconst pointer = node.style.getPropertyValue(`pointer-events`),\n\t\t\tpriority = node.style.getPropertyPriority(`pointer-events`)\n\t\tconst focused = node.ownerDocument.activeElement as HTMLElement | null\n\t\tif (focused && node.contains(focused)) focused.blur()\n\t\tnode.setAttribute(`inert`, ``)\n\t\tnode.setAttribute(`aria-hidden`, `true`)\n\t\tnode.style.setProperty(`pointer-events`, `none`, `important`)\n\t\treturn () => {\n\t\t\tfor (const [key, value] of [\n\t\t\t\t[`inert`, inert],\n\t\t\t\t[`aria-hidden`, hidden],\n\t\t\t] as const) {\n\t\t\t\tif (value === null) node.removeAttribute(key)\n\t\t\t\telse node.setAttribute(key, value)\n\t\t\t}\n\t\t\tif (pointer) node.style.setProperty(`pointer-events`, pointer, priority)\n\t\t\telse node.style.removeProperty(`pointer-events`)\n\t\t}\n\t}\n\tconst walk = (scope: Scope, visit: (scope: Scope) => void) => {\n\t\tconst descend = (at: Scope) => {\n\t\t\tvisit(at)\n\t\t\tfor (const child of at._cleanups)\n\t\t\t\tif (typeof child !== `function`) descend(child)\n\t\t}\n\t\tdescend(scope)\n\t}\n\tconst ancestor = (scope: Scope, parent: Scope) => {\n\t\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\t\tif (at === parent) return true\n\t\treturn false\n\t}\n\tconst finish = () => {\n\t\tfor (const group of [...groups.values()]) {\n\t\t\tif (group.scope._dead || group.sessions.some((session) => !session.done))\n\t\t\t\tcontinue\n\t\t\tif (\n\t\t\t\t[...groups.keys()].some(\n\t\t\t\t\t(scope) => scope !== group.scope && ancestor(group.scope, scope),\n\t\t\t\t)\n\t\t\t)\n\t\t\t\tcontinue\n\t\t\tgroups.delete(group.scope)\n\t\t\ttry {\n\t\t\t\tgroup.done()\n\t\t\t} catch (error) {\n\t\t\t\tif (!root._dead) reportScopeError(group.scope, error)\n\t\t\t}\n\t\t}\n\t}\n\tconst cancel = (session: Session) => {\n\t\tsession.cancelled = true\n\t\tsessions.delete(session)\n\t\tactive.delete(session.participant)\n\t\tsession.handle.cancel()\n\t}\n\tconst coordinator: PresenceCoordinator = {\n\t\ttarget(scope, target) {\n\t\t\t;(scope._targets ??= new Set()).add(target)\n\t\t\tscope._cleanups.add(() => {\n\t\t\t\tscope._targets!.delete(target)\n\t\t\t})\n\t\t},\n\t\tbind(scope, binding, props, namespace) {\n\t\t\tconst read = () =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries(props())\n\t\t\t\t\t\t.filter(([key]) => key.startsWith(`${namespace}:`))\n\t\t\t\t\t\t.map(([key, value]) => [key.slice(namespace.length + 1), value]),\n\t\t\t\t)\n\t\t\tif (!binding.exit) return\n\t\t\tconst participant = {\n\t\t\t\texit: () => binding.exit!(untrack(read)),\n\t\t\t\tresume() {\n\t\t\t\t\tbinding.update(untrack(read))\n\t\t\t\t\tbinding.resume?.()\n\t\t\t\t},\n\t\t\t}\n\t\t\t;(scope._exits ??= new Set()).add(participant)\n\t\t\tconst release = () => {\n\t\t\t\tscope._exits!.delete(participant)\n\t\t\t\tscope._cleanups.delete(release)\n\t\t\t\treleases.delete(binding)\n\t\t\t}\n\t\t\treleases.set(binding, release)\n\t\t\tscope._cleanups.add(release)\n\t\t},\n\t\tunbind(binding) {\n\t\t\treleases.get(binding)?.()\n\t\t},\n\t\tcollection<T, V>(\n\t\t\tscopeOf: (record: T) => Scope,\n\t\t\tcompatible: (record: T, value: V) => boolean,\n\t\t): PresenceCollection<T, V> {\n\t\t\tlet order: T[] = []\n\t\t\tconst exiting = new Map<\n\t\t\t\tT,\n\t\t\t\t{ key: unknown; eligible: boolean; index: number }\n\t\t\t>()\n\t\t\treturn {\n\t\t\t\ttake(key, value) {\n\t\t\t\t\t// Empty conditional children do not replace an exiting generation.\n\t\t\t\t\tif (value == null || typeof value === `boolean`) return undefined\n\t\t\t\t\tfor (const [record, state] of exiting)\n\t\t\t\t\t\tif (state.eligible && state.key === key) {\n\t\t\t\t\t\t\tif (!compatible(record, value)) {\n\t\t\t\t\t\t\t\tstate.eligible = false\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\t\treturn record\n\t\t\t\t\t\t}\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\t\t\t\tremove(record, key, eligible, index, done) {\n\t\t\t\t\tconst position = order.indexOf(record)\n\t\t\t\t\tconst state = { key, eligible, index: position < 0 ? index : position }\n\t\t\t\t\texiting.set(record, state)\n\t\t\t\t\tlet pending = false\n\t\t\t\t\tconst release = () => {\n\t\t\t\t\t\tdispose(scopeOf(record))\n\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\torder = order.filter((item) => item !== record)\n\t\t\t\t\t\tfor (const other of exiting.values())\n\t\t\t\t\t\t\tif (other.index > state.index) other.index--\n\t\t\t\t\t\tif (pending) done()\n\t\t\t\t\t}\n\t\t\t\t\tpending = coordinator.remove(scopeOf(record), release)\n\t\t\t\t\tif (!pending) release()\n\t\t\t\t},\n\t\t\t\tmerge(records) {\n\t\t\t\t\tconst rendered = [...records]\n\t\t\t\t\tfor (const [record, state] of [...exiting].sort(\n\t\t\t\t\t\t(a, b) => a[1].index - b[1].index,\n\t\t\t\t\t)) {\n\t\t\t\t\t\trendered.splice(Math.min(state.index, rendered.length), 0, record)\n\t\t\t\t\t\tstate.index = rendered.indexOf(record)\n\t\t\t\t\t}\n\t\t\t\t\t// DOM reconciliation reverses its result while moving ranges. Keep a snapshot.\n\t\t\t\t\torder = [...rendered]\n\t\t\t\t\treturn rendered\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tremove(scope, done) {\n\t\t\tconst collected: Session[] = []\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const participant of at._exits ?? []) {\n\t\t\t\t\tlet session = active.get(participant)\n\t\t\t\t\tif (!session) {\n\t\t\t\t\t\tconst handle = untrack(() => participant.exit())\n\t\t\t\t\t\tif (!handle) continue\n\t\t\t\t\t\tsession = {\n\t\t\t\t\t\t\tscope: at,\n\t\t\t\t\t\t\tparticipant,\n\t\t\t\t\t\t\thandle,\n\t\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsessions.add(session)\n\t\t\t\t\t\tactive.set(participant, session)\n\t\t\t\t\t\tconst held = session\n\t\t\t\t\t\tvoid handle.finished.then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tif (held.cancelled || root._dead) return\n\t\t\t\t\t\t\t\theld.done = true\n\t\t\t\t\t\t\t\tfinish()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\tif (!held.cancelled && !root._dead)\n\t\t\t\t\t\t\t\t\treportScopeError(held.scope, error)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tcollected.push(session)\n\t\t\t\t}\n\t\t\t})\n\t\t\tif (!collected.some((session) => !session.done)) return false\n\t\t\tscope._exiting = true\n\t\t\tgroups.set(scope, { scope, sessions: collected, done })\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const target of at._targets ?? [])\n\t\t\t\t\tif (\n\t\t\t\t\t\t!suspended.has(target) &&\n\t\t\t\t\t\t(target.kind === `dom` || target.suspend)\n\t\t\t\t\t)\n\t\t\t\t\t\tsuspended.set(target, { scope: at, restore: suspend(target) })\n\t\t\t})\n\t\t\treturn true\n\t\t},\n\t\tresume(scope) {\n\t\t\tif (!groups.delete(scope)) return\n\t\t\tscope._exiting = false\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope) && isPresent(session.scope)) {\n\t\t\t\t\tcancel(session)\n\t\t\t\t}\n\t\t\twalk(scope, (at) => {\n\t\t\t\tif (isPresent(at))\n\t\t\t\t\tfor (const participant of at._exits ?? []) participant.resume()\n\t\t\t})\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (isPresent(state.scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\tstate.restore()\n\t\t\t\t}\n\t\t\tinvalidate(scope)\n\t\t\t// Reconcile returning descendants before releasing their adopted, completed exits.\n\t\t\tqueueMicrotask(finish)\n\t\t},\n\t\tforget(scope) {\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcancel(session)\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 at of groups.keys()) if (ancestor(at, scope)) groups.delete(at)\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (ancestor(state.scope, scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstate.restore()\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}\n\treturn coordinator\n}\n","import type { animate, MotionValue } from \"motion\"\nimport {\n\tcancelFrame,\n\tframe,\n\thandOffElementState,\n\thover,\n\tmotionValue,\n\tpress,\n\treadStyleValue,\n\tstyleEffect,\n\tvisualElementStore,\n} from \"motion\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Root } from \"./core.ts\"\nimport { createLayoutController } from \"./motion-layout.ts\"\nimport { finalFrame, propertyTransition } from \"./motion-transition.ts\"\nimport { animateTween } from \"./motion-tween.ts\"\nimport type { ExitHandle } from \"./presence.ts\"\nimport { createPresence } from \"./presence.ts\"\n\nexport type MotionKeyframes = readonly [\n\tMotionScalar | null,\n\tMotionScalar,\n\t...MotionScalar[],\n]\nexport type MotionEasing =\n\t| `linear`\n\t| `easeIn`\n\t| `easeOut`\n\t| `easeInOut`\n\t| `circIn`\n\t| `circOut`\n\t| `circInOut`\n\t| `backIn`\n\t| `backOut`\n\t| `backInOut`\n\t| readonly [number, number, number, number]\n/** Public options remain independent of optional Motion peer declarations. */\nexport interface MotionValueTransition {\n\ttype?: `spring` | `tween`\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n\tvelocity?: number\n\trestSpeed?: number\n\trestDelta?: number\n\tbounce?: number\n\tvisualDuration?: number\n\tduration?: number\n\tdelay?: number\n\ttimes?: readonly number[]\n\tease?: MotionEasing | readonly MotionEasing[]\n}\nexport interface MotionTransition extends MotionValueTransition {\n\tdefault?: MotionValueTransition\n\tproperties?: Readonly<Record<string, MotionValueTransition>>\n}\nexport interface MotionLayoutTransition {\n\ttype?: `spring` | `tween`\n\tduration?: number\n\tdelay?: number\n\tease?:\n\t\t| `linear`\n\t\t| `easeIn`\n\t\t| `easeOut`\n\t\t| `easeInOut`\n\t\t| readonly [number, number, number, number]\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n}\n\nexport type MotionScalar = number | string\nexport type MotionDOMTarget = Partial<\n\tRecord<\n\t\t| keyof CSSStyleDeclaration\n\t\t| `x`\n\t\t| `y`\n\t\t| `z`\n\t\t| `scale`\n\t\t| `scaleX`\n\t\t| `scaleY`\n\t\t| `rotate`\n\t\t| `rotateX`\n\t\t| `rotateY`\n\t\t| `rotateZ`\n\t\t| `skewX`\n\t\t| `skewY`\n\t\t| `--${string}`,\n\t\tMotionScalar | MotionKeyframes\n\t>\n>\nexport interface MotionThreeTarget {\n\tposition?: readonly [number, number, number]\n\trotation?: readonly [number, number, number]\n\tscale?: number | readonly [number, number, number]\n\topacity?: number\n\tintensity?: number\n\tcolor?: string\n}\nexport type MotionTarget<Kind extends string> = Kind extends `dom`\n\t? MotionDOMTarget\n\t: Kind extends `three`\n\t\t? MotionThreeTarget\n\t\t: Record<string, MotionScalar>\nexport interface MotionAttributes<Kind extends string = `dom`> {\n\t[`motion:layout`]?: Kind extends `dom` ? boolean | `position` | `size` : never\n\t[`motion:layoutId`]?: Kind extends `dom` ? string | number : never\n\t[`motion:layoutGroup`]?: Kind extends `dom` ? string | number : never\n\t[`motion:layoutScroll`]?: Kind extends `dom` ? boolean : never\n\t[`motion:layoutTransition`]?: Kind extends `dom`\n\t\t? MotionLayoutTransition\n\t\t: never\n\t[`motion:initial`]?:\n\t\t| (Kind extends `dom`\n\t\t\t\t? Partial<Record<keyof MotionDOMTarget, MotionScalar>>\n\t\t\t\t: MotionTarget<Kind>)\n\t\t| false\n\t[`motion:animate`]?: MotionTarget<Kind>\n\t[`motion:exit`]?: MotionTarget<Kind>\n\t[`motion:transition`]?: MotionTransition\n\t[`motion:whileHover`]?: MotionTarget<Kind>\n\t[`motion:whileTap`]?: MotionTarget<Kind>\n}\n\n// eslint-disable-next-line quotes -- TypeScript module augmentation requires a string literal.\ndeclare module \"@atom.io/spa/jsx-runtime\" {\n\t// oxlint-disable-next-line typescript/no-empty-interface -- Declaration merging adds optional motion attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends MotionAttributes<Kind> {}\n}\n\nexport interface MotionCapabilityOptions {\n\t/** Respect the user's reduced-motion preference by default. */\n\treducedMotion?: `user` | `always` | `never`\n\t/** Default transition for layout projection; animated properties use motion:transition. */\n\tlayoutTransition?: MotionLayoutTransition\n}\ntype TargetValue = MotionScalar | readonly (MotionScalar | null)[]\ntype TargetValues = Record<string, TargetValue>\ninterface AnimatedProperty {\n\tvalues: MotionValue<MotionScalar>[]\n\tbase: TargetValue\n\trest: TargetValue\n\ttarget: TargetValue\n\trelease(): void\n}\nconst transform =\n\t/^(x|y|z|translate.*|scale.*|rotate.*|skew.*|transformPerspective)$/\nconst allowed = new Set([\n\t`initial`,\n\t`animate`,\n\t`exit`,\n\t`transition`,\n\t`whileHover`,\n\t`whileTap`,\n])\nconst layoutKeys = {\n\tlayout: `animate`,\n\tlayoutId: `id`,\n\tlayoutGroup: `group`,\n\tlayoutScroll: `scroll`,\n\tlayoutTransition: `transition`,\n} as const\nfunction equal(a: unknown, b: unknown): boolean {\n\treturn (\n\t\tObject.is(a, b) ||\n\t\t(Array.isArray(a) &&\n\t\t\tArray.isArray(b) &&\n\t\t\ta.length === b.length &&\n\t\t\ta.every((value, index) => Object.is(value, b[index])))\n\t)\n}\n\nfunction attachValues(\n\ttarget: CapabilityTarget,\n\toptions: MotionCapabilityOptions,\n): CapabilityBinding {\n\tconst element =\n\t\ttarget.kind === `dom` ? (target.node as HTMLElement | SVGElement) : undefined\n\tconst properties = new Map<string, AnimatedProperty>()\n\tconst originalStyles = new Map<string, { value: string; priority: string }>()\n\tlet styles: (() => void) | undefined\n\tlet props: Record<string, unknown> = {}\n\tlet hovered = false\n\tlet tapped = false\n\tlet started = false\n\tlet dead = false\n\tlet exiting = false\n\tlet exitHandle: ExitHandle | undefined\n\tlet gestures: (() => void)[] = []\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && preference?.matches)\n\tconst read = (key: string, fallback: unknown): any => {\n\t\tconst value = element ? readStyleValue(element, key) : target.read!(key)\n\t\treturn value === undefined || value === ``\n\t\t\t? typeof fallback === `number`\n\t\t\t\t? key.startsWith(`scale`) || key === `opacity`\n\t\t\t\t\t? 1\n\t\t\t\t\t: 0\n\t\t\t\t: fallback\n\t\t\t: value\n\t}\n\tconst bindStyles = () => {\n\t\tstyles?.()\n\t\tif (element) {\n\t\t\tstyles = styleEffect(\n\t\t\t\t[element],\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\t[...properties].map(([key, property]) => [key, property.values[0]]),\n\t\t\t\t) as any,\n\t\t\t)\n\t\t\t// Layout projection and late-added/gesture values must render together.\n\t\t\tconst visual = visualElementStore.get(element)\n\t\t\tif (visual) handOffElementState(element, visual)\n\t\t}\n\t}\n\tconst ensure = (\n\t\tkey: string,\n\t\tgoal: TargetValue,\n\t\tinitial: TargetValues | false,\n\t): AnimatedProperty => {\n\t\tconst vector = !element && Array.isArray(goal)\n\t\tconst sample = element ? finalFrame(goal) : goal\n\t\tconst existing = properties.get(key)\n\t\tif (existing) {\n\t\t\tif (existing.values.length !== (vector ? goal.length : 1))\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\treturn existing\n\t\t}\n\t\tconst base = read(key, sample) as TargetValue\n\t\tconst rest = !vector && Array.isArray(base) ? base[0]! : base\n\t\tlet start = initial === false ? sample : (initial[key] ?? rest)\n\t\tif (!vector && Array.isArray(start)) start = start[0]!\n\t\tif (vector && (!Array.isArray(start) || start.length !== goal.length))\n\t\t\tthrow new Error(`spa/motion: ${key} requires matching numeric tuples`)\n\t\tconst values = (Array.isArray(start) ? start : [start]).map((value) =>\n\t\t\tmotionValue(value),\n\t\t) as MotionValue<MotionScalar>[]\n\t\tconst unsubscribers: (() => void)[] = []\n\t\tif (element) {\n\t\t\tconst cssKey = transform.test(key)\n\t\t\t\t? `transform`\n\t\t\t\t: key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n\t\t\tif (!originalStyles.has(cssKey))\n\t\t\t\toriginalStyles.set(cssKey, {\n\t\t\t\t\tvalue: element.style.getPropertyValue(cssKey),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(cssKey),\n\t\t\t\t})\n\t\t} else {\n\t\t\tconst write = () => {\n\t\t\t\ttarget.write!(\n\t\t\t\t\tkey,\n\t\t\t\t\tArray.isArray(goal)\n\t\t\t\t\t\t? values.map((value) => value.get())\n\t\t\t\t\t\t: values[0].get(),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const value of values) unsubscribers.push(value.on(`change`, write))\n\t\t\twrite()\n\t\t}\n\t\tconst property: AnimatedProperty = {\n\t\t\tvalues,\n\t\t\tbase,\n\t\t\trest,\n\t\t\ttarget: start,\n\t\t\trelease() {\n\t\t\t\tfor (const release of unsubscribers) release()\n\t\t\t\tfor (const value of values) value.destroy()\n\t\t\t},\n\t\t}\n\t\tproperties.set(key, property)\n\t\treturn property\n\t}\n\tconst refresh = (force = false) => {\n\t\tif (dead || exiting) return\n\t\tconst initial = (props[`initial`] ?? {}) as TargetValues | false\n\t\tconst animateTo = (props[`animate`] ?? {}) as TargetValues\n\t\tconst hoverTo = (props[`whileHover`] ?? {}) as TargetValues\n\t\tconst tapTo = (props[`whileTap`] ?? {}) as TargetValues\n\t\tconst goals = {\n\t\t\t...animateTo,\n\t\t\t...(hovered ? hoverTo : {}),\n\t\t\t...(tapped ? tapTo : {}),\n\t\t}\n\t\tconst keys = new Set([\n\t\t\t...Object.keys(initial || {}),\n\t\t\t...Object.keys(animateTo),\n\t\t\t...Object.keys(hoverTo),\n\t\t\t...Object.keys(tapTo),\n\t\t])\n\t\tlet added = false\n\t\tfor (const key of keys) {\n\t\t\tconst sample =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\thoverTo[key] ??\n\t\t\t\ttapTo[key]\n\t\t\tif (sample === undefined) continue\n\t\t\tconst had = properties.has(key)\n\t\t\tensure(key, sample, started ? {} : initial)\n\t\t\tif (!had) added = true\n\t\t}\n\t\tif (added) bindStyles()\n\t\tfor (const [key, property] of properties) {\n\t\t\tconst goal =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\tproperty.rest\n\t\t\tif (!force && equal(property.target, goal)) continue\n\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\tconst next = !element && Array.isArray(goal) ? goal : [goal]\n\t\t\tconst transition = propertyTransition(\n\t\t\t\tprops[`transition`] as MotionTransition | undefined,\n\t\t\t\tkey,\n\t\t\t\telement ? goal : undefined,\n\t\t\t)\n\t\t\tif (next.length !== property.values.length)\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\tproperty.values.forEach((value, index) => {\n\t\t\t\tif (reduced() || (!started && initial === false))\n\t\t\t\t\tvalue.jump(finalFrame(next[index]))\n\t\t\t\telse\n\t\t\t\t\tanimateTween(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tnext[index],\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\tforce || value.isAnimating(),\n\t\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\tstarted = true\n\t}\n\tconst clearGestures = () => {\n\t\tfor (const release of gestures) release()\n\t\tgestures = []\n\t}\n\tconst installGestures = () => {\n\t\tclearGestures()\n\t\tif (element) {\n\t\t\tif (props[`whileHover`])\n\t\t\t\tgestures.push(\n\t\t\t\t\thover([element], () => {\n\t\t\t\t\t\thovered = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\thovered = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\tif (props[`whileTap`])\n\t\t\t\tgestures.push(\n\t\t\t\t\tpress([element], () => {\n\t\t\t\t\t\ttapped = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttapped = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t} else if (props[`whileHover`] || props[`whileTap`]) {\n\t\t\tif (!target.listen)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: ${target.kind} gestures require a renderer event adapter`,\n\t\t\t\t)\n\t\t\tconst listen = (event: string, run: () => void) =>\n\t\t\t\tgestures.push(target.listen!(event, run))\n\t\t\tlisten(`pointerenter`, () => {\n\t\t\t\thovered = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerleave`, () => {\n\t\t\t\thovered = false\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerdown`, () => {\n\t\t\t\ttapped = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerup`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointercancel`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\tconst preferenceChanged = () => {\n\t\tif (reduced()) {\n\t\t\tfor (const property of properties.values()) {\n\t\t\t\tconst goal =\n\t\t\t\t\t!element && Array.isArray(property.target)\n\t\t\t\t\t\t? property.target\n\t\t\t\t\t\t: [property.target]\n\t\t\t\tproperty.values.forEach((value, i) => {\n\t\t\t\t\tvalue.jump(finalFrame(goal[i]))\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tconst finishExit = () => {\n\t\texitHandle?.cancel()\n\t}\n\tconst mediaChanged = () => {\n\t\tpreferenceChanged()\n\t\tif (reduced() && exiting) finishExit()\n\t}\n\tpreference?.addEventListener(`change`, mediaChanged)\n\treturn {\n\t\texit(next) {\n\t\t\tconst goals = next[`exit`] as TargetValues | undefined\n\t\t\texiting = true\n\t\t\thovered = tapped = false\n\t\t\tclearGestures()\n\t\t\tconst moving = new Set<MotionValue<MotionScalar>>()\n\t\t\tfor (const property of properties.values())\n\t\t\t\tfor (const value of property.values) {\n\t\t\t\t\tif (value.isAnimating()) moving.add(value)\n\t\t\t\t\tvalue.stop()\n\t\t\t\t}\n\t\t\tif (!goals || !Object.keys(goals).length || reduced()) return undefined\n\t\t\tconst transition = (next[`transition`] ?? {\n\t\t\t\ttype: `spring`,\n\t\t\t}) as MotionTransition\n\t\t\tfor (const key of [\n\t\t\t\t`duration`,\n\t\t\t\t`delay`,\n\t\t\t\t`visualDuration`,\n\t\t\t\t`velocity`,\n\t\t\t\t`bounce`,\n\t\t\t\t`stiffness`,\n\t\t\t\t`damping`,\n\t\t\t\t`mass`,\n\t\t\t\t`restDelta`,\n\t\t\t\t`restSpeed`,\n\t\t\t] as const) {\n\t\t\t\tconst value = transition[key]\n\t\t\t\tif (\n\t\t\t\t\tvalue !== undefined &&\n\t\t\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t\t\t(key !== `velocity` && value < 0) ||\n\t\t\t\t\t\t(key === `bounce` && value >= 1) ||\n\t\t\t\t\t\t([`stiffness`, `damping`, `mass`, `restDelta`, `restSpeed`].includes(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\tvalue === 0))\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`spa/motion: exit requires a finite settling transition`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t\tlet added = false\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst had = properties.has(key)\n\t\t\t\tensure(key, goal, {})\n\t\t\t\tif (!had) added = true\n\t\t\t}\n\t\t\tif (added) bindStyles()\n\t\t\tlet settle!: () => void\n\t\t\tlet reject!: (error: unknown) => void\n\t\t\tconst finished = new Promise<void>((resolve, fail) => {\n\t\t\t\tsettle = resolve\n\t\t\t\treject = fail\n\t\t\t})\n\t\t\tconst controls: ReturnType<typeof animate>[] = []\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst property = properties.get(key)!\n\t\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\t\tconst values = !element && Array.isArray(goal) ? goal : [goal]\n\t\t\t\tconst resolved = propertyTransition(\n\t\t\t\t\tnext[`transition`] as MotionTransition | undefined,\n\t\t\t\t\tkey,\n\t\t\t\t\telement ? goal : undefined,\n\t\t\t\t)\n\t\t\t\tproperty.values.forEach((value, index) =>\n\t\t\t\t\tcontrols.push(\n\t\t\t\t\t\tanimateTween(value, values[index], resolved, moving.has(value)),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tvoid Promise.all(controls.map((control) => Promise.resolve(control))).then(\n\t\t\t\tsettle,\n\t\t\t\treject,\n\t\t\t)\n\t\t\texitHandle = {\n\t\t\t\tfinished,\n\t\t\t\tcancel() {\n\t\t\t\t\tfor (const control of controls) control.stop()\n\t\t\t\t\tsettle()\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn exitHandle\n\t\t},\n\t\tresume() {\n\t\t\texitHandle?.cancel()\n\t\t\texitHandle = undefined\n\t\t\texiting = false\n\t\t\tinstallGestures()\n\t\t\trefresh(true)\n\t\t},\n\t\tupdate(next, previousStyle) {\n\t\t\tconst gestureChange =\n\t\t\t\t!started ||\n\t\t\t\tBoolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) ||\n\t\t\t\tBoolean(next[`whileTap`]) !== Boolean(props[`whileTap`])\n\t\t\tprops = next\n\t\t\tif (gestureChange && !exiting) installGestures()\n\t\t\tif (previousStyle !== undefined && started && element) {\n\t\t\t\tconst snapshot = element.ownerDocument.createElement(`div`).style\n\t\t\t\tsnapshot.cssText = previousStyle\n\t\t\t\tfor (const key of originalStyles.keys())\n\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tsnapshot.getPropertyValue(key),\n\t\t\t\t\t\tsnapshot.getPropertyPriority(key),\n\t\t\t\t\t)\n\t\t\t}\n\t\t\trefresh()\n\t\t},\n\t\tdispose() {\n\t\t\tdead = true\n\t\t\tclearGestures()\n\t\t\texitHandle?.cancel()\n\t\t\tpreference?.removeEventListener(`change`, mediaChanged)\n\t\t\tstyles?.()\n\t\t\tconst visual = element && visualElementStore.get(element)\n\t\t\tfor (const [key, property] of properties) {\n\t\t\t\t// Projection can retain this renderer after the binding is gone.\n\t\t\t\tif (visual?.values.get(key) === property.values[0])\n\t\t\t\t\tvisual.removeValue(key)\n\t\t\t\tproperty.release()\n\t\t\t\tif (!element) target.write!(key, property.base)\n\t\t\t}\n\t\t\tfor (const [key, value] of originalStyles) {\n\t\t\t\tif (value.value)\n\t\t\t\t\telement!.style.setProperty(key, value.value, value.priority)\n\t\t\t\telse element!.style.removeProperty(key)\n\t\t\t}\n\t\t\tproperties.clear()\n\t\t},\n\t}\n}\n\n/** Explicit, root-scoped motion:* integration. Importing it never registers globally. */\nexport function motionCapability(\n\toptions: MotionCapabilityOptions = {},\n): Capability {\n\tconst layouts = new WeakMap<Root, ReturnType<typeof createLayoutController>>()\n\treturn {\n\t\tnamespace: `motion`,\n\t\tpresence: createPresence,\n\t\tbeforeUpdate(root) {\n\t\t\tconst layout = layouts.get(root)\n\t\t\t// A layout binding can first appear during the upcoming DOM writes.\n\t\t\treturn layout ? layout.beforeUpdate() : () => layouts.get(root)?.commit()\n\t\t},\n\t\tattach(target, scope) {\n\t\t\tif (target.kind !== `dom` && (!target.read || !target.write))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: renderer ${target.kind} does not support motion`,\n\t\t\t\t)\n\t\t\tlet values: CapabilityBinding | undefined\n\t\t\tlet layout: CapabilityBinding | undefined\n\t\t\tlet dead = false\n\t\t\treturn {\n\t\t\t\tupdate(next, previousStyle) {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tconst animated: Record<string, unknown> = {}\n\t\t\t\t\tconst projected: Record<string, unknown> = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(next)) {\n\t\t\t\t\t\tif (Object.hasOwn(layoutKeys, key))\n\t\t\t\t\t\t\tprojected[layoutKeys[key as keyof typeof layoutKeys]] = value\n\t\t\t\t\t\telse if (allowed.has(key)) animated[key] = value\n\t\t\t\t\t\telse throw new Error(`spa/motion: unknown property motion:${key}`)\n\t\t\t\t\t}\n\t\t\t\t\tif (Object.keys(projected).length) {\n\t\t\t\t\t\tif (!layout) {\n\t\t\t\t\t\t\tconst element = target.node as HTMLElement\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttarget.kind !== `dom` ||\n\t\t\t\t\t\t\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml` ||\n\t\t\t\t\t\t\t\t!scope\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`spa/motion: layout requires an owned HTML element`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tlet controller = layouts.get(scope._root)\n\t\t\t\t\t\t\tif (!controller) {\n\t\t\t\t\t\t\t\tcontroller = createLayoutController(scope._root, options)\n\t\t\t\t\t\t\t\tlayouts.set(scope._root, controller)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlayout = controller.attach(element, scope)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlayout.update(projected, previousStyle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlayout?.dispose()\n\t\t\t\t\t\tlayout = undefined\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tObject.keys(animated).length ||\n\t\t\t\t\t\t(values && !Object.keys(projected).length)\n\t\t\t\t\t) {\n\t\t\t\t\t\tvalues ??= attachValues(target, options)\n\t\t\t\t\t\tvalues.update(animated, previousStyle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalues?.dispose()\n\t\t\t\t\t\tvalues = undefined\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\texit(next) {\n\t\t\t\t\tif (dead) return undefined\n\t\t\t\t\tlayout?.exit?.(next)\n\t\t\t\t\treturn values?.exit?.(next)\n\t\t\t\t},\n\t\t\t\tresume() {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tlayout?.resume?.()\n\t\t\t\t\tvalues?.resume?.()\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tdead = true\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalues?.dispose()\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tlayout?.dispose()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tscheduleFrame(callback) {\n\t\t\tconst run = ({ timestamp }: { timestamp: number }) => {\n\t\t\t\tcallback(timestamp)\n\t\t\t}\n\t\t\t// Layout measurement flushes update/preRender/render outside animation frames.\n\t\t\t// Run application scene work after rendering, only in the full frame batch.\n\t\t\tframe.postRender(run, true)\n\t\t\treturn () => {\n\t\t\t\tcancelFrame(run)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;AAoCA,IAAI,SAAS;AAEb,SAAgB,uBACf,MACA,SACmB;CACnB,MAAM,SAAS;CACf,MAAM,0BAAU,IAAI,IAAW;CAC/B,IAAI,OAAO;CACX,IAAI,WAAW;CACf,MAAM,aACL,QAAQ,kBAAkB,WAAW,OAAO,eAAe,aACxD,WAAW,kCAAkC,IAC7C,KAAA;CACJ,MAAM,gBACL,QAAQ,kBAAkB,YACzB,QAAQ,kBAAkB,WAAW,QAAQ,YAAY,OAAO;CAClE,MAAM,UAAU,UAAmB;EAClC,IAAI;GACH,KAAK,MAAM,KAAK;EACjB,SAAS,SAAS;GACjB,KAAK,MAAM,OAAO;EACnB;CACD;CACA,MAAM,gBACL,CAAC,GAAG,OAAO,CAAC,CACV,QACC,UAAU,MAAM,WAAW,CAAC,MAAM,QAAQ,MAAM,QAAQ,WAC1D,CAAC,CACA,MAAM,GAAG,MACT,EAAE,QAAQ,wBAAwB,EAAE,OAAO,IAC3C,KAAK,8BACF,KACA,CACJ;CACF,MAAM,WAAW,UAAiB;EACjC,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,KAAA;EAChB,MAAM,OAAO,KAAA;EACb,MAAM,gBAAgB,MAAM,gBAAgB,KAAA;EAC5C,SAAS;CACV;CACA,MAAM,aAAa,UAAiB;EACnC,MAAM,aAAa,MAAM,MAAM,cAC9B,QAAQ,oBAAoB,EAAE,UAAU,GAAI;EAC7C,KAAK,MAAM,QAAQ;GAClB;GACA;GACA;GACA;GACA;EACD,GAAY;GACX,MAAM,QAAQ,WAAW;GACzB,IACC,UAAU,KAAA,MACT,CAAC,OAAO,SAAS,KAAK,KACtB,QAAQ,KACP;IAAC;I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,cAAc,UAAU;GACvB,MAAM,OAAO,EAAE,gBAAuC;IACrD,SAAS,SAAS;GACnB;GAGA,MAAM,WAAW,KAAK,IAAI;GAC1B,aAAa;IACZ,YAAY,GAAG;GAChB;EACD;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"motion.js","names":[],"sources":["../src/motion-layout.ts","../src/motion-transition.ts","../src/motion-tween.ts","../src/presence.ts","../src/motion.ts"],"sourcesContent":["import type { IProjectionNode, ValueTransition } from \"motion\"\nimport { acquireProjectionNode, visualElementStore } from \"motion\"\n\nimport type { CapabilityBinding } from \"./capabilities.ts\"\nimport type { Cleanup, Root, Scope } from \"./core.ts\"\nimport { fail, onMount, within } from \"./core.ts\"\nimport type {\n\tMotionCapabilityOptions,\n\tMotionLayoutTransition,\n} from \"./motion.ts\"\n\ninterface Props {\n\tanimate?: boolean | `position` | `size`\n\tid?: string | number\n\tgroup?: string | number\n\tscroll?: boolean\n\troot?: boolean\n\ttransition?: MotionLayoutTransition\n}\ninterface LayoutController {\n\tcommit(): void\n\tbeforeUpdate(): Cleanup\n\tattach(element: HTMLElement, scope: Scope): CapabilityBinding\n}\ninterface Entry {\n\telement: HTMLElement\n\tscope: Scope\n\tprops: Props\n\tmounted: boolean\n\tdead: boolean\n\tnode?: IProjectionNode | undefined\n\trelease?: Cleanup | undefined\n\tbeginStyles?: Cleanup | undefined\n\tmeasureStyles?: Cleanup | undefined\n\tendStyles?: Cleanup | undefined\n\tcaptureStyles?: Cleanup | undefined\n\tidentity?: string\n\tsize?: string\n}\nlet serial = 0\n\nexport function createLayoutController(\n\troot: Root,\n\toptions: MotionCapabilityOptions,\n): LayoutController {\n\tconst prefix = serial++\n\tconst entries = new Set<Entry>()\n\tlet dead = false\n\tlet updating = false\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && Boolean(preference?.matches))\n\tconst report = (error: unknown) => {\n\t\ttry {\n\t\t\tfail(root, error)\n\t\t} catch (failure) {\n\t\t\troot.error(failure)\n\t\t}\n\t}\n\tconst ordered = () =>\n\t\t[...entries]\n\t\t\t.filter(\n\t\t\t\t(entry) => entry.mounted && !entry.dead && entry.element.isConnected,\n\t\t\t)\n\t\t\t.sort((a, b) =>\n\t\t\t\ta.element.compareDocumentPosition(b.element) &\n\t\t\t\tNode.DOCUMENT_POSITION_FOLLOWING\n\t\t\t\t\t? -1\n\t\t\t\t\t: 1,\n\t\t\t)\n\tconst release = (entry: Entry) => {\n\t\tconst detach = entry.release\n\t\tentry.release = undefined\n\t\tentry.node = undefined\n\t\tentry.beginStyles =\n\t\t\tentry.measureStyles =\n\t\t\tentry.endStyles =\n\t\t\tentry.captureStyles =\n\t\t\t\tundefined\n\t\tdetach?.()\n\t}\n\tconst configure = (entry: Entry) => {\n\t\tconst transition = entry.props.transition ??\n\t\t\toptions.layoutTransition ?? { duration: 0.3 }\n\t\tfor (const name of [\n\t\t\t`duration`,\n\t\t\t`delay`,\n\t\t\t`stiffness`,\n\t\t\t`damping`,\n\t\t\t`mass`,\n\t\t] as const) {\n\t\t\tconst value = transition[name]\n\t\t\tif (\n\t\t\t\tvalue !== undefined &&\n\t\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t\tvalue < 0 ||\n\t\t\t\t\t([`stiffness`, `damping`, `mass`].includes(name) && value === 0))\n\t\t\t)\n\t\t\t\tthrow new Error(`spa/motion: transitions must settle in finite time`)\n\t\t}\n\t\tentry.node!.setOptions({\n\t\t\tlayoutScroll: entry.props.scroll ?? false,\n\t\t\tlayoutRoot: entry.props.root ?? false,\n\t\t\tanimationType:\n\t\t\t\ttypeof entry.props.animate === `string` ? entry.props.animate : `both`,\n\t\t\tanimate: entry.props.animate !== false && !reduced(),\n\t\t\ttransition: (reduced() ? { duration: 0 } : transition) as ValueTransition,\n\t\t})\n\t\tif (reduced()) entry.node!.finishAnimation()\n\t}\n\tconst prepare = (entry: Entry) => {\n\t\tconst { element, props } = entry\n\t\tconst identity = JSON.stringify([\n\t\t\tprefix,\n\t\t\tprops.group ?? ``,\n\t\t\tprops.id ?? null,\n\t\t\tprops.animate ?? true,\n\t\t])\n\t\tif (entry.node && entry.identity !== identity) release(entry)\n\t\tif (!entry.node) {\n\t\t\tconst attrs = [`data-layout`, `data-layout-id`].map(\n\t\t\t\t(name) => [name, element.getAttribute(name)] as const,\n\t\t\t)\n\t\t\tconst styleNames = [\n\t\t\t\t`transform`,\n\t\t\t\t`transform-origin`,\n\t\t\t\t`opacity`,\n\t\t\t\t`visibility`,\n\t\t\t\t`pointer-events`,\n\t\t\t]\n\t\t\tconst style = element.ownerDocument.createElement(`div`).style\n\t\t\tstyle.cssText = element.style.cssText\n\t\t\tconst restore = (name: string) => {\n\t\t\t\tconst value = style.getPropertyValue(name)\n\t\t\t\tif (value)\n\t\t\t\t\telement.style.setProperty(name, value, style.getPropertyPriority(name))\n\t\t\t\telse element.style.removeProperty(name)\n\t\t\t}\n\t\t\telement.removeAttribute(`data-layout`)\n\t\t\telement.removeAttribute(`data-layout-id`)\n\t\t\tif (props.animate !== false)\n\t\t\t\telement.setAttribute(\n\t\t\t\t\t`data-layout`,\n\t\t\t\t\ttypeof props.animate === `string` ? props.animate : `true`,\n\t\t\t\t)\n\t\t\tif (props.id !== undefined && props.animate !== false)\n\t\t\t\telement.setAttribute(\n\t\t\t\t\t`data-layout-id`,\n\t\t\t\t\tJSON.stringify([prefix, props.group ?? ``, props.id]),\n\t\t\t\t)\n\t\t\tconst [node, detach] = acquireProjectionNode(element)\n\t\t\tentry.node = node\n\t\t\tentry.identity = identity\n\t\t\tconst visual = node.options.visualElement!\n\t\t\tconst originalProps = visual.getProps()\n\t\t\tconst originalValues = { ...node.latestValues }\n\t\t\tlet opacity = `1`\n\t\t\tlet visibility = ``\n\t\t\tlet pointerEvents = ``\n\t\t\tlet transform = ``\n\t\t\tlet rendered = ``\n\t\t\tconst transformTemplate = (_: unknown, projected: string) =>\n\t\t\t\t`${projected === `none` ? `` : projected} ${transform}`.trim()\n\t\t\tentry.captureStyles = () => {\n\t\t\t\tstyle.cssText = element.style.cssText\n\t\t\t}\n\t\t\tentry.beginStyles = () => {\n\t\t\t\t// Resolve authored CSS against today's dimensions, without reading back\n\t\t\t\t// the opacity and percentage origins written by projection itself.\n\t\t\t\trendered = element.style.cssText\n\t\t\t\tfor (const name of styleNames) restore(name)\n\t\t\t}\n\t\t\tentry.measureStyles = () => {\n\t\t\t\tconst authored = getComputedStyle(element)\n\t\t\t\topacity = authored.opacity || `1`\n\t\t\t\tvisibility = authored.visibility\n\t\t\t\tpointerEvents = authored.pointerEvents\n\t\t\t\ttransform = authored.transform\n\t\t\t\tif (!visual.values.has(`opacity`))\n\t\t\t\t\tnode.latestValues[`opacity`] = Number(opacity)\n\t\t\t\tconst origin = authored.transformOrigin.split(` `)\n\t\t\t\tconst width = element.offsetWidth,\n\t\t\t\t\theight = element.offsetHeight\n\t\t\t\tentry.size = `${width}:${height}`\n\t\t\t\tfor (const [key, value] of [\n\t\t\t\t\t[`originX`, parseFloat(origin[0]) / (width || 1)],\n\t\t\t\t\t[`originY`, parseFloat(origin[1]) / (height || 1)],\n\t\t\t\t] as const)\n\t\t\t\t\tif (!visual.values.has(key) && Number.isFinite(value))\n\t\t\t\t\t\tnode.latestValues[key] = value\n\t\t\t\t// Motion-owned transforms compose in projection; return to authored\n\t\t\t\t// transforms if that Motion binding is subsequently removed.\n\t\t\t\tconst template =\n\t\t\t\t\ttransform &&\n\t\t\t\t\ttransform !== `none` &&\n\t\t\t\t\t!Object.keys(visual.latestValues).some((key) =>\n\t\t\t\t\t\t/^(x|y|scale|rotate|skew)/.test(key),\n\t\t\t\t\t)\n\t\t\t\t\t\t? transformTemplate\n\t\t\t\t\t\t: originalProps.transformTemplate\n\t\t\t\tif (visual.getProps().transformTemplate !== template) {\n\t\t\t\t\tconst next = { ...visual.getProps() }\n\t\t\t\t\tif (template) next.transformTemplate = template\n\t\t\t\t\telse delete next.transformTemplate\n\t\t\t\t\tvisual.update(next, null)\n\t\t\t\t}\n\t\t\t}\n\t\t\tentry.endStyles = () => {\n\t\t\t\telement.style.cssText = rendered\n\t\t\t}\n\t\t\tconst applyProjectionStyles = node.applyProjectionStyles\n\t\t\tnode.applyProjectionStyles = (targetStyle, styleProp) => {\n\t\t\t\tapplyProjectionStyles.call(node, targetStyle, {\n\t\t\t\t\t...styleProp,\n\t\t\t\t\tpointerEvents: styleProp?.[`pointerEvents`] ?? pointerEvents,\n\t\t\t\t})\n\t\t\t\tif (!targetStyle.visibility) targetStyle.visibility = visibility\n\t\t\t\tif (!targetStyle.opacity)\n\t\t\t\t\ttargetStyle.opacity = String(node.latestValues[`opacity`] ?? opacity)\n\t\t\t}\n\t\t\tentry.release = () => {\n\t\t\t\ttry {\n\t\t\t\t\tif (node.isLead()) node.finishAnimation()\n\t\t\t\t\tdetach()\n\t\t\t\t} finally {\n\t\t\t\t\tnode.applyProjectionStyles = applyProjectionStyles\n\t\t\t\t\tvisual.projection = undefined\n\t\t\t\t\tfor (const key of [`opacity`, `originX`, `originY`])\n\t\t\t\t\t\tif (!visual.values.has(key)) {\n\t\t\t\t\t\t\tif (originalValues[key] === undefined)\n\t\t\t\t\t\t\t\tReflect.deleteProperty(node.latestValues, key)\n\t\t\t\t\t\t\telse node.latestValues[key] = originalValues[key]\n\t\t\t\t\t\t}\n\t\t\t\t\tconst retained =\n\t\t\t\t\t\t!root._dead && !entry.scope._dead && visual.values.size > 0\n\t\t\t\t\tif (!retained) {\n\t\t\t\t\t\tvisual.unmount()\n\t\t\t\t\t\tvisualElementStore.delete(element)\n\t\t\t\t\t} else visual.update(originalProps, null)\n\t\t\t\t\tfor (const [name, value] of attrs) {\n\t\t\t\t\t\tif (value === null) element.removeAttribute(name)\n\t\t\t\t\t\telse element.setAttribute(name, value)\n\t\t\t\t\t}\n\t\t\t\t\tfor (const name of styleNames) restore(name)\n\t\t\t\t\tif (retained) visual.scheduleRender()\n\t\t\t\t}\n\t\t\t}\n\t\t\tobserver?.observe(element)\n\t\t}\n\t}\n\tconst prepareAll = () => {\n\t\tconst active = ordered()\n\t\tfor (const entry of active) prepare(entry)\n\t\tconst begun: Entry[] = []\n\t\ttry {\n\t\t\t// Strip every projection before reading any authored style or dimension.\n\t\t\t// Interleaving these phases forces a layout for each registered element.\n\t\t\tfor (const entry of active) {\n\t\t\t\tbegun.push(entry)\n\t\t\t\tentry.beginStyles!()\n\t\t\t}\n\t\t\tfor (const entry of active) entry.measureStyles!()\n\t\t} finally {\n\t\t\tfor (const entry of begun) entry.endStyles!()\n\t\t}\n\t\tfor (const entry of active) configure(entry)\n\t\treturn active\n\t}\n\tconst commit = () => {\n\t\ttry {\n\t\t\tif (dead) return\n\t\t\tprepareAll()\n\t\t\tconst roots = new Set(\n\t\t\t\t[...entries].flatMap((entry) =>\n\t\t\t\t\tentry.node ? [entry.node.root ?? entry.node] : [],\n\t\t\t\t),\n\t\t\t)\n\t\t\tfor (const projection of roots) projection.didUpdate()\n\t\t\t// Mount replacements before dropping outgoing nodes so shared snapshots can hand off.\n\t\t\tfor (const entry of entries)\n\t\t\t\tif (entry.dead) {\n\t\t\t\t\tobserver?.unobserve(entry.element)\n\t\t\t\t\trelease(entry)\n\t\t\t\t\tentries.delete(entry)\n\t\t\t\t}\n\t\t} finally {\n\t\t\tupdating = false\n\t\t}\n\t}\n\tconst observer =\n\t\ttypeof ResizeObserver === `function`\n\t\t\t? new ResizeObserver((changes) => {\n\t\t\t\t\tif (dead || updating) return\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const change of changes) {\n\t\t\t\t\t\t\tconst entry = [...entries].find(\n\t\t\t\t\t\t\t\t(candidate) => candidate.element === change.target,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!entry?.node ||\n\t\t\t\t\t\t\t\tentry.size ===\n\t\t\t\t\t\t\t\t\t`${entry.element.offsetWidth}:${entry.element.offsetHeight}`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\tconst previous = entry.node.layout\n\t\t\t\t\t\t\tentry.node.willUpdate()\n\t\t\t\t\t\t\tif (previous) entry.node.snapshot = previous\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcommit()\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treport(error)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t: undefined\n\tconst mediaChanged = () => {\n\t\ttry {\n\t\t\tfor (const entry of entries) if (entry.node) configure(entry)\n\t\t} catch (error) {\n\t\t\treport(error)\n\t\t}\n\t}\n\tpreference?.addEventListener(`change`, mediaChanged)\n\troot._cleanups.add(() => {\n\t\tdead = true\n\t\tobserver?.disconnect()\n\t\tpreference?.removeEventListener(`change`, mediaChanged)\n\t\tconst errors: unknown[] = []\n\t\tfor (const entry of entries)\n\t\t\ttry {\n\t\t\t\trelease(entry)\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\tentries.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t})\n\treturn {\n\t\tcommit,\n\t\tbeforeUpdate(): Cleanup {\n\t\t\tupdating = true\n\t\t\t// Snapshot the rendered projection; resolve authored styles once after the DOM changes.\n\t\t\tfor (const entry of ordered()) {\n\t\t\t\tprepare(entry)\n\t\t\t\tentry.node!.willUpdate()\n\t\t\t}\n\t\t\treturn commit\n\t\t},\n\t\tattach(element: HTMLElement, scope: Scope): CapabilityBinding {\n\t\t\tconst entry: Entry = {\n\t\t\t\telement,\n\t\t\t\tscope,\n\t\t\t\tprops: {},\n\t\t\t\tmounted: false,\n\t\t\t\tdead: false,\n\t\t\t}\n\t\t\tentries.add(entry)\n\t\t\twithin(scope, () => {\n\t\t\t\tonMount(() => {\n\t\t\t\t\tentry.mounted = true\n\t\t\t\t})\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tupdate(props, previousStyle) {\n\t\t\t\t\tentry.props = props\n\t\t\t\t\tif (previousStyle !== undefined) entry.captureStyles?.()\n\t\t\t\t},\n\t\t\t\texit() {\n\t\t\t\t\tif (entry.node) entry.node.isPresent = false\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\t\t\t\tresume() {\n\t\t\t\t\tif (entry.node) {\n\t\t\t\t\t\tentry.node.isPresent = true\n\t\t\t\t\t\tentry.node.promote()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tentry.dead = true\n\t\t\t\t\tif (!updating) {\n\t\t\t\t\t\tobserver?.unobserve(element)\n\t\t\t\t\t\trelease(entry)\n\t\t\t\t\t\tentries.delete(entry)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t}\n}\n","import type { ValueAnimationTransition } from \"motion\"\n\nimport type { MotionScalar, MotionTransition } from \"./motion.ts\"\n\nexport function finalFrame(value: any): MotionScalar {\n\treturn Array.isArray(value) ? value.at(-1) : value\n}\n/** Property options override default options, which override top-level options. */\nexport function propertyTransition(\n\tconfig: MotionTransition | undefined,\n\tkey: string,\n\tgoal?: unknown,\n): ValueAnimationTransition {\n\tconst { default: fallback, properties, ...base } = config ?? {}\n\tconst transition = { ...base, ...fallback, ...properties?.[key] }\n\tconst sequence = Array.isArray(goal)\n\tif (sequence) {\n\t\tif (\n\t\t\tgoal.length < 2 ||\n\t\t\tgoal.some(\n\t\t\t\t(value, index) =>\n\t\t\t\t\t!(\n\t\t\t\t\t\ttypeof value === `string` ||\n\t\t\t\t\t\t(typeof value === `number` && Number.isFinite(value)) ||\n\t\t\t\t\t\t(index === 0 && value === null)\n\t\t\t\t\t),\n\t\t\t)\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: keyframes require at least two scalar values; only the first may be null`,\n\t\t\t)\n\t\tif (transition.type === `spring` && goal.length > 2)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: multi-keyframe sequences require a tween transition`,\n\t\t\t)\n\t\ttransition.type ??= `tween`\n\t}\n\tif (!sequence && !config) transition.type ??= `spring`\n\tconst count = sequence ? goal.length : 2\n\tif (\n\t\ttransition.times &&\n\t\t(transition.times.length !== count ||\n\t\t\ttransition.times[0] !== 0 ||\n\t\t\ttransition.times.at(-1) !== 1 ||\n\t\t\ttransition.times.some(\n\t\t\t\t(at, index, times) =>\n\t\t\t\t\t!Number.isFinite(at) ||\n\t\t\t\t\tat < 0 ||\n\t\t\t\t\tat > 1 ||\n\t\t\t\t\t(index > 0 && at < times[index - 1]),\n\t\t\t))\n\t)\n\t\tthrow new Error(\n\t\t\t`spa/motion: times must match the keyframes and increase from 0 to 1`,\n\t\t)\n\tif (\n\t\tArray.isArray(transition.ease) &&\n\t\ttypeof transition.ease[0] !== `number` &&\n\t\ttransition.ease.length !== count - 1\n\t)\n\t\tthrow new Error(\n\t\t\t`spa/motion: segment easing must match the keyframe intervals`,\n\t\t)\n\tfor (const option of [\n\t\t`duration`,\n\t\t`delay`,\n\t\t`visualDuration`,\n\t\t`velocity`,\n\t\t`bounce`,\n\t\t`stiffness`,\n\t\t`damping`,\n\t\t`mass`,\n\t\t`restDelta`,\n\t\t`restSpeed`,\n\t] as const) {\n\t\tconst value = transition[option]\n\t\tif (\n\t\t\tvalue !== undefined &&\n\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t(option !== `velocity` && option !== `delay` && value < 0) ||\n\t\t\t\t(option === `bounce` && value >= 1) ||\n\t\t\t\t([`stiffness`, `damping`, `mass`, `restDelta`, `restSpeed`].includes(\n\t\t\t\t\toption,\n\t\t\t\t) &&\n\t\t\t\t\tvalue === 0))\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`spa/motion: animation requires a finite settling transition`,\n\t\t\t)\n\t}\n\treturn transition as ValueAnimationTransition\n}\n","import type { MotionValue, ValueAnimationTransition } from \"motion\"\nimport { animate, keyframes } from \"motion\"\n\nimport type { MotionScalar } from \"./motion.ts\"\n\nconst trajectories = new WeakMap<\n\tMotionValue<MotionScalar>,\n\t() => { position: number; velocity: number }\n>()\nconst scalar = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)$/i\nconst brake = (progress: number) => progress * (2 - progress)\nconst returnToTarget = (progress: number) =>\n\tprogress * progress * (3 - 2 * progress)\n\n/** Retarget a moving tween without changing its position or velocity at the join. */\nexport function animateTween(\n\tvalue: MotionValue<MotionScalar>,\n\tgoal: MotionScalar | readonly (MotionScalar | null)[],\n\ttransition: ValueAnimationTransition,\n\tinterrupted: boolean,\n): ReturnType<typeof animate> {\n\tif (Array.isArray(goal)) {\n\t\tvalue.stop()\n\t\ttrajectories.delete(value)\n\t\tlet frames = goal.map((frame) => frame ?? value.get())\n\t\tconst units = frames.map((frame) =>\n\t\t\ttypeof frame === `number` ? `` : scalar.exec(frame)?.[2],\n\t\t)\n\t\tconst unit = units.find((suffix) => suffix)\n\t\t// Synchronous animation bypasses Motion's DOM unit resolver. Keep compatible\n\t\t// scalar frames in one unit so numeric mixers never receive CSS strings.\n\t\tif (unit && units.every((suffix) => suffix === `` || suffix === unit))\n\t\t\tframes = frames.map((frame, index) =>\n\t\t\t\tunits[index] === `` ? `${frame}${unit}` : frame,\n\t\t\t)\n\t\treturn animate(value, frames, { ...transition, isSync: true })\n\t}\n\tif (interrupted) value.stop()\n\tconst current = value.get()\n\tconst from =\n\t\ttypeof current === `number` ? [``, current, ``] : scalar.exec(current)\n\tconst to =\n\t\ttypeof goal === `number` ? [``, goal, ``] : scalar.exec(goal as string)\n\tconst previous = trajectories.get(value)?.()\n\tconst velocity =\n\t\tprevious && from && Math.abs(previous.position - Number(from[1])) < 0.001\n\t\t\t? previous.velocity\n\t\t\t: value.getVelocity()\n\ttrajectories.delete(value)\n\tconst duration = transition.duration ?? 0.3\n\t// A duration/ease without an explicit type is also a Motion tween. Springs keep\n\t// Motion's own velocity-aware integration; discrete values keep native mixing.\n\tconst tween =\n\t\ttransition.type === `tween` ||\n\t\t(transition.type === undefined &&\n\t\t\t(transition.duration !== undefined || transition.ease !== undefined))\n\tconst moving =\n\t\tinterrupted &&\n\t\ttween &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tNumber.isFinite(velocity) &&\n\t\tvelocity !== 0 &&\n\t\tduration > 0\n\tconst braking = 0.2\n\tconst turn = from ? Number(from[1]) + (velocity * duration * braking) / 2 : 0\n\tconst waypoint = typeof current === `number` ? turn : `${turn}${from?.[2]}`\n\tconst frames = moving ? [current, waypoint, goal] : [current, goal]\n\t// Constant deceleration: dx/dt at t=0 is v, and at the waypoint is zero.\n\t// The return starts and ends at rest. Keyframes also handle goal === current.\n\tconst next = moving\n\t\t? {\n\t\t\t\t...transition,\n\t\t\t\ttype: `tween` as const,\n\t\t\t\tduration,\n\t\t\t\tdelay: 0,\n\t\t\t\ttimes: [0, braking, 1],\n\t\t\t\tease: [brake, returnToTarget],\n\t\t\t}\n\t\t: transition\n\t// Values are already resolved. Synchronous numeric tweens also keep cancelled,\n\t// not-yet-started resolver work from being revived by a timeline read.\n\tconst controls = animate(\n\t\tvalue,\n\t\tframes,\n\t\ttween && (moving || current !== goal) ? { ...next, isSync: true } : next,\n\t)\n\tif (\n\t\ttween &&\n\t\t(moving || current !== goal) &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tduration > 0\n\t) {\n\t\tconst curve = keyframes({\n\t\t\tkeyframes: moving\n\t\t\t\t? [Number(from[1]), turn, Number(to[1])]\n\t\t\t\t: [Number(from[1]), Number(to[1])],\n\t\t\tduration: duration * 1000,\n\t\t\ttimes: moving ? [0, braking, 1] : [0, 1],\n\t\t\tease: next.ease ?? `easeOut`,\n\t\t})\n\t\tconst sample = (at: number) => curve.next(at * 1000).value\n\n\t\t// Use the tween's own timeline. Frame-estimated MotionValue velocity becomes\n\t\t// noisy when stop/resume happen several times within the same render frame.\n\t\ttrajectories.set(value, () => {\n\t\t\tconst at = Math.max(0, Math.min(duration, controls.time))\n\t\t\tconst before = Math.max(0, at - 0.0001),\n\t\t\t\tafter = Math.min(duration, at + 0.0001)\n\t\t\treturn {\n\t\t\t\tposition: sample(at),\n\t\t\t\tvelocity:\n\t\t\t\t\tat <= 0 || at >= duration\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: (sample(after) - sample(before)) / (after - before),\n\t\t\t}\n\t\t})\n\t}\n\treturn controls\n}\n","import type { CapabilityBinding } from \"./capabilities.ts\"\nimport type { Cleanup, Root, Scope } from \"./core.ts\"\nimport {\n\tdispose,\n\tinvalidate,\n\tisPresent,\n\treportScopeError,\n\tuntrack,\n} from \"./core.ts\"\n\nexport interface ExitHandle {\n\tfinished: Promise<void>\n\tcancel(): void\n}\nexport interface ExitParticipant {\n\texit(): ExitHandle | undefined\n\tresume(): void\n}\nexport interface PresenceTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n}\nexport interface PresenceCollection<T, V> {\n\ttake(key: unknown, value: V): T | undefined\n\tremove(\n\t\trecord: T,\n\t\tkey: unknown,\n\t\teligible: boolean,\n\t\tindex: number,\n\t\tdone: Cleanup,\n\t): void\n\tmerge(records: T[]): T[]\n}\nexport interface PresenceCoordinator {\n\tcollection<T, V>(\n\t\tscope: (record: T) => Scope,\n\t\tcompatible: (record: T, value: V) => boolean,\n\t): PresenceCollection<T, V>\n\ttarget(scope: Scope, target: PresenceTarget): void\n\tbind(\n\t\tscope: Scope,\n\t\tbinding: CapabilityBinding,\n\t\tread: () => Record<string, unknown>,\n\t\tnamespace: string,\n\t): void\n\tunbind(binding: CapabilityBinding): void\n\tremove(scope: Scope, done: Cleanup): boolean\n\tresume(scope: Scope): void\n\tforget(scope: Scope): void\n}\ninterface Session {\n\tscope: Scope\n\tparticipant: ExitParticipant\n\thandle: ExitHandle\n\tdone: boolean\n\tcancelled: boolean\n}\ninterface Group {\n\tscope: Scope\n\tsessions: Session[]\n\tdone: Cleanup\n}\n\n/** Optional coordinator: only imported by integrations that support retention. */\nexport function createPresence(root: Root): PresenceCoordinator {\n\tconst releases = new Map<CapabilityBinding, Cleanup>()\n\t// Groups own absent ranges; sessions can be shared when a parent adopts a child exit.\n\tconst groups = new Map<Scope, Group>()\n\tconst sessions = new Set<Session>()\n\tconst active = new Map<ExitParticipant, Session>()\n\tconst suspended = new Map<PresenceTarget, { scope: Scope; restore: Cleanup }>()\n\tconst suspend = (target: PresenceTarget): Cleanup => {\n\t\tif (target.kind !== `dom`) return target.suspend!()\n\t\tconst node = target.node as HTMLElement\n\t\tconst inert = node.getAttribute(`inert`),\n\t\t\thidden = node.getAttribute(`aria-hidden`)\n\t\tconst pointer = node.style.getPropertyValue(`pointer-events`),\n\t\t\tpriority = node.style.getPropertyPriority(`pointer-events`)\n\t\tconst focused = node.ownerDocument.activeElement as HTMLElement | null\n\t\tif (focused && node.contains(focused)) focused.blur()\n\t\tnode.setAttribute(`inert`, ``)\n\t\tnode.setAttribute(`aria-hidden`, `true`)\n\t\tnode.style.setProperty(`pointer-events`, `none`, `important`)\n\t\treturn () => {\n\t\t\tfor (const [key, value] of [\n\t\t\t\t[`inert`, inert],\n\t\t\t\t[`aria-hidden`, hidden],\n\t\t\t] as const) {\n\t\t\t\tif (value === null) node.removeAttribute(key)\n\t\t\t\telse node.setAttribute(key, value)\n\t\t\t}\n\t\t\tif (pointer) node.style.setProperty(`pointer-events`, pointer, priority)\n\t\t\telse node.style.removeProperty(`pointer-events`)\n\t\t}\n\t}\n\tconst walk = (scope: Scope, visit: (scope: Scope) => void) => {\n\t\tconst descend = (at: Scope) => {\n\t\t\tvisit(at)\n\t\t\tfor (const child of at._cleanups)\n\t\t\t\tif (typeof child !== `function`) descend(child)\n\t\t}\n\t\tdescend(scope)\n\t}\n\tconst ancestor = (scope: Scope, parent: Scope) => {\n\t\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\t\tif (at === parent) return true\n\t\treturn false\n\t}\n\tconst finish = () => {\n\t\tfor (const group of [...groups.values()]) {\n\t\t\tif (group.scope._dead || group.sessions.some((session) => !session.done))\n\t\t\t\tcontinue\n\t\t\tif (\n\t\t\t\t[...groups.keys()].some(\n\t\t\t\t\t(scope) => scope !== group.scope && ancestor(group.scope, scope),\n\t\t\t\t)\n\t\t\t)\n\t\t\t\tcontinue\n\t\t\tgroups.delete(group.scope)\n\t\t\ttry {\n\t\t\t\tgroup.done()\n\t\t\t} catch (error) {\n\t\t\t\tif (!root._dead) reportScopeError(group.scope, error)\n\t\t\t}\n\t\t}\n\t}\n\tconst cancel = (session: Session) => {\n\t\tsession.cancelled = true\n\t\tsessions.delete(session)\n\t\tactive.delete(session.participant)\n\t\tsession.handle.cancel()\n\t}\n\tconst coordinator: PresenceCoordinator = {\n\t\ttarget(scope, target) {\n\t\t\t;(scope._targets ??= new Set()).add(target)\n\t\t\tscope._cleanups.add(() => {\n\t\t\t\tscope._targets!.delete(target)\n\t\t\t})\n\t\t},\n\t\tbind(scope, binding, props, namespace) {\n\t\t\tconst read = () =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries(props())\n\t\t\t\t\t\t.filter(([key]) => key.startsWith(`${namespace}:`))\n\t\t\t\t\t\t.map(([key, value]) => [key.slice(namespace.length + 1), value]),\n\t\t\t\t)\n\t\t\tif (!binding.exit) return\n\t\t\tconst participant = {\n\t\t\t\texit: () => binding.exit!(untrack(read)),\n\t\t\t\tresume() {\n\t\t\t\t\tbinding.update(untrack(read))\n\t\t\t\t\tbinding.resume?.()\n\t\t\t\t},\n\t\t\t}\n\t\t\t;(scope._exits ??= new Set()).add(participant)\n\t\t\tconst release = () => {\n\t\t\t\tscope._exits!.delete(participant)\n\t\t\t\tscope._cleanups.delete(release)\n\t\t\t\treleases.delete(binding)\n\t\t\t}\n\t\t\treleases.set(binding, release)\n\t\t\tscope._cleanups.add(release)\n\t\t},\n\t\tunbind(binding) {\n\t\t\treleases.get(binding)?.()\n\t\t},\n\t\tcollection<T, V>(\n\t\t\tscopeOf: (record: T) => Scope,\n\t\t\tcompatible: (record: T, value: V) => boolean,\n\t\t): PresenceCollection<T, V> {\n\t\t\tlet order: T[] = []\n\t\t\tconst exiting = new Map<\n\t\t\t\tT,\n\t\t\t\t{ key: unknown; eligible: boolean; index: number }\n\t\t\t>()\n\t\t\treturn {\n\t\t\t\ttake(key, value) {\n\t\t\t\t\t// Empty conditional children do not replace an exiting generation.\n\t\t\t\t\tif (value == null || typeof value === `boolean`) return undefined\n\t\t\t\t\tfor (const [record, state] of exiting)\n\t\t\t\t\t\tif (state.eligible && state.key === key) {\n\t\t\t\t\t\t\tif (!compatible(record, value)) {\n\t\t\t\t\t\t\t\tstate.eligible = false\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\t\treturn record\n\t\t\t\t\t\t}\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\t\t\t\tremove(record, key, eligible, index, done) {\n\t\t\t\t\tconst position = order.indexOf(record)\n\t\t\t\t\tconst state = { key, eligible, index: position < 0 ? index : position }\n\t\t\t\t\texiting.set(record, state)\n\t\t\t\t\tlet pending = false\n\t\t\t\t\tconst release = () => {\n\t\t\t\t\t\tdispose(scopeOf(record))\n\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\torder = order.filter((item) => item !== record)\n\t\t\t\t\t\tfor (const other of exiting.values())\n\t\t\t\t\t\t\tif (other.index > state.index) other.index--\n\t\t\t\t\t\tif (pending) done()\n\t\t\t\t\t}\n\t\t\t\t\tpending = coordinator.remove(scopeOf(record), release)\n\t\t\t\t\tif (!pending) release()\n\t\t\t\t},\n\t\t\t\tmerge(records) {\n\t\t\t\t\tconst rendered = [...records]\n\t\t\t\t\tfor (const [record, state] of [...exiting].sort(\n\t\t\t\t\t\t(a, b) => a[1].index - b[1].index,\n\t\t\t\t\t)) {\n\t\t\t\t\t\trendered.splice(Math.min(state.index, rendered.length), 0, record)\n\t\t\t\t\t\tstate.index = rendered.indexOf(record)\n\t\t\t\t\t}\n\t\t\t\t\t// DOM reconciliation reverses its result while moving ranges. Keep a snapshot.\n\t\t\t\t\torder = [...rendered]\n\t\t\t\t\treturn rendered\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tremove(scope, done) {\n\t\t\tconst collected: Session[] = []\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const participant of at._exits ?? []) {\n\t\t\t\t\tlet session = active.get(participant)\n\t\t\t\t\tif (!session) {\n\t\t\t\t\t\tconst handle = untrack(() => participant.exit())\n\t\t\t\t\t\tif (!handle) continue\n\t\t\t\t\t\tsession = {\n\t\t\t\t\t\t\tscope: at,\n\t\t\t\t\t\t\tparticipant,\n\t\t\t\t\t\t\thandle,\n\t\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsessions.add(session)\n\t\t\t\t\t\tactive.set(participant, session)\n\t\t\t\t\t\tconst held = session\n\t\t\t\t\t\tvoid handle.finished.then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tif (held.cancelled || root._dead) return\n\t\t\t\t\t\t\t\theld.done = true\n\t\t\t\t\t\t\t\tfinish()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\tif (!held.cancelled && !root._dead)\n\t\t\t\t\t\t\t\t\treportScopeError(held.scope, error)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tcollected.push(session)\n\t\t\t\t}\n\t\t\t})\n\t\t\tif (!collected.some((session) => !session.done)) return false\n\t\t\tscope._exiting = true\n\t\t\tgroups.set(scope, { scope, sessions: collected, done })\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const target of at._targets ?? [])\n\t\t\t\t\tif (\n\t\t\t\t\t\t!suspended.has(target) &&\n\t\t\t\t\t\t(target.kind === `dom` || target.suspend)\n\t\t\t\t\t)\n\t\t\t\t\t\tsuspended.set(target, { scope: at, restore: suspend(target) })\n\t\t\t})\n\t\t\treturn true\n\t\t},\n\t\tresume(scope) {\n\t\t\tif (!groups.delete(scope)) return\n\t\t\tscope._exiting = false\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope) && isPresent(session.scope)) {\n\t\t\t\t\tcancel(session)\n\t\t\t\t}\n\t\t\twalk(scope, (at) => {\n\t\t\t\tif (isPresent(at))\n\t\t\t\t\tfor (const participant of at._exits ?? []) participant.resume()\n\t\t\t})\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (isPresent(state.scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\tstate.restore()\n\t\t\t\t}\n\t\t\tinvalidate(scope)\n\t\t\t// Reconcile returning descendants before releasing their adopted, completed exits.\n\t\t\tqueueMicrotask(finish)\n\t\t},\n\t\tforget(scope) {\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcancel(session)\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 at of groups.keys()) if (ancestor(at, scope)) groups.delete(at)\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (ancestor(state.scope, scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstate.restore()\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}\n\treturn coordinator\n}\n","import type { animate, MotionValue } from \"motion\"\nimport {\n\tcancelFrame,\n\tframe,\n\thandOffElementState,\n\thover,\n\tmotionValue,\n\tpress,\n\treadStyleValue,\n\tstyleEffect,\n\tvisualElementStore,\n} from \"motion\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Root } from \"./core.ts\"\nimport { createLayoutController } from \"./motion-layout.ts\"\nimport { finalFrame, propertyTransition } from \"./motion-transition.ts\"\nimport { animateTween } from \"./motion-tween.ts\"\nimport type { ExitHandle } from \"./presence.ts\"\nimport { createPresence } from \"./presence.ts\"\n\nexport type MotionKeyframes = readonly [\n\tMotionScalar | null,\n\tMotionScalar,\n\t...MotionScalar[],\n]\nexport type MotionEasing =\n\t| `linear`\n\t| `easeIn`\n\t| `easeOut`\n\t| `easeInOut`\n\t| `circIn`\n\t| `circOut`\n\t| `circInOut`\n\t| `backIn`\n\t| `backOut`\n\t| `backInOut`\n\t| readonly [number, number, number, number]\n/** Public options remain independent of optional Motion peer declarations. */\nexport interface MotionValueTransition {\n\ttype?: `spring` | `tween`\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n\tvelocity?: number\n\trestSpeed?: number\n\trestDelta?: number\n\tbounce?: number\n\tvisualDuration?: number\n\tduration?: number\n\tdelay?: number\n\ttimes?: readonly number[]\n\tease?: MotionEasing | readonly MotionEasing[]\n}\nexport interface MotionTransition extends MotionValueTransition {\n\tdefault?: MotionValueTransition\n\tproperties?: Readonly<Record<string, MotionValueTransition>>\n}\nexport interface MotionLayoutTransition {\n\ttype?: `spring` | `tween`\n\tduration?: number\n\tdelay?: number\n\tease?:\n\t\t| `linear`\n\t\t| `easeIn`\n\t\t| `easeOut`\n\t\t| `easeInOut`\n\t\t| readonly [number, number, number, number]\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n}\n\nexport type MotionScalar = number | string\nexport type MotionDOMTarget = Partial<\n\tRecord<\n\t\t| keyof CSSStyleDeclaration\n\t\t| `x`\n\t\t| `y`\n\t\t| `z`\n\t\t| `scale`\n\t\t| `scaleX`\n\t\t| `scaleY`\n\t\t| `rotate`\n\t\t| `rotateX`\n\t\t| `rotateY`\n\t\t| `rotateZ`\n\t\t| `skewX`\n\t\t| `skewY`\n\t\t| `--${string}`,\n\t\tMotionScalar | MotionKeyframes\n\t>\n>\nexport interface MotionThreeTarget {\n\tposition?: readonly [number, number, number]\n\trotation?: readonly [number, number, number]\n\tscale?: number | readonly [number, number, number]\n\topacity?: number\n\tintensity?: number\n\tcolor?: string\n}\nexport type MotionTarget<Kind extends string> = Kind extends `dom`\n\t? MotionDOMTarget\n\t: Kind extends `three`\n\t\t? MotionThreeTarget\n\t\t: Record<string, MotionScalar>\nexport interface MotionAttributes<Kind extends string = `dom`> {\n\t[`motion:layout`]?: Kind extends `dom` ? boolean | `position` | `size` : never\n\t[`motion:layoutId`]?: Kind extends `dom` ? string | number : never\n\t[`motion:layoutGroup`]?: Kind extends `dom` ? string | number : never\n\t[`motion:layoutScroll`]?: Kind extends `dom` ? boolean : never\n\t/** Measure descendants relative to this instantly positioned layout ancestor. */\n\t[`motion:layoutRoot`]?: Kind extends `dom` ? boolean : never\n\t[`motion:layoutTransition`]?: Kind extends `dom`\n\t\t? MotionLayoutTransition\n\t\t: never\n\t[`motion:initial`]?:\n\t\t| (Kind extends `dom`\n\t\t\t\t? Partial<Record<keyof MotionDOMTarget, MotionScalar>>\n\t\t\t\t: MotionTarget<Kind>)\n\t\t| false\n\t[`motion:animate`]?: MotionTarget<Kind>\n\t[`motion:exit`]?: MotionTarget<Kind>\n\t[`motion:transition`]?: MotionTransition\n\t[`motion:whileHover`]?: MotionTarget<Kind>\n\t[`motion:whileTap`]?: MotionTarget<Kind>\n}\n\n// eslint-disable-next-line quotes -- TypeScript module augmentation requires a string literal.\ndeclare module \"@atom.io/spa/jsx-runtime\" {\n\t// oxlint-disable-next-line typescript/no-empty-interface -- Declaration merging adds optional motion attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends MotionAttributes<Kind> {}\n}\n\nexport interface MotionCapabilityOptions {\n\t/** Respect the user's reduced-motion preference by default. */\n\treducedMotion?: `user` | `always` | `never`\n\t/** Default transition for layout projection; animated properties use motion:transition. */\n\tlayoutTransition?: MotionLayoutTransition\n}\ntype TargetValue = MotionScalar | readonly (MotionScalar | null)[]\ntype TargetValues = Record<string, TargetValue>\ninterface AnimatedProperty {\n\tvalues: MotionValue<MotionScalar>[]\n\tbase: TargetValue\n\trest: TargetValue\n\ttarget: TargetValue\n\trelease(): void\n}\nconst transform =\n\t/^(x|y|z|translate.*|scale.*|rotate.*|skew.*|transformPerspective)$/\nconst allowed = new Set([\n\t`initial`,\n\t`animate`,\n\t`exit`,\n\t`transition`,\n\t`whileHover`,\n\t`whileTap`,\n])\nconst layoutKeys = {\n\tlayout: `animate`,\n\tlayoutId: `id`,\n\tlayoutGroup: `group`,\n\tlayoutScroll: `scroll`,\n\tlayoutRoot: `root`,\n\tlayoutTransition: `transition`,\n} as const\nfunction equal(a: unknown, b: unknown): boolean {\n\treturn (\n\t\tObject.is(a, b) ||\n\t\t(Array.isArray(a) &&\n\t\t\tArray.isArray(b) &&\n\t\t\ta.length === b.length &&\n\t\t\ta.every((value, index) => Object.is(value, b[index])))\n\t)\n}\n\nfunction attachValues(\n\ttarget: CapabilityTarget,\n\toptions: MotionCapabilityOptions,\n): CapabilityBinding {\n\tconst element =\n\t\ttarget.kind === `dom` ? (target.node as HTMLElement | SVGElement) : undefined\n\tconst properties = new Map<string, AnimatedProperty>()\n\tconst originalStyles = new Map<string, { value: string; priority: string }>()\n\tlet styles: (() => void) | undefined\n\tlet props: Record<string, unknown> = {}\n\tlet hovered = false\n\tlet tapped = false\n\tlet started = false\n\tlet dead = false\n\tlet exiting = false\n\tlet exitHandle: ExitHandle | undefined\n\tlet gestures: (() => void)[] = []\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && preference?.matches)\n\tconst read = (key: string, fallback: unknown): any => {\n\t\tconst value = element ? readStyleValue(element, key) : target.read!(key)\n\t\treturn value === undefined || value === ``\n\t\t\t? typeof fallback === `number`\n\t\t\t\t? key.startsWith(`scale`) || key === `opacity`\n\t\t\t\t\t? 1\n\t\t\t\t\t: 0\n\t\t\t\t: fallback\n\t\t\t: value\n\t}\n\tconst bindStyles = () => {\n\t\tstyles?.()\n\t\tif (element) {\n\t\t\tstyles = styleEffect(\n\t\t\t\t[element],\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\t[...properties].map(([key, property]) => [key, property.values[0]]),\n\t\t\t\t) as any,\n\t\t\t)\n\t\t\t// Layout projection and late-added/gesture values must render together.\n\t\t\tconst visual = visualElementStore.get(element)\n\t\t\tif (visual) handOffElementState(element, visual)\n\t\t}\n\t}\n\tconst ensure = (\n\t\tkey: string,\n\t\tgoal: TargetValue,\n\t\tinitial: TargetValues | false,\n\t): AnimatedProperty => {\n\t\tconst vector = !element && Array.isArray(goal)\n\t\tconst sample = element ? finalFrame(goal) : goal\n\t\tconst existing = properties.get(key)\n\t\tif (existing) {\n\t\t\tif (existing.values.length !== (vector ? goal.length : 1))\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\treturn existing\n\t\t}\n\t\tconst base = read(key, sample) as TargetValue\n\t\tconst rest = !vector && Array.isArray(base) ? base[0]! : base\n\t\tlet start = initial === false ? sample : (initial[key] ?? rest)\n\t\tif (!vector && Array.isArray(start)) start = start[0]!\n\t\tif (vector && (!Array.isArray(start) || start.length !== goal.length))\n\t\t\tthrow new Error(`spa/motion: ${key} requires matching numeric tuples`)\n\t\tconst values = (Array.isArray(start) ? start : [start]).map((value) =>\n\t\t\tmotionValue(value),\n\t\t) as MotionValue<MotionScalar>[]\n\t\tconst unsubscribers: (() => void)[] = []\n\t\tif (element) {\n\t\t\tconst cssKey = transform.test(key)\n\t\t\t\t? `transform`\n\t\t\t\t: key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n\t\t\tif (!originalStyles.has(cssKey))\n\t\t\t\toriginalStyles.set(cssKey, {\n\t\t\t\t\tvalue: element.style.getPropertyValue(cssKey),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(cssKey),\n\t\t\t\t})\n\t\t} else {\n\t\t\tconst write = () => {\n\t\t\t\ttarget.write!(\n\t\t\t\t\tkey,\n\t\t\t\t\tArray.isArray(goal)\n\t\t\t\t\t\t? values.map((value) => value.get())\n\t\t\t\t\t\t: values[0].get(),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const value of values) unsubscribers.push(value.on(`change`, write))\n\t\t\twrite()\n\t\t}\n\t\tconst property: AnimatedProperty = {\n\t\t\tvalues,\n\t\t\tbase,\n\t\t\trest,\n\t\t\ttarget: start,\n\t\t\trelease() {\n\t\t\t\tfor (const release of unsubscribers) release()\n\t\t\t\tfor (const value of values) value.destroy()\n\t\t\t},\n\t\t}\n\t\tproperties.set(key, property)\n\t\treturn property\n\t}\n\tconst refresh = (force = false) => {\n\t\tif (dead || exiting) return\n\t\tconst initial = (props[`initial`] ?? {}) as TargetValues | false\n\t\tconst animateTo = (props[`animate`] ?? {}) as TargetValues\n\t\tconst hoverTo = (props[`whileHover`] ?? {}) as TargetValues\n\t\tconst tapTo = (props[`whileTap`] ?? {}) as TargetValues\n\t\tconst goals = {\n\t\t\t...animateTo,\n\t\t\t...(hovered ? hoverTo : {}),\n\t\t\t...(tapped ? tapTo : {}),\n\t\t}\n\t\tconst keys = new Set([\n\t\t\t...Object.keys(initial || {}),\n\t\t\t...Object.keys(animateTo),\n\t\t\t...Object.keys(hoverTo),\n\t\t\t...Object.keys(tapTo),\n\t\t])\n\t\tlet added = false\n\t\tfor (const key of keys) {\n\t\t\tconst sample =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\thoverTo[key] ??\n\t\t\t\ttapTo[key]\n\t\t\tif (sample === undefined) continue\n\t\t\tconst had = properties.has(key)\n\t\t\tensure(key, sample, started ? {} : initial)\n\t\t\tif (!had) added = true\n\t\t}\n\t\tif (added) bindStyles()\n\t\tfor (const [key, property] of properties) {\n\t\t\tconst goal =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\tproperty.rest\n\t\t\tif (!force && equal(property.target, goal)) continue\n\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\tconst next = !element && Array.isArray(goal) ? goal : [goal]\n\t\t\tconst transition = propertyTransition(\n\t\t\t\tprops[`transition`] as MotionTransition | undefined,\n\t\t\t\tkey,\n\t\t\t\telement ? goal : undefined,\n\t\t\t)\n\t\t\tif (next.length !== property.values.length)\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\tproperty.values.forEach((value, index) => {\n\t\t\t\tif (reduced() || (!started && initial === false))\n\t\t\t\t\tvalue.jump(finalFrame(next[index]))\n\t\t\t\telse\n\t\t\t\t\tanimateTween(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tnext[index],\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\tforce || value.isAnimating(),\n\t\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\tstarted = true\n\t}\n\tconst clearGestures = () => {\n\t\tfor (const release of gestures) release()\n\t\tgestures = []\n\t}\n\tconst installGestures = () => {\n\t\tclearGestures()\n\t\tif (element) {\n\t\t\tif (props[`whileHover`])\n\t\t\t\tgestures.push(\n\t\t\t\t\thover([element], () => {\n\t\t\t\t\t\thovered = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\thovered = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\tif (props[`whileTap`])\n\t\t\t\tgestures.push(\n\t\t\t\t\tpress([element], () => {\n\t\t\t\t\t\ttapped = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttapped = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t} else if (props[`whileHover`] || props[`whileTap`]) {\n\t\t\tif (!target.listen)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: ${target.kind} gestures require a renderer event adapter`,\n\t\t\t\t)\n\t\t\tconst listen = (event: string, run: () => void) =>\n\t\t\t\tgestures.push(target.listen!(event, run))\n\t\t\tlisten(`pointerenter`, () => {\n\t\t\t\thovered = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerleave`, () => {\n\t\t\t\thovered = false\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerdown`, () => {\n\t\t\t\ttapped = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerup`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointercancel`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\tconst preferenceChanged = () => {\n\t\tif (reduced()) {\n\t\t\tfor (const property of properties.values()) {\n\t\t\t\tconst goal =\n\t\t\t\t\t!element && Array.isArray(property.target)\n\t\t\t\t\t\t? property.target\n\t\t\t\t\t\t: [property.target]\n\t\t\t\tproperty.values.forEach((value, i) => {\n\t\t\t\t\tvalue.jump(finalFrame(goal[i]))\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tconst finishExit = () => {\n\t\texitHandle?.cancel()\n\t}\n\tconst mediaChanged = () => {\n\t\tpreferenceChanged()\n\t\tif (reduced() && exiting) finishExit()\n\t}\n\tpreference?.addEventListener(`change`, mediaChanged)\n\treturn {\n\t\texit(next) {\n\t\t\tconst goals = next[`exit`] as TargetValues | undefined\n\t\t\texiting = true\n\t\t\thovered = tapped = false\n\t\t\tclearGestures()\n\t\t\tconst moving = new Set<MotionValue<MotionScalar>>()\n\t\t\tfor (const property of properties.values())\n\t\t\t\tfor (const value of property.values) {\n\t\t\t\t\tif (value.isAnimating()) moving.add(value)\n\t\t\t\t\tvalue.stop()\n\t\t\t\t}\n\t\t\tif (!goals || !Object.keys(goals).length || reduced()) return undefined\n\t\t\tconst transition = (next[`transition`] ?? {\n\t\t\t\ttype: `spring`,\n\t\t\t}) as MotionTransition\n\t\t\tfor (const key of [\n\t\t\t\t`duration`,\n\t\t\t\t`delay`,\n\t\t\t\t`visualDuration`,\n\t\t\t\t`velocity`,\n\t\t\t\t`bounce`,\n\t\t\t\t`stiffness`,\n\t\t\t\t`damping`,\n\t\t\t\t`mass`,\n\t\t\t\t`restDelta`,\n\t\t\t\t`restSpeed`,\n\t\t\t] as const) {\n\t\t\t\tconst value = transition[key]\n\t\t\t\tif (\n\t\t\t\t\tvalue !== undefined &&\n\t\t\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t\t\t(key !== `velocity` && value < 0) ||\n\t\t\t\t\t\t(key === `bounce` && value >= 1) ||\n\t\t\t\t\t\t([`stiffness`, `damping`, `mass`, `restDelta`, `restSpeed`].includes(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\tvalue === 0))\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`spa/motion: exit requires a finite settling transition`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t\tlet added = false\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst had = properties.has(key)\n\t\t\t\tensure(key, goal, {})\n\t\t\t\tif (!had) added = true\n\t\t\t}\n\t\t\tif (added) bindStyles()\n\t\t\tlet settle!: () => void\n\t\t\tlet reject!: (error: unknown) => void\n\t\t\tconst finished = new Promise<void>((resolve, fail) => {\n\t\t\t\tsettle = resolve\n\t\t\t\treject = fail\n\t\t\t})\n\t\t\tconst controls: ReturnType<typeof animate>[] = []\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst property = properties.get(key)!\n\t\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\t\tconst values = !element && Array.isArray(goal) ? goal : [goal]\n\t\t\t\tconst resolved = propertyTransition(\n\t\t\t\t\tnext[`transition`] as MotionTransition | undefined,\n\t\t\t\t\tkey,\n\t\t\t\t\telement ? goal : undefined,\n\t\t\t\t)\n\t\t\t\tproperty.values.forEach((value, index) =>\n\t\t\t\t\tcontrols.push(\n\t\t\t\t\t\tanimateTween(value, values[index], resolved, moving.has(value)),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tvoid Promise.all(controls.map((control) => Promise.resolve(control))).then(\n\t\t\t\tsettle,\n\t\t\t\treject,\n\t\t\t)\n\t\t\texitHandle = {\n\t\t\t\tfinished,\n\t\t\t\tcancel() {\n\t\t\t\t\tfor (const control of controls) control.stop()\n\t\t\t\t\tsettle()\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn exitHandle\n\t\t},\n\t\tresume() {\n\t\t\texitHandle?.cancel()\n\t\t\texitHandle = undefined\n\t\t\texiting = false\n\t\t\tinstallGestures()\n\t\t\trefresh(true)\n\t\t},\n\t\tupdate(next, previousStyle) {\n\t\t\tconst gestureChange =\n\t\t\t\t!started ||\n\t\t\t\tBoolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) ||\n\t\t\t\tBoolean(next[`whileTap`]) !== Boolean(props[`whileTap`])\n\t\t\tprops = next\n\t\t\tif (gestureChange && !exiting) installGestures()\n\t\t\tif (previousStyle !== undefined && started && element) {\n\t\t\t\tconst snapshot = element.ownerDocument.createElement(`div`).style\n\t\t\t\tsnapshot.cssText = previousStyle\n\t\t\t\tfor (const key of originalStyles.keys())\n\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tsnapshot.getPropertyValue(key),\n\t\t\t\t\t\tsnapshot.getPropertyPriority(key),\n\t\t\t\t\t)\n\t\t\t}\n\t\t\trefresh()\n\t\t},\n\t\tdispose() {\n\t\t\tdead = true\n\t\t\tclearGestures()\n\t\t\texitHandle?.cancel()\n\t\t\tpreference?.removeEventListener(`change`, mediaChanged)\n\t\t\tstyles?.()\n\t\t\tconst visual = element && visualElementStore.get(element)\n\t\t\tfor (const [key, property] of properties) {\n\t\t\t\t// Projection can retain this renderer after the binding is gone.\n\t\t\t\tif (visual?.values.get(key) === property.values[0])\n\t\t\t\t\tvisual.removeValue(key)\n\t\t\t\tproperty.release()\n\t\t\t\tif (!element) target.write!(key, property.base)\n\t\t\t}\n\t\t\tfor (const [key, value] of originalStyles) {\n\t\t\t\tif (value.value)\n\t\t\t\t\telement!.style.setProperty(key, value.value, value.priority)\n\t\t\t\telse element!.style.removeProperty(key)\n\t\t\t}\n\t\t\tproperties.clear()\n\t\t},\n\t}\n}\n\n/** Explicit, root-scoped motion:* integration. Importing it never registers globally. */\nexport function motionCapability(\n\toptions: MotionCapabilityOptions = {},\n): Capability {\n\tconst layouts = new WeakMap<Root, ReturnType<typeof createLayoutController>>()\n\treturn {\n\t\tnamespace: `motion`,\n\t\tpresence: createPresence,\n\t\tbeforeUpdate(root) {\n\t\t\tconst layout = layouts.get(root)\n\t\t\t// A layout binding can first appear during the upcoming DOM writes.\n\t\t\treturn layout ? layout.beforeUpdate() : () => layouts.get(root)?.commit()\n\t\t},\n\t\tattach(target, scope) {\n\t\t\tif (target.kind !== `dom` && (!target.read || !target.write))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: renderer ${target.kind} does not support motion`,\n\t\t\t\t)\n\t\t\tlet values: CapabilityBinding | undefined\n\t\t\tlet layout: CapabilityBinding | undefined\n\t\t\tlet dead = false\n\t\t\treturn {\n\t\t\t\tupdate(next, previousStyle) {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tconst animated: Record<string, unknown> = {}\n\t\t\t\t\tconst projected: Record<string, unknown> = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(next)) {\n\t\t\t\t\t\tif (Object.hasOwn(layoutKeys, key))\n\t\t\t\t\t\t\tprojected[layoutKeys[key as keyof typeof layoutKeys]] = value\n\t\t\t\t\t\telse if (allowed.has(key)) animated[key] = value\n\t\t\t\t\t\telse throw new Error(`spa/motion: unknown property motion:${key}`)\n\t\t\t\t\t}\n\t\t\t\t\tif (Object.keys(projected).length) {\n\t\t\t\t\t\tif (!layout) {\n\t\t\t\t\t\t\tconst element = target.node as HTMLElement\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttarget.kind !== `dom` ||\n\t\t\t\t\t\t\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml` ||\n\t\t\t\t\t\t\t\t!scope\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`spa/motion: layout requires an owned HTML element`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tlet controller = layouts.get(scope._root)\n\t\t\t\t\t\t\tif (!controller) {\n\t\t\t\t\t\t\t\tcontroller = createLayoutController(scope._root, options)\n\t\t\t\t\t\t\t\tlayouts.set(scope._root, controller)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlayout = controller.attach(element, scope)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlayout.update(projected, previousStyle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlayout?.dispose()\n\t\t\t\t\t\tlayout = undefined\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tObject.keys(animated).length ||\n\t\t\t\t\t\t(values && !Object.keys(projected).length)\n\t\t\t\t\t) {\n\t\t\t\t\t\tvalues ??= attachValues(target, options)\n\t\t\t\t\t\tvalues.update(animated, previousStyle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalues?.dispose()\n\t\t\t\t\t\tvalues = undefined\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\texit(next) {\n\t\t\t\t\tif (dead) return undefined\n\t\t\t\t\tlayout?.exit?.(next)\n\t\t\t\t\treturn values?.exit?.(next)\n\t\t\t\t},\n\t\t\t\tresume() {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tlayout?.resume?.()\n\t\t\t\t\tvalues?.resume?.()\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tif (dead) return\n\t\t\t\t\tdead = true\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalues?.dispose()\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tlayout?.dispose()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tscheduleFrame(callback) {\n\t\t\tconst run = ({ timestamp }: { timestamp: number }) => {\n\t\t\t\tcallback(timestamp)\n\t\t\t}\n\t\t\t// Layout measurement flushes update/preRender/render outside animation frames.\n\t\t\t// Run application scene work after rendering, only in the full frame batch.\n\t\t\tframe.postRender(run, true)\n\t\t\treturn () => {\n\t\t\t\tcancelFrame(run)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;AAuCA,IAAI,SAAS;AAEb,SAAgB,uBACf,MACA,SACmB;CACnB,MAAM,SAAS;CACf,MAAM,0BAAU,IAAI,IAAW;CAC/B,IAAI,OAAO;CACX,IAAI,WAAW;CACf,MAAM,aACL,QAAQ,kBAAkB,WAAW,OAAO,eAAe,aACxD,WAAW,kCAAkC,IAC7C,KAAA;CACJ,MAAM,gBACL,QAAQ,kBAAkB,YACzB,QAAQ,kBAAkB,WAAW,QAAQ,YAAY,OAAO;CAClE,MAAM,UAAU,UAAmB;EAClC,IAAI;GACH,KAAK,MAAM,KAAK;EACjB,SAAS,SAAS;GACjB,KAAK,MAAM,OAAO;EACnB;CACD;CACA,MAAM,gBACL,CAAC,GAAG,OAAO,CAAC,CACV,QACC,UAAU,MAAM,WAAW,CAAC,MAAM,QAAQ,MAAM,QAAQ,WAC1D,CAAC,CACA,MAAM,GAAG,MACT,EAAE,QAAQ,wBAAwB,EAAE,OAAO,IAC3C,KAAK,8BACF,KACA,CACJ;CACF,MAAM,WAAW,UAAiB;EACjC,MAAM,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