@absolutejs/absolute 0.19.0-beta.823 → 0.19.0-beta.825
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-GQ5fnl/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-GQ5fnl/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-GQ5fnl/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -23,29 +23,33 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const id = registry.nextRouteId();
|
|
26
|
-
|
|
26
|
+
const registrationOrder = Number(id.slice(1));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Register synchronously at script-body time so SSR (which doesn't
|
|
29
|
+
// run $effect) sees the registration. On the client, $effect
|
|
30
|
+
// re-registers when path or basepath changes.
|
|
31
|
+
const initialCompiled = compilePattern(
|
|
32
|
+
joinBasepath(registry.basepath, path)
|
|
33
|
+
);
|
|
34
|
+
registry.register(id, {
|
|
35
|
+
pattern: initialCompiled,
|
|
36
|
+
registrationOrder
|
|
37
|
+
});
|
|
30
38
|
|
|
31
39
|
$effect(() => {
|
|
32
|
-
registrationOrder = Number(id.slice(1));
|
|
33
40
|
registry.register(id, {
|
|
34
|
-
pattern:
|
|
41
|
+
pattern: compilePattern(joinBasepath(registry.basepath, path)),
|
|
35
42
|
registrationOrder
|
|
36
43
|
});
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
onDestroy(() => registry.deregister(id));
|
|
40
|
-
|
|
41
|
-
const isWinner = $derived(registry.isWinner(id));
|
|
42
|
-
const match = $derived(
|
|
43
|
-
isWinner
|
|
44
|
-
? matchPattern<Path>(compiled, page.url.pathname)
|
|
45
|
-
: { matched: false as const }
|
|
46
|
-
);
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
|
-
{#if
|
|
50
|
-
{@
|
|
49
|
+
{#if registry.isWinner(id)}
|
|
50
|
+
{@const compiled = compilePattern(joinBasepath(registry.basepath, path))}
|
|
51
|
+
{@const match = matchPattern<Path>(compiled, page.url.pathname)}
|
|
52
|
+
{#if match.matched}
|
|
53
|
+
{@render content(match.params)}
|
|
54
|
+
{/if}
|
|
51
55
|
{/if}
|
|
@@ -60,25 +60,13 @@
|
|
|
60
60
|
|
|
61
61
|
// Specificity ranking across siblings: each <Route> registers with
|
|
62
62
|
// its compiled pattern + a stable mount-order index. The winner is
|
|
63
|
-
//
|
|
64
|
-
//
|
|
63
|
+
// recomputed eagerly inside `isWinner()` rather than via $derived —
|
|
64
|
+
// that avoids an SSR timing edge where $derived caches a value from
|
|
65
|
+
// before later siblings have registered.
|
|
65
66
|
const routes = $state(new Map<string, CompiledPatternBox>());
|
|
66
67
|
let routeCounter = 0;
|
|
67
68
|
|
|
68
|
-
const
|
|
69
|
-
basepath: stackedBasepath,
|
|
70
|
-
deregister: (id) => {
|
|
71
|
-
routes.delete(id);
|
|
72
|
-
},
|
|
73
|
-
isWinner: (id) => winnerId === id,
|
|
74
|
-
mode: stackedMode,
|
|
75
|
-
nextRouteId: () => `r${routeCounter++}`,
|
|
76
|
-
register: (id, entry) => {
|
|
77
|
-
routes.set(id, entry);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const winnerId = $derived.by(() => {
|
|
69
|
+
const computeWinnerId = () => {
|
|
82
70
|
let bestId: string | null = null;
|
|
83
71
|
let bestScore = -Infinity;
|
|
84
72
|
let bestOrder = Infinity;
|
|
@@ -99,7 +87,20 @@
|
|
|
99
87
|
}
|
|
100
88
|
|
|
101
89
|
return bestId;
|
|
102
|
-
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const registry: RouterRegistry = {
|
|
93
|
+
basepath: stackedBasepath,
|
|
94
|
+
deregister: (id) => {
|
|
95
|
+
routes.delete(id);
|
|
96
|
+
},
|
|
97
|
+
isWinner: (id) => computeWinnerId() === id,
|
|
98
|
+
mode: stackedMode,
|
|
99
|
+
nextRouteId: () => `r${routeCounter++}`,
|
|
100
|
+
register: (id, entry) => {
|
|
101
|
+
routes.set(id, entry);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
103
104
|
|
|
104
105
|
setContext<RouterRegistry>(ROUTER_CONTEXT_KEY, registry);
|
|
105
106
|
|
package/package.json
CHANGED