@qwik.dev/router 2.0.0-alpha.9 → 2.0.0-beta.2
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/README.md +1 -1
- package/lib/adapters/azure-swa/vite/index.cjs +3 -3
- package/lib/adapters/azure-swa/vite/index.d.ts +13 -13
- package/lib/adapters/bun-server/vite/index.cjs +3 -3
- package/lib/adapters/bun-server/vite/index.d.ts +14 -14
- package/lib/adapters/cloud-run/vite/index.cjs +3 -3
- package/lib/adapters/cloud-run/vite/index.d.ts +13 -13
- package/lib/adapters/cloudflare-pages/vite/index.cjs +3 -3
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +27 -27
- package/lib/adapters/deno-server/vite/index.cjs +3 -3
- package/lib/adapters/deno-server/vite/index.d.ts +14 -14
- package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
- package/lib/adapters/netlify-edge/vite/index.d.ts +44 -44
- package/lib/adapters/node-server/vite/index.cjs +3 -3
- package/lib/adapters/node-server/vite/index.d.ts +14 -14
- package/lib/adapters/shared/vite/index.cjs +10 -3
- package/lib/adapters/shared/vite/index.d.ts +114 -114
- package/lib/adapters/shared/vite/index.mjs +7 -0
- package/lib/adapters/static/vite/index.cjs +10 -3
- package/lib/adapters/static/vite/index.d.ts +10 -10
- package/lib/adapters/static/vite/index.mjs +7 -0
- package/lib/adapters/vercel-edge/vite/index.cjs +3 -3
- package/lib/adapters/vercel-edge/vite/index.d.ts +45 -45
- package/lib/index.d.ts +878 -810
- package/lib/index.qwik.cjs +110 -48
- package/lib/index.qwik.mjs +112 -50
- package/lib/middleware/aws-lambda/index.d.ts +48 -48
- package/lib/middleware/azure-swa/index.d.ts +28 -28
- package/lib/middleware/bun/index.d.ts +35 -35
- package/lib/middleware/cloudflare-pages/index.d.ts +35 -35
- package/lib/middleware/deno/index.d.ts +47 -47
- package/lib/middleware/firebase/index.d.ts +26 -26
- package/lib/middleware/netlify-edge/index.d.ts +27 -27
- package/lib/middleware/node/index.cjs +3 -3
- package/lib/middleware/node/index.d.ts +64 -64
- package/lib/middleware/request-handler/index.cjs +142 -73
- package/lib/middleware/request-handler/index.d.ts +710 -676
- package/lib/middleware/request-handler/index.mjs +138 -70
- package/lib/middleware/vercel-edge/index.d.ts +26 -26
- package/lib/service-worker.cjs +13 -263
- package/lib/service-worker.d.ts +15 -4
- package/lib/service-worker.mjs +13 -263
- package/lib/static/index.cjs +3 -3
- package/lib/static/index.d.ts +96 -96
- package/lib/static/node.cjs +3 -3
- package/lib/vite/index.cjs +209 -261
- package/lib/vite/index.d.ts +154 -154
- package/lib/vite/index.mjs +207 -259
- package/package.json +7 -7
package/lib/index.d.ts
CHANGED
|
@@ -1,812 +1,880 @@
|
|
|
1
1
|
/// <reference path="./modules.d.ts" />
|
|
2
2
|
|
|
3
|
-
import { Component } from '@qwik.dev/core';
|
|
4
|
-
import { Cookie } from '@qwik.dev/router/middleware/request-handler';
|
|
5
|
-
import { CookieOptions } from '@qwik.dev/router/middleware/request-handler';
|
|
6
|
-
import { CookieValue } from '@qwik.dev/router/middleware/request-handler';
|
|
7
|
-
import { DeferReturn } from '@qwik.dev/router/middleware/request-handler';
|
|
8
|
-
import type { EnvGetter } from '@qwik.dev/router/middleware/request-handler';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import type
|
|
23
|
-
import type
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* component$()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
readonly
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator
|
|
53
|
-
<OBJ extends Record<string, any> | void | null,
|
|
54
|
-
<OBJ
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
readonly
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
readonly
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
readonly
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator
|
|
75
|
-
<OBJ extends Record<string, any> | void | null,
|
|
76
|
-
<OBJ
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
readonly
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
readonly
|
|
163
|
-
readonly
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
readonly
|
|
170
|
-
readonly
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
readonly
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
/** @public */
|
|
210
|
-
export declare interface
|
|
211
|
-
|
|
212
|
-
readonly
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
readonly
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
readonly
|
|
267
|
-
readonly
|
|
268
|
-
readonly
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/** @
|
|
272
|
-
export declare interface
|
|
273
|
-
readonly
|
|
274
|
-
readonly props?: Readonly<QwikIntrinsicElements['
|
|
275
|
-
readonly key?: string;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
declare
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
declare type
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
/** @public */
|
|
352
|
-
export declare type
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
/** @public */
|
|
365
|
-
export declare
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
/** @public */
|
|
430
|
-
declare type
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
declare type
|
|
453
|
-
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
* @
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
export declare
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
export
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
/** @public */
|
|
612
|
-
declare
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
/** @public */
|
|
620
|
-
export declare
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
declare
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
*
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
export declare
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
/** @
|
|
724
|
-
declare type
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
/** @
|
|
789
|
-
export declare
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
<T extends
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
<T extends
|
|
800
|
-
<T extends
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
export
|
|
3
|
+
import { Component } from '@qwik.dev/core';
|
|
4
|
+
import { Cookie } from '@qwik.dev/router/middleware/request-handler';
|
|
5
|
+
import { CookieOptions } from '@qwik.dev/router/middleware/request-handler';
|
|
6
|
+
import { CookieValue } from '@qwik.dev/router/middleware/request-handler';
|
|
7
|
+
import { DeferReturn } from '@qwik.dev/router/middleware/request-handler';
|
|
8
|
+
import type { EnvGetter } from '@qwik.dev/router/middleware/request-handler';
|
|
9
|
+
import { JSXOutput as JSXOutput_2 } from '@qwik.dev/core';
|
|
10
|
+
import { QRL } from '@qwik.dev/core';
|
|
11
|
+
import { QRLEventHandlerMulti } from '@qwik.dev/core';
|
|
12
|
+
import { QwikIntrinsicElements } from '@qwik.dev/core';
|
|
13
|
+
import { QwikJSX } from '@qwik.dev/core';
|
|
14
|
+
import type { ReadonlySignal } from '@qwik.dev/core';
|
|
15
|
+
import { RequestEvent } from '@qwik.dev/router/middleware/request-handler';
|
|
16
|
+
import { RequestEventAction } from '@qwik.dev/router/middleware/request-handler';
|
|
17
|
+
import { RequestEventBase } from '@qwik.dev/router/middleware/request-handler';
|
|
18
|
+
import { RequestEventCommon } from '@qwik.dev/router/middleware/request-handler';
|
|
19
|
+
import { RequestEventLoader } from '@qwik.dev/router/middleware/request-handler';
|
|
20
|
+
import { RequestHandler } from '@qwik.dev/router/middleware/request-handler';
|
|
21
|
+
import type { ResolveSyncValue } from '@qwik.dev/router/middleware/request-handler';
|
|
22
|
+
import type * as v from 'valibot';
|
|
23
|
+
import type { ValueOrPromise } from '@qwik.dev/core';
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
import type * as z_2 from 'zod';
|
|
26
|
+
|
|
27
|
+
/** @public */
|
|
28
|
+
export declare type Action<RETURN, INPUT = Record<string, unknown>, OPTIONAL extends boolean = true> = {
|
|
29
|
+
/**
|
|
30
|
+
* Returns the `ActionStore` containing the current action state and methods to invoke it from a
|
|
31
|
+
* component$(). Like all `use-` functions and methods, it can only be invoked within a
|
|
32
|
+
* `component$()`.
|
|
33
|
+
*/
|
|
34
|
+
(): ActionStore<RETURN, INPUT, OPTIONAL>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @public */
|
|
38
|
+
export declare type ActionConstructor = {
|
|
39
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
|
|
40
|
+
readonly id?: string;
|
|
41
|
+
readonly validation: [VALIDATOR, ...REST];
|
|
42
|
+
}): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
43
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
|
|
44
|
+
readonly id?: string;
|
|
45
|
+
readonly validation: [VALIDATOR];
|
|
46
|
+
}): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
47
|
+
<OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
|
|
48
|
+
readonly id?: string;
|
|
49
|
+
readonly validation: REST;
|
|
50
|
+
}): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
51
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
52
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
53
|
+
<OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
54
|
+
<OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: {
|
|
55
|
+
readonly id?: string;
|
|
56
|
+
}): Action<StrictUnion<OBJ>>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** @public */
|
|
60
|
+
declare type ActionConstructorQRL = {
|
|
61
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
|
|
62
|
+
readonly id?: string;
|
|
63
|
+
readonly validation: [VALIDATOR, ...REST];
|
|
64
|
+
}): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
65
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
|
|
66
|
+
readonly id?: string;
|
|
67
|
+
readonly validation: [VALIDATOR];
|
|
68
|
+
}): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
69
|
+
<OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
|
|
70
|
+
readonly id?: string;
|
|
71
|
+
readonly validation: REST;
|
|
72
|
+
}): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
73
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: VALIDATOR, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
74
|
+
<OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: VALIDATOR): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
|
|
75
|
+
<OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
76
|
+
<OBJ>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options?: {
|
|
77
|
+
readonly id?: string;
|
|
78
|
+
}): Action<StrictUnion<OBJ>>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** @public */
|
|
82
|
+
export declare type ActionReturn<RETURN> = {
|
|
83
|
+
readonly status?: number;
|
|
84
|
+
readonly value: RETURN;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** @public */
|
|
88
|
+
export declare type ActionStore<RETURN, INPUT, OPTIONAL extends boolean = true> = {
|
|
89
|
+
/**
|
|
90
|
+
* It's the "action" path that a native `<form>` should have in order to call the action.
|
|
91
|
+
*
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <form action={action.actionPath} />
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* Most of the time this property should not be used directly, instead use the `Form` component:
|
|
97
|
+
*
|
|
98
|
+
* ```tsx
|
|
99
|
+
* import {action$, Form} from '@qwik.dev/router';
|
|
100
|
+
*
|
|
101
|
+
* export const useAddUser = action$(() => { ... });
|
|
102
|
+
*
|
|
103
|
+
* export default component$(() => {
|
|
104
|
+
* const action = useAddUser();
|
|
105
|
+
* return (
|
|
106
|
+
* <Form action={action}/>
|
|
107
|
+
* );
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
readonly actionPath: string;
|
|
112
|
+
/**
|
|
113
|
+
* Reactive property that becomes `true` only in the browser, when a form is submitted and
|
|
114
|
+
* switched back to false when the action finish, ie, it describes if the action is actively
|
|
115
|
+
* running.
|
|
116
|
+
*
|
|
117
|
+
* This property is specially useful to disable the submit button while the action is processing,
|
|
118
|
+
* to prevent multiple submissions, and to inform visually to the user that the action is actively
|
|
119
|
+
* running.
|
|
120
|
+
*
|
|
121
|
+
* It will be always `false` in the server, and only becomes `true` briefly while the action is
|
|
122
|
+
* running.
|
|
123
|
+
*/
|
|
124
|
+
readonly isRunning: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Returned HTTP status code of the action after its last execution.
|
|
127
|
+
*
|
|
128
|
+
* It's `undefined` before the action is first called.
|
|
129
|
+
*/
|
|
130
|
+
readonly status?: number;
|
|
131
|
+
/**
|
|
132
|
+
* When calling an action through a `<form>`, this property contains the previously submitted
|
|
133
|
+
* `FormData`.
|
|
134
|
+
*
|
|
135
|
+
* This is useful to keep the filled form data even after a full page reload.
|
|
136
|
+
*
|
|
137
|
+
* It's `undefined` before the action is first called.
|
|
138
|
+
*/
|
|
139
|
+
readonly formData: FormData | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Returned successful data of the action. This reactive property will contain the data returned
|
|
142
|
+
* inside the `action$` function.
|
|
143
|
+
*
|
|
144
|
+
* It's `undefined` before the action is first called.
|
|
145
|
+
*/
|
|
146
|
+
readonly value: RETURN | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Method to execute the action programmatically from the browser. Ie, instead of using a
|
|
149
|
+
* `<form>`, a 'click' handle can call the `run()` method of the action in order to execute the
|
|
150
|
+
* action in the server.
|
|
151
|
+
*/
|
|
152
|
+
readonly submit: QRL<OPTIONAL extends true ? (form?: INPUT | FormData | SubmitEvent) => Promise<ActionReturn<RETURN>> : (form: INPUT | FormData | SubmitEvent) => Promise<ActionReturn<RETURN>>>;
|
|
153
|
+
/** Is action.submit was submitted */
|
|
154
|
+
readonly submitted: boolean;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare type AnchorAttributes = QwikIntrinsicElements['a'];
|
|
158
|
+
|
|
159
|
+
/** @public */
|
|
160
|
+
export declare interface ContentHeading {
|
|
161
|
+
readonly text: string;
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly level: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** @public */
|
|
167
|
+
export declare interface ContentMenu {
|
|
168
|
+
readonly text: string;
|
|
169
|
+
readonly href?: string;
|
|
170
|
+
readonly items?: ContentMenu[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
declare type ContentModule = PageModule | LayoutModule;
|
|
174
|
+
|
|
175
|
+
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
|
|
176
|
+
|
|
177
|
+
declare type ContentModuleLoader = () => Promise<ContentModule>;
|
|
178
|
+
|
|
179
|
+
/** @public */
|
|
180
|
+
declare interface ContentState {
|
|
181
|
+
readonly headings: ContentHeading[] | undefined;
|
|
182
|
+
readonly menu: ContentMenu | undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { Cookie }
|
|
186
|
+
|
|
187
|
+
export { CookieOptions }
|
|
188
|
+
|
|
189
|
+
export { CookieValue }
|
|
190
|
+
|
|
191
|
+
/** @public */
|
|
192
|
+
export declare type DataValidator<T extends Record<string, any> = {}> = {
|
|
193
|
+
validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<T>>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export { DeferReturn }
|
|
197
|
+
|
|
198
|
+
/** @public */
|
|
199
|
+
declare interface DevJSX {
|
|
200
|
+
fileName: string;
|
|
201
|
+
lineNumber: number;
|
|
202
|
+
columnNumber: number;
|
|
203
|
+
stack?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** @public */
|
|
207
|
+
export declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => DocumentHeadValue);
|
|
208
|
+
|
|
209
|
+
/** @public */
|
|
210
|
+
export declare interface DocumentHeadProps extends RouteLocation {
|
|
211
|
+
readonly head: ResolvedDocumentHead;
|
|
212
|
+
readonly withLocale: <T>(fn: () => T) => T;
|
|
213
|
+
readonly resolveValue: ResolveSyncValue;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** @public */
|
|
217
|
+
export declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
|
|
218
|
+
/** Sets `document.title`. */
|
|
219
|
+
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
|
+
*/
|
|
224
|
+
readonly meta?: readonly DocumentMeta[];
|
|
225
|
+
/** Used to manually append `<link>` elements to the `<head>`. */
|
|
226
|
+
readonly links?: readonly DocumentLink[];
|
|
227
|
+
/** Used to manually append `<style>` elements to the `<head>`. */
|
|
228
|
+
readonly styles?: readonly DocumentStyle[];
|
|
229
|
+
/** Used to manually append `<script>` elements to the `<head>`. */
|
|
230
|
+
readonly scripts?: readonly DocumentScript[];
|
|
231
|
+
/**
|
|
232
|
+
* Arbitrary object containing custom data. When the document head is created from markdown files,
|
|
233
|
+
* the frontmatter attributes that are not recognized as a well-known meta names (such as title,
|
|
234
|
+
* description, author, etc...), are stored in this property.
|
|
235
|
+
*/
|
|
236
|
+
readonly frontmatter?: Readonly<FrontMatter>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** @public */
|
|
240
|
+
export declare interface DocumentLink {
|
|
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
|
+
}
|
|
259
|
+
|
|
260
|
+
/** @public */
|
|
261
|
+
export declare interface DocumentMeta {
|
|
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
|
+
}
|
|
277
|
+
|
|
278
|
+
/** @public */
|
|
279
|
+
export declare interface DocumentStyle {
|
|
280
|
+
readonly style: string;
|
|
281
|
+
readonly props?: Readonly<QwikIntrinsicElements['style']>;
|
|
282
|
+
readonly key?: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
declare type EndpointModuleLoader = () => Promise<RouteModule>;
|
|
286
|
+
|
|
287
|
+
/** @public */
|
|
288
|
+
export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
|
|
289
|
+
|
|
290
|
+
/** @public */
|
|
291
|
+
declare interface ErrorBoundaryProps {
|
|
292
|
+
fallback$?: QRL<(error: any) => any>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare type Failed = {
|
|
296
|
+
failed: true;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/** @public */
|
|
300
|
+
export declare type FailOfRest<REST extends readonly DataValidator[]> = REST extends readonly DataValidator<infer ERROR>[] ? ERROR : never;
|
|
301
|
+
|
|
302
|
+
/** @public */
|
|
303
|
+
export declare type FailReturn<T> = T & Failed;
|
|
304
|
+
|
|
305
|
+
/** @public */
|
|
306
|
+
export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput_2;
|
|
307
|
+
|
|
308
|
+
/** @public */
|
|
309
|
+
export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements['form'], 'action' | 'method'> {
|
|
310
|
+
/** Reference to the action returned by `action()`. */
|
|
311
|
+
action?: ActionStore<O, I, true | false>;
|
|
312
|
+
/**
|
|
313
|
+
* When `true` the form submission will cause a full page reload, even if SPA mode is enabled and
|
|
314
|
+
* JS is available.
|
|
315
|
+
*/
|
|
316
|
+
reloadDocument?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* When `true` all the form inputs will be reset in SPA mode, just like happens in a full page
|
|
319
|
+
* form submission.
|
|
320
|
+
*
|
|
321
|
+
* Defaults to `false`
|
|
322
|
+
*/
|
|
323
|
+
spaReset?: boolean;
|
|
324
|
+
/** Event handler executed right when the form is submitted. */
|
|
325
|
+
onSubmit$?: QRLEventHandlerMulti<SubmitEvent, HTMLFormElement> | undefined;
|
|
326
|
+
/** Event handler executed right after the action is executed successfully and returns some data. */
|
|
327
|
+
onSubmitCompleted$?: QRLEventHandlerMulti<CustomEvent<FormSubmitSuccessDetail<O>>, HTMLFormElement> | undefined;
|
|
328
|
+
key?: string | number | null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** @public */
|
|
332
|
+
export declare interface FormSubmitSuccessDetail<T> {
|
|
333
|
+
status: number;
|
|
334
|
+
value: T;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Any function taking a props object that returns JSXOutput.
|
|
339
|
+
*
|
|
340
|
+
* The `key`, `flags` and `dev` parameters are for internal use.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
declare type FunctionComponent<P = unknown> = {
|
|
345
|
+
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
|
|
346
|
+
}['renderFn'];
|
|
347
|
+
|
|
348
|
+
/** @public */
|
|
349
|
+
export declare type GetValidatorInputType<VALIDATOR extends TypedDataValidator> = VALIDATOR extends ValibotDataValidator<infer TYPE> ? v.InferInput<TYPE> : VALIDATOR extends ZodDataValidator<infer TYPE> ? z_2.input<TYPE> : never;
|
|
350
|
+
|
|
351
|
+
/** @public */
|
|
352
|
+
export declare type GetValidatorOutputType<VALIDATOR extends TypedDataValidator> = VALIDATOR extends ValibotDataValidator<infer TYPE> ? v.InferOutput<TYPE> : VALIDATOR extends ZodDataValidator<infer TYPE> ? z_2.output<TYPE> : never;
|
|
353
|
+
|
|
354
|
+
/** @public */
|
|
355
|
+
export declare type GetValidatorType<VALIDATOR extends TypedDataValidator> = GetValidatorOutputType<VALIDATOR>;
|
|
356
|
+
|
|
357
|
+
/** @public */
|
|
358
|
+
export declare const globalAction$: ActionConstructor;
|
|
359
|
+
|
|
360
|
+
/* Excluded from this release type: globalActionQrl */
|
|
361
|
+
|
|
362
|
+
declare type IsAny<Type> = 0 extends 1 & Type ? true : false;
|
|
363
|
+
|
|
364
|
+
/** @public */
|
|
365
|
+
export declare type JSONObject = {
|
|
366
|
+
[x: string]: JSONValue;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
/** @public */
|
|
370
|
+
export declare type JSONValue = string | number | boolean | {
|
|
371
|
+
[x: string]: JSONValue;
|
|
372
|
+
} | Array<JSONValue>;
|
|
373
|
+
|
|
374
|
+
/** @public */
|
|
375
|
+
declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
|
|
379
|
+
*
|
|
380
|
+
* @public
|
|
381
|
+
*/
|
|
382
|
+
declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
|
|
383
|
+
type: T;
|
|
384
|
+
props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
|
|
385
|
+
children: JSXChildren | null;
|
|
386
|
+
key: string | null;
|
|
387
|
+
dev?: DevJSX;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Any valid output for a component
|
|
392
|
+
*
|
|
393
|
+
* @public
|
|
394
|
+
*/
|
|
395
|
+
declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
|
|
396
|
+
|
|
397
|
+
declare interface LayoutModule extends RouteModule {
|
|
398
|
+
readonly default: unknown;
|
|
399
|
+
readonly head?: ContentModuleHead;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** @public */
|
|
403
|
+
export declare const Link: Component<LinkProps>;
|
|
404
|
+
|
|
405
|
+
/** @public */
|
|
406
|
+
export declare interface LinkProps extends AnchorAttributes {
|
|
407
|
+
/**
|
|
408
|
+
* **Defaults to _true_.**
|
|
409
|
+
*
|
|
410
|
+
* Whether Qwik should prefetch and cache the target page of this **`Link`**, this includes
|
|
411
|
+
* invoking any **`routeLoader$`**, **`onGet`**, etc.
|
|
412
|
+
*
|
|
413
|
+
* This **improves UX performance** for client-side (**SPA**) navigations.
|
|
414
|
+
*
|
|
415
|
+
* Prefetching occurs when a the Link enters the viewport in production (**`on:qvisible`**), or
|
|
416
|
+
* with **`mouseover`/`focus`** during dev.
|
|
417
|
+
*
|
|
418
|
+
* Prefetching will not occur if the user has the **data saver** setting enabled.
|
|
419
|
+
*
|
|
420
|
+
* Setting this value to **`"js"`** will prefetch only javascript bundles required to render this
|
|
421
|
+
* page on the client, **`false`** will disable prefetching altogether.
|
|
422
|
+
*/
|
|
423
|
+
prefetch?: boolean | 'js';
|
|
424
|
+
reload?: boolean;
|
|
425
|
+
replaceState?: boolean;
|
|
426
|
+
scroll?: boolean;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** @public */
|
|
430
|
+
declare type Loader_2<RETURN> = {
|
|
431
|
+
/**
|
|
432
|
+
* Returns the `Signal` containing the data returned by the `loader$` function. Like all `use-`
|
|
433
|
+
* functions and methods, it can only be invoked within a `component$()`.
|
|
434
|
+
*/
|
|
435
|
+
(): LoaderSignal<RETURN>;
|
|
436
|
+
};
|
|
437
|
+
export { Loader_2 as Loader }
|
|
438
|
+
|
|
439
|
+
/** @public */
|
|
440
|
+
declare type LoaderConstructor = {
|
|
441
|
+
<OBJ>(loaderFn: (event: RequestEventLoader) => ValueOrPromise<OBJ>, options?: LoaderOptions): Loader_2<[Extract<OBJ, Failed>] extends [never] ? OBJ : StrictUnion<OBJ>>;
|
|
442
|
+
<OBJ extends Record<string, any> | void | null, REST extends readonly DataValidator[]>(loaderFn: (event: RequestEventLoader) => ValueOrPromise<OBJ>, ...rest: REST): Loader_2<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
/** @public */
|
|
446
|
+
declare type LoaderConstructorQRL = {
|
|
447
|
+
<OBJ>(loaderQrl: QRL<(event: RequestEventLoader) => ValueOrPromise<OBJ>>, options?: LoaderOptions): Loader_2<[Extract<OBJ, Failed>] extends [never] ? OBJ : StrictUnion<OBJ>>;
|
|
448
|
+
<OBJ extends Record<string, any> | void | null, REST extends readonly DataValidator[]>(loaderQrl: QRL<(event: RequestEventLoader) => ValueOrPromise<OBJ>>, ...rest: REST): Loader_2<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
/** @public */
|
|
452
|
+
declare type LoaderOptions = {
|
|
453
|
+
id?: string;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/** @public */
|
|
457
|
+
export declare type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;
|
|
458
|
+
|
|
459
|
+
/** @public */
|
|
460
|
+
export declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader];
|
|
461
|
+
|
|
462
|
+
declare interface MenuModule {
|
|
463
|
+
readonly default: ContentMenu;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
declare type MenuModuleLoader = () => Promise<MenuModule>;
|
|
467
|
+
|
|
468
|
+
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader;
|
|
469
|
+
|
|
470
|
+
/** @public */
|
|
471
|
+
declare type NavigationType_2 = 'initial' | 'form' | 'link' | 'popstate';
|
|
472
|
+
export { NavigationType_2 as NavigationType }
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Creates a new object from `obj` by omitting a set of `keys`.
|
|
476
|
+
*
|
|
477
|
+
* @beta
|
|
478
|
+
* @experimental
|
|
479
|
+
*/
|
|
480
|
+
export declare function omitProps<T, KEYS extends keyof T>(obj: T, keys: KEYS[]): Omit<T, KEYS>;
|
|
481
|
+
|
|
482
|
+
/** @public */
|
|
483
|
+
export declare interface PageModule extends RouteModule {
|
|
484
|
+
readonly default: unknown;
|
|
485
|
+
readonly head?: ContentModuleHead;
|
|
486
|
+
readonly headings?: ContentHeading[];
|
|
487
|
+
readonly onStaticGenerate?: StaticGenerateHandler;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/** @public */
|
|
491
|
+
export declare type PathParams = Record<string, string>;
|
|
492
|
+
|
|
493
|
+
declare type Prettify<T> = {} & {
|
|
494
|
+
[K in keyof T]: T[K];
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* @param url - The URL that the user is trying to navigate to, or a number to indicate the user is
|
|
499
|
+
* trying to navigate back/forward in the application history. If it is missing, the event is sent
|
|
500
|
+
* by the browser and the user is trying to reload or navigate away from the page. In this case,
|
|
501
|
+
* the function should decide the answer synchronously.
|
|
502
|
+
* @returns `true` to prevent navigation, `false` to allow navigation, or a Promise that resolves to
|
|
503
|
+
* `true` or `false`. For browser events, returning `true` or a Promise may show a confirmation
|
|
504
|
+
* dialog, at the browser's discretion. If the user confirms, the navigation will still be
|
|
505
|
+
* allowed.
|
|
506
|
+
* @public
|
|
507
|
+
*/
|
|
508
|
+
export declare type PreventNavigateCallback = (url?: number | URL) => ValueOrPromise<boolean>;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* @deprecated Use `QWIK_ROUTER_SCROLLER` instead (will be removed in V3)
|
|
512
|
+
* @public
|
|
513
|
+
*/
|
|
514
|
+
export declare const QWIK_CITY_SCROLLER = "_qCityScroller";
|
|
515
|
+
|
|
516
|
+
/** @public */
|
|
517
|
+
export declare const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @deprecated Use `QwikRouterMockProps` instead. will be removed in V3
|
|
521
|
+
* @public
|
|
522
|
+
*/
|
|
523
|
+
export declare type QwikCityMockProps = QwikRouterMockProps;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @deprecated Use `QwikRouterMockProvider` instead. Will be removed in V3
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* @deprecated Use `QwikRouterConfig` instead. Will be removed in V3.
|
|
533
|
+
* @public
|
|
534
|
+
*/
|
|
535
|
+
export declare type QwikCityPlan = QwikRouterConfig;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated Use `QwikRouterProps` instead. will be removed in V3
|
|
539
|
+
* @public
|
|
540
|
+
*/
|
|
541
|
+
export declare type QwikCityProps = QwikRouterProps;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* @deprecated Use `QwikRouterProvider` instead. will be removed in V3
|
|
545
|
+
* @public
|
|
546
|
+
*/
|
|
547
|
+
export declare const QwikCityProvider: Component<QwikRouterProps>;
|
|
548
|
+
|
|
549
|
+
/** @public */
|
|
550
|
+
export declare interface QwikRouterConfig {
|
|
551
|
+
readonly routes: RouteData[];
|
|
552
|
+
readonly serverPlugins?: RouteModule[];
|
|
553
|
+
readonly basePathname?: string;
|
|
554
|
+
readonly menus?: MenuData[];
|
|
555
|
+
readonly trailingSlash?: boolean;
|
|
556
|
+
readonly cacheModules?: boolean;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** @public */
|
|
560
|
+
export declare interface QwikRouterMockProps {
|
|
561
|
+
url?: string;
|
|
562
|
+
params?: Record<string, string>;
|
|
563
|
+
goto?: RouteNavigate;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** @public */
|
|
567
|
+
export declare const QwikRouterMockProvider: Component<QwikRouterMockProps>;
|
|
568
|
+
|
|
569
|
+
/** @public */
|
|
570
|
+
export declare interface QwikRouterProps {
|
|
571
|
+
/**
|
|
572
|
+
* Enable the ViewTransition API
|
|
573
|
+
*
|
|
574
|
+
* Default: `true`
|
|
575
|
+
*
|
|
576
|
+
* @see https://github.com/WICG/view-transitions/blob/main/explainer.md
|
|
577
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
578
|
+
* @see https://caniuse.com/mdn-api_viewtransition
|
|
579
|
+
*/
|
|
580
|
+
viewTransition?: boolean;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/** @public */
|
|
584
|
+
export declare const QwikRouterProvider: Component<QwikRouterProps>;
|
|
585
|
+
|
|
586
|
+
/** @public */
|
|
587
|
+
declare interface ReadonlySignal_2<T = unknown> {
|
|
588
|
+
readonly value: T;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export { RequestEvent }
|
|
592
|
+
|
|
593
|
+
export { RequestEventAction }
|
|
594
|
+
|
|
595
|
+
export { RequestEventBase }
|
|
596
|
+
|
|
597
|
+
export { RequestEventCommon }
|
|
598
|
+
|
|
599
|
+
export { RequestEventLoader }
|
|
600
|
+
|
|
601
|
+
export { RequestHandler }
|
|
602
|
+
|
|
603
|
+
/** @public */
|
|
604
|
+
export declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>>;
|
|
605
|
+
|
|
606
|
+
/** @public */
|
|
607
|
+
export declare const routeAction$: ActionConstructor;
|
|
608
|
+
|
|
609
|
+
/* Excluded from this release type: routeActionQrl */
|
|
610
|
+
|
|
611
|
+
/** @public */
|
|
612
|
+
export declare type RouteData = [routeName: string, loaders: ModuleLoader[]] | [
|
|
613
|
+
routeName: string,
|
|
614
|
+
loaders: ModuleLoader[],
|
|
615
|
+
originalPathname: string,
|
|
616
|
+
routeBundleNames: string[]
|
|
617
|
+
];
|
|
618
|
+
|
|
619
|
+
/** @public */
|
|
620
|
+
export declare const routeLoader$: LoaderConstructor;
|
|
621
|
+
|
|
622
|
+
/* Excluded from this release type: routeLoaderQrl */
|
|
623
|
+
|
|
624
|
+
/** @public */
|
|
625
|
+
export declare interface RouteLocation {
|
|
626
|
+
readonly params: Readonly<Record<string, string>>;
|
|
627
|
+
readonly url: URL;
|
|
628
|
+
readonly isNavigating: boolean;
|
|
629
|
+
readonly prevUrl: URL | undefined;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare interface RouteModule<BODY = unknown> {
|
|
633
|
+
onDelete?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
634
|
+
onGet?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
635
|
+
onHead?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
636
|
+
onOptions?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
637
|
+
onPatch?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
638
|
+
onPost?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
639
|
+
onPut?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
640
|
+
onRequest?: RequestHandler<BODY> | RequestHandler<BODY>[];
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/** @public */
|
|
644
|
+
export declare type RouteNavigate = QRL<(path?: string | number | URL, options?: {
|
|
645
|
+
type?: Exclude<NavigationType_2, 'initial'>;
|
|
646
|
+
forceReload?: boolean;
|
|
647
|
+
replaceState?: boolean;
|
|
648
|
+
scroll?: boolean;
|
|
649
|
+
} | boolean) => Promise<void>>;
|
|
650
|
+
|
|
651
|
+
/** @public */
|
|
652
|
+
export declare const RouterOutlet: Component<unknown>;
|
|
653
|
+
|
|
654
|
+
/** @public */
|
|
655
|
+
export declare const server$: <T extends ServerFunction>(qrl: T, options?: ServerConfig | undefined) => ServerQRL<T>;
|
|
656
|
+
|
|
657
|
+
/** @public */
|
|
658
|
+
declare interface ServerConfig {
|
|
659
|
+
origin?: string;
|
|
660
|
+
method?: 'get' | 'post';
|
|
661
|
+
headers?: Record<string, string>;
|
|
662
|
+
fetchOptions?: any;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/** @public */
|
|
666
|
+
export declare type ServerFunction = {
|
|
667
|
+
(this: RequestEventBase, ...args: any[]): any;
|
|
668
|
+
options?: ServerConfig;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* You can pass an AbortSignal as the first argument of a `server$` function and it will use it to
|
|
673
|
+
* abort the fetch when fired.
|
|
674
|
+
*
|
|
675
|
+
* @public
|
|
676
|
+
*/
|
|
677
|
+
export declare type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSignal, ...args: Parameters<T>) => ReturnType<T>) | ((...args: Parameters<T>) => ReturnType<T>)>;
|
|
678
|
+
|
|
679
|
+
/* Excluded from this release type: serverQrl */
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Loads the service workers that are defined in the routes. Any file named `service-worker.*` (all
|
|
683
|
+
* JS extensions are allowed) will be picked up, bundled into a separate file, and registered as a
|
|
684
|
+
* service worker.
|
|
685
|
+
*
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
688
|
+
export declare const ServiceWorkerRegister: (props: {
|
|
689
|
+
nonce?: string;
|
|
690
|
+
}) => JSXOutput;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* A signal is a reactive value which can be read and written. When the signal is written, all tasks
|
|
694
|
+
* which are tracking the signal will be re-run and all components that read the signal will be
|
|
695
|
+
* re-rendered.
|
|
696
|
+
*
|
|
697
|
+
* Furthermore, when a signal value is passed as a prop to a component, the optimizer will
|
|
698
|
+
* automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
|
|
699
|
+
* will update the `title` attribute when the signal changes without having to re-render the
|
|
700
|
+
* component.
|
|
701
|
+
*
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
704
|
+
declare interface Signal<T = any> extends ReadonlySignal_2<T> {
|
|
705
|
+
value: T;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/** @public */
|
|
709
|
+
export declare interface StaticGenerate {
|
|
710
|
+
params?: PathParams[];
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/** @public */
|
|
714
|
+
export declare type StaticGenerateHandler = ({ env, }: {
|
|
715
|
+
env: EnvGetter;
|
|
716
|
+
}) => Promise<StaticGenerate> | StaticGenerate;
|
|
717
|
+
|
|
718
|
+
/** @public */
|
|
719
|
+
export declare type StrictUnion<T> = Prettify<StrictUnionHelper<T, T>>;
|
|
720
|
+
|
|
721
|
+
declare type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
722
|
+
|
|
723
|
+
/** @public */
|
|
724
|
+
export declare type TypedDataValidator = ValibotDataValidator | ZodDataValidator;
|
|
725
|
+
|
|
726
|
+
declare type UnionKeys<T> = T extends T ? keyof T : never;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* @beta
|
|
730
|
+
* @experimental
|
|
731
|
+
*/
|
|
732
|
+
export declare const untypedAppUrl: (route: string, params?: Record<string, string>, paramsPrefix?: string) => string;
|
|
733
|
+
|
|
734
|
+
/** @public */
|
|
735
|
+
export declare const useContent: () => ContentState;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Returns the document head for the current page. The generic type describes the front matter.
|
|
739
|
+
*
|
|
740
|
+
* @public
|
|
741
|
+
*/
|
|
742
|
+
export declare const useDocumentHead: <FrontMatter extends Record<string, unknown> = Record<string, any>>() => Required<ResolvedDocumentHead<FrontMatter>>;
|
|
743
|
+
|
|
744
|
+
/** @public */
|
|
745
|
+
export declare const useLocation: () => RouteLocation;
|
|
746
|
+
|
|
747
|
+
/** @public */
|
|
748
|
+
export declare const useNavigate: () => RouteNavigate;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Prevent navigation attempts. This hook registers a callback that will be called before SPA or
|
|
752
|
+
* browser navigation.
|
|
753
|
+
*
|
|
754
|
+
* Return `true` to prevent navigation.
|
|
755
|
+
*
|
|
756
|
+
* #### SPA Navigation
|
|
757
|
+
*
|
|
758
|
+
* For Single-Page-App (SPA) navigation (via `<Link />`, `const nav = useNavigate()`, and browser
|
|
759
|
+
* backwards/forwards inside SPA history), the callback will be provided with the target, either a
|
|
760
|
+
* URL or a number. It will only be a number if `nav(number)` was called to navigate forwards or
|
|
761
|
+
* backwards in SPA history.
|
|
762
|
+
*
|
|
763
|
+
* If you return a Promise, the navigation will be blocked until the promise resolves.
|
|
764
|
+
*
|
|
765
|
+
* This can be used to show a nice dialog to the user, and wait for the user to confirm, or to
|
|
766
|
+
* record the url, prevent the navigation, and navigate there later via `nav(url)`.
|
|
767
|
+
*
|
|
768
|
+
* #### Browser Navigation
|
|
769
|
+
*
|
|
770
|
+
* However, when the user navigates away by clicking on a regular `<a />`, reloading, or moving
|
|
771
|
+
* backwards/forwards outside SPA history, this callback will not be awaited. This is because the
|
|
772
|
+
* browser does not provide a way to asynchronously prevent these navigations.
|
|
773
|
+
*
|
|
774
|
+
* In this case, returning returning `true` will tell the browser to show a confirmation dialog,
|
|
775
|
+
* which cannot be customized. You are also not able to show your own `window.confirm()` dialog
|
|
776
|
+
* during the callback, the browser won't allow it. If you return a Promise, it will be considered
|
|
777
|
+
* as `true`.
|
|
778
|
+
*
|
|
779
|
+
* When the callback is called from the browser, no url will be provided. Use this to know whether
|
|
780
|
+
* you can show a dialog or just return `true` to prevent the navigation.
|
|
781
|
+
*
|
|
782
|
+
* @public
|
|
783
|
+
*/
|
|
784
|
+
export declare const usePreventNavigate$: (qrl: PreventNavigateCallback) => void;
|
|
785
|
+
|
|
786
|
+
/* Excluded from this release type: usePreventNavigateQrl */
|
|
787
|
+
|
|
788
|
+
/** @beta */
|
|
789
|
+
export declare const valibot$: ValibotConstructor;
|
|
790
|
+
|
|
791
|
+
/** @beta */
|
|
792
|
+
declare type ValibotConstructor = {
|
|
793
|
+
<T extends v.GenericSchema | v.GenericSchemaAsync>(schema: T): ValibotDataValidator<T>;
|
|
794
|
+
<T extends v.GenericSchema | v.GenericSchemaAsync>(schema: (ev: RequestEvent) => T): ValibotDataValidator<T>;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/** @beta */
|
|
798
|
+
declare type ValibotConstructorQRL = {
|
|
799
|
+
<T extends v.GenericSchema | v.GenericSchemaAsync>(schema: QRL<T>): ValibotDataValidator<T>;
|
|
800
|
+
<T extends v.GenericSchema | v.GenericSchemaAsync>(schema: QRL<(ev: RequestEvent) => T>): ValibotDataValidator<T>;
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
/** @beta */
|
|
804
|
+
declare type ValibotDataValidator<T extends v.GenericSchema | v.GenericSchemaAsync = v.GenericSchema | v.GenericSchemaAsync> = {
|
|
805
|
+
readonly __brand: 'valibot';
|
|
806
|
+
validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<ValidatorErrorType<v.InferInput<T>>>>;
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
/* Excluded from this release type: valibotQrl */
|
|
810
|
+
|
|
811
|
+
/** @public */
|
|
812
|
+
export declare const validator$: ValidatorConstructor;
|
|
813
|
+
|
|
814
|
+
declare type ValidatorConstructor = {
|
|
815
|
+
<T extends ValidatorReturn>(validator: (ev: RequestEvent, data: unknown) => ValueOrPromise<T>): T extends ValidatorReturnFail<infer ERROR> ? DataValidator<ERROR> : DataValidator<never>;
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
declare type ValidatorConstructorQRL = {
|
|
819
|
+
<T extends ValidatorReturn>(validator: QRL<(ev: RequestEvent, data: unknown) => ValueOrPromise<T>>): T extends ValidatorReturnFail<infer ERROR> ? DataValidator<ERROR> : DataValidator<never>;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
/** @public */
|
|
823
|
+
export declare type ValidatorErrorKeyDotNotation<T, Prefix extends string = ''> = IsAny<T> extends true ? never : T extends object ? {
|
|
824
|
+
[K in keyof T & string]: IsAny<T[K]> extends true ? never : T[K] extends (infer U)[] ? IsAny<U> extends true ? never : U extends object ? `${Prefix}${K}[]` | ValidatorErrorKeyDotNotation<U, `${Prefix}${K}[].`> : `${Prefix}${K}[]` : T[K] extends object ? ValidatorErrorKeyDotNotation<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
|
|
825
|
+
}[keyof T & string] : never;
|
|
826
|
+
|
|
827
|
+
/** @public */
|
|
828
|
+
export declare type ValidatorErrorType<T, U = string> = {
|
|
829
|
+
formErrors: U[];
|
|
830
|
+
fieldErrors: Partial<{
|
|
831
|
+
[K in ValidatorErrorKeyDotNotation<T>]: K extends `${infer _Prefix}[]${infer _Suffix}` ? U[] : U;
|
|
832
|
+
}>;
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
/* Excluded from this release type: validatorQrl */
|
|
836
|
+
|
|
837
|
+
/** @public */
|
|
838
|
+
export declare type ValidatorReturn<T extends Record<string, any> = {}> = ValidatorReturnSuccess | ValidatorReturnFail<T>;
|
|
839
|
+
|
|
840
|
+
declare type ValidatorReturnFail<T extends Record<string, any> = {}> = {
|
|
841
|
+
readonly success: false;
|
|
842
|
+
readonly error: T;
|
|
843
|
+
readonly status?: number;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
declare type ValidatorReturnSuccess = {
|
|
847
|
+
readonly success: true;
|
|
848
|
+
readonly data?: unknown;
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
export { z }
|
|
852
|
+
|
|
853
|
+
/** @public */
|
|
854
|
+
export declare const zod$: ZodConstructor;
|
|
855
|
+
|
|
856
|
+
/** @public */
|
|
857
|
+
export declare type ZodConstructor = {
|
|
858
|
+
<T extends z_2.ZodRawShape>(schema: T): ZodDataValidator<z_2.ZodObject<T>>;
|
|
859
|
+
<T extends z_2.ZodRawShape>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<z_2.ZodObject<T>>;
|
|
860
|
+
<T extends z_2.Schema>(schema: T): ZodDataValidator<T>;
|
|
861
|
+
<T extends z_2.Schema>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<T>;
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
/** @public */
|
|
865
|
+
declare type ZodConstructorQRL = {
|
|
866
|
+
<T extends z_2.ZodRawShape>(schema: QRL<T>): ZodDataValidator<z_2.ZodObject<T>>;
|
|
867
|
+
<T extends z_2.ZodRawShape>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<z_2.ZodObject<T>>;
|
|
868
|
+
<T extends z_2.Schema>(schema: QRL<T>): ZodDataValidator<T>;
|
|
869
|
+
<T extends z_2.Schema>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<T>;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
/** @public */
|
|
873
|
+
declare type ZodDataValidator<T extends z_2.ZodType = z_2.ZodType> = {
|
|
874
|
+
readonly __brand: 'zod';
|
|
875
|
+
validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<ValidatorErrorType<z_2.input<T>>>>;
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
/* Excluded from this release type: zodQrl */
|
|
879
|
+
|
|
880
|
+
export { }
|