@kitbag/router 0.27.0 → 0.28.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.
Files changed (38) hide show
  1. package/dist/components/routerLink.d.ts +1 -0
  2. package/dist/components/viewTransition.browser.spec.d.ts +1 -0
  3. package/dist/components/viewTransition.d.ts +16 -0
  4. package/dist/components/viewTransition.spec-d.d.ts +1 -0
  5. package/dist/compositions/useViewTransition.d.ts +5 -0
  6. package/dist/kitbag-router.js +1758 -1524
  7. package/dist/kitbag-router.umd.cjs +2 -2
  8. package/dist/main.d.ts +12 -1
  9. package/dist/services/addView.d.ts +3 -3
  10. package/dist/services/createRoute.d.ts +2 -4
  11. package/dist/services/createRouter.d.ts +2 -2
  12. package/dist/services/createRouterAssets.d.ts +11 -0
  13. package/dist/services/createRouterHistory.d.ts +10 -2
  14. package/dist/services/createViewTransitions.browser.spec.d.ts +1 -0
  15. package/dist/services/createViewTransitions.d.ts +38 -0
  16. package/dist/services/history.d.ts +1 -0
  17. package/dist/services/routeViews.d.ts +7 -0
  18. package/dist/tests/navigationBehavior.browser.spec.d.ts +1 -0
  19. package/dist/tests/viewTransitions.browser.spec.d.ts +1 -0
  20. package/dist/types/addView.d.ts +3 -4
  21. package/dist/types/createRouteOptions.d.ts +17 -61
  22. package/dist/types/navigation.d.ts +2 -0
  23. package/dist/types/props.d.ts +0 -18
  24. package/dist/types/route.d.ts +2 -3
  25. package/dist/types/routeViews.d.ts +5 -7
  26. package/dist/types/router.d.ts +13 -0
  27. package/dist/types/routerPush.d.ts +8 -0
  28. package/dist/types/routerReplace.d.ts +3 -0
  29. package/dist/types/useLink.d.ts +5 -0
  30. package/dist/types/viewTransition.d.ts +49 -0
  31. package/dist/utilities/navigation.d.ts +15 -0
  32. package/dist/utilities/promises.d.ts +4 -0
  33. package/dist/utilities/promises.spec.d.ts +1 -0
  34. package/dist/utilities/testHelpers.d.ts +32 -100
  35. package/dist/utilities/viewTransition.d.ts +11 -0
  36. package/dist/utilities/viewTransition.spec.d.ts +1 -0
  37. package/package.json +7 -6
  38. package/dist/services/createRouteViews.d.ts +0 -16
@@ -1 +1,5 @@
1
1
  export declare function isPromise(value: unknown): value is Promise<unknown>;
2
+ /**
3
+ * Resolves when the signal aborts, including an already aborted signal.
4
+ */
5
+ export declare function createAbortPromise(signal: AbortSignal): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -14,7 +14,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
14
14
  }>, [Omit<{
15
15
  readonly name: "parentA";
16
16
  readonly path: "/parentA/[paramA]";
17
- }, "meta" | "component" | "components" | "name" | "parent"> & {
17
+ }, "meta" | "name" | "parent"> & {
18
18
  id: string;
19
19
  name: "parentA";
20
20
  meta: Readonly<{}>;
@@ -34,7 +34,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
34
34
  }>, [Omit<{
35
35
  readonly name: "parentA";
36
36
  readonly path: "/parentA/[paramA]";
37
- }, "meta" | "component" | "components" | "name" | "parent"> & {
37
+ }, "meta" | "name" | "parent"> & {
38
38
  id: string;
39
39
  name: "parentA";
40
40
  meta: Readonly<{}>;
@@ -47,7 +47,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
47
47
  }>, [Omit<{
48
48
  readonly name: "parentA";
49
49
  readonly path: "/parentA/[paramA]";
50
- }, "meta" | "component" | "components" | "name" | "parent"> & {
50
+ }, "meta" | "name" | "parent"> & {
51
51
  id: string;
52
52
  name: "parentA";
53
53
  meta: Readonly<{}>;
@@ -56,7 +56,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
56
56
  }]>;
57
57
  readonly name: "parentA.childA";
58
58
  readonly path: "/childA/[?paramB]";
59
- }, "meta" | "component" | "components" | "name" | "parent"> & {
59
+ }, "meta" | "name" | "parent"> & {
60
60
  id: string;
61
61
  name: "parentA.childA";
62
62
  meta: Readonly<{}>;
@@ -76,37 +76,21 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
76
76
  }>, [Omit<{
77
77
  readonly name: "parentA";
78
78
  readonly path: "/parentA/[paramA]";
79
- }, "meta" | "component" | "components" | "name" | "parent"> & {
79
+ }, "meta" | "name" | "parent"> & {
80
80
  id: string;
81
81
  name: "parentA";
82
82
  meta: Readonly<{}>;
83
83
  views: {};
84
84
  loaders: {};
85
- }, Omit<{
86
- readonly parent: import('../types/routeWithMethods').RouteWithMethods<import('../types/url').ToUrl<{
87
- readonly name: "parentA";
88
- readonly path: "/parentA/[paramA]";
89
- }>, [Omit<{
90
- readonly name: "parentA";
91
- readonly path: "/parentA/[paramA]";
92
- }, "meta" | "component" | "components" | "name" | "parent"> & {
93
- id: string;
94
- name: "parentA";
95
- meta: Readonly<{}>;
96
- views: {};
97
- loaders: {};
98
- }]>;
99
- readonly name: "parentA.childB";
100
- readonly path: "/childB/[paramD]";
101
- readonly component: {
102
- template: string;
103
- };
104
- }, "meta" | "component" | "components" | "name" | "parent"> & {
85
+ }, {
86
+ meta: Readonly<{}>;
105
87
  id: string;
106
88
  name: "parentA.childB";
107
- meta: Readonly<{}>;
108
- views: {};
109
89
  loaders: {};
90
+ readonly path: "/childB/[paramD]";
91
+ views: {
92
+ default: import('../types/routeViews').RouteView;
93
+ };
110
94
  }]>, import('../types/routeWithMethods').RouteWithMethods<import('../main').Url<{
111
95
  paramA: {
112
96
  param: StringConstructor;
@@ -126,7 +110,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
126
110
  }>, [Omit<{
127
111
  readonly name: "parentA";
128
112
  readonly path: "/parentA/[paramA]";
129
- }, "meta" | "component" | "components" | "name" | "parent"> & {
113
+ }, "meta" | "name" | "parent"> & {
130
114
  id: string;
131
115
  name: "parentA";
132
116
  meta: Readonly<{}>;
@@ -139,7 +123,7 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
139
123
  }>, [Omit<{
140
124
  readonly name: "parentA";
141
125
  readonly path: "/parentA/[paramA]";
142
- }, "meta" | "component" | "components" | "name" | "parent"> & {
126
+ }, "meta" | "name" | "parent"> & {
143
127
  id: string;
144
128
  name: "parentA";
145
129
  meta: Readonly<{}>;
@@ -148,95 +132,43 @@ export declare const routes: readonly [import('../types/routeWithMethods').Route
148
132
  }]>;
149
133
  readonly name: "parentA.childA";
150
134
  readonly path: "/childA/[?paramB]";
151
- }, "meta" | "component" | "components" | "name" | "parent"> & {
135
+ }, "meta" | "name" | "parent"> & {
152
136
  id: string;
153
137
  name: "parentA.childA";
154
138
  meta: Readonly<{}>;
155
139
  views: {};
156
140
  loaders: {};
157
- }, Omit<{
158
- readonly parent: import('../types/routeWithMethods').RouteWithMethods<import('../main').Url<{
159
- paramA: {
160
- param: StringConstructor;
161
- isOptional: false;
162
- isGreedy: false;
163
- };
164
- paramB: {
165
- param: StringConstructor;
166
- isOptional: true;
167
- isGreedy: false;
168
- };
169
- }>, [Omit<{
170
- readonly name: "parentA";
171
- readonly path: "/parentA/[paramA]";
172
- }, "meta" | "component" | "components" | "name" | "parent"> & {
173
- id: string;
174
- name: "parentA";
175
- meta: Readonly<{}>;
176
- views: {};
177
- loaders: {};
178
- }, Omit<{
179
- readonly parent: import('../types/routeWithMethods').RouteWithMethods<import('../types/url').ToUrl<{
180
- readonly name: "parentA";
181
- readonly path: "/parentA/[paramA]";
182
- }>, [Omit<{
183
- readonly name: "parentA";
184
- readonly path: "/parentA/[paramA]";
185
- }, "meta" | "component" | "components" | "name" | "parent"> & {
186
- id: string;
187
- name: "parentA";
188
- meta: Readonly<{}>;
189
- views: {};
190
- loaders: {};
191
- }]>;
192
- readonly name: "parentA.childA";
193
- readonly path: "/childA/[?paramB]";
194
- }, "meta" | "component" | "components" | "name" | "parent"> & {
195
- id: string;
196
- name: "parentA.childA";
197
- meta: Readonly<{}>;
198
- views: {};
199
- loaders: {};
200
- }]>;
201
- readonly name: "parentA.childA.grandChildA";
202
- readonly path: "/[paramC]";
203
- readonly component: {
204
- template: string;
205
- };
206
- }, "meta" | "component" | "components" | "name" | "parent"> & {
141
+ }, {
142
+ meta: Readonly<{}>;
207
143
  id: string;
208
144
  name: "parentA.childA.grandChildA";
209
- meta: Readonly<{}>;
210
- views: {};
211
145
  loaders: {};
146
+ readonly path: "/[paramC]";
147
+ views: {
148
+ default: import('../types/routeViews').RouteView;
149
+ };
212
150
  }]>, import('../types/routeWithMethods').RouteWithMethods<import('../types/url').ToUrl<{
213
151
  readonly name: "parentB";
214
152
  readonly path: "/parentB";
215
- }>, [Omit<{
216
- readonly name: "parentB";
217
- readonly path: "/parentB";
218
- readonly component: {
219
- template: string;
220
- };
221
- }, "meta" | "component" | "components" | "name" | "parent"> & {
153
+ }>, [{
154
+ meta: Readonly<{}>;
222
155
  id: string;
223
156
  name: "parentB";
224
- meta: Readonly<{}>;
225
- views: {};
226
157
  loaders: {};
158
+ readonly path: "/parentB";
159
+ views: {
160
+ default: import('../types/routeViews').RouteView;
161
+ };
227
162
  }]>, import('../types/routeWithMethods').RouteWithMethods<import('../types/url').ToUrl<{
228
163
  readonly name: "parentC";
229
164
  readonly path: "/";
230
- }>, [Omit<{
231
- readonly name: "parentC";
232
- readonly path: "/";
233
- readonly component: {
234
- template: string;
235
- };
236
- }, "meta" | "component" | "components" | "name" | "parent"> & {
165
+ }>, [{
166
+ meta: Readonly<{}>;
237
167
  id: string;
238
168
  name: "parentC";
239
- meta: Readonly<{}>;
240
- views: {};
241
169
  loaders: {};
170
+ readonly path: "/";
171
+ views: {
172
+ default: import('../types/routeViews').RouteView;
173
+ };
242
174
  }]>];
@@ -0,0 +1,11 @@
1
+ import { ViewTransitionConfigs, ViewTransitionContext, ViewTransitionTypes } from '../types/viewTransition';
2
+ /**
3
+ * The types to transition with, or `false` when the navigation should not transition. The nearest level
4
+ * that sets the option decides whether it is on, and the types of every level that is on are combined.
5
+ */
6
+ export declare function getViewTransitionTypes({ routerViewTransition, routeViewTransition, navigationViewTransition, ...context }: ViewTransitionConfigs & ViewTransitionContext): ViewTransitionTypes | false;
7
+ export declare function supportsViewTransitions(): boolean;
8
+ /**
9
+ * Passing types to a browser that predates them throws, so they are only passed where a transition has them.
10
+ */
11
+ export declare function supportsViewTransitionTypes(): boolean;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitbag/router",
3
3
  "private": false,
4
- "version": "0.27.0",
4
+ "version": "0.28.0",
5
5
  "license": "MIT",
6
6
  "bugs": {
7
7
  "url": "https://github.com/kitbagjs/router/issues"
@@ -45,21 +45,22 @@
45
45
  "devDependencies": {
46
46
  "@kitbag/eslint-config": "1.0.6",
47
47
  "@vitejs/plugin-vue": "^6.0.8",
48
- "@vue/language-core": "^3.3.11",
48
+ "@vue/language-core": "^3.3.12",
49
49
  "@vue/test-utils": "^2.5.1",
50
- "arktype": "^2.2.5",
50
+ "arktype": "^2.2.8",
51
51
  "eslint": "^9.39.5",
52
- "globals": "^17.12.0",
53
- "happy-dom": "^20.14.5",
52
+ "globals": "^17.13.0",
53
+ "happy-dom": "^20.14.6",
54
54
  "typedoc": "^0.28.20",
55
55
  "typedoc-plugin-markdown": "^4.13.1",
56
56
  "typedoc-vitepress-theme": "^1.1.4",
57
57
  "typescript": "^6.0.3",
58
58
  "valibot": "^1.0.0",
59
+ "view-transitions-mock": "^1.1.0",
59
60
  "vite": "^8.2.0",
60
61
  "vite-plugin-dts": "^5.0.3",
61
62
  "vitepress": "^1.6.4",
62
- "vitest": "^5.0.1",
63
+ "vitest": "^5.0.3",
63
64
  "vue-tsc": "^3.3.8",
64
65
  "zod": "4.0.0"
65
66
  },
@@ -1,16 +0,0 @@
1
- import { CreateRouteOptions, CreateRouteProps } from '../types/createRouteOptions';
2
- import { RouteViews } from '../types/routeViews';
3
- export declare const DEFAULT_VIEW_NAME = "default";
4
- /**
5
- * Builds the initial views for a route, seeding components from the (deprecated) `component`/`components`
6
- * options and prop getters from the props argument. Subsequent views are added via the route's `addView`.
7
- *
8
- * This is where the props argument's two shapes — a single getter for the unnamed view, or a record keyed
9
- * by view name — are normalized, so the rest of the router only deals with views keyed by name.
10
- */
11
- export declare function createRouteViews(options: CreateRouteOptions, props?: CreateRouteProps): RouteViews;
12
- /**
13
- * The names of the views that have a props getter. A view without one is never computed, so waiting on it
14
- * would never settle.
15
- */
16
- export declare function viewNamesWithProps(views: RouteViews): string[];