@memoized-dom/runtime 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access.d.ts +7 -3
- package/dist/access.d.ts.map +1 -1
- package/dist/async-storage.d.ts +9 -0
- package/dist/async-storage.d.ts.map +1 -0
- package/dist/chunks/access-CMv8a6Cm.js +1 -0
- package/dist/chunks/jsx-dom-C2FcLSgz.js +1 -0
- package/dist/chunks/mount-COP9U3A-.js +1 -0
- package/dist/chunks/src-CMZZbF4X.js +0 -0
- package/dist/cleanup.d.ts +3 -0
- package/dist/cleanup.d.ts.map +1 -1
- package/dist/cond.d.ts +1 -1
- package/dist/cond.d.ts.map +1 -1
- package/dist/dirty-reasons.d.ts +12 -5
- package/dist/dirty-reasons.d.ts.map +1 -1
- package/dist/effect.d.ts.map +1 -1
- package/dist/environment.d.ts +60 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/events.d.ts +3 -7
- package/dist/events.d.ts.map +1 -1
- package/dist/hot.d.ts.map +1 -1
- package/dist/hot.js +1 -0
- package/dist/hydrate.d.ts +19 -0
- package/dist/hydrate.d.ts.map +1 -0
- package/dist/hydrate.js +1 -0
- package/dist/hydration-error.d.ts +8 -0
- package/dist/hydration-error.d.ts.map +1 -0
- package/dist/hydration.d.ts +123 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/jsx-dom.d.ts.map +1 -1
- package/dist/kernel.d.ts +85 -40
- package/dist/kernel.d.ts.map +1 -1
- package/dist/list-keys.d.ts +40 -0
- package/dist/list-keys.d.ts.map +1 -0
- package/dist/list-update.d.ts +6 -0
- package/dist/list-update.d.ts.map +1 -0
- package/dist/list.d.ts +3 -7
- package/dist/list.d.ts.map +1 -1
- package/dist/mount.d.ts +11 -3
- package/dist/mount.d.ts.map +1 -1
- package/dist/props.d.ts.map +1 -1
- package/dist/refs.d.ts +3 -0
- package/dist/refs.d.ts.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1 -0
- package/dist/state-cells.d.ts +51 -0
- package/dist/state-cells.d.ts.map +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +55 -28
- package/dist/chunks/chunk-S23GGVHN.js +0 -1
package/dist/access.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* M3 — The static access table: compile-time read/write knowledge.
|
|
2
|
+
* access.ts — M3 — The static access table: compile-time read/write knowledge.
|
|
4
3
|
*
|
|
5
4
|
* In the real pipeline (M5) the COMPILER emits this table per app by analyzing
|
|
6
5
|
* component bodies. In the bootstrap we hand-write it — we are the compiler.
|
|
@@ -18,6 +17,11 @@
|
|
|
18
17
|
* HONEST LIMITATION: ordinary 'Row[*]' readers over-approximate and dirty all
|
|
19
18
|
* matching live rows. Parametrized payload patterns can narrow this when the
|
|
20
19
|
* compiler has a precise target; otherwise guarded writes absorb the slack.
|
|
20
|
+
*
|
|
21
|
+
* SSR Slice 1.1b — all resolver state lives on the active application
|
|
22
|
+
* runtime. Installed fragments and their derived matcher caches are
|
|
23
|
+
* request-scoped: two concurrent server renders maintain completely separate
|
|
24
|
+
* tables, and a runtime's registry listener mutates only its own expansions.
|
|
21
25
|
*/
|
|
22
26
|
import { type EntityId } from './kernel';
|
|
23
27
|
export interface AccessTable {
|
|
@@ -53,5 +57,5 @@ export declare function resolveStaticWrites(writes: readonly string[]): EntityId
|
|
|
53
57
|
*
|
|
54
58
|
* Returns 'root-subtree' when any write is opaque — the Imba fallback.
|
|
55
59
|
*/
|
|
56
|
-
export declare function resolveWrites(writes: readonly string[], _liveIds: readonly EntityId[], payload?: Record<string,
|
|
60
|
+
export declare function resolveWrites(writes: readonly string[], _liveIds: readonly EntityId[], payload?: Record<string, unknown>): EntityId[] | 'root-subtree';
|
|
57
61
|
//# sourceMappingURL=access.d.ts.map
|
package/dist/access.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;CACzD;AAmKD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,QAAQ,EACd,KAAK,SAAsC,GAC1C,IAAI,CAON;AAyBD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxD;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,SAAS,IAAI,QAAQ,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,QAAQ,EAAE,GAAG,cAAc,CAG7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,QAAQ,EAAE,GAAG,cAAc,CAgE7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface StorageShim<T> {
|
|
2
|
+
getStore(): T | undefined;
|
|
3
|
+
run<R>(store: T, callback: () => R): R;
|
|
4
|
+
}
|
|
5
|
+
export type StorageFactory = <T>() => StorageShim<T>;
|
|
6
|
+
/** Configure the host-specific scoped-storage implementation. */
|
|
7
|
+
export declare function setStorageFactory(factory: StorageFactory): void;
|
|
8
|
+
export declare function createStorage<T>(name?: string): StorageShim<T>;
|
|
9
|
+
//# sourceMappingURL=async-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-storage.d.ts","sourceRoot":"","sources":["../src/async-storage.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AAKrD,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAE/D;AAoBD,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,SAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAyBjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,h as t,l as n,m as r}from"./jsx-dom-C2FcLSgz.js";const i=/^[A-Za-z0-9._~-]+$/;function a(e){if(i.test(e))return e;let t=``;for(let n of e)if(i.test(n))t+=n;else try{t+=encodeURIComponent(n)}catch{return null}return t}function o(e){let t=typeof e;if(t===`number`){if(Number.isNaN(e))return null;let t=a(String(e));return t===null?null:`n:${t}`}if(t===`string`){let t=a(e);return t===null?null:`s:${t}`}if(t===`bigint`){let t=a(e.toString());return t===null?null:`g:${t}`}return t===`boolean`?e?`t`:`f`:null}function s(e){if(!e.includes(`%`))return e;try{return decodeURIComponent(e)}catch{return null}}function c(e){if(e===`t`)return!0;if(e===`f`)return!1;if(e.startsWith(`n:`)){let t=s(e.slice(2));return t===null||t===``||Number.isNaN(Number(t))?void 0:Number(t)}if(e.startsWith(`g:`)){let t=s(e.slice(2));return t===null||!/^-?\d+$/.test(t)?void 0:BigInt(t)}if(e.startsWith(`s:`)){let t=s(e.slice(2));return t===null?void 0:t}}function l(){return{rootId:``,exactReaders:new Map,wildReaders:new Map,paramReaders:new Map,opaqueVars:new Set,fragments:new Map,allKeysCache:[],wildMatched:new Map,resVersion:0,matchKeysCache:new Map,resolutionCache:new Map}}function u(){return n(`access`,l)}function d(t,n=e()){t.wildMatched=new Map;for(let[e,r]of t.wildReaders){let i=new Set;for(let e of r)for(let t of n)e.test(t)&&i.add(t);t.wildMatched.set(e,i)}}r((e,t)=>{let n=u();if(n.wildReaders.size===0)return;let r=!1;if(t===`add`)for(let[t,i]of n.wildReaders){let a=n.wildMatched.get(t);if(a){for(let t of i)if(t.test(e)){a.add(e),r=!0;break}}}else for(let t of n.wildMatched.values())t.delete(e)&&(r=!0);r&&n.resVersion++});function f(e){if(!e.includes(`*`))return null;let t=e.split(`**`).map(e=>e.split(`*`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`[^/]*`)).join(`.*`);return RegExp(`^${t}$`)}function p(t=u(),n=e()){t.rootId=``,t.exactReaders=new Map,t.wildReaders=new Map,t.paramReaders=new Map,t.opaqueVars=new Set;for(let{table:e,root:n}of t.fragments.values()){t.rootId=n;for(let[n,r]of Object.entries(e.readers))for(let e of r){let r=f(e);if(r===null){let r=t.exactReaders.get(n)??[];r.includes(e)||r.push(e),t.exactReaders.set(n,r)}else{let e=t.wildReaders.get(n)??[];e.some(e=>e.source===r.source)||e.push(r),t.wildReaders.set(n,e)}}for(let[n,r]of Object.entries(e.params??{})){let e=t.paramReaders.get(n)??[];for(let t of r)e.includes(t.pattern)||e.push(t.pattern);t.paramReaders.set(n,e)}for(let n of e.opaque??[])t.opaqueVars.add(n)}t.allKeysCache=[...new Set([...t.exactReaders.keys(),...t.wildReaders.keys()])],t.matchKeysCache.clear(),t.resolutionCache.clear(),d(t,n),t.resVersion++}function m(e,t,n=`${t}\0${JSON.stringify(e)}`){u().fragments.set(n,{table:e,root:t}),h.set(n,{table:e,root:t}),p()}const h=new Map;t(e=>{if(h.size===0)return;let t=e.state.extensions,n=t.get(`access`);n===void 0&&(n=l(),t.set(`access`,n));for(let[e,t]of h)n.fragments.set(e,{table:t.table,root:t.root});p(n,e.state.registry.keys())});function g(e){u().fragments.delete(e)&&(h.delete(e),p())}function _(){u().fragments.clear(),h.clear(),p()}function v(e){return u().opaqueVars.has(e)}function y(){return u().rootId}function b(e){return e.some(v)?`root-subtree`:S(e)}function x(e,t,n){if(e.some(v))return`root-subtree`;if(n){let t=new Set,r=!0;for(let i of e){let e=u().paramReaders.get(i);if(e===void 0||e.length===0){r=!1;break}for(let i of e){let e=!1,a=i.replace(/\{([^}]+)\}/g,(t,r)=>{let i=r.trim();if(!i.startsWith(`payload.`))return e=!0,``;let a=n;for(let t of i.slice(8).split(`.`)){if(typeof a!=`object`||!a)return e=!0,``;a=a[t]}if(a==null)return e=!0,``;let s=o(a);return s===null?(e=!0,``):s});if(e){r=!1;break}t.add(a)}if(!r)break;for(let e of u().exactReaders.get(i)??[])t.add(e)}if(r&&t.size>0)return[...t]}return S(e)}function S(e){let t=u(),n=e.length===1?e[0]:e.join(` `),r=t.resolutionCache.get(n);if(r!==void 0&&r.v===t.resVersion)return r.result;let i=new Set,a=new Set;for(let n of e){let e=t.matchKeysCache.get(n);if(e===void 0){e=[];for(let r of t.allKeysCache)(r===n||r.startsWith(`${n}.`)||n.startsWith(`${r}.`))&&e.push(r);t.matchKeysCache.set(n,e)}for(let t of e)a.add(t)}for(let e of a){for(let n of t.exactReaders.get(e)??[])i.add(n);for(let n of t.wildMatched.get(e)??[])i.add(n)}let o=[...i];return t.resolutionCache.set(n,{v:t.resVersion,result:o}),o}export{b as a,c,_ as i,o as l,m as n,x as o,v as r,g as s,y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=n;function t(t){e=t}function n(){let e;return{getStore(){return e},run(t,n){let r=e;e=t;try{return n()}finally{e=r}}}}function r(t=`default`){let n=globalThis,r=n.__MMD_ASYNC_STORAGE__??=new Map,i=r.get(t);if(i!==void 0)return i;let a,o={getStore(){return a??=e(),a.getStore()},run(t,n){return a??=e(),a.run(t,n)}};return r.set(t,o),o}function i(){return new Map}function a(e,t,n,r){if(r===void 0||Array.isArray(r)&&r.length===0){e.size!==0&&e.delete(t);return}if(!n){typeof r==`number`||typeof r==`string`?e.set(t,r):r.length===1?e.set(t,r[0]):e.set(t,new Set(r));return}let i=e.get(t);if(i===void 0)return;let a=typeof r==`number`||typeof r==`string`?[r]:r;if(!(i instanceof Set)){a.some(e=>e!==i)&&e.set(t,new Set([i,...a]));return}for(let e of a)i.add(e)}function o(e,t){if(e.size===0)return null;let n=e.get(t)??null;return e.delete(t),n}function s(e,t){e.size!==0&&e.delete(t)}function c(){if(typeof document>`u`)throw Error(`[memo-dom] no document available - server environments must inject a DocumentLike into their application runtime`);return document}function l(){return typeof requestAnimationFrame==`function`?requestAnimationFrame.bind(globalThis):null}function u(){return{mode:`client-create`,get document(){return c()},get schedule(){return l()},effects:`run`,refs:`run`}}function d(e){let t=u();return e===void 0?t:{mode:e.mode??t.mode,document:e.document??t.document,schedule:e.schedule===void 0?t.schedule:e.schedule,effects:e.effects??t.effects,refs:e.refs??t.refs,hydration:e.hydration}}const f=typeof queueMicrotask==`function`?queueMicrotask.bind(globalThis):e=>Promise.resolve().then(e);function p(e){return{registry:new Map,dirty:new Set,volatile:new Set,dirtyReasons:i(),cells:new Map,idsCache:null,generation:0,scheduler:f,volatileFrameScheduled:!1,scheduled:!1,inCommit:!1,renderingEntity:null,renderCounts:null,markedBy:null,extensions:new Map,environment:d(e)}}let m=0;function h(e=`runtime-${++m}`,t){let n=p(t),r={id:e,state:n,dispose(){let e=[...n.registry.keys()];for(let t of e)z(n,t);n.dirty.clear(),n.dirtyReasons.clear(),n.cells.clear(),n.volatile.clear(),n.idsCache=null,n.scheduled=!1,n.inCommit=!1,n.renderingEntity=null,n.renderCounts=null,n.markedBy=null,n.extensions.clear(),v===r&&(v=g)}};for(let e of b)e(r);return r}const g={id:`browser-default`,state:p(),dispose(){throw Error(`[memo-dom] the default browser runtime cannot be disposed`)}},_=r(`runtime`);let v=g;function y(){return _.getStore()??v}const b=[];function x(e){return b.push(e),()=>{let t=b.indexOf(e);t>=0&&b.splice(t,1)}}function S(e){let t=v;return v=e,t}function C(e,t){let n=v;return _.run(e,()=>{v=e;try{return t()}finally{v=n}})}function w(e){y().state.scheduler=e}function T(){return y().state.environment}function E(){return y().state.environment.hydration===void 0}function D(e,t){let n=y().state,r=n.environment;n.environment={mode:e.mode??r.mode,document:e.document??r.document,schedule:e.schedule===void 0?r.schedule:e.schedule,effects:e.effects??r.effects,refs:e.refs??r.refs,hydration:e.hydration??r.hydration};try{return t()}finally{n.environment=r}}function O(e,t){let n=y().state.extensions,r=n.get(e);if(r!==void 0)return r;let i=t();return n.set(e,i),i}function k(){y().state.scheduler=f}const A=[],j=[];function M(e){j.includes(e)||j.push(e)}function N(e){A.push(e)}function P(e,t){for(let n of A)n(e,t)}function F(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===47&&t++;return t}function I(e){if(e.volatileFrameScheduled||e.volatile.size===0)return;let t=e.environment.schedule;t!==null&&(e.volatileFrameScheduled=!0,t(()=>{if(e.volatileFrameScheduled=!1,e.environment.document.hidden!==!0)for(let t of e.volatile)G(t,-1);I(e)}))}function L(e){let t=y().state,n=e.parent===null?void 0:t.registry.get(e.parent);e.depth=e.depth??(n&&n.depth!==void 0?n.depth+1:F(e.id)),t.registry.set(e.id,e),e.volatile===!0?t.volatile.add(e.id):t.volatile.delete(e.id),n&&(n.children??=new Set).add(e.id),t.idsCache=null,t.generation++,P(e.id,`add`),I(t)}function R(e){z(y().state,e)}function z(e,t){let n=e.registry.get(t);if(!n)return;n.parent!==null&&e.registry.get(n.parent)?.children?.delete(t);let r=[t],i=[],a=[];for(;r.length>0;){let t=r.pop(),n=e.registry.get(t);if(n&&(i.push(t),n.children))for(let e of n.children)r.push(e)}i.reverse();for(let t of i)e.registry.delete(t),e.dirty.delete(t),e.volatile.delete(t),s(e.dirtyReasons,t),P(t,`remove`);for(let e of i)for(let t of j){let n=t(e);n!==void 0&&a.push(...n)}if(e.idsCache=null,e.generation++,a.length===1)throw a[0];if(a.length>1)throw AggregateError(a,`[memo-dom] ${a.length} cleanup disposers failed while unregistering '${t}'`)}function B(e){R(e)}function V(e){return y().state.registry.has(e)}function H(e){return y().state.registry.get(e)}function U(e){let t=y().state,n=e=>{if(e.children!==void 0)for(let r of e.children){let e=t.registry.get(r);e!==void 0&&(e.phase!==`effect`&&(e.render(),K(r)),n(e))}},r=e=>{if(e.children!==void 0)for(let n of e.children){let e=t.registry.get(n);e!==void 0&&(e.phase===`effect`&&(e.render(),K(n)),r(e))}},i=t.registry.get(e);i!==void 0&&(n(i),r(i))}function W(){let e=y().state;return e.idsCache??=[...e.registry.keys()],e.idsCache}function G(e,t){let n=y().state;if(!n.registry.has(e))return;n.inCommit&&n.markedBy!==null&&n.renderingEntity!==null&&n.markedBy.set(e,n.renderingEntity);let r=n.dirty.has(e);(t!==void 0||r)&&a(n.dirtyReasons,e,r,t),n.dirty.add(e),J(n)}function K(e){let t=y().state;t.dirty.size!==0&&t.dirty.delete(e)&&s(t.dirtyReasons,e)}function q(e){let t=y().state,n=e+`/`,r=!1;for(let i of t.registry.keys())(i===e||i.startsWith(n))&&(t.dirty.add(i),s(t.dirtyReasons,i),r=!0);r&&J(t)}function J(e){e.scheduled||e.inCommit||(e.scheduled=!0,e.scheduler(Y))}function Y(){let e=y().state;if(e.scheduled=!1,!e.inCommit){e.inCommit=!0,e.renderCounts??=new Map,e.markedBy??=new Map;try{for(let t=0;t<100&&e.dirty.size>0;t++){let t=[];for(let n of e.dirty){let r=e.registry.get(n);r?t.push(r):(e.dirty.delete(n),s(e.dirtyReasons,n))}let n=t.some(e=>e.phase!==`effect`)?t.filter(e=>e.phase!==`effect`):t;n.sort((e,t)=>(e.depth??0)-(t.depth??0));for(let t of n)if(e.dirty.delete(t.id)){let n=(e.renderCounts.get(t.id)??0)+1;if(e.renderCounts.set(t.id,n),n>12){let r=new Map;for(let[n,i]of e.markedBy){let a=e.renderCounts.get(n)??0;(n===t.id||a>1)&&r.set(i,(r.get(i)??0)+1)}let i=[...r].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e,t])=>`${e} (${t} marks)`).join(`, `);throw Error(`[memo-dom] entity '${t.id}' rendered ${n} times within a single commit — a render cycle involves it. Entities that marked it or its participants during this commit: ${i||`unknown`}. An effect likely writes state its own owner's update re-reads.`)}e.renderingEntity=t.id;try{t.render(o(e.dirtyReasons,t.id))}finally{e.renderingEntity=null}}}if(e.dirty.size>0)throw Error(`[memo-dom] commit cascade exceeded 100 passes — an update is dirtying its own readers (cycle)`)}finally{e.inCommit=!1,e.renderingEntity=null,e.renderCounts=null,e.markedBy=null}}}function X(){let e=y().state;return{registry:e.registry,dirtySet:e.dirty,volatileSet:e.volatile}}function Z(e){if(e.nodeType!==11)return[e];if(typeof e==`object`&&e&&`__mmdAdoptedChildren`in e){let t=e;if(t.__mmdAdoptedChildren!==void 0)return[...t.__mmdAdoptedChildren]}return Array.from(e.childNodes)}export{w as C,r as D,R as E,t as O,S,B as T,W as _,h as a,C as b,H as c,G as d,q as f,L as g,x as h,Y as i,O as l,N as m,X as n,y as o,M as p,E as r,T as s,Z as t,V as u,U as v,K as w,D as x,k as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,l as t,s as n,t as r}from"./jsx-dom-C2FcLSgz.js";var i=class extends Error{boundary;expected;actual;constructor(e,t,n){super(`memoized-dom: hydration mismatch in '${e}': expected ${t}, found ${n}`),this.name=`HydrationMismatchError`,this.boundary=e,this.expected=t,this.actual=n}};const a=new WeakMap;function o(){return t(`mount`,()=>({mountedHosts:new WeakMap,mountedRoots:new Map}))}function s(e,t){a.set(e,t)}function c(e){for(let t of e)t.parentNode?.removeChild(t)}function l(e){if(typeof e!=`string`)return e;let t=n().document.getElementById(e);if(t===null)throw Error(`memoized-dom: mount target '#${e}' was not found`);return t}function u(t,n){let i=l(t);if(o().mountedHosts.has(i))throw Error(`memoized-dom: mount target already owns an application`);let s=a.get(n);if(s===void 0)throw Error(`memoized-dom: mount received a component that is not a compiled application root`);if(o().mountedRoots.has(s.id))throw Error(`memoized-dom: root entity '${s.id}' is already mounted`);if(o().mountedRoots.size>0)throw Error(`memoized-dom: the runtime currently supports one mounted application`);let u;try{u=s.create({mode:`create`,host:i})}catch(t){throw e(s.id),t}let d=r(u);try{i.appendChild(u)}catch(t){throw e(s.id),c(d),t}let f=!0,p={host:i,rootId:s.id,nodes:d,get mounted(){return f},unmount(){if(f){f=!1,o().mountedHosts.delete(i),o().mountedRoots.delete(s.id);try{e(s.id)}finally{c(d)}}}};return o().mountedHosts.set(i,p),o().mountedRoots.set(s.id,p),p}function d(e){return a.get(e)}export{l as a,c as i,o as n,d as o,s as r,i as s,u as t};
|
|
Binary file
|
package/dist/cleanup.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* `cleanup(componentId, disposer)`. Registrations may happen before the
|
|
6
6
|
* component enters the entity registry; unregistering the entity owns and
|
|
7
7
|
* synchronously drains its disposers.
|
|
8
|
+
*
|
|
9
|
+
* Disposer storage lives on the active application runtime, so concurrent
|
|
10
|
+
* server requests never drain each other's teardowns.
|
|
8
11
|
*/
|
|
9
12
|
import { type EntityId } from './kernel';
|
|
10
13
|
export type CleanupDisposer = () => void;
|
package/dist/cleanup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAsC,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC;AAsBzC,mEAAmE;AACnE,wBAAgB,OAAO,CACrB,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,eAAe,GACxB,eAAe,CAkBjB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,EAAE,CAoB/D"}
|
package/dist/cond.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - A swap destroys branch-local DOM state (focus, scroll); module state
|
|
16
16
|
* survives, so re-mounting a branch reflects current state.
|
|
17
17
|
*/
|
|
18
|
-
import type
|
|
18
|
+
import { type EntityId } from './kernel';
|
|
19
19
|
export interface CondEntry {
|
|
20
20
|
/** Root nodes of the mounted branch (elements or fragment children). */
|
|
21
21
|
nodes: Node[];
|
package/dist/cond.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cond.d.ts","sourceRoot":"","sources":["../src/cond.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"cond.d.ts","sourceRoot":"","sources":["../src/cond.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,WAAW,SAAS;IACxB,wEAAwE;IACxE,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,2CAA2C;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,UAAU;IACzB,2EAA2E;IAC3E,MAAM,IAAI,IAAI,CAAC;IACf,sCAAsC;IACtC,KAAK,IAAI,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,IAAI,EACZ,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,MAAM,EAClB,QAAQ,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EAAE,GAC9C,UAAU,CAqFZ"}
|
package/dist/dirty-reasons.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Batches exact numeric causes for dirty entities until their next render.
|
|
3
|
+
*
|
|
4
|
+
* The pending store lives on the active application runtime so concurrent
|
|
5
|
+
* server renders never observe each other's reasons.
|
|
3
6
|
*/
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
7
|
+
export type DirtyReason = number | string;
|
|
8
|
+
export type DirtyReasonInput = DirtyReason | readonly DirtyReason[];
|
|
9
|
+
export type DirtyReasons = DirtyReason | ReadonlySet<DirtyReason> | null;
|
|
6
10
|
type EntityId = string;
|
|
11
|
+
/** Per-runtime cause storage; owned by the kernel's application runtime. */
|
|
12
|
+
export type DirtyReasonStore = Map<EntityId, DirtyReason | Set<DirtyReason>>;
|
|
13
|
+
export declare function createDirtyReasonStore(): DirtyReasonStore;
|
|
7
14
|
/** Merge an exact cause, or clear causes when the update must be full. */
|
|
8
|
-
export declare function mergeDirtyReasons(id: EntityId, wasDirty: boolean, reason: DirtyReasonInput | undefined): void;
|
|
15
|
+
export declare function mergeDirtyReasons(store: DirtyReasonStore, id: EntityId, wasDirty: boolean, reason: DirtyReasonInput | undefined): void;
|
|
9
16
|
/** Consume pending causes; absence is the full-update sentinel. */
|
|
10
|
-
export declare function takeDirtyReasons(id: EntityId): DirtyReasons;
|
|
17
|
+
export declare function takeDirtyReasons(store: DirtyReasonStore, id: EntityId): DirtyReasons;
|
|
11
18
|
/** Discard causes for an update that was cancelled or became conservative. */
|
|
12
|
-
export declare function clearDirtyReasons(id: EntityId): void;
|
|
19
|
+
export declare function clearDirtyReasons(store: DirtyReasonStore, id: EntityId): void;
|
|
13
20
|
export {};
|
|
14
21
|
//# sourceMappingURL=dirty-reasons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dirty-reasons.d.ts","sourceRoot":"","sources":["../src/dirty-reasons.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dirty-reasons.d.ts","sourceRoot":"","sources":["../src/dirty-reasons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,WAAW,EAAE,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;AAEzE,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,QAAQ,EAAE,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAE7E,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,gBAAgB,GAAG,SAAS,GACnC,IAAI,CAiCN;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,gBAAgB,EACvB,EAAE,EAAE,QAAQ,GACX,YAAY,CAKd;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI,CAE7E"}
|
package/dist/effect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,GAAG,eAAe,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC;AAE5C,wBAAgB,cAAc,CAC5B,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,QAAQ,GAAG,IAAI,EACvB,QAAQ,EAAE,cAAc,GACvB,IAAI,CA0CN;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,QAAQ,GAAG,IAAI,EACvB,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,cAAc,GACvB,IAAI,CA+BN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* environment.ts - Phase 1.2 capability descriptor.
|
|
3
|
+
*
|
|
4
|
+
* Runtime behavior must be selected by explicit capabilities, not inferred
|
|
5
|
+
* from `typeof window` probes scattered across modules. The active
|
|
6
|
+
* application runtime carries one RenderEnvironment; the browser default
|
|
7
|
+
* resolves lazily against ambient globals so existing imports behave
|
|
8
|
+
* identically.
|
|
9
|
+
*
|
|
10
|
+
* Modes map to proposal phases:
|
|
11
|
+
* client-create ordinary browser mounting (today's only path)
|
|
12
|
+
* server-dom Phase 1.4 LinkeDOM reference rendering
|
|
13
|
+
* server-string Phase 4 string writer
|
|
14
|
+
* hydrate Phase 3 adoption
|
|
15
|
+
*/
|
|
16
|
+
import type { HydrationController } from './hydration';
|
|
17
|
+
export type RenderMode = 'client-create' | 'server-dom' | 'server-string' | 'hydrate';
|
|
18
|
+
/**
|
|
19
|
+
* Lifecycle capabilities. 'defer' is reserved for hydration (Phase 3):
|
|
20
|
+
* recorded now, executed after adoption. Until then it behaves like
|
|
21
|
+
* 'disabled'.
|
|
22
|
+
*/
|
|
23
|
+
export type Capability = 'run' | 'defer' | 'disabled';
|
|
24
|
+
/**
|
|
25
|
+
* The node operations the RUNTIME itself performs (structural anchors,
|
|
26
|
+
* fragments, range removal, host lookup). Compiled element creation goes
|
|
27
|
+
* through the same document in server-dom mode once Phase 1.4 lands; the
|
|
28
|
+
* string tier replaces it in Phase 4.
|
|
29
|
+
*/
|
|
30
|
+
export interface DocumentLike {
|
|
31
|
+
readonly hidden?: boolean;
|
|
32
|
+
createComment(data: string): Comment;
|
|
33
|
+
createElement(tagName: string): Element;
|
|
34
|
+
createElementNS(namespaceURI: string, qualifiedName: string): Element;
|
|
35
|
+
createTextNode(data: string): Text;
|
|
36
|
+
createDocumentFragment(): DocumentFragment;
|
|
37
|
+
createRange?(): Range;
|
|
38
|
+
getElementById(id: string): Element | null;
|
|
39
|
+
}
|
|
40
|
+
export interface RenderEnvironment {
|
|
41
|
+
mode: RenderMode;
|
|
42
|
+
/**
|
|
43
|
+
* Node source for runtime-owned structure. Defaults to the ambient
|
|
44
|
+
* document in client-create mode; server modes must inject one.
|
|
45
|
+
*/
|
|
46
|
+
document: DocumentLike;
|
|
47
|
+
/**
|
|
48
|
+
* Driver for conservative volatile-pull frames. null disables pulling
|
|
49
|
+
* entirely (servers render synchronously; nothing keeps ticking).
|
|
50
|
+
*/
|
|
51
|
+
schedule: ((fn: () => void) => void) | null;
|
|
52
|
+
effects: Capability;
|
|
53
|
+
refs: Capability;
|
|
54
|
+
hydration?: HydrationController;
|
|
55
|
+
}
|
|
56
|
+
/** Browser default: ambient document, rAF pulls, everything runs. */
|
|
57
|
+
export declare function clientEnvironment(): RenderEnvironment;
|
|
58
|
+
/** Merge partial overrides over the client default. */
|
|
59
|
+
export declare function resolveEnvironment(overrides?: Partial<RenderEnvironment>): RenderEnvironment;
|
|
60
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,YAAY,GACZ,eAAe,GACf,SAAS,CAAC;AAEd;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;IACtE,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,sBAAsB,IAAI,gBAAgB,CAAC;IAC3C,WAAW,CAAC,IAAI,KAAK,CAAC;IACtB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5C,OAAO,EAAE,UAAU,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC;AAiBD,qEAAqE;AACrE,wBAAgB,iBAAiB,IAAI,iBAAiB,CAarD;AAED,uDAAuD;AACvD,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,iBAAiB,CAYnB"}
|
package/dist/events.d.ts
CHANGED
|
@@ -23,14 +23,10 @@ export interface EventRecord {
|
|
|
23
23
|
/** Provenance for every routed event — devtools, tests, debugging. */
|
|
24
24
|
export declare function getEventLog(): readonly EventRecord[];
|
|
25
25
|
export declare function clearEventLog(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Route exact or bounded effects through the static access table and dirty
|
|
28
|
-
* their readers.
|
|
29
|
-
* This is THE invalidation entry point — handlers and programmatic sources
|
|
30
|
-
* share it, so there is exactly one routing code path in the runtime.
|
|
31
|
-
*/
|
|
32
26
|
export declare function commitWrites(writes: readonly string[]): void;
|
|
27
|
+
/** Route a compiler-proven structure-only collection write. */
|
|
28
|
+
export declare function commitStructuralWrites(writes: readonly string[]): void;
|
|
33
29
|
/** Route an L2 payload through parameterized access patterns. */
|
|
34
|
-
export declare function commitWritesWithPayload(writes: readonly string[], payload: Record<string,
|
|
30
|
+
export declare function commitWritesWithPayload(writes: readonly string[], payload: Record<string, unknown>): void;
|
|
35
31
|
export declare function handle<T extends Event>(origin: EntityId, writes: readonly string[], fn: (ev: T) => void): (ev: T) => void;
|
|
36
32
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAYtE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAKD,sEAAsE;AACtE,wBAAgB,WAAW,IAAI,SAAS,WAAW,EAAE,CAEpD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAoBD,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAE5D;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CActE;AAED,iEAAiE;AACjE,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAON;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EACpC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,GAClB,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CASjB"}
|
package/dist/hot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hot.d.ts","sourceRoot":"","sources":["../src/hot.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAIlB,MAAM,MAAM,mBAAmB,GAAG,CAChC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,OAAO,EAAE,KACd,IAAI,CAAC;AAUV,MAAM,MAAM,kBAAkB,GAAG,SAAS;IACxC,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,mBAAmB,GAAG,SAAS;IACrC,WAAW,EAAE,OAAO;CACrB,CAAC;AAyBF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,QAAQ,GAAG,IAAI,EACvB,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,GACtB,IAAI,CASN;
|
|
1
|
+
{"version":3,"file":"hot.d.ts","sourceRoot":"","sources":["../src/hot.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAIlB,MAAM,MAAM,mBAAmB,GAAG,CAChC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,OAAO,EAAE,KACd,IAAI,CAAC;AAUV,MAAM,MAAM,kBAAkB,GAAG,SAAS;IACxC,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,mBAAmB,GAAG,SAAS;IACrC,WAAW,EAAE,OAAO;CACrB,CAAC;AAyBF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,QAAQ,GAAG,IAAI,EACvB,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,GACtB,IAAI,CASN;AAuDD,6EAA6E;AAC7E,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,MAAM,EAAE,QAAQ,GACf,IAAI,CAYN;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CAUzE"}
|
package/dist/hot.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,_ as t,f as n,p as r,t as i}from"./chunks/jsx-dom-C2FcLSgz.js";import{s as a}from"./chunks/access-CMv8a6Cm.js";const o=new Map,s=new Map;let c=!1;function l(e){s.delete(e.id);let t=o.get(e.factory);t?.delete(e),t?.size===0&&o.delete(e.factory)}function u(){c||(c=!0,r(e=>{let t=s.get(e);t!==void 0&&l(t)}))}function d(e,t,n,r,i){u();let a=s.get(t);a!==void 0&&l(a);let c={factory:e,id:t,parent:n,nodes:r,props:i};s.set(t,c);let d=o.get(e)??new Set;d.add(c),o.set(e,d)}function f(t,n){if(s.get(t.id)!==t)return;let r=t.nodes.find(e=>e.parentNode!==null),a=r?.parentNode,o=(r?.ownerDocument)?.createComment(`memoized-dom-hmr`);r!==void 0&&a!=null&&o!==void 0&&a.insertBefore(o,r),e(t.id);for(let e of t.nodes)e.parentNode?.removeChild(e);try{let e=t.props===null?n(t.id,t.parent):n(t.id,t.parent,t.props),r=i(e);if(o?.parentNode!==null&&o?.parentNode!==void 0){let e=o.parentNode;for(let t of r)e.insertBefore(t,o);e.removeChild(o)}}catch{o?.parentNode?.removeChild(o),m()}}function p(e,t){let n=[...o.get(e)??[]];for(let e of n)f(e,t);return n.length}function m(){let e=[...s.values()].filter(e=>e.parent===null);for(let t of e)f(t,t.factory)}function h(e,t){if(e.some(([,e,t])=>e===void 0||t)){m();return}let r=0;for(let[t,n]of e)n!==void 0&&(r+=p(t,n));r===0&&n(t)}function g(n,r){a(n);let i=encodeURIComponent(n),o=`${r}/$computed/${i}#`,s=`${r}/$module-effects/${i}/`;for(let n of[...t()])(n.startsWith(o)||n.startsWith(s))&&e(n)}export{h as applyHotUpdate,g as disposeHotModule,d as registerHotComponent};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HydrationMismatchError } from './hydration';
|
|
2
|
+
import { type MountableComponent, type MountTarget, type MountedApplication } from './mount';
|
|
3
|
+
export interface HydrationPayloadDelivery {
|
|
4
|
+
readonly version: 1;
|
|
5
|
+
readonly state?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface HydrateOptions {
|
|
8
|
+
/** Recover a root mismatch by discarding server markup and mounting fresh. */
|
|
9
|
+
recover?: boolean;
|
|
10
|
+
/** Called when a mismatch is recovered. */
|
|
11
|
+
onRecover?: (error: HydrationMismatchError) => void;
|
|
12
|
+
/** DOM-embedded payload lookup, an explicit payload, or no restoration. */
|
|
13
|
+
payload?: 'auto' | 'none' | HydrationPayloadDelivery;
|
|
14
|
+
}
|
|
15
|
+
/** Adopt server-rendered DOM within the compiled application root boundary. */
|
|
16
|
+
export declare function hydrate(target: MountTarget, component: MountableComponent, options?: HydrateOptions): MountedApplication;
|
|
17
|
+
export { createHydrationCursor, HydrationDocument, HydrationMismatchError, HydrationMarkerIndex, HydrationNodePlan, LocalHydrationCursor, parseHydrationMarker, } from './hydration';
|
|
18
|
+
export type { ClaimedHydrationRange, HydrationCloseMarker, HydrationController, HydrationMarker, HydrationMarkerKind, HydrationNodeExpectation, HydrationOpenMarker, PairedHydrationMarkerKind, } from './hydration';
|
|
19
|
+
//# sourceMappingURL=hydrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../src/hydrate.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACpD,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,wBAAwB,CAAC;CACtD;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CACrB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,kBAAkB,EAC7B,OAAO,GAAE,cAAmB,GAC3B,kBAAkB,CAuEpB;AAkCD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
|
package/dist/hydrate.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,l as t,s as n,t as r,x as i}from"./chunks/jsx-dom-C2FcLSgz.js";import{a,i as o,n as s,o as c,s as l,t as u}from"./chunks/mount-COP9U3A-.js";const d=new Set([`r`,`c`,`g`,`l`]);function f(e){if(e===`/mmd`)return{type:`close`};if(!e.startsWith(`mmd:`)||e.length<7)return null;let t=e[4];if(e[5]!==`:`||t!==`r`&&t!==`c`&&t!==`g`&&t!==`l`&&t!==`w`&&t!==`d`)return null;let n=e.slice(6),r=n.indexOf(` @ `),i=r===-1?n:n.slice(0,r);if(i.length===0||i.includes(`>`))return null;let a=r===-1?void 0:n.slice(r+3);return{type:`open`,kind:t,identity:i,...a===void 0?{}:{attribute:a}}}function p(e){return e?.nodeType===8?f(e.data):null}function m(e){return e===null?`the end of the boundary`:e.nodeType===8?`comment <!--${e.data}-->`:e.nodeType===1?`element <${e.localName}>`:e.nodeType===3?`a text node`:`node type ${e.nodeType}`}function h(e,t,n){let r=0;for(let n=e.nextSibling;n!==t&&n!==null;n=n?.nextSibling??null){let e=p(n);if(e?.type===`open`&&d.has(e.kind)){r++;continue}if(e?.type===`close`){if(r===0)return n;r--}}throw new l(n,`a matching <!--/mmd--> close`,m(t))}function g(e,t,n,r){let i=p(e);if(i?.type!==`open`||i.kind!==t||i.identity!==n)throw new l(r,`<!--mmd:${t}:${n}-->`,m(e));return e}var _=class e{boundary;end;#e;constructor(e,t,n){this.boundary=e,this.#e=t,this.end=n}get nextNode(){return this.#e===this.end?null:this.#e}get done(){return this.#e===this.end}claimNode(e){let t=this.nextNode;if(t===null)throw new l(this.boundary,v(e),m(null));if(p(t)!==null||t.nodeType!==e.nodeType)throw new l(this.boundary,v(e),m(t));if(t.nodeType===1){let n=t;if(e.tagName!==void 0&&n.localName!==e.tagName.toLowerCase()||e.namespaceURI!==void 0&&n.namespaceURI!==e.namespaceURI)throw new l(this.boundary,v(e),m(t))}return this.#e=t.nextSibling,t}claimRange(t,n){let r=g(this.nextNode,t,n,this.boundary),i=h(r,this.end,n);return this.#e=i.nextSibling,{kind:t,identity:n,open:r,end:i,cursor:new e(n,r.nextSibling,i)}}claimRow(t,n){let r=`${t}:${n}`,i=g(this.nextNode,`w`,r,this.boundary),a=0,o=this.end;for(let e=i.nextSibling;e!==this.end&&e!==null;e=e?.nextSibling??null){let t=p(e);if(t?.type===`open`){if(a===0&&t.kind===`w`){o=e;break}d.has(t.kind)&&a++}else t?.type===`close`&&a>0&&a--}return this.#e=o,{kind:`w`,identity:r,open:i,end:o,cursor:new e(r,i.nextSibling,o)}}expectDone(){if(!this.done)throw new l(this.boundary,`the end of the boundary`,m(this.nextNode))}};function v(e){if(e.nodeType===1){let t=e.tagName??`*`,n=e.namespaceURI===void 0?``:` in namespace ${String(e.namespaceURI)}`;return`element <${t.toLowerCase()}>${n}`}return e.nodeType===3?`a text node`:e.nodeType===8?`a comment node`:`node type ${e.nodeType}`}function y(e,t){let n=null;for(let r=e.firstChild;r!==null;r=r.nextSibling){let e=p(r);if(e?.type===`open`&&e.kind===`r`&&e.identity===t){if(n!==null)throw new l(t,`one application-root marker`,`multiple matching application-root markers`);n=r}}if(n===null)throw new l(t,`<!--mmd:r:${t}-->`,`no matching application-root marker`);let r=h(n,null,t);return{kind:`r`,identity:t,open:n,end:r,cursor:new _(t,n.nextSibling,r)}}var b=class{boundary;#e;#t=0;constructor(e){this.boundary=e.identity,this.#e=[],x(e.open.nextSibling,e.end,this.#e)}get remaining(){return this.#e.length-this.#t}get done(){return this.#t===this.#e.length}claimNode(e){let t=this.#e[this.#t]??null;if(t===null||t.nodeType!==e.nodeType)throw new l(this.boundary,v(e),m(t));if(t.nodeType===1){let n=t;if(e.tagName!==void 0&&n.localName!==e.tagName.toLowerCase()||e.namespaceURI!==void 0&&n.namespaceURI!==e.namespaceURI)throw new l(this.boundary,v(e),m(t))}return this.#t++,t}expectDone(){if(!this.done)throw new l(this.boundary,`the end of the creation plan`,`${this.remaining} unclaimed server node(s)`)}};function x(e,t,n){let r=e;for(;r!==null&&r!==t;){let e=p(r);if(e?.type===`open`){r=e.kind===`w`?S(r,t):h(r,t,e.identity).nextSibling;continue}if(e?.type===`close`){r=r.nextSibling;continue}x(r.firstChild,null,n),n.push(r),r=r.nextSibling}}function S(e,t){let n=0;for(let r=e.nextSibling;r!==null&&r!==t;r=r.nextSibling){let e=p(r);if(e?.type===`open`){if(n===0&&e.kind===`w`)return r;d.has(e.kind)&&n++}else if(e?.type===`close`){if(n===0)return r;n--}}return t}var C=class{#e=new Map;constructor(e){this.#n(e.open.nextSibling,e.end)}get size(){return this.#e.size}claimRange(e,t){return this.#t(e,t)}claimRow(e,t){return this.#t(`w`,`${e}:${t}`)}get unclaimed(){let e=0;for(let t of this.#e.values())t.claimed||e++;return e}#t(e,t){let n=this.#e.get(t);if(n===void 0)throw new l(t,`<!--mmd:${e}:${t}-->`,`no matching marker in the server stream`);if(n.kind!==e)throw new l(t,`<!--mmd:${e}:${t}-->`,`<!--mmd:${n.kind}:${t}-->`);if(n.claimed)throw new l(t,`one structural claim`,`the range was already claimed`);return n.claimed=!0,{kind:e,identity:t,open:n.open,end:n.end,cursor:new _(t,n.open.nextSibling,n.end)}}#n(e,t){let n=e;for(;n!==null&&n!==t;){let e=p(n);if(e?.type!==`open`){n.nodeType===1&&this.#n(n.firstChild,null),n=n.nextSibling;continue}if(e.kind===`d`){n=n.nextSibling;continue}let r;if(r=e.kind===`w`?S(n,t)??t??n:h(n,t,e.identity),this.#e.has(e.identity))throw new l(e.identity,`one marker identity`,`a duplicate identity in the server stream`);this.#e.set(e.identity,{kind:e.kind,open:n,end:r,claimed:!1}),this.#n(n.nextSibling,r),n=r===t?t:e.kind===`w`&&r.nodeType===8&&p(r)?.type===`open`?r:r.nextSibling}}},w=class{#e;#t;#n;constructor(e,t){this.#e=e,this.#t=new C(t),this.#n=[new b(t)]}claimRange(e,t){return this.#t.claimRange(e,t)}claimRow(e,t){return this.#t.claimRow(e,t)}pushRange(e){this.#n.push(new b(e))}popRange(){if(this.#n.length===1)throw Error(`memoized-dom: cannot pop the hydration root plan`);this.#n.at(-1).expectDone(),this.#n.pop()}createElement(e){return this.#r().claimNode({nodeType:1,tagName:e})}createElementNS(e,t){return this.#r().claimNode({nodeType:1,tagName:t,namespaceURI:e})}createTextNode(e){return this.#r().claimNode({nodeType:3})}createComment(e){return this.#e.createComment(e)}createDocumentFragment(){let e=this.#e.createDocumentFragment(),t=[];return Object.defineProperty(e,"__mmdAdoptedChildren",{value:t,configurable:!0}),e.appendChild=e=>(t.push(e),e),e}createRange(){if(this.#e.createRange===void 0)throw Error(`memoized-dom: active hydration document does not support Range`);return this.#e.createRange()}getElementById(e){return this.#e.getElementById(e)}expectDone(){if(this.#n.length!==1)throw new l(this.#n[0].boundary,`the root plan only`,`${this.#n.length-1} open structural plan(s)`);if(this.#r().expectDone(),this.#t.unclaimed>0)throw new l(this.#r().boundary,`every structural range claimed`,`${this.#t.unclaimed} unclaimed structural range(s)`)}#r(){return this.#n.at(-1)}};function T(t,d,f={}){let p=a(t),m=s();if(m.mountedHosts.has(p))throw Error(`memoized-dom: mount target already owns an application`);let h=c(d);if(h===void 0)throw Error(`memoized-dom: hydrate received a component that is not a compiled application root`);if(m.mountedRoots.has(h.id)||m.mountedRoots.size>0)throw Error(`memoized-dom: root entity '${h.id}' is already mounted`);E(h.id,f.payload);let g=y(p,h.id),_=new w(n().document,g),v;try{v=i({mode:`hydrate`,document:_,hydration:_},()=>h.create({mode:`hydrate`,host:p})),_.expectDone()}catch(n){if(e(h.id),f.recover&&n instanceof l)return f.onRecover?.(n),p.innerHTML=``,u(t,d);throw n}let b=r(v),x=!0,S={host:p,rootId:h.id,nodes:b,get mounted(){return x},unmount(){if(x){x=!1,m.mountedHosts.delete(p),m.mountedRoots.delete(h.id);try{e(h.id)}finally{o(b),g.open.parentNode?.removeChild(g.open),g.end.parentNode?.removeChild(g.end)}}}};return m.mountedHosts.set(p,S),m.mountedRoots.set(h.id,S),S}function E(e,n){if(n===`none`)return;let r=typeof n==`object`?n:void 0;if(r===void 0&&globalThis.document!==void 0){let t=globalThis.document.querySelector(`script[type="application/mmd+json"][data-mmd-root="${e}"]`);if(t?.textContent)try{r=JSON.parse(t.textContent)}catch{}}typeof r==`object`&&r&&`state`in r&&r.state!==void 0&&t(`mmd:data-runtime-active`,()=>({})).restoreState?.(r.state)}export{w as HydrationDocument,C as HydrationMarkerIndex,l as HydrationMismatchError,b as HydrationNodePlan,_ as LocalHydrationCursor,y as createHydrationCursor,T as hydrate,f as parseHydrationMarker};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Structural skew between server markup and the compiled client tree. */
|
|
2
|
+
export declare class HydrationMismatchError extends Error {
|
|
3
|
+
readonly boundary: string;
|
|
4
|
+
readonly expected: string;
|
|
5
|
+
readonly actual: string;
|
|
6
|
+
constructor(boundary: string, expected: string, actual: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hydration-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration-error.d.ts","sourceRoot":"","sources":["../src/hydration-error.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAQ7D;CACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 3 hydration cursor — read-only adoption over the v0.2 marker stream.
|
|
3
|
+
*
|
|
4
|
+
* The cursor never creates, moves, or removes nodes. It validates and claims
|
|
5
|
+
* the server tree in compiler-defined order. Mutation/recovery belongs to the
|
|
6
|
+
* mount integration layer; keeping this primitive read-only makes failed
|
|
7
|
+
* adoption safe and independently testable.
|
|
8
|
+
*/
|
|
9
|
+
import type { DocumentLike } from './environment';
|
|
10
|
+
export { HydrationMismatchError } from './hydration-error';
|
|
11
|
+
export type HydrationMarkerKind = 'r' | 'c' | 'g' | 'l' | 'w' | 'd';
|
|
12
|
+
export type PairedHydrationMarkerKind = 'r' | 'c' | 'g' | 'l';
|
|
13
|
+
export interface HydrationOpenMarker {
|
|
14
|
+
readonly type: 'open';
|
|
15
|
+
readonly kind: HydrationMarkerKind;
|
|
16
|
+
readonly identity: string;
|
|
17
|
+
readonly attribute?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface HydrationCloseMarker {
|
|
20
|
+
readonly type: 'close';
|
|
21
|
+
}
|
|
22
|
+
export type HydrationMarker = HydrationOpenMarker | HydrationCloseMarker;
|
|
23
|
+
export interface HydrationController {
|
|
24
|
+
claimRange(kind: Exclude<PairedHydrationMarkerKind, 'r'>, identity: string): ClaimedHydrationRange;
|
|
25
|
+
claimRow(listId: string, encodedKey: string): ClaimedHydrationRange;
|
|
26
|
+
pushRange(range: ClaimedHydrationRange): void;
|
|
27
|
+
popRange(): void;
|
|
28
|
+
}
|
|
29
|
+
export interface HydrationNodeExpectation {
|
|
30
|
+
readonly nodeType: number;
|
|
31
|
+
readonly tagName?: string;
|
|
32
|
+
readonly namespaceURI?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface ClaimedHydrationRange {
|
|
35
|
+
readonly kind: PairedHydrationMarkerKind | 'w';
|
|
36
|
+
readonly identity: string;
|
|
37
|
+
readonly open: Comment;
|
|
38
|
+
/** Exclusive end: the pair close, next row marker, or enclosing list close. */
|
|
39
|
+
readonly end: Node;
|
|
40
|
+
readonly cursor: LocalHydrationCursor;
|
|
41
|
+
}
|
|
42
|
+
/** Parse one protocol comment body. Unrelated comments return null. */
|
|
43
|
+
export declare function parseHydrationMarker(data: string): HydrationMarker | null;
|
|
44
|
+
/** A deterministic sibling cursor bounded by one structural owner. */
|
|
45
|
+
export declare class LocalHydrationCursor {
|
|
46
|
+
#private;
|
|
47
|
+
readonly boundary: string;
|
|
48
|
+
readonly end: Node;
|
|
49
|
+
constructor(boundary: string, first: Node | null, end: Node);
|
|
50
|
+
get nextNode(): Node | null;
|
|
51
|
+
get done(): boolean;
|
|
52
|
+
/** Claim one ordinary node and validate kind/tag/namespace in place. */
|
|
53
|
+
claimNode(expectation: HydrationNodeExpectation): Node;
|
|
54
|
+
/** Claim the next paired component/conditional/list region. */
|
|
55
|
+
claimRange(kind: Exclude<PairedHydrationMarkerKind, 'r'>, identity: string): ClaimedHydrationRange;
|
|
56
|
+
/**
|
|
57
|
+
* Claim one v0.2 single-opening row. Its exclusive end is the next row
|
|
58
|
+
* marker at list depth zero or the enclosing list close.
|
|
59
|
+
*/
|
|
60
|
+
claimRow(listId: string, encodedKey: string): ClaimedHydrationRange;
|
|
61
|
+
expectDone(): void;
|
|
62
|
+
}
|
|
63
|
+
/** Locate and validate one application-root marker pair inside a host. */
|
|
64
|
+
export declare function createHydrationCursor(host: Element, rootId: string): ClaimedHydrationRange;
|
|
65
|
+
/**
|
|
66
|
+
* Compiler creation order for one claimed range.
|
|
67
|
+
*
|
|
68
|
+
* JSX emission creates descendants before their host (`text → button →
|
|
69
|
+
* section`), while DOM order stores hosts before descendants. This plan
|
|
70
|
+
* performs one marker-aware post-order walk and then validates each factory
|
|
71
|
+
* claim without creating or moving nodes. Nested structural ranges are
|
|
72
|
+
* skipped: their cond/list/row primitive owns a separate plan.
|
|
73
|
+
*/
|
|
74
|
+
export declare class HydrationNodePlan {
|
|
75
|
+
#private;
|
|
76
|
+
readonly boundary: string;
|
|
77
|
+
constructor(range: ClaimedHydrationRange);
|
|
78
|
+
get remaining(): number;
|
|
79
|
+
get done(): boolean;
|
|
80
|
+
/** Claim the next node in compiler creation order and validate its shape. */
|
|
81
|
+
claimNode(expectation: HydrationNodeExpectation): Node;
|
|
82
|
+
expectDone(): void;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* One-time identity index for nested structural marker ranges.
|
|
86
|
+
*
|
|
87
|
+
* Compiler creation order and DOM marker order are independent. The node
|
|
88
|
+
* plan serves ordinary nodes in post-order; this index locates `c/g/l/w`
|
|
89
|
+
* owners by their compiler-canonical identity regardless of when a factory
|
|
90
|
+
* reaches them. It validates pair nesting while building and permits exactly
|
|
91
|
+
* one claim per identity.
|
|
92
|
+
*/
|
|
93
|
+
export declare class HydrationMarkerIndex {
|
|
94
|
+
#private;
|
|
95
|
+
constructor(root: ClaimedHydrationRange);
|
|
96
|
+
get size(): number;
|
|
97
|
+
claimRange(kind: Exclude<PairedHydrationMarkerKind, 'r'>, identity: string): ClaimedHydrationRange;
|
|
98
|
+
claimRow(listId: string, encodedKey: string): ClaimedHydrationRange;
|
|
99
|
+
get unclaimed(): number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Adoption document backed by one compiler-order node plan per structural
|
|
103
|
+
* range. Runtime primitives claim their marker range through the controller
|
|
104
|
+
* surface, push it for the initial factory, then pop after all ordinary
|
|
105
|
+
* nodes were served.
|
|
106
|
+
*/
|
|
107
|
+
export declare class HydrationDocument implements DocumentLike, HydrationController {
|
|
108
|
+
#private;
|
|
109
|
+
constructor(fallback: DocumentLike, range: ClaimedHydrationRange);
|
|
110
|
+
claimRange(kind: Exclude<PairedHydrationMarkerKind, 'r'>, identity: string): ClaimedHydrationRange;
|
|
111
|
+
claimRow(listId: string, encodedKey: string): ClaimedHydrationRange;
|
|
112
|
+
pushRange(range: ClaimedHydrationRange): void;
|
|
113
|
+
popRange(): void;
|
|
114
|
+
createElement(tagName: string): Element;
|
|
115
|
+
createElementNS(namespaceURI: string, qualifiedName: string): Element;
|
|
116
|
+
createTextNode(_data: string): Text;
|
|
117
|
+
createComment(data: string): Comment;
|
|
118
|
+
createDocumentFragment(): DocumentFragment;
|
|
119
|
+
createRange(): Range;
|
|
120
|
+
getElementById(id: string): Element | null;
|
|
121
|
+
expectDone(): void;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=hydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* full runtime surface. Ordinary browser entries additionally import mount;
|
|
7
7
|
* reactive and emission primitives remain compiler-owned.
|
|
8
8
|
*/
|
|
9
|
-
export { register, unregister, unregisterSubtree, registeredIds, has, markDirty, undirty, markDirtySubtree, commit, setScheduler, resetScheduler, getEntity, renderDescendants, } from './kernel';
|
|
10
|
-
export
|
|
9
|
+
export { register, unregister, unregisterSubtree, registeredIds, has, markDirty, undirty, markDirtySubtree, commit, setScheduler, resetScheduler, getEntity, renderDescendants, createApplicationRuntime, getActiveApplicationRuntime, getExtensionStore, setActiveApplicationRuntime, runWithApplicationRuntime, getActiveEnvironment, canReuseTemplate, runWithRenderEnvironment, } from './kernel';
|
|
10
|
+
export { createStorage, type StorageShim } from './async-storage';
|
|
11
|
+
export type { ApplicationRuntime, DirtyReasonInput, DirtyReasons, Entity, } from './kernel';
|
|
12
|
+
export type { Capability, DocumentLike, RenderEnvironment, RenderMode, } from './environment';
|
|
13
|
+
export { defineStateCell, readCell, setCell, updateCell, } from './state-cells';
|
|
14
|
+
export type { StateCell } from './state-cells';
|
|
11
15
|
export { cleanup } from './cleanup';
|
|
12
16
|
export type { CleanupDisposer } from './cleanup';
|
|
13
17
|
export { mountRef } from './refs';
|
|
@@ -18,18 +22,18 @@ export { setText, setClassName, setClass, setAttr, setProp, setStyle, computedCh
|
|
|
18
22
|
export type { SlotCache } from './setters';
|
|
19
23
|
export { installAccessTable, resetAccessTable, uninstallAccessTable, resolveWrites, resolveStaticWrites, isOpaque, getRootId, } from './access';
|
|
20
24
|
export type { AccessTable } from './access';
|
|
21
|
-
export { commitWrites, commitWritesWithPayload, handle, getEventLog, clearEventLog, } from './events';
|
|
25
|
+
export { commitStructuralWrites, commitWrites, commitWritesWithPayload, handle, getEventLog, clearEventLog, } from './events';
|
|
22
26
|
export type { EventRecord } from './events';
|
|
23
27
|
export { createListRegion } from './list';
|
|
24
28
|
export type { ListRegion, ListEntry, KeyFn } from './list';
|
|
29
|
+
export { isStructuralListUpdate } from './list-update';
|
|
25
30
|
export { rootNodes } from './jsx-dom';
|
|
31
|
+
export { decodeListKey, encodeListKey } from './list-keys';
|
|
26
32
|
export { mount, registerRootFactory } from './mount';
|
|
27
33
|
export type { MountableComponent, MountTarget, MountedApplication, RootMountContext, } from './mount';
|
|
28
34
|
export { createDelegatedEventBinding, setDelegatedEvent, type DelegatedEventBinding, } from './delegated-events';
|
|
29
35
|
export { patchDomProps, setDomValue } from './dom-props';
|
|
30
36
|
export { classValue, setClassValue, setStyleValue } from './dom-values';
|
|
31
|
-
export { applyHotUpdate, disposeHotModule, registerHotComponent, } from './hot';
|
|
32
|
-
export type { HotComponentFactory, HotComponentUpdate } from './hot';
|
|
33
37
|
export { createCondRegion } from './cond';
|
|
34
38
|
export { registerProps, setProps } from './props';
|
|
35
39
|
export type { CondRegion, CondEntry, CondBranchFactory } from './cond';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,cAAc,EACd,SAAS,EACT,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e,D as t,E as n,S as r,T as i,_ as a,a as o,b as s,c,d as l,f as u,g as d,i as f,l as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./chunks/jsx-dom-C2FcLSgz.js";import{a as C,c as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j}from"./chunks/access-CMv8a6Cm.js";import{A as M,C as N,D as P,E as F,F as I,M as L,N as R,O as z,P as B,S as V,T as H,_ as U,a as W,b as G,c as K,d as q,f as J,g as Y,h as X,i as Z,j as Q,k as $,l as ee,m as te,n as ne,o as re,p as ie,r as ae,s as oe,u as se,v as ce,w as le,x as ue,y as de}from"./chunks/src-CMZZbF4X.js";import{r as fe,t as pe}from"./chunks/mount-COP9U3A-.js";export{h as canReuseTemplate,oe as classValue,le as cleanup,$ as clearEventLog,f as commit,M as commitStructuralWrites,Q as commitWrites,L as commitWritesWithPayload,ie as computedChanged,o as createApplicationRuntime,Z as createCondRegion,se as createDelegatedEventBinding,J as createListRegion,t as createStorage,w as decodeListKey,H as defineStateCell,te as effectAssignmentChanged,E as encodeListKey,m as getActiveApplicationRuntime,g as getActiveEnvironment,c as getEntity,R as getEventLog,p as getExtensionStore,j as getRootId,B as handle,v as has,D as installAccessTable,k as isOpaque,I as isStructuralListUpdate,l as markDirty,u as markDirtySubtree,pe as mount,N as mountRef,W as patchDomProps,F as readCell,d as register,ue as registerConditionalEffect,V as registerEffect,ne as registerProps,fe as registerRootFactory,a as registeredIds,y as renderDescendants,T as resetAccessTable,S as resetScheduler,C as resolveStaticWrites,O as resolveWrites,_ as rootNodes,s as runWithApplicationRuntime,x as runWithRenderEnvironment,r as setActiveApplicationRuntime,X as setAttr,P as setCell,Y as setClass,U as setClassName,K as setClassValue,q as setDelegatedEvent,re as setDomValue,ce as setProp,ae as setProps,e as setScheduler,de as setStyle,ee as setStyleValue,G as setText,b as undirty,A as uninstallAccessTable,i as unregister,n as unregisterSubtree,z as updateCell};
|
package/dist/jsx-dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dom.d.ts","sourceRoot":"","sources":["../src/jsx-dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"jsx-dom.d.ts","sourceRoot":"","sources":["../src/jsx-dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAa5C"}
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* M0 — Runtime kernel of the Analyzed Memoized DOM.
|
|
4
|
-
*
|
|
5
|
-
* The kernel owns exactly four things (see memoized-dom-paradigm.md §5–§6):
|
|
6
|
-
* 1. The entity registry — Map<id, Entity>, O(1) lookup by hierarchical id
|
|
7
|
-
* 2. The dirty set — Set<id>, dedupes any number of triggers into one render
|
|
8
|
-
* 3. The frame scheduler — batches all dirty marks into one commit per frame
|
|
9
|
-
* 4. The commit cycle — re-renders exactly the dirty set, parent-before-child
|
|
10
|
-
*
|
|
11
|
-
* It knows NOTHING about components, state, or events. Those are compiler
|
|
12
|
-
* concerns layered on top. Keep this file focused on entity lifetime.
|
|
13
|
-
*
|
|
14
|
-
* M4 hardening (benchmark-driven):
|
|
15
|
-
* - Entity carries `children` + precomputed `depth`: subtree teardown is
|
|
16
|
-
* O(subtree) — was O(registry) per entity, i.e. O(n^2) on mass removal
|
|
17
|
-
* (clear-10k took 1510ms before this fix)
|
|
18
|
-
* - commit sorts NUMERIC depths, not string paths
|
|
19
|
-
* - registeredIds() returns a cached array, rebuilt only on register/unregister
|
|
20
|
-
*
|
|
21
|
-
* INVARIANT (the M5 compiler guarantees this): parents register BEFORE their
|
|
22
|
-
* children, so child links exist. Violations don't corrupt rendering — they
|
|
23
|
-
* only orphan children from subtree teardown.
|
|
24
|
-
*/
|
|
25
|
-
import { type DirtyReasonInput, type DirtyReasons } from './dirty-reasons';
|
|
1
|
+
import { type DirtyReasonInput, type DirtyReasons, type DirtyReasonStore } from './dirty-reasons';
|
|
2
|
+
import { type RenderEnvironment } from './environment';
|
|
26
3
|
export type EntityId = string;
|
|
27
4
|
export type { DirtyReasonInput, DirtyReasons } from './dirty-reasons';
|
|
28
5
|
/**
|
|
@@ -43,19 +20,90 @@ export interface Entity {
|
|
|
43
20
|
depth?: number;
|
|
44
21
|
children?: Set<EntityId>;
|
|
45
22
|
}
|
|
46
|
-
type Scheduler = (fn: () => void) => void;
|
|
47
|
-
/**
|
|
23
|
+
export type Scheduler = (fn: () => void) => void;
|
|
24
|
+
/**
|
|
25
|
+
* All mutable kernel bookkeeping for one application/request. Nothing else
|
|
26
|
+
* in the kernel may hold render-affecting state at module scope.
|
|
27
|
+
*/
|
|
28
|
+
interface KernelState {
|
|
29
|
+
readonly registry: Map<EntityId, Entity>;
|
|
30
|
+
readonly dirty: Set<EntityId>;
|
|
31
|
+
readonly volatile: Set<EntityId>;
|
|
32
|
+
/** Exact numeric causes per dirty entity until their next render. */
|
|
33
|
+
readonly dirtyReasons: DirtyReasonStore;
|
|
34
|
+
/**
|
|
35
|
+
* Request-owned storage cells for lifted module state (SSR Phase 1.3,
|
|
36
|
+
* proposal Option B). Keyed by canonical linker identity.
|
|
37
|
+
*/
|
|
38
|
+
readonly cells: Map<string, unknown>;
|
|
39
|
+
/** Cached id array for the access resolver — null when stale. */
|
|
40
|
+
idsCache: EntityId[] | null;
|
|
41
|
+
/** Monotonic registry generation for resolver caches. */
|
|
42
|
+
generation: number;
|
|
43
|
+
scheduler: Scheduler;
|
|
44
|
+
volatileFrameScheduled: boolean;
|
|
45
|
+
scheduled: boolean;
|
|
46
|
+
inCommit: boolean;
|
|
47
|
+
/** Cycle diagnostics — non-null only while a commit drain runs. */
|
|
48
|
+
renderingEntity: EntityId | null;
|
|
49
|
+
renderCounts: Map<EntityId, number> | null;
|
|
50
|
+
markedBy: Map<EntityId, EntityId> | null;
|
|
51
|
+
/**
|
|
52
|
+
* Named per-runtime stores for kernel-adjacent subsystems (cleanup, prop
|
|
53
|
+
* boxes, access resolver, mount bookkeeping). Modules own their store
|
|
54
|
+
* shapes; the kernel only provides request-scoped storage and lifetime.
|
|
55
|
+
*/
|
|
56
|
+
readonly extensions: Map<string, unknown>;
|
|
57
|
+
/** Capability descriptor selecting browser/server behavior. */
|
|
58
|
+
environment: RenderEnvironment;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One isolated application/request runtime. Browser code uses the ambient
|
|
62
|
+
* default; server entry points create, activate, and dispose one per request.
|
|
63
|
+
*/
|
|
64
|
+
export interface ApplicationRuntime {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
/**
|
|
67
|
+
* Unregister every entity (draining cleanup hooks) and drop all pending
|
|
68
|
+
* bookkeeping. The handle must not be activated afterwards.
|
|
69
|
+
*/
|
|
70
|
+
dispose(): void;
|
|
71
|
+
/** @internal Test/introspection surface. Not part of the paradigm API. */
|
|
72
|
+
readonly state: KernelState;
|
|
73
|
+
}
|
|
74
|
+
/** Create an isolated runtime. Server entry points call this per request. */
|
|
75
|
+
export declare function createApplicationRuntime(id?: string, environment?: Partial<RenderEnvironment>): ApplicationRuntime;
|
|
76
|
+
/** The runtime all kernel operations currently route through. */
|
|
77
|
+
export declare function getActiveApplicationRuntime(): ApplicationRuntime;
|
|
78
|
+
type RuntimeCreatedListener = (runtime: ApplicationRuntime) => void;
|
|
79
|
+
/** Invoke `listener` for every application runtime created from now on. */
|
|
80
|
+
export declare function onRuntimeCreated(listener: RuntimeCreatedListener): () => void;
|
|
81
|
+
/** Route subsequent kernel operations through `runtime`. */
|
|
82
|
+
export declare function setActiveApplicationRuntime(runtime: ApplicationRuntime): ApplicationRuntime;
|
|
83
|
+
/** Scope `fn` to `runtime`, restoring the previous runtime afterwards. */
|
|
84
|
+
export declare function runWithApplicationRuntime<T>(runtime: ApplicationRuntime, fn: () => T): T;
|
|
85
|
+
/** Swap the scheduling policy of the ACTIVE runtime (tests, SSR, hosts). */
|
|
48
86
|
export declare function setScheduler(fn: Scheduler): void;
|
|
49
|
-
/**
|
|
50
|
-
export declare function
|
|
51
|
-
/** Current registry generation (see above). Introspection/resolver only. */
|
|
52
|
-
export declare function registryGeneration(): number;
|
|
87
|
+
/** The capability descriptor of the ACTIVE runtime. */
|
|
88
|
+
export declare function getActiveEnvironment(): RenderEnvironment;
|
|
53
89
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* run synchronously; they must be cheap (a few regex tests).
|
|
90
|
+
* Whether detached DOM templates may be cloned for new instances. False in
|
|
91
|
+
* hydrate mode: row factories must claim their server nodes through the
|
|
92
|
+
* document instead of cloning a template built from the first claim.
|
|
58
93
|
*/
|
|
94
|
+
export declare function canReuseTemplate(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Run `run` in an overridden render environment (mode, document, hydration).
|
|
97
|
+
* Restores the previous environment afterwards.
|
|
98
|
+
*/
|
|
99
|
+
export declare function runWithRenderEnvironment<T>(overrides: Partial<RenderEnvironment>, run: () => T): T;
|
|
100
|
+
/**
|
|
101
|
+
* Per-runtime named storage for kernel-adjacent subsystems. The first call
|
|
102
|
+
* creates the store; every later call inside the same runtime returns the
|
|
103
|
+
* same instance, so concurrent runtimes never share module state.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getExtensionStore<T>(key: string, create: () => T): T;
|
|
106
|
+
export declare function resetScheduler(): void;
|
|
59
107
|
type RegistryListener = (id: EntityId, kind: 'add' | 'remove') => void;
|
|
60
108
|
/**
|
|
61
109
|
* Lifecycle features install their disposer lazily on first use. Keeping the
|
|
@@ -65,6 +113,8 @@ type RegistryListener = (id: EntityId, kind: 'add' | 'remove') => void;
|
|
|
65
113
|
export type EntityDisposeHook = (id: EntityId) => readonly unknown[] | void;
|
|
66
114
|
export declare function onEntityDispose(fn: EntityDisposeHook): void;
|
|
67
115
|
export declare function onRegistryChange(fn: RegistryListener): void;
|
|
116
|
+
/** Current registry generation (introspection/resolver only). */
|
|
117
|
+
export declare function registryGeneration(): number;
|
|
68
118
|
export declare function register(entity: Entity): void;
|
|
69
119
|
/**
|
|
70
120
|
* Unregister an entity and ALL its descendants — O(subtree), not O(registry).
|
|
@@ -82,11 +132,6 @@ export declare function getEntity(id: EntityId): Entity | undefined;
|
|
|
82
132
|
* whose lexical dependencies belong to the callback caller.
|
|
83
133
|
*/
|
|
84
134
|
export declare function renderDescendants(id: EntityId): void;
|
|
85
|
-
/**
|
|
86
|
-
* Live entity ids for the access-table resolver. Cached — the array is
|
|
87
|
-
* rebuilt only when the registry mutates, so per-event cost is zero.
|
|
88
|
-
* Callers MUST NOT mutate the returned array.
|
|
89
|
-
*/
|
|
90
135
|
export declare function registeredIds(): readonly EntityId[];
|
|
91
136
|
/**
|
|
92
137
|
* Mark one entity dirty and schedule a commit.
|
package/dist/kernel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list-keys.ts — Phase 0 hydration-safe keyed-list identity encoding.
|
|
3
|
+
*
|
|
4
|
+
* List row identity embeds the user-provided key into an entity id segment
|
|
5
|
+
* (`<idPrefix>/Row[<encoded>]`). The historical encoding was `String(key)`:
|
|
6
|
+
*
|
|
7
|
+
* - `1`, `"1"`, `1n` and `true`/`"true"` collapsed into identical ids;
|
|
8
|
+
* - raw string keys injected protocol-significant characters (`/` splits
|
|
9
|
+
* id segments, `]` closes the row marker, `%` pre-empts future escapes).
|
|
10
|
+
*
|
|
11
|
+
* The contract below is the hydration-safe replacement. Every PRIMITIVE key
|
|
12
|
+
* encodes deterministically with an explicit type tag, so server and client
|
|
13
|
+
* builds of one graph derive identical identity from identical data:
|
|
14
|
+
*
|
|
15
|
+
* number → `n:<canonical digits>` (String(number); -0 encodes as `0`,
|
|
16
|
+
* SameValueZero makes that equivalent)
|
|
17
|
+
* bigint → `g:<decimal digits>`
|
|
18
|
+
* boolean → `t` | `f`
|
|
19
|
+
* string → `s:<escaped>` (every code point outside
|
|
20
|
+
* A–Z a–z 0–9 _ . ~ - becomes
|
|
21
|
+
* uppercase percent-escape UTF-8)
|
|
22
|
+
*
|
|
23
|
+
* NON-primitive keys (objects, symbols, functions, null, undefined) return
|
|
24
|
+
* `null` here and fall back to process-local synthetic ids. DECLARED SSR
|
|
25
|
+
* LIMITATION: such keys cannot survive a server→client transfer; hydration
|
|
26
|
+
* requires stable primitive keys. This is a documented diagnostic boundary,
|
|
27
|
+
* not silent cross-request sharing.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Encode a list key for embedding in an entity id / hydration marker.
|
|
31
|
+
* Returns `null` when the key is not a hydration-stable primitive.
|
|
32
|
+
*/
|
|
33
|
+
export declare function encodeListKey(key: unknown): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Inverse of `encodeListKey`. Returns `undefined` for input this contract
|
|
36
|
+
* did not produce (including synthetic `#N` segments, which were never
|
|
37
|
+
* hydration-stable).
|
|
38
|
+
*/
|
|
39
|
+
export declare function decodeListKey(encoded: string): unknown;
|
|
40
|
+
//# sourceMappingURL=list-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-keys.d.ts","sourceRoot":"","sources":["../src/list-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAuBH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmBzD;AAWD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAkBtD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DirtyReasons } from './dirty-reasons';
|
|
2
|
+
export declare function listStructureReason(source: string): string;
|
|
3
|
+
export declare function listStructureReaderKey(source: string): string;
|
|
4
|
+
export declare function isStructuralListUpdate(reasons: DirtyReasons, source: string): boolean;
|
|
5
|
+
export declare function retainedRowNeedsSync<T>(previous: T, next: T, previousIndex: number, nextIndex: number, indexSensitive: boolean): boolean;
|
|
6
|
+
//# sourceMappingURL=list-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-update.d.ts","sourceRoot":"","sources":["../src/list-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAapD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAaT;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,CAAC,EACP,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,OAAO,GACtB,OAAO,CAET"}
|
package/dist/list.d.ts
CHANGED
|
@@ -55,17 +55,13 @@ export interface ListEntry {
|
|
|
55
55
|
}
|
|
56
56
|
export type KeyFn<T> = (item: T, index: number) => unknown;
|
|
57
57
|
export interface ListRegion<T> {
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
* writes may pass `false`: retained rows whose item reference is unchanged
|
|
61
|
-
* then skip content replay while inserted/replaced items still synchronize.
|
|
62
|
-
*/
|
|
63
|
-
reconcile(items: readonly T[], syncRetained?: boolean): void;
|
|
58
|
+
/** Reconcile collection identity, order, and retained row content. */
|
|
59
|
+
reconcile(items: readonly T[], structuralOnly?: boolean): void;
|
|
64
60
|
/** Re-sync one retained row through the region's O(1) key cache. */
|
|
65
61
|
refreshKey(key: unknown): void;
|
|
66
62
|
size(): number;
|
|
67
63
|
/** Remove retained nodes and unregister every entity owned by the region. */
|
|
68
64
|
dispose(): void;
|
|
69
65
|
}
|
|
70
|
-
export declare function createListRegion<T>(parent: Node, idPrefix: EntityId, create: (item: T, rowId: EntityId, index: number) => ListEntry, key?: KeyFn<T>, trackRowIds?: boolean): ListRegion<T>;
|
|
66
|
+
export declare function createListRegion<T>(parent: Node, idPrefix: EntityId, create: (item: T, rowId: EntityId, index: number) => ListEntry, key?: KeyFn<T>, trackRowIds?: boolean, indexSensitive?: boolean): ListRegion<T>;
|
|
71
67
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAA+D,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKtG,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,KAAK,EAAE,IAAI,GAAG,SAAS,IAAI,EAAE,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAK3D,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,sEAAsE;IACtE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/D,oEAAoE;IACpE,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,IAAI,IAAI,MAAM,CAAC;IACf,6EAA6E;IAC7E,OAAO,IAAI,IAAI,CAAC;CACjB;AAiDD,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,EAC9D,GAAG,GAAE,KAAK,CAAC,CAAC,CAAe,EAC3B,WAAW,UAAO,EAClB,cAAc,UAAO,GACpB,UAAU,CAAC,CAAC,CAAC,CA+qBf"}
|
package/dist/mount.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
export type MountableComponent = () => unknown;
|
|
3
3
|
export type MountTarget = string | Element;
|
|
4
4
|
export interface RootMountContext {
|
|
5
|
-
readonly mode: 'create';
|
|
5
|
+
readonly mode: 'create' | 'hydrate';
|
|
6
6
|
readonly host: Element;
|
|
7
7
|
}
|
|
8
|
-
interface RootFactoryDefinition {
|
|
8
|
+
export interface RootFactoryDefinition {
|
|
9
9
|
id: string;
|
|
10
10
|
create(context: RootMountContext): Node;
|
|
11
11
|
}
|
|
@@ -16,9 +16,17 @@ export interface MountedApplication {
|
|
|
16
16
|
readonly mounted: boolean;
|
|
17
17
|
unmount(): void;
|
|
18
18
|
}
|
|
19
|
+
export interface MountStore {
|
|
20
|
+
readonly mountedHosts: WeakMap<Element, MountedApplication>;
|
|
21
|
+
readonly mountedRoots: Map<string, MountedApplication>;
|
|
22
|
+
}
|
|
23
|
+
export declare function mountStore(): MountStore;
|
|
19
24
|
/** Compiler-emitted root metadata. Application code should call mount(). */
|
|
20
25
|
export declare function registerRootFactory(component: Function, definition: RootFactoryDefinition): void;
|
|
26
|
+
export declare function removeNodes(nodes: readonly Node[]): void;
|
|
27
|
+
export declare function resolveHost(target: MountTarget): Element;
|
|
21
28
|
/** Mount one compiled application root into an ordinary DOM host. */
|
|
22
29
|
export declare function mount(target: MountTarget, component: MountableComponent): MountedApplication;
|
|
23
|
-
|
|
30
|
+
/** Hydration entry support; intentionally absent from the public client barrel. */
|
|
31
|
+
export declare function rootFactoryFor(component: MountableComponent): RootFactoryDefinition | undefined;
|
|
24
32
|
//# sourceMappingURL=mount.d.ts.map
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAOA,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC;AAC/C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAOD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC5D,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CACxD;AACD,wBAAgB,UAAU,IAAI,UAAU,CAKvC;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,QAAQ,EACnB,UAAU,EAAE,qBAAqB,GAChC,IAAI,CAEN;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,CAExD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAOxD;AAED,qEAAqE;AACrE,wBAAgB,KAAK,CACnB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,kBAAkB,GAC5B,kBAAkB,CA6DpB;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAC5B,SAAS,EAAE,kBAAkB,GAC5B,qBAAqB,GAAG,SAAS,CAEnC"}
|
package/dist/props.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAkD,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMzF,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAgBrE;AAED,uCAAuC;AACvC,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,CAEtE"}
|
package/dist/refs.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Assignable refs are compiled into this callback contract, so the runtime
|
|
5
5
|
* never needs to understand source l-values or allocate JSX/ref objects.
|
|
6
|
+
*
|
|
7
|
+
* Ref invocation is capability-gated (SSR slice 1.2): server environments
|
|
8
|
+
* record ownership without handing over nodes.
|
|
6
9
|
*/
|
|
7
10
|
export type RefCallback<T extends Node = Node> = (node: T) => void | (() => void);
|
|
8
11
|
export type RefValue<T extends Node = Node> = RefCallback<T> | readonly RefValue<T>[] | null | undefined | false;
|
package/dist/refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,IAAI,CAC/C,IAAI,EAAE,CAAC,KACJ,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AACzB,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,IACtC,WAAW,CAAC,CAAC,CAAC,GACd,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,GACtB,IAAI,GACJ,SAAS,GACT,KAAK,CAAC;AAEV,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,CAAC,SAAS,IAAI,EACrC,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GACjB,MAAM,IAAI,CAkCZ"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AASA,cAAc,SAAS,CAAC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,i as p,l as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./chunks/jsx-dom-C2FcLSgz.js";import{a as w,c as T,i as E,l as D,n as O,o as k,r as A,s as j,t as M}from"./chunks/access-CMv8a6Cm.js";import{A as N,C as P,D as F,E as I,F as L,M as R,N as z,O as B,P as V,S as H,T as U,_ as W,a as G,b as K,c as q,d as J,f as Y,g as X,h as Z,i as Q,j as $,k as ee,l as te,m as ne,n as re,o as ie,p as ae,r as oe,s as se,u as ce,v as le,w as ue,x as de,y as fe}from"./chunks/src-CMZZbF4X.js";import{r as pe,t as me}from"./chunks/mount-COP9U3A-.js";import{AsyncLocalStorage as he}from"node:async_hooks";r(()=>new he);export{g as canReuseTemplate,se as classValue,ue as cleanup,ee as clearEventLog,p as commit,N as commitStructuralWrites,$ as commitWrites,R as commitWritesWithPayload,ae as computedChanged,s as createApplicationRuntime,Q as createCondRegion,ce as createDelegatedEventBinding,Y as createListRegion,t as createStorage,T as decodeListKey,U as defineStateCell,ne as effectAssignmentChanged,D as encodeListKey,h as getActiveApplicationRuntime,_ as getActiveEnvironment,l as getEntity,z as getEventLog,m as getExtensionStore,M as getRootId,V as handle,y as has,O as installAccessTable,A as isOpaque,L as isStructuralListUpdate,u as markDirty,d as markDirtySubtree,me as mount,P as mountRef,G as patchDomProps,I as readCell,f as register,de as registerConditionalEffect,H as registerEffect,re as registerProps,pe as registerRootFactory,o as registeredIds,b as renderDescendants,E as resetAccessTable,C as resetScheduler,w as resolveStaticWrites,k as resolveWrites,v as rootNodes,c as runWithApplicationRuntime,S as runWithRenderEnvironment,i as setActiveApplicationRuntime,Z as setAttr,F as setCell,X as setClass,W as setClassName,q as setClassValue,J as setDelegatedEvent,ie as setDomValue,le as setProp,oe as setProps,e as setScheduler,fe as setStyle,te as setStyleValue,K as setText,x as undirty,j as uninstallAccessTable,a as unregister,n as unregisterSubtree,B as updateCell};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* state-cells.ts - SSR Phase 1.3 (proposal Option B) storage primitive.
|
|
3
|
+
*
|
|
4
|
+
* Module-level reactive state (`export let count = 0`) compiles today to
|
|
5
|
+
* ordinary ESM bindings, which are singletons: two concurrent server requests
|
|
6
|
+
* would share one memory cell. State cells give the compiler a lowering
|
|
7
|
+
* target where the STORAGE is owned by each application runtime while the
|
|
8
|
+
* canonical linker identity stays stable for invalidation routing.
|
|
9
|
+
*
|
|
10
|
+
* Authored:
|
|
11
|
+
* export let count = 0;
|
|
12
|
+
* export const store = { items: [] };
|
|
13
|
+
* export function inc() { count++; store.items.push(count); }
|
|
14
|
+
*
|
|
15
|
+
* Lowered shape the compiler emits (owning module passes its authored
|
|
16
|
+
* default; importing modules reference the same canonical key):
|
|
17
|
+
* const _c_count = _MD.defineStateCell('./src/state.ts#count', 0);
|
|
18
|
+
* const _c_store = _MD.defineStateCell('./src/state.ts#store', () => ({ items: [] }));
|
|
19
|
+
* export function inc() {
|
|
20
|
+
* _MD.updateCell(_c_count, (c) => c + 1);
|
|
21
|
+
* _MD.readCell(_c_store).items.push(_MD.readCell(_c_count));
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* Values initialize lazily per application runtime from the recorded
|
|
25
|
+
* default. Factory initials produce a FRESH value for every request, so
|
|
26
|
+
* mutated object stores never share instances across requests. Writes
|
|
27
|
+
* invalidate readers through the existing access table by canonical key,
|
|
28
|
+
* so computed entities, effects, and component updates need no changes.
|
|
29
|
+
*/
|
|
30
|
+
export interface StateCell {
|
|
31
|
+
/** Canonical linker identity, e.g. './src/state.ts#count'. */
|
|
32
|
+
readonly key: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Declare a cell under a canonical identity. The module that OWNS the state
|
|
36
|
+
* passes its authored default - a value, or a factory for object state so
|
|
37
|
+
* each request gets a fresh instance. Importing modules call it with the
|
|
38
|
+
* same key and no initial.
|
|
39
|
+
*/
|
|
40
|
+
export declare function defineStateCell<T>(key: string, initial?: T | (() => T)): StateCell;
|
|
41
|
+
/** Read this request's value of the cell. Initializes from the default once. */
|
|
42
|
+
export declare function readCell<T>(cell: StateCell): T;
|
|
43
|
+
/**
|
|
44
|
+
* Write this request's value and route invalidation through the access
|
|
45
|
+
* table under the cell's canonical key — identical routing to an ordinary
|
|
46
|
+
* authored state write.
|
|
47
|
+
*/
|
|
48
|
+
export declare function setCell<T>(cell: StateCell, value: T): void;
|
|
49
|
+
/** Functional write; receives the request's current value. */
|
|
50
|
+
export declare function updateCell<T>(cell: StateCell, change: (current: T) => T): void;
|
|
51
|
+
//# sourceMappingURL=state-cells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-cells.d.ts","sourceRoot":"","sources":["../src/state-cells.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GACtB,SAAS,CAGX;AAkBD,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAG1D;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GACxB,IAAI,CAEN"}
|
package/dist/testing.d.ts
CHANGED
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/testing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e,D as t,E as n,S as r,T as i,_ as a,a as o,b as s,c,d as l,f as u,g as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./chunks/jsx-dom-C2FcLSgz.js";import{a as w,c as T,i as E,l as D,n as O,o as k,r as A,s as j,t as M}from"./chunks/access-CMv8a6Cm.js";import{A as N,C as P,D as F,E as I,F as L,I as R,M as z,N as B,O as V,P as H,S as U,T as W,_ as G,a as K,b as q,c as J,d as Y,f as X,g as Z,h as Q,i as $,j as ee,k as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue,v as de,w as fe,x as pe,y as me}from"./chunks/src-CMZZbF4X.js";import{r as he,t as ge}from"./chunks/mount-COP9U3A-.js";export{m as _internals,le as _propsBox,g as canReuseTemplate,ce as classValue,fe as cleanup,te as clearEventLog,f as commit,N as commitStructuralWrites,ee as commitWrites,z as commitWritesWithPayload,oe as computedChanged,o as createApplicationRuntime,$ as createCondRegion,ue as createDelegatedEventBinding,X as createListRegion,t as createStorage,T as decodeListKey,W as defineStateCell,re as effectAssignmentChanged,D as encodeListKey,h as getActiveApplicationRuntime,_ as getActiveEnvironment,c as getEntity,B as getEventLog,p as getExtensionStore,M as getRootId,H as handle,y as has,O as installAccessTable,A as isOpaque,L as isStructuralListUpdate,R as listStructureReason,l as markDirty,u as markDirtySubtree,ge as mount,P as mountRef,K as patchDomProps,I as readCell,d as register,pe as registerConditionalEffect,U as registerEffect,ie as registerProps,he as registerRootFactory,a as registeredIds,b as renderDescendants,E as resetAccessTable,C as resetScheduler,w as resolveStaticWrites,k as resolveWrites,v as rootNodes,s as runWithApplicationRuntime,S as runWithRenderEnvironment,r as setActiveApplicationRuntime,Q as setAttr,F as setCell,Z as setClass,G as setClassName,J as setClassValue,Y as setDelegatedEvent,ae as setDomValue,de as setProp,se as setProps,e as setScheduler,me as setStyle,ne as setStyleValue,q as setText,x as undirty,j as uninstallAccessTable,i as unregister,n as unregisterSubtree,V as updateCell};
|
package/package.json
CHANGED
|
@@ -1,28 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@memoized-dom/runtime",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Dependency-free runtime for compiler-analyzed memoized DOM updates",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects":
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@memoized-dom/runtime",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "Dependency-free runtime for compiler-analyzed memoized DOM updates",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"./dist/server.js"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"browser": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/server.js",
|
|
21
|
+
"default": "./dist/server.js"
|
|
22
|
+
},
|
|
23
|
+
"./client": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./server": {
|
|
29
|
+
"types": "./dist/server.d.ts",
|
|
30
|
+
"import": "./dist/server.js",
|
|
31
|
+
"default": "./dist/server.js"
|
|
32
|
+
},
|
|
33
|
+
"./hydrate": {
|
|
34
|
+
"types": "./dist/hydrate.d.ts",
|
|
35
|
+
"import": "./dist/hydrate.js",
|
|
36
|
+
"default": "./dist/hydrate.js"
|
|
37
|
+
},
|
|
38
|
+
"./hot": {
|
|
39
|
+
"types": "./dist/hot.d.ts",
|
|
40
|
+
"import": "./dist/hot.js",
|
|
41
|
+
"default": "./dist/hot.js"
|
|
42
|
+
},
|
|
43
|
+
"./testing": {
|
|
44
|
+
"types": "./dist/testing.d.ts",
|
|
45
|
+
"import": "./dist/testing.js",
|
|
46
|
+
"default": "./dist/testing.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "bun run ./scripts/clean.ts && rolldown -c rolldown.config.ts && tsc -p tsconfig.build.json"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=new Map;function We(e,t,n){if(n===void 0||Array.isArray(n)&&n.length===0){T.size!==0&&T.delete(e);return}if(!t){typeof n=="number"?T.set(e,n):n.length===1?T.set(e,n[0]):T.set(e,new Set(n));return}let o=T.get(e);if(o===void 0)return;let r=typeof n=="number"?[n]:n;if(typeof o=="number"){r.some(i=>i!==o)&&T.set(e,new Set([o,...r]));return}for(let i of r)o.add(i)}function $e(e){if(T.size===0)return null;let t=T.get(e)??null;return T.delete(e),t}function j(e){T.size!==0&&T.delete(e)}var v=new Map,S=new Set,P=new Set,ye=!1,vt=-1;function ze(){ye||P.size===0||typeof globalThis.requestAnimationFrame!="function"||(ye=!0,globalThis.requestAnimationFrame(()=>{if(ye=!1,!(typeof globalThis.document<"u"&&globalThis.document.hidden))for(let t of P)N(t,vt);ze()}))}var Be=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e),he=Be;function kt(e){he=e}function Ct(){he=Be}function Rt(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===47&&t++;return t}var Y=null,Ve=0;var je=[],ge=[];function ee(e){ge.includes(e)||ge.push(e)}function te(e){je.push(e)}function Ke(e,t){for(let n of je)n(e,t)}function ne(e){let t=e.parent!==null?v.get(e.parent):void 0;e.depth=e.depth??(t&&t.depth!==void 0?t.depth+1:Rt(e.id)),v.set(e.id,e),e.volatile===!0?P.add(e.id):P.delete(e.id),t&&(t.children??=new Set).add(e.id),Y=null,Ve++,Ke(e.id,"add"),ze()}function x(e){let t=v.get(e);if(!t)return;t.parent!==null&&v.get(t.parent)?.children?.delete(e);let n=[e],o=[],r=[];for(;n.length>0;){let i=n.pop(),s=v.get(i);if(s&&(o.push(i),s.children))for(let d of s.children)n.push(d)}o.reverse();for(let i of o)v.delete(i),S.delete(i),P.delete(i),j(i),Ke(i,"remove");for(let i of o)for(let s of ge){let d=s(i);d!==void 0&&r.push(...d)}if(Y=null,Ve++,r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,`[memo-dom] ${r.length} cleanup disposers failed while unregistering '${e}'`)}function It(e){x(e)}function K(e){return v.has(e)}function Ee(e){return v.get(e)}function Tt(e){let t=r=>{if(r.children!==void 0)for(let i of r.children){let s=v.get(i);s!==void 0&&(s.phase!=="effect"&&(s.render(),O(i)),t(s))}},n=r=>{if(r.children!==void 0)for(let i of r.children){let s=v.get(i);s!==void 0&&(s.phase==="effect"&&(s.render(),O(i)),n(s))}},o=v.get(e);o!==void 0&&(t(o),n(o))}function _(){return Y??=[...v.keys()],Y}function N(e,t){if(!v.has(e))return;let n=S.has(e);(t!==void 0||n)&&We(e,n,t),S.add(e),_e()}function O(e){S.size!==0&&S.delete(e)&&j(e)}function L(e){let t=e+"/",n=!1;for(let o of v.keys())(o===e||o.startsWith(t))&&(S.add(o),j(o),n=!0);n&&_e()}var me=!1,Q=!1;function _e(){me||Q||(me=!0,he(Ue))}function Ue(){if(me=!1,!Q){Q=!0;try{for(let e=0;e<100&&S.size>0;e++){let t=[];for(let r of S){let i=v.get(r);i?t.push(i):(S.delete(r),j(r))}let o=t.some(r=>r.phase!=="effect")?t.filter(r=>r.phase!=="effect"):t;o.sort((r,i)=>(r.depth??0)-(i.depth??0));for(let r of o)S.delete(r.id)&&r.render($e(r.id))}if(S.size>0)throw new Error("[memo-dom] commit cascade exceeded 100 passes \u2014 an update is dirtying its own readers (cycle)")}finally{Q=!1}}}function Ln(){return{registry:v,dirtySet:S,volatileSet:P}}var oe=new Map,we=new Set,qe=!1;function St(){qe||(qe=!0,ee(At))}function re(e,t){if(typeof t!="function")throw new TypeError("[memo-dom] cleanup(disposer) requires a function");if(we.has(e))throw new Error(`[memo-dom] cannot register cleanup while '${e}' is being unregistered`);St();let n=oe.get(e);return n===void 0&&(n=[],oe.set(e,n)),n.push(t),t}function At(e){let t=oe.get(e);if(t===void 0)return[];oe.delete(e),we.add(e);let n=[];try{for(let o=t.length-1;o>=0;o--)try{t[o]()}catch(r){n.push(r)}}finally{we.delete(e)}return n}function Dt(e,t){let n=[],o=!0;try{Je(e,t,n)}catch(r){let i=Ge(n);throw i.length>0?new AggregateError([r,...i],"[memo-dom] ref setup and rollback failed"):r}return()=>{if(!o)return;o=!1;let r=Ge(n);if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"[memo-dom] multiple ref cleanups failed")}}function Je(e,t,n){if(t==null||t===!1)return;if(Array.isArray(t)){for(let r of t)Je(e,r,n);return}if(typeof t!="function")throw new TypeError("[memo-dom] ref value must be a callback, an assignable JSX target, or an array of refs");let o=t(e);if(o!=null){if(typeof o!="function")throw new TypeError("[memo-dom] ref callback must return a cleanup function or nothing");n.push(o)}}function Ge(e){let t=[];for(let n=e.length-1;n>=0;n--)try{e[n]()}catch(o){t.push(o)}return e.length=0,t}function Ze(e,t,n){let o;K(e)&&x(e),ne({id:e,parent:t,phase:"effect",render(){let r=o;o=void 0,r?.();let i=n();if(i!==void 0&&typeof i!="function")throw new TypeError(`[memo-dom] effect '${e}' must return a cleanup function or undefined`);o=typeof i=="function"?i:void 0}}),re(e,()=>{let r=o;o=void 0,r?.()}),N(e)}function Nt(e,t,n,o){let r=`${e}/$active`,i=!1;K(e)&&x(e),ne({id:e,parent:t,phase:"effect",render(){let s=!!n();s!==i&&(i=s,i?Ze(r,e,o):x(r))}}),re(e,()=>{i=!1,K(r)&&x(r)}),N(e)}function Mt(e,t,n,o){e[t]!==o&&(e[t]=o,n.data=o==null||typeof o=="boolean"?"":String(o))}function Lt(e,t,n,o){e[t]!==o&&(e[t]=o,n.className=o)}function Ht(e,t,n,o,r){e[t]!==r&&(e[t]=r,n.classList.toggle(o,r))}function Ft(e,t,n,o,r){e[t]!==r&&(e[t]=r,r==null||r===!1?n.removeAttribute(o):r===!0?n.setAttribute(o,""):n.setAttribute(o,String(r)))}function Pt(e,t,n,o,r){e[t]!==r&&(e[t]=r,n[o]=r)}function Ot(e,t,n,o,r){e[t]!==r&&(e[t]=r,r==null?n.style.removeProperty(o):n.style.setProperty(o,r))}function Wt(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(e===t||e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n])||be(e[n]))return!0;return!1}return be(e)||be(t)?!0:!Object.is(e,t)}function $t(e,t){return!Object.is(e,t)}function be(e){return typeof e=="object"&&e!==null||typeof e=="function"}var xe="",W=new Map,H=new Map,ie=new Map,ve=new Set,de=new Map,Xe=[],U=new Map,se=0,ke=new Map,Ce=new Map;function zt(){U=new Map;let e=_();for(let[t,n]of H){let o=new Set;for(let r of n)for(let i of e)r.test(i)&&o.add(i);U.set(t,o)}}te((e,t)=>{if(H.size===0)return;let n=!1;if(t==="add")for(let[o,r]of H){let i=U.get(o);if(i){for(let s of r)if(s.test(e)){i.add(e),n=!0;break}}}else for(let o of U.values())o.delete(e)&&(n=!0);n&&se++});function Bt(e){if(!e.includes("*"))return null;let t=e.split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("[^/]*");return new RegExp(`^${t}$`)}function Re(){xe="",W=new Map,H=new Map,ie=new Map,ve=new Set;for(let{table:e,root:t}of de.values()){xe=t;for(let[n,o]of Object.entries(e.readers))for(let r of o){let i=Bt(r);if(i===null){let s=W.get(n)??[];s.includes(r)||s.push(r),W.set(n,s)}else{let s=H.get(n)??[];s.some(d=>d.source===i.source)||s.push(i),H.set(n,s)}}for(let[n,o]of Object.entries(e.params??{})){let r=ie.get(n)??[];for(let i of o)r.includes(i.pattern)||r.push(i.pattern);ie.set(n,r)}for(let n of e.opaque??[])ve.add(n)}Xe=[...new Set([...W.keys(),...H.keys()])],ke.clear(),Ce.clear(),zt(),se++}function Vt(e,t,n=`${t}\0${JSON.stringify(e)}`){de.set(n,{table:e,root:t}),Re()}function Ie(e){de.delete(e)&&Re()}function jt(){de.clear(),Re()}function Te(e){return ve.has(e)}function le(){return xe}function Se(e){return e.some(Te)?"root-subtree":Qe(e)}function Ae(e,t,n){if(e.some(Te))return"root-subtree";if(n){let o=new Set,r=!0;for(let i of e){let s=ie.get(i);if(s===void 0||s.length===0){r=!1;break}for(let d of s){let l=!1,f=d.replace(/\{([^}]+)\}/g,(h,p)=>{let A=p.trim();if(!A.startsWith("payload."))return l=!0,"";let b=n;for(let k of A.slice(8).split(".")){if(b===null||typeof b!="object")return l=!0,"";b=b[k]}return b==null?(l=!0,""):String(b)});if(l){r=!1;break}o.add(f)}if(!r)break;for(let d of W.get(i)??[])o.add(d)}if(r&&o.size>0)return[...o]}return Qe(e)}function Qe(e){let t=e.length===1?e[0]:e.join(" "),n=Ce.get(t);if(n!==void 0&&n.v===se)return n.result;let o=new Set,r=new Set;for(let s of e){let d=ke.get(s);if(d===void 0){d=[];for(let l of Xe)(l===s||l.startsWith(`${s}.`)||s.startsWith(`${l}.`))&&d.push(l);ke.set(s,d)}for(let l of d)r.add(l)}for(let s of r){for(let d of W.get(s)??[])o.add(d);for(let d of U.get(s)??[])o.add(d)}let i=[...o];return Ce.set(t,{v:se,result:i}),i}var Kt=1e3,q=[];function _t(){return q}function Ut(){q.length=0}function Ye(e){let t=Se(e);if(t==="root-subtree"){L(le());return}for(let n of t)N(n)}function qt(e,t){let n=Ae(e,[],t);if(n==="root-subtree"){L(le());return}for(let o of n)N(o)}function Gt(e,t,n){return o=>{n(o),q.push({origin:e,writes:t,at:Date.now()}),q.length>Kt&&q.shift(),Ye(t)}}var Jt=e=>e,Zt=[],Xt=[],Qt=[];function Yt(e){let t=e.length,n=Zt,o=Xt,r=Qt;n.length=t,r.length=t,o.length=0;for(let s=0;s<t;s++)n[s]=!1,r[s]=-1;for(let s=0;s<t;s++){let d=e[s];if(d<0)continue;let l=0,f=o.length;for(;l<f;){let h=l+f>>1;e[o[h]]<d?l=h+1:f=h}o[l]=s,l>0&&(r[s]=o[l-1])}let i=o.length>0?o[o.length-1]:-1;for(;i>=0;)n[i]=!0,i=r[i];return n}function en(e,t,n,o=Jt,r=!0){let i=document.createComment(`list:${t}`);e.appendChild(i);let s=new Map,d=new Map,l=0,f=[],h=[],p=[],A=new Map,b=[],k=[],z=[];function pe(y,E,u,C){if(y.updateProps?.(E,C),y.update!==void 0)y.update(),u!==null&&O(u);else if(u!==null){let M=Ee(u);M&&(M.render(),O(u))}}function gt(y){let E=typeof y;if(E==="string"||E==="number"||E==="boolean"||E==="bigint")return`${t}/Row[${String(y)}]`;let u=d.get(y);return u===void 0&&(u=`#${++l}`,d.set(y,u)),`${t}/Row[${u}]`}function mt(y,E=!0){if(y.length===f.length){let a=!0;for(let c=0;c<y.length;c++)if(y[c]!==f[c]){a=!1;break}if(a){if(!E)return;for(let c=0;c<y.length;c++)pe(h[c],y[c],r?p[c]??null:null,c);return}}let u=s,C=u.size===0;A.clear();let M=A,F=k,R=b,B=y.length;F.length=r?B:0,R.length=B,z.length=C?0:B;let Z=!1,Le=0,He=!0,Fe=-1;for(let a=0;a<y.length;a++){let c=y[a],w=o(c,a);if(M.has(w))throw new Error(`[memo-dom] duplicate list key: ${String(w)}`);let m=C?void 0:u.get(w);if(m!==void 0){Le++,u.delete(w);let g=m.pos;z[a]=g,g<=Fe?He=!1:Fe=g,m.pos=a,(E||c!==f[g])&&pe(m.e,c,m.id,a)}else{let g=r?gt(w):t;m={e:n(c,g,a),id:r?g:null,pos:a},C||(z[a]=-1),Z=!0}M.set(w,m),R[a]=m.e,r&&(F[a]=m.id)}if(!C&&Le===0&&(B===0||Z)){for(let[,g]of u)g.e.dispose?.();let a=!1,c;for(let g of h){let I=g.nodes;if(c=Array.isArray(I)?I[0]:I,c!==void 0)break}if(c!==void 0&&c.parentNode===e&&i.parentNode===e&&typeof document.createRange=="function"){let g=document.createRange();g.setStartBefore(c),g.setEndBefore(i),g.deleteContents(),a=!0}for(let[g,I]of u){if(!a){let D=I.e.nodes;if(Array.isArray(D))for(let X of D)X.parentNode?.removeChild(X);else D.parentNode?.removeChild(D)}for(let D of I.e.entities)x(D);d.delete(g)}if(u.clear(),B!==0){let g=document.createDocumentFragment();for(let I=0;I<R.length;I++){let D=R[I].nodes;if(Array.isArray(D))for(let X of D)g.appendChild(X);else g.appendChild(D)}e.insertBefore(g,i)}s=M,A=u;let w=h;h=R,b=w;let m=p;p=F,k=m,b.length=0,k.length=0,f=y.slice();return}if(C&&Z){let a=document.createDocumentFragment();for(let m=0;m<R.length;m++){let g=R[m].nodes;if(Array.isArray(g))for(let I of g)a.appendChild(I);else a.appendChild(g)}e.insertBefore(a,i),s=M,A=u;let c=h;h=R,b=c;let w=p;p=F,k=w,b.length=0,k.length=0,f=y.slice();return}if(!Z&&u.size===0&&He){s=M,A=u;let a=h;h=R,b=a;let c=p;p=F,k=c,b.length=0,k.length=0,f=y.slice();return}for(let[a,c]of u){c.e.dispose?.();let w=c.e.nodes;if(Array.isArray(w))for(let m of w)m.parentNode?.removeChild(m);else w.parentNode?.removeChild(w);for(let m of c.e.entities)x(m);d.delete(a)}u.clear();let wt=Yt(z),Pe=i,V=null,Oe=()=>{if(V===null)return;let a=document.createDocumentFragment();for(let c=V.length-1;c>=0;c--){let w=V[c].nodes;if(Array.isArray(w))for(let m of w)a.appendChild(m);else a.appendChild(w)}e.insertBefore(a,Pe),V=null};for(let a=R.length-1;a>=0;a--){let c=R[a];z[a]===-1||!wt[a]?(V??=[]).push(c):(Oe(),Pe=Array.isArray(c.nodes)?c.nodes[0]:c.nodes)}Oe(),s=M,A=u;let bt=h;h=R,b=bt;let xt=p;p=F,k=xt,b.length=0,k.length=0,f=y.slice()}function ht(y){let E=s.get(y);E!==void 0&&pe(E.e,f[E.pos],E.id,E.pos)}function Et(){for(let[y,E]of s){E.e.dispose?.();let u=E.e.nodes;if(Array.isArray(u))for(let C of u)C.parentNode?.removeChild(C);else u.parentNode?.removeChild(u);for(let C of E.e.entities)x(C);d.delete(y)}s.clear(),A.clear(),f=[],h.length=0,p.length=0,b.length=0,k.length=0,i.parentNode?.removeChild(i)}return{reconcile:mt,refreshKey:ht,size:()=>s.size,dispose:Et}}function G(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(e.childNodes):[e]}var tt=new WeakMap,De=new WeakMap,ce=new Map;function tn(e,t){tt.set(e,t)}function et(e){for(let t of e)t.parentNode?.removeChild(t)}function nn(e){if(typeof e!="string")return e;let t=document.getElementById(e);if(t===null)throw new Error(`memoized-dom: mount target '#${e}' was not found`);return t}function on(e,t){let n=nn(e);if(De.has(n))throw new Error("memoized-dom: mount target already owns an application");let o=tt.get(t);if(o===void 0)throw new Error("memoized-dom: mount received a component that is not a compiled application root");if(ce.has(o.id))throw new Error(`memoized-dom: root entity '${o.id}' is already mounted`);if(ce.size>0)throw new Error("memoized-dom: the runtime currently supports one mounted application");let r;try{r=o.create({mode:"create",host:n})}catch(l){throw x(o.id),l}let i=G(r);try{n.appendChild(r)}catch(l){throw x(o.id),et(i),l}let s=!0,d={host:n,rootId:o.id,nodes:i,get mounted(){return s},unmount(){if(s){s=!1,De.delete(n),ce.delete(o.id);try{x(o.id)}finally{et(i)}}}};return De.set(n,d),ce.set(o.id,d),d}var nt=new Map,ot=new Map;function rn(e,t,n){let o=t;o[e.handler]=n,o[e.rootKey]=e.root}function sn(e,t){let n=dn(t);return ln(e,n),{root:e,handler:n.handler,rootKey:n.root}}function dn(e){let t=ot.get(e);if(t!==void 0)return t;let n=an(e);return t=nt.get(n),t===void 0&&(t={handler:Symbol(`memo-dom:${n}:handler`),root:Symbol(`memo-dom:${n}:root`),roots:new WeakSet,type:n},nt.set(n,t)),ot.set(e,t),t}function ln(e,t){t.roots.has(e)||(t.roots.add(e),e.addEventListener(t.type,n=>{n.bubbles&&rt(e,t,n)}),e.addEventListener(t.type,n=>{n.bubbles||rt(e,t,n)},!0))}function rt(e,t,n){let o=typeof n.composedPath=="function"?n.composedPath():cn(n.target,e);for(let r of o){if(r===void 0)continue;let i=r;if(i[t.root]===e){let s=i[t.handler];s!==void 0&&s.call(r,n)===!1&&n.preventDefault()}if(r===e||n.cancelBubble)break}}function cn(e,t){let n=[],o=e;for(;o!==null&&(n.push(o),o!==t);)o="parentNode"in o?o.parentNode:null;return n}function an(e){let t=e.startsWith("on")?e.slice(2).toLowerCase():e.toLowerCase();return t==="doubleclick"?"dblclick":t}var ae=new WeakMap,fn=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","column-count","flex","flex-grow","flex-shrink","font-weight","grid-column","grid-row","line-height","opacity","order","orphans","scale","tab-size","widows","z-index","zoom"]);function fe(e){let t=[];return it(e,t),t.join(" ")}function Ne(e,t){let n=fe(t);e.namespaceURI==="http://www.w3.org/2000/svg"?n===""?e.removeAttribute("class"):e.setAttribute("class",n):e.className=n}function Me(e,t){let n=e.style;if(n===void 0)return;if(typeof t=="string"){let i=ae.get(e);if(i?.size===1&&i.get("$cssText")===t)return;n.cssText=t,ae.set(e,new Map([["$cssText",t]]));return}let o=new Map;if(t!==null&&typeof t=="object")for(let[i,s]of Object.entries(t)){if(s==null)continue;let d=un(i);o.set(d,pn(d,s))}let r=ae.get(e)??new Map;r.has("$cssText")&&(n.cssText="");for(let i of r.keys())i!=="$cssText"&&!o.has(i)&&n.removeProperty(i);for(let[i,s]of o)r.get(i)!==s&&n.setProperty(i,s);ae.set(e,o)}function it(e,t){if(e==null||e===!1||e===!0)return;if(Array.isArray(e)){for(let o of e)it(o,t);return}if(typeof e=="object"){for(let[o,r]of Object.entries(e))r&&t.push(o);return}let n=String(e).trim();n!==""&&t.push(n)}function un(e){return e.startsWith("--")||e.includes("-")?e:e.replace(/^ms([A-Z])/,"ms-$1").replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function pn(e,t){return typeof t=="number"&&t!==0&&!e.startsWith("--")&&!fn.has(e)?`${t}px`:String(t)}var st=new WeakMap,dt=new WeakMap,yn=new Set(["innerHTML","checked","value","selected","disabled","hidden","multiple","required","readOnly","muted","open","controls","loop","autoFocus","autoPlay","tabIndex"]),lt={className:"class",htmlFor:"for",readOnly:"readonly",autoFocus:"autofocus",autoPlay:"autoplay",tabIndex:"tabindex",crossOrigin:"crossorigin"},gn={className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",dominantBaseline:"dominant-baseline",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",vectorEffect:"vector-effect",xlinkHref:"xlink:href"},mn={doubleclick:"dblclick"};function hn(e,t,n,o=[]){let r=t!==null&&typeof t=="object"?t:{},i=st.get(e)??new Map,s=new Set(o);for(let l of i.keys())Object.prototype.hasOwnProperty.call(r,l)||ct(e,l,null,i,n,s);for(let[l,f]of Object.entries(r))ct(e,l,f,i,n,s);let d=new Map;for(let[l,f]of Object.entries(r))d.set(l,ft(l,f));st.set(e,d)}function at(e,t,n){if(t==="class"||t==="className"){Ne(e,n);return}if(t==="style"){Me(e,n);return}bn(e,t,n)}function ct(e,t,n,o,r,i){if(t==="key"||t==="children"||t==="ref")return;if(/^on[A-Z]/.test(t)){En(e,t,typeof n=="function"?n:null,r,i.has(t));return}let s=ft(t,n);Object.is(o.get(t),s)||at(e,t,n)}function ft(e,t){return e==="class"||e==="className"?fe(t):e==="style"?Symbol("style-snapshot"):t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:String(t)}function En(e,t,n,o,r){let i=dt.get(e);i===void 0&&(i=new Map,dt.set(e,i));let s=i.get(t);if(s?.source===n||(s!==void 0&&(e.removeEventListener(s.type,s.listener),i.delete(t)),n===null))return;let d=wn(t),l=r?n:function(h){let p=n.call(this,h);return L(o),p!==null&&typeof p=="object"&&"then"in p&&typeof p.then=="function"&&p.then(()=>{L(o)}),p};e.addEventListener(d,l),i.set(t,{source:n,listener:l,type:d})}function wn(e){let t=e.slice(2).toLowerCase();return mn[t]??t}function bn(e,t,n){let o=e.namespaceURI!=="http://www.w3.org/2000/svg";if(o&&yn.has(t)){if(t==="tabIndex"&&n==null){e.removeAttribute("tabindex");return}e[t]=n??xn(t);return}let r=o?lt[t]??t:gn[t]??lt[t]??t;n==null||n===!1?e.removeAttribute(r):n===!0?e.setAttribute(r,""):!o&&t==="xlinkHref"?e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",String(n)):e.setAttribute(r,String(n))}function xn(e){return e==="value"||e==="innerHTML"?"":!1}var J=new Map,$=new Map,ut=!1;function pt(e){$.delete(e.id);let t=J.get(e.factory);t?.delete(e),t?.size===0&&J.delete(e.factory)}function vn(){ut||(ut=!0,ee(e=>{let t=$.get(e);t!==void 0&&pt(t)}))}function kn(e,t,n,o,r){vn();let i=$.get(t);i!==void 0&&pt(i);let s={factory:e,id:t,parent:n,nodes:o,props:r};$.set(t,s);let d=J.get(e)??new Set;d.add(s),J.set(e,d)}function yt(e,t){if($.get(e.id)!==e)return;let n=e.nodes.find(l=>l.parentNode!==null),o=n?.parentNode,i=n?.ownerDocument?.createComment("memoized-dom-hmr");n!==void 0&&o!==void 0&&o!==null&&i!==void 0&&o.insertBefore(i,n),x(e.id);for(let l of e.nodes)l.parentNode?.removeChild(l);let s=e.props===null?t(e.id,e.parent):t(e.id,e.parent,e.props),d=G(s);if(i?.parentNode!==null&&i?.parentNode!==void 0){let l=i.parentNode;for(let f of d)l.insertBefore(f,i);l.removeChild(i)}}function Cn(e,t){let n=[...J.get(e)??[]];for(let o of n)yt(o,t);return n.length}function Rn(){let e=[...$.values()].filter(t=>t.parent===null);for(let t of e)yt(t,t.factory)}function In(e,t){if(e.some(([,o,r])=>o===void 0||r)){Rn();return}let n=0;for(let[o,r]of e)r!==void 0&&(n+=Cn(o,r));n===0&&L(t)}function Tn(e,t){Ie(e);let n=encodeURIComponent(e),o=`${t}/$computed/${n}#`,r=`${t}/$module-effects/${n}/`;for(let i of[..._()])(i.startsWith(o)||i.startsWith(r))&&x(i)}function Sn(e,t,n,o){let r=document.createComment(`when:${t}`);e.appendChild(r);let i=-1,s=null;function d(){let f=n();if(f===i){s?.update();return}if(s!==null){s.dispose?.();for(let p of s.nodes)p.parentNode?.removeChild(p);s=null}let h=o[f]??null;if(h!==null){s=h();for(let p=s.nodes.length-1;p>=0;p--)r.parentNode.insertBefore(s.nodes[p],r)}i=f}function l(){if(s!==null){s.dispose?.();for(let f of s.nodes)f.parentNode?.removeChild(f);s=null}r.parentNode?.removeChild(r),i=-1}return d(),{update:d,index:()=>i,dispose:l}}var ue=new Map;function An(e,t){ue.set(e,t)}function Dn(e,t){let n=ue.get(e);if(n===void 0)return;let o=n.length!==t.length;if(!o){for(let r=0;r<t.length;r++)if(!Object.is(n[r],t[r])){o=!0;break}}if(o){n.length=t.length;for(let r=0;r<t.length;r++)n[r]=t[r];N(e)}}function fo(e){return ue.get(e)}te((e,t)=>{t==="remove"&&ue.delete(e)});export{kt as a,Ct as b,ne as c,x as d,It as e,K as f,Ee as g,Tt as h,_ as i,N as j,O as k,L as l,Ue as m,Ln as n,re as o,Dt as p,Ze as q,Nt as r,Mt as s,Lt as t,Ht as u,Ft as v,Pt as w,Ot as x,Wt as y,$t as z,Vt as A,Ie as B,jt as C,Te as D,le as E,Se as F,Ae as G,_t as H,Ut as I,Ye as J,qt as K,Gt as L,en as M,G as N,tn as O,on as P,rn as Q,sn as R,fe as S,Ne as T,Me as U,hn as V,at as W,kn as X,In as Y,Tn as Z,Sn as _,An as $,Dn as aa,fo as ba};
|