@vertz/ui 0.2.23 → 0.2.25
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/shared/chunk-09ntccdx.js +39 -0
- package/dist/shared/{chunk-g6fb5yc2.js → chunk-1jgws7rs.js} +210 -258
- package/dist/shared/{chunk-016m1fq0.js → chunk-2krx4aqe.js} +119 -15
- package/dist/shared/{chunk-f4d5nphq.js → chunk-7nr2ebrf.js} +1 -1
- package/dist/shared/{chunk-4gmtsf6v.js → chunk-bk7mmn92.js} +1 -1
- package/dist/shared/chunk-djvarb8r.js +333 -0
- package/dist/shared/{chunk-jtma4sh4.js → chunk-e09mdqcx.js} +2 -2
- package/dist/shared/{chunk-4xkw6h1s.js → chunk-h1fsr8kv.js} +67 -1
- package/dist/shared/{chunk-xhc7arn9.js → chunk-j1a7t906.js} +14 -12
- package/dist/shared/{chunk-656n0x6y.js → chunk-ppr06jgn.js} +8 -2
- package/dist/shared/{chunk-2kyhn86t.js → chunk-svvqjmyy.js} +5 -63
- package/dist/shared/{chunk-da2w7j7w.js → chunk-xs5s8gqe.js} +1 -1
- package/dist/shared/{chunk-p3fz6qqp.js → chunk-ymc3wwam.js} +8 -2
- package/dist/src/auth/public.d.ts +35 -1
- package/dist/src/auth/public.js +72 -3
- package/dist/src/components/index.d.ts +3 -2
- package/dist/src/components/index.js +56 -46
- package/dist/src/css/public.d.ts +5 -1
- package/dist/src/css/public.js +4 -5
- package/dist/src/form/public.js +2 -2
- package/dist/src/index.d.ts +162 -53
- package/dist/src/index.js +341 -320
- package/dist/src/internals.d.ts +85 -10
- package/dist/src/internals.js +380 -90
- package/dist/src/jsx-runtime/index.js +3 -5
- package/dist/src/query/public.d.ts +6 -33
- package/dist/src/query/public.js +5 -7
- package/dist/src/router/public.d.ts +27 -4
- package/dist/src/router/public.js +8 -10
- package/dist/src/test/index.d.ts +12 -3
- package/dist/src/test/index.js +3 -3
- package/package.json +4 -3
- package/reactivity.json +1 -1
- package/dist/shared/chunk-13tvh4wq.js +0 -229
- package/dist/shared/chunk-2y9f9j62.js +0 -40
- package/dist/shared/chunk-prj7nm08.js +0 -67
package/dist/src/internals.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ListAnimationContext,
|
|
2
3
|
deserializeProps,
|
|
3
4
|
onAnimationsComplete,
|
|
4
5
|
resolveComponent
|
|
5
|
-
} from "../shared/chunk-
|
|
6
|
+
} from "../shared/chunk-ymc3wwam.js";
|
|
6
7
|
import {
|
|
7
|
-
__attr,
|
|
8
|
-
__classList,
|
|
9
8
|
__discardMountFrame,
|
|
10
9
|
__flushMountFrame,
|
|
11
10
|
__on,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__show
|
|
15
|
-
} from "../shared/chunk-2kyhn86t.js";
|
|
16
|
-
import {
|
|
17
|
-
styleObjectToString
|
|
18
|
-
} from "../shared/chunk-4xkw6h1s.js";
|
|
11
|
+
__pushMountFrame
|
|
12
|
+
} from "../shared/chunk-svvqjmyy.js";
|
|
19
13
|
import {
|
|
20
14
|
executeLoaders,
|
|
21
15
|
matchPath,
|
|
@@ -26,7 +20,7 @@ import {
|
|
|
26
20
|
MemoryCache,
|
|
27
21
|
QueryEnvelopeStore,
|
|
28
22
|
deriveKey
|
|
29
|
-
} from "../shared/chunk-
|
|
23
|
+
} from "../shared/chunk-1jgws7rs.js";
|
|
30
24
|
import"../shared/chunk-jrtrk5z4.js";
|
|
31
25
|
import {
|
|
32
26
|
ALIGNMENT_MAP,
|
|
@@ -47,28 +41,35 @@ import {
|
|
|
47
41
|
SIZE_KEYWORDS,
|
|
48
42
|
SPACING_SCALE,
|
|
49
43
|
compileTheme
|
|
50
|
-
} from "../shared/chunk-
|
|
44
|
+
} from "../shared/chunk-j1a7t906.js";
|
|
51
45
|
import {
|
|
46
|
+
RENDER_NODE_BRAND,
|
|
52
47
|
__append,
|
|
48
|
+
__attr,
|
|
53
49
|
__child,
|
|
50
|
+
__classList,
|
|
54
51
|
__element,
|
|
55
52
|
__enterChildren,
|
|
56
53
|
__exitChildren,
|
|
57
54
|
__insert,
|
|
55
|
+
__prop,
|
|
56
|
+
__show,
|
|
58
57
|
__staticText,
|
|
59
|
-
__text
|
|
60
|
-
} from "../shared/chunk-13tvh4wq.js";
|
|
61
|
-
import"../shared/chunk-prj7nm08.js";
|
|
62
|
-
import {
|
|
63
|
-
RENDER_NODE_BRAND,
|
|
58
|
+
__text,
|
|
64
59
|
createDOMAdapter,
|
|
65
60
|
getAdapter,
|
|
66
61
|
isRenderNode,
|
|
67
62
|
setAdapter
|
|
68
|
-
} from "../shared/chunk-
|
|
63
|
+
} from "../shared/chunk-djvarb8r.js";
|
|
64
|
+
import {
|
|
65
|
+
SVG_NS,
|
|
66
|
+
normalizeSVGAttr,
|
|
67
|
+
styleObjectToString
|
|
68
|
+
} from "../shared/chunk-h1fsr8kv.js";
|
|
69
|
+
import"../shared/chunk-09ntccdx.js";
|
|
69
70
|
import {
|
|
70
71
|
isBrowser
|
|
71
|
-
} from "../shared/chunk-
|
|
72
|
+
} from "../shared/chunk-xs5s8gqe.js";
|
|
72
73
|
import {
|
|
73
74
|
_tryOnCleanup,
|
|
74
75
|
claimComment,
|
|
@@ -87,23 +88,39 @@ import {
|
|
|
87
88
|
setContextScope,
|
|
88
89
|
signal,
|
|
89
90
|
startSignalCollection,
|
|
90
|
-
stopSignalCollection
|
|
91
|
-
|
|
91
|
+
stopSignalCollection,
|
|
92
|
+
useContext
|
|
93
|
+
} from "../shared/chunk-ppr06jgn.js";
|
|
92
94
|
// src/dom/conditional.ts
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
function clearBetween(start, end) {
|
|
96
|
+
let current = start.nextSibling;
|
|
97
|
+
while (current && current !== end) {
|
|
98
|
+
const next = current.nextSibling;
|
|
99
|
+
current.parentNode?.removeChild(current);
|
|
100
|
+
current = next;
|
|
96
101
|
}
|
|
102
|
+
}
|
|
103
|
+
function insertContentBefore(endMarker, branchResult) {
|
|
104
|
+
if (branchResult == null || typeof branchResult === "boolean")
|
|
105
|
+
return;
|
|
106
|
+
const parent = endMarker.parentNode;
|
|
107
|
+
if (!parent)
|
|
108
|
+
return;
|
|
97
109
|
if (isRenderNode(branchResult)) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
wrap.style.display = "contents";
|
|
101
|
-
wrap.appendChild(branchResult);
|
|
102
|
-
return wrap;
|
|
103
|
-
}
|
|
104
|
-
return branchResult;
|
|
110
|
+
parent.insertBefore(branchResult, endMarker);
|
|
111
|
+
return;
|
|
105
112
|
}
|
|
106
|
-
|
|
113
|
+
const text = getAdapter().createTextNode(String(branchResult));
|
|
114
|
+
parent.insertBefore(text, endMarker);
|
|
115
|
+
}
|
|
116
|
+
function appendBranchContent(fragment, branchResult) {
|
|
117
|
+
if (branchResult == null || typeof branchResult === "boolean")
|
|
118
|
+
return;
|
|
119
|
+
if (isRenderNode(branchResult)) {
|
|
120
|
+
fragment.appendChild(branchResult);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
fragment.appendChild(getAdapter().createTextNode(String(branchResult)));
|
|
107
124
|
}
|
|
108
125
|
function __conditional(condFn, trueFn, falseFn) {
|
|
109
126
|
if (getIsHydrating()) {
|
|
@@ -117,11 +134,11 @@ function hydrateConditional(condFn, trueFn, falseFn) {
|
|
|
117
134
|
return csrConditional(condFn, trueFn, falseFn);
|
|
118
135
|
}
|
|
119
136
|
const anchor = claimed;
|
|
120
|
-
let currentNode = null;
|
|
121
137
|
let branchCleanups = [];
|
|
122
|
-
let
|
|
123
|
-
const outerScope = pushScope();
|
|
138
|
+
let endMarker = null;
|
|
124
139
|
let isFirstRun = true;
|
|
140
|
+
let needsCsrFallback = false;
|
|
141
|
+
const outerScope = pushScope();
|
|
125
142
|
domEffect(() => {
|
|
126
143
|
const show = condFn();
|
|
127
144
|
if (isFirstRun) {
|
|
@@ -130,60 +147,47 @@ function hydrateConditional(condFn, trueFn, falseFn) {
|
|
|
130
147
|
const branchResult2 = show ? trueFn() : falseFn();
|
|
131
148
|
popScope();
|
|
132
149
|
branchCleanups = scope2;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
contentNode = null;
|
|
136
|
-
} else if (isRenderNode(branchResult2)) {
|
|
137
|
-
contentNode = branchResult2;
|
|
138
|
-
} else {
|
|
139
|
-
const claimed2 = claimText();
|
|
140
|
-
contentNode = claimed2 ?? getAdapter().createTextNode(String(branchResult2));
|
|
150
|
+
if (branchResult2 != null && !isRenderNode(branchResult2) && typeof branchResult2 !== "boolean") {
|
|
151
|
+
claimText();
|
|
141
152
|
}
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
anchorParent.insertBefore(wrap, anchor);
|
|
147
|
-
wrap.appendChild(anchor);
|
|
148
|
-
if (contentNode?.parentNode && contentNode.parentNode !== wrap) {
|
|
149
|
-
wrap.appendChild(contentNode);
|
|
150
|
-
}
|
|
151
|
-
currentNode = wrap;
|
|
152
|
-
resultNode = wrap;
|
|
153
|
-
} else {
|
|
154
|
-
currentNode = contentNode ?? getAdapter().createComment("empty");
|
|
155
|
-
resultNode = currentNode;
|
|
153
|
+
const claimedEnd = claimComment();
|
|
154
|
+
if (!claimedEnd) {
|
|
155
|
+
needsCsrFallback = true;
|
|
156
|
+
return;
|
|
156
157
|
}
|
|
158
|
+
endMarker = claimedEnd;
|
|
157
159
|
return;
|
|
158
160
|
}
|
|
159
161
|
runCleanups(branchCleanups);
|
|
162
|
+
clearBetween(anchor, endMarker);
|
|
160
163
|
const scope = pushScope();
|
|
161
164
|
const branchResult = show ? trueFn() : falseFn();
|
|
162
165
|
popScope();
|
|
163
166
|
branchCleanups = scope;
|
|
164
|
-
|
|
165
|
-
if (currentNode?.parentNode) {
|
|
166
|
-
currentNode.parentNode.replaceChild(newNode, currentNode);
|
|
167
|
-
} else if (anchor.parentNode) {
|
|
168
|
-
anchor.parentNode.insertBefore(newNode, anchor.nextSibling);
|
|
169
|
-
}
|
|
170
|
-
currentNode = newNode;
|
|
167
|
+
insertContentBefore(endMarker, branchResult);
|
|
171
168
|
});
|
|
172
169
|
popScope();
|
|
170
|
+
if (needsCsrFallback) {
|
|
171
|
+
runCleanups(branchCleanups);
|
|
172
|
+
runCleanups(outerScope);
|
|
173
|
+
return csrConditional(condFn, trueFn, falseFn);
|
|
174
|
+
}
|
|
173
175
|
const disposeFn = () => {
|
|
174
176
|
runCleanups(branchCleanups);
|
|
175
177
|
runCleanups(outerScope);
|
|
176
178
|
};
|
|
177
179
|
_tryOnCleanup(disposeFn);
|
|
178
|
-
const result = Object.assign(
|
|
180
|
+
const result = Object.assign(anchor, {
|
|
179
181
|
dispose: disposeFn
|
|
180
182
|
});
|
|
181
183
|
return result;
|
|
182
184
|
}
|
|
183
185
|
function csrConditional(condFn, trueFn, falseFn) {
|
|
184
186
|
const anchor = getAdapter().createComment("conditional");
|
|
185
|
-
|
|
187
|
+
const endMarker = getAdapter().createComment("/conditional");
|
|
186
188
|
let branchCleanups = [];
|
|
189
|
+
let isFirstRun = true;
|
|
190
|
+
let firstRunResult;
|
|
187
191
|
const outerScope = pushScope();
|
|
188
192
|
domEffect(() => {
|
|
189
193
|
const show = condFn();
|
|
@@ -192,26 +196,26 @@ function csrConditional(condFn, trueFn, falseFn) {
|
|
|
192
196
|
const branchResult = show ? trueFn() : falseFn();
|
|
193
197
|
popScope();
|
|
194
198
|
branchCleanups = scope;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
anchor.parentNode.insertBefore(newNode, anchor.nextSibling);
|
|
199
|
+
if (isFirstRun) {
|
|
200
|
+
isFirstRun = false;
|
|
201
|
+
firstRunResult = branchResult;
|
|
202
|
+
return;
|
|
200
203
|
}
|
|
201
|
-
|
|
204
|
+
clearBetween(anchor, endMarker);
|
|
205
|
+
insertContentBefore(endMarker, branchResult);
|
|
202
206
|
});
|
|
203
207
|
popScope();
|
|
204
|
-
const
|
|
208
|
+
const disposeFn = () => {
|
|
205
209
|
runCleanups(branchCleanups);
|
|
206
210
|
runCleanups(outerScope);
|
|
207
211
|
};
|
|
208
|
-
_tryOnCleanup(
|
|
212
|
+
_tryOnCleanup(disposeFn);
|
|
209
213
|
const fragment = getAdapter().createDocumentFragment();
|
|
210
214
|
fragment.appendChild(anchor);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const result = Object.assign(fragment, { dispose:
|
|
215
|
+
appendBranchContent(fragment, firstRunResult);
|
|
216
|
+
firstRunResult = undefined;
|
|
217
|
+
fragment.appendChild(endMarker);
|
|
218
|
+
const result = Object.assign(fragment, { dispose: disposeFn });
|
|
215
219
|
return result;
|
|
216
220
|
}
|
|
217
221
|
// src/dom/insert.ts
|
|
@@ -227,6 +231,7 @@ function clearChildren(container) {
|
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
233
|
// src/dom/list.ts
|
|
234
|
+
var unkeyedListWarned = false;
|
|
230
235
|
function createItemProxy(itemSignal) {
|
|
231
236
|
const initial = itemSignal.peek();
|
|
232
237
|
if (typeof initial !== "object" || initial == null) {
|
|
@@ -277,6 +282,10 @@ function __list(container, items, keyFn, renderFn) {
|
|
|
277
282
|
const nodeMap = new Map;
|
|
278
283
|
const scopeMap = new Map;
|
|
279
284
|
const itemSignalMap = new Map;
|
|
285
|
+
if (!keyFn && !unkeyedListWarned) {
|
|
286
|
+
unkeyedListWarned = true;
|
|
287
|
+
console.warn("[vertz] .map() without a key prop uses full-replacement mode (slower). " + "Add a key prop to list items for efficient updates: " + "{items.map(item => <Item key={item.id} />)}");
|
|
288
|
+
}
|
|
280
289
|
const isHydrationRun = getIsHydrating();
|
|
281
290
|
let startOffset = isHydrationRun ? -1 : container.childNodes.length;
|
|
282
291
|
const outerScope = pushScope();
|
|
@@ -286,20 +295,47 @@ function __list(container, items, keyFn, renderFn) {
|
|
|
286
295
|
if (isFirstRun && isHydrationRun) {
|
|
287
296
|
isFirstRun = false;
|
|
288
297
|
for (const [i, item] of newItems.entries()) {
|
|
289
|
-
const key = keyFn(item, i);
|
|
290
|
-
const itemSig = signal(item);
|
|
291
|
-
const proxy = createItemProxy(itemSig);
|
|
298
|
+
const key = keyFn ? keyFn(item, i) : i;
|
|
292
299
|
const scope = pushScope();
|
|
293
|
-
|
|
300
|
+
if (keyFn) {
|
|
301
|
+
const itemSig = signal(item);
|
|
302
|
+
const proxy = createItemProxy(itemSig);
|
|
303
|
+
const node = renderFn(proxy);
|
|
304
|
+
itemSignalMap.set(key, itemSig);
|
|
305
|
+
nodeMap.set(key, node);
|
|
306
|
+
} else {
|
|
307
|
+
const node = renderFn(item);
|
|
308
|
+
nodeMap.set(key, node);
|
|
309
|
+
}
|
|
294
310
|
popScope();
|
|
295
|
-
nodeMap.set(key, node);
|
|
296
311
|
scopeMap.set(key, scope);
|
|
297
|
-
itemSignalMap.set(key, itemSig);
|
|
298
312
|
}
|
|
299
313
|
startOffset = container.childNodes.length - nodeMap.size;
|
|
300
314
|
return;
|
|
301
315
|
}
|
|
302
316
|
isFirstRun = false;
|
|
317
|
+
if (!keyFn) {
|
|
318
|
+
for (const scope of scopeMap.values()) {
|
|
319
|
+
runCleanups(scope);
|
|
320
|
+
}
|
|
321
|
+
scopeMap.clear();
|
|
322
|
+
for (const node of nodeMap.values()) {
|
|
323
|
+
node.parentNode?.removeChild(node);
|
|
324
|
+
}
|
|
325
|
+
nodeMap.clear();
|
|
326
|
+
itemSignalMap.clear();
|
|
327
|
+
for (const item of newItems) {
|
|
328
|
+
const scope = pushScope();
|
|
329
|
+
const node = renderFn(item);
|
|
330
|
+
popScope();
|
|
331
|
+
container.appendChild(node);
|
|
332
|
+
const internalKey = nodeMap.size;
|
|
333
|
+
nodeMap.set(internalKey, node);
|
|
334
|
+
scopeMap.set(internalKey, scope);
|
|
335
|
+
}
|
|
336
|
+
fixUpSelectValue(container);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
303
339
|
const newKeySet = new Set(newItems.map((item, i) => keyFn(item, i)));
|
|
304
340
|
for (const [key, node] of nodeMap) {
|
|
305
341
|
if (!newKeySet.has(key)) {
|
|
@@ -340,12 +376,7 @@ function __list(container, items, keyFn, renderFn) {
|
|
|
340
376
|
container.insertBefore(desiredNode, currentChild ?? null);
|
|
341
377
|
}
|
|
342
378
|
}
|
|
343
|
-
|
|
344
|
-
const selected = container.querySelector("option[selected]");
|
|
345
|
-
if (selected) {
|
|
346
|
-
Reflect.set(container, "value", selected.value);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
379
|
+
fixUpSelectValue(container);
|
|
349
380
|
});
|
|
350
381
|
popScope();
|
|
351
382
|
const wrapper = () => {
|
|
@@ -358,6 +389,262 @@ function __list(container, items, keyFn, renderFn) {
|
|
|
358
389
|
_tryOnCleanup(wrapper);
|
|
359
390
|
return wrapper;
|
|
360
391
|
}
|
|
392
|
+
function fixUpSelectValue(container) {
|
|
393
|
+
if (container.tagName === "SELECT") {
|
|
394
|
+
const selected = container.querySelector("option[selected]");
|
|
395
|
+
if (selected) {
|
|
396
|
+
Reflect.set(container, "value", selected.value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// src/dom/list-value.ts
|
|
401
|
+
var unkeyedListValueWarned = false;
|
|
402
|
+
function createItemProxy2(itemSignal) {
|
|
403
|
+
const initial = itemSignal.peek();
|
|
404
|
+
if (typeof initial !== "object" || initial == null) {
|
|
405
|
+
return initial;
|
|
406
|
+
}
|
|
407
|
+
return new Proxy(initial, {
|
|
408
|
+
get(_target, prop, receiver) {
|
|
409
|
+
const current = itemSignal.value;
|
|
410
|
+
if (current == null)
|
|
411
|
+
return;
|
|
412
|
+
const value = Reflect.get(current, prop, receiver);
|
|
413
|
+
if (typeof value === "function") {
|
|
414
|
+
return value.bind(current);
|
|
415
|
+
}
|
|
416
|
+
return value;
|
|
417
|
+
},
|
|
418
|
+
set() {
|
|
419
|
+
return false;
|
|
420
|
+
},
|
|
421
|
+
has(_target, prop) {
|
|
422
|
+
const current = itemSignal.value;
|
|
423
|
+
if (current == null)
|
|
424
|
+
return false;
|
|
425
|
+
return Reflect.has(current, prop);
|
|
426
|
+
},
|
|
427
|
+
ownKeys() {
|
|
428
|
+
const current = itemSignal.value;
|
|
429
|
+
if (current == null)
|
|
430
|
+
return [];
|
|
431
|
+
return Reflect.ownKeys(current);
|
|
432
|
+
},
|
|
433
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
434
|
+
const current = itemSignal.value;
|
|
435
|
+
if (current == null)
|
|
436
|
+
return;
|
|
437
|
+
return Reflect.getOwnPropertyDescriptor(current, prop);
|
|
438
|
+
},
|
|
439
|
+
getPrototypeOf() {
|
|
440
|
+
const current = itemSignal.value;
|
|
441
|
+
if (current == null)
|
|
442
|
+
return null;
|
|
443
|
+
return Object.getPrototypeOf(current);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
function __listValue(items, keyFn, renderFn) {
|
|
448
|
+
const getItems = typeof items === "function" ? items : () => items.value;
|
|
449
|
+
const startMarker = document.createComment("lv-s");
|
|
450
|
+
const endMarker = document.createComment("lv-e");
|
|
451
|
+
const fragment = document.createDocumentFragment();
|
|
452
|
+
fragment.appendChild(startMarker);
|
|
453
|
+
fragment.appendChild(endMarker);
|
|
454
|
+
const nodeMap = new Map;
|
|
455
|
+
const scopeMap = new Map;
|
|
456
|
+
const itemSignalMap = new Map;
|
|
457
|
+
const exitingNodes = new Set;
|
|
458
|
+
const exitingKeyMap = new Map;
|
|
459
|
+
const keyGeneration = new Map;
|
|
460
|
+
const animHooks = useContext(ListAnimationContext);
|
|
461
|
+
let isFirstRun = true;
|
|
462
|
+
if (!keyFn && !unkeyedListValueWarned) {
|
|
463
|
+
unkeyedListValueWarned = true;
|
|
464
|
+
console.warn("[vertz] .map() without a key prop uses full-replacement mode (slower). " + "Add a key prop to list items for efficient updates: " + "{items.map(item => <Item key={item.id} />)}");
|
|
465
|
+
}
|
|
466
|
+
const outerScope = pushScope();
|
|
467
|
+
try {
|
|
468
|
+
domEffect(() => {
|
|
469
|
+
const newItems = getItems() ?? [];
|
|
470
|
+
if (!keyFn) {
|
|
471
|
+
for (const scope of scopeMap.values()) {
|
|
472
|
+
runCleanups(scope);
|
|
473
|
+
}
|
|
474
|
+
scopeMap.clear();
|
|
475
|
+
for (const node of nodeMap.values()) {
|
|
476
|
+
node.parentNode?.removeChild(node);
|
|
477
|
+
}
|
|
478
|
+
nodeMap.clear();
|
|
479
|
+
itemSignalMap.clear();
|
|
480
|
+
for (const [i, item] of newItems.entries()) {
|
|
481
|
+
const scope = pushScope();
|
|
482
|
+
const node = renderFn(item);
|
|
483
|
+
popScope();
|
|
484
|
+
endMarker.parentNode?.insertBefore(node, endMarker);
|
|
485
|
+
nodeMap.set(i, node);
|
|
486
|
+
scopeMap.set(i, scope);
|
|
487
|
+
}
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (isFirstRun) {
|
|
491
|
+
isFirstRun = false;
|
|
492
|
+
for (const [i, item] of newItems.entries()) {
|
|
493
|
+
const key = keyFn(item, i);
|
|
494
|
+
const itemSig = signal(item);
|
|
495
|
+
const proxy = createItemProxy2(itemSig);
|
|
496
|
+
const scope = pushScope();
|
|
497
|
+
const node = renderFn(proxy);
|
|
498
|
+
popScope();
|
|
499
|
+
nodeMap.set(key, node);
|
|
500
|
+
scopeMap.set(key, scope);
|
|
501
|
+
itemSignalMap.set(key, itemSig);
|
|
502
|
+
endMarker.parentNode?.insertBefore(node, endMarker);
|
|
503
|
+
}
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
animHooks?.onBeforeReconcile();
|
|
507
|
+
const newKeySet = new Set(newItems.map((item, i) => keyFn(item, i)));
|
|
508
|
+
for (const [key, node] of nodeMap) {
|
|
509
|
+
if (!newKeySet.has(key)) {
|
|
510
|
+
const scope = scopeMap.get(key);
|
|
511
|
+
if (scope) {
|
|
512
|
+
runCleanups(scope);
|
|
513
|
+
scopeMap.delete(key);
|
|
514
|
+
}
|
|
515
|
+
nodeMap.delete(key);
|
|
516
|
+
itemSignalMap.delete(key);
|
|
517
|
+
if (animHooks) {
|
|
518
|
+
const gen = (keyGeneration.get(key) ?? 0) + 1;
|
|
519
|
+
keyGeneration.set(key, gen);
|
|
520
|
+
exitingNodes.add(node);
|
|
521
|
+
exitingKeyMap.set(key, node);
|
|
522
|
+
animHooks.onItemExit(node, key, () => {
|
|
523
|
+
if (keyGeneration.get(key) === gen) {
|
|
524
|
+
node.parentNode?.removeChild(node);
|
|
525
|
+
exitingNodes.delete(node);
|
|
526
|
+
exitingKeyMap.delete(key);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
} else {
|
|
530
|
+
node.parentNode?.removeChild(node);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
const desiredNodes = [];
|
|
535
|
+
const enterEntries = [];
|
|
536
|
+
for (const [i, item] of newItems.entries()) {
|
|
537
|
+
const key = keyFn(item, i);
|
|
538
|
+
let node = nodeMap.get(key);
|
|
539
|
+
if (!node) {
|
|
540
|
+
const oldExiting = exitingKeyMap.get(key);
|
|
541
|
+
if (oldExiting) {
|
|
542
|
+
oldExiting.parentNode?.removeChild(oldExiting);
|
|
543
|
+
exitingNodes.delete(oldExiting);
|
|
544
|
+
exitingKeyMap.delete(key);
|
|
545
|
+
}
|
|
546
|
+
const gen = (keyGeneration.get(key) ?? 0) + 1;
|
|
547
|
+
keyGeneration.set(key, gen);
|
|
548
|
+
const itemSig = signal(item);
|
|
549
|
+
const proxy = createItemProxy2(itemSig);
|
|
550
|
+
const scope = pushScope();
|
|
551
|
+
node = renderFn(proxy);
|
|
552
|
+
popScope();
|
|
553
|
+
nodeMap.set(key, node);
|
|
554
|
+
scopeMap.set(key, scope);
|
|
555
|
+
itemSignalMap.set(key, itemSig);
|
|
556
|
+
enterEntries.push({ node, key });
|
|
557
|
+
} else {
|
|
558
|
+
const itemSig = itemSignalMap.get(key);
|
|
559
|
+
if (itemSig) {
|
|
560
|
+
itemSig.value = item;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
desiredNodes.push(node);
|
|
564
|
+
}
|
|
565
|
+
const parent = startMarker.parentNode;
|
|
566
|
+
if (parent) {
|
|
567
|
+
let cursor = startMarker.nextSibling;
|
|
568
|
+
for (const desired of desiredNodes) {
|
|
569
|
+
while (cursor && cursor !== endMarker && exitingNodes.has(cursor)) {
|
|
570
|
+
cursor = cursor.nextSibling;
|
|
571
|
+
}
|
|
572
|
+
if (cursor === endMarker) {
|
|
573
|
+
parent.insertBefore(desired, endMarker);
|
|
574
|
+
} else if (cursor === desired) {
|
|
575
|
+
cursor = cursor.nextSibling;
|
|
576
|
+
} else {
|
|
577
|
+
parent.insertBefore(desired, cursor);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (animHooks) {
|
|
582
|
+
for (const { node, key } of enterEntries) {
|
|
583
|
+
animHooks.onItemEnter(node, key);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
animHooks?.onAfterReconcile();
|
|
587
|
+
});
|
|
588
|
+
} finally {
|
|
589
|
+
popScope();
|
|
590
|
+
}
|
|
591
|
+
const dispose = () => {
|
|
592
|
+
for (const scope of scopeMap.values()) {
|
|
593
|
+
runCleanups(scope);
|
|
594
|
+
}
|
|
595
|
+
scopeMap.clear();
|
|
596
|
+
for (const node of exitingNodes) {
|
|
597
|
+
node.parentNode?.removeChild(node);
|
|
598
|
+
}
|
|
599
|
+
exitingNodes.clear();
|
|
600
|
+
exitingKeyMap.clear();
|
|
601
|
+
runCleanups(outerScope);
|
|
602
|
+
};
|
|
603
|
+
_tryOnCleanup(dispose);
|
|
604
|
+
return Object.assign(fragment, { dispose });
|
|
605
|
+
}
|
|
606
|
+
// src/dom/spread.ts
|
|
607
|
+
var SKIP_KEYS = new Set(["children", "key"]);
|
|
608
|
+
var PROP_ALIASES = {
|
|
609
|
+
className: "class",
|
|
610
|
+
htmlFor: "for"
|
|
611
|
+
};
|
|
612
|
+
function __spread(el, props) {
|
|
613
|
+
const isSvg = el.namespaceURI === SVG_NS;
|
|
614
|
+
for (const key of Object.keys(props)) {
|
|
615
|
+
if (SKIP_KEYS.has(key))
|
|
616
|
+
continue;
|
|
617
|
+
const value = props[key];
|
|
618
|
+
if (key === "ref") {
|
|
619
|
+
if (value && typeof value === "object" && "current" in value) {
|
|
620
|
+
value.current = el;
|
|
621
|
+
}
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
if (key.length > 2 && key.startsWith("on") && typeof value === "function") {
|
|
625
|
+
const eventName = key.slice(2).toLowerCase();
|
|
626
|
+
el.addEventListener(eventName, value);
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
if (value == null || value === false)
|
|
630
|
+
continue;
|
|
631
|
+
const attrName = PROP_ALIASES[key] ?? key;
|
|
632
|
+
if (attrName === "style") {
|
|
633
|
+
if (typeof value === "object") {
|
|
634
|
+
el.setAttribute("style", styleObjectToString(value));
|
|
635
|
+
} else {
|
|
636
|
+
el.setAttribute("style", String(value));
|
|
637
|
+
}
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
if (value === true) {
|
|
641
|
+
el.setAttribute(attrName, "");
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
const finalName = isSvg ? normalizeSVGAttr(attrName) : attrName;
|
|
645
|
+
el.setAttribute(finalName, String(value));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
361
648
|
export {
|
|
362
649
|
stopSignalCollection,
|
|
363
650
|
startSignalCollection,
|
|
@@ -392,10 +679,12 @@ export {
|
|
|
392
679
|
__text,
|
|
393
680
|
styleObjectToString as __styleStr,
|
|
394
681
|
__staticText,
|
|
682
|
+
__spread,
|
|
395
683
|
__show,
|
|
396
684
|
__pushMountFrame,
|
|
397
685
|
__prop,
|
|
398
686
|
__on,
|
|
687
|
+
__listValue,
|
|
399
688
|
__list,
|
|
400
689
|
__insert,
|
|
401
690
|
__flushMountFrame,
|
|
@@ -418,6 +707,7 @@ export {
|
|
|
418
707
|
PSEUDO_MAP,
|
|
419
708
|
PROPERTY_MAP,
|
|
420
709
|
MemoryCache,
|
|
710
|
+
ListAnimationContext,
|
|
421
711
|
LINE_HEIGHT_SCALE,
|
|
422
712
|
KEYWORD_MAP,
|
|
423
713
|
HEIGHT_AXIS_PROPERTIES,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
styleObjectToString
|
|
3
|
-
} from "../../shared/chunk-4xkw6h1s.js";
|
|
4
1
|
import {
|
|
5
2
|
SVG_NS,
|
|
6
3
|
isSVGTag,
|
|
7
|
-
normalizeSVGAttr
|
|
8
|
-
|
|
4
|
+
normalizeSVGAttr,
|
|
5
|
+
styleObjectToString
|
|
6
|
+
} from "../../shared/chunk-h1fsr8kv.js";
|
|
9
7
|
|
|
10
8
|
// src/jsx-runtime/index.ts
|
|
11
9
|
function applyChildren(parent, children) {
|