vorma 0.0.0-pre.0 → 0.82.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/LICENSE +28 -0
- package/README.md +48 -0
- package/internal/framework/_typescript/client/index.ts +64 -0
- package/internal/framework/_typescript/client/src/asset_manager.ts +67 -0
- package/internal/framework/_typescript/client/src/client.ts +1201 -0
- package/internal/framework/_typescript/client/src/client_loaders.ts +249 -0
- package/internal/framework/_typescript/client/src/component_loader.ts +105 -0
- package/internal/framework/_typescript/client/src/error_boundary.ts +7 -0
- package/internal/framework/_typescript/client/src/events.ts +54 -0
- package/internal/framework/_typescript/client/src/global_loading_indicator/global_loading_indicator.ts +125 -0
- package/internal/framework/_typescript/client/src/hard_reload.ts +1 -0
- package/internal/framework/_typescript/client/src/head_elements/head_elements.ts +193 -0
- package/internal/framework/_typescript/client/src/history/history.ts +118 -0
- package/internal/framework/_typescript/client/src/history/npm_history_types.ts +83 -0
- package/internal/framework/_typescript/client/src/hmr/hmr.ts +71 -0
- package/internal/framework/_typescript/client/src/init_client.ts +134 -0
- package/internal/framework/_typescript/client/src/links.ts +218 -0
- package/internal/framework/_typescript/client/src/redirects/redirects.ts +203 -0
- package/internal/framework/_typescript/client/src/rendering.ts +135 -0
- package/internal/framework/_typescript/client/src/resolve_public_href.ts +15 -0
- package/internal/framework/_typescript/client/src/scroll_state_manager.ts +100 -0
- package/internal/framework/_typescript/client/src/static_route_defs/route_def_helpers.ts +22 -0
- package/internal/framework/_typescript/client/src/ui_lib_impl_helpers/link_components.ts +131 -0
- package/internal/framework/_typescript/client/src/ui_lib_impl_helpers/route_components.ts +56 -0
- package/internal/framework/_typescript/client/src/ui_lib_impl_helpers/typed_navigate.ts +58 -0
- package/internal/framework/_typescript/client/src/utils/errors.ts +10 -0
- package/internal/framework/_typescript/client/src/utils/logging.ts +7 -0
- package/internal/framework/_typescript/client/src/vorma_app_helpers/vorma_app_helpers.ts +290 -0
- package/internal/framework/_typescript/client/src/vorma_ctx/vorma_ctx.ts +128 -0
- package/internal/framework/_typescript/client/src/window_focus_revalidation/window_focus_revalidation.ts +32 -0
- package/internal/framework/_typescript/client/tsconfig.json +3 -0
- package/internal/framework/_typescript/create/main.ts +378 -0
- package/internal/framework/_typescript/create/package.json +33 -0
- package/internal/framework/_typescript/create/pnpm-lock.yaml +70 -0
- package/internal/framework/_typescript/create/tsconfig.json +3 -0
- package/internal/framework/_typescript/preact/index.tsx +10 -0
- package/internal/framework/_typescript/preact/src/helpers.ts +113 -0
- package/internal/framework/_typescript/preact/src/link.tsx +107 -0
- package/internal/framework/_typescript/preact/src/preact.tsx +191 -0
- package/internal/framework/_typescript/preact/tsconfig.json +7 -0
- package/internal/framework/_typescript/react/index.tsx +10 -0
- package/internal/framework/_typescript/react/src/helpers.ts +118 -0
- package/internal/framework/_typescript/react/src/link.tsx +115 -0
- package/internal/framework/_typescript/react/src/react.tsx +299 -0
- package/internal/framework/_typescript/react/tsconfig.json +6 -0
- package/internal/framework/_typescript/solid/index.tsx +10 -0
- package/internal/framework/_typescript/solid/src/helpers.ts +114 -0
- package/internal/framework/_typescript/solid/src/link.tsx +104 -0
- package/internal/framework/_typescript/solid/src/solid.tsx +204 -0
- package/internal/framework/_typescript/solid/tsconfig.json +7 -0
- package/internal/framework/_typescript/vite/tsconfig.json +3 -0
- package/internal/framework/_typescript/vite/vite.ts +93 -0
- package/internal/site/frontend/assets/vorma-banner.webp +0 -0
- package/kit/_typescript/converters/converters.ts +152 -0
- package/kit/_typescript/cookies/cookies.ts +18 -0
- package/kit/_typescript/csrf/csrf.ts +10 -0
- package/kit/_typescript/debounce/debounce.ts +17 -0
- package/kit/_typescript/fmt/fmt.ts +3 -0
- package/kit/_typescript/json/deep_equals.ts +54 -0
- package/kit/_typescript/json/json.ts +3 -0
- package/kit/_typescript/json/search_param_serializer.ts +49 -0
- package/kit/_typescript/json/stringify_stable.ts +43 -0
- package/kit/_typescript/listeners/listeners.ts +16 -0
- package/kit/_typescript/matcher/find_best_match.ts +205 -0
- package/kit/_typescript/matcher/find_nested_matches.ts +357 -0
- package/kit/_typescript/matcher/parse_segments.ts +30 -0
- package/kit/_typescript/matcher/register.ts +271 -0
- package/kit/_typescript/theme/theme.ts +166 -0
- package/kit/_typescript/tsconfig.json +3 -0
- package/kit/_typescript/url/url.ts +132 -0
- package/npm_dist/internal/framework/_typescript/client/index.d.ts +17 -0
- package/npm_dist/internal/framework/_typescript/client/index.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/index.js +2489 -0
- package/npm_dist/internal/framework/_typescript/client/index.js.map +7 -0
- package/npm_dist/internal/framework/_typescript/client/src/asset_manager.d.ts +6 -0
- package/npm_dist/internal/framework/_typescript/client/src/asset_manager.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/client.d.ts +119 -0
- package/npm_dist/internal/framework/_typescript/client/src/client.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/client_loaders.d.ts +18 -0
- package/npm_dist/internal/framework/_typescript/client/src/client_loaders.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/component_loader.d.ts +10 -0
- package/npm_dist/internal/framework/_typescript/client/src/component_loader.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/error_boundary.d.ts +3 -0
- package/npm_dist/internal/framework/_typescript/client/src/error_boundary.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/events.d.ts +26 -0
- package/npm_dist/internal/framework/_typescript/client/src/events.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/global_loading_indicator/global_loading_indicator.d.ts +12 -0
- package/npm_dist/internal/framework/_typescript/client/src/global_loading_indicator/global_loading_indicator.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/hard_reload.d.ts +2 -0
- package/npm_dist/internal/framework/_typescript/client/src/hard_reload.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/head_elements/head_elements.d.ts +7 -0
- package/npm_dist/internal/framework/_typescript/client/src/head_elements/head_elements.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/history/history.d.ts +14 -0
- package/npm_dist/internal/framework/_typescript/client/src/history/history.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/history/npm_history_types.d.ts +84 -0
- package/npm_dist/internal/framework/_typescript/client/src/history/npm_history_types.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/hmr/hmr.d.ts +3 -0
- package/npm_dist/internal/framework/_typescript/client/src/hmr/hmr.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/init_client.d.ts +9 -0
- package/npm_dist/internal/framework/_typescript/client/src/init_client.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/links.d.ts +33 -0
- package/npm_dist/internal/framework/_typescript/client/src/links.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/redirects/redirects.d.ts +26 -0
- package/npm_dist/internal/framework/_typescript/client/src/redirects/redirects.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/rendering.d.ts +18 -0
- package/npm_dist/internal/framework/_typescript/client/src/rendering.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/resolve_public_href.d.ts +2 -0
- package/npm_dist/internal/framework/_typescript/client/src/resolve_public_href.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/scroll_state_manager.d.ts +22 -0
- package/npm_dist/internal/framework/_typescript/client/src/scroll_state_manager.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/static_route_defs/route_def_helpers.d.ts +12 -0
- package/npm_dist/internal/framework/_typescript/client/src/static_route_defs/route_def_helpers.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/link_components.d.ts +28 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/link_components.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/route_components.d.ts +18 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/route_components.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/typed_navigate.d.ts +11 -0
- package/npm_dist/internal/framework/_typescript/client/src/ui_lib_impl_helpers/typed_navigate.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/utils/errors.d.ts +3 -0
- package/npm_dist/internal/framework/_typescript/client/src/utils/errors.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/utils/logging.d.ts +3 -0
- package/npm_dist/internal/framework/_typescript/client/src/utils/logging.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/vorma_app_helpers/vorma_app_helpers.d.ts +119 -0
- package/npm_dist/internal/framework/_typescript/client/src/vorma_app_helpers/vorma_app_helpers.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/vorma_ctx/vorma_ctx.d.ts +88 -0
- package/npm_dist/internal/framework/_typescript/client/src/vorma_ctx/vorma_ctx.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/client/src/window_focus_revalidation/window_focus_revalidation.d.ts +10 -0
- package/npm_dist/internal/framework/_typescript/client/src/window_focus_revalidation/window_focus_revalidation.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/create/main.d.ts +3 -0
- package/npm_dist/internal/framework/_typescript/create/main.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/preact/index.d.ts +4 -0
- package/npm_dist/internal/framework/_typescript/preact/index.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/preact/index.js +283 -0
- package/npm_dist/internal/framework/_typescript/preact/index.js.map +7 -0
- package/npm_dist/internal/framework/_typescript/preact/src/helpers.d.ts +21 -0
- package/npm_dist/internal/framework/_typescript/preact/src/helpers.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/preact/src/link.d.ts +11 -0
- package/npm_dist/internal/framework/_typescript/preact/src/link.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/preact/src/preact.d.ts +21 -0
- package/npm_dist/internal/framework/_typescript/preact/src/preact.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/react/index.d.ts +4 -0
- package/npm_dist/internal/framework/_typescript/react/index.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/react/index.js +370 -0
- package/npm_dist/internal/framework/_typescript/react/index.js.map +7 -0
- package/npm_dist/internal/framework/_typescript/react/src/helpers.d.ts +21 -0
- package/npm_dist/internal/framework/_typescript/react/src/helpers.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/react/src/link.d.ts +11 -0
- package/npm_dist/internal/framework/_typescript/react/src/link.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/react/src/react.d.ts +20 -0
- package/npm_dist/internal/framework/_typescript/react/src/react.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/solid/index.d.ts +4 -0
- package/npm_dist/internal/framework/_typescript/solid/index.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/solid/index.js +314 -0
- package/npm_dist/internal/framework/_typescript/solid/index.js.map +7 -0
- package/npm_dist/internal/framework/_typescript/solid/src/helpers.d.ts +22 -0
- package/npm_dist/internal/framework/_typescript/solid/src/helpers.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/solid/src/link.d.ts +11 -0
- package/npm_dist/internal/framework/_typescript/solid/src/link.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/solid/src/solid.d.ts +22 -0
- package/npm_dist/internal/framework/_typescript/solid/src/solid.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/vite/vite.d.ts +11 -0
- package/npm_dist/internal/framework/_typescript/vite/vite.d.ts.map +1 -0
- package/npm_dist/internal/framework/_typescript/vite/vite.js +82 -0
- package/npm_dist/internal/framework/_typescript/vite/vite.js.map +7 -0
- package/npm_dist/kit/_typescript/chunk-YBAPNBS2.js +202 -0
- package/npm_dist/kit/_typescript/chunk-YBAPNBS2.js.map +7 -0
- package/npm_dist/kit/_typescript/converters/converters.d.ts +26 -0
- package/npm_dist/kit/_typescript/converters/converters.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/converters/converters.js +99 -0
- package/npm_dist/kit/_typescript/converters/converters.js.map +7 -0
- package/npm_dist/kit/_typescript/cookies/cookies.d.ts +13 -0
- package/npm_dist/kit/_typescript/cookies/cookies.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/cookies/cookies.js +13 -0
- package/npm_dist/kit/_typescript/cookies/cookies.js.map +7 -0
- package/npm_dist/kit/_typescript/csrf/csrf.d.ts +5 -0
- package/npm_dist/kit/_typescript/csrf/csrf.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/csrf/csrf.js +11 -0
- package/npm_dist/kit/_typescript/csrf/csrf.js.map +7 -0
- package/npm_dist/kit/_typescript/debounce/debounce.d.ts +4 -0
- package/npm_dist/kit/_typescript/debounce/debounce.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/debounce/debounce.js +16 -0
- package/npm_dist/kit/_typescript/debounce/debounce.js.map +7 -0
- package/npm_dist/kit/_typescript/fmt/fmt.d.ts +2 -0
- package/npm_dist/kit/_typescript/fmt/fmt.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/fmt/fmt.js +8 -0
- package/npm_dist/kit/_typescript/fmt/fmt.js.map +7 -0
- package/npm_dist/kit/_typescript/json/deep_equals.d.ts +7 -0
- package/npm_dist/kit/_typescript/json/deep_equals.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/json/json.d.ts +4 -0
- package/npm_dist/kit/_typescript/json/json.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/json/json.js +110 -0
- package/npm_dist/kit/_typescript/json/json.js.map +7 -0
- package/npm_dist/kit/_typescript/json/search_param_serializer.d.ts +2 -0
- package/npm_dist/kit/_typescript/json/search_param_serializer.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/json/stringify_stable.d.ts +7 -0
- package/npm_dist/kit/_typescript/json/stringify_stable.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/listeners/listeners.d.ts +2 -0
- package/npm_dist/kit/_typescript/listeners/listeners.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/listeners/listeners.js +20 -0
- package/npm_dist/kit/_typescript/listeners/listeners.js.map +7 -0
- package/npm_dist/kit/_typescript/matcher/find_best_match.d.ts +10 -0
- package/npm_dist/kit/_typescript/matcher/find_best_match.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/matcher/find_best_match.js +146 -0
- package/npm_dist/kit/_typescript/matcher/find_best_match.js.map +7 -0
- package/npm_dist/kit/_typescript/matcher/find_nested_matches.d.ts +14 -0
- package/npm_dist/kit/_typescript/matcher/find_nested_matches.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/matcher/find_nested_matches.js +248 -0
- package/npm_dist/kit/_typescript/matcher/find_nested_matches.js.map +7 -0
- package/npm_dist/kit/_typescript/matcher/parse_segments.d.ts +2 -0
- package/npm_dist/kit/_typescript/matcher/parse_segments.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/matcher/register.d.ts +54 -0
- package/npm_dist/kit/_typescript/matcher/register.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/matcher/register.js +21 -0
- package/npm_dist/kit/_typescript/matcher/register.js.map +7 -0
- package/npm_dist/kit/_typescript/theme/theme.d.ts +23 -0
- package/npm_dist/kit/_typescript/theme/theme.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/theme/theme.js +122 -0
- package/npm_dist/kit/_typescript/theme/theme.js.map +7 -0
- package/npm_dist/kit/_typescript/url/url.d.ts +30 -0
- package/npm_dist/kit/_typescript/url/url.d.ts.map +1 -0
- package/npm_dist/kit/_typescript/url/url.js +100 -0
- package/npm_dist/kit/_typescript/url/url.js.map +7 -0
- package/package.json +135 -3
- package/tsconfig.base.json +17 -0
- package/index.js +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { parseSegments } from "./parse_segments.ts";
|
|
2
|
+
|
|
3
|
+
export type Params = Record<string, string>;
|
|
4
|
+
export type SegType = "splat" | "static" | "dynamic" | "index";
|
|
5
|
+
|
|
6
|
+
export type Segment = {
|
|
7
|
+
normalizedVal: string;
|
|
8
|
+
segType: SegType;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type RegisteredPattern = {
|
|
12
|
+
originalPattern: string;
|
|
13
|
+
normalizedPattern: string;
|
|
14
|
+
normalizedSegments: Segment[];
|
|
15
|
+
lastSegType: SegType;
|
|
16
|
+
lastSegIsNonRootSplat: boolean;
|
|
17
|
+
lastSegIsIndex: boolean;
|
|
18
|
+
numberOfDynamicParamSegs: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SegmentNode = {
|
|
22
|
+
pattern: string;
|
|
23
|
+
nodeType: number;
|
|
24
|
+
children: Map<string, SegmentNode> | null;
|
|
25
|
+
dynChildren: SegmentNode[];
|
|
26
|
+
paramName: string;
|
|
27
|
+
finalScore: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type RegistrationOptions = {
|
|
31
|
+
dynamicParamPrefixRune?: string;
|
|
32
|
+
splatSegmentRune?: string;
|
|
33
|
+
explicitIndexSegment?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type PatternRegistry = {
|
|
37
|
+
staticPatterns: Map<string, RegisteredPattern>;
|
|
38
|
+
dynamicPatterns: Map<string, RegisteredPattern>;
|
|
39
|
+
rootNode: SegmentNode;
|
|
40
|
+
config: {
|
|
41
|
+
dynamicParamPrefixRune: string;
|
|
42
|
+
splatSegmentRune: string;
|
|
43
|
+
explicitIndexSegment: string;
|
|
44
|
+
slashIndexSegment: string;
|
|
45
|
+
usingExplicitIndexSegment: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/////////////////////////////////////////////////////////////////////
|
|
50
|
+
/////// CONSTANTS
|
|
51
|
+
/////////////////////////////////////////////////////////////////////
|
|
52
|
+
|
|
53
|
+
export const NODE_STATIC = 0;
|
|
54
|
+
export const NODE_DYNAMIC = 1;
|
|
55
|
+
export const NODE_SPLAT = 2;
|
|
56
|
+
export const SCORE_STATIC_MATCH = 2;
|
|
57
|
+
export const SCORE_DYNAMIC = 1;
|
|
58
|
+
|
|
59
|
+
export const SEG_TYPES = {
|
|
60
|
+
splat: "splat" as SegType,
|
|
61
|
+
static: "static" as SegType,
|
|
62
|
+
dynamic: "dynamic" as SegType,
|
|
63
|
+
index: "index" as SegType,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/////////////////////////////////////////////////////////////////////
|
|
67
|
+
/////// REGISTRATION
|
|
68
|
+
/////////////////////////////////////////////////////////////////////
|
|
69
|
+
|
|
70
|
+
function createSegmentNode(): SegmentNode {
|
|
71
|
+
return {
|
|
72
|
+
pattern: "",
|
|
73
|
+
nodeType: NODE_STATIC,
|
|
74
|
+
children: null,
|
|
75
|
+
dynChildren: [],
|
|
76
|
+
paramName: "",
|
|
77
|
+
finalScore: 0,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function findOrCreateChild(node: SegmentNode, segment: string): SegmentNode {
|
|
82
|
+
if (segment === "*" || (segment.length > 0 && segment[0] === ":")) {
|
|
83
|
+
for (const child of node.dynChildren) {
|
|
84
|
+
if (child.paramName === segment.substring(1)) return child;
|
|
85
|
+
}
|
|
86
|
+
return addDynamicChild(node, segment);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (node.children === null) node.children = new Map<string, SegmentNode>();
|
|
90
|
+
|
|
91
|
+
let child = node.children.get(segment);
|
|
92
|
+
if (child) return child;
|
|
93
|
+
|
|
94
|
+
child = createSegmentNode();
|
|
95
|
+
child.nodeType = NODE_STATIC;
|
|
96
|
+
node.children.set(segment, child);
|
|
97
|
+
return child;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function addDynamicChild(node: SegmentNode, segment: string): SegmentNode {
|
|
101
|
+
const child = createSegmentNode();
|
|
102
|
+
if (segment === "*") {
|
|
103
|
+
child.nodeType = NODE_SPLAT;
|
|
104
|
+
} else {
|
|
105
|
+
child.nodeType = NODE_DYNAMIC;
|
|
106
|
+
child.paramName = segment.substring(1);
|
|
107
|
+
}
|
|
108
|
+
node.dynChildren.push(child);
|
|
109
|
+
return child;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getSegmentType(
|
|
113
|
+
segment: string,
|
|
114
|
+
dynamicPrefix: string,
|
|
115
|
+
splatRune: string,
|
|
116
|
+
): SegType {
|
|
117
|
+
if (segment === "") return SEG_TYPES.index;
|
|
118
|
+
if (segment.length === 1 && segment === splatRune) return SEG_TYPES.splat;
|
|
119
|
+
if (segment.length > 0 && segment[0] === dynamicPrefix)
|
|
120
|
+
return SEG_TYPES.dynamic;
|
|
121
|
+
return SEG_TYPES.static;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function isStatic(segments: Segment[]): boolean {
|
|
125
|
+
for (const segment of segments) {
|
|
126
|
+
if (
|
|
127
|
+
segment.segType === SEG_TYPES.splat ||
|
|
128
|
+
segment.segType === SEG_TYPES.dynamic
|
|
129
|
+
) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function normalizePattern(
|
|
137
|
+
originalPattern: string,
|
|
138
|
+
config: PatternRegistry["config"],
|
|
139
|
+
): RegisteredPattern {
|
|
140
|
+
let normalizedPattern = originalPattern;
|
|
141
|
+
|
|
142
|
+
if (config.usingExplicitIndexSegment) {
|
|
143
|
+
if (normalizedPattern.endsWith("/")) {
|
|
144
|
+
if (normalizedPattern !== "/") {
|
|
145
|
+
throw new Error(`bad trailing slash: ${originalPattern}`);
|
|
146
|
+
}
|
|
147
|
+
normalizedPattern = normalizedPattern.replace(/\/+$/, "");
|
|
148
|
+
}
|
|
149
|
+
if (normalizedPattern.endsWith(config.slashIndexSegment)) {
|
|
150
|
+
normalizedPattern = normalizedPattern.slice(
|
|
151
|
+
0,
|
|
152
|
+
-config.explicitIndexSegment.length,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const rawSegments = parseSegments(normalizedPattern);
|
|
158
|
+
const segments: Segment[] = [];
|
|
159
|
+
let numberOfDynamicParamSegs = 0;
|
|
160
|
+
|
|
161
|
+
for (const seg of rawSegments) {
|
|
162
|
+
let normalizedVal = seg;
|
|
163
|
+
const segType = getSegmentType(
|
|
164
|
+
seg,
|
|
165
|
+
config.dynamicParamPrefixRune,
|
|
166
|
+
config.splatSegmentRune,
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
if (segType === SEG_TYPES.dynamic) {
|
|
170
|
+
numberOfDynamicParamSegs++;
|
|
171
|
+
normalizedVal = ":" + seg.substring(1);
|
|
172
|
+
}
|
|
173
|
+
if (segType === SEG_TYPES.splat) {
|
|
174
|
+
normalizedVal = "*";
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
segments.push({ normalizedVal, segType });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const segLen = segments.length;
|
|
181
|
+
let lastType: SegType =
|
|
182
|
+
segLen > 0 ? segments[segLen - 1]!.segType : SEG_TYPES.static;
|
|
183
|
+
|
|
184
|
+
let finalNormalizedPattern = "/";
|
|
185
|
+
for (let i = 0; i < segments.length; i++) {
|
|
186
|
+
finalNormalizedPattern += segments[i]!.normalizedVal;
|
|
187
|
+
if (i < segLen - 1) finalNormalizedPattern += "/";
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (finalNormalizedPattern.endsWith("/") && lastType !== SEG_TYPES.index) {
|
|
191
|
+
finalNormalizedPattern = finalNormalizedPattern.replace(/\/+$/, "");
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
originalPattern,
|
|
196
|
+
normalizedPattern: finalNormalizedPattern,
|
|
197
|
+
normalizedSegments: segments,
|
|
198
|
+
lastSegType: lastType,
|
|
199
|
+
lastSegIsNonRootSplat: lastType === SEG_TYPES.splat && segLen > 1,
|
|
200
|
+
lastSegIsIndex: lastType === SEG_TYPES.index,
|
|
201
|
+
numberOfDynamicParamSegs,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function createPatternRegistry(
|
|
206
|
+
opts?: RegistrationOptions,
|
|
207
|
+
): PatternRegistry {
|
|
208
|
+
const config = {
|
|
209
|
+
dynamicParamPrefixRune: opts?.dynamicParamPrefixRune ?? ":",
|
|
210
|
+
splatSegmentRune: opts?.splatSegmentRune ?? "*",
|
|
211
|
+
explicitIndexSegment: opts?.explicitIndexSegment ?? "",
|
|
212
|
+
slashIndexSegment: "/" + (opts?.explicitIndexSegment ?? ""),
|
|
213
|
+
usingExplicitIndexSegment: (opts?.explicitIndexSegment ?? "") !== "",
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
if (config.explicitIndexSegment.includes("/")) {
|
|
217
|
+
throw new Error("explicit index segment cannot contain /");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
staticPatterns: new Map(),
|
|
222
|
+
dynamicPatterns: new Map(),
|
|
223
|
+
rootNode: createSegmentNode(),
|
|
224
|
+
config,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function registerPattern(
|
|
229
|
+
registry: PatternRegistry,
|
|
230
|
+
originalPattern: string,
|
|
231
|
+
): RegisteredPattern {
|
|
232
|
+
const normalized = normalizePattern(originalPattern, registry.config);
|
|
233
|
+
|
|
234
|
+
if (
|
|
235
|
+
!(globalThis.window && globalThis.document) &&
|
|
236
|
+
(registry.staticPatterns.has(normalized.normalizedPattern) ||
|
|
237
|
+
registry.dynamicPatterns.has(normalized.normalizedPattern))
|
|
238
|
+
) {
|
|
239
|
+
console.warn(`already registered: ${originalPattern}`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (isStatic(normalized.normalizedSegments)) {
|
|
243
|
+
registry.staticPatterns.set(normalized.normalizedPattern, normalized);
|
|
244
|
+
return normalized;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
registry.dynamicPatterns.set(normalized.normalizedPattern, normalized);
|
|
248
|
+
|
|
249
|
+
let current = registry.rootNode;
|
|
250
|
+
let nodeScore = 0;
|
|
251
|
+
|
|
252
|
+
for (let i = 0; i < normalized.normalizedSegments.length; i++) {
|
|
253
|
+
const segment = normalized.normalizedSegments[i]!;
|
|
254
|
+
const child = findOrCreateChild(current, segment.normalizedVal);
|
|
255
|
+
|
|
256
|
+
if (segment.segType === SEG_TYPES.dynamic) {
|
|
257
|
+
nodeScore += SCORE_DYNAMIC;
|
|
258
|
+
} else if (segment.segType !== SEG_TYPES.splat) {
|
|
259
|
+
nodeScore += SCORE_STATIC_MATCH;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (i === normalized.normalizedSegments.length - 1) {
|
|
263
|
+
child.finalScore = nodeScore;
|
|
264
|
+
child.pattern = normalized.normalizedPattern;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
current = child;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return normalized;
|
|
271
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { getClientCookie, setClientCookie } from "vorma/kit/cookies";
|
|
2
|
+
|
|
3
|
+
/////////////////////////////////////////////////////////////////////
|
|
4
|
+
/////// SETUP
|
|
5
|
+
/////////////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
export const THEMES = {
|
|
8
|
+
Dark: "dark",
|
|
9
|
+
Light: "light",
|
|
10
|
+
System: "system",
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
const THEME_VALUES = Object.values(THEMES);
|
|
14
|
+
const THEME_KEY = "kit_theme";
|
|
15
|
+
const RESOLVED_THEME_KEY = "kit_resolved_theme";
|
|
16
|
+
const PREFERS_DARK_QUERY = window.matchMedia("(prefers-color-scheme: dark)");
|
|
17
|
+
const CLASSLIST = window.document.documentElement.classList;
|
|
18
|
+
const THEME_CHANGE_EVENT_KEY = "theme_change";
|
|
19
|
+
|
|
20
|
+
export type Theme = (typeof THEME_VALUES)[number];
|
|
21
|
+
export type ResolvedTheme = Exclude<Theme, typeof THEMES.System>;
|
|
22
|
+
type ThemeChangeEventDetail = {
|
|
23
|
+
theme: Theme;
|
|
24
|
+
resolvedTheme: ResolvedTheme;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/////////////////////////////////////////////////////////////////////
|
|
28
|
+
///////// BROADCAST CHANNEL
|
|
29
|
+
/////////////////////////////////////////////////////////////////////
|
|
30
|
+
|
|
31
|
+
let bc = __newBC();
|
|
32
|
+
__setBCOnMessage(bc);
|
|
33
|
+
|
|
34
|
+
// bfcache stuff
|
|
35
|
+
window.addEventListener("pagehide", () => bc.close());
|
|
36
|
+
window.addEventListener("pageshow", () => {
|
|
37
|
+
bc = __newBC();
|
|
38
|
+
__setBCOnMessage(bc);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function __newBC(): BroadcastChannel {
|
|
42
|
+
return new BroadcastChannel("kit_theme_channel");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function __setBCOnMessage(bc: BroadcastChannel) {
|
|
46
|
+
bc.onmessage = (e) => {
|
|
47
|
+
const detail = e.data as ThemeChangeEventDetail;
|
|
48
|
+
const theme = detail.theme;
|
|
49
|
+
const resolvedTheme = __getResolvedThemeFromTheme(theme);
|
|
50
|
+
__setClassesAndDispatchEvent({ theme, resolvedTheme });
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/////////////////////////////////////////////////////////////////////
|
|
55
|
+
/////// PREFERS COLOR SCHEME EVENT LISTENER
|
|
56
|
+
/////////////////////////////////////////////////////////////////////
|
|
57
|
+
|
|
58
|
+
PREFERS_DARK_QUERY.addEventListener("change", () => {
|
|
59
|
+
if (CLASSLIST.contains(THEMES.System)) {
|
|
60
|
+
setTheme(THEMES.System);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/////////////////////////////////////////////////////////////////////
|
|
65
|
+
/////// PUBLIC HELPER FUNCTIONS
|
|
66
|
+
/////////////////////////////////////////////////////////////////////
|
|
67
|
+
|
|
68
|
+
export function getTheme(): Theme {
|
|
69
|
+
const theme = getClientCookie(THEME_KEY);
|
|
70
|
+
return __isTheme(theme) ? theme : THEMES.System;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getThemeLocal(): Theme {
|
|
74
|
+
const theme = localStorage.getItem(THEME_KEY);
|
|
75
|
+
return __isTheme(theme) ? theme : THEMES.System;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function getResolvedTheme(): ResolvedTheme {
|
|
79
|
+
const resolvedTheme = getClientCookie(RESOLVED_THEME_KEY);
|
|
80
|
+
return __isResolvedTheme(resolvedTheme) ? resolvedTheme : THEMES.Light;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function getResolvedThemeLocal(): ResolvedTheme {
|
|
84
|
+
const resolvedTheme = localStorage.getItem(RESOLVED_THEME_KEY);
|
|
85
|
+
return __isResolvedTheme(resolvedTheme) ? resolvedTheme : THEMES.Light;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function setTheme(theme: Theme) {
|
|
89
|
+
const resolvedTheme = __getResolvedThemeFromTheme(theme);
|
|
90
|
+
setClientCookie(THEME_KEY, theme);
|
|
91
|
+
setClientCookie(RESOLVED_THEME_KEY, resolvedTheme);
|
|
92
|
+
const detail: ThemeChangeEventDetail = { theme, resolvedTheme };
|
|
93
|
+
__setClassesAndDispatchEvent(detail);
|
|
94
|
+
bc.postMessage(detail);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function setThemeLocal(theme: Theme) {
|
|
98
|
+
const resolvedTheme = __getResolvedThemeFromTheme(theme);
|
|
99
|
+
localStorage.setItem(THEME_KEY, theme);
|
|
100
|
+
localStorage.setItem(RESOLVED_THEME_KEY, resolvedTheme);
|
|
101
|
+
const detail: ThemeChangeEventDetail = { theme, resolvedTheme };
|
|
102
|
+
__setClassesAndDispatchEvent(detail);
|
|
103
|
+
bc.postMessage(detail);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function addThemeChangeListener(
|
|
107
|
+
listener: (e: CustomEvent<ThemeChangeEventDetail>) => void,
|
|
108
|
+
): CleanupFunction {
|
|
109
|
+
window.addEventListener(THEME_CHANGE_EVENT_KEY, listener as EventListener);
|
|
110
|
+
return () => {
|
|
111
|
+
window.removeEventListener(
|
|
112
|
+
THEME_CHANGE_EVENT_KEY,
|
|
113
|
+
listener as EventListener,
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type CleanupFunction = () => void;
|
|
119
|
+
|
|
120
|
+
export function initLocal() {
|
|
121
|
+
const theme = localStorage.getItem(THEME_KEY) || THEMES.System;
|
|
122
|
+
const resolvedTheme = __getResolvedThemeFromTheme(
|
|
123
|
+
__isTheme(theme) ? theme : THEMES.System,
|
|
124
|
+
);
|
|
125
|
+
CLASSLIST.add(theme);
|
|
126
|
+
if (theme === THEMES.System) {
|
|
127
|
+
CLASSLIST.add(resolvedTheme);
|
|
128
|
+
}
|
|
129
|
+
localStorage.setItem(THEME_KEY, theme);
|
|
130
|
+
localStorage.setItem(RESOLVED_THEME_KEY, resolvedTheme);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/////////////////////////////////////////////////////////////////////
|
|
134
|
+
/////// INTERNAL UTILS
|
|
135
|
+
/////////////////////////////////////////////////////////////////////
|
|
136
|
+
|
|
137
|
+
function __getResolvedThemeFromTheme(theme: Theme): ResolvedTheme {
|
|
138
|
+
let resolvedTheme = theme;
|
|
139
|
+
if (resolvedTheme === THEMES.System) {
|
|
140
|
+
resolvedTheme = PREFERS_DARK_QUERY.matches ? THEMES.Dark : THEMES.Light;
|
|
141
|
+
}
|
|
142
|
+
return resolvedTheme;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function __setClassesAndDispatchEvent(detail: ThemeChangeEventDetail) {
|
|
146
|
+
CLASSLIST.remove(...THEME_VALUES);
|
|
147
|
+
CLASSLIST.add(detail.theme);
|
|
148
|
+
if (detail.theme === THEMES.System) {
|
|
149
|
+
CLASSLIST.add(detail.resolvedTheme);
|
|
150
|
+
}
|
|
151
|
+
window.dispatchEvent(new CustomEvent(THEME_CHANGE_EVENT_KEY, { detail }));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/////////////////////////////////////////////////////////////////////
|
|
155
|
+
/////// TYPE GUARDS
|
|
156
|
+
/////////////////////////////////////////////////////////////////////
|
|
157
|
+
|
|
158
|
+
function __isTheme(theme: string | undefined | null): theme is Theme {
|
|
159
|
+
return THEME_VALUES.includes(theme as Theme);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function __isResolvedTheme(
|
|
163
|
+
theme: string | undefined | null,
|
|
164
|
+
): theme is ResolvedTheme {
|
|
165
|
+
return theme === THEMES.Dark || theme === THEMES.Light;
|
|
166
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export function getIsErrorRes(response: Response) {
|
|
2
|
+
return (
|
|
3
|
+
String(response.status).startsWith("4") || String(response.status).startsWith("5")
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getIsGETRequest(requestInit?: RequestInit) {
|
|
8
|
+
return (
|
|
9
|
+
!requestInit?.method ||
|
|
10
|
+
requestInit.method.toLowerCase() === "get" ||
|
|
11
|
+
requestInit.method.toLowerCase() === "head"
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getAnchorDetailsFromEvent(event: MouseEvent) {
|
|
16
|
+
if (!event || !event.target || !(event.target as HTMLElement).closest) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const anchor = (event.target as HTMLElement).closest("a");
|
|
21
|
+
|
|
22
|
+
if (!anchor) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const isEligibleForDefaultPrevention =
|
|
27
|
+
anchor.target !== "_blank" && // ignore new tabs
|
|
28
|
+
event.button !== 1 && // middle mouse button click
|
|
29
|
+
!anchor.href.startsWith("#") && // ignore hash links
|
|
30
|
+
!anchor.hasAttribute("download") && // ignore downloads
|
|
31
|
+
!event.ctrlKey && // ignore ctrl+click
|
|
32
|
+
!event.shiftKey && // ignore shift+click
|
|
33
|
+
!event.metaKey && // ignore cmd+click
|
|
34
|
+
!event.altKey; // ignore alt+click
|
|
35
|
+
|
|
36
|
+
const hrefDetails = getHrefDetails(anchor.href);
|
|
37
|
+
const isInternal = hrefDetails.isHTTP && hrefDetails.isInternal;
|
|
38
|
+
|
|
39
|
+
return { anchor, isEligibleForDefaultPrevention, isInternal };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type HrefDetails =
|
|
43
|
+
| {
|
|
44
|
+
url: URL;
|
|
45
|
+
isHTTP: true;
|
|
46
|
+
absoluteURL: string;
|
|
47
|
+
relativeURL: string;
|
|
48
|
+
isExternal: boolean;
|
|
49
|
+
isInternal: boolean;
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
isHTTP: false;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function getHrefDetails(href: string): HrefDetails {
|
|
56
|
+
if (!href) {
|
|
57
|
+
return { isHTTP: false };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let url: URL;
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
url = new URL(href, window.location.href);
|
|
64
|
+
} catch {
|
|
65
|
+
return { isHTTP: false };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const isExternal = url.origin !== window.location.origin;
|
|
69
|
+
const isInternal = !isExternal;
|
|
70
|
+
|
|
71
|
+
// Filter out things like "#", "tel:", "mailto:", etc.
|
|
72
|
+
const isHTTP = url.protocol.startsWith("http");
|
|
73
|
+
if (!isHTTP) {
|
|
74
|
+
return { isHTTP: false };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isExternal) {
|
|
78
|
+
return {
|
|
79
|
+
url,
|
|
80
|
+
isHTTP: true,
|
|
81
|
+
absoluteURL: url.href,
|
|
82
|
+
relativeURL: "",
|
|
83
|
+
isExternal,
|
|
84
|
+
isInternal,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
url,
|
|
90
|
+
isHTTP: true,
|
|
91
|
+
absoluteURL: url.href,
|
|
92
|
+
relativeURL: url.href.replace(url.origin, ""),
|
|
93
|
+
isExternal,
|
|
94
|
+
isInternal,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function getPrefetchHandlers(href: string, timeout = 50) {
|
|
99
|
+
const hrefDetails = getHrefDetails(href);
|
|
100
|
+
if (!hrefDetails.isHTTP) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const { relativeURL, isExternal } = hrefDetails;
|
|
105
|
+
if (!relativeURL || isExternal) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let timer: number | undefined;
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
...hrefDetails,
|
|
113
|
+
start() {
|
|
114
|
+
timer = window.setTimeout(() => prefetch(relativeURL), timeout);
|
|
115
|
+
},
|
|
116
|
+
stop() {
|
|
117
|
+
document.querySelector(`link[href="${relativeURL}"]`)?.remove();
|
|
118
|
+
clearTimeout(timer);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function prefetch(relativeURL: string) {
|
|
124
|
+
document.querySelector(`link[href="${relativeURL}"]`)?.remove();
|
|
125
|
+
|
|
126
|
+
const link = document.createElement("link");
|
|
127
|
+
link.rel = "prefetch";
|
|
128
|
+
link.href = relativeURL;
|
|
129
|
+
link.id = relativeURL;
|
|
130
|
+
|
|
131
|
+
document.head.appendChild(link);
|
|
132
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { getBuildID, getHistoryInstance, getLocation, getRootEl, getStatus, revalidate, submit, vormaNavigate, type SubmitOptions, } from "./src/client.ts";
|
|
2
|
+
export { __registerClientLoaderPattern } from "./src/client_loaders.ts";
|
|
3
|
+
export { defaultErrorBoundary } from "./src/error_boundary.ts";
|
|
4
|
+
export { addBuildIDListener, addLocationListener, addRouteChangeListener, addStatusListener, type RouteChangeEvent, type StatusEvent, } from "./src/events.ts";
|
|
5
|
+
export { setupGlobalLoadingIndicator } from "./src/global_loading_indicator/global_loading_indicator.ts";
|
|
6
|
+
export { __runClientLoadersAfterHMRUpdate } from "./src/hmr/hmr.ts";
|
|
7
|
+
export { initClient } from "./src/init_client.ts";
|
|
8
|
+
export { __getPrefetchHandlers, __makeLinkOnClickFn } from "./src/links.ts";
|
|
9
|
+
export { __applyScrollState } from "./src/scroll_state_manager.ts";
|
|
10
|
+
export { route } from "./src/static_route_defs/route_def_helpers.ts";
|
|
11
|
+
export { __makeFinalLinkProps, type VormaLinkPropsBase, } from "./src/ui_lib_impl_helpers/link_components.ts";
|
|
12
|
+
export { type ParamsForPattern, type UseRouterDataFunction, type VormaRouteGeneric, } from "./src/ui_lib_impl_helpers/route_components.ts";
|
|
13
|
+
export { makeTypedNavigate } from "./src/ui_lib_impl_helpers/typed_navigate.ts";
|
|
14
|
+
export { __resolvePath, buildMutationURL, buildQueryURL, resolveBody, type ExtractApp, type PermissivePatternBasedProps, type VormaAppBase, type VormaAppConfig, type VormaLoaderOutput, type VormaLoaderPattern, type VormaMutationInput, type VormaMutationOutput, type VormaMutationPattern, type VormaMutationProps, type VormaQueryInput, type VormaQueryOutput, type VormaQueryPattern, type VormaQueryProps, type VormaRoutePropsGeneric, } from "./src/vorma_app_helpers/vorma_app_helpers.ts";
|
|
15
|
+
export { __vormaClientGlobal, getRouterData, type ClientLoaderAwaitedServerData, } from "./src/vorma_ctx/vorma_ctx.ts";
|
|
16
|
+
export { revalidateOnWindowFocus } from "./src/window_focus_revalidation/window_focus_revalidation.ts";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../internal/framework/_typescript/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,MAAM,EACN,aAAa,EACb,KAAK,aAAa,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,4DAA4D,CAAC;AACzG,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,EACN,oBAAoB,EACpB,KAAK,kBAAkB,GACvB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACtB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,KAAK,UAAU,EACf,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,KAAK,6BAA6B,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8DAA8D,CAAC"}
|