@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
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__classList,
|
|
3
2
|
__on,
|
|
4
3
|
beginDeferringMounts,
|
|
5
4
|
discardDeferredMounts,
|
|
6
5
|
flushDeferredMounts
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-svvqjmyy.js";
|
|
8
7
|
import {
|
|
9
8
|
__append,
|
|
9
|
+
__classList,
|
|
10
10
|
__element,
|
|
11
11
|
__enterChildren,
|
|
12
12
|
__exitChildren,
|
|
13
13
|
__staticText
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-djvarb8r.js";
|
|
15
15
|
import {
|
|
16
16
|
RouterContext
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7nr2ebrf.js";
|
|
18
18
|
import {
|
|
19
19
|
isBrowser
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-xs5s8gqe.js";
|
|
21
21
|
import {
|
|
22
22
|
_tryOnCleanup,
|
|
23
23
|
createContext,
|
|
@@ -32,7 +32,65 @@ import {
|
|
|
32
32
|
startHydration,
|
|
33
33
|
untrack,
|
|
34
34
|
useContext
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ppr06jgn.js";
|
|
36
|
+
|
|
37
|
+
// src/component/error-boundary-context.ts
|
|
38
|
+
var handlerStack = [];
|
|
39
|
+
function pushErrorHandler(handler) {
|
|
40
|
+
handlerStack.push(handler);
|
|
41
|
+
}
|
|
42
|
+
function popErrorHandler() {
|
|
43
|
+
handlerStack.pop();
|
|
44
|
+
}
|
|
45
|
+
function getCurrentErrorHandler() {
|
|
46
|
+
if (handlerStack.length === 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
return handlerStack[handlerStack.length - 1];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/component/error-boundary.ts
|
|
53
|
+
function toError(value) {
|
|
54
|
+
if (value instanceof Error) {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
return new Error(String(value));
|
|
58
|
+
}
|
|
59
|
+
function ErrorBoundary(props) {
|
|
60
|
+
function handleAsyncError(error, placeholder) {
|
|
61
|
+
const fallbackNode = props.fallback(error, retry);
|
|
62
|
+
function retry() {
|
|
63
|
+
try {
|
|
64
|
+
const retryResult = props.children();
|
|
65
|
+
if (fallbackNode.parentNode) {
|
|
66
|
+
fallbackNode.parentNode.replaceChild(retryResult, fallbackNode);
|
|
67
|
+
}
|
|
68
|
+
} catch (_retryThrown) {}
|
|
69
|
+
}
|
|
70
|
+
if (placeholder.parentNode) {
|
|
71
|
+
placeholder.parentNode.replaceChild(fallbackNode, placeholder);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
pushErrorHandler(handleAsyncError);
|
|
76
|
+
const result = props.children();
|
|
77
|
+
popErrorHandler();
|
|
78
|
+
return result;
|
|
79
|
+
} catch (thrown) {
|
|
80
|
+
let retry = function() {
|
|
81
|
+
try {
|
|
82
|
+
const retryResult = props.children();
|
|
83
|
+
if (fallbackNode.parentNode) {
|
|
84
|
+
fallbackNode.parentNode.replaceChild(retryResult, fallbackNode);
|
|
85
|
+
}
|
|
86
|
+
} catch (_retryThrown) {}
|
|
87
|
+
};
|
|
88
|
+
popErrorHandler();
|
|
89
|
+
const error = toError(thrown);
|
|
90
|
+
const fallbackNode = props.fallback(error, retry);
|
|
91
|
+
return fallbackNode;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
36
94
|
|
|
37
95
|
// src/router/link.ts
|
|
38
96
|
var DANGEROUS_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
@@ -256,12 +314,13 @@ function Outlet() {
|
|
|
256
314
|
}
|
|
257
315
|
|
|
258
316
|
// src/router/router-view.ts
|
|
259
|
-
function RouterView({ router, fallback }) {
|
|
317
|
+
function RouterView({ router, fallback, errorFallback }) {
|
|
260
318
|
const container = __element("div");
|
|
261
319
|
let isFirstHydrationRender = getIsHydrating();
|
|
262
320
|
let renderGen = 0;
|
|
263
321
|
let pageCleanups = [];
|
|
264
322
|
let prevLevels = [];
|
|
323
|
+
let prevParamsKey;
|
|
265
324
|
__enterChildren(container);
|
|
266
325
|
const dispose = domEffect(() => {
|
|
267
326
|
const match = router.current.value;
|
|
@@ -274,17 +333,23 @@ function RouterView({ router, fallback }) {
|
|
|
274
333
|
if (prevLevels[divergeAt].route !== newMatched[divergeAt].route)
|
|
275
334
|
break;
|
|
276
335
|
}
|
|
277
|
-
|
|
336
|
+
const currentParamsKey = match ? JSON.stringify(match.params) : undefined;
|
|
337
|
+
const chainIdentical = prevLevels.length > 0 && divergeAt === prevLevels.length && divergeAt === newMatched.length;
|
|
338
|
+
if (chainIdentical && prevParamsKey === currentParamsKey) {
|
|
278
339
|
return;
|
|
279
340
|
}
|
|
341
|
+
if (chainIdentical) {
|
|
342
|
+
divergeAt = 0;
|
|
343
|
+
}
|
|
280
344
|
if (divergeAt > 0 && newMatched.length > 0) {
|
|
281
345
|
const newLevels = buildLevels(newMatched);
|
|
282
|
-
const newChildFactory = buildInsideOutFactory(newMatched, newLevels, divergeAt, router);
|
|
346
|
+
const newChildFactory = buildInsideOutFactory(newMatched, newLevels, divergeAt, router, errorFallback);
|
|
283
347
|
const parentLevel = prevLevels[divergeAt - 1];
|
|
284
348
|
if (parentLevel.childSignal) {
|
|
285
349
|
parentLevel.childSignal.value = newChildFactory;
|
|
286
350
|
}
|
|
287
351
|
prevLevels = [...prevLevels.slice(0, divergeAt), ...newLevels.slice(divergeAt)];
|
|
352
|
+
prevParamsKey = currentParamsKey;
|
|
288
353
|
return;
|
|
289
354
|
}
|
|
290
355
|
runCleanups(pageCleanups);
|
|
@@ -299,6 +364,7 @@ function RouterView({ router, fallback }) {
|
|
|
299
364
|
pageCleanups = pushScope();
|
|
300
365
|
if (!match) {
|
|
301
366
|
prevLevels = [];
|
|
367
|
+
prevParamsKey = undefined;
|
|
302
368
|
if (fallback) {
|
|
303
369
|
container.appendChild(fallback());
|
|
304
370
|
}
|
|
@@ -306,7 +372,8 @@ function RouterView({ router, fallback }) {
|
|
|
306
372
|
return;
|
|
307
373
|
}
|
|
308
374
|
const levels = buildLevels(newMatched);
|
|
309
|
-
const rootFactory = buildInsideOutFactory(newMatched, levels, 0, router);
|
|
375
|
+
const rootFactory = buildInsideOutFactory(newMatched, levels, 0, router, errorFallback);
|
|
376
|
+
const lazyFallback = match ? match.route.errorComponent ?? errorFallback : undefined;
|
|
310
377
|
let asyncRoute = false;
|
|
311
378
|
RouterContext.Provider(router, () => {
|
|
312
379
|
const result = rootFactory();
|
|
@@ -352,11 +419,35 @@ function RouterView({ router, fallback }) {
|
|
|
352
419
|
container.appendChild(node);
|
|
353
420
|
});
|
|
354
421
|
}
|
|
422
|
+
} catch (thrown) {
|
|
423
|
+
if (lazyFallback) {
|
|
424
|
+
const error = thrown instanceof Error ? thrown : new Error(String(thrown));
|
|
425
|
+
while (container.firstChild) {
|
|
426
|
+
container.removeChild(container.firstChild);
|
|
427
|
+
}
|
|
428
|
+
const fallbackNode = lazyFallback({
|
|
429
|
+
error,
|
|
430
|
+
retry: () => {
|
|
431
|
+
try {
|
|
432
|
+
const retryNode = mod.default();
|
|
433
|
+
if (fallbackNode.parentNode) {
|
|
434
|
+
fallbackNode.parentNode.replaceChild(retryNode, fallbackNode);
|
|
435
|
+
}
|
|
436
|
+
} catch {}
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
container.appendChild(fallbackNode);
|
|
440
|
+
} else {
|
|
441
|
+
throw thrown;
|
|
442
|
+
}
|
|
355
443
|
} finally {
|
|
356
444
|
popScope();
|
|
357
445
|
}
|
|
358
446
|
});
|
|
359
447
|
} else {
|
|
448
|
+
if (gen !== renderGen) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
360
451
|
__append(container, result);
|
|
361
452
|
if (getIsHydrating() && !container.contains(result)) {
|
|
362
453
|
while (container.firstChild) {
|
|
@@ -366,7 +457,10 @@ function RouterView({ router, fallback }) {
|
|
|
366
457
|
}
|
|
367
458
|
}
|
|
368
459
|
});
|
|
369
|
-
|
|
460
|
+
if (gen === renderGen) {
|
|
461
|
+
prevLevels = levels;
|
|
462
|
+
prevParamsKey = currentParamsKey;
|
|
463
|
+
}
|
|
370
464
|
if (!asyncRoute) {
|
|
371
465
|
popScope();
|
|
372
466
|
}
|
|
@@ -387,7 +481,7 @@ function buildLevels(matched) {
|
|
|
387
481
|
route: m.route
|
|
388
482
|
}));
|
|
389
483
|
}
|
|
390
|
-
function buildInsideOutFactory(matched, levels, startAt, router) {
|
|
484
|
+
function buildInsideOutFactory(matched, levels, startAt, router, errorFallback) {
|
|
391
485
|
const ssrCtx = getSSRContext();
|
|
392
486
|
const wrapForSSR = (route, routeIndex) => {
|
|
393
487
|
if (!ssrCtx)
|
|
@@ -415,12 +509,22 @@ function buildInsideOutFactory(matched, levels, startAt, router) {
|
|
|
415
509
|
return result;
|
|
416
510
|
};
|
|
417
511
|
};
|
|
418
|
-
|
|
512
|
+
const resolveFallback = (route) => route.errorComponent ?? errorFallback;
|
|
513
|
+
const maybeWrapInBoundary = (componentFn, fb) => {
|
|
514
|
+
if (!fb)
|
|
515
|
+
return componentFn;
|
|
516
|
+
return () => ErrorBoundary({
|
|
517
|
+
children: componentFn,
|
|
518
|
+
fallback: (error, retry) => fb({ error, retry })
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
const leafRoute = matched[matched.length - 1].route;
|
|
522
|
+
let factory = maybeWrapInBoundary(wrapForSSR(leafRoute, matched.length - 1), resolveFallback(leafRoute));
|
|
419
523
|
for (let i = matched.length - 2;i >= startAt; i--) {
|
|
420
524
|
const level = levels[i];
|
|
421
525
|
const childFactory = factory;
|
|
422
526
|
level.childSignal.value = childFactory;
|
|
423
|
-
const parentComponent = wrapForSSR(level.route, i);
|
|
527
|
+
const parentComponent = maybeWrapInBoundary(wrapForSSR(level.route, i), resolveFallback(level.route));
|
|
424
528
|
const cs = level.childSignal;
|
|
425
529
|
factory = () => {
|
|
426
530
|
let result;
|
|
@@ -451,4 +555,4 @@ function useSearchParams(searchSignal) {
|
|
|
451
555
|
return searchSignal.value;
|
|
452
556
|
}
|
|
453
557
|
|
|
454
|
-
export { createLink, Link, OutletContext, Outlet, RouterView, parseSearchParams, useSearchParams };
|
|
558
|
+
export { getCurrentErrorHandler, ErrorBoundary, createLink, Link, OutletContext, Outlet, RouterView, parseSearchParams, useSearchParams };
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SVG_NS,
|
|
3
|
+
isSVGTag,
|
|
4
|
+
normalizeSVGAttr,
|
|
5
|
+
styleObjectToString
|
|
6
|
+
} from "./chunk-h1fsr8kv.js";
|
|
7
|
+
import {
|
|
8
|
+
claimComment,
|
|
9
|
+
claimElement,
|
|
10
|
+
claimText,
|
|
11
|
+
deferredDomEffect,
|
|
12
|
+
domEffect,
|
|
13
|
+
enterChildren,
|
|
14
|
+
exitChildren,
|
|
15
|
+
getIsHydrating,
|
|
16
|
+
getSSRContext,
|
|
17
|
+
pauseHydration,
|
|
18
|
+
popScope,
|
|
19
|
+
pushScope,
|
|
20
|
+
resumeHydration,
|
|
21
|
+
runCleanups
|
|
22
|
+
} from "./chunk-ppr06jgn.js";
|
|
23
|
+
|
|
24
|
+
// src/dom/dom-adapter.ts
|
|
25
|
+
function createDOMAdapter() {
|
|
26
|
+
return {
|
|
27
|
+
createElement: (tag) => document.createElement(tag),
|
|
28
|
+
createElementNS: (ns, tag) => document.createElementNS(ns, tag),
|
|
29
|
+
createTextNode: (text) => document.createTextNode(text),
|
|
30
|
+
createComment: (text) => document.createComment(text),
|
|
31
|
+
createDocumentFragment: () => document.createDocumentFragment(),
|
|
32
|
+
isNode: (value) => typeof Node !== "undefined" && value instanceof Node
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/dom/adapter.ts
|
|
37
|
+
var RENDER_NODE_BRAND = Symbol.for("vertz:render-node");
|
|
38
|
+
function isRenderNode(value) {
|
|
39
|
+
if (value == null || typeof value !== "object")
|
|
40
|
+
return false;
|
|
41
|
+
if (RENDER_NODE_BRAND in value)
|
|
42
|
+
return true;
|
|
43
|
+
return typeof Node !== "undefined" && value instanceof Node;
|
|
44
|
+
}
|
|
45
|
+
var currentAdapter = null;
|
|
46
|
+
function getAdapter() {
|
|
47
|
+
const ctx = getSSRContext();
|
|
48
|
+
if (ctx)
|
|
49
|
+
return ctx.adapter;
|
|
50
|
+
if (!currentAdapter) {
|
|
51
|
+
currentAdapter = createDOMAdapter();
|
|
52
|
+
}
|
|
53
|
+
return currentAdapter;
|
|
54
|
+
}
|
|
55
|
+
function setAdapter(adapter) {
|
|
56
|
+
currentAdapter = adapter;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/dom/element.ts
|
|
60
|
+
var MAX_THUNK_DEPTH = 100;
|
|
61
|
+
function __text(fn) {
|
|
62
|
+
if (getIsHydrating()) {
|
|
63
|
+
const claimed = claimText();
|
|
64
|
+
if (claimed) {
|
|
65
|
+
const node2 = claimed;
|
|
66
|
+
node2.dispose = deferredDomEffect(() => {
|
|
67
|
+
node2.data = fn();
|
|
68
|
+
});
|
|
69
|
+
return node2;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const node = getAdapter().createTextNode("");
|
|
73
|
+
node.dispose = domEffect(() => {
|
|
74
|
+
node.data = fn();
|
|
75
|
+
});
|
|
76
|
+
return node;
|
|
77
|
+
}
|
|
78
|
+
function resolveAndInsertAfter(anchor, value, managed, depth = 0) {
|
|
79
|
+
if (depth >= MAX_THUNK_DEPTH) {
|
|
80
|
+
throw new Error("resolveAndInsertAfter: max recursion depth exceeded — possible circular thunk");
|
|
81
|
+
}
|
|
82
|
+
if (value == null || typeof value === "boolean")
|
|
83
|
+
return;
|
|
84
|
+
if (typeof value === "function") {
|
|
85
|
+
resolveAndInsertAfter(anchor, value(), managed, depth + 1);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(value)) {
|
|
89
|
+
for (const item of value) {
|
|
90
|
+
resolveAndInsertAfter(anchor, item, managed, depth);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const node = isRenderNode(value) ? value : getAdapter().createTextNode(typeof value === "string" ? value : String(value));
|
|
95
|
+
if (node.nodeType === 11) {
|
|
96
|
+
const children = Array.from(node.childNodes);
|
|
97
|
+
for (const child of children) {
|
|
98
|
+
const insertAfter2 = managed.length > 0 ? managed[managed.length - 1] : anchor;
|
|
99
|
+
insertAfter2.parentNode.insertBefore(child, insertAfter2.nextSibling);
|
|
100
|
+
managed.push(child);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const insertAfter = managed.length > 0 ? managed[managed.length - 1] : anchor;
|
|
105
|
+
insertAfter.parentNode.insertBefore(node, insertAfter.nextSibling);
|
|
106
|
+
managed.push(node);
|
|
107
|
+
}
|
|
108
|
+
function childEffect(anchor, fn, managed, childCleanups) {
|
|
109
|
+
return domEffect(() => {
|
|
110
|
+
runCleanups(childCleanups.value);
|
|
111
|
+
const scope = pushScope();
|
|
112
|
+
const value = fn();
|
|
113
|
+
popScope();
|
|
114
|
+
childCleanups.value = scope;
|
|
115
|
+
if (managed.length === 1 && isRenderNode(value) && managed[0] === value) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (managed.length === 1 && managed[0].nodeType === 3 && !isRenderNode(value) && value != null && typeof value !== "boolean" && typeof value !== "function") {
|
|
119
|
+
const text = typeof value === "string" ? value : String(value);
|
|
120
|
+
managed[0].data = text;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
for (const node of managed) {
|
|
124
|
+
node.parentNode?.removeChild(node);
|
|
125
|
+
}
|
|
126
|
+
managed.length = 0;
|
|
127
|
+
resolveAndInsertAfter(anchor, value, managed);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function __child(fn) {
|
|
131
|
+
if (getIsHydrating()) {
|
|
132
|
+
const claimed = claimComment();
|
|
133
|
+
if (claimed) {
|
|
134
|
+
const anchor2 = claimed;
|
|
135
|
+
const managed2 = [];
|
|
136
|
+
const childCleanups2 = { value: [] };
|
|
137
|
+
let sibling = anchor2.nextSibling;
|
|
138
|
+
while (sibling) {
|
|
139
|
+
if (sibling.nodeType === 8 && sibling.data.trim() === "child") {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
const next = sibling.nextSibling;
|
|
143
|
+
sibling.parentNode?.removeChild(sibling);
|
|
144
|
+
sibling = next;
|
|
145
|
+
}
|
|
146
|
+
pauseHydration();
|
|
147
|
+
try {
|
|
148
|
+
const dispose2 = childEffect(anchor2, ((originalFn) => () => {
|
|
149
|
+
const needsPause = getIsHydrating();
|
|
150
|
+
if (needsPause)
|
|
151
|
+
pauseHydration();
|
|
152
|
+
try {
|
|
153
|
+
return originalFn();
|
|
154
|
+
} finally {
|
|
155
|
+
if (needsPause)
|
|
156
|
+
resumeHydration();
|
|
157
|
+
}
|
|
158
|
+
})(fn), managed2, childCleanups2);
|
|
159
|
+
const result2 = Object.assign(anchor2, {
|
|
160
|
+
dispose: () => {
|
|
161
|
+
runCleanups(childCleanups2.value);
|
|
162
|
+
dispose2();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return result2;
|
|
166
|
+
} finally {
|
|
167
|
+
resumeHydration();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const anchor = getAdapter().createComment("child");
|
|
172
|
+
const fragment = getAdapter().createDocumentFragment();
|
|
173
|
+
fragment.appendChild(anchor);
|
|
174
|
+
const managed = [];
|
|
175
|
+
const childCleanups = { value: [] };
|
|
176
|
+
const dispose = childEffect(anchor, fn, managed, childCleanups);
|
|
177
|
+
const result = Object.assign(fragment, {
|
|
178
|
+
dispose: () => {
|
|
179
|
+
runCleanups(childCleanups.value);
|
|
180
|
+
dispose();
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
function resolveAndInsert(parent, value, depth = 0) {
|
|
186
|
+
if (depth >= MAX_THUNK_DEPTH) {
|
|
187
|
+
throw new Error("__insert: max recursion depth exceeded — possible circular thunk");
|
|
188
|
+
}
|
|
189
|
+
if (value == null || typeof value === "boolean") {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (typeof value === "function") {
|
|
193
|
+
resolveAndInsert(parent, value(), depth + 1);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (Array.isArray(value)) {
|
|
197
|
+
for (const item of value) {
|
|
198
|
+
resolveAndInsert(parent, item, depth);
|
|
199
|
+
}
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
insertLeaf(parent, value);
|
|
203
|
+
}
|
|
204
|
+
function insertLeaf(parent, value) {
|
|
205
|
+
if (getIsHydrating()) {
|
|
206
|
+
if (isRenderNode(value)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
claimText();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (isRenderNode(value)) {
|
|
213
|
+
parent.appendChild(value);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const text = typeof value === "string" ? value : String(value);
|
|
217
|
+
parent.appendChild(getAdapter().createTextNode(text));
|
|
218
|
+
}
|
|
219
|
+
function __insert(parent, value) {
|
|
220
|
+
if (value == null || typeof value === "boolean") {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
resolveAndInsert(parent, value);
|
|
224
|
+
}
|
|
225
|
+
function __element(tag, props) {
|
|
226
|
+
if (getIsHydrating()) {
|
|
227
|
+
const claimed = claimElement(tag);
|
|
228
|
+
if (claimed) {
|
|
229
|
+
if (props && typeof process !== "undefined" && true) {
|
|
230
|
+
for (const [key, value] of Object.entries(props)) {
|
|
231
|
+
if (key === "role" || key.startsWith("aria-")) {
|
|
232
|
+
const actual = claimed.getAttribute(key);
|
|
233
|
+
if (actual !== value) {
|
|
234
|
+
console.warn(`[hydrate] ARIA mismatch on <${tag}>: ${key}="${actual}" (expected "${value}")`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return claimed;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const adapter = getAdapter();
|
|
243
|
+
const svg = isSVGTag(tag);
|
|
244
|
+
const el = svg ? adapter.createElementNS(SVG_NS, tag) : adapter.createElement(tag);
|
|
245
|
+
if (props) {
|
|
246
|
+
for (const [key, value] of Object.entries(props)) {
|
|
247
|
+
const attrName = svg ? normalizeSVGAttr(key) : key;
|
|
248
|
+
el.setAttribute(attrName, value);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return el;
|
|
252
|
+
}
|
|
253
|
+
function __append(parent, child) {
|
|
254
|
+
if (getIsHydrating())
|
|
255
|
+
return;
|
|
256
|
+
parent.appendChild(child);
|
|
257
|
+
}
|
|
258
|
+
function __staticText(text) {
|
|
259
|
+
if (getIsHydrating()) {
|
|
260
|
+
const claimed = claimText();
|
|
261
|
+
if (claimed)
|
|
262
|
+
return claimed;
|
|
263
|
+
}
|
|
264
|
+
return getAdapter().createTextNode(text);
|
|
265
|
+
}
|
|
266
|
+
function __enterChildren(el) {
|
|
267
|
+
if (getIsHydrating()) {
|
|
268
|
+
enterChildren(el);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function __exitChildren() {
|
|
272
|
+
if (getIsHydrating()) {
|
|
273
|
+
exitChildren();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// src/dom/attributes.ts
|
|
278
|
+
function __attr(el, name, fn) {
|
|
279
|
+
return deferredDomEffect(() => {
|
|
280
|
+
const value = fn();
|
|
281
|
+
if (value == null || value === false) {
|
|
282
|
+
el.removeAttribute(name);
|
|
283
|
+
} else if (value === true) {
|
|
284
|
+
el.setAttribute(name, "");
|
|
285
|
+
} else if (name === "style" && typeof value === "object") {
|
|
286
|
+
el.setAttribute(name, styleObjectToString(value));
|
|
287
|
+
} else {
|
|
288
|
+
el.setAttribute(name, value);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function __prop(el, name, fn) {
|
|
293
|
+
return deferredDomEffect(() => {
|
|
294
|
+
const value = fn();
|
|
295
|
+
if (value == null) {
|
|
296
|
+
Reflect.set(el, name, typeof Reflect.get(el, name) === "boolean" ? false : "");
|
|
297
|
+
} else {
|
|
298
|
+
Reflect.set(el, name, value);
|
|
299
|
+
}
|
|
300
|
+
if (name === "selected") {
|
|
301
|
+
if (value) {
|
|
302
|
+
el.setAttribute(name, "");
|
|
303
|
+
} else {
|
|
304
|
+
el.removeAttribute(name);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function __show(el, fn) {
|
|
310
|
+
const originalDisplay = el.style.display;
|
|
311
|
+
return deferredDomEffect(() => {
|
|
312
|
+
el.style.display = fn() ? originalDisplay : "none";
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function __classList(el, classMap) {
|
|
316
|
+
const disposers = [];
|
|
317
|
+
for (const [className, fn] of Object.entries(classMap)) {
|
|
318
|
+
disposers.push(deferredDomEffect(() => {
|
|
319
|
+
if (fn()) {
|
|
320
|
+
el.classList.add(className);
|
|
321
|
+
} else {
|
|
322
|
+
el.classList.remove(className);
|
|
323
|
+
}
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
return () => {
|
|
327
|
+
for (const dispose of disposers) {
|
|
328
|
+
dispose();
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export { createDOMAdapter, RENDER_NODE_BRAND, isRenderNode, getAdapter, setAdapter, __text, __child, __insert, __element, __append, __staticText, __enterChildren, __exitChildren, __attr, __prop, __show, __classList };
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from "./chunk-jrtrk5z4.js";
|
|
8
8
|
import {
|
|
9
9
|
isBrowser
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-xs5s8gqe.js";
|
|
11
11
|
import {
|
|
12
12
|
getSSRContext,
|
|
13
13
|
signal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ppr06jgn.js";
|
|
15
15
|
|
|
16
16
|
// src/router/view-transitions.ts
|
|
17
17
|
var transitionGen = 0;
|
|
@@ -1,3 +1,69 @@
|
|
|
1
|
+
// src/dom/svg-tags.ts
|
|
2
|
+
var SVG_TAGS = new Set([
|
|
3
|
+
"svg",
|
|
4
|
+
"path",
|
|
5
|
+
"circle",
|
|
6
|
+
"ellipse",
|
|
7
|
+
"rect",
|
|
8
|
+
"line",
|
|
9
|
+
"polyline",
|
|
10
|
+
"polygon",
|
|
11
|
+
"g",
|
|
12
|
+
"defs",
|
|
13
|
+
"symbol",
|
|
14
|
+
"use",
|
|
15
|
+
"text",
|
|
16
|
+
"tspan",
|
|
17
|
+
"image",
|
|
18
|
+
"foreignObject",
|
|
19
|
+
"filter",
|
|
20
|
+
"feGaussianBlur",
|
|
21
|
+
"feOffset",
|
|
22
|
+
"feColorMatrix",
|
|
23
|
+
"feBlend",
|
|
24
|
+
"feMerge",
|
|
25
|
+
"feMergeNode",
|
|
26
|
+
"feComposite",
|
|
27
|
+
"feFlood",
|
|
28
|
+
"linearGradient",
|
|
29
|
+
"radialGradient",
|
|
30
|
+
"stop",
|
|
31
|
+
"pattern",
|
|
32
|
+
"clipPath",
|
|
33
|
+
"mask",
|
|
34
|
+
"animate",
|
|
35
|
+
"animateTransform",
|
|
36
|
+
"set",
|
|
37
|
+
"marker",
|
|
38
|
+
"desc"
|
|
39
|
+
]);
|
|
40
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
41
|
+
function isSVGTag(tag) {
|
|
42
|
+
return SVG_TAGS.has(tag);
|
|
43
|
+
}
|
|
44
|
+
var SVG_ATTR_MAP = {
|
|
45
|
+
strokeWidth: "stroke-width",
|
|
46
|
+
strokeLinecap: "stroke-linecap",
|
|
47
|
+
strokeLinejoin: "stroke-linejoin",
|
|
48
|
+
strokeDasharray: "stroke-dasharray",
|
|
49
|
+
strokeDashoffset: "stroke-dashoffset",
|
|
50
|
+
strokeOpacity: "stroke-opacity",
|
|
51
|
+
fillOpacity: "fill-opacity",
|
|
52
|
+
fillRule: "fill-rule",
|
|
53
|
+
clipRule: "clip-rule",
|
|
54
|
+
clipPath: "clip-path",
|
|
55
|
+
stopColor: "stop-color",
|
|
56
|
+
stopOpacity: "stop-opacity",
|
|
57
|
+
floodColor: "flood-color",
|
|
58
|
+
floodOpacity: "flood-opacity",
|
|
59
|
+
colorInterpolation: "color-interpolation",
|
|
60
|
+
colorInterpolationFilters: "color-interpolation-filters",
|
|
61
|
+
viewBox: "viewBox"
|
|
62
|
+
};
|
|
63
|
+
function normalizeSVGAttr(attr) {
|
|
64
|
+
return SVG_ATTR_MAP[attr] ?? attr;
|
|
65
|
+
}
|
|
66
|
+
|
|
1
67
|
// src/dom/style.ts
|
|
2
68
|
function camelToKebab(prop) {
|
|
3
69
|
const third = prop[2];
|
|
@@ -70,4 +136,4 @@ function styleObjectToString(style) {
|
|
|
70
136
|
return parts.join("; ");
|
|
71
137
|
}
|
|
72
138
|
|
|
73
|
-
export { styleObjectToString };
|
|
139
|
+
export { SVG_NS, isSVGTag, normalizeSVGAttr, styleObjectToString };
|