@firsthandjs/dom 0.8.0 → 0.9.0
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/chunk-26MSEGYG.js +1 -0
- package/dist/chunk-NNHZJMZS.js +1 -0
- package/dist/chunk-TZRPGQ3R.js +1 -0
- package/dist/claim.d.ts +76 -0
- package/dist/claim.d.ts.map +1 -0
- package/dist/dev-chunk-5QV3XALZ.js +45 -0
- package/dist/{dev-chunk-2CKM3OGC.js → dev-chunk-HCAUM4JK.js} +61 -435
- package/dist/dev-chunk-HTXIHAW7.js +501 -0
- package/dist/dev.d.ts +11 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.prod.d.ts +1 -0
- package/dist/dev.prod.d.ts.map +1 -1
- package/dist/hydrate.d.ts +91 -0
- package/dist/hydrate.d.ts.map +1 -0
- package/dist/hydrate.dev.js +153 -0
- package/dist/hydrate.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.dev.js +19 -35
- package/dist/index.js +1 -1
- package/dist/insert.d.ts +28 -1
- package/dist/insert.d.ts.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.dev.js +30 -12
- package/dist/internal.js +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/props.d.ts.map +1 -1
- package/dist/render.d.ts +9 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/template.d.ts.map +1 -1
- package/package.json +7 -2
- package/dist/chunk-EWYTWH5D.js +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mount
|
|
3
|
+
} from "./dev-chunk-5QV3XALZ.js";
|
|
4
|
+
import {
|
|
5
|
+
hydration
|
|
6
|
+
} from "./dev-chunk-HTXIHAW7.js";
|
|
7
|
+
|
|
8
|
+
// packages/dom/src/hydrate.ts
|
|
9
|
+
var COMMENT_NODE = 8;
|
|
10
|
+
var TEXT_NODE = 3;
|
|
11
|
+
var OPEN = "[";
|
|
12
|
+
var claim = null;
|
|
13
|
+
var depth = 0;
|
|
14
|
+
var cursors = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
var openers = [];
|
|
16
|
+
var offers = /* @__PURE__ */ new Map();
|
|
17
|
+
function hydrate(view, container = document.body) {
|
|
18
|
+
return mount(view, container, (body) => {
|
|
19
|
+
hydrateWith(container, body);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function hydrateWith(container, body) {
|
|
23
|
+
const outer = claim;
|
|
24
|
+
const previous = depth;
|
|
25
|
+
depth++;
|
|
26
|
+
hydration.current = claimer;
|
|
27
|
+
claim = { node: container.firstChild, end: null };
|
|
28
|
+
try {
|
|
29
|
+
return body();
|
|
30
|
+
} finally {
|
|
31
|
+
claim = outer;
|
|
32
|
+
depth = previous;
|
|
33
|
+
if (depth === 0) {
|
|
34
|
+
hydration.current = null;
|
|
35
|
+
finish();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function finish() {
|
|
40
|
+
for (let i = 0; i < openers.length; i++) {
|
|
41
|
+
const node = openers[i];
|
|
42
|
+
node.parentNode?.removeChild(node);
|
|
43
|
+
}
|
|
44
|
+
openers = [];
|
|
45
|
+
cursors = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
offers = /* @__PURE__ */ new Map();
|
|
47
|
+
}
|
|
48
|
+
function adopt(tag) {
|
|
49
|
+
if (claim === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const node = claim.node;
|
|
53
|
+
if (node === null || node.nodeName !== tag) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const after = node.nextSibling;
|
|
57
|
+
claim.node = after === claim.end ? null : after;
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
function claimRegion(parent, marker) {
|
|
61
|
+
if (marker !== null) {
|
|
62
|
+
const offered = offers.get(marker);
|
|
63
|
+
if (offered !== void 0) {
|
|
64
|
+
offers.delete(marker);
|
|
65
|
+
return offered;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const held = cursors.get(parent);
|
|
69
|
+
const fromTheTop = held === void 0;
|
|
70
|
+
const node = fromTheTop ? parent.firstChild : held;
|
|
71
|
+
let start;
|
|
72
|
+
let end;
|
|
73
|
+
const stop = fromTheTop ? marker : null;
|
|
74
|
+
let open = node;
|
|
75
|
+
while (open !== null && open !== stop && !isOpen(open)) {
|
|
76
|
+
open = open.nextSibling;
|
|
77
|
+
}
|
|
78
|
+
if (open !== null && open !== stop) {
|
|
79
|
+
end = closeOf(open);
|
|
80
|
+
if (marker !== null && marker !== end) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
openers.push(open);
|
|
84
|
+
start = open.nextSibling;
|
|
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;
|
|
94
|
+
}
|
|
95
|
+
const nodes = [];
|
|
96
|
+
for (let one = start; one !== null && one !== end; one = one.nextSibling) {
|
|
97
|
+
nodes.push(one);
|
|
98
|
+
}
|
|
99
|
+
const only = nodes.length === 1 ? nodes[0] : null;
|
|
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
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function within(region, body) {
|
|
107
|
+
const outer = claim;
|
|
108
|
+
claim = region;
|
|
109
|
+
try {
|
|
110
|
+
return body();
|
|
111
|
+
} finally {
|
|
112
|
+
claim = outer;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function isOpen(node) {
|
|
116
|
+
return node !== null && node.nodeType === COMMENT_NODE && node.nodeValue === OPEN;
|
|
117
|
+
}
|
|
118
|
+
function closeOf(open) {
|
|
119
|
+
let level = 0;
|
|
120
|
+
for (let node = open.nextSibling; node !== null; node = node.nextSibling) {
|
|
121
|
+
if (node.nodeType !== COMMENT_NODE) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (isOpen(node)) {
|
|
125
|
+
level++;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (level === 0) {
|
|
129
|
+
return node;
|
|
130
|
+
}
|
|
131
|
+
level--;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
function step(node) {
|
|
136
|
+
return isOpen(node) ? closeOf(node) : node;
|
|
137
|
+
}
|
|
138
|
+
function tagOf(html) {
|
|
139
|
+
return html.slice(1, html.search(/[\s/>]/)).toUpperCase();
|
|
140
|
+
}
|
|
141
|
+
function keep(slot, parent, anchor, claimed) {
|
|
142
|
+
parent.insertBefore(anchor, claimed.region.end);
|
|
143
|
+
slot.node = claimed.nodes === null ? anchor : [...Array.isArray(claimed.nodes) ? claimed.nodes : [claimed.nodes], anchor];
|
|
144
|
+
offers.set(anchor, claimed);
|
|
145
|
+
}
|
|
146
|
+
var claimer = { tag: tagOf, adopt, claim: claimRegion, within, keep, step };
|
|
147
|
+
export {
|
|
148
|
+
adopt,
|
|
149
|
+
claimRegion,
|
|
150
|
+
hydrate,
|
|
151
|
+
hydrateWith,
|
|
152
|
+
within
|
|
153
|
+
};
|
package/dist/hydrate.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as x}from"./chunk-26MSEGYG.js";import{b as a}from"./chunk-NNHZJMZS.js";var m=8,C=3,w="[",i=null,p=0,g=new WeakMap,c=[],N=new Map;function F(e,n=document.body){return x(e,n,l=>{M(n,l)})}function M(e,n){let l=i,o=p;p++,a.current=V,i={node:e.firstChild,end:null};try{return n()}finally{i=l,p=o,p===0&&(a.current=null,O())}}function O(){for(let e=0;e<c.length;e++){let n=c[e];n.parentNode?.removeChild(n)}c=[],g=new WeakMap,N=new Map}function S(e){if(i===null)return null;let n=i.node;if(n===null||n.nodeName!==e)return null;let l=n.nextSibling;return i.node=l===i.end?null:l,n}function v(e,n){if(n!==null){let r=N.get(n);if(r!==void 0)return N.delete(n),r}let l=g.get(e),o=l===void 0,h=o?e.firstChild:l,d,u,T=o?n:null,t=h;for(;t!==null&&t!==T&&!y(t);)t=t.nextSibling;if(t!==null&&t!==T){if(u=b(t),n!==null&&n!==u)return null;c.push(t),d=t.nextSibling}else if(o)d=h,u=n;else return null;g.set(e,u===null?null:u.nextSibling),d===u&&(d=null);let s=[];for(let r=d;r!==null&&r!==u;r=r.nextSibling)s.push(r);let f=s.length===1?s[0]:null;return{nodes:s.length===0?null:f??s,text:f!==null&&f.nodeType===C?f.data:void 0,region:{node:d,end:u}}}function E(e,n){let l=i;i=e;try{return n()}finally{i=l}}function y(e){return e!==null&&e.nodeType===m&&e.nodeValue===w}function b(e){let n=0;for(let l=e.nextSibling;l!==null;l=l.nextSibling)if(l.nodeType===m){if(y(l)){n++;continue}if(n===0)return l;n--}return null}function D(e){return y(e)?b(e):e}function R(e){return e.slice(1,e.search(/[\s/>]/)).toUpperCase()}function W(e,n,l,o){n.insertBefore(l,o.region.end),e.node=o.nodes===null?l:[...Array.isArray(o.nodes)?o.nodes:[o.nodes],l],N.set(l,o)}var V={tag:R,adopt:S,claim:v,within:E,keep:W,step:D};export{S as adopt,v as claimRegion,F as hydrate,M as hydrateWith,E as within};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the reactive core so that applications have one import site.
|
|
5
5
|
*/
|
|
6
|
-
export { component, defineElement, setElementPrefix, createComponent } from './component.js';
|
|
6
|
+
export { component, defineElement, setElementPrefix, createComponent, view } from './component.js';
|
|
7
7
|
export { setComponentAdapter, FirsthandComponentError } from './adapter.js';
|
|
8
8
|
export type { ComponentAdapter } from './adapter.js';
|
|
9
9
|
export type { Component, ComponentOptions, AttributeCodec, View, Render } from './component.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,MAAM,gBAAgB,CAAC;
|
|
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,cAAc,CAAC;AAC5E,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
|
@@ -1,47 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FirsthandComponentError,
|
|
3
|
-
applyChild,
|
|
4
3
|
component,
|
|
5
4
|
createComponent,
|
|
6
5
|
defineElement,
|
|
7
|
-
insert,
|
|
8
6
|
list,
|
|
9
7
|
mergeProps,
|
|
10
8
|
off,
|
|
11
9
|
on,
|
|
12
10
|
setComponentAdapter,
|
|
13
|
-
setElementPrefix
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
createRoot((stop) => {
|
|
21
|
-
dispose = stop;
|
|
22
|
-
const result = untrack(view);
|
|
23
|
-
if (typeof result === "function") {
|
|
24
|
-
insert(container, result);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let slot = null;
|
|
28
|
-
slot = applyChild(container, null, null, result);
|
|
29
|
-
onCleanup(() => {
|
|
30
|
-
applyChild(container, null, slot, null);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
return dispose;
|
|
34
|
-
}
|
|
11
|
+
setElementPrefix,
|
|
12
|
+
view
|
|
13
|
+
} from "./dev-chunk-HCAUM4JK.js";
|
|
14
|
+
import {
|
|
15
|
+
render
|
|
16
|
+
} from "./dev-chunk-5QV3XALZ.js";
|
|
17
|
+
import "./dev-chunk-HTXIHAW7.js";
|
|
35
18
|
|
|
36
19
|
// packages/dom/src/portal.ts
|
|
37
|
-
import { onCleanup
|
|
38
|
-
function portal(
|
|
20
|
+
import { onCleanup } from "@firsthandjs/core";
|
|
21
|
+
function portal(view2, target) {
|
|
39
22
|
const nodes = [];
|
|
40
|
-
collectNodes(
|
|
23
|
+
collectNodes(view2, nodes);
|
|
41
24
|
for (let i = 0; i < nodes.length; i++) {
|
|
42
25
|
target.appendChild(nodes[i]);
|
|
43
26
|
}
|
|
44
|
-
|
|
27
|
+
onCleanup(() => {
|
|
45
28
|
for (let i = 0; i < nodes.length; i++) {
|
|
46
29
|
const node = nodes[i];
|
|
47
30
|
node.parentNode?.removeChild(node);
|
|
@@ -72,9 +55,9 @@ import {
|
|
|
72
55
|
computed,
|
|
73
56
|
effect,
|
|
74
57
|
batch,
|
|
75
|
-
untrack
|
|
76
|
-
onCleanup as
|
|
77
|
-
createRoot
|
|
58
|
+
untrack,
|
|
59
|
+
onCleanup as onCleanup2,
|
|
60
|
+
createRoot,
|
|
78
61
|
catchError,
|
|
79
62
|
runWithOwner,
|
|
80
63
|
createContext,
|
|
@@ -95,14 +78,14 @@ export {
|
|
|
95
78
|
computed,
|
|
96
79
|
createComponent,
|
|
97
80
|
createContext,
|
|
98
|
-
|
|
81
|
+
createRoot,
|
|
99
82
|
defineElement,
|
|
100
83
|
effect,
|
|
101
84
|
list,
|
|
102
85
|
mergeProps,
|
|
103
86
|
off,
|
|
104
87
|
on,
|
|
105
|
-
|
|
88
|
+
onCleanup2 as onCleanup,
|
|
106
89
|
portal,
|
|
107
90
|
provide,
|
|
108
91
|
render,
|
|
@@ -110,6 +93,7 @@ export {
|
|
|
110
93
|
setComponentAdapter,
|
|
111
94
|
setElementPrefix,
|
|
112
95
|
signal,
|
|
113
|
-
|
|
114
|
-
useContext
|
|
96
|
+
untrack,
|
|
97
|
+
useContext,
|
|
98
|
+
view
|
|
115
99
|
};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as d,b as i,e as f,f as s,h as a,i as m,j as l,k as x,l as C,m as h,x as y}from"./chunk-TZRPGQ3R.js";import{a as c}from"./chunk-26MSEGYG.js";import"./chunk-NNHZJMZS.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 D,computed as S,effect as T,batch as V,untrack as W,onCleanup as q,createRoot as z,catchError as B,runWithOwner as G,createContext as H,provide as I,useContext as J,FirsthandContextError as K,FirsthandCycleError as L,FirsthandReadonlyError as M}from"@firsthandjs/core";export{i as FirsthandComponentError,K as FirsthandContextError,L as FirsthandCycleError,M as FirsthandReadonlyError,V as batch,B as catchError,s as component,S as computed,m as createComponent,H as createContext,z as createRoot,l as defineElement,T as effect,x as list,y as mergeProps,h as off,C as on,q as onCleanup,N as portal,I as provide,c as render,G as runWithOwner,d as setComponentAdapter,f as setElementPrefix,D as signal,W as untrack,J as useContext,a as view};
|
package/dist/insert.d.ts
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { type Owner, type Signal } from '@firsthandjs/core';
|
|
2
|
+
import { type Claimed } from './claim.js';
|
|
2
3
|
/** What a child part currently owns in the DOM. */
|
|
3
4
|
export type ChildSlot = Node | Node[] | null;
|
|
5
|
+
/**
|
|
6
|
+
* Runs `body` with the parts inside it excused from removing their nodes.
|
|
7
|
+
*
|
|
8
|
+
* The caller is promising that the nodes those parts wrote into are about to
|
|
9
|
+
* be removed wholesale. `list` is the only caller, and `reconcile` is the
|
|
10
|
+
* promise it is keeping.
|
|
11
|
+
*/
|
|
12
|
+
export declare function discard(body: () => void): void;
|
|
4
13
|
declare const PART: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* Marks an array as nodes, in order, with nothing to unpack.
|
|
16
|
+
*
|
|
17
|
+
* `applyChild` accepts arrays of anything — nested arrays, thunks, strings,
|
|
18
|
+
* dynamic children — so it walks what it is given and builds a flat list of
|
|
19
|
+
* nodes out of it. A keyed list has already done that walk: it has the nodes,
|
|
20
|
+
* it made the array, and nobody else can reach it. Walking it again is one
|
|
21
|
+
* allocation and ten thousand steps for a list of ten thousand rows.
|
|
22
|
+
*/
|
|
23
|
+
export declare const FLAT: unique symbol;
|
|
5
24
|
/**
|
|
6
25
|
* A dynamic child inside an array, carrying the scope it was written in.
|
|
7
26
|
*
|
|
@@ -114,7 +133,15 @@ export declare function writeChild(store: Store, index: number, parent: Node, ma
|
|
|
114
133
|
* The thunk is evaluated once inside a tracking scope; if it read nothing
|
|
115
134
|
* reactive, no effect is retained (ADR-0009).
|
|
116
135
|
*/
|
|
117
|
-
export declare function insert(parent: Node, value: unknown, marker?: Node | null
|
|
136
|
+
export declare function insert(parent: Node, value: unknown, marker?: Node | null,
|
|
137
|
+
/**
|
|
138
|
+
* A region already claimed, handed down rather than looked up.
|
|
139
|
+
*
|
|
140
|
+
* The compiler never passes this. It is how a part that turns out to
|
|
141
|
+
* produce another part gives the markup it claimed to the part that will
|
|
142
|
+
* actually own it — see the `function` branch below.
|
|
143
|
+
*/
|
|
144
|
+
seed?: Claimed | null): void;
|
|
118
145
|
/** Applies one value to a child slot and returns the slot's new contents. */
|
|
119
146
|
export declare function applyChild(parent: Node, marker: Node | null, current: ChildSlot, value: unknown): ChildSlot;
|
|
120
147
|
/**
|
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,EASL,KAAK,KAAK,EACV,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../src/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,KAAK,EACV,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAErD,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;AAiB7C;;;;;;GAMG;AAC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GAAG,IAAI,EACnB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,OAAO,GACb,SAAS,CA+EX;AA4FD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAqEvF"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const PROTOCOL_VERSION = 1;
|
|
13
13
|
export { template, path } from './template.js';
|
|
14
|
+
export { first, next } from './claim.js';
|
|
14
15
|
export { insert, applyChild, reconcile, part, store, site, open, close, ran, wrote, cell, writeChild, } from './insert.js';
|
|
15
16
|
export type { DynamicChild, ChildSlot, Slot, Store } from './insert.js';
|
|
16
17
|
export { setAttribute, setAttributeNS, setProperty, setBoolean, setClass, setClassList, setStyle, setStyleObject, } from './attributes.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,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,GAAG,EACH,KAAK,EACL,IAAI,EACJ,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,E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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
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMPONENT,
|
|
3
3
|
VIEW,
|
|
4
|
-
applyChild,
|
|
5
4
|
applyProp,
|
|
6
|
-
cell,
|
|
7
|
-
close,
|
|
8
5
|
createComponent,
|
|
9
|
-
insert,
|
|
10
6
|
isComponent,
|
|
11
|
-
label,
|
|
12
7
|
list,
|
|
13
8
|
mergeProps,
|
|
14
9
|
off,
|
|
15
10
|
on,
|
|
16
|
-
open,
|
|
17
|
-
part,
|
|
18
|
-
ran,
|
|
19
|
-
reconcile,
|
|
20
11
|
rest,
|
|
21
12
|
setAttribute,
|
|
22
13
|
setAttributeNS,
|
|
@@ -26,18 +17,43 @@ import {
|
|
|
26
17
|
setProperty,
|
|
27
18
|
setStyle,
|
|
28
19
|
setStyleObject,
|
|
29
|
-
site,
|
|
30
20
|
spread,
|
|
21
|
+
view
|
|
22
|
+
} from "./dev-chunk-HCAUM4JK.js";
|
|
23
|
+
import {
|
|
24
|
+
applyChild,
|
|
25
|
+
cell,
|
|
26
|
+
close,
|
|
27
|
+
devHydrationMismatch,
|
|
28
|
+
first,
|
|
29
|
+
hydration,
|
|
30
|
+
insert,
|
|
31
|
+
label,
|
|
32
|
+
next,
|
|
33
|
+
open,
|
|
34
|
+
part,
|
|
35
|
+
ran,
|
|
36
|
+
reconcile,
|
|
37
|
+
site,
|
|
31
38
|
store,
|
|
32
|
-
view,
|
|
33
39
|
writeChild,
|
|
34
40
|
wrote
|
|
35
|
-
} from "./dev-chunk-
|
|
41
|
+
} from "./dev-chunk-HTXIHAW7.js";
|
|
36
42
|
|
|
37
43
|
// packages/dom/src/template.ts
|
|
38
44
|
function template(html, isFragment = false) {
|
|
39
45
|
let source;
|
|
46
|
+
let expected;
|
|
40
47
|
return () => {
|
|
48
|
+
const claimer = hydration.current;
|
|
49
|
+
if (claimer !== null) {
|
|
50
|
+
expected ??= claimer.tag(html);
|
|
51
|
+
const claimed = claimer.adopt(expected);
|
|
52
|
+
if (claimed !== null) {
|
|
53
|
+
devHydrationMismatch(claimed, html);
|
|
54
|
+
return claimed;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
41
57
|
if (source === void 0) {
|
|
42
58
|
const element = document.createElement("template");
|
|
43
59
|
element.innerHTML = html;
|
|
@@ -71,11 +87,13 @@ export {
|
|
|
71
87
|
cell,
|
|
72
88
|
close,
|
|
73
89
|
createComponent,
|
|
90
|
+
first,
|
|
74
91
|
insert,
|
|
75
92
|
isComponent,
|
|
76
93
|
label,
|
|
77
94
|
list,
|
|
78
95
|
mergeProps,
|
|
96
|
+
next,
|
|
79
97
|
off,
|
|
80
98
|
on,
|
|
81
99
|
open,
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as O,d as g,g as E,h as P,i as T,k as w,l as L,m as M,n as j,o as v,p as A,q as F,r as H,s as I,t as R,u as V,v as B,w as D,x as W,y as _}from"./chunk-TZRPGQ3R.js";import{a as p,b as i,c as s,d as a,g as d,h as m,i as f,j as c,k as u,l as x,m as y,n as C,o as N,p as h,q as b,r as S}from"./chunk-NNHZJMZS.js";function k(n,l=!1){let t,o;return()=>{let r=i.current;if(r!==null){o??=r.tag(n);let e=r.adopt(o);if(e!==null)return e}if(t===void 0){let e=document.createElement("template");e.innerHTML=n,t=l?e.content:e.content.firstChild}return t.cloneNode(!0)}}function q(n,...l){let t=n;for(let o=0;o<l.length;o++){let r=t.firstChild;for(let e=l[o];e>0;e--)r=r.nextSibling;t=r}return t}import{bind as oe}from"@firsthandjs/core";var Q=1;export{O as COMPONENT,Q as PROTOCOL_VERSION,g as VIEW,b as applyChild,B as applyProp,oe as bind,C as cell,x as close,T as createComponent,s as first,h as insert,E as isComponent,p as label,w as list,W as mergeProps,a as next,M as off,L as on,u as open,d as part,q as path,y as ran,S as reconcile,_ as rest,j as setAttribute,v as setAttributeNS,F as setBoolean,H as setClass,I as setClassList,A as setProperty,R as setStyle,V as setStyleObject,c as site,D as spread,m as store,k as template,P as view,N as writeChild,f 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;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAW3B;;;;;;;;;;;;;;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/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,CA8C3E;AAED;;;;;;;;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"}
|
package/dist/render.d.ts
CHANGED
|
@@ -10,4 +10,13 @@ import type { View } from './component.js';
|
|
|
10
10
|
* children.
|
|
11
11
|
*/
|
|
12
12
|
export declare function render(view: () => View, container?: ParentNode): Dispose;
|
|
13
|
+
/**
|
|
14
|
+
* The whole of mounting, with one hole in it.
|
|
15
|
+
*
|
|
16
|
+
* `around` is how `@firsthandjs/dom/hydrate` gets in: it wraps the run so that
|
|
17
|
+
* what the view builds is adopted rather than created. `render` passes
|
|
18
|
+
* nothing, which is why a build without a server contains neither the wrapper
|
|
19
|
+
* nor anything it would have called.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mount(view: () => View, container: ParentNode, around: ((body: () => void) => void) | null): Dispose;
|
|
13
22
|
//# sourceMappingURL=render.d.ts.map
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,SAAS,GAAE,UAA0B,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,SAAS,GAAE,UAA0B,GAAG,OAAO,CAEvF;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,IAAI,EAChB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC,GAAG,IAAI,GAC1C,OAAO,CAcT"}
|
package/dist/template.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC;AAEzC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,eAAe,CA+B1E;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAUpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firsthandjs/dom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "DOM parts, templates, components, portals and keyed lists for Firsthand.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"development": "./dist/index.dev.js",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./hydrate": {
|
|
15
|
+
"types": "./dist/hydrate.d.ts",
|
|
16
|
+
"development": "./dist/hydrate.dev.js",
|
|
17
|
+
"default": "./dist/hydrate.js"
|
|
18
|
+
},
|
|
14
19
|
"./internal": {
|
|
15
20
|
"types": "./dist/internal.d.ts",
|
|
16
21
|
"development": "./dist/internal.dev.js",
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
"LICENSE"
|
|
26
31
|
],
|
|
27
32
|
"dependencies": {
|
|
28
|
-
"@firsthandjs/core": "0.
|
|
33
|
+
"@firsthandjs/core": "0.9.0"
|
|
29
34
|
},
|
|
30
35
|
"engines": {
|
|
31
36
|
"node": ">=20.11.0"
|
package/dist/chunk-EWYTWH5D.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var C=null,S=new WeakMap;function Vn(n){C=n,S=new WeakMap}var E=class extends Error{constructor(t){super(`${t} is not a Firsthand component. If it is a React component, import '@firsthandjs/react/auto' once at startup to render React components directly, or wrap it with fromReact(). Otherwise, declare it with component().`),this.name="FirsthandComponentError"}};function j(n){let t=S.get(n);if(t!==void 0)return t;if(C===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new E(o)}let e=C(n);return S.set(n,e),e}function qn(n,t,e){return n}import{bind as pn,createOwner as mn,signal as wn,disposeOwner as gn,getOwner as v,onCleanup as yn,runWithOwner as hn,setOwner as _}from"@firsthandjs/core";var bn=3;function W(n){return typeof n.nodeType=="number"}var D=Symbol("firsthand.part");function M(n){return{[D]:!0,anchor:document.createTextNode(""),thunk:n,owner:v()}}function I(n){return D in n}function Xn(n=""){return{slots:[],owner:v(),generation:0,name:n}}function R(n){n.busy=!0}function V(n,t){let e=n.slots[t];if(e!==void 0)return e.seen=n.generation,e;let o={seen:n.generation};return n.slots[t]=o,o}function Jn(n,t){let e=mn(n.owner);return t.owner=e,_(e)}function Qn(n){_(n)}function Un(n,t){let e=n.generation,o=n.slots;for(let r=0;r<o.length;r++){let i=o[r];i===void 0||i.seen===e||(i.owner!==void 0&&gn(i.owner),o[r]=void 0)}return n.generation=e+1,t}function ne(n,t,e){let o=V(n,t),r=o.cell;if(r===void 0){let i=wn(e);return o.cell=i,i}return r.peek()!==e&&(R(n),r.value=e),r}function ee(n,t,e,o,r){let i=V(n,t),s=typeof r;if(s==="string"||s==="number"){let l=String(r);if(l===i.text)return;R(n),i.text=l,i.node=p(e,o,i.node??null,l);return}i.text=void 0,r!==i.last&&(R(n),i.last=r,i.node=p(e,o,i.node??null,r))}function F(n,t,e=null){if(typeof t!="function"){p(n,e,null,t);return}let o=null,r;pn(()=>{let i=t(),s=typeof i;if(s==="string"||s==="number"){let l=String(i);l!==r&&(r=l,o=p(n,e,o,l));return}if(r=void 0,s==="function"){o=g(o),F(n,i,e);return}o=p(n,e,o,i)}),yn(()=>{o=g(o)})}function p(n,t,e,o){let r=typeof o;if(o==null||r==="boolean")return g(e);if(r==="string"||r==="number"){let i=String(o);return e!==null&&!Array.isArray(e)&&e.nodeType===bn?(e.data=i,e):L(n,t,e,document.createTextNode(i))}if(r==="function")return p(n,t,e,o());if(Array.isArray(o)){let i=[],s=[];if(q(o,i,s),i.length===0)return g(e);kn(n,t,e===null?[]:Array.isArray(e)?e:[e],i);for(let l=0;l<s.length;l++){let d=s[l];hn(d.owner??v(),()=>{F(n,d.thunk,d.anchor)})}return i}return I(o)?p(n,t,e,[o]):W(o)?L(n,t,e,o):p(n,t,e,String(o))}function q(n,t,e){for(let o=0;o<n.length;o++){let r=n[o];if(typeof r=="object"&&r!==null&&I(r)){t.push(r.anchor),e.push(r);continue}for(;typeof r=="function";)r=r();r==null||typeof r=="boolean"||(Array.isArray(r)?q(r,t,e):typeof r=="object"&&W(r)?t.push(r):t.push(document.createTextNode(String(r))))}}function H(n){let t=n.parentNode;t!==null&&t.removeChild(n)}function g(n){if(n!==null)if(Array.isArray(n))for(let t=0;t<n.length;t++)H(n[t]);else H(n);return null}function L(n,t,e,o){return e===o?o:e!==null&&!Array.isArray(e)?(n.replaceChild(o,e),o):(g(e),n.insertBefore(o,t),o)}function kn(n,t,e,o){let r=0,i=0,s=e.length-1,l=o.length-1;for(;r<=s&&i<=l&&e[r]===o[i];)r++,i++;for(;r<=s&&i<=l&&e[s]===o[l];)s--,l--;let d=l+1<o.length?o[l+1]:t;if(r>s){for(let u=i;u<=l;u++)n.insertBefore(o[u],d);return}if(i>l){for(let u=r;u<=s;u++)n.removeChild(e[u]);return}let c=new Map;for(let u=r;u<=s;u++)c.set(e[u],u);let a=l-i+1,f=new Int32Array(a).fill(-1);for(let u=0;u<a;u++){let w=o[i+u],$=c.get(w);$!==void 0&&(f[u]=$,c.delete(w))}for(let u of c.keys())n.removeChild(u);let m=xn(f),x=m.length-1,T=d;for(let u=a-1;u>=0;u--){let w=o[i+u];x>=0&&m[x]===u?x--:n.insertBefore(w,T),T=w}}function xn(n){let t=n.length,e=new Int32Array(t).fill(-1),o=[];for(let s=0;s<t;s++){let l=n[s];if(l===-1)continue;let d=0,c=o.length;for(;d<c;){let a=d+c>>1;n[o[a]]<l?d=a+1:c=a}d>0&&(e[s]=o[d-1]),o[d]=s}let r=[],i=o.length>0?o[o.length-1]:-1;for(;i!==-1;)r.push(i),i=e[i];return r.reverse()}import{signal as Cn,createOwner as z,devEnterSetup as B,devExitSetup as h,disposeOwner as Sn,getOwner as K,handleError as Z,setOwner as y,untrack as Y}from"@firsthandjs/core";var G=Symbol.for("firsthand.component"),X=Symbol.for("firsthand.view"),En=0,J="firsthand";function ue(n){J=n}function ce(n,t,e,o){let i=Object.assign(s=>Rn(i,s),{[G]:!0,setup:n,options:t,id:e??`c${String(++En)}`,tag:void 0});return Object.defineProperty(i,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),e===void 0&&(`${i.name}`,void 0),(t?.tag!==void 0||t?.shadow===!0)&&Nn(i,typeof t.tag=="string"?t.tag:void 0),i}function ae(n){return typeof n=="function"&&G in n}function fe(n){return n[X]=!0,n}function Rn(n,t){if(Object.freeze(t),n.setup===void 0)return X in n?M(()=>n(t)):j(n)(t);if(n.tag!==void 0)return An(n,t);let e=z(K());n.name;let o=y(e);try{B(n.id);let r=Y(()=>n.setup(t));return h(),y(o),r}catch(r){return h(),y(o),Z(r,e),null}}function vn(n){let t=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${J}-${t}`}function Nn(n,t){let e=n;if(e.tag!==void 0)return e.tag;let o=t??vn(e);return customElements.get(o)!==void 0&&(o=`${o}-${e.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),e.tag=o,customElements.define(o,On(e)),o}function On(n){let t=n.options?.shadow===!0,e=n.options?.attributes,o=e!==void 0?Object.keys(e):[];return class extends HTMLElement{static observedAttributes=o;constructor(){super(),this.$owner=null,this.$props=null,this.$attrs=null,this.$standalone=!1}connectedCallback(){this.$owner===null&&(this.$standalone=!0,this.$attrs={},this.$props=Pn(this,e,this.$attrs),Q(this,n,t))}disconnectedCallback(){!this.$standalone||this.$owner===null||(Sn(this.$owner),this.$owner=null)}attributeChangedCallback(i,s,l){let d=this.$attrs?.[i];d!==void 0&&(d.value=e[i]?.(l))}}}function Pn(n,t,e){let o={};if(t!==void 0)for(let r in t){let i=Cn(t[r](n.getAttribute(r)));e[r]=i,Object.defineProperty(o,r,{enumerable:!0,get:()=>i.value})}return Object.freeze(o)}function Q(n,t,e){let o=z(K());t.name,n.$owner=o;let r=y(o);try{B(t.id);let i=e?n.attachShadow({mode:"open"}):n,s=Y(()=>t.setup(n.$props));h(),p(i,null,null,s)}catch(i){h(),Z(i,o)}finally{y(r)}}function An(n,t){let e=document.createElement(n.tag);return e.$props=t,Q(e,n,n.options?.shadow===!0),e}import{batch as Tn,createOwner as nn,disposeOwner as $n,getOwner as jn,setOwner as N,signal as U,untrack as en}from"@firsthandjs/core";function he(n,t,e){let o=nn(jn()),r=new Map;return()=>{let i=n(),s=new Map,l=[];return Tn(()=>{for(let d=0;d<i.length;d++){let c=i[d],a=en(()=>t(c,d));if(s.has(a)){`${String(a)}`;continue}let f=r.get(a);f===void 0?f=Hn(o,c,d,e):(r.delete(a),f.item.value=c,f.index.value=d),s.set(a,f);for(let m=0;m<f.nodes.length;m++)l.push(f.nodes[m])}for(let d of r.values())$n(d.owner)}),r=s,l}}function Hn(n,t,e,o){let r=nn(n),i=U(t),s=U(e),l=N(r),d;try{d=en(()=>o(i,s)),N(l)}catch(a){throw N(l),a}let c=[];return tn(d,c),{owner:r,item:i,index:s,nodes:c}}function tn(n,t){if(!(n==null||typeof n=="boolean")){if(Array.isArray(n)){for(let e=0;e<n.length;e++)tn(n[e],t);return}if(typeof n=="object"&&typeof n.nodeType=="number"){t.push(n);return}t.push(document.createTextNode(String(n)))}}var Ln=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),on=new Set;function b(n){return`$firsthand$${n}`}function _n(n){let t=b(n.type),e=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<e.length;r++){let i=e[r],s=i[t];if(s!==void 0&&(o=i,s.call(i,n),n.cancelBubble)||i===document)break}o=null}function k(n,t,e,o){if(o!==void 0||!Ln.has(t)){let r=n,i=o===!0?void 0:o,s=`${b(t)}$${i===void 0?"":Object.keys(i).sort().join(",")}`,l=r[s];l!==void 0&&n.removeEventListener(t,l.handler,l.options),r[s]={handler:e,options:i},n.addEventListener(t,e,i);return}n[b(t)]=e,on.has(t)||(on.add(t),document.addEventListener(t,_n))}function ke(n,t){n[b(t)]=void 0}var Wn={class:"className",for:"htmlFor"};function P(n,t,e){e==null||e===!1?n.removeAttribute(t):n.setAttribute(t,e===!0?"":String(e))}function Se(n,t,e,o){o==null||o===!1?n.removeAttributeNS(t,e):n.setAttributeNS(t,e,o===!0?"":String(o))}function A(n,t,e){n[Wn[t]??t]=e}function Ee(n,t,e){n[t]=!!e}function sn(n,t){t==null?n.removeAttribute("class"):n.className=String(t)}function ln(n,t,e){let o=n.classList;if(e!==void 0)for(let r in e)r in t||o.remove(r);for(let r in t){let i=!!t[r];(e===void 0||!!e[r]!==i)&&o.toggle(r,i)}}function dn(n,t){t==null?n.style.cssText="":n.style.cssText=String(t)}function un(n,t,e){let o=n.style;if(e!==void 0)for(let r in e)r in t||o.removeProperty(O(r));for(let r in t){let i=t[r];(e===void 0||e[r]!==i)&&(i==null?o.removeProperty(O(r)):o.setProperty(O(r),String(i)))}}var Dn=/[A-Z]/g,rn=new Map;function O(n){let t=rn.get(n);return t===void 0&&(t=n.startsWith("--")?n:n.replace(Dn,e=>`-${e.toLowerCase()}`),rn.set(n,t)),t}function Mn(n,t,e){if(t==="class"||t==="className"){e!==null&&typeof e=="object"?ln(n,e,an(n,"class",e)):sn(n,e);return}if(t==="style"){e!==null&&typeof e=="object"?un(n,e,an(n,"style",e)):dn(n,e);return}if(t==="ref"){e(n);return}if(t.startsWith("prop:")){A(n,t.slice(5),e);return}if(t.startsWith("attr:")){P(n,t.slice(5),e);return}if(t.startsWith("on")&&t.length>2&&/[A-Z:]/.test(t[2])){In(n,t,e);return}if(t in n&&typeof e!="string"){A(n,t,e);return}P(n,t,e)}function In(n,t,e){let o=t.slice(2).split(":"),r=o[0]==="",i=r?o[1]:o[0].toLowerCase(),s=o[r?2:1];s===void 0?k(n,i,e):s==="native"?k(n,i,e,!0):k(n,i,e,{[s]:!0})}function Oe(n,t){for(let e in t)e!=="children"&&Mn(n,e,t[e])}function Pe(...n){let t={};for(let e=0;e<n.length;e++){let o=n[e];for(let r of Object.keys(o))Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return t}function Ae(n,t){let e={};for(let o of Object.keys(n))t.includes(o)||Object.defineProperty(e,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(e)}var cn=new WeakMap;function an(n,t,e){let o=cn.get(n);o===void 0&&(o={},cn.set(n,o));let r=o[t];return o[t]=e,r}export{Vn as a,E as b,qn as c,M as d,Xn as e,R as f,V as g,Jn as h,Qn as i,Un as j,ne as k,ee as l,F as m,p as n,kn as o,G as p,X as q,ue as r,ce as s,ae as t,fe as u,Rn as v,Nn as w,he as x,k as y,ke as z,P as A,Se as B,A as C,Ee as D,sn as E,ln as F,dn as G,un as H,Mn as I,Oe as J,Pe as K,Ae as L};
|