@qwik.dev/router 2.0.0-beta.2 → 2.0.0-beta.21
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/adapters/static/vite.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +9 -9
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +9 -7
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +9 -7
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +9 -24
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +9 -7
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +10 -14
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +9 -7
- package/lib/adapters/shared/vite/index.d.ts +13 -19
- package/lib/adapters/shared/vite/index.mjs +107 -139
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +18 -0
- package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
- package/lib/adapters/vercel-edge/vite/index.mjs +9 -11
- package/lib/chunks/error-handler.mjs +57 -0
- package/lib/chunks/format-error.mjs +137 -0
- package/lib/chunks/fs.mjs +254 -0
- package/lib/{static/node.mjs → chunks/index.mjs} +361 -563
- package/lib/chunks/mime-types.mjs +52 -0
- package/lib/chunks/routing.qwik.mjs +429 -0
- package/lib/chunks/types.qwik.mjs +22 -0
- package/lib/index.d.ts +240 -60
- package/lib/index.qwik.mjs +698 -983
- package/lib/middleware/aws-lambda/index.d.ts +3 -2
- package/lib/middleware/aws-lambda/index.mjs +8 -12
- package/lib/middleware/azure-swa/index.mjs +10 -216
- package/lib/middleware/bun/index.d.ts +11 -0
- package/lib/middleware/bun/index.mjs +24 -83
- package/lib/middleware/cloudflare-pages/index.mjs +10 -22
- package/lib/middleware/deno/index.d.ts +11 -0
- package/lib/middleware/deno/index.mjs +24 -83
- package/lib/middleware/firebase/index.mjs +7 -11
- package/lib/middleware/netlify-edge/index.mjs +10 -23
- package/lib/middleware/node/index.mjs +22 -87
- package/lib/middleware/request-handler/index.d.ts +89 -70
- package/lib/middleware/request-handler/index.mjs +584 -659
- package/lib/middleware/vercel-edge/index.mjs +15 -27
- package/lib/modules.d.ts +4 -12
- package/lib/service-worker/index.mjs +4 -0
- package/lib/{static → ssg}/index.d.ts +17 -17
- package/lib/ssg/index.mjs +14 -0
- package/lib/vite/index.d.ts +32 -10
- package/lib/vite/index.mjs +1524 -26934
- package/modules.d.ts +4 -12
- package/package.json +62 -68
- package/ssg.d.ts +2 -0
- package/static.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.cjs +0 -96
- package/lib/adapters/bun-server/vite/index.cjs +0 -50
- package/lib/adapters/cloud-run/vite/index.cjs +0 -47
- package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
- package/lib/adapters/deno-server/vite/index.cjs +0 -62
- package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
- package/lib/adapters/node-server/vite/index.cjs +0 -50
- package/lib/adapters/shared/vite/index.cjs +0 -378
- package/lib/adapters/static/vite/index.cjs +0 -368
- package/lib/adapters/static/vite/index.d.ts +0 -10
- package/lib/adapters/static/vite/index.mjs +0 -331
- package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
- package/lib/index.qwik.cjs +0 -1947
- package/lib/middleware/node/index.cjs +0 -314
- package/lib/middleware/request-handler/index.cjs +0 -1614
- package/lib/service-worker.cjs +0 -17
- package/lib/service-worker.mjs +0 -15
- package/lib/static/deno.mjs +0 -8
- package/lib/static/index.cjs +0 -67
- package/lib/static/index.mjs +0 -48
- package/lib/static/node.cjs +0 -1124
- package/lib/vite/index.cjs +0 -27445
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference path="./modules.d.ts" />
|
|
2
2
|
|
|
3
|
+
import type { AsyncSignal } from '@qwik.dev/core/internal';
|
|
3
4
|
import { Component } from '@qwik.dev/core';
|
|
4
5
|
import { Cookie } from '@qwik.dev/router/middleware/request-handler';
|
|
5
6
|
import { CookieOptions } from '@qwik.dev/router/middleware/request-handler';
|
|
@@ -12,6 +13,8 @@ import { QRLEventHandlerMulti } from '@qwik.dev/core';
|
|
|
12
13
|
import { QwikIntrinsicElements } from '@qwik.dev/core';
|
|
13
14
|
import { QwikJSX } from '@qwik.dev/core';
|
|
14
15
|
import type { ReadonlySignal } from '@qwik.dev/core';
|
|
16
|
+
import { Render } from '@qwik.dev/core/server';
|
|
17
|
+
import { RenderOptions } from '@qwik.dev/core/server';
|
|
15
18
|
import { RequestEvent } from '@qwik.dev/router/middleware/request-handler';
|
|
16
19
|
import { RequestEventAction } from '@qwik.dev/router/middleware/request-handler';
|
|
17
20
|
import { RequestEventBase } from '@qwik.dev/router/middleware/request-handler';
|
|
@@ -19,8 +22,10 @@ import { RequestEventCommon } from '@qwik.dev/router/middleware/request-handler'
|
|
|
19
22
|
import { RequestEventLoader } from '@qwik.dev/router/middleware/request-handler';
|
|
20
23
|
import { RequestHandler } from '@qwik.dev/router/middleware/request-handler';
|
|
21
24
|
import type { ResolveSyncValue } from '@qwik.dev/router/middleware/request-handler';
|
|
25
|
+
import type { SerializationStrategy } from '@qwik.dev/core/internal';
|
|
22
26
|
import type * as v from 'valibot';
|
|
23
27
|
import type { ValueOrPromise } from '@qwik.dev/core';
|
|
28
|
+
import { ValueOrPromise as ValueOrPromise_2 } from '@qwik.dev/core/internal';
|
|
24
29
|
import { z } from 'zod';
|
|
25
30
|
import type * as z_2 from 'zod';
|
|
26
31
|
|
|
@@ -188,6 +193,38 @@ export { CookieOptions }
|
|
|
188
193
|
|
|
189
194
|
export { CookieValue }
|
|
190
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Creates the `render()` function that is required by `createQwikRouter()`. It requires a function
|
|
198
|
+
* that returns the `jsx` and `options` for the renderer.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
*
|
|
202
|
+
* ```tsx
|
|
203
|
+
* const renderer = createRenderer((opts) => {
|
|
204
|
+
* if (opts.requestHeaders['x-hello'] === 'world') {
|
|
205
|
+
* return { jsx: <Hello />, options: opts };
|
|
206
|
+
* }
|
|
207
|
+
* return { jsx: <Root />, options: {
|
|
208
|
+
* ...opts,
|
|
209
|
+
* serverData: {
|
|
210
|
+
* ...opts.serverData,
|
|
211
|
+
* documentHead: {
|
|
212
|
+
* meta: [
|
|
213
|
+
* { name: 'renderedAt', content: new Date().toISOString() },
|
|
214
|
+
* ],
|
|
215
|
+
* },
|
|
216
|
+
* },
|
|
217
|
+
* } };
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* @public
|
|
222
|
+
*/
|
|
223
|
+
export declare const createRenderer: (getOptions: (options: RendererOptions) => {
|
|
224
|
+
jsx: JSXOutput_2;
|
|
225
|
+
options: RendererOutputOptions;
|
|
226
|
+
}) => Render;
|
|
227
|
+
|
|
191
228
|
/** @public */
|
|
192
229
|
export declare type DataValidator<T extends Record<string, any> = {}> = {
|
|
193
230
|
validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<T>>;
|
|
@@ -209,18 +246,40 @@ export declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProp
|
|
|
209
246
|
/** @public */
|
|
210
247
|
export declare interface DocumentHeadProps extends RouteLocation {
|
|
211
248
|
readonly head: ResolvedDocumentHead;
|
|
249
|
+
/** @deprecated This is not necessary, it works correctly without */
|
|
212
250
|
readonly withLocale: <T>(fn: () => T) => T;
|
|
213
251
|
readonly resolveValue: ResolveSyncValue;
|
|
214
252
|
}
|
|
215
253
|
|
|
254
|
+
/**
|
|
255
|
+
* This renders all the tags collected from `head`.
|
|
256
|
+
*
|
|
257
|
+
* You can partially override the head, for example if you want to change the title:
|
|
258
|
+
*
|
|
259
|
+
* ```tsx
|
|
260
|
+
* import { DocumentHeadTags, useDocumentHead } from '@qwik.dev/router';
|
|
261
|
+
*
|
|
262
|
+
* export default component$(() => {
|
|
263
|
+
* const head = useDocumentHead();
|
|
264
|
+
* return <DocumentHeadTags title={`${head.title} - My App`} />;
|
|
265
|
+
* });
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
* You don't have to use this component, you can also do it yourself for full control. Just copy the
|
|
269
|
+
* code from this component and modify it to your needs.
|
|
270
|
+
*
|
|
271
|
+
* Note that this component normally only runs once, during SSR. You can use Signals in your
|
|
272
|
+
* `src/root.tsx` to make runtime changes to `<head>` if needed.
|
|
273
|
+
*
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export declare const DocumentHeadTags: Component<DocumentHeadValue<Record<string, unknown>>>;
|
|
277
|
+
|
|
216
278
|
/** @public */
|
|
217
279
|
export declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
|
|
218
280
|
/** Sets `document.title`. */
|
|
219
281
|
readonly title?: string;
|
|
220
|
-
/**
|
|
221
|
-
* Used to manually set meta tags in the head. Additionally, the `data` property could be used to
|
|
222
|
-
* set arbitrary data which the `<head>` component could later use to generate `<meta>` tags.
|
|
223
|
-
*/
|
|
282
|
+
/** Used to manually set meta tags in the head. */
|
|
224
283
|
readonly meta?: readonly DocumentMeta[];
|
|
225
284
|
/** Used to manually append `<link>` elements to the `<head>`. */
|
|
226
285
|
readonly links?: readonly DocumentLink[];
|
|
@@ -237,53 +296,59 @@ export declare interface DocumentHeadValue<FrontMatter extends Record<string, an
|
|
|
237
296
|
}
|
|
238
297
|
|
|
239
298
|
/** @public */
|
|
240
|
-
export declare
|
|
241
|
-
as?: string;
|
|
242
|
-
crossorigin?: string;
|
|
243
|
-
disabled?: boolean;
|
|
244
|
-
href?: string;
|
|
245
|
-
hreflang?: string;
|
|
246
|
-
id?: string;
|
|
247
|
-
imagesizes?: string;
|
|
248
|
-
imagesrcset?: string;
|
|
249
|
-
integrity?: string;
|
|
250
|
-
media?: string;
|
|
251
|
-
prefetch?: string;
|
|
252
|
-
referrerpolicy?: string;
|
|
253
|
-
rel?: string;
|
|
254
|
-
sizes?: string;
|
|
255
|
-
title?: string;
|
|
256
|
-
type?: string;
|
|
257
|
-
key?: string;
|
|
258
|
-
}
|
|
299
|
+
export declare type DocumentLink = QwikIntrinsicElements['link'];
|
|
259
300
|
|
|
260
301
|
/** @public */
|
|
261
|
-
export declare
|
|
262
|
-
readonly content?: string;
|
|
263
|
-
readonly httpEquiv?: string;
|
|
264
|
-
readonly name?: string;
|
|
265
|
-
readonly property?: string;
|
|
266
|
-
readonly key?: string;
|
|
267
|
-
readonly itemprop?: string;
|
|
268
|
-
readonly media?: string;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/** @beta */
|
|
272
|
-
export declare interface DocumentScript {
|
|
273
|
-
readonly script?: string;
|
|
274
|
-
readonly props?: Readonly<QwikIntrinsicElements['script']>;
|
|
275
|
-
readonly key?: string;
|
|
276
|
-
}
|
|
302
|
+
export declare type DocumentMeta = QwikIntrinsicElements['meta'];
|
|
277
303
|
|
|
278
304
|
/** @public */
|
|
279
|
-
export declare
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
305
|
+
export declare type DocumentScript = ((Omit<QwikIntrinsicElements['script'], 'dangerouslySetInnerHTML'> & {
|
|
306
|
+
props?: never;
|
|
307
|
+
}) | {
|
|
308
|
+
key?: string;
|
|
309
|
+
/**
|
|
310
|
+
* The props of the script element. @deprecated Prefer setting the properties directly instead
|
|
311
|
+
* of using this property.
|
|
312
|
+
*/
|
|
313
|
+
props: Readonly<QwikIntrinsicElements['script']>;
|
|
314
|
+
}) & ({
|
|
315
|
+
/** The inline script content. */
|
|
316
|
+
script?: string;
|
|
317
|
+
dangerouslySetInnerHTML?: never;
|
|
318
|
+
} | {
|
|
319
|
+
dangerouslySetInnerHTML?: string;
|
|
320
|
+
script?: never;
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
/** @public */
|
|
324
|
+
export declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style'], 'dangerouslySetInnerHTML'> & {
|
|
325
|
+
props?: never;
|
|
326
|
+
}) | {
|
|
327
|
+
key?: string;
|
|
328
|
+
/**
|
|
329
|
+
* The props of the style element. @deprecated Prefer setting the properties directly
|
|
330
|
+
* instead of using this property.
|
|
331
|
+
*/
|
|
332
|
+
props: Readonly<QwikIntrinsicElements['style']>;
|
|
333
|
+
}) & ({
|
|
334
|
+
/** The inline style content. */
|
|
335
|
+
style?: string;
|
|
336
|
+
dangerouslySetInnerHTML?: never;
|
|
337
|
+
} | {
|
|
338
|
+
dangerouslySetInnerHTML?: string;
|
|
339
|
+
style?: never;
|
|
340
|
+
})>;
|
|
284
341
|
|
|
285
342
|
declare type EndpointModuleLoader = () => Promise<RouteModule>;
|
|
286
343
|
|
|
344
|
+
declare interface EndpointResponse {
|
|
345
|
+
status: number;
|
|
346
|
+
loaders: Record<string, unknown>;
|
|
347
|
+
loadersSerializationStrategy: Map<string, SerializationStrategy>;
|
|
348
|
+
formData?: FormData;
|
|
349
|
+
action?: string;
|
|
350
|
+
}
|
|
351
|
+
|
|
287
352
|
/** @public */
|
|
288
353
|
export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
|
|
289
354
|
|
|
@@ -412,7 +477,7 @@ export declare interface LinkProps extends AnchorAttributes {
|
|
|
412
477
|
*
|
|
413
478
|
* This **improves UX performance** for client-side (**SPA**) navigations.
|
|
414
479
|
*
|
|
415
|
-
* Prefetching occurs when a the Link enters the viewport in production (**`
|
|
480
|
+
* Prefetching occurs when a the Link enters the viewport in production (**`q-e:qvisible`**), or
|
|
416
481
|
* with **`mouseover`/`focus`** during dev.
|
|
417
482
|
*
|
|
418
483
|
* Prefetching will not occur if the user has the **data saver** setting enabled.
|
|
@@ -426,6 +491,14 @@ export declare interface LinkProps extends AnchorAttributes {
|
|
|
426
491
|
scroll?: boolean;
|
|
427
492
|
}
|
|
428
493
|
|
|
494
|
+
declare type LoadedRoute = [
|
|
495
|
+
routeName: string,
|
|
496
|
+
params: PathParams,
|
|
497
|
+
mods: (RouteModule | ContentModule)[],
|
|
498
|
+
menu: ContentMenu | undefined,
|
|
499
|
+
routeBundleNames: string[] | undefined
|
|
500
|
+
];
|
|
501
|
+
|
|
429
502
|
/** @public */
|
|
430
503
|
declare type Loader_2<RETURN> = {
|
|
431
504
|
/**
|
|
@@ -450,11 +523,13 @@ declare type LoaderConstructorQRL = {
|
|
|
450
523
|
|
|
451
524
|
/** @public */
|
|
452
525
|
declare type LoaderOptions = {
|
|
453
|
-
id?: string;
|
|
526
|
+
readonly id?: string;
|
|
527
|
+
readonly validation?: DataValidator[];
|
|
528
|
+
readonly serializationStrategy?: SerializationStrategy;
|
|
454
529
|
};
|
|
455
530
|
|
|
456
531
|
/** @public */
|
|
457
|
-
export declare type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;
|
|
532
|
+
export declare type LoaderSignal<TYPE> = (TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>) & Pick<AsyncSignal, 'promise' | 'loading' | 'error'>;
|
|
458
533
|
|
|
459
534
|
/** @public */
|
|
460
535
|
export declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader];
|
|
@@ -507,6 +582,9 @@ declare type Prettify<T> = {} & {
|
|
|
507
582
|
*/
|
|
508
583
|
export declare type PreventNavigateCallback = (url?: number | URL) => ValueOrPromise<boolean>;
|
|
509
584
|
|
|
585
|
+
/** @public */
|
|
586
|
+
export declare const Q_ROUTE = "q:route";
|
|
587
|
+
|
|
510
588
|
/**
|
|
511
589
|
* @deprecated Use `QWIK_ROUTER_SCROLLER` instead (will be removed in V3)
|
|
512
590
|
* @public
|
|
@@ -517,13 +595,7 @@ export declare const QWIK_CITY_SCROLLER = "_qCityScroller";
|
|
|
517
595
|
export declare const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
|
|
518
596
|
|
|
519
597
|
/**
|
|
520
|
-
* @deprecated Use `
|
|
521
|
-
* @public
|
|
522
|
-
*/
|
|
523
|
-
export declare type QwikCityMockProps = QwikRouterMockProps;
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* @deprecated Use `QwikRouterMockProvider` instead. Will be removed in V3
|
|
598
|
+
* @deprecated Use `useQwikMockRouter()` instead. Will be removed in V3
|
|
527
599
|
* @public
|
|
528
600
|
*/
|
|
529
601
|
export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
|
|
@@ -535,13 +607,13 @@ export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
|
|
|
535
607
|
export declare type QwikCityPlan = QwikRouterConfig;
|
|
536
608
|
|
|
537
609
|
/**
|
|
538
|
-
* @deprecated Use `QwikRouterProps` instead.
|
|
610
|
+
* @deprecated Use `QwikRouterProps` instead. Will be removed in v3.
|
|
539
611
|
* @public
|
|
540
612
|
*/
|
|
541
613
|
export declare type QwikCityProps = QwikRouterProps;
|
|
542
614
|
|
|
543
615
|
/**
|
|
544
|
-
* @deprecated Use `
|
|
616
|
+
* @deprecated Use `useQwikRouter()` instead. Will be removed in v3.
|
|
545
617
|
* @public
|
|
546
618
|
*/
|
|
547
619
|
export declare const QwikCityProvider: Component<QwikRouterProps>;
|
|
@@ -556,11 +628,71 @@ export declare interface QwikRouterConfig {
|
|
|
556
628
|
readonly cacheModules?: boolean;
|
|
557
629
|
}
|
|
558
630
|
|
|
631
|
+
/** @public */
|
|
632
|
+
export declare interface QwikRouterEnvData {
|
|
633
|
+
routeName: string;
|
|
634
|
+
ev: RequestEvent;
|
|
635
|
+
params: PathParams;
|
|
636
|
+
response: EndpointResponse;
|
|
637
|
+
loadedRoute: LoadedRoute | null;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/** @public */
|
|
641
|
+
export declare interface QwikRouterMockActionProp<T = any> {
|
|
642
|
+
/** The action function to mock. */
|
|
643
|
+
action: Action<T>;
|
|
644
|
+
/** The QRL function that will be called when the action is submitted. */
|
|
645
|
+
handler: QRL<(data: T) => ValueOrPromise_2<RouteActionResolver>>;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/** @public */
|
|
649
|
+
export declare interface QwikRouterMockLoaderProp<T = any> {
|
|
650
|
+
/** The loader function to mock. */
|
|
651
|
+
loader: Loader_2<T>;
|
|
652
|
+
/** The data to return when the loader is called. */
|
|
653
|
+
data: T;
|
|
654
|
+
}
|
|
655
|
+
|
|
559
656
|
/** @public */
|
|
560
657
|
export declare interface QwikRouterMockProps {
|
|
658
|
+
/**
|
|
659
|
+
* Allow mocking the url returned by `useLocation` hook.
|
|
660
|
+
*
|
|
661
|
+
* Default: `http://localhost/`
|
|
662
|
+
*/
|
|
561
663
|
url?: string;
|
|
664
|
+
/** Allow mocking the route params returned by `useLocation` hook. */
|
|
562
665
|
params?: Record<string, string>;
|
|
666
|
+
/** Allow mocking the `goto` function returned by `useNavigate` hook. */
|
|
563
667
|
goto?: RouteNavigate;
|
|
668
|
+
/**
|
|
669
|
+
* Allow mocking data for loaders defined with `routeLoader$` function.
|
|
670
|
+
*
|
|
671
|
+
* ```
|
|
672
|
+
* [
|
|
673
|
+
* {
|
|
674
|
+
* loader: useProductData,
|
|
675
|
+
* data: { product: { name: 'Test Product' } },
|
|
676
|
+
* },
|
|
677
|
+
* ];
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
loaders?: Array<QwikRouterMockLoaderProp<any>>;
|
|
681
|
+
/**
|
|
682
|
+
* Allow mocking actions defined with `routeAction$` function.
|
|
683
|
+
*
|
|
684
|
+
* ```
|
|
685
|
+
* [
|
|
686
|
+
* {
|
|
687
|
+
* action: useAddUser,
|
|
688
|
+
* handler: $(async (data) => {
|
|
689
|
+
* console.log('useAddUser action called with data:', data);
|
|
690
|
+
* }),
|
|
691
|
+
* },
|
|
692
|
+
* ];
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
actions?: Array<QwikRouterMockActionProp<any>>;
|
|
564
696
|
}
|
|
565
697
|
|
|
566
698
|
/** @public */
|
|
@@ -575,12 +707,12 @@ export declare interface QwikRouterProps {
|
|
|
575
707
|
*
|
|
576
708
|
* @see https://github.com/WICG/view-transitions/blob/main/explainer.md
|
|
577
709
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
578
|
-
* @see https://caniuse.com/
|
|
710
|
+
* @see https://caniuse.com/mdn_api_viewtransition
|
|
579
711
|
*/
|
|
580
712
|
viewTransition?: boolean;
|
|
581
713
|
}
|
|
582
714
|
|
|
583
|
-
/** @public */
|
|
715
|
+
/** @public This is a wrapper around the `useQwikRouter()` hook. We recommend using the hook instead of this component, unless you have a good reason to make your root component reactive. */
|
|
584
716
|
export declare const QwikRouterProvider: Component<QwikRouterProps>;
|
|
585
717
|
|
|
586
718
|
/** @public */
|
|
@@ -588,6 +720,18 @@ declare interface ReadonlySignal_2<T = unknown> {
|
|
|
588
720
|
readonly value: T;
|
|
589
721
|
}
|
|
590
722
|
|
|
723
|
+
/** @public */
|
|
724
|
+
export declare type RendererOptions = Omit<RenderOptions, 'serverData'> & {
|
|
725
|
+
serverData: ServerData;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
/** @public */
|
|
729
|
+
export declare type RendererOutputOptions = Omit<RenderOptions, 'serverData'> & {
|
|
730
|
+
serverData: ServerData & {
|
|
731
|
+
documentHead?: DocumentHeadValue;
|
|
732
|
+
} & Record<string, unknown>;
|
|
733
|
+
};
|
|
734
|
+
|
|
591
735
|
export { RequestEvent }
|
|
592
736
|
|
|
593
737
|
export { RequestEventAction }
|
|
@@ -608,11 +752,21 @@ export declare const routeAction$: ActionConstructor;
|
|
|
608
752
|
|
|
609
753
|
/* Excluded from this release type: routeActionQrl */
|
|
610
754
|
|
|
755
|
+
declare type RouteActionResolver = {
|
|
756
|
+
status: number;
|
|
757
|
+
result: unknown;
|
|
758
|
+
};
|
|
759
|
+
|
|
611
760
|
/** @public */
|
|
612
|
-
export declare type RouteData = [
|
|
761
|
+
export declare type RouteData = [
|
|
762
|
+
routeName: string,
|
|
763
|
+
moduleLoaders: ModuleLoader[]
|
|
764
|
+
] | [
|
|
613
765
|
routeName: string,
|
|
614
|
-
|
|
766
|
+
moduleLoaders: ModuleLoader[],
|
|
767
|
+
/** The actual src/routes pathname, not rewritten */
|
|
615
768
|
originalPathname: string,
|
|
769
|
+
/** The bundles that contain the loaders */
|
|
616
770
|
routeBundleNames: string[]
|
|
617
771
|
];
|
|
618
772
|
|
|
@@ -662,6 +816,18 @@ declare interface ServerConfig {
|
|
|
662
816
|
fetchOptions?: any;
|
|
663
817
|
}
|
|
664
818
|
|
|
819
|
+
/** @public The server data that is provided by Qwik Router during SSR rendering. It can be retrieved with `useServerData(key)` in the server, but it is not available in the client. */
|
|
820
|
+
export declare type ServerData = {
|
|
821
|
+
url: string;
|
|
822
|
+
requestHeaders: Record<string, string>;
|
|
823
|
+
locale: string | undefined;
|
|
824
|
+
nonce: string | undefined;
|
|
825
|
+
containerAttributes: Record<string, string> & {
|
|
826
|
+
[Q_ROUTE]: string;
|
|
827
|
+
};
|
|
828
|
+
qwikrouter: QwikRouterEnvData;
|
|
829
|
+
};
|
|
830
|
+
|
|
665
831
|
/** @public */
|
|
666
832
|
export declare type ServerFunction = {
|
|
667
833
|
(this: RequestEventBase, ...args: any[]): any;
|
|
@@ -683,6 +849,12 @@ export declare type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSign
|
|
|
683
849
|
* JS extensions are allowed) will be picked up, bundled into a separate file, and registered as a
|
|
684
850
|
* service worker.
|
|
685
851
|
*
|
|
852
|
+
* Qwik 1.14.0 and above now use `<link rel="modulepreload">` by default. If you didn't add custom
|
|
853
|
+
* service-worker logic, you should remove your service-worker.ts file(s) for the
|
|
854
|
+
* `ServiceWorkerRegister` Component to actually unregister the service-worker.js and delete its
|
|
855
|
+
* related cache. Make sure to keep the `ServiceWorkerRegister` Component in your app (without any
|
|
856
|
+
* service-worker.ts file) as long as you want to unregister the service-worker.js for your users.
|
|
857
|
+
*
|
|
686
858
|
* @public
|
|
687
859
|
*/
|
|
688
860
|
export declare const ServiceWorkerRegister: (props: {
|
|
@@ -785,6 +957,14 @@ export declare const usePreventNavigate$: (qrl: PreventNavigateCallback) => void
|
|
|
785
957
|
|
|
786
958
|
/* Excluded from this release type: usePreventNavigateQrl */
|
|
787
959
|
|
|
960
|
+
/**
|
|
961
|
+
* @public
|
|
962
|
+
* This hook initializes Qwik Router, providing the necessary context for it to work.
|
|
963
|
+
*
|
|
964
|
+
* This hook should be used once, at the root of your application.
|
|
965
|
+
*/
|
|
966
|
+
export declare const useQwikRouter: (props?: QwikRouterProps) => void;
|
|
967
|
+
|
|
788
968
|
/** @beta */
|
|
789
969
|
export declare const valibot$: ValibotConstructor;
|
|
790
970
|
|