@firsthandjs/dom 0.9.1 → 0.10.1
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/adapter.d.ts +0 -3
- package/dist/adapter.d.ts.map +1 -1
- package/dist/chunk-467WEPXM.js +1 -0
- package/dist/chunk-MWEKNBIC.js +1 -0
- package/dist/{chunk-6BRSYQCI.js → chunk-YX6HJXS6.js} +1 -1
- package/dist/{dev-chunk-MKONDKMD.js → dev-chunk-HLMVSIC4.js} +97 -74
- package/dist/{dev-chunk-6V32MCOI.js → dev-chunk-KJHYMOKB.js} +1 -1
- package/dist/{dev-chunk-ADHDPKZW.js → dev-chunk-U46CIJCO.js} +221 -311
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.dev.js +28 -24
- package/dist/hydrate.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.dev.js +3 -3
- package/dist/index.js +1 -1
- package/dist/insert.d.ts +41 -127
- package/dist/insert.d.ts.map +1 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.dev.js +121 -11
- package/dist/internal.js +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/nodes.d.ts +36 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/props.d.ts.map +1 -1
- package/dist/reconcile.d.ts +30 -0
- package/dist/reconcile.d.ts.map +1 -0
- package/dist/store.d.ts +105 -0
- package/dist/store.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-E4GAI5XA.js +0 -1
- package/dist/chunk-P4PXTIUD.js +0 -1
package/dist/hydrate.dev.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mount
|
|
3
|
-
} from "./dev-chunk-
|
|
3
|
+
} from "./dev-chunk-KJHYMOKB.js";
|
|
4
4
|
import {
|
|
5
5
|
hydration
|
|
6
|
-
} from "./dev-chunk-
|
|
6
|
+
} from "./dev-chunk-U46CIJCO.js";
|
|
7
7
|
|
|
8
8
|
// packages/dom/src/hydrate.ts
|
|
9
9
|
var COMMENT_NODE = 8;
|
|
@@ -65,43 +65,47 @@ function claimRegion(parent, marker) {
|
|
|
65
65
|
return offered;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
const bounds = boundsOf(parent, marker);
|
|
69
|
+
if (bounds === null) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const { end } = bounds;
|
|
73
|
+
cursors.set(parent, end === null ? null : end.nextSibling);
|
|
74
|
+
return claimedOf(bounds.start === end ? null : bounds.start, end);
|
|
75
|
+
}
|
|
76
|
+
function claimedOf(start, end) {
|
|
77
|
+
const nodes = [];
|
|
78
|
+
for (let one = start; one !== null && one !== end; one = one.nextSibling) {
|
|
79
|
+
nodes.push(one);
|
|
80
|
+
}
|
|
81
|
+
const only = nodes.length === 1 ? nodes[0] : null;
|
|
82
|
+
return {
|
|
83
|
+
nodes: nodes.length === 0 ? null : only ?? nodes,
|
|
84
|
+
text: only !== null && only.nodeType === TEXT_NODE ? only.data : void 0,
|
|
85
|
+
region: { node: start, end }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function boundsOf(parent, marker) {
|
|
68
89
|
const held = cursors.get(parent);
|
|
69
90
|
const fromTheTop = held === void 0;
|
|
70
91
|
const node = fromTheTop ? parent.firstChild : held;
|
|
71
|
-
let start;
|
|
72
|
-
let end;
|
|
73
92
|
const stop = fromTheTop ? marker : null;
|
|
74
93
|
let open = node;
|
|
75
94
|
while (open !== null && open !== stop && !isOpen(open)) {
|
|
76
95
|
open = open.nextSibling;
|
|
77
96
|
}
|
|
78
97
|
if (open !== null && open !== stop) {
|
|
79
|
-
end = closeOf(open);
|
|
98
|
+
const end = closeOf(open);
|
|
80
99
|
if (marker !== null && marker !== end) {
|
|
81
100
|
return null;
|
|
82
101
|
}
|
|
83
102
|
openers.push(open);
|
|
84
|
-
start
|
|
85
|
-
} else if (fromTheTop) {
|
|
86
|
-
start = node;
|
|
87
|
-
end = marker;
|
|
88
|
-
} else {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
cursors.set(parent, end === null ? null : end.nextSibling);
|
|
92
|
-
if (start === end) {
|
|
93
|
-
start = null;
|
|
103
|
+
return { start: open.nextSibling, end };
|
|
94
104
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
nodes.push(one);
|
|
105
|
+
if (fromTheTop) {
|
|
106
|
+
return { start: node, end: marker };
|
|
98
107
|
}
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
nodes: nodes.length === 0 ? null : only ?? nodes,
|
|
102
|
-
text: only !== null && only.nodeType === TEXT_NODE ? only.data : void 0,
|
|
103
|
-
region: { node: start, end }
|
|
104
|
-
};
|
|
108
|
+
return null;
|
|
105
109
|
}
|
|
106
110
|
function place(anchor) {
|
|
107
111
|
const node = claim === null ? null : claim.node;
|
package/dist/hydrate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as g}from"./chunk-YX6HJXS6.js";import{b as f}from"./chunk-467WEPXM.js";var y=8,x=3,T="[",l=null,r=0,c=new WeakMap,d=[],s=new Map;function A(n,o=document.body){return g(n,o,e=>{m(o,e)})}function m(n,o){let e=l,t=r;r++,f.current=W,l={node:n.firstChild,end:null};try{return o()}finally{l=e,r=t,r===0&&(f.current=null,b())}}function b(){for(let n=0;n<d.length;n++){let o=d[n];o.parentNode?.removeChild(o)}d=[],c=new WeakMap,s=new Map}function C(n){if(l===null)return null;let o=l.node;if(o===null||o.nodeName!==n)return null;let e=o.nextSibling;return l.node=e===l.end?null:e,o}function O(n,o){if(o!==null){let u=s.get(o);if(u!==void 0)return s.delete(o),u}let e=M(n,o);if(e===null)return null;let{end:t}=e;return c.set(n,t===null?null:t.nextSibling),w(e.start===t?null:e.start,t)}function w(n,o){let e=[];for(let u=n;u!==null&&u!==o;u=u.nextSibling)e.push(u);let t=e.length===1?e[0]:null;return{nodes:e.length===0?null:t??e,text:t!==null&&t.nodeType===x?t.data:void 0,region:{node:n,end:o}}}function M(n,o){let e=c.get(n),t=e===void 0,u=t?n.firstChild:e,N=t?o:null,i=u;for(;i!==null&&i!==N&&!p(i);)i=i.nextSibling;if(i!==null&&i!==N){let a=h(i);return o!==null&&o!==a?null:(d.push(i),{start:i.nextSibling,end:a})}return t?{start:u,end:o}:null}function S(n){let o=l===null?null:l.node,e=o?.parentNode??null;return e?.insertBefore(n,o),e}function v(n,o){let e=l;l=n;try{return o()}finally{l=e}}function p(n){return n!==null&&n.nodeType===y&&n.nodeValue===T}function h(n){let o=0;for(let e=n.nextSibling;e!==null;e=e.nextSibling)if(e.nodeType===y){if(p(e)){o++;continue}if(o===0)return e;o--}return null}function E(n){return p(n)?h(n):n}function D(n){return n.slice(1,n.search(/[\s/>]/)).toUpperCase()}function R(n,o,e,t){o.insertBefore(e,t.region.end),n.node=t.nodes===null?e:[...Array.isArray(t.nodes)?t.nodes:[t.nodes],e],s.set(e,t)}var W={tag:D,adopt:C,claim:O,within:v,keep:R,step:E,place:S};export{C as adopt,O as claimRegion,A as hydrate,m as hydrateWith,S as place,v as within};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Re-exports the reactive core so that applications have one import site.
|
|
5
5
|
*/
|
|
6
6
|
export { component, defineElement, setElementPrefix, createComponent, view } from './component.js';
|
|
7
|
-
export { setComponentAdapter
|
|
7
|
+
export { setComponentAdapter } from './adapter.js';
|
|
8
|
+
export { FirsthandComponentError } from './errors.js';
|
|
8
9
|
export type { ComponentAdapter } from './adapter.js';
|
|
9
10
|
export type { Component, ComponentOptions, AttributeCodec, View, Render } from './component.js';
|
|
10
11
|
export { render } from './render.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,MAAM,GACP,MAAM,mBAAmB,CAAC"}
|
package/dist/index.dev.js
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
setComponentAdapter,
|
|
11
11
|
setElementPrefix,
|
|
12
12
|
view
|
|
13
|
-
} from "./dev-chunk-
|
|
13
|
+
} from "./dev-chunk-HLMVSIC4.js";
|
|
14
14
|
import {
|
|
15
15
|
render
|
|
16
|
-
} from "./dev-chunk-
|
|
17
|
-
import "./dev-chunk-
|
|
16
|
+
} from "./dev-chunk-KJHYMOKB.js";
|
|
17
|
+
import "./dev-chunk-U46CIJCO.js";
|
|
18
18
|
|
|
19
19
|
// packages/dom/src/portal.ts
|
|
20
20
|
import { onCleanup } from "@firsthandjs/core";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as i,e as f,f as s,h as
|
|
1
|
+
import{a as d,b as i,e as f,f as s,h as m,i as a,j as l,k as x,l as C,m as h,x as y}from"./chunk-MWEKNBIC.js";import{a as c}from"./chunk-YX6HJXS6.js";import"./chunk-467WEPXM.js";import{onCleanup as u}from"@firsthandjs/core";function N(e,t){let o=[];p(e,o);for(let r=0;r<o.length;r++)t.appendChild(o[r]);return u(()=>{for(let r=0;r<o.length;r++){let n=o[r];n.parentNode?.removeChild(n)}}),null}function p(e,t){if(!(e==null||typeof e=="boolean")){if(Array.isArray(e)){for(let o=0;o<e.length;o++)p(e[o],t);return}if(typeof e=="object"&&typeof e.nodeType=="number"){t.push(e);return}t.push(document.createTextNode(String(e)))}}import{signal as S,computed as T,effect as V,batch as W,untrack as q,onCleanup as z,createRoot as B,catchError as G,runWithOwner as H,createContext as I,provide as J,useContext as K,FirsthandContextError as L,FirsthandCycleError as M,FirsthandReadonlyError as Q}from"@firsthandjs/core";export{d as FirsthandComponentError,L as FirsthandContextError,M as FirsthandCycleError,Q as FirsthandReadonlyError,W as batch,G as catchError,s as component,T as computed,a as createComponent,I as createContext,B as createRoot,l as defineElement,V as effect,x as list,y as mergeProps,h as off,C as on,z as onCleanup,N as portal,J as provide,c as render,H as runWithOwner,i as setComponentAdapter,f as setElementPrefix,S as signal,q as untrack,K as useContext,m as view};
|
package/dist/insert.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A dynamic child position: what fills it, and when it is filled again.
|
|
3
|
+
*
|
|
4
|
+
* `insert` binds one; `applyChild` writes whatever a part produced into one.
|
|
5
|
+
* The two are mutually recursive by nature — an array of children is children —
|
|
6
|
+
* which is why they are one module rather than two.
|
|
7
|
+
*/
|
|
8
|
+
import { type Owner } from '@firsthandjs/core';
|
|
2
9
|
import { type Claimed } from './claim.js';
|
|
3
|
-
|
|
4
|
-
export type ChildSlot
|
|
10
|
+
import { type ChildSlot } from './nodes.js';
|
|
11
|
+
export type { ChildSlot } from './nodes.js';
|
|
5
12
|
/**
|
|
6
13
|
* Runs `body` with the parts inside it excused from removing their nodes.
|
|
7
14
|
*
|
|
@@ -55,88 +62,32 @@ export type DynamicChild = {
|
|
|
55
62
|
export declare function part(thunk: () => unknown): DynamicChild;
|
|
56
63
|
export declare function isDynamicChild(value: object): value is DynamicChild;
|
|
57
64
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* A render function runs as a whole, so the DOM it describes has to be the DOM
|
|
61
|
-
* it already made: created on the first run, written on every one after. These
|
|
62
|
-
* records are what survives between runs — the node, and the last value, so a
|
|
63
|
-
* run that produces what is already on screen writes nothing.
|
|
64
|
-
*/
|
|
65
|
-
export type Slot = {
|
|
66
|
-
/** What this site made, or what a write currently owns. */
|
|
67
|
-
node?: ChildSlot;
|
|
68
|
-
/** The last primitive written here, when the last thing written was one. */
|
|
69
|
-
text?: string | undefined;
|
|
70
|
-
/** The last value written to an attribute or a property. */
|
|
71
|
-
last?: unknown;
|
|
72
|
-
/** What the site made besides its node: parts, listeners, components. */
|
|
73
|
-
owner?: Owner;
|
|
74
|
-
/** The run that last reached this site. */
|
|
75
|
-
seen?: number;
|
|
76
|
-
/** A prop a run feeds a child, held so the child keeps its instance. */
|
|
77
|
-
cell?: Signal<unknown>;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Where a run keeps its sites.
|
|
65
|
+
* What only the runtime passes, and the compiler never does.
|
|
81
66
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
67
|
+
* Two hand-offs that exist for one caller each, grouped rather than added to
|
|
68
|
+
* the signature: `insert` is the compiler/runtime protocol, and its arity is
|
|
69
|
+
* part of that protocol (ARCHITECTURE section 1.1). Both paths that pass this
|
|
70
|
+
* happen once per part rather than once per row, so the object costs nothing
|
|
71
|
+
* anybody can measure.
|
|
87
72
|
*/
|
|
88
|
-
export type
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
|
|
73
|
+
export type InsertOptions = {
|
|
74
|
+
/**
|
|
75
|
+
* A region already claimed, handed down rather than looked up.
|
|
76
|
+
*
|
|
77
|
+
* How a part that turns out to produce another part gives the markup it
|
|
78
|
+
* claimed to the part that will actually own it — see the `function` branch
|
|
79
|
+
* in `run` below.
|
|
80
|
+
*/
|
|
81
|
+
seed?: Claimed | null;
|
|
82
|
+
/**
|
|
83
|
+
* Told what this part currently has in the document, after every run.
|
|
84
|
+
*
|
|
85
|
+
* A keyed list needs it: a row that is a view owns nodes that change without
|
|
86
|
+
* the list running, and a reorder has to move what the row has now rather
|
|
87
|
+
* than what it had when it was made.
|
|
88
|
+
*/
|
|
89
|
+
report?: Report;
|
|
99
90
|
};
|
|
100
|
-
/** Declared once per instance by the compiler, in the setup. */
|
|
101
|
-
export declare function store(name?: string): Store;
|
|
102
|
-
/** Notes that this run has actually changed something. */
|
|
103
|
-
export declare function wrote(store: Store): void;
|
|
104
|
-
/** The record for one site, made the first time a run reaches it. */
|
|
105
|
-
export declare function site(store: Store, index: number): Slot;
|
|
106
|
-
/**
|
|
107
|
-
* Opens a site: what it makes now belongs to the instance, not to this run.
|
|
108
|
-
*
|
|
109
|
-
* Returns the owner to restore, which the compiler hands back to `close`.
|
|
110
|
-
*/
|
|
111
|
-
export declare function open(store: Store, slot: Slot): Owner | null;
|
|
112
|
-
export declare function close(previous: Owner | null): void;
|
|
113
|
-
/**
|
|
114
|
-
* Ends a run, and disposes what it did not reach.
|
|
115
|
-
*
|
|
116
|
-
* A branch the run has left is gone, not hidden: its components run their
|
|
117
|
-
* cleanups and its parts stop, exactly as if the markup had never been there.
|
|
118
|
-
* Coming back builds it again. That is what the control flow says, so it is
|
|
119
|
-
* what happens.
|
|
120
|
-
*/
|
|
121
|
-
export declare function ran<T>(store: Store, value: T): T;
|
|
122
|
-
/**
|
|
123
|
-
* A prop whose value belongs to the run, as something the child can hold.
|
|
124
|
-
*
|
|
125
|
-
* The child keeps its instance across runs, so its props cannot be getters
|
|
126
|
-
* over the run that made them — that value belongs to one call. It gets a cell
|
|
127
|
-
* instead, made the first time and written afterwards, so a prop that did not
|
|
128
|
-
* change wakes nothing.
|
|
129
|
-
*/
|
|
130
|
-
export declare function cell(store: Store, index: number, value: unknown): Signal<unknown>;
|
|
131
|
-
/**
|
|
132
|
-
* Writes a child position a run owns.
|
|
133
|
-
*
|
|
134
|
-
* The same text twice is not a write: `data` would accept it, and measuring
|
|
135
|
-
* says that comparing a remembered string costs half what setting one does.
|
|
136
|
-
* Anything else goes through `applyChild`, where a node that has not moved is
|
|
137
|
-
* recognised and left where it is.
|
|
138
|
-
*/
|
|
139
|
-
export declare function writeChild(store: Store, index: number, parent: Node, marker: Node | null, value: unknown): void;
|
|
140
91
|
/**
|
|
141
92
|
* Binds a dynamic child position.
|
|
142
93
|
*
|
|
@@ -144,27 +95,17 @@ export declare function writeChild(store: Store, index: number, parent: Node, ma
|
|
|
144
95
|
* The thunk is evaluated once inside a tracking scope; if it read nothing
|
|
145
96
|
* reactive, no effect is retained (ADR-0009).
|
|
146
97
|
*/
|
|
147
|
-
export declare function insert(parent: Node, value: unknown, marker?: Node | null,
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
* The compiler never passes this. It is how a part that turns out to
|
|
152
|
-
* produce another part gives the markup it claimed to the part that will
|
|
153
|
-
* actually own it — see the `function` branch below.
|
|
154
|
-
*/
|
|
155
|
-
seed?: Claimed | null,
|
|
98
|
+
export declare function insert(parent: Node, value: unknown, marker?: Node | null, options?: InsertOptions): void;
|
|
99
|
+
/** Told what a part has in the document, when somebody needs to know. */
|
|
100
|
+
export type Report = (nodes: Node[]) => void;
|
|
156
101
|
/**
|
|
157
|
-
*
|
|
102
|
+
* Applies one value to a child slot and returns the slot's new contents.
|
|
158
103
|
*
|
|
159
|
-
* The
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
104
|
+
* The two branches that answer for almost every write are first and inline:
|
|
105
|
+
* nothing, and a primitive. Everything else is a shape that costs more than the
|
|
106
|
+
* call to reach it, so it lives in `applyOther` and this function stays small
|
|
107
|
+
* enough to read in one go.
|
|
163
108
|
*/
|
|
164
|
-
report?: Report): void;
|
|
165
|
-
/** Told what a part has in the document, when somebody needs to know. */
|
|
166
|
-
export type Report = (nodes: Node[]) => void;
|
|
167
|
-
/** Applies one value to a child slot and returns the slot's new contents. */
|
|
168
109
|
export declare function applyChild(parent: Node, marker: Node | null, current: ChildSlot, value: unknown): ChildSlot;
|
|
169
110
|
/**
|
|
170
111
|
* Binds parts whose anchors are now in the document.
|
|
@@ -173,33 +114,6 @@ export declare function applyChild(parent: Node, marker: Node | null, current: C
|
|
|
173
114
|
* disposal and error ownership lexical. A part created outside any scope —
|
|
174
115
|
* runtime JSX at module level, say — is bound under the scope doing the
|
|
175
116
|
* inserting, so that it is still disposed by something rather than by nothing.
|
|
176
|
-
*
|
|
177
|
-
* A part that is already mounted is left alone. A run hands back what it made
|
|
178
|
-
* rather than making it again, so the same part arrives here on every run of
|
|
179
|
-
* the run that owns it, and binding it twice would put a second copy of the
|
|
180
|
-
* whole child on the page beside the first.
|
|
181
117
|
*/
|
|
182
118
|
export declare function bindPart(child: DynamicChild, parent: Node, report?: Report): void;
|
|
183
|
-
/**
|
|
184
|
-
* Reconciles two node lists in place, by node identity.
|
|
185
|
-
*
|
|
186
|
-
* Keyed lists reuse their rows' DOM nodes across reorders, so identity is
|
|
187
|
-
* exactly the right key here: a row that survived is the same node, and only
|
|
188
|
-
* nodes that genuinely moved are touched.
|
|
189
|
-
*
|
|
190
|
-
* The algorithm is a common-prefix/suffix trim, then a longest-increasing-
|
|
191
|
-
* subsequence over the surviving nodes, moving only the ones outside it — the
|
|
192
|
-
* provably minimal number of `insertBefore` calls.
|
|
193
|
-
*
|
|
194
|
-
* This is the outcome of the comparison ADR-0010 required, not an assumption:
|
|
195
|
-
* three candidates were measured over ten operations at two sizes, with the
|
|
196
|
-
* order rotated per repetition and correctness asserted on every run. LIS came
|
|
197
|
-
* out ahead overall (1.02 against 1.17 for the two-ended scan and 1.49 for the
|
|
198
|
-
* naive baseline) and decisively where moves are few and far apart — a swap at
|
|
199
|
-
* 10 000 rows costs it 2 moves instead of 9 997. It loses one case: a full
|
|
200
|
-
* reverse, where the subsequence is length 1 and the analysis buys nothing.
|
|
201
|
-
* That trade is published in `benchmarks/results/reconcilers.json`.
|
|
202
|
-
*/
|
|
203
|
-
export declare function reconcile(parent: Node, marker: Node | null, a: Node[], b: Node[]): void;
|
|
204
|
-
export {};
|
|
205
119
|
//# sourceMappingURL=insert.d.ts.map
|
package/dist/insert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../src/insert.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../src/insert.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA2C,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrD,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvF,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiB5C;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAO9C;AAED,QAAA,MAAM,IAAI,EAAE,OAAO,MAAiC,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,MAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,MAAoC,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B,CAAC;AAgBF,oEAAoE;AACpE,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,OAAO,GAAG,YAAY,CAEvD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,OAAO,EACd,MAAM,GAAE,IAAI,GAAG,IAAW,EAC1B,OAAO,CAAC,EAAE,aAAa,GACtB,IAAI,CA4EN;AAED,yEAAyE;AACzE,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAgD7C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,IAAI,GAAG,IAAI,EACnB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,OAAO,GACb,SAAS,CAuBX;AAyED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAajF"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
export declare const PROTOCOL_VERSION = 1;
|
|
13
13
|
export { template, path } from './template.js';
|
|
14
14
|
export { first, next } from './claim.js';
|
|
15
|
-
export { insert, applyChild,
|
|
16
|
-
export
|
|
15
|
+
export { insert, applyChild, part } from './insert.js';
|
|
16
|
+
export { reconcile } from './reconcile.js';
|
|
17
|
+
export { store, site, open, close, ran, wrote, cell, writeChild } from './store.js';
|
|
18
|
+
export type { DynamicChild, ChildSlot } from './insert.js';
|
|
19
|
+
export type { Slot, Store } from './store.js';
|
|
17
20
|
export { setAttribute, setAttributeNS, setProperty, setBoolean, setClass, setClassList, setStyle, setStyleObject, } from './attributes.js';
|
|
18
21
|
export { on, off } from './events.js';
|
|
19
22
|
export { applyProp, spread, mergeProps, rest } from './props.js';
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpF,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/internal.dev.js
CHANGED
|
@@ -19,26 +19,21 @@ import {
|
|
|
19
19
|
setStyleObject,
|
|
20
20
|
spread,
|
|
21
21
|
view
|
|
22
|
-
} from "./dev-chunk-
|
|
22
|
+
} from "./dev-chunk-HLMVSIC4.js";
|
|
23
23
|
import {
|
|
24
24
|
applyChild,
|
|
25
|
-
|
|
26
|
-
close,
|
|
25
|
+
devHandedNewFunction,
|
|
27
26
|
devHydrationMismatch,
|
|
27
|
+
devRan,
|
|
28
28
|
first,
|
|
29
29
|
hydration,
|
|
30
30
|
insert,
|
|
31
|
+
isDynamicChild,
|
|
31
32
|
label,
|
|
32
33
|
next,
|
|
33
|
-
open,
|
|
34
34
|
part,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
site,
|
|
38
|
-
store,
|
|
39
|
-
writeChild,
|
|
40
|
-
wrote
|
|
41
|
-
} from "./dev-chunk-ADHDPKZW.js";
|
|
35
|
+
reconcile
|
|
36
|
+
} from "./dev-chunk-U46CIJCO.js";
|
|
42
37
|
|
|
43
38
|
// packages/dom/src/template.ts
|
|
44
39
|
function template(html, isFragment = false) {
|
|
@@ -74,6 +69,121 @@ function path(root, ...indices) {
|
|
|
74
69
|
return node;
|
|
75
70
|
}
|
|
76
71
|
|
|
72
|
+
// packages/dom/src/store.ts
|
|
73
|
+
import {
|
|
74
|
+
createOwner,
|
|
75
|
+
disposeOwner,
|
|
76
|
+
getOwner,
|
|
77
|
+
runWithOwner,
|
|
78
|
+
setOwner,
|
|
79
|
+
signal
|
|
80
|
+
} from "@firsthandjs/core";
|
|
81
|
+
function store(name = "") {
|
|
82
|
+
return { slots: [], owner: getOwner(), generation: 0, name };
|
|
83
|
+
}
|
|
84
|
+
function wrote(store2) {
|
|
85
|
+
store2.busy = true;
|
|
86
|
+
}
|
|
87
|
+
function site(store2, index) {
|
|
88
|
+
const existing = store2.slots[index];
|
|
89
|
+
if (existing !== void 0) {
|
|
90
|
+
existing.seen = store2.generation;
|
|
91
|
+
return existing;
|
|
92
|
+
}
|
|
93
|
+
const slot = { seen: store2.generation };
|
|
94
|
+
store2.slots[index] = slot;
|
|
95
|
+
return slot;
|
|
96
|
+
}
|
|
97
|
+
function open(store2, slot) {
|
|
98
|
+
const owner = createOwner(store2.owner);
|
|
99
|
+
slot.owner = owner;
|
|
100
|
+
return setOwner(owner);
|
|
101
|
+
}
|
|
102
|
+
function close(previous) {
|
|
103
|
+
setOwner(previous);
|
|
104
|
+
}
|
|
105
|
+
function ran(store2, value) {
|
|
106
|
+
devRan(store2);
|
|
107
|
+
const generation = store2.generation;
|
|
108
|
+
const slots = store2.slots;
|
|
109
|
+
for (let i = 0; i < slots.length; i++) {
|
|
110
|
+
const slot = slots[i];
|
|
111
|
+
if (slot === void 0 || slot.seen === generation) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (slot.owner !== void 0) {
|
|
115
|
+
disposeOwner(slot.owner);
|
|
116
|
+
}
|
|
117
|
+
slots[i] = void 0;
|
|
118
|
+
}
|
|
119
|
+
store2.generation = generation + 1;
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
function cell(store2, index, value) {
|
|
123
|
+
const slot = site(store2, index);
|
|
124
|
+
const existing = slot.cell;
|
|
125
|
+
if (existing === void 0) {
|
|
126
|
+
const made = signal(value);
|
|
127
|
+
slot.cell = made;
|
|
128
|
+
return made;
|
|
129
|
+
}
|
|
130
|
+
if (existing.peek() !== value) {
|
|
131
|
+
devHandedNewFunction(store2, value);
|
|
132
|
+
wrote(store2);
|
|
133
|
+
existing.value = value;
|
|
134
|
+
}
|
|
135
|
+
return existing;
|
|
136
|
+
}
|
|
137
|
+
function writeChild(store2, index, parent, marker, value) {
|
|
138
|
+
const slot = site(store2, index);
|
|
139
|
+
if (slot.node === void 0 && hydration.current !== null && adopt(slot, parent, marker, value)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const type = typeof value;
|
|
143
|
+
if (type === "string" || type === "number") {
|
|
144
|
+
const text = String(value);
|
|
145
|
+
if (text === slot.text) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
wrote(store2);
|
|
149
|
+
slot.text = text;
|
|
150
|
+
slot.node = applyChild(parent, marker, slot.node ?? null, text);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
slot.text = void 0;
|
|
154
|
+
if (value === slot.last) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
wrote(store2);
|
|
158
|
+
slot.last = value;
|
|
159
|
+
slot.node = applyChild(parent, marker, slot.node ?? null, value);
|
|
160
|
+
}
|
|
161
|
+
function adopt(slot, parent, marker, value) {
|
|
162
|
+
const claimed = hydration.current.claim(
|
|
163
|
+
parent,
|
|
164
|
+
marker
|
|
165
|
+
);
|
|
166
|
+
if (claimed === null) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
if (typeof value === "object" && value !== null && isDynamicChild(value)) {
|
|
170
|
+
slot.last = value;
|
|
171
|
+
hydration.current.keep(
|
|
172
|
+
slot,
|
|
173
|
+
parent,
|
|
174
|
+
value.anchor,
|
|
175
|
+
claimed
|
|
176
|
+
);
|
|
177
|
+
runWithOwner(value.owner, () => {
|
|
178
|
+
insert(parent, value.thunk, value.anchor);
|
|
179
|
+
});
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
slot.node = claimed.nodes;
|
|
183
|
+
slot.text = claimed.text;
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
|
|
77
187
|
// packages/dom/src/internal.ts
|
|
78
188
|
import { bind } from "@firsthandjs/core";
|
|
79
189
|
var PROTOCOL_VERSION = 1;
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as h,d as b,g as N,h as C,i as O,k as T,l as k,m as j,n as E,o as P,p as F,q as H,r as L,s as M,t as R,u as A,v as D,w as I,x as V,y as W}from"./chunk-MWEKNBIC.js";import{a as x,b as l,c as w,d as y,e as S,i as g,j as a,k as f,l as s}from"./chunk-467WEPXM.js";function q(e,i=!1){let r,n;return()=>{let o=l.current;if(o!==null){n??=o.tag(e);let t=o.adopt(n);if(t!==null)return t}if(r===void 0){let t=document.createElement("template");t.innerHTML=e,r=i?t.content:t.content.firstChild}return r.cloneNode(!0)}}function B(e,...i){let r=e;for(let n=0;n<i.length;n++){let o=r.firstChild;for(let t=i[n];t>0;t--)o=o.nextSibling;r=o}return r}import{createOwner as _,disposeOwner as z,getOwner as G,runWithOwner as J,setOwner as m,signal as K}from"@firsthandjs/core";function Q(e=""){return{slots:[],owner:G(),generation:0,name:e}}function d(e){e.busy=!0}function p(e,i){let r=e.slots[i];if(r!==void 0)return r.seen=e.generation,r;let n={seen:e.generation};return e.slots[i]=n,n}function U(e,i){let r=_(e.owner);return i.owner=r,m(r)}function X(e){m(e)}function Y(e,i){let r=e.generation,n=e.slots;for(let o=0;o<n.length;o++){let t=n[o];t===void 0||t.seen===r||(t.owner!==void 0&&z(t.owner),n[o]=void 0)}return e.generation=r+1,i}function Z(e,i,r){let n=p(e,i),o=n.cell;if(o===void 0){let t=K(r);return n.cell=t,t}return o.peek()!==r&&(d(e),o.value=r),o}function $(e,i,r,n,o){let t=p(e,i);if(t.node===void 0&&l.current!==null&&v(t,r,n,o))return;let c=typeof o;if(c==="string"||c==="number"){let u=String(o);if(u===t.text)return;d(e),t.text=u,t.node=s(r,n,t.node??null,u);return}t.text=void 0,o!==t.last&&(d(e),t.last=o,t.node=s(r,n,t.node??null,o))}function v(e,i,r,n){let o=l.current.claim(i,r);return o===null?!1:typeof n=="object"&&n!==null&&a(n)?(e.last=n,l.current.keep(e,i,n.anchor,o),J(n.owner,()=>{f(i,n.thunk,n.anchor)}),!0):(e.node=o.nodes,e.text=o.text,!1)}import{bind as Ne}from"@firsthandjs/core";var pe=1;export{h as COMPONENT,pe as PROTOCOL_VERSION,b as VIEW,s as applyChild,D as applyProp,Ne as bind,Z as cell,X as close,O as createComponent,w as first,f as insert,N as isComponent,x as label,T as list,V as mergeProps,y as next,j as off,k as on,U as open,g as part,B as path,Y as ran,S as reconcile,W as rest,E as setAttribute,P as setAttributeNS,H as setBoolean,L as setClass,M as setClassList,F as setProperty,R as setStyle,A as setStyleObject,p as site,I as spread,Q as store,q as template,C as view,$ as writeChild,d as wrote};
|
package/dist/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAmC3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,IAAI,EAAE,MAAM,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EAC1C,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,GACtE,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAmC3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,IAAI,EAAE,MAAM,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EAC1C,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,GACtE,MAAM,IAAI,EAAE,CAyDd"}
|
package/dist/nodes.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Putting nodes where they belong, and taking them away again.
|
|
3
|
+
*
|
|
4
|
+
* The four calls every child position eventually makes, with the measured
|
|
5
|
+
* reasons each one is shaped the way it is. Nothing here knows what a part is
|
|
6
|
+
* or what a run is: it is given a slot's current contents and a node, and it
|
|
7
|
+
* performs the mutation.
|
|
8
|
+
*/
|
|
9
|
+
/** What a child part currently owns in the DOM. */
|
|
10
|
+
export type ChildSlot = Node | Node[] | null;
|
|
11
|
+
export declare const TEXT_NODE = 3;
|
|
12
|
+
export declare function isNode(value: object): value is Node;
|
|
13
|
+
/**
|
|
14
|
+
* Removes a node from wherever it currently is.
|
|
15
|
+
*
|
|
16
|
+
* Usually that is `parent`, but a node can legitimately have been moved — an
|
|
17
|
+
* element host relocated in the document, for instance — and disposal must
|
|
18
|
+
* still clean up rather than throw.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detach(node: Node): void;
|
|
21
|
+
/**
|
|
22
|
+
* Empties a child slot that is everything its parent has.
|
|
23
|
+
*
|
|
24
|
+
* Removing ten thousand rows one at a time is ten thousand mutations, each one
|
|
25
|
+
* a chance for the engine to do bookkeeping it is about to throw away. When
|
|
26
|
+
* the slot *is* the parent's content — no marker after it, nothing beside it —
|
|
27
|
+
* the platform has one call that says so, and it is what clearing a table
|
|
28
|
+
* actually costs: `removeChild` was 85 % of that scenario before this.
|
|
29
|
+
*
|
|
30
|
+
* Falls back to removing them one by one whenever the slot is anything less
|
|
31
|
+
* than the whole, including when a node has been moved out from under it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function clearIn(parent: Node, marker: Node | null, current: ChildSlot): null;
|
|
34
|
+
export declare function clear(current: ChildSlot): null;
|
|
35
|
+
export declare function single(parent: Node, marker: Node | null, current: ChildSlot, node: Node): Node;
|
|
36
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;AAE7C,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,IAAI,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAKvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAWnF;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAW9C;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAW9F"}
|
package/dist/props.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA8B3E;AA+BD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAa5E;AAED,+CAA+C;AAC/C,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAM1E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazF;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two node lists, made the same in the fewest moves (ADR-0010).
|
|
3
|
+
*
|
|
4
|
+
* Its own module because it is its own algorithm and its own decision: which
|
|
5
|
+
* reconciler this is was settled by measurement, the comparison is published
|
|
6
|
+
* in `benchmarks/results/reconcilers.json`, and changing it means running that
|
|
7
|
+
* comparison again rather than reading the code around it.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Reconciles two node lists in place, by node identity.
|
|
11
|
+
*
|
|
12
|
+
* Keyed lists reuse their rows' DOM nodes across reorders, so identity is
|
|
13
|
+
* exactly the right key here: a row that survived is the same node, and only
|
|
14
|
+
* nodes that genuinely moved are touched.
|
|
15
|
+
*
|
|
16
|
+
* The algorithm is a common-prefix/suffix trim, then a longest-increasing-
|
|
17
|
+
* subsequence over the surviving nodes, moving only the ones outside it — the
|
|
18
|
+
* provably minimal number of `insertBefore` calls.
|
|
19
|
+
*
|
|
20
|
+
* This is the outcome of the comparison ADR-0010 required, not an assumption:
|
|
21
|
+
* three candidates were measured over ten operations at two sizes, with the
|
|
22
|
+
* order rotated per repetition and correctness asserted on every run. LIS came
|
|
23
|
+
* out ahead overall (1.02 against 1.17 for the two-ended scan and 1.49 for the
|
|
24
|
+
* naive baseline) and decisively where moves are few and far apart — a swap at
|
|
25
|
+
* 10 000 rows costs it 2 moves instead of 9 997. It loses one case: a full
|
|
26
|
+
* reverse, where the subsequence is length 1 and the analysis buys nothing.
|
|
27
|
+
* That trade is published in `benchmarks/results/reconcilers.json`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function reconcile(parent: Node, marker: Node | null, a: Node[], b: Node[]): void;
|
|
30
|
+
//# sourceMappingURL=reconcile.d.ts.map
|