@atom.io/spa 0.0.4 → 0.0.6
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 +224 -105
- package/README.mdx +87 -20
- package/dist/astro-application.d.ts +1 -1
- package/dist/astro-client.d.ts +3 -2
- package/dist/astro-client.d.ts.map +1 -1
- package/dist/astro-client.js +9 -8
- package/dist/astro-client.js.map +1 -1
- package/dist/astro-request-DRKvDjsO.js.map +1 -1
- package/dist/astro-resumability-client.d.ts +10 -0
- package/dist/astro-resumability-client.d.ts.map +1 -0
- package/dist/astro-resumability-client.js +29 -0
- package/dist/astro-resumability-client.js.map +1 -0
- package/dist/astro-resumability-server.d.ts +3 -0
- package/dist/astro-resumability-server.d.ts.map +1 -0
- package/dist/astro-resumability-server.js +7 -0
- package/dist/astro-resumability-server.js.map +1 -0
- package/dist/astro-server.d.ts +3 -2
- package/dist/astro-server.d.ts.map +1 -1
- package/dist/astro-server.js +28 -9
- package/dist/astro-server.js.map +1 -1
- package/dist/{astro-shared-BT45auwR.js → astro-shared-83hxw7-M.js} +4 -2
- package/dist/astro-shared-83hxw7-M.js.map +1 -0
- package/dist/{astro-shared-CYSRrRr8.d.ts → astro-shared-B9wvGIkk.d.ts} +2 -2
- package/dist/{astro-shared-CYSRrRr8.d.ts.map → astro-shared-B9wvGIkk.d.ts.map} +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +6 -8
- package/dist/astro.js.map +1 -1
- package/dist/{capabilities-D3HObAIy.d.ts → capabilities-_zOwNJ-2.d.ts} +12 -7
- package/dist/capabilities-_zOwNJ-2.d.ts.map +1 -0
- package/dist/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
- package/dist/capabilities-nOIitQ-_.js.map +1 -0
- package/dist/client.min.js +1 -1
- package/dist/{core-Bl1Ec1hY.js → core-DjFJ0aIJ.js} +4 -2
- package/dist/core-DjFJ0aIJ.js.map +1 -0
- package/dist/development/astro-client.js +9 -8
- package/dist/development/astro-client.js.map +1 -1
- package/dist/development/astro-request-DRKvDjsO.js.map +1 -1
- package/dist/development/astro-resumability-client.js +29 -0
- package/dist/development/astro-resumability-client.js.map +1 -0
- package/dist/development/astro-resumability-server.js +7 -0
- package/dist/development/astro-resumability-server.js.map +1 -0
- package/dist/development/astro-server.js +28 -9
- package/dist/development/astro-server.js.map +1 -1
- package/dist/development/{astro-shared-BT45auwR.js → astro-shared-83hxw7-M.js} +4 -2
- package/dist/development/astro-shared-83hxw7-M.js.map +1 -0
- package/dist/development/astro.js +6 -8
- package/dist/development/astro.js.map +1 -1
- package/dist/development/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
- package/dist/development/capabilities-nOIitQ-_.js.map +1 -0
- package/dist/development/{core-DZFaOyTO.js → core-DxPiKryn.js} +4 -2
- package/dist/development/core-DxPiKryn.js.map +1 -0
- package/dist/development/{dom-Dwa2SFTn.js → dom-BWy4dDss.js} +53 -20
- package/dist/development/dom-BWy4dDss.js.map +1 -0
- package/dist/development/floating.js +148 -0
- package/dist/development/floating.js.map +1 -0
- package/dist/development/index.js +3 -3
- package/dist/development/jsx-runtime.js +2 -2
- package/dist/development/jsx-runtime.js.map +1 -1
- package/dist/development/konva.js +2 -2
- package/dist/development/konva.js.map +1 -1
- package/dist/development/motion.js +7 -2
- package/dist/development/motion.js.map +1 -1
- package/dist/development/renderer.js +2 -2
- package/dist/development/renderer.js.map +1 -1
- package/dist/development/server-renderer-C7lGVhpo.js +90 -0
- package/dist/development/server-renderer-C7lGVhpo.js.map +1 -0
- package/dist/development/server.js +2 -83
- package/dist/development/server.js.map +1 -1
- package/dist/development/{src-BUtG4BgX.js → src-WSHJxR9b.js} +2 -2
- package/dist/development/{src-BUtG4BgX.js.map → src-WSHJxR9b.js.map} +1 -1
- package/dist/development/three.js +12 -9
- package/dist/development/three.js.map +1 -1
- package/dist/{vite-CSHoxzXU.js → development/vite-Bmyb6P5w.js} +32 -7
- package/dist/development/vite-Bmyb6P5w.js.map +1 -0
- package/dist/development/vite.js +1 -1
- package/dist/{dom-Cfj3GtQK.js → dom-BrPrxO97.js} +53 -20
- package/dist/dom-BrPrxO97.js.map +1 -0
- package/dist/floating.d.ts +16 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +148 -0
- package/dist/floating.js.map +1 -0
- package/dist/{index-YRZ79lN5.d.ts → index-BFIjI7gF.d.ts} +5 -5
- package/dist/{index-YRZ79lN5.d.ts.map → index-BFIjI7gF.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/{jsx-runtime-Q-UBV97Y.d.ts → jsx-runtime-BhiCZOYZ.d.ts} +7 -7
- package/dist/{jsx-runtime-Q-UBV97Y.d.ts.map → jsx-runtime-BhiCZOYZ.d.ts.map} +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/konva.d.ts +16 -16
- package/dist/konva.js +2 -2
- package/dist/konva.js.map +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +7 -2
- package/dist/motion.js.map +1 -1
- package/dist/renderer.d.ts +4 -4
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +2 -2
- package/dist/renderer.js.map +1 -1
- package/dist/server-renderer-D-uRg04V.js +90 -0
- package/dist/server-renderer-D-uRg04V.js.map +1 -0
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -83
- package/dist/server.js.map +1 -1
- package/dist/size.json +16 -16
- package/dist/{src-DvkUMuNW.js → src-DWIqXCiz.js} +2 -2
- package/dist/{src-DvkUMuNW.js.map → src-DWIqXCiz.js.map} +1 -1
- package/dist/three.d.ts +17 -17
- package/dist/three.js +12 -9
- package/dist/three.js.map +1 -1
- package/dist/{development/vite-CSHoxzXU.js → vite-Bmyb6P5w.js} +32 -7
- package/dist/vite-Bmyb6P5w.js.map +1 -0
- package/dist/vite.js +1 -1
- package/package.json +39 -11
- package/src/astro-client.ts +17 -4
- package/src/astro-request.ts +1 -1
- package/src/astro-resumability-client.ts +40 -0
- package/src/astro-resumability-server.ts +7 -0
- package/src/astro-server.ts +58 -19
- package/src/astro-shared.ts +5 -2
- package/src/astro.ts +11 -3
- package/src/capabilities.ts +9 -4
- package/src/compiler.ts +28 -9
- package/src/core.ts +15 -10
- package/src/dom.ts +85 -50
- package/src/floating.ts +234 -0
- package/src/index.ts +2 -2
- package/src/jsx-runtime.ts +11 -7
- package/src/jsx-types.d.ts +2 -2
- package/src/konva.ts +3 -3
- package/src/motion.ts +11 -1
- package/src/presence.ts +1 -1
- package/src/renderer.ts +24 -18
- package/src/server-renderer.ts +162 -0
- package/src/server.ts +4 -153
- package/src/three-events.ts +14 -10
- package/src/three.ts +4 -4
- package/dist/astro-shared-BT45auwR.js.map +0 -1
- package/dist/capabilities-BkQ2i0vV.js.map +0 -1
- package/dist/capabilities-D3HObAIy.d.ts.map +0 -1
- package/dist/core-Bl1Ec1hY.js.map +0 -1
- package/dist/development/astro-shared-BT45auwR.js.map +0 -1
- package/dist/development/capabilities-BkQ2i0vV.js.map +0 -1
- package/dist/development/core-DZFaOyTO.js.map +0 -1
- package/dist/development/dom-Dwa2SFTn.js.map +0 -1
- package/dist/development/vite-CSHoxzXU.js.map +0 -1
- package/dist/dom-Cfj3GtQK.js.map +0 -1
- package/dist/vite-CSHoxzXU.js.map +0 -1
|
@@ -171,10 +171,12 @@ function resolveStateToken(token, key) {
|
|
|
171
171
|
}
|
|
172
172
|
function useGetter(token, key) {
|
|
173
173
|
token = resolveStateToken(token, key);
|
|
174
|
-
const
|
|
174
|
+
const root = owner._root;
|
|
175
|
+
const store = root._store;
|
|
175
176
|
const subscribe = (notify) => subscribeToState(store, token, `spa:${serial++}`, notify);
|
|
176
177
|
return () => {
|
|
177
178
|
const value = getFromStore(store, token);
|
|
179
|
+
root._onRead?.(value, token);
|
|
178
180
|
tracking?.(subscribe);
|
|
179
181
|
return value;
|
|
180
182
|
};
|
|
@@ -256,4 +258,4 @@ function isPresent(scope) {
|
|
|
256
258
|
}
|
|
257
259
|
export { useSetter as _, invalidate as a, useTransaction as b, onCleanup as c, plain as d, resolveStateToken as f, useRef as g, useId as h, fail as i, onMount as l, useGetter as m, createScope as n, isPresent as o, untrack as p, dispose as r, observe as s, createRoot as t, owner as u, useStore as v, within as x, useTimeline as y };
|
|
258
260
|
|
|
259
|
-
//# sourceMappingURL=core-
|
|
261
|
+
//# sourceMappingURL=core-DxPiKryn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-DxPiKryn.js","names":[],"sources":["../../src/core.ts"],"sourcesContent":["import type {\n\tReadableFamilyToken,\n\tReadableToken,\n\tRegularAtomFamilyToken,\n\tRegularAtomToken,\n\tSetter,\n\tTimelineFamilyToken,\n\tTimelineManageable,\n\tTimelineToken,\n\tTransactionToken,\n\tViewOf,\n\tWritableFamilyToken,\n\tWritableToken,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tclearTimelineInStore,\n\tfindInStore,\n\tfindTimelineInStore,\n\tgetFromStore,\n\tgetTimelineTransactionAtHead,\n\tIMPLICIT,\n\tsetIntoStore,\n\tsubscribeToState,\n\tsubscribeToTimeline,\n\ttimeTravel,\n\ttimeTravelTransactionGroupInStore,\n\twithdraw,\n} from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type {\n\tExitParticipant,\n\tPresenceCoordinator,\n\tPresenceTarget,\n} from \"./presence.ts\"\n\nexport type Cleanup = () => void\n// A callable interface permits the recursive Children union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Children. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Children\n/** A JSX descriptor for an intrinsic tag, component, or fragment. */\nexport interface SpaElement {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\n/** Renderable content, including nested groups and reactive accessors. */\nexport type Children =\n\t| SpaElement\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Children[]\n\t| Accessor<Children>\nexport interface RootOptions {\n\tcapabilities?: readonly Capability[]\n\tstore?: RootStore\n\tidPrefix?: string\n\tonError?: (error: unknown) => void\n}\nexport interface Scope {\n\t_exiting?: boolean\n\t_exits?: Set<ExitParticipant>\n\t_targets?: Set<PresenceTarget>\n\t_root: Root\n\t_parent?: Scope | undefined\n\t_cleanups: Set<Cleanup | Scope>\n\t_updates: Cleanup[]\n\t_dead: boolean\n}\nexport interface Root extends Scope {\n\t_onRead?: ((value: unknown, token: ReadableToken<unknown>) => void) | undefined\n\t_presence?: PresenceCoordinator\n\t_capabilities: Map<string, Capability>\n\t_store: RootStore\n\t_prefix: string\n\t_id: number\n\t_queue: Set<Cleanup>\n\t_mounts: Cleanup[] | undefined\n\tflush: Cleanup\n\terror: (error: unknown) => void\n}\n\nexport let owner: Scope | undefined\ntype Subscribe = (notify: Cleanup) => Cleanup\nlet tracking: ((subscribe: Subscribe) => void) | undefined\nlet serial = 0\n\nexport function within<T>(scope: Scope, run: () => T): T {\n\tconst previous = owner\n\towner = scope\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\towner = previous\n\t}\n}\nexport function untrack<T>(run: () => T): T {\n\tconst previous = tracking\n\ttracking = undefined\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\ttracking = previous\n\t}\n}\nexport function createScope(parent?: Scope): Scope {\n\tconst child: Scope = {\n\t\t_root: parent?._root as Root,\n\t\t_parent: parent,\n\t\t_cleanups: new Set(),\n\t\t_updates: [],\n\t\t_dead: false,\n\t}\n\tparent?._cleanups.add(child)\n\treturn child\n}\nexport function fail(scope: Scope, error: unknown): never {\n\ttry {\n\t\tdispose(scope)\n\t} catch (cleanup) {\n\t\tthrow new AggregateError([error, cleanup])\n\t}\n\tthrow error\n}\nexport function dispose(scope: Scope): void {\n\tif (scope._dead) return\n\tscope._dead = true\n\tconst errors: unknown[] = []\n\ttry {\n\t\tscope._root._presence?.forget(scope)\n\t} catch (error) {\n\t\terrors.push(error)\n\t}\n\tfor (const cleanup of [...scope._cleanups].reverse()) {\n\t\ttry {\n\t\t\ttypeof cleanup === `function` ? cleanup() : dispose(cleanup)\n\t\t} catch (error) {\n\t\t\terrors.push(error)\n\t\t}\n\t}\n\tscope._parent?._cleanups.delete(scope)\n\tscope._cleanups.clear()\n\tscope._updates.length = 0\n\tif (errors.length) throw new AggregateError(errors)\n}\nexport function invalidate(scope: Scope): void {\n\tfor (const run of scope._updates) enqueue(scope, run)\n\tfor (const child of scope._cleanups)\n\t\tif (typeof child !== `function`) invalidate(child)\n}\nfunction enqueue(scope: Scope, run: Cleanup): void {\n\tif (!isPresent(scope)) return\n\tconst root = scope._root\n\tif (!root._queue.size)\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\troot.flush()\n\t\t\t} catch (error) {\n\t\t\t\troot.error(error)\n\t\t\t}\n\t\t})\n\troot._queue.add(run)\n}\nexport function createRoot(options: RootOptions = {}, server = false): Root {\n\tconst capabilities = new Map<string, Capability>()\n\tfor (const capability of options.capabilities ?? []) {\n\t\tif (capabilities.has(capability.namespace))\n\t\t\tthrow new Error(`spa: duplicate capability ${capability.namespace}`)\n\t\tcapabilities.set(capability.namespace, capability)\n\t}\n\tconst root = {\n\t\t_capabilities: capabilities,\n\t\t_store: options.store ?? IMPLICIT.STORE,\n\t\t_prefix: options.idPrefix ?? `w${serial++}`,\n\t\t_id: 0,\n\t\t...createScope(),\n\t\t_queue: new Set(),\n\t\t_mounts: server ? undefined : [],\n\t} as unknown as Root\n\troot._root = root\n\troot.error =\n\t\toptions.onError ??\n\t\t((error) => {\n\t\t\tthrow error\n\t\t})\n\tfor (const capability of capabilities.values())\n\t\tif (capability.presence) {\n\t\t\tif (root._presence) throw new Error(`spa: multiple presence coordinators`)\n\t\t\troot._presence = capability.presence(root)\n\t\t}\n\troot.flush = () => {\n\t\ttry {\n\t\t\tlet passes = 0\n\t\t\twhile (root._queue.size || root._mounts!.length) {\n\t\t\t\tif (import.meta.env.DEV && ++passes > 100)\n\t\t\t\t\tthrow new Error(`spa: update loop`)\n\t\t\t\tfor (const run of [...root._queue]) if (root._queue.delete(run)) run()\n\t\t\t\tfor (const run of root._mounts!.splice(0)) run()\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfail(root, error)\n\t\t}\n\t}\n\treturn root\n}\n/** Return the atom.io store selected by the current root. */\nexport function useStore(): RootStore {\n\treturn owner!._root._store\n}\nexport function onCleanup(cleanup: Cleanup): void {\n\towner!._cleanups.add(cleanup)\n}\nexport function onMount(run: Cleanup): void {\n\tconst scope = owner!\n\tscope._root._mounts?.push(() => {\n\t\tif (!scope._dead)\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(run)\n\t\t\t})\n\t})\n}\nexport function useId(): string {\n\tconst root = owner!._root\n\treturn `${root._prefix}-${root._id++}`\n}\n\nexport function observe<T>(\n\tscope: Scope,\n\tread: Accessor<T>,\n\tapply: (value: T) => void,\n): void {\n\tconst subscriptions = new Map<Subscribe, Cleanup>()\n\tconst run = () => {\n\t\tif (!isPresent(scope)) return\n\t\tconst used = new Set<Subscribe>()\n\t\tconst previous = tracking\n\t\ttracking = (subscribe) => {\n\t\t\tused.add(subscribe)\n\t\t\tif (!subscriptions.has(subscribe))\n\t\t\t\tsubscriptions.set(\n\t\t\t\t\tsubscribe,\n\t\t\t\t\tsubscribe(() => {\n\t\t\t\t\t\tenqueue(scope, run)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t}\n\t\tlet value: T\n\t\ttry {\n\t\t\tvalue = within(scope, read)\n\t\t} finally {\n\t\t\ttracking = previous\n\t\t\tfor (const [subscribe, unsubscribe] of subscriptions)\n\t\t\t\tif (!used.has(subscribe)) {\n\t\t\t\t\tunsubscribe()\n\t\t\t\t\tsubscriptions.delete(subscribe)\n\t\t\t\t}\n\t\t}\n\t\tuntrack(() => {\n\t\t\tapply(value)\n\t\t})\n\t}\n\tscope._updates.push(run)\n\tscope._cleanups.add(() => {\n\t\tscope._root._queue.delete(run)\n\t\tfor (const unsubscribe of subscriptions.values()) unsubscribe()\n\t})\n\trun()\n}\n\n/** Resolve a fixed family key in the current owner's store. */\nexport function resolveStateToken(token: any, key?: Canonical): any {\n\tconst store = owner!._root._store\n\treturn token.type.endsWith(`_family`) ? findInStore(store, token, key!) : token\n}\n\n/** Capture a token for this instance. Change the component key to change its token. */\nexport function useGetter<T, E = never>(\n\ttoken: ReadableToken<T, any, E>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter<T, K extends Canonical, E = never>(\n\tfamily: ReadableFamilyToken<T, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter(token: any, key?: Canonical): Accessor<any> {\n\ttoken = resolveStateToken(token, key)\n\tconst root = owner!._root\n\tconst store = root._store\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToState(store, token, `spa:${serial++}`, notify)\n\treturn () => {\n\t\tconst value = getFromStore(store, token)\n\t\troot._onRead?.(value, token)\n\t\ttracking?.(subscribe)\n\t\treturn value\n\t}\n}\nexport function useSetter<T>(\n\ttoken: WritableToken<T, any, any>,\n): (value: T | Setter<T>) => void\nexport function useSetter<T, K extends Canonical>(\n\tfamily: WritableFamilyToken<T, K, any>,\n\tkey: NoInfer<K>,\n): (value: T | Setter<T>) => void\nexport function useSetter(token: any, key?: Canonical): (value: any) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = owner!._root._store\n\treturn (value) => {\n\t\tsetIntoStore(store, token, value)\n\t}\n}\nexport function useTransaction<F extends (...args: any[]) => any>(\n\ttoken: TransactionToken<F>,\n): (...args: Parameters<F>) => ReturnType<F> {\n\treturn actUponStore(owner!._root._store, token, `spa:${serial++}`)\n}\n\nconst refs = new WeakMap<RootStore, Map<string, object>>()\nexport function useRef<E extends Element>(\n\ttoken: RegularAtomToken<E | null>,\n): (element: E | null) => void\nexport function useRef<E extends Element, K extends Canonical>(\n\tfamily: RegularAtomFamilyToken<E | null, K>,\n\tkey: NoInfer<K>,\n): (element: E | null) => void\nexport function useRef<E extends Element>(\n\ttoken: any,\n\tkey?: Canonical,\n): (element: E | null) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = owner!._root._store\n\tconst owners = refs.get(store) ?? new Map<string, object>()\n\trefs.set(store, owners)\n\tconst identity = {}\n\tlet held: E | null = null\n\treturn (element) => {\n\t\tif (element) {\n\t\t\theld = element\n\t\t\towners.set(token.key, identity)\n\t\t\tsetIntoStore(store, token, element)\n\t\t} else if (owners.get(token.key) === identity) {\n\t\t\towners.delete(token.key)\n\t\t\tif (getFromStore(store, token) === held) setIntoStore(store, token, null)\n\t\t\theld = null\n\t\t}\n\t}\n}\nexport interface TimelineControls {\n\tgetCursor(): number\n\tgetLength(): number\n\tundo(): void\n\tredo(): void\n\tclear(): void\n\tgetTransaction(): { undo?: Cleanup; redo?: Cleanup }\n}\nexport function useTimeline<M extends TimelineManageable>(\n\ttoken: TimelineToken<M>,\n): TimelineControls\nexport function useTimeline<K extends Canonical, M extends TimelineManageable>(\n\tfamily: TimelineFamilyToken<K, M>,\n\tkey: NoInfer<K>,\n): TimelineControls\nexport function useTimeline(token: any, key?: Canonical): TimelineControls {\n\tconst store = owner!._root._store\n\tconst selected: TimelineToken<any> =\n\t\ttoken.type === `timeline_family`\n\t\t\t? findTimelineInStore(store, token, key!)\n\t\t\t: token\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToTimeline(store, selected, `spa:${serial++}`, notify)\n\tconst read = () => {\n\t\tconst timeline = withdraw(store, selected)\n\t\ttracking?.(subscribe)\n\t\treturn timeline\n\t}\n\treturn {\n\t\tgetCursor: () => read().at,\n\t\tgetLength: () => read().history.length,\n\t\tundo: () => {\n\t\t\ttimeTravel(store, `undo`, selected)\n\t\t},\n\t\tredo: () => {\n\t\t\ttimeTravel(store, `redo`, selected)\n\t\t},\n\t\tclear: () => {\n\t\t\tclearTimelineInStore(store, selected)\n\t\t},\n\t\tgetTransaction: () => {\n\t\t\tconst timeline = read()\n\t\t\tconst controls: ReturnType<TimelineControls[`getTransaction`]> = {}\n\t\t\tfor (const direction of [`undo`, `redo`] as const) {\n\t\t\t\tconst group = getTimelineTransactionAtHead(timeline, direction)\n\t\t\t\tif (group)\n\t\t\t\t\tcontrols[direction] = () => {\n\t\t\t\t\t\ttimeTravelTransactionGroupInStore(store, direction, group)\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn controls\n\t\t},\n\t}\n}\n\nexport function plain(value: Children): string {\n\tif (typeof value === `function`) return plain(value())\n\tif (Array.isArray(value)) return value.map(plain).join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (import.meta.env.DEV && typeof value === `object`)\n\t\tthrow new Error(`spa: text required`)\n\t// oxlint-disable-next-line typescript/no-base-to-string -- Valid text children are primitives here; development rejects malformed object children.\n\treturn String(value)\n}\n\nexport function isPresent(scope: Scope): boolean {\n\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\tif (at._dead || at._exiting) return false\n\treturn true\n}\n"],"mappings":";;AA4FA,IAAW;AAEX,IAAI;AACJ,IAAI,SAAS;AAEb,SAAgB,OAAU,OAAc,KAAiB;CACxD,MAAM,WAAW;CACjB,QAAQ;CACR,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,QAAQ;CACT;AACD;AACA,SAAgB,QAAW,KAAiB;CAC3C,MAAM,WAAW;CACjB,WAAW,KAAA;CACX,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,WAAW;CACZ;AACD;AACA,SAAgB,YAAY,QAAuB;CAClD,MAAM,QAAe;EACpB,OAAO,QAAQ;EACf,SAAS;EACT,2BAAW,IAAI,IAAI;EACnB,UAAU,CAAC;EACX,OAAO;CAC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AAW,OAAO,QAAQ,QAAQ;EACnC;EACA,YAAY;GACX,WAAW,OAAO,QAAQ,QAAQ;EACnC;EACA,aAAa;GACZ,qBAAqB,OAAO,QAAQ;EACrC;EACA,sBAAsB;GACrB,MAAM,WAAW,KAAK;GACtB,MAAM,WAA2D,CAAC;GAClE,KAAK,MAAM,aAAa,CAAC,QAAQ,MAAM,GAAY;IAClD,MAAM,QAAQ,6BAA6B,UAAU,SAAS;IAC9D,IAAI,OACH,SAAS,mBAAmB;KAC3B,kCAAkC,OAAO,WAAW,KAAK;IAC1D;GACF;GACA,OAAO;EACR;CACD;AACD;AAEA,SAAgB,MAAM,OAAyB;CAC9C,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAAC;CACrD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE;CACzD,IAAI,SAAS,QAAQ,OAAO,UAAU,WAAW,OAAO;CACxD,IAA2B,OAAO,UAAU,UAC3C,MAAM,IAAI,MAAM,oBAAoB;CAErC,OAAO,OAAO,KAAK;AACpB;AAEA,SAAgB,UAAU,OAAuB;CAChD,KAAK,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
import { n as capabilityProps } from "./capabilities-
|
|
2
|
-
import { a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot, x as within } from "./core-
|
|
1
|
+
import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
|
|
2
|
+
import { a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot, x as within } from "./core-DxPiKryn.js";
|
|
3
3
|
import { Fragment, merge } from "./jsx-runtime.js";
|
|
4
4
|
// src/dom.ts
|
|
5
5
|
const HTML = `http://www.w3.org/1999/xhtml`;
|
|
6
6
|
const SVG = `http://www.w3.org/2000/svg`;
|
|
7
|
+
function finish(cursor) {
|
|
8
|
+
if (cursor?.node) {
|
|
9
|
+
cursor.report(null, cursor.node);
|
|
10
|
+
while (cursor.node) {
|
|
11
|
+
const node = cursor.node;
|
|
12
|
+
cursor.node = node.nextSibling;
|
|
13
|
+
node.remove();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
7
17
|
function take(node, parent, before, owner, cursor) {
|
|
8
18
|
if (cursor && !(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)) {
|
|
9
19
|
const found = cursor.node;
|
|
10
|
-
if (!found || found.nodeType !== node.nodeType || found.nodeName !== node.nodeName || found.namespaceURI !== node.namespaceURI || node.nodeType !== 1 && found.nodeValue !== node.nodeValue)
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
if (!found || found.nodeType !== node.nodeType || found.nodeName !== node.nodeName || found.namespaceURI !== node.namespaceURI || node.nodeType !== 1 && found.nodeValue !== node.nodeValue) {
|
|
21
|
+
cursor.report(node, found);
|
|
22
|
+
parent.insertBefore(node, found);
|
|
23
|
+
cursor.node = found?.nextSibling ?? null;
|
|
24
|
+
found?.remove();
|
|
25
|
+
} else {
|
|
26
|
+
node = found;
|
|
27
|
+
cursor.node = found.nextSibling;
|
|
28
|
+
}
|
|
13
29
|
} else parent.insertBefore(node, cursor ? cursor.node : before);
|
|
14
30
|
owner._cleanups.add(() => {
|
|
15
31
|
node.remove();
|
|
@@ -142,20 +158,19 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
142
158
|
if (element.textContent !== text) element.textContent = text;
|
|
143
159
|
});
|
|
144
160
|
else {
|
|
145
|
-
const children = cursor ? {
|
|
161
|
+
const children = cursor ? {
|
|
162
|
+
node: element.firstChild,
|
|
163
|
+
report: cursor.report
|
|
164
|
+
} : void 0;
|
|
146
165
|
if (!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(vnode.type) || ns !== HTML) mount(() => props[`children`], element, null, owner, vnode.type === `foreignObject` ? HTML : ns, children);
|
|
147
|
-
|
|
166
|
+
finish(children);
|
|
148
167
|
}
|
|
168
|
+
let previous = {};
|
|
149
169
|
const nativeProps = capabilityProps(owner, {
|
|
150
170
|
kind: `dom`,
|
|
151
171
|
node: element
|
|
152
|
-
}, () => ({ ...props }))
|
|
153
|
-
|
|
154
|
-
owner._cleanups.add(() => {
|
|
155
|
-
for (const key in previous) if (key.startsWith(`on`)) property(element, key, null, previous[key]);
|
|
156
|
-
});
|
|
157
|
-
observe(owner, () => ({ ...props }), (all) => {
|
|
158
|
-
const next = nativeProps(all);
|
|
172
|
+
}, () => ({ ...props }), (next) => {
|
|
173
|
+
const previousStyle = previous[`style`] !== next[`style`] ? element.getAttribute(`style`) ?? `` : void 0;
|
|
159
174
|
for (const key in {
|
|
160
175
|
...previous,
|
|
161
176
|
...next
|
|
@@ -164,7 +179,12 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
164
179
|
previous[key] = next[key];
|
|
165
180
|
}
|
|
166
181
|
previous = next;
|
|
182
|
+
return previousStyle;
|
|
167
183
|
});
|
|
184
|
+
owner._cleanups.add(() => {
|
|
185
|
+
for (const key in previous) if (key.startsWith(`on`)) property(element, key, null, previous[key]);
|
|
186
|
+
});
|
|
187
|
+
observe(owner, () => ({ ...props }), nativeProps);
|
|
168
188
|
const ref = untrack(() => props[`ref`]);
|
|
169
189
|
if (ref) owner._root._mounts.unshift(() => {
|
|
170
190
|
if (!owner._dead) {
|
|
@@ -174,18 +194,31 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
174
194
|
});
|
|
175
195
|
}
|
|
176
196
|
function start(setup, host, options, hydrating) {
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
197
|
+
let reported = false;
|
|
198
|
+
const cursor = hydrating ? {
|
|
199
|
+
node: host.firstChild,
|
|
200
|
+
report(expected, found) {
|
|
201
|
+
if (!reported) {
|
|
202
|
+
reported = true;
|
|
203
|
+
console.warn(`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`, {
|
|
204
|
+
host,
|
|
205
|
+
expected,
|
|
206
|
+
found
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} : void 0;
|
|
211
|
+
const marker = cursor?.node;
|
|
212
|
+
const prefix = marker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`) ? marker.nodeValue.slice(2) : void 0;
|
|
180
213
|
const root = createRoot(options);
|
|
181
|
-
if (prefix !== void 0) root._prefix = prefix;
|
|
214
|
+
if (prefix !== void 0 && options.idPrefix === void 0) root._prefix = prefix;
|
|
182
215
|
try {
|
|
183
216
|
comment(`w:${root._prefix}`, host, null, root, cursor);
|
|
184
217
|
within(root, () => {
|
|
185
218
|
mount(untrack(setup), host, null, root, host.namespaceURI === SVG ? SVG : HTML, cursor);
|
|
186
219
|
});
|
|
187
220
|
comment(`/w`, host, null, root, cursor);
|
|
188
|
-
|
|
221
|
+
finish(cursor);
|
|
189
222
|
root.flush();
|
|
190
223
|
} catch (error) {
|
|
191
224
|
fail(root, error);
|
|
@@ -205,4 +238,4 @@ function hydrate(setup, host, options = {}) {
|
|
|
205
238
|
}
|
|
206
239
|
export { render as n, hydrate as t };
|
|
207
240
|
|
|
208
|
-
//# sourceMappingURL=dom-
|
|
241
|
+
//# sourceMappingURL=dom-BWy4dDss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-BWy4dDss.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EAC7B;CACD;AACD;AAEA,SAAS,KACR,MACA,QACA,QACA,OACA,QACO;CACP,IACC,UACA,EAAE,KAAK,aAAa,KAAK,CAAC,KAAK,aAAa,OAAO,MAAM,aAAa,IACrE;EACD,MAAM,QAAQ,OAAO;EACrB,IACC,CAAC,SACD,MAAM,aAAa,KAAK,YACxB,MAAM,aAAa,KAAK,YACvB,MAAkB,iBAAkB,KAAiB,gBACrD,KAAK,aAAa,KAAK,MAAM,cAAc,KAAK,WAChD;GACD,OAAO,OAAO,MAAM,KAAK;GACzB,OAAO,aAAa,MAAM,KAAK;GAC/B,OAAO,OAAO,OAAO,eAAe;GACnC,OAA6B,OAAO;EACtC,OAAO;GACN,OAAO;GACP,OAAO,OAAO,MAAM;EACrB;CACD,OAAO,OAAO,aAAa,MAAM,SAAS,OAAO,OAAO,MAAM;CAC9D,MAAM,UAAU,UAAU;EACxB,KAAoB,OAAO;CAC7B,CAAC;CACD,OAAO;AACR;AACA,SAAS,QACR,OACA,QACA,QACA,OACA,QACO;CACP,OAAO,KACN,OAAO,cAAe,cAAc,KAAK,GACzC,QACA,QACA,OACA,MACD;AACD;AACA,SAAS,SACR,SACA,KACA,OACA,UACO;CACP,IAAI,uB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aAAa,KAAA,GAChD,KAAK,UAAU;CAChB,IAAI;EACH,QAAQ,KAAK,KAAK,WAAW,MAAM,MAAM,MAAM,MAAM;EACrD,OAAO,YAAY;GAClB,MACC,QAAQ,KAAK,GACb,MACA,MACA,MACA,KAAK,iBAAiB,MAAM,MAAM,MAClC,MACD;EACD,CAAC;EACD,QAAQ,MAAM,MAAM,MAAM,MAAM,MAAM;EACtC,OAAO,MAAM;EACb,KAAK,MAAM;CACZ,SAAS,OAAO;EACf,KAAK,MAAM,KAAK;CACjB;CACA,OAAO;EACN,eAAe;GACd,QAAQ,IAAI;EACb;EACA,OAAO,KAAK;CACb;AACD;AACA,SAAgB,OACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,KAAK;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { i as fail, l as onMount, x as within } from "./core-DxPiKryn.js";
|
|
2
|
+
import { autoUpdate, computePosition } from "@floating-ui/dom";
|
|
3
|
+
// src/floating.ts
|
|
4
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
5
|
+
`reference`,
|
|
6
|
+
`placement`,
|
|
7
|
+
`strategy`,
|
|
8
|
+
`middleware`,
|
|
9
|
+
`enabled`,
|
|
10
|
+
`autoUpdate`
|
|
11
|
+
]);
|
|
12
|
+
const observerKeys = [
|
|
13
|
+
`ancestorScroll`,
|
|
14
|
+
`ancestorResize`,
|
|
15
|
+
`elementResize`,
|
|
16
|
+
`layoutShift`,
|
|
17
|
+
`animationFrame`
|
|
18
|
+
];
|
|
19
|
+
const ownedStyles = [
|
|
20
|
+
`position`,
|
|
21
|
+
`left`,
|
|
22
|
+
`top`,
|
|
23
|
+
`translate`,
|
|
24
|
+
`visibility`
|
|
25
|
+
];
|
|
26
|
+
function attach(target, scope) {
|
|
27
|
+
const element = target.node;
|
|
28
|
+
if (target.kind !== `dom` || element?.namespaceURI !== `http://www.w3.org/1999/xhtml`) throw new Error(`spa/floating: floating elements must be HTML elements`);
|
|
29
|
+
let props = {};
|
|
30
|
+
let dead = false;
|
|
31
|
+
let mounted = false;
|
|
32
|
+
let generation = 0;
|
|
33
|
+
let request = 0;
|
|
34
|
+
let stop;
|
|
35
|
+
let reference;
|
|
36
|
+
let observing;
|
|
37
|
+
let original;
|
|
38
|
+
let positioned = false;
|
|
39
|
+
let translation = ``;
|
|
40
|
+
const restore = () => {
|
|
41
|
+
if (!original) return;
|
|
42
|
+
for (const [key, style] of original) if (style.value) element.style.setProperty(key, style.value, style.priority);
|
|
43
|
+
else element.style.removeProperty(key);
|
|
44
|
+
original = void 0;
|
|
45
|
+
positioned = false;
|
|
46
|
+
translation = ``;
|
|
47
|
+
};
|
|
48
|
+
const disconnect = () => {
|
|
49
|
+
++generation;
|
|
50
|
+
stop?.();
|
|
51
|
+
stop = void 0;
|
|
52
|
+
reference = void 0;
|
|
53
|
+
};
|
|
54
|
+
const report = (error) => {
|
|
55
|
+
if (!scope) {
|
|
56
|
+
queueMicrotask(() => {
|
|
57
|
+
throw error;
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
fail(scope._root, error);
|
|
63
|
+
} catch (failure) {
|
|
64
|
+
scope._root.error(failure);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const updatePosition = () => {
|
|
68
|
+
const anchor = reference;
|
|
69
|
+
if (dead || !anchor) return;
|
|
70
|
+
const currentGeneration = generation;
|
|
71
|
+
const currentRequest = ++request;
|
|
72
|
+
computePosition(anchor, element, {
|
|
73
|
+
placement: props.placement ?? `bottom`,
|
|
74
|
+
strategy: props.strategy ?? `absolute`,
|
|
75
|
+
middleware: props.middleware ? [...props.middleware] : []
|
|
76
|
+
}).then(({ x, y }) => {
|
|
77
|
+
if (dead || generation !== currentGeneration || currentRequest !== request) return;
|
|
78
|
+
translation = `${x}px ${y}px`;
|
|
79
|
+
element.style.setProperty(`translate`, translation);
|
|
80
|
+
if (!positioned) {
|
|
81
|
+
positioned = true;
|
|
82
|
+
const visibility = original.get(`visibility`);
|
|
83
|
+
if (visibility.value) element.style.setProperty(`visibility`, visibility.value, visibility.priority);
|
|
84
|
+
else element.style.removeProperty(`visibility`);
|
|
85
|
+
}
|
|
86
|
+
}, (error) => {
|
|
87
|
+
if (!dead && generation === currentGeneration && currentRequest === request) report(error);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const connect = () => {
|
|
91
|
+
if (dead || !mounted) return;
|
|
92
|
+
const nextReference = props.enabled === false ? void 0 : props.reference ?? void 0;
|
|
93
|
+
const nextObserving = props.autoUpdate ?? true;
|
|
94
|
+
const optionsChanged = typeof nextObserving !== typeof observing || (typeof nextObserving === `object` && typeof observing === `object` ? observerKeys.some((key) => nextObserving[key] !== observing[key]) : nextObserving !== observing);
|
|
95
|
+
const reconnect = nextReference !== reference || optionsChanged;
|
|
96
|
+
if (reconnect) disconnect();
|
|
97
|
+
if (!nextReference) {
|
|
98
|
+
restore();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
original ??= new Map(ownedStyles.map((key) => [key, {
|
|
102
|
+
value: element.style.getPropertyValue(key),
|
|
103
|
+
priority: element.style.getPropertyPriority(key)
|
|
104
|
+
}]));
|
|
105
|
+
element.style.setProperty(`position`, props.strategy ?? `absolute`);
|
|
106
|
+
element.style.setProperty(`left`, `0px`);
|
|
107
|
+
element.style.setProperty(`top`, `0px`);
|
|
108
|
+
if (positioned) element.style.setProperty(`translate`, translation);
|
|
109
|
+
else element.style.setProperty(`visibility`, `hidden`, `important`);
|
|
110
|
+
reference = nextReference;
|
|
111
|
+
observing = typeof nextObserving === `object` ? { ...nextObserving } : nextObserving;
|
|
112
|
+
if (reconnect && nextObserving !== false) stop = autoUpdate(nextReference, element, updatePosition, typeof nextObserving === `object` ? nextObserving : void 0);
|
|
113
|
+
else updatePosition();
|
|
114
|
+
};
|
|
115
|
+
const mount = () => {
|
|
116
|
+
if (dead) return;
|
|
117
|
+
mounted = true;
|
|
118
|
+
connect();
|
|
119
|
+
};
|
|
120
|
+
if (scope) within(scope, () => {
|
|
121
|
+
onMount(mount);
|
|
122
|
+
});
|
|
123
|
+
else queueMicrotask(mount);
|
|
124
|
+
return {
|
|
125
|
+
update(next) {
|
|
126
|
+
if (dead) return;
|
|
127
|
+
for (const key of Object.keys(next)) if (!allowed.has(key)) throw new Error(`spa/floating: unknown property floating:${key}`);
|
|
128
|
+
props = next;
|
|
129
|
+
connect();
|
|
130
|
+
},
|
|
131
|
+
dispose() {
|
|
132
|
+
if (dead) return;
|
|
133
|
+
dead = true;
|
|
134
|
+
disconnect();
|
|
135
|
+
restore();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** Position HTML overlays using CSS translate, leaving transform available to Motion. */
|
|
140
|
+
function floatingCapability() {
|
|
141
|
+
return {
|
|
142
|
+
namespace: `floating`,
|
|
143
|
+
attach
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export { floatingCapability };
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=floating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating.js","names":[],"sources":["../../src/floating.ts"],"sourcesContent":["import type {\n\tAutoUpdateOptions,\n\tMiddleware,\n\tPlacement,\n\tReferenceElement,\n\tStrategy,\n} from \"@floating-ui/dom\"\nimport { autoUpdate, computePosition } from \"@floating-ui/dom\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Scope } from \"./core.ts\"\nimport { fail, onMount, within } from \"./core.ts\"\n\nexport interface FloatingAttributes<Kind extends string = `dom`> {\n\t[`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never\n\t[`floating:placement`]?: Kind extends `dom` ? Placement : never\n\t[`floating:strategy`]?: Kind extends `dom` ? Strategy : never\n\t[`floating:middleware`]?: Kind extends `dom` ? readonly Middleware[] : never\n\t[`floating:enabled`]?: Kind extends `dom` ? boolean : never\n\t[`floating:autoUpdate`]?: Kind extends `dom`\n\t\t? boolean | AutoUpdateOptions\n\t\t: never\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 supplies optional floating attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends FloatingAttributes<Kind> {}\n}\n\ninterface FloatingProps {\n\treference?: ReferenceElement | null\n\tplacement?: Placement\n\tstrategy?: Strategy\n\tmiddleware?: readonly Middleware[]\n\tenabled?: boolean\n\tautoUpdate?: boolean | AutoUpdateOptions\n}\nconst allowed = new Set([\n\t`reference`,\n\t`placement`,\n\t`strategy`,\n\t`middleware`,\n\t`enabled`,\n\t`autoUpdate`,\n])\nconst observerKeys = [\n\t`ancestorScroll`,\n\t`ancestorResize`,\n\t`elementResize`,\n\t`layoutShift`,\n\t`animationFrame`,\n] as const\nconst ownedStyles = [\n\t`position`,\n\t`left`,\n\t`top`,\n\t`translate`,\n\t`visibility`,\n] as const\n\nfunction attach(target: CapabilityTarget, scope?: Scope): CapabilityBinding {\n\tconst element = target.node as HTMLElement\n\tif (\n\t\ttarget.kind !== `dom` ||\n\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml`\n\t)\n\t\tthrow new Error(`spa/floating: floating elements must be HTML elements`)\n\tlet props: FloatingProps = {}\n\tlet dead = false\n\tlet mounted = false\n\tlet generation = 0\n\tlet request = 0\n\tlet stop: (() => void) | undefined\n\tlet reference: ReferenceElement | undefined\n\tlet observing: boolean | AutoUpdateOptions | undefined\n\tlet original: Map<string, { value: string; priority: string }> | undefined\n\tlet positioned = false\n\tlet translation = ``\n\n\tconst restore = () => {\n\t\tif (!original) return\n\t\tfor (const [key, style] of original) {\n\t\t\tif (style.value)\n\t\t\t\telement.style.setProperty(key, style.value, style.priority)\n\t\t\telse element.style.removeProperty(key)\n\t\t}\n\t\toriginal = undefined\n\t\tpositioned = false\n\t\ttranslation = ``\n\t}\n\tconst disconnect = () => {\n\t\t++generation\n\t\tstop?.()\n\t\tstop = undefined\n\t\treference = undefined\n\t}\n\tconst report = (error: unknown) => {\n\t\tif (!scope) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tfail(scope._root, error)\n\t\t} catch (failure) {\n\t\t\tscope._root.error(failure)\n\t\t}\n\t}\n\tconst updatePosition = () => {\n\t\tconst anchor = reference\n\t\tif (dead || !anchor) return\n\t\tconst currentGeneration = generation\n\t\tconst currentRequest = ++request\n\t\tvoid computePosition(anchor, element, {\n\t\t\tplacement: props.placement ?? `bottom`,\n\t\t\tstrategy: props.strategy ?? `absolute`,\n\t\t\tmiddleware: props.middleware ? [...props.middleware] : [],\n\t\t}).then(\n\t\t\t({ x, y }) => {\n\t\t\t\tif (\n\t\t\t\t\tdead ||\n\t\t\t\t\tgeneration !== currentGeneration ||\n\t\t\t\t\tcurrentRequest !== request\n\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\ttranslation = `${x}px ${y}px`\n\t\t\t\telement.style.setProperty(`translate`, translation)\n\t\t\t\tif (!positioned) {\n\t\t\t\t\tpositioned = true\n\t\t\t\t\tconst visibility = original!.get(`visibility`)!\n\t\t\t\t\tif (visibility.value)\n\t\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\t\t`visibility`,\n\t\t\t\t\t\t\tvisibility.value,\n\t\t\t\t\t\t\tvisibility.priority,\n\t\t\t\t\t\t)\n\t\t\t\t\telse element.style.removeProperty(`visibility`)\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tif (\n\t\t\t\t\t!dead &&\n\t\t\t\t\tgeneration === currentGeneration &&\n\t\t\t\t\tcurrentRequest === request\n\t\t\t\t)\n\t\t\t\t\treport(error)\n\t\t\t},\n\t\t)\n\t}\n\tconst connect = () => {\n\t\tif (dead || !mounted) return\n\t\tconst nextReference =\n\t\t\tprops.enabled === false ? undefined : (props.reference ?? undefined)\n\t\tconst nextObserving = props.autoUpdate ?? true\n\t\tconst optionsChanged =\n\t\t\ttypeof nextObserving !== typeof observing ||\n\t\t\t(typeof nextObserving === `object` && typeof observing === `object`\n\t\t\t\t? observerKeys.some(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tnextObserving[key] !== (observing as AutoUpdateOptions)[key],\n\t\t\t\t\t)\n\t\t\t\t: nextObserving !== observing)\n\t\tconst reconnect = nextReference !== reference || optionsChanged\n\t\tif (reconnect) disconnect()\n\t\tif (!nextReference) {\n\t\t\trestore()\n\t\t\treturn\n\t\t}\n\t\toriginal ??= new Map(\n\t\t\townedStyles.map((key) => [\n\t\t\t\tkey,\n\t\t\t\t{\n\t\t\t\t\tvalue: element.style.getPropertyValue(key),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(key),\n\t\t\t\t},\n\t\t\t]),\n\t\t)\n\t\telement.style.setProperty(`position`, props.strategy ?? `absolute`)\n\t\telement.style.setProperty(`left`, `0px`)\n\t\telement.style.setProperty(`top`, `0px`)\n\t\tif (positioned) element.style.setProperty(`translate`, translation)\n\t\telse element.style.setProperty(`visibility`, `hidden`, `important`)\n\t\treference = nextReference\n\t\tobserving =\n\t\t\ttypeof nextObserving === `object` ? { ...nextObserving } : nextObserving\n\t\tif (reconnect && nextObserving !== false) {\n\t\t\tstop = autoUpdate(\n\t\t\t\tnextReference,\n\t\t\t\telement,\n\t\t\t\tupdatePosition,\n\t\t\t\ttypeof nextObserving === `object` ? nextObserving : undefined,\n\t\t\t)\n\t\t} else updatePosition()\n\t}\n\tconst mount = () => {\n\t\tif (dead) return\n\t\tmounted = true\n\t\tconnect()\n\t}\n\tif (scope)\n\t\twithin(scope, () => {\n\t\t\tonMount(mount)\n\t\t})\n\telse queueMicrotask(mount)\n\treturn {\n\t\tupdate(next) {\n\t\t\tif (dead) return\n\t\t\tfor (const key of Object.keys(next))\n\t\t\t\tif (!allowed.has(key))\n\t\t\t\t\tthrow new Error(`spa/floating: unknown property floating:${key}`)\n\t\t\tprops = next\n\t\t\tconnect()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tdisconnect()\n\t\t\trestore()\n\t\t},\n\t}\n}\n\n/** Position HTML overlays using CSS translate, leaving transform available to Motion. */\nexport function floatingCapability(): Capability {\n\treturn { namespace: `floating`, attach }\n}\n"],"mappings":";;;AA4CA,MAAM,0BAAU,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;AACD;AAEA,SAAS,OAAO,QAA0B,OAAkC;CAC3E,MAAM,UAAU,OAAO;CACvB,IACC,OAAO,SAAS,SAChB,SAAS,iBAAiB,gCAE1B,MAAM,IAAI,MAAM,uDAAuD;CACxE,IAAI,QAAuB,CAAC;CAC5B,IAAI,OAAO;CACX,IAAI,UAAU;CACd,IAAI,aAAa;CACjB,IAAI,UAAU;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,aAAa;CACjB,IAAI,cAAc;CAElB,MAAM,gBAAgB;EACrB,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,CAAC,KAAK,UAAU,UAC1B,IAAI,MAAM,OACT,QAAQ,MAAM,YAAY,KAAK,MAAM,OAAO,MAAM,QAAQ;OACtD,QAAQ,MAAM,eAAe,GAAG;EAEtC,WAAW,KAAA;EACX,aAAa;EACb,cAAc;CACf;CACA,MAAM,mBAAmB;EACxB,EAAE;EACF,OAAO;EACP,OAAO,KAAA;EACP,YAAY,KAAA;CACb;CACA,MAAM,UAAU,UAAmB;EAClC,IAAI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AAQ;GACR;EACD;EACA,aAAa,IAAI,IAChB,YAAY,KAAK,QAAQ,CACxB,KACA;GACC,OAAO,QAAQ,MAAM,iBAAiB,GAAG;GACzC,UAAU,QAAQ,MAAM,oBAAoB,GAAG;EAChD,CACD,CAAC,CACF;EACA,QAAQ,MAAM,YAAY,YAAY,MAAM,YAAY,UAAU;EAClE,QAAQ,MAAM,YAAY,QAAQ,KAAK;EACvC,QAAQ,MAAM,YAAY,OAAO,KAAK;EACtC,IAAI,YAAY,QAAQ,MAAM,YAAY,aAAa,WAAW;OAC7D,QAAQ,MAAM,YAAY,cAAc,UAAU,WAAW;EAClE,YAAY;EACZ,YACC,OAAO,kBAAkB,WAAW,EAAE,GAAG,cAAc,IAAI;EAC5D,IAAI,aAAa,kBAAkB,OAClC,OAAO,WACN,eACA,SACA,gBACA,OAAO,kBAAkB,WAAW,gBAAgB,KAAA,CACrD;OACM,eAAe;CACvB;CACA,MAAM,cAAc;EACnB,IAAI,MAAM;EACV,UAAU;EACV,QAAQ;CACT;CACA,IAAI,OACH,OAAO,aAAa;EACnB,QAAQ,KAAK;CACd,CAAC;MACG,eAAe,KAAK;CACzB,OAAO;EACN,OAAO,MAAM;GACZ,IAAI,MAAM;GACV,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,GACnB,MAAM,IAAI,MAAM,2CAA2C,KAAK;GAClE,QAAQ;GACR,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACD;AACD;;AAGA,SAAgB,qBAAiC;CAChD,OAAO;EAAE,WAAW;EAAY;CAAO;AACxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as useSetter, b as useTransaction, c as onCleanup, g as useRef, h as useId, l as onMount, m as useGetter, v as useStore, y as useTimeline } from "./core-
|
|
1
|
+
import { _ as useSetter, b as useTransaction, c as onCleanup, g as useRef, h as useId, l as onMount, m as useGetter, v as useStore, y as useTimeline } from "./core-DxPiKryn.js";
|
|
2
2
|
import { Fragment } from "./jsx-runtime.js";
|
|
3
|
-
import { n as render, t as hydrate } from "./dom-
|
|
4
|
-
import { t as useLoadable } from "./src-
|
|
3
|
+
import { n as render, t as hydrate } from "./dom-BWy4dDss.js";
|
|
4
|
+
import { t as useLoadable } from "./src-WSHJxR9b.js";
|
|
5
5
|
export { Fragment, hydrate, onCleanup, onMount, render, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
|
|
@@ -14,10 +14,10 @@ function merge(...sources) {
|
|
|
14
14
|
return new Proxy({}, {
|
|
15
15
|
get: (_, key) => values().reverse().find((source) => Object.hasOwn(source, key))?.[key],
|
|
16
16
|
ownKeys: () => [...new Set(values().flatMap(Object.keys))],
|
|
17
|
-
getOwnPropertyDescriptor: () => ({
|
|
17
|
+
getOwnPropertyDescriptor: (_, key) => values().some((source) => Object.hasOwn(source, key)) ? {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
configurable: true
|
|
20
|
-
}
|
|
20
|
+
} : void 0
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
export { Fragment, jsx, jsxDEV, jsxs, merge };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["import type { Children, Component, SpaElement } from \"./core.ts\"\nimport type { HTMLAttributes, NativeElements } from \"./jsx-types.d.ts\"\n\nexport type {\n\tAriaAttributes,\n\tDOMAttributes,\n\tEventAttributes,\n\tEventHandler,\n\tHTMLAttributes,\n\tRef,\n\tSVGAttributes,\n\tTargetedEvent,\n} from \"./jsx-types.d.ts\"\n\n/** Optional integrations augment attributes without changing element identity. */\n// oxlint-disable-next-line typescript/no-empty-interface -- Optional integrations augment this declaration.\nexport interface CapabilityAttributes<Kind extends string = string> {}\n\nexport const Fragment = (props: { children?: Children }): Children =>\n\tprops.children\nexport function jsx(\n\ttype: SpaElement[`type`],\n\tprops: SpaElement[`props`] | null,\n\tkey?: unknown,\n): SpaElement {\n\treturn {\n\t\ttype,\n\t\tprops: key === undefined ? (props ?? {}) : merge(props ?? {}, { key }),\n\t}\n}\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\n/** Preserve lazy props and spread precedence, including keys added by later updates. */\nexport function merge(\n\t...sources: (Record<string, any> | (() => Record<string, any>))[]\n): Record<string, any> {\n\tconst values = () =>\n\t\tsources.map(\n\t\t\t(source) => (typeof source === `function` ? source() : source) ?? {},\n\t\t)\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, key) =>\n\t\t\t\tvalues()\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.find((source) => Object.hasOwn(source, key))?.[key],\n\t\t\townKeys: () => [...new Set(values().flatMap(Object.keys))],\n\t\t\tgetOwnPropertyDescriptor: (_, key) =>\n\t\t\t\tvalues().some((source) => Object.hasOwn(source, key))\n\t\t\t\t\t? { enumerable: true, configurable: true }\n\t\t\t\t\t: undefined,\n\t\t},\n\t)\n}\n\nexport namespace JSX {\n\texport type Element = SpaElement\n\texport type ElementType = keyof IntrinsicElements | Component\n\texport interface ElementChildrenAttribute {\n\t\tchildren: {}\n\t}\n\texport interface IntrinsicAttributes {\n\t\tkey?: string | number\n\t}\n\t/** Augment this interface to declare attributes for registered custom elements. */\n\texport interface IntrinsicElements extends NativeElements {\n\t\t[tag: `${string}-${string}`]: HTMLAttributes<HTMLElement>\n\t}\n}\n"],"mappings":";AAkBA,MAAa,YAAY,UACxB,MAAM;AACP,SAAgB,IACf,MACA,OACA,KACa;CACb,OAAO;EACN;EACA,OAAO,QAAQ,KAAA,IAAa,SAAS,CAAC,IAAK,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;CACtE;AACD;AACA,MAAa,OAAO;AACpB,MAAa,SAAS;;AAGtB,SAAgB,MACf,GAAG,SACmB;CACtB,MAAM,eACL,QAAQ,KACN,YAAY,OAAO,WAAW,aAAa,OAAO,IAAI,WAAW,CAAC,CACpE;CACD,OAAO,IAAI,MACV,CAAC,GACD;EACC,MAAM,GAAG,QACR,OAAO,CAAC,CACN,QAAQ,CAAC,CACT,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,CAAC,GAAG;EAClD,eAAe,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC;EACzD,2BAA2B,GAAG,QAC7B,OAAO,CAAC,CAAC,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,IACjD;GAAE,YAAY;GAAM,cAAc;EAAK,IACvC,KAAA;CACL,CACD;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as capabilityProps } from "./capabilities-
|
|
2
|
-
import { c as onCleanup, l as onMount, u as owner } from "./core-
|
|
1
|
+
import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
|
|
2
|
+
import { c as onCleanup, l as onMount, u as owner } from "./core-DxPiKryn.js";
|
|
3
3
|
import { jsx } from "./jsx-runtime.js";
|
|
4
4
|
import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
|
|
5
5
|
import Konva from "konva";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"konva.js","names":[],"sources":["../../src/konva.ts"],"sourcesContent":["import Konva from \"konva\"\n\nimport { capabilityProps } from \"./capabilities.ts\"\nimport { owner } from \"./core.ts\"\nimport type {
|
|
1
|
+
{"version":3,"file":"konva.js","names":[],"sources":["../../src/konva.ts"],"sourcesContent":["import Konva from \"konva\"\n\nimport { capabilityProps } from \"./capabilities.ts\"\nimport { owner } from \"./core.ts\"\nimport type { Children, SpaElement } from \"./index.ts\"\nimport { onCleanup, onMount } from \"./index.ts\"\nimport type { CapabilityAttributes } from \"./jsx-runtime.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\nimport { bindScene, createSceneRenderer, sceneComponent } from \"./renderer.ts\"\n\ntype Props<C, N> = C &\n\tCapabilityAttributes<`konva`> & {\n\t\tchildren?: Children\n\t\tref?: (node: N | null) => void\n\t\tonClick?: (event: Konva.KonvaEventObject<MouseEvent>) => void\n\t\tonPointerDown?: (event: Konva.KonvaEventObject<PointerEvent>) => void\n\t\tonDragMove?: (event: Konva.KonvaEventObject<DragEvent>) => void\n\t\tonDragEnd?: (event: Konva.KonvaEventObject<DragEvent>) => void\n\t}\nconst constructors = {\n\tLayer: Konva.Layer,\n\tGroup: Konva.Group,\n\tRect: Konva.Rect,\n\tCircle: Konva.Circle,\n\tEllipse: Konva.Ellipse,\n\tLine: Konva.Line,\n\tText: Konva.Text,\n\tImage: Konva.Image,\n\tPath: Konva.Path,\n\tStar: Konva.Star,\n\tTransformer: Konva.Transformer,\n}\nfunction suspendNode(node: Konva.Node): () => void {\n\tconst listening = node.listening()\n\tconst draggable = node.draggable()\n\tnode.listening(false)\n\t// The public setter clears both pending and active native drag records.\n\tnode.draggable(false)\n\treturn () => {\n\t\tnode.listening(listening)\n\t\tnode.draggable(draggable)\n\t}\n}\nfunction updateNode(\n\tnode: Konva.Node,\n\tprops: Record<string, any>,\n\tprevious: Record<string, any>,\n): void {\n\tfor (const key of new Set([...Object.keys(previous), ...Object.keys(props)])) {\n\t\tif (/^(key|children|ref)$/.test(key) || Object.is(props[key], previous[key]))\n\t\t\tcontinue\n\t\tif (key.startsWith(`on`)) {\n\t\t\tconst event = key.slice(2).toLowerCase()\n\t\t\tif (previous[key]) node.off(event, previous[key])\n\t\t\tif (props[key]) node.on(event, props[key])\n\t\t} else node.setAttr(key, props[key])\n\t}\n}\nconst renderer = createSceneRenderer<Konva.Node>({\n\ttarget(node) {\n\t\treturn {\n\t\t\tkind: `konva`,\n\t\t\tnode,\n\t\t\tsuspend() {\n\t\t\t\treturn suspendNode(node)\n\t\t\t},\n\t\t\tread: (key) => node.getAttr(key),\n\t\t\twrite: (key, value) => {\n\t\t\t\tnode.setAttr(key, value)\n\t\t\t},\n\t\t\tlisten(event, listener) {\n\t\t\t\tnode.on(event, listener)\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.off(event, listener)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n\tcreate(type) {\n\t\tconst Constructor = constructors[type as keyof typeof constructors]\n\t\tif (!Constructor) throw new Error(`spa/konva: unknown node ${type}`)\n\t\treturn new Constructor({} as any)\n\t},\n\tupdate: updateNode,\n\tchildren(parent, children) {\n\t\tif (children.length && !(parent instanceof Konva.Container))\n\t\t\tthrow new Error(`spa/konva: shapes cannot contain children`)\n\t\tif (parent instanceof Konva.Container) {\n\t\t\tfor (const child of [...parent.getChildren()])\n\t\t\t\tif (!children.includes(child)) child.remove()\n\t\t\tchildren.forEach((child, index) => {\n\t\t\t\tif (child.getParent() !== parent) parent.add(child as any)\n\t\t\t\tchild.zIndex(index)\n\t\t\t})\n\t\t}\n\t},\n\tdestroy(node) {\n\t\tnode.off()\n\t\tnode.destroy()\n\t},\n})\n\n/** A DOM boundary owning a Konva stage and its scene subtree. */\nexport function Stage(\n\tprops: Props<Omit<Konva.StageConfig, `container`>, Konva.Stage> & {\n\t\twidth?: number\n\t\theight?: number\n\t},\n): SpaElement {\n\tlet container: HTMLDivElement | null = null\n\tonMount(() => {\n\t\t// Konva clears its container; preserve SPA's markers in the outer element.\n\t\tconst surface = container!.ownerDocument.createElement(`div`)\n\t\tcontainer!.append(surface)\n\t\tonCleanup(() => {\n\t\t\tsurface.remove()\n\t\t})\n\t\tconst stage = new Konva.Stage({\n\t\t\tcontainer: surface,\n\t\t\twidth: props.width ?? 300,\n\t\t\theight: props.height ?? 150,\n\t\t})\n\t\tonCleanup(() => {\n\t\t\tstage.off()\n\t\t\tstage.destroy()\n\t\t})\n\t\tconst nativeProps = capabilityProps(\n\t\t\towner!,\n\t\t\t{\n\t\t\t\tkind: `konva`,\n\t\t\t\tnode: stage,\n\t\t\t\tsuspend() {\n\t\t\t\t\treturn suspendNode(stage)\n\t\t\t\t},\n\t\t\t\tlisten(event, listener) {\n\t\t\t\t\tstage.on(event, listener)\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tstage.off(event, listener)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tread: (key) => stage.getAttr(key),\n\t\t\t\twrite: (key, value) => {\n\t\t\t\t\tstage.setAttr(key, value)\n\t\t\t\t},\n\t\t\t},\n\t\t\t() => ({ ...props }),\n\t\t)\n\t\tlet previous: Record<string, any> = {}\n\t\tbindScene(\n\t\t\t() => ({ ...props }),\n\t\t\t(all) => {\n\t\t\t\tconst next = nativeProps(all)\n\t\t\t\tupdateNode(stage, next, previous)\n\t\t\t\tprevious = next\n\t\t\t},\n\t\t)\n\t\tprops.ref?.(stage)\n\t\tonCleanup(() => props.ref?.(null))\n\t\trenderer.mount(() => props.children, stage)\n\t})\n\treturn jsx(`div`, {\n\t\tref: (element: HTMLDivElement | null) => {\n\t\t\tcontainer = element\n\t\t},\n\t})\n}\nexport const Layer =\n\tsceneComponent<Props<Konva.LayerConfig, Konva.Layer>>(`Layer`)\nexport const Group =\n\tsceneComponent<Props<Konva.ContainerConfig, Konva.Group>>(`Group`)\nexport const Rect = sceneComponent<Props<Konva.RectConfig, Konva.Rect>>(`Rect`)\nexport const Circle =\n\tsceneComponent<Props<Konva.CircleConfig, Konva.Circle>>(`Circle`)\nexport const Ellipse =\n\tsceneComponent<Props<Konva.EllipseConfig, Konva.Ellipse>>(`Ellipse`)\nexport const Line = sceneComponent<Props<Konva.LineConfig, Konva.Line>>(`Line`)\nexport const Text = sceneComponent<Props<Konva.TextConfig, Konva.Text>>(`Text`)\nexport const Image =\n\tsceneComponent<Props<Konva.ImageConfig, Konva.Image>>(`Image`)\nexport const Path = sceneComponent<Props<Konva.PathConfig, Konva.Path>>(`Path`)\nexport const Star = sceneComponent<Props<Konva.StarConfig, Konva.Star>>(`Star`)\nexport const Transformer =\n\tsce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ACD;GACA,OAAO,QAAQ,MAAM,QAAQ,GAAG;GAChC,QAAQ,KAAK,UAAU;IACtB,MAAM,QAAQ,KAAK,KAAK;GACzB;EACD,UACO,EAAE,GAAG,MAAM,EACnB;EACA,IAAI,WAAgC,CAAC;EACrC,iBACQ,EAAE,GAAG,MAAM,KACjB,QAAQ;GACR,MAAM,OAAO,YAAY,GAAG;GAC5B,WAAW,OAAO,MAAM,QAAQ;GAChC,WAAW;EACZ,CACD;EACA,MAAM,MAAM,KAAK;EACjB,gBAAgB,MAAM,MAAM,IAAI,CAAC;EACjC,SAAS,YAAY,MAAM,UAAU,KAAK;CAC3C,CAAC;CACD,OAAO,IAAI,OAAO,EACjB,MAAM,YAAmC;EACxC,YAAY;CACb,EACD,CAAC;AACF;AACA,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,QACZ,eAA0D,OAAO;AAClE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,SACZ,eAAwD,QAAQ;AACjE,MAAa,UACZ,eAA0D,SAAS;AACpE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,cACZ,eACC,aACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as invalidate, i as fail, o as isPresent, p as untrack, r as dispose } from "./core-
|
|
1
|
+
import { a as invalidate, i as fail, o as isPresent, p as untrack, r as dispose } from "./core-DxPiKryn.js";
|
|
2
2
|
import { animate, cancelFrame, frame, hover, keyframes, motionValue, press, readStyleValue, styleEffect } from "motion";
|
|
3
3
|
// src/motion-tween.ts
|
|
4
4
|
const trajectories = /* @__PURE__ */ new WeakMap();
|
|
@@ -554,12 +554,17 @@ function attach(target, options) {
|
|
|
554
554
|
installGestures();
|
|
555
555
|
refresh(true);
|
|
556
556
|
},
|
|
557
|
-
update(next) {
|
|
557
|
+
update(next, previousStyle) {
|
|
558
558
|
if (dead) return;
|
|
559
559
|
for (const key of Object.keys(next)) if (!allowed.has(key)) throw new Error(`spa/motion: unknown property motion:${key}`);
|
|
560
560
|
const gestureChange = !started || Boolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) || Boolean(next[`whileTap`]) !== Boolean(props[`whileTap`]);
|
|
561
561
|
props = next;
|
|
562
562
|
if (gestureChange && !exiting) installGestures();
|
|
563
|
+
if (previousStyle !== void 0 && started && element) {
|
|
564
|
+
const snapshot = element.ownerDocument.createElement(`div`).style;
|
|
565
|
+
snapshot.cssText = previousStyle;
|
|
566
|
+
for (const key of originalStyles.keys()) element.style.setProperty(key, snapshot.getPropertyValue(key), snapshot.getPropertyPriority(key));
|
|
567
|
+
}
|
|
563
568
|
refresh();
|
|
564
569
|
},
|
|
565
570
|
dispose() {
|