@vertz/ui 0.2.22 → 0.2.24
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-pdqr78k9.js → chunk-18frwfc4.js} +1 -1
- package/dist/shared/chunk-2eh4p2n7.js +39 -0
- package/dist/shared/{chunk-67z8b0q8.js → chunk-2wag9c7v.js} +182 -53
- package/dist/shared/{chunk-c61572xp.js → chunk-2y9f9j62.js} +1 -1
- package/dist/shared/{chunk-szk0hyjg.js → chunk-4gen306a.js} +212 -155
- package/dist/shared/{chunk-yb4a0smw.js → chunk-4gmtsf6v.js} +1 -1
- package/dist/shared/{chunk-2qe6aqhb.js → chunk-656n0x6y.js} +48 -48
- package/dist/shared/{chunk-bybgyjye.js → chunk-da2w7j7w.js} +1 -1
- package/dist/shared/{chunk-4cmt1ve8.js → chunk-f4d5nphq.js} +1 -1
- package/dist/shared/chunk-ge2e6y2s.js +102 -0
- package/dist/shared/{chunk-4xkw6h1s.js → chunk-h1fsr8kv.js} +67 -1
- package/dist/shared/{chunk-7g722pdh.js → chunk-jtma4sh4.js} +2 -2
- package/dist/shared/{chunk-vwz86vg9.js → chunk-mbnda3pv.js} +96 -18
- package/dist/shared/{chunk-pq8khh47.js → chunk-t3rnfxc0.js} +64 -23
- package/dist/src/auth/public.d.ts +35 -1
- package/dist/src/auth/public.js +72 -3
- package/dist/src/components/index.d.ts +2 -2
- package/dist/src/components/index.js +51 -46
- package/dist/src/css/public.d.ts +7 -3
- package/dist/src/css/public.js +5 -5
- package/dist/src/form/public.js +2 -2
- package/dist/src/index.d.ts +211 -39
- package/dist/src/index.js +372 -153
- package/dist/src/internals.d.ts +70 -6
- package/dist/src/internals.js +161 -34
- package/dist/src/jsx-runtime/index.js +3 -5
- package/dist/src/query/public.d.ts +7 -3
- package/dist/src/query/public.js +5 -4
- package/dist/src/router/public.d.ts +27 -4
- package/dist/src/router/public.js +9 -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-kjwp5q5s.js +0 -53
- package/dist/shared/chunk-prj7nm08.js +0 -67
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getSSRContext
|
|
3
|
+
} from "./chunk-656n0x6y.js";
|
|
4
|
+
|
|
5
|
+
// src/query/invalidate.ts
|
|
6
|
+
var registry = new Set;
|
|
7
|
+
function registerActiveQuery(entityMeta, refetch, clearData) {
|
|
8
|
+
const registration = { entityMeta, refetch, clearData };
|
|
9
|
+
registry.add(registration);
|
|
10
|
+
return () => registry.delete(registration);
|
|
11
|
+
}
|
|
12
|
+
function invalidate(descriptor) {
|
|
13
|
+
const meta = descriptor._entity;
|
|
14
|
+
if (!meta)
|
|
15
|
+
return;
|
|
16
|
+
if (meta.kind === "get" && !meta.id)
|
|
17
|
+
return;
|
|
18
|
+
for (const reg of [...registry]) {
|
|
19
|
+
if (reg.entityMeta.entityType !== meta.entityType)
|
|
20
|
+
continue;
|
|
21
|
+
if (reg.entityMeta.kind !== meta.kind)
|
|
22
|
+
continue;
|
|
23
|
+
if (meta.kind === "get" && reg.entityMeta.id !== meta.id)
|
|
24
|
+
continue;
|
|
25
|
+
reg.refetch();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function invalidateTenantQueries() {
|
|
29
|
+
if (getSSRContext() !== undefined)
|
|
30
|
+
return;
|
|
31
|
+
for (const reg of [...registry]) {
|
|
32
|
+
if (reg.entityMeta.tenantScoped !== true)
|
|
33
|
+
continue;
|
|
34
|
+
reg.clearData?.();
|
|
35
|
+
reg.refetch();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { registerActiveQuery, invalidate, invalidateTenantQueries };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
__on,
|
|
3
|
+
beginDeferringMounts,
|
|
4
|
+
discardDeferredMounts,
|
|
5
|
+
flushDeferredMounts
|
|
6
|
+
} from "./chunk-ge2e6y2s.js";
|
|
5
7
|
import {
|
|
6
8
|
__append,
|
|
9
|
+
__classList,
|
|
7
10
|
__element,
|
|
8
11
|
__enterChildren,
|
|
9
12
|
__exitChildren,
|
|
10
13
|
__staticText
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-mbnda3pv.js";
|
|
12
15
|
import {
|
|
13
16
|
RouterContext
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-f4d5nphq.js";
|
|
15
18
|
import {
|
|
16
19
|
isBrowser
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-da2w7j7w.js";
|
|
18
21
|
import {
|
|
19
22
|
_tryOnCleanup,
|
|
20
23
|
createContext,
|
|
@@ -29,7 +32,65 @@ import {
|
|
|
29
32
|
startHydration,
|
|
30
33
|
untrack,
|
|
31
34
|
useContext
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-656n0x6y.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
|
+
}
|
|
33
94
|
|
|
34
95
|
// src/router/link.ts
|
|
35
96
|
var DANGEROUS_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
@@ -191,32 +252,43 @@ function Outlet() {
|
|
|
191
252
|
return;
|
|
192
253
|
let node;
|
|
193
254
|
childCleanups = pushScope();
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
255
|
+
try {
|
|
256
|
+
if (wasHydrating) {
|
|
257
|
+
beginDeferringMounts();
|
|
258
|
+
startHydration(container);
|
|
259
|
+
let miniHydrationOk = false;
|
|
260
|
+
try {
|
|
261
|
+
RouterContext.Provider(router, () => {
|
|
262
|
+
node = mod.default();
|
|
263
|
+
__append(container, node);
|
|
264
|
+
});
|
|
265
|
+
miniHydrationOk = true;
|
|
266
|
+
} finally {
|
|
267
|
+
endHydration();
|
|
268
|
+
if (miniHydrationOk) {
|
|
269
|
+
flushDeferredMounts();
|
|
270
|
+
} else {
|
|
271
|
+
discardDeferredMounts();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (!container.contains(node)) {
|
|
275
|
+
while (container.firstChild) {
|
|
276
|
+
container.removeChild(container.firstChild);
|
|
277
|
+
}
|
|
278
|
+
container.appendChild(node);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
while (container.firstChild) {
|
|
282
|
+
container.removeChild(container.firstChild);
|
|
283
|
+
}
|
|
197
284
|
RouterContext.Provider(router, () => {
|
|
198
285
|
node = mod.default();
|
|
199
286
|
__append(container, node);
|
|
200
287
|
});
|
|
201
|
-
} finally {
|
|
202
|
-
endHydration();
|
|
203
288
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
container.removeChild(container.firstChild);
|
|
207
|
-
}
|
|
208
|
-
container.appendChild(node);
|
|
209
|
-
}
|
|
210
|
-
} else {
|
|
211
|
-
while (container.firstChild) {
|
|
212
|
-
container.removeChild(container.firstChild);
|
|
213
|
-
}
|
|
214
|
-
RouterContext.Provider(router, () => {
|
|
215
|
-
node = mod.default();
|
|
216
|
-
__append(container, node);
|
|
217
|
-
});
|
|
289
|
+
} finally {
|
|
290
|
+
popScope();
|
|
218
291
|
}
|
|
219
|
-
popScope();
|
|
220
292
|
});
|
|
221
293
|
} else {
|
|
222
294
|
__append(container, result);
|
|
@@ -242,12 +314,13 @@ function Outlet() {
|
|
|
242
314
|
}
|
|
243
315
|
|
|
244
316
|
// src/router/router-view.ts
|
|
245
|
-
function RouterView({ router, fallback }) {
|
|
317
|
+
function RouterView({ router, fallback, errorFallback }) {
|
|
246
318
|
const container = __element("div");
|
|
247
319
|
let isFirstHydrationRender = getIsHydrating();
|
|
248
320
|
let renderGen = 0;
|
|
249
321
|
let pageCleanups = [];
|
|
250
322
|
let prevLevels = [];
|
|
323
|
+
let prevParamsKey;
|
|
251
324
|
__enterChildren(container);
|
|
252
325
|
const dispose = domEffect(() => {
|
|
253
326
|
const match = router.current.value;
|
|
@@ -260,17 +333,23 @@ function RouterView({ router, fallback }) {
|
|
|
260
333
|
if (prevLevels[divergeAt].route !== newMatched[divergeAt].route)
|
|
261
334
|
break;
|
|
262
335
|
}
|
|
263
|
-
|
|
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) {
|
|
264
339
|
return;
|
|
265
340
|
}
|
|
341
|
+
if (chainIdentical) {
|
|
342
|
+
divergeAt = 0;
|
|
343
|
+
}
|
|
266
344
|
if (divergeAt > 0 && newMatched.length > 0) {
|
|
267
345
|
const newLevels = buildLevels(newMatched);
|
|
268
|
-
const newChildFactory = buildInsideOutFactory(newMatched, newLevels, divergeAt, router);
|
|
346
|
+
const newChildFactory = buildInsideOutFactory(newMatched, newLevels, divergeAt, router, errorFallback);
|
|
269
347
|
const parentLevel = prevLevels[divergeAt - 1];
|
|
270
348
|
if (parentLevel.childSignal) {
|
|
271
349
|
parentLevel.childSignal.value = newChildFactory;
|
|
272
350
|
}
|
|
273
351
|
prevLevels = [...prevLevels.slice(0, divergeAt), ...newLevels.slice(divergeAt)];
|
|
352
|
+
prevParamsKey = currentParamsKey;
|
|
274
353
|
return;
|
|
275
354
|
}
|
|
276
355
|
runCleanups(pageCleanups);
|
|
@@ -285,6 +364,7 @@ function RouterView({ router, fallback }) {
|
|
|
285
364
|
pageCleanups = pushScope();
|
|
286
365
|
if (!match) {
|
|
287
366
|
prevLevels = [];
|
|
367
|
+
prevParamsKey = undefined;
|
|
288
368
|
if (fallback) {
|
|
289
369
|
container.appendChild(fallback());
|
|
290
370
|
}
|
|
@@ -292,7 +372,8 @@ function RouterView({ router, fallback }) {
|
|
|
292
372
|
return;
|
|
293
373
|
}
|
|
294
374
|
const levels = buildLevels(newMatched);
|
|
295
|
-
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;
|
|
296
377
|
let asyncRoute = false;
|
|
297
378
|
RouterContext.Provider(router, () => {
|
|
298
379
|
const result = rootFactory();
|
|
@@ -304,34 +385,69 @@ function RouterView({ router, fallback }) {
|
|
|
304
385
|
return;
|
|
305
386
|
let node;
|
|
306
387
|
pageCleanups = pushScope();
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
388
|
+
try {
|
|
389
|
+
if (wasHydrating) {
|
|
390
|
+
beginDeferringMounts();
|
|
391
|
+
startHydration(container);
|
|
392
|
+
let miniHydrationOk = false;
|
|
393
|
+
try {
|
|
394
|
+
RouterContext.Provider(router, () => {
|
|
395
|
+
node = mod.default();
|
|
396
|
+
__append(container, node);
|
|
397
|
+
});
|
|
398
|
+
miniHydrationOk = true;
|
|
399
|
+
} finally {
|
|
400
|
+
endHydration();
|
|
401
|
+
if (miniHydrationOk) {
|
|
402
|
+
flushDeferredMounts();
|
|
403
|
+
} else {
|
|
404
|
+
discardDeferredMounts();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (!container.contains(node)) {
|
|
408
|
+
while (container.firstChild) {
|
|
409
|
+
container.removeChild(container.firstChild);
|
|
410
|
+
}
|
|
411
|
+
container.appendChild(node);
|
|
412
|
+
}
|
|
413
|
+
} else {
|
|
414
|
+
while (container.firstChild) {
|
|
415
|
+
container.removeChild(container.firstChild);
|
|
416
|
+
}
|
|
310
417
|
RouterContext.Provider(router, () => {
|
|
311
418
|
node = mod.default();
|
|
312
|
-
|
|
419
|
+
container.appendChild(node);
|
|
313
420
|
});
|
|
314
|
-
} finally {
|
|
315
|
-
endHydration();
|
|
316
421
|
}
|
|
317
|
-
|
|
422
|
+
} catch (thrown) {
|
|
423
|
+
if (lazyFallback) {
|
|
424
|
+
const error = thrown instanceof Error ? thrown : new Error(String(thrown));
|
|
318
425
|
while (container.firstChild) {
|
|
319
426
|
container.removeChild(container.firstChild);
|
|
320
427
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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;
|
|
326
442
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
container.appendChild(node);
|
|
330
|
-
});
|
|
443
|
+
} finally {
|
|
444
|
+
popScope();
|
|
331
445
|
}
|
|
332
|
-
popScope();
|
|
333
446
|
});
|
|
334
447
|
} else {
|
|
448
|
+
if (gen !== renderGen) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
335
451
|
__append(container, result);
|
|
336
452
|
if (getIsHydrating() && !container.contains(result)) {
|
|
337
453
|
while (container.firstChild) {
|
|
@@ -341,7 +457,10 @@ function RouterView({ router, fallback }) {
|
|
|
341
457
|
}
|
|
342
458
|
}
|
|
343
459
|
});
|
|
344
|
-
|
|
460
|
+
if (gen === renderGen) {
|
|
461
|
+
prevLevels = levels;
|
|
462
|
+
prevParamsKey = currentParamsKey;
|
|
463
|
+
}
|
|
345
464
|
if (!asyncRoute) {
|
|
346
465
|
popScope();
|
|
347
466
|
}
|
|
@@ -362,7 +481,7 @@ function buildLevels(matched) {
|
|
|
362
481
|
route: m.route
|
|
363
482
|
}));
|
|
364
483
|
}
|
|
365
|
-
function buildInsideOutFactory(matched, levels, startAt, router) {
|
|
484
|
+
function buildInsideOutFactory(matched, levels, startAt, router, errorFallback) {
|
|
366
485
|
const ssrCtx = getSSRContext();
|
|
367
486
|
const wrapForSSR = (route, routeIndex) => {
|
|
368
487
|
if (!ssrCtx)
|
|
@@ -390,12 +509,22 @@ function buildInsideOutFactory(matched, levels, startAt, router) {
|
|
|
390
509
|
return result;
|
|
391
510
|
};
|
|
392
511
|
};
|
|
393
|
-
|
|
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));
|
|
394
523
|
for (let i = matched.length - 2;i >= startAt; i--) {
|
|
395
524
|
const level = levels[i];
|
|
396
525
|
const childFactory = factory;
|
|
397
526
|
level.childSignal.value = childFactory;
|
|
398
|
-
const parentComponent = wrapForSSR(level.route, i);
|
|
527
|
+
const parentComponent = maybeWrapInBoundary(wrapForSSR(level.route, i), resolveFallback(level.route));
|
|
399
528
|
const cs = level.childSignal;
|
|
400
529
|
factory = () => {
|
|
401
530
|
let result;
|
|
@@ -426,4 +555,4 @@ function useSearchParams(searchSignal) {
|
|
|
426
555
|
return searchSignal.value;
|
|
427
556
|
}
|
|
428
557
|
|
|
429
|
-
export { createLink, Link, OutletContext, Outlet, RouterView, parseSearchParams, useSearchParams };
|
|
558
|
+
export { getCurrentErrorHandler, ErrorBoundary, createLink, Link, OutletContext, Outlet, RouterView, parseSearchParams, useSearchParams };
|