@atom.io/spa 0.0.2 → 0.0.4
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 +144 -47
- package/README.mdx +37 -11
- package/dist/astro-application.d.ts +1 -1
- package/dist/astro-application.js +2 -2
- package/dist/astro-application.js.map +1 -1
- package/dist/astro-client.d.ts +1 -1
- package/dist/astro-client.js +4 -4
- package/dist/astro-client.js.map +1 -1
- package/dist/{astro-shared-DyzbUi6c.d.ts → astro-shared-CYSRrRr8.d.ts} +2 -2
- package/dist/{astro-shared-DyzbUi6c.d.ts.map → astro-shared-CYSRrRr8.d.ts.map} +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/capabilities-BkQ2i0vV.js +63 -0
- package/dist/capabilities-BkQ2i0vV.js.map +1 -0
- package/dist/{capabilities-yC9TsHDI.d.ts → capabilities-D3HObAIy.d.ts} +66 -11
- package/dist/capabilities-D3HObAIy.d.ts.map +1 -0
- package/dist/client.min.js +1 -1
- package/dist/{capabilities-BuZUQpiD.js → core-Bl1Ec1hY.js} +42 -79
- package/dist/core-Bl1Ec1hY.js.map +1 -0
- package/dist/development/astro-application.js +2 -2
- package/dist/development/astro-application.js.map +1 -1
- package/dist/development/astro-client.js +4 -4
- package/dist/development/astro-client.js.map +1 -1
- package/dist/development/capabilities-BkQ2i0vV.js +63 -0
- package/dist/development/capabilities-BkQ2i0vV.js.map +1 -0
- package/dist/development/{capabilities-DhOJmeoJ.js → core-DZFaOyTO.js} +42 -79
- package/dist/development/core-DZFaOyTO.js.map +1 -0
- package/dist/development/{dom-BKc6V_Kz.js → dom-Dwa2SFTn.js} +16 -7
- package/dist/development/dom-Dwa2SFTn.js.map +1 -0
- package/dist/development/index.js +4 -4
- package/dist/development/konva.js +25 -3
- package/dist/development/konva.js.map +1 -1
- package/dist/development/motion.js +392 -8
- package/dist/development/motion.js.map +1 -1
- package/dist/development/renderer.js +23 -10
- package/dist/development/renderer.js.map +1 -1
- package/dist/development/server.js +2 -1
- package/dist/development/server.js.map +1 -1
- package/dist/development/{src-Dh-d6w4y.js → src-BUtG4BgX.js} +4 -4
- package/dist/development/src-BUtG4BgX.js.map +1 -0
- package/dist/development/three.js +24 -10
- package/dist/development/three.js.map +1 -1
- package/dist/{dom-B2rm8o2L.js → dom-Cfj3GtQK.js} +16 -7
- package/dist/dom-Cfj3GtQK.js.map +1 -0
- package/dist/{index-BdwxmSKg.d.ts → index-YRZ79lN5.d.ts} +3 -3
- package/dist/{index-BdwxmSKg.d.ts.map → index-YRZ79lN5.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{jsx-runtime-CZU7F8Qz.d.ts → jsx-runtime-Q-UBV97Y.d.ts} +2 -2
- package/dist/{jsx-runtime-CZU7F8Qz.d.ts.map → jsx-runtime-Q-UBV97Y.d.ts.map} +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/konva.d.ts +3 -3
- package/dist/konva.d.ts.map +1 -1
- package/dist/konva.js +25 -3
- package/dist/konva.js.map +1 -1
- package/dist/motion.d.ts +2 -1
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +392 -8
- package/dist/motion.js.map +1 -1
- package/dist/renderer.d.ts +3 -3
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +23 -10
- package/dist/renderer.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -1
- package/dist/server.js.map +1 -1
- package/dist/size.json +12 -12
- package/dist/{src-BZxX4xbU.js → src-DvkUMuNW.js} +4 -4
- package/dist/src-DvkUMuNW.js.map +1 -0
- package/dist/three.d.ts +3 -3
- package/dist/three.d.ts.map +1 -1
- package/dist/three.js +24 -10
- package/dist/three.js.map +1 -1
- package/package.json +9 -7
- package/src/astro-application.ts +2 -2
- package/src/astro-client.ts +3 -3
- package/src/capabilities.ts +21 -2
- package/src/core.ts +66 -41
- package/src/dom.ts +35 -4
- package/src/index.ts +2 -2
- package/src/konva.ts +41 -14
- package/src/motion-tween.ts +106 -0
- package/src/motion.ts +122 -9
- package/src/presence.ts +324 -0
- package/src/renderer.ts +51 -14
- package/src/three-events.ts +13 -1
- package/src/three.ts +38 -15
- package/src/use-loadable.ts +3 -3
- package/dist/capabilities-BuZUQpiD.js.map +0 -1
- package/dist/capabilities-yC9TsHDI.d.ts.map +0 -1
- package/dist/development/capabilities-DhOJmeoJ.js.map +0 -1
- package/dist/development/dom-BKc6V_Kz.js.map +0 -1
- package/dist/development/src-Dh-d6w4y.js.map +0 -1
- package/dist/dom-B2rm8o2L.js.map +0 -1
- package/dist/src-BZxX4xbU.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-client.js","names":[],"sources":["../../src/astro-client.ts"],"sourcesContent":["import type { RegularAtomFamilyToken } from \"atom.io\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tcreateRegularAtomFamily,\n\tdisposeFromStore,\n\tfindInStore,\n\tIMPLICIT,\n\tsetIntoStore,\n} from \"atom.io/internal\"\n\nimport { browserApplication } from \"./astro-application.ts\"\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport type { Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport { onCleanup,
|
|
1
|
+
{"version":3,"file":"astro-client.js","names":[],"sources":["../../src/astro-client.ts"],"sourcesContent":["import type { RegularAtomFamilyToken } from \"atom.io\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tcreateRegularAtomFamily,\n\tdisposeFromStore,\n\tfindInStore,\n\tIMPLICIT,\n\tsetIntoStore,\n} from \"atom.io/internal\"\n\nimport { browserApplication } from \"./astro-application.ts\"\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport type { Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport { onCleanup, useGetter } from \"./core.ts\"\nimport { hydrate, render } from \"./dom.ts\"\n\ntype Props = Record<string, any>\ntype Slots = Record<string, string>\ntype Hydrator = (\n\tcomponent: Island,\n\tprops: Props,\n\tslots: Slots,\n\tmetadata: { client: string },\n) => Promise<void>\nconst roots = new WeakMap<\n\tElement,\n\t{\n\t\tcomponent: Island\n\t\tready: Promise<void>\n\t\tupdate(props: Props, slots: Slots): void\n\t\tdispose(): void\n\t}\n>()\ntype State = { props: Props; slots: Slots }\nconst states = new WeakMap<RootStore, RegularAtomFamilyToken<State, number>>()\nlet serial = 0\n\nexport default (element: HTMLElement): Hydrator =>\n\tasync (component, props, slots, { client }) => {\n\t\tconst previous = roots.get(element)\n\t\tif (previous?.component === component) {\n\t\t\tprevious.update(props, slots)\n\t\t\treturn previous.ready\n\t\t}\n\t\tprevious?.dispose()\n\t\tconst shared = !component.createStore && !component.isolate\n\t\tconst application = shared\n\t\t\t? browserApplication(element.ownerDocument)\n\t\t\t: undefined\n\t\tif (application && client === `only`) application.canResume = false\n\t\tconst lifetime = storeContext(element, application)\n\t\tconst initial = { props, slots }\n\t\tlet current = initial\n\t\tlet update: ((value: State) => void) | undefined\n\t\tlet disposed = false\n\t\tconst dispose = () => {\n\t\t\tif (disposed) return\n\t\t\tdisposed = true\n\t\t\telement.removeEventListener(`astro:unmount`, dispose)\n\t\t\troots.delete(element)\n\t\t\tlifetime.dispose()\n\t\t}\n\t\t// Publish the pending owner before invoking user code. Repeated hydration\n\t\t// calls update its props and share its preparation rather than racing stores.\n\t\tconst ready = Promise.resolve().then(async () => {\n\t\t\tif (lifetime.context.signal.aborted) return\n\t\t\tlet mounting = false\n\t\t\ttry {\n\t\t\t\tconst store = await Promise.race([\n\t\t\t\t\tislandStore(\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t\tlifetime.context,\n\t\t\t\t\t\tshared ? IMPLICIT.STORE : undefined,\n\t\t\t\t\t),\n\t\t\t\t\tlifetime.cancelled,\n\t\t\t\t])\n\t\t\t\tif (lifetime.context.signal.aborted) return\n\t\t\t\tmounting = true\n\t\t\t\tconst replace =\n\t\t\t\t\tclient === `only` ||\n\t\t\t\t\tprevious !== undefined ||\n\t\t\t\t\tapplication?.canResume === false\n\t\t\t\t// Astro leaves this sentinel on islands inserted by ClientRouter.\n\t\t\t\tconst sentinel = element.lastChild\n\t\t\t\tif (sentinel?.nodeType === 8 && sentinel.nodeValue === `astro:end`)\n\t\t\t\t\tsentinel.remove()\n\t\t\t\tlet family = states.get(store!)\n\t\t\t\tif (!family) {\n\t\t\t\t\tfamily = createRegularAtomFamily<State, number, never>(store!, {\n\t\t\t\t\t\tkey: `🔍 spa islands`,\n\t\t\t\t\t\tdefault: { props: {}, slots: {} },\n\t\t\t\t\t})\n\t\t\t\t\tstates.set(store!, family)\n\t\t\t\t}\n\t\t\t\tconst state = findInStore(store!, family, serial++)\n\t\t\t\tsetIntoStore(store!, state, replace ? current : initial)\n\t\t\t\tlifetime.context.onCleanup(() => {\n\t\t\t\t\tdisposeFromStore(store!, state)\n\t\t\t\t})\n\t\t\t\tconst mount = () => {\n\t\t\t\t\tonCleanup(dispose)\n\t\t\t\t\tconst getState = useGetter(state)\n\t\t\t\t\treturn () => island(component, getState().props, getState().slots)\n\t\t\t\t}\n\t\t\t\tif (replace) element.replaceChildren()\n\t\t\t\tconst root = (replace ? render : hydrate)(mount, element, {\n\t\t\t\t\tstore: store!,\n\t\t\t\t\tcapabilities: component.capabilities ?? [],\n\t\t\t\t})\n\t\t\t\tlifetime.context.onCleanup(root.dispose)\n\t\t\t\tupdate = (next) => {\n\t\t\t\t\tsetIntoStore(store!, state, next)\n\t\t\t\t\troot.flush()\n\t\t\t\t}\n\t\t\t\t// Match the existing SSR tree before applying a structural prop update\n\t\t\t\t// that arrived while its store was still being prepared.\n\t\t\t\tif (!replace && current !== initial) update(current)\n\t\t\t} catch (error) {\n\t\t\t\tif (lifetime.context.signal.aborted && !mounting) return\n\t\t\t\tfailPreparation(error, dispose)\n\t\t\t}\n\t\t})\n\t\troots.set(element, {\n\t\t\tcomponent,\n\t\t\tready,\n\t\t\tupdate(nextProps, nextSlots) {\n\t\t\t\tcurrent = { props: nextProps, slots: nextSlots }\n\t\t\t\tupdate?.(current)\n\t\t\t},\n\t\t\tdispose,\n\t\t})\n\t\telement.addEventListener(`astro:unmount`, dispose, { once: true })\n\t\tlifetime.context.onCleanup(dispose)\n\t\treturn ready\n\t}\n"],"mappings":";;;;;;;AAyBA,MAAM,wBAAQ,IAAI,QAQhB;AAEF,MAAM,yBAAS,IAAI,QAA0D;AAC7E,IAAI,SAAS;AAEb,IAAA,wBAAgB,YACf,OAAO,WAAW,OAAO,OAAO,EAAE,aAAa;CAC9C,MAAM,WAAW,MAAM,IAAI,OAAO;CAClC,IAAI,UAAU,cAAc,WAAW;EACtC,SAAS,OAAO,OAAO,KAAK;EAC5B,OAAO,SAAS;CACjB;CACA,UAAU,QAAQ;CAClB,MAAM,SAAS,CAAC,UAAU,eAAe,CAAC,UAAU;CACpD,MAAM,cAAc,SACjB,mBAAmB,QAAQ,aAAa,IACxC,KAAA;CACH,IAAI,eAAe,WAAW,QAAQ,YAAY,YAAY;CAC9D,MAAM,WAAW,aAAa,SAAS,WAAW;CAClD,MAAM,UAAU;EAAE;EAAO;CAAM;CAC/B,IAAI,UAAU;CACd,IAAI;CACJ,IAAI,WAAW;CACf,MAAM,gBAAgB;EACrB,IAAI,UAAU;EACd,WAAW;EACX,QAAQ,oBAAoB,iBAAiB,OAAO;EACpD,MAAM,OAAO,OAAO;EACpB,SAAS,QAAQ;CAClB;CAGA,MAAM,QAAQ,QAAQ,QAAQ,CAAC,CAAC,KAAK,YAAY;EAChD,IAAI,SAAS,QAAQ,OAAO,SAAS;EACrC,IAAI,WAAW;EACf,IAAI;GACH,MAAM,QAAQ,MAAM,QAAQ,KAAK,CAChC,YACC,WACA,OACA,SAAS,SACT,SAAS,SAAS,QAAQ,KAAA,CAC3B,GACA,SAAS,SACV,CAAC;GACD,IAAI,SAAS,QAAQ,OAAO,SAAS;GACrC,WAAW;GACX,MAAM,UACL,WAAW,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;CACjE,SAAS,QAAQ,UAAU,OAAO;CAClC,OAAO;AACR"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/capabilities.ts
|
|
2
|
+
function capabilityNamespace(key) {
|
|
3
|
+
const colon = key.indexOf(`:`);
|
|
4
|
+
if (colon < 0) return void 0;
|
|
5
|
+
const namespace = key.slice(0, colon);
|
|
6
|
+
return /^(xml|xmlns|xlink)$/.test(namespace) ? void 0 : namespace;
|
|
7
|
+
}
|
|
8
|
+
function validateCapabilities(scope, props) {
|
|
9
|
+
for (const key of Object.keys(props)) {
|
|
10
|
+
const namespace = capabilityNamespace(key);
|
|
11
|
+
if (namespace && !scope._root._capabilities.has(namespace)) throw new Error(`spa: capability "${namespace}" is not registered for this root`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Separate framework properties from native attributes and own their bindings. */
|
|
15
|
+
function capabilityProps(scope, target, read) {
|
|
16
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
17
|
+
scope._root._presence?.target(scope, target);
|
|
18
|
+
const cleanup = () => {
|
|
19
|
+
const errors = [];
|
|
20
|
+
for (const binding of [...bindings.values()].reverse()) try {
|
|
21
|
+
binding.dispose();
|
|
22
|
+
} catch (error) {
|
|
23
|
+
errors.push(error);
|
|
24
|
+
}
|
|
25
|
+
bindings.clear();
|
|
26
|
+
if (errors.length) throw new AggregateError(errors);
|
|
27
|
+
};
|
|
28
|
+
scope._cleanups.add(cleanup);
|
|
29
|
+
return (props) => {
|
|
30
|
+
validateCapabilities(scope, props);
|
|
31
|
+
const native = {};
|
|
32
|
+
const groups = /* @__PURE__ */ new Map();
|
|
33
|
+
for (const key of Object.keys(props)) {
|
|
34
|
+
const namespace = capabilityNamespace(key);
|
|
35
|
+
if (!namespace) {
|
|
36
|
+
const value = props[key];
|
|
37
|
+
native[key] = key.startsWith(`on`) && typeof value === `function` ? scope._root._presence?.event(scope, value) ?? value : value;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const group = groups.get(namespace) ?? {};
|
|
41
|
+
group[key.slice(namespace.length + 1)] = props[key];
|
|
42
|
+
groups.set(namespace, group);
|
|
43
|
+
}
|
|
44
|
+
for (const [namespace, values] of groups) {
|
|
45
|
+
let binding = bindings.get(namespace);
|
|
46
|
+
if (!binding) {
|
|
47
|
+
binding = scope._root._capabilities.get(namespace).attach(target);
|
|
48
|
+
bindings.set(namespace, binding);
|
|
49
|
+
scope._root._presence?.bind(scope, binding, read ?? (() => props), namespace);
|
|
50
|
+
}
|
|
51
|
+
binding.update(values);
|
|
52
|
+
}
|
|
53
|
+
for (const [namespace, binding] of bindings) if (!groups.has(namespace)) {
|
|
54
|
+
bindings.delete(namespace);
|
|
55
|
+
scope._root._presence?.unbind(binding);
|
|
56
|
+
binding.dispose();
|
|
57
|
+
}
|
|
58
|
+
return native;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export { capabilityProps as n, validateCapabilities as r, capabilityNamespace as t };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=capabilities-BkQ2i0vV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-BkQ2i0vV.js","names":[],"sources":["../../src/capabilities.ts"],"sourcesContent":["import type { Cleanup, Root, Scope } 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\tupdate(props: Record<string, unknown>): void\n\tdispose(): void\n}\nexport interface Capability {\n\tnamespace: string\n\tpresence?(root: Root): PresenceCoordinator\n\tscheduleFrame?(callback: (time: number) => void): Cleanup\n\tattach(target: CapabilityTarget): CapabilityBinding\n}\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}\nexport function validateCapabilities(\n\tscope: Scope,\n\tprops: Record<string, unknown>,\n): void {\n\tfor (const key of Object.keys(props)) {\n\t\tconst namespace = capabilityNamespace(key)\n\t\tif (namespace && !scope._root._capabilities.has(namespace))\n\t\t\tthrow new Error(\n\t\t\t\t`spa: capability \"${namespace}\" is not registered for this root`,\n\t\t\t)\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): (props: Record<string, any>) => Record<string, any> {\n\tconst bindings = new Map<string, CapabilityBinding>()\n\n\tscope._root._presence?.target(scope, 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\tvalidateCapabilities(scope, props)\n\t\tconst native: Record<string, any> = {}\n\t\tconst groups = new Map<string, 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? (scope._root._presence?.event(scope, value) ?? value)\n\t\t\t\t\t\t: value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst group = groups.get(namespace) ?? {}\n\t\t\tgroup[key.slice(namespace.length + 1)] = props[key]\n\t\t\tgroups.set(namespace, group)\n\t\t}\n\t\tfor (const [namespace, values] of groups) {\n\t\t\tlet binding = bindings.get(namespace)\n\t\t\tif (!binding) {\n\t\t\t\tbinding = scope._root._capabilities.get(namespace)!.attach(target)\n\t\t\t\tbindings.set(namespace, binding)\n\t\t\t\tscope._root._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\tnamespace,\n\t\t\t\t)\n\t\t\t}\n\t\t\tbinding.update(values)\n\t\t}\n\t\tfor (const [namespace, binding] of bindings)\n\t\t\tif (!groups.has(namespace)) {\n\t\t\t\tbindings.delete(namespace)\n\t\t\t\tscope._root._presence?.unbind(binding)\n\t\t\t\tbinding.dispose()\n\t\t\t}\n\t\treturn native\n\t}\n}\n"],"mappings":";AAyBA,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,SAAgB,qBACf,OACA,OACO;CACP,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACrC,MAAM,YAAY,oBAAoB,GAAG;EACzC,IAAI,aAAa,CAAC,MAAM,MAAM,cAAc,IAAI,SAAS,GACxD,MAAM,IAAI,MACT,oBAAoB,UAAU,kCAC/B;CACF;AACD;;AAGA,SAAgB,gBACf,OACA,QACA,MACsD;CACtD,MAAM,2BAAW,IAAI,IAA+B;CAEpD,MAAM,MAAM,WAAW,OAAO,OAAO,MAAM;CAC3C,MAAM,gBAAyB;EAC9B,MAAM,SAAoB,CAAC;EAC3B,KAAK,MAAM,WAAW,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC,CAAC,QAAQ,GACpD,IAAI;GACH,QAAQ,QAAQ;EACjB,SAAS,OAAO;GACf,OAAO,KAAK,KAAK;EAClB;EAED,SAAS,MAAM;EACf,IAAI,OAAO,QAAQ,MAAM,IAAI,eAAe,MAAM;CACnD;CACA,MAAM,UAAU,IAAI,OAAO;CAC3B,QAAQ,UAAU;EACjB,qBAAqB,OAAO,KAAK;EACjC,MAAM,SAA8B,CAAC;EACrC,MAAM,yBAAS,IAAI,IAAqC;EACxD,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;GACrC,MAAM,YAAY,oBAAoB,GAAG;GACzC,IAAI,CAAC,WAAW;IACf,MAAM,QAAQ,MAAM;IACpB,OAAO,OACN,IAAI,WAAW,IAAI,KAAK,OAAO,UAAU,aACrC,MAAM,MAAM,WAAW,MAAM,OAAO,KAAK,KAAK,QAC/C;IACJ;GACD;GACA,MAAM,QAAQ,OAAO,IAAI,SAAS,KAAK,CAAC;GACxC,MAAM,IAAI,MAAM,UAAU,SAAS,CAAC,KAAK,MAAM;GAC/C,OAAO,IAAI,WAAW,KAAK;EAC5B;EACA,KAAK,MAAM,CAAC,WAAW,WAAW,QAAQ;GACzC,IAAI,UAAU,SAAS,IAAI,SAAS;GACpC,IAAI,CAAC,SAAS;IACb,UAAU,MAAM,MAAM,cAAc,IAAI,SAAS,CAAC,CAAE,OAAO,MAAM;IACjE,SAAS,IAAI,WAAW,OAAO;IAC/B,MAAM,MAAM,WAAW,KACtB,OACA,SACA,eAAe,QACf,SACD;GACD;GACA,QAAQ,OAAO,MAAM;EACtB;EACA,KAAK,MAAM,CAAC,WAAW,YAAY,UAClC,IAAI,CAAC,OAAO,IAAI,SAAS,GAAG;GAC3B,SAAS,OAAO,SAAS;GACzB,MAAM,MAAM,WAAW,OAAO,OAAO;GACrC,QAAQ,QAAQ;EACjB;EACD,OAAO;CACR;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, actUponStore, clearTimelineInStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead,
|
|
1
|
+
import { IMPLICIT, actUponStore, clearTimelineInStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead, setIntoStore, subscribeToState, subscribeToTimeline, timeTravel, timeTravelTransactionGroupInStore, withdraw } from "atom.io/internal";
|
|
2
2
|
// src/core.ts
|
|
3
3
|
let owner;
|
|
4
4
|
let tracking;
|
|
@@ -44,6 +44,11 @@ function dispose(scope) {
|
|
|
44
44
|
if (scope._dead) return;
|
|
45
45
|
scope._dead = true;
|
|
46
46
|
const errors = [];
|
|
47
|
+
try {
|
|
48
|
+
scope._root._presence?.forget(scope);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
errors.push(error);
|
|
51
|
+
}
|
|
47
52
|
for (const cleanup of [...scope._cleanups].reverse()) try {
|
|
48
53
|
typeof cleanup === `function` ? cleanup() : dispose(cleanup);
|
|
49
54
|
} catch (error) {
|
|
@@ -59,7 +64,7 @@ function invalidate(scope) {
|
|
|
59
64
|
for (const child of scope._cleanups) if (typeof child !== `function`) invalidate(child);
|
|
60
65
|
}
|
|
61
66
|
function enqueue(scope, run) {
|
|
62
|
-
if (scope
|
|
67
|
+
if (!isPresent(scope)) return;
|
|
63
68
|
const root = scope._root;
|
|
64
69
|
if (!root._queue.size) queueMicrotask(() => {
|
|
65
70
|
try {
|
|
@@ -89,6 +94,10 @@ function createRoot(options = {}, server = false) {
|
|
|
89
94
|
root.error = options.onError ?? ((error) => {
|
|
90
95
|
throw error;
|
|
91
96
|
});
|
|
97
|
+
for (const capability of capabilities.values()) if (capability.presence) {
|
|
98
|
+
if (root._presence) throw new Error(`spa: multiple presence coordinators`);
|
|
99
|
+
root._presence = capability.presence(root);
|
|
100
|
+
}
|
|
92
101
|
root.flush = () => {
|
|
93
102
|
try {
|
|
94
103
|
let passes = 0;
|
|
@@ -125,7 +134,7 @@ function useId() {
|
|
|
125
134
|
function observe(scope, read, apply) {
|
|
126
135
|
const subscriptions = /* @__PURE__ */ new Map();
|
|
127
136
|
const run = () => {
|
|
128
|
-
if (scope
|
|
137
|
+
if (!isPresent(scope)) return;
|
|
129
138
|
const used = /* @__PURE__ */ new Set();
|
|
130
139
|
const previous = tracking;
|
|
131
140
|
tracking = (subscribe) => {
|
|
@@ -160,7 +169,7 @@ function resolveStateToken(token, key) {
|
|
|
160
169
|
const store = owner._root._store;
|
|
161
170
|
return token.type.endsWith(`_family`) ? findInStore(store, token, key) : token;
|
|
162
171
|
}
|
|
163
|
-
function
|
|
172
|
+
function useGetter(token, key) {
|
|
164
173
|
token = resolveStateToken(token, key);
|
|
165
174
|
const store = owner._root._store;
|
|
166
175
|
const subscribe = (notify) => subscribeToState(store, token, `spa:${serial++}`, notify);
|
|
@@ -202,30 +211,36 @@ function useRef(token, key) {
|
|
|
202
211
|
}
|
|
203
212
|
function useTimeline(token, key) {
|
|
204
213
|
const store = owner._root._store;
|
|
205
|
-
|
|
206
|
-
const subscribe = (notify) => subscribeToTimeline(store,
|
|
207
|
-
const
|
|
214
|
+
const selected = token.type === `timeline_family` ? findTimelineInStore(store, token, key) : token;
|
|
215
|
+
const subscribe = (notify) => subscribeToTimeline(store, selected, `spa:${serial++}`, notify);
|
|
216
|
+
const read = () => {
|
|
217
|
+
const timeline = withdraw(store, selected);
|
|
218
|
+
tracking?.(subscribe);
|
|
219
|
+
return timeline;
|
|
220
|
+
};
|
|
221
|
+
return {
|
|
222
|
+
getCursor: () => read().at,
|
|
223
|
+
getLength: () => read().history.length,
|
|
208
224
|
undo: () => {
|
|
209
|
-
timeTravel(store, `undo`,
|
|
225
|
+
timeTravel(store, `undo`, selected);
|
|
210
226
|
},
|
|
211
227
|
redo: () => {
|
|
212
|
-
timeTravel(store, `redo`,
|
|
228
|
+
timeTravel(store, `redo`, selected);
|
|
213
229
|
},
|
|
214
230
|
clear: () => {
|
|
215
|
-
clearTimelineInStore(store,
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
231
|
+
clearTimelineInStore(store, selected);
|
|
232
|
+
},
|
|
233
|
+
getTransaction: () => {
|
|
234
|
+
const timeline = read();
|
|
235
|
+
const controls = {};
|
|
236
|
+
for (const direction of [`undo`, `redo`]) {
|
|
237
|
+
const group = getTimelineTransactionAtHead(timeline, direction);
|
|
238
|
+
if (group) controls[direction] = () => {
|
|
239
|
+
timeTravelTransactionGroupInStore(store, direction, group);
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return controls;
|
|
227
243
|
}
|
|
228
|
-
return value;
|
|
229
244
|
};
|
|
230
245
|
}
|
|
231
246
|
function plain(value) {
|
|
@@ -235,62 +250,10 @@ function plain(value) {
|
|
|
235
250
|
if (typeof value === `object`) throw new Error(`spa: text required`);
|
|
236
251
|
return String(value);
|
|
237
252
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (colon < 0) return void 0;
|
|
242
|
-
const namespace = key.slice(0, colon);
|
|
243
|
-
return /^(xml|xmlns|xlink)$/.test(namespace) ? void 0 : namespace;
|
|
244
|
-
}
|
|
245
|
-
function validateCapabilities(scope, props) {
|
|
246
|
-
for (const key of Object.keys(props)) {
|
|
247
|
-
const namespace = capabilityNamespace(key);
|
|
248
|
-
if (namespace && !scope._root._capabilities.has(namespace)) throw new Error(`spa: capability "${namespace}" is not registered for this root`);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
/** Separate framework properties from native attributes and own their bindings. */
|
|
252
|
-
function capabilityProps(scope, target) {
|
|
253
|
-
const bindings = /* @__PURE__ */ new Map();
|
|
254
|
-
const cleanup = () => {
|
|
255
|
-
const errors = [];
|
|
256
|
-
for (const binding of [...bindings.values()].reverse()) try {
|
|
257
|
-
binding.dispose();
|
|
258
|
-
} catch (error) {
|
|
259
|
-
errors.push(error);
|
|
260
|
-
}
|
|
261
|
-
bindings.clear();
|
|
262
|
-
if (errors.length) throw new AggregateError(errors);
|
|
263
|
-
};
|
|
264
|
-
scope._cleanups.add(cleanup);
|
|
265
|
-
return (props) => {
|
|
266
|
-
validateCapabilities(scope, props);
|
|
267
|
-
const native = {};
|
|
268
|
-
const groups = /* @__PURE__ */ new Map();
|
|
269
|
-
for (const key of Object.keys(props)) {
|
|
270
|
-
const namespace = capabilityNamespace(key);
|
|
271
|
-
if (!namespace) {
|
|
272
|
-
native[key] = props[key];
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
const group = groups.get(namespace) ?? {};
|
|
276
|
-
group[key.slice(namespace.length + 1)] = props[key];
|
|
277
|
-
groups.set(namespace, group);
|
|
278
|
-
}
|
|
279
|
-
for (const [namespace, values] of groups) {
|
|
280
|
-
let binding = bindings.get(namespace);
|
|
281
|
-
if (!binding) {
|
|
282
|
-
binding = scope._root._capabilities.get(namespace).attach(target);
|
|
283
|
-
bindings.set(namespace, binding);
|
|
284
|
-
}
|
|
285
|
-
binding.update(values);
|
|
286
|
-
}
|
|
287
|
-
for (const [namespace, binding] of bindings) if (!groups.has(namespace)) {
|
|
288
|
-
bindings.delete(namespace);
|
|
289
|
-
binding.dispose();
|
|
290
|
-
}
|
|
291
|
-
return native;
|
|
292
|
-
};
|
|
253
|
+
function isPresent(scope) {
|
|
254
|
+
for (let at = scope; at; at = at._parent) if (at._dead || at._exiting) return false;
|
|
255
|
+
return true;
|
|
293
256
|
}
|
|
294
|
-
export {
|
|
257
|
+
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 };
|
|
295
258
|
|
|
296
|
-
//# sourceMappingURL=
|
|
259
|
+
//# sourceMappingURL=core-DZFaOyTO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-DZFaOyTO.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 Child union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Child. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Child\nexport interface VNode {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\nexport type Child =\n\t| VNode\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Child[]\n\t| Accessor<Child>\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_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 store = owner!._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\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: Child): 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":";;AAyFA,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;CACR;CACA,QAAQ,UAAU,IAAI,KAAK;CAC3B,OAAO;AACR;AACA,SAAgB,KAAK,OAAc,OAAuB;CACzD,IAAI;EACH,QAAQ,KAAK;CACd,SAAS,SAAS;EACjB,MAAM,IAAI,eAAe,CAAC,OAAO,OAAO,CAAC;CAC1C;CACA,MAAM;AACP;AACA,SAAgB,QAAQ,OAAoB;CAC3C,IAAI,MAAM,OAAO;CACjB,MAAM,QAAQ;CACd,MAAM,SAAoB,CAAC;CAC3B,IAAI;EACH,MAAM,MAAM,WAAW,OAAO,KAAK;CACpC,SAAS,OAAO;EACf,OAAO,KAAK,KAAK;CAClB;CACA,KAAK,MAAM,WAAW,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,QAAQ,GAClD,IAAI;EACH,OAAO,YAAY,aAAa,QAAQ,IAAI,QAAQ,OAAO;CAC5D,SAAS,OAAO;EACf,OAAO,KAAK,KAAK;CAClB;CAED,MAAM,SAAS,UAAU,OAAO,KAAK;CACrC,MAAM,UAAU,MAAM;CACtB,MAAM,SAAS,SAAS;CACxB,IAAI,OAAO,QAAQ,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,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as capabilityProps } from "./capabilities-BkQ2i0vV.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-DZFaOyTO.js";
|
|
2
3
|
import { Fragment, merge } from "./jsx-runtime.js";
|
|
3
4
|
// src/dom.ts
|
|
4
5
|
const HTML = `http://www.w3.org/1999/xhtml`;
|
|
@@ -46,6 +47,11 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
46
47
|
comment(`{`, parent, before, owner, cursor);
|
|
47
48
|
let end = null;
|
|
48
49
|
let records = /* @__PURE__ */ new Map();
|
|
50
|
+
const presence = owner._root._presence?.collection((record) => record._scope, (record, child) => typeof record._value === typeof child && record._value?.type === child?.type);
|
|
51
|
+
const retire = (record, key, eligible, index) => {
|
|
52
|
+
if (presence) presence.remove(record, key, eligible, index, () => {});
|
|
53
|
+
else dispose(record._scope);
|
|
54
|
+
};
|
|
49
55
|
let initial = cursor;
|
|
50
56
|
observe(owner, () => source()(), (next) => {
|
|
51
57
|
const values = [next].flat(Infinity);
|
|
@@ -59,9 +65,10 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
59
65
|
if (kept.has(key)) throw new Error(`spa: duplicate key`);
|
|
60
66
|
let record = records.get(key);
|
|
61
67
|
if (record && (typeof record._value !== typeof child || record._value?.type !== vnode?.type)) {
|
|
62
|
-
|
|
68
|
+
retire(record, key, child == null || typeof child === `boolean`, [...records.keys()].indexOf(key));
|
|
63
69
|
record = void 0;
|
|
64
70
|
}
|
|
71
|
+
record ??= presence?.take(key, child);
|
|
65
72
|
if (!record) {
|
|
66
73
|
const childOwner = createScope(owner);
|
|
67
74
|
record = {
|
|
@@ -75,14 +82,16 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
75
82
|
record._end = comment(`]`, parent, end ?? before, childOwner, initial);
|
|
76
83
|
} else {
|
|
77
84
|
record._value = child;
|
|
85
|
+
owner._root._presence?.resume(record._scope);
|
|
78
86
|
invalidate(record._scope);
|
|
79
87
|
}
|
|
80
88
|
kept.set(key, record);
|
|
81
89
|
}
|
|
82
|
-
for (const [key, record] of records) if (!kept.has(key))
|
|
90
|
+
for (const [key, record] of records) if (!kept.has(key)) retire(record, key, true, [...records.keys()].indexOf(key));
|
|
83
91
|
if (!initial) {
|
|
84
92
|
let at = end ?? before;
|
|
85
|
-
|
|
93
|
+
const rendered = presence?.merge([...kept.values()]) ?? [...kept.values()];
|
|
94
|
+
for (const record of rendered.reverse()) {
|
|
86
95
|
if (record._end.nextSibling !== at) {
|
|
87
96
|
const range = parent.ownerDocument.createRange();
|
|
88
97
|
range.setStartBefore(record._start);
|
|
@@ -91,7 +100,7 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
91
100
|
}
|
|
92
101
|
at = record._start;
|
|
93
102
|
}
|
|
94
|
-
if (focus?.isConnected && focus !== parent.ownerDocument.activeElement) focus.focus({ preventScroll: true });
|
|
103
|
+
if (focus?.isConnected && !focus.closest(`[inert]`) && focus !== parent.ownerDocument.activeElement) focus.focus({ preventScroll: true });
|
|
95
104
|
}
|
|
96
105
|
initial = void 0;
|
|
97
106
|
records = kept;
|
|
@@ -140,7 +149,7 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
|
|
|
140
149
|
const nativeProps = capabilityProps(owner, {
|
|
141
150
|
kind: `dom`,
|
|
142
151
|
node: element
|
|
143
|
-
});
|
|
152
|
+
}, () => ({ ...props }));
|
|
144
153
|
let previous = {};
|
|
145
154
|
owner._cleanups.add(() => {
|
|
146
155
|
for (const key in previous) if (key.startsWith(`on`)) property(element, key, null, previous[key]);
|
|
@@ -196,4 +205,4 @@ function hydrate(setup, host, options = {}) {
|
|
|
196
205
|
}
|
|
197
206
|
export { render as n, hydrate as t };
|
|
198
207
|
|
|
199
|
-
//# sourceMappingURL=dom-
|
|
208
|
+
//# sourceMappingURL=dom-Dwa2SFTn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-Dwa2SFTn.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type { Accessor, Child, RootOptions, Scope, VNode } 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 = { node: Node | null }\ntype RecordNode = { _value: Child; _scope: Scope; _start: Node; _end: Node }\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\tthrow new Error(\n\t\t\t\timport.meta.env.DEV ? `spa: hydration mismatch` : undefined,\n\t\t\t)\n\t\tnode = found\n\t\tcursor.node = found.nextSibling\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: Child,\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, Child>(\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 VNode | null)?.type === (child as VNode | 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 () => Child)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Child[]\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 VNode | 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 VNode | 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 VNode\n\tconst props = merge(() => (source() as VNode).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 ? { node: element.firstChild } : 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\tif (children?.node)\n\t\t\tthrow new Error(\n\t\t\t\timport.meta.env.DEV ? `spa: hydration mismatch` : undefined,\n\t\t\t)\n\t}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t)\n\tlet previous: Record<string, any> = {}\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(\n\t\towner,\n\t\t() => ({ ...props }),\n\t\t(all) => {\n\t\t\tconst next = nativeProps(all)\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},\n\t)\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: () => Child,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tconst cursor = hydrating ? { node: host.firstChild } : undefined\n\tconst prefix = cursor?.node?.nodeValue?.slice(2)\n\tif (\n\t\thydrating &&\n\t\t(prefix === undefined ||\n\t\t\t(options.idPrefix !== undefined && prefix !== options.idPrefix))\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: hydration mismatch` : undefined)\n\tconst root = createRoot(options)\n\tif (prefix !== undefined) root._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\tif (cursor?.node)\n\t\t\tthrow new Error(\n\t\t\t\timport.meta.env.DEV ? `spa: hydration mismatch` : undefined,\n\t\t\t)\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: () => Child,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Child,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAeA,MAAM,OAAO;AACb,MAAM,MAAM;AAIZ,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,WAEjD,MAAM,IAAI,MACa,yBACvB;EACD,OAAO;EACP,OAAO,OAAO,MAAM;CACrB,OAAO,OAAO,aAAa,MAAM,SAAS,OAAO,OAAO,MAAM;CAC9D,MAAM,UAAU,UAAU;EACxB,KAAoB,OAAO;CAC7B,CAAC;CACD,OAAO;AACR;AACA,SAAS,QACR,OACA,QACA,QACA,OACA,QACO;CACP,OAAO,KACN,OAAO,cAAe,cAAc,KAAK,GACzC,QACA,QACA,OACA,MACD;AACD;AACA,SAAS,SACR,SACA,KACA,OACA,UACO;CACP,IAAI,uBAAuB,KAAK,GAAG,GAAG;CACtC,IAAI,QAAQ,eAAe,QAAQ,cAAc,cAAc;CAC/D,IACC,wEAAwE,KACvE,GACD,GAEA,MAAM,IAAI,MAA4B,oBAAgC;CACvE,IAAI,IAAI,WAAW,IAAI,GAAG;EACzB,MAAM,UAAU,uBAAuB,KAAK,GAAG;EAC/C,MAAM,QAAQ,IACZ,MAAM,GAAG,UAAU,KAAK,KAAA,CAAS,CAAC,CAClC,YAAY,CAAC,CACb,QAAQ,eAAe,UAAU;EACnC,IAAI,UAAU,QAAQ,oBAAoB,OAAO,UAAU,OAAO;EAClE,IAAI,SAAS,MAAM;GAClB,IAA2B,OAAO,UAAU,YAC3C,MAAM,IAAI,MAAM,oBAAoB;GAC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
|
1
|
-
import {
|
|
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-DZFaOyTO.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-
|
|
5
|
-
export { Fragment, hydrate, onCleanup, onMount, render, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction
|
|
3
|
+
import { n as render, t as hydrate } from "./dom-Dwa2SFTn.js";
|
|
4
|
+
import { t as useLoadable } from "./src-BUtG4BgX.js";
|
|
5
|
+
export { Fragment, hydrate, onCleanup, onMount, render, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as capabilityProps } from "./capabilities-BkQ2i0vV.js";
|
|
2
|
+
import { c as onCleanup, l as onMount, u as owner } from "./core-DZFaOyTO.js";
|
|
2
3
|
import { jsx } from "./jsx-runtime.js";
|
|
3
4
|
import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
|
|
4
5
|
import Konva from "konva";
|
|
@@ -16,6 +17,16 @@ const constructors = {
|
|
|
16
17
|
Star: Konva.Star,
|
|
17
18
|
Transformer: Konva.Transformer
|
|
18
19
|
};
|
|
20
|
+
function suspendNode(node) {
|
|
21
|
+
const listening = node.listening();
|
|
22
|
+
const draggable = node.draggable();
|
|
23
|
+
node.listening(false);
|
|
24
|
+
node.draggable(false);
|
|
25
|
+
return () => {
|
|
26
|
+
node.listening(listening);
|
|
27
|
+
node.draggable(draggable);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
19
30
|
function updateNode(node, props, previous) {
|
|
20
31
|
for (const key of /* @__PURE__ */ new Set([...Object.keys(previous), ...Object.keys(props)])) {
|
|
21
32
|
if (/^(key|children|ref)$/.test(key) || Object.is(props[key], previous[key])) continue;
|
|
@@ -31,6 +42,9 @@ const renderer = createSceneRenderer({
|
|
|
31
42
|
return {
|
|
32
43
|
kind: `konva`,
|
|
33
44
|
node,
|
|
45
|
+
suspend() {
|
|
46
|
+
return suspendNode(node);
|
|
47
|
+
},
|
|
34
48
|
read: (key) => node.getAttr(key),
|
|
35
49
|
write: (key, value) => {
|
|
36
50
|
node.setAttr(key, value);
|
|
@@ -68,8 +82,13 @@ const renderer = createSceneRenderer({
|
|
|
68
82
|
function Stage(props) {
|
|
69
83
|
let container = null;
|
|
70
84
|
onMount(() => {
|
|
85
|
+
const surface = container.ownerDocument.createElement(`div`);
|
|
86
|
+
container.append(surface);
|
|
87
|
+
onCleanup(() => {
|
|
88
|
+
surface.remove();
|
|
89
|
+
});
|
|
71
90
|
const stage = new Konva.Stage({
|
|
72
|
-
container,
|
|
91
|
+
container: surface,
|
|
73
92
|
width: props.width ?? 300,
|
|
74
93
|
height: props.height ?? 150
|
|
75
94
|
});
|
|
@@ -80,6 +99,9 @@ function Stage(props) {
|
|
|
80
99
|
const nativeProps = capabilityProps(owner, {
|
|
81
100
|
kind: `konva`,
|
|
82
101
|
node: stage,
|
|
102
|
+
suspend() {
|
|
103
|
+
return suspendNode(stage);
|
|
104
|
+
},
|
|
83
105
|
listen(event, listener) {
|
|
84
106
|
stage.on(event, listener);
|
|
85
107
|
return () => {
|
|
@@ -90,7 +112,7 @@ function Stage(props) {
|
|
|
90
112
|
write: (key, value) => {
|
|
91
113
|
stage.setAttr(key, value);
|
|
92
114
|
}
|
|
93
|
-
});
|
|
115
|
+
}, () => ({ ...props }));
|
|
94
116
|
let previous = {};
|
|
95
117
|
bindScene(() => ({ ...props }), (all) => {
|
|
96
118
|
const next = nativeProps(all);
|
|
@@ -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 { Child, VNode } 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?: Child\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 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\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): VNode {\n\tlet container: HTMLDivElement | null = null\n\tonMount(() => {\n\t\tconst stage = new Konva.Stage({\n\t\t\tcontainer:
|
|
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 { Child, VNode } 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?: Child\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): VNode {\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\tsceneComponent<Props<Konva.TransformerConfig, Konva.Transformer>>(\n\t\t`Transformer`,\n\t)\nexport { renderer as konvaRenderer }\n"],"mappings":";;;;;;AAmBA,MAAM,eAAe;CACpB,OAAO,MAAM;CACb,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,QAAQ,MAAM;CACd,SAAS,MAAM;CACf,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,OAAO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