@kimesh/query 0.2.48 → 0.2.49

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 (2) hide show
  1. package/dist/index.d.mts +1445 -2
  2. package/package.json +2 -7
package/dist/index.d.mts CHANGED
@@ -2,8 +2,7 @@ import * as _tanstack_vue_query0 from "@tanstack/vue-query";
2
2
  import { QueryClient, QueryClient as QueryClient$1, QueryKey, QueryKey as QueryKey$1, UseInfiniteQueryReturnType, UseQueryReturnType, VueQueryPlugin, VueQueryPluginOptions, queryOptions, useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
3
3
  import { FetchContext, FetchContext as FetchContext$1, FetchError, FetchResponse, FetchResponse as FetchResponse$1 } from "ofetch";
4
4
  import * as vue from "vue";
5
- import { ComputedRef, MaybeRefOrGetter, Plugin, Ref, WatchSource } from "vue";
6
- import { RouteLocationNormalized, Router } from "vue-router";
5
+ import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, MaybeRef, MaybeRefOrGetter, Plugin, Ref, ShallowRef, UnwrapRef, VNode, VNodeProps, WatchSource } from "vue";
7
6
 
8
7
  //#region src/plugin.d.ts
9
8
  /**
@@ -219,6 +218,1450 @@ interface LayerFetchPluginOptions {
219
218
  */
220
219
  declare function layerFetchPlugin(options: LayerFetchPluginOptions): () => void;
221
220
  //#endregion
221
+ //#region ../../node_modules/.pnpm/vue-router@5.0.4_@vue+compiler-sfc@3.5.30_pinia@3.0.4_typescript@5.9.3_vue@3.5.29_types_d61141097fb336273056f1bc288b9240/node_modules/vue-router/dist/index-BzEKChPW.d.ts
222
+ //#region src/config.d.ts
223
+ /**
224
+ * Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
225
+ *
226
+ * - `$router` - the router instance
227
+ * - `$route` - the current route location
228
+ * - `beforeRouteEnter` - Page component option
229
+ * - `beforeRouteUpdate` - Page component option
230
+ * - `beforeRouteLeave` - Page component option
231
+ * - `RouterLink` - RouterLink Component
232
+ * - `RouterView` - RouterView Component
233
+ *
234
+ * @internal
235
+ */
236
+ interface TypesConfig {} //#endregion
237
+ //#region src/query.d.ts
238
+ /**
239
+ * Possible values in normalized {@link LocationQuery}. `null` renders the query
240
+ * param but without an `=`.
241
+ *
242
+ * @example
243
+ * ```
244
+ * ?isNull&isEmpty=&other=other
245
+ * gives
246
+ * `{ isNull: null, isEmpty: '', other: 'other' }`.
247
+ * ```
248
+ *
249
+ * @internal
250
+ */
251
+ type LocationQueryValue = string | null;
252
+ /**
253
+ * Possible values when defining a query. `undefined` allows to remove a value.
254
+ *
255
+ * @internal
256
+ */
257
+ type LocationQueryValueRaw = LocationQueryValue | number | undefined;
258
+ /**
259
+ * Normalized query object that appears in {@link RouteLocationNormalized}
260
+ *
261
+ * @public
262
+ */
263
+ type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
264
+ /**
265
+ * Loose {@link LocationQuery} object that can be passed to functions like
266
+ * {@link Router.push} and {@link Router.replace} or anywhere when creating a
267
+ * {@link RouteLocationRaw}
268
+ *
269
+ * @public
270
+ */
271
+ type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
272
+ /**
273
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
274
+ * version with the leading `?` and without Should work as URLSearchParams
275
+
276
+ * @internal
277
+ *
278
+ * @param search - search string to parse
279
+ * @returns a query object
280
+ */
281
+ declare function parseQuery(search: string): LocationQuery;
282
+ /**
283
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
284
+ * doesn't prepend a `?`
285
+ *
286
+ * @internal
287
+ *
288
+ * @param query - query object to stringify
289
+ * @returns string version of the query without the leading `?`
290
+ */
291
+ declare function stringifyQuery(query: LocationQueryRaw | undefined): string; //#endregion
292
+ //#region src/matcher/types.d.ts
293
+ /**
294
+ * Normalized version of a {@link RouteRecord | route record}.
295
+ */
296
+ interface RouteRecordNormalized {
297
+ /**
298
+ * {@inheritDoc _RouteRecordBase.path}
299
+ */
300
+ path: _RouteRecordBase['path'];
301
+ /**
302
+ * {@inheritDoc _RouteRecordBase.redirect}
303
+ */
304
+ redirect: _RouteRecordBase['redirect'] | undefined;
305
+ /**
306
+ * {@inheritDoc _RouteRecordBase.name}
307
+ */
308
+ name: _RouteRecordBase['name'];
309
+ /**
310
+ * {@inheritDoc RouteRecordMultipleViews.components}
311
+ */
312
+ components: RouteRecordMultipleViews['components'] | null | undefined;
313
+ /**
314
+ * Contains the original modules for lazy loaded components.
315
+ * @internal
316
+ */
317
+ mods: Record<string, unknown>;
318
+ /**
319
+ * Nested route records.
320
+ */
321
+ children: RouteRecordRaw[];
322
+ /**
323
+ * {@inheritDoc _RouteRecordBase.meta}
324
+ */
325
+ meta: Exclude<_RouteRecordBase['meta'], void>;
326
+ /**
327
+ * {@inheritDoc RouteRecordMultipleViews.props}
328
+ */
329
+ props: Record<string, _RouteRecordProps>;
330
+ /**
331
+ * Registered beforeEnter guards
332
+ */
333
+ beforeEnter: _RouteRecordBase['beforeEnter'];
334
+ /**
335
+ * Registered leave guards
336
+ *
337
+ * @internal
338
+ */
339
+ leaveGuards: Set<NavigationGuard>;
340
+ /**
341
+ * Registered update guards
342
+ *
343
+ * @internal
344
+ */
345
+ updateGuards: Set<NavigationGuard>;
346
+ /**
347
+ * Registered beforeRouteEnter callbacks passed to `next` or returned in guards
348
+ *
349
+ * @internal
350
+ */
351
+ enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
352
+ /**
353
+ * Mounted route component instances
354
+ * Having the instances on the record mean beforeRouteUpdate and
355
+ * beforeRouteLeave guards can only be invoked with the latest mounted app
356
+ * instance if there are multiple application instances rendering the same
357
+ * view, basically duplicating the content on the page, which shouldn't happen
358
+ * in practice. It will work if multiple apps are rendering different named
359
+ * views.
360
+ */
361
+ instances: Record<string, ComponentPublicInstance | undefined | null>;
362
+ /**
363
+ * Defines if this record is the alias of another one. This property is
364
+ * `undefined` if the record is the original one.
365
+ */
366
+ aliasOf: RouteRecordNormalized | undefined;
367
+ }
368
+ /**
369
+ * {@inheritDoc RouteRecordNormalized}
370
+ */
371
+ type RouteRecord = RouteRecordNormalized; //#endregion
372
+ //#region src/matcher/pathParserRanker.d.ts
373
+ /**
374
+ * @internal
375
+ */
376
+ interface _PathParserOptions {
377
+ /**
378
+ * Makes the RegExp case-sensitive.
379
+ *
380
+ * @defaultValue `false`
381
+ */
382
+ sensitive?: boolean;
383
+ /**
384
+ * Whether to disallow a trailing slash or not.
385
+ *
386
+ * @defaultValue `false`
387
+ */
388
+ strict?: boolean;
389
+ /**
390
+ * Should the RegExp match from the beginning by prepending a `^` to it.
391
+ * @internal
392
+ *
393
+ * @defaultValue `true`
394
+ */
395
+ start?: boolean;
396
+ /**
397
+ * Should the RegExp match until the end by appending a `$` to it.
398
+ *
399
+ * @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
400
+ *
401
+ * @defaultValue `true`
402
+ */
403
+ end?: boolean;
404
+ }
405
+ type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>; //#endregion
406
+ //#region src/matcher/pathMatcher.d.ts
407
+ //#endregion
408
+ //#region src/history/common.d.ts
409
+ type HistoryLocation = string;
410
+ /**
411
+ * Allowed variables in HTML5 history state. Note that pushState clones the state
412
+ * passed and does not accept everything: e.g.: it doesn't accept symbols, nor
413
+ * functions as values. It also ignores Symbols as keys.
414
+ *
415
+ * @internal
416
+ */
417
+ type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
418
+ /**
419
+ * Allowed HTML history.state
420
+ */
421
+ interface HistoryState {
422
+ [x: number]: HistoryStateValue;
423
+ [x: string]: HistoryStateValue;
424
+ }
425
+ /**
426
+ * Allowed arrays for history.state.
427
+ *
428
+ * @internal
429
+ */
430
+ interface HistoryStateArray extends Array<HistoryStateValue> {}
431
+ declare enum NavigationType {
432
+ pop = "pop",
433
+ push = "push"
434
+ }
435
+ declare enum NavigationDirection {
436
+ back = "back",
437
+ forward = "forward",
438
+ unknown = ""
439
+ }
440
+ interface NavigationInformation {
441
+ type: NavigationType;
442
+ direction: NavigationDirection;
443
+ delta: number;
444
+ }
445
+ interface NavigationCallback {
446
+ (to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
447
+ }
448
+ /**
449
+ * Interface implemented by History implementations that can be passed to the
450
+ * router as {@link Router.history}
451
+ *
452
+ * @alpha
453
+ */
454
+ interface RouterHistory {
455
+ /**
456
+ * Base path that is prepended to every url. This allows hosting an SPA at a
457
+ * sub-folder of a domain like `example.com/sub-folder` by having a `base` of
458
+ * `/sub-folder`
459
+ */
460
+ readonly base: string;
461
+ /**
462
+ * Current History location
463
+ */
464
+ readonly location: HistoryLocation;
465
+ /**
466
+ * Current History state
467
+ */
468
+ readonly state: HistoryState;
469
+ /**
470
+ * Navigates to a location. In the case of an HTML5 History implementation,
471
+ * this will call `history.pushState` to effectively change the URL.
472
+ *
473
+ * @param to - location to push
474
+ * @param data - optional {@link HistoryState} to be associated with the
475
+ * navigation entry
476
+ */
477
+ push(to: HistoryLocation, data?: HistoryState): void;
478
+ /**
479
+ * Same as {@link RouterHistory.push} but performs a `history.replaceState`
480
+ * instead of `history.pushState`
481
+ *
482
+ * @param to - location to set
483
+ * @param data - optional {@link HistoryState} to be associated with the
484
+ * navigation entry
485
+ */
486
+ replace(to: HistoryLocation, data?: HistoryState): void;
487
+ /**
488
+ * Traverses history in a given direction.
489
+ *
490
+ * @example
491
+ * ```js
492
+ * myHistory.go(-1) // equivalent to window.history.back()
493
+ * myHistory.go(1) // equivalent to window.history.forward()
494
+ * ```
495
+ *
496
+ * @param delta - distance to travel. If delta is \< 0, it will go back,
497
+ * if it's \> 0, it will go forward by that amount of entries.
498
+ * @param triggerListeners - whether this should trigger listeners attached to
499
+ * the history
500
+ */
501
+ go(delta: number, triggerListeners?: boolean): void;
502
+ /**
503
+ * Attach a listener to the History implementation that is triggered when the
504
+ * navigation is triggered from outside (like the Browser back and forward
505
+ * buttons) or when passing `true` to {@link RouterHistory.back} and
506
+ * {@link RouterHistory.forward}
507
+ *
508
+ * @param callback - listener to attach
509
+ * @returns a callback to remove the listener
510
+ */
511
+ listen(callback: NavigationCallback): () => void;
512
+ /**
513
+ * Generates the corresponding href to be used in an anchor tag.
514
+ *
515
+ * @param location - history location that should create an href
516
+ */
517
+ createHref(location: HistoryLocation): string;
518
+ /**
519
+ * Clears any event listener attached by the history implementation.
520
+ */
521
+ destroy(): void;
522
+ } //#endregion
523
+ //#region src/types/index.d.ts
524
+ type Lazy<T> = () => Promise<T>;
525
+ /**
526
+ * @internal
527
+ */
528
+ type RouteParamValue = string;
529
+ /**
530
+ * @internal
531
+ */
532
+ type RouteParamValueRaw = RouteParamValue | number | null | undefined;
533
+ type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
534
+ type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
535
+ /**
536
+ * @internal
537
+ */
538
+ interface RouteQueryAndHash {
539
+ query?: LocationQueryRaw;
540
+ hash?: string;
541
+ }
542
+ /**
543
+ * @internal
544
+ */
545
+ /**
546
+ * Common options for all navigation methods.
547
+ */
548
+ interface RouteLocationOptions {
549
+ /**
550
+ * Replace the entry in the history instead of pushing a new entry
551
+ */
552
+ replace?: boolean;
553
+ /**
554
+ * Triggers the navigation even if the location is the same as the current one.
555
+ * Note this will also add a new entry to the history unless `replace: true`
556
+ * is passed.
557
+ */
558
+ force?: boolean;
559
+ /**
560
+ * State to save using the History API. This cannot contain any reactive
561
+ * values and some primitives like Symbols are forbidden. More info at
562
+ * https://developer.mozilla.org/en-US/docs/Web/API/History/state
563
+ */
564
+ state?: HistoryState;
565
+ }
566
+ /**
567
+ * Route Location that can infer the necessary params based on the name.
568
+ *
569
+ * @internal
570
+ */
571
+ interface RouteLocationMatched extends RouteRecordNormalized {
572
+ components: Record<string, RouteComponent> | null | undefined;
573
+ }
574
+ /**
575
+ * Base properties for a normalized route location.
576
+ *
577
+ * @internal
578
+ */
579
+ interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
580
+ /**
581
+ * The whole location including the `search` and `hash`. This string is
582
+ * percentage encoded.
583
+ */
584
+ fullPath: string;
585
+ /**
586
+ * Object representation of the `search` property of the current location.
587
+ */
588
+ query: LocationQuery;
589
+ /**
590
+ * Hash of the current location. If present, starts with a `#`.
591
+ */
592
+ hash: string;
593
+ /**
594
+ * Contains the location we were initially trying to access before ending up
595
+ * on the current location.
596
+ */
597
+ redirectedFrom: RouteLocation | undefined;
598
+ }
599
+ /**
600
+ * Allowed Component in {@link RouteLocationMatched}
601
+ */
602
+ type RouteComponent = Component$1 | DefineComponent;
603
+ /**
604
+ * Allowed Component definitions in route records provided by the user
605
+ */
606
+ type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
607
+ /**
608
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
609
+ */
610
+ interface _RouteRecordBase extends PathParserOptions {
611
+ /**
612
+ * Path of the record. Should start with `/` unless the record is the child of
613
+ * another record.
614
+ *
615
+ * @example `/users/:id` matches `/users/1` as well as `/users/posva`.
616
+ */
617
+ path: string;
618
+ /**
619
+ * Where to redirect if the route is directly matched. The redirection happens
620
+ * before any navigation guard and triggers a new navigation with the new
621
+ * target location.
622
+ */
623
+ redirect?: RouteRecordRedirectOption;
624
+ /**
625
+ * Aliases for the record. Allows defining extra paths that will behave like a
626
+ * copy of the record. Allows having paths shorthands like `/users/:id` and
627
+ * `/u/:id`. All `alias` and `path` values must share the same params.
628
+ */
629
+ alias?: string | string[];
630
+ /**
631
+ * Name for the route record. Must be unique.
632
+ */
633
+ name?: RouteRecordNameGeneric;
634
+ /**
635
+ * Before Enter guard specific to this record. Note `beforeEnter` has no
636
+ * effect if the record has a `redirect` property.
637
+ */
638
+ beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
639
+ /**
640
+ * Arbitrary data attached to the record.
641
+ */
642
+ meta?: RouteMeta;
643
+ /**
644
+ * Array of nested routes.
645
+ */
646
+ children?: RouteRecordRaw[];
647
+ /**
648
+ * Allow passing down params as props to the component rendered by `router-view`.
649
+ */
650
+ props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
651
+ }
652
+ /**
653
+ * Interface to type `meta` fields in route records.
654
+ *
655
+ * @example
656
+ *
657
+ * ```ts
658
+ * // typings.d.ts or router.ts
659
+ * import 'vue-router';
660
+ *
661
+ * declare module 'vue-router' {
662
+ * interface RouteMeta {
663
+ * requiresAuth?: boolean
664
+ * }
665
+ * }
666
+ * ```
667
+ */
668
+ interface RouteMeta extends Record<PropertyKey, unknown> {}
669
+ /**
670
+ * Route Record defining one single component with the `component` option.
671
+ */
672
+ interface RouteRecordSingleView extends _RouteRecordBase {
673
+ /**
674
+ * Component to display when the URL matches this route.
675
+ */
676
+ component: RawRouteComponent;
677
+ components?: never;
678
+ children?: never;
679
+ redirect?: never;
680
+ /**
681
+ * Allow passing down params as props to the component rendered by `router-view`.
682
+ */
683
+ props?: _RouteRecordProps;
684
+ }
685
+ /**
686
+ * Route Record defining one single component with a nested view. Differently
687
+ * from {@link RouteRecordSingleView}, this record has children and allows a
688
+ * `redirect` option.
689
+ */
690
+ interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
691
+ /**
692
+ * Component to display when the URL matches this route.
693
+ */
694
+ component?: RawRouteComponent | null | undefined;
695
+ components?: never;
696
+ children: RouteRecordRaw[];
697
+ /**
698
+ * Allow passing down params as props to the component rendered by `router-view`.
699
+ */
700
+ props?: _RouteRecordProps;
701
+ }
702
+ /**
703
+ * Route Record defining multiple named components with the `components` option.
704
+ */
705
+ interface RouteRecordMultipleViews extends _RouteRecordBase {
706
+ /**
707
+ * Components to display when the URL matches this route. Allow using named views.
708
+ */
709
+ components: Record<string, RawRouteComponent>;
710
+ component?: never;
711
+ children?: never;
712
+ redirect?: never;
713
+ /**
714
+ * Allow passing down params as props to the component rendered by
715
+ * `router-view`. Should be an object with the same keys as `components` or a
716
+ * boolean to be applied to every component.
717
+ */
718
+ props?: Record<string, _RouteRecordProps> | boolean;
719
+ }
720
+ /**
721
+ * Route Record defining multiple named components with the `components` option and children.
722
+ */
723
+ interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
724
+ /**
725
+ * Components to display when the URL matches this route. Allow using named views.
726
+ */
727
+ components?: Record<string, RawRouteComponent> | null | undefined;
728
+ component?: never;
729
+ children: RouteRecordRaw[];
730
+ /**
731
+ * Allow passing down params as props to the component rendered by
732
+ * `router-view`. Should be an object with the same keys as `components` or a
733
+ * boolean to be applied to every component.
734
+ */
735
+ props?: Record<string, _RouteRecordProps> | boolean;
736
+ }
737
+ /**
738
+ * Route Record that defines a redirect. Cannot have `component` or `components`
739
+ * as it is never rendered.
740
+ */
741
+ interface RouteRecordRedirect extends _RouteRecordBase {
742
+ redirect: RouteRecordRedirectOption;
743
+ component?: never;
744
+ components?: never;
745
+ props?: never;
746
+ }
747
+ type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
748
+ /**
749
+ * Route location that can be passed to the matcher.
750
+ */
751
+ /**
752
+ * Normalized/resolved Route location that returned by the matcher.
753
+ */
754
+ interface MatcherLocation {
755
+ /**
756
+ * Name of the matched record
757
+ */
758
+ name: RouteRecordNameGeneric | null | undefined;
759
+ /**
760
+ * Percentage encoded pathname section of the URL.
761
+ */
762
+ path: string;
763
+ /**
764
+ * Object of decoded params extracted from the `path`.
765
+ */
766
+ params: RouteParamsGeneric;
767
+ /**
768
+ * Merged `meta` properties from all the matched route records.
769
+ */
770
+ meta: RouteMeta;
771
+ /**
772
+ * Array of {@link RouteRecord} containing components as they were
773
+ * passed when adding records. It can also contain redirect records. This
774
+ * can't be used directly
775
+ */
776
+ matched: RouteRecord[];
777
+ } //#endregion
778
+ //#region src/typed-routes/route-map.d.ts
779
+ /**
780
+ * Helper type to define a Typed `RouteRecord`
781
+ * @see {@link RouteRecord}
782
+ */
783
+ interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
784
+ name: Name;
785
+ path: Path;
786
+ paramsRaw: ParamsRaw;
787
+ params: Params;
788
+ childrenNames: ChildrenNames;
789
+ }
790
+ type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
791
+ /**
792
+ * Convenience type to get the typed RouteMap or a generic one if not provided.
793
+ * It is extracted from the {@link TypesConfig} if it exists, it becomes
794
+ * {@link RouteMapGeneric} otherwise.
795
+ */
796
+ type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
797
+ /**
798
+ * Generic version of the `RouteMap`.
799
+ */
800
+ type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>; //#endregion
801
+ //#region src/typed-routes/params.d.ts
802
+ /**
803
+ * Utility type for raw and non raw params like :id+
804
+ *
805
+ */
806
+ //#endregion
807
+ //#region src/types/utils.d.ts
808
+ /**
809
+ * Creates a union type that still allows autocompletion for strings.
810
+ * @internal
811
+ */
812
+ type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
813
+ /**
814
+ * Maybe a promise maybe not
815
+ * @internal
816
+ */
817
+ type _Awaitable<T> = T | PromiseLike<T>;
818
+ /**
819
+ * @internal
820
+ */
821
+ //#endregion
822
+ //#region src/typed-routes/route-records.d.ts
823
+ /**
824
+ * @internal
825
+ */
826
+ type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
827
+ /**
828
+ * Generic version of {@link RouteRecordName}.
829
+ */
830
+ type RouteRecordNameGeneric = string | symbol | undefined;
831
+ /**
832
+ * Possible values for a route record **after normalization**
833
+ *
834
+ * NOTE: since `RouteRecordName` is a type, it evaluates too early and it's often the generic version {@link RouteRecordNameGeneric}. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
835
+ */
836
+ /**
837
+ * @internal
838
+ */
839
+ type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>); //#endregion
840
+ //#region src/typed-routes/route-location.d.ts
841
+ /**
842
+ * Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
843
+ */
844
+ interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
845
+ /**
846
+ * Array of {@link RouteRecord} containing components as they were
847
+ * passed when adding records. It can also contain redirect records. This
848
+ * can't be used directly. **This property is non-enumerable**.
849
+ */
850
+ matched: RouteRecord[];
851
+ }
852
+ /**
853
+ * Helper to generate a type safe version of the {@link RouteLocation} type.
854
+ */
855
+ interface RouteLocationTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric }, Name extends keyof RouteMap> extends RouteLocationGeneric {
856
+ name: Extract<Name, string | symbol>;
857
+ params: RouteMap[Name]['params'];
858
+ }
859
+ /**
860
+ * List of all possible {@link RouteLocation} indexed by the route name.
861
+ * @internal
862
+ */
863
+ type RouteLocationTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationTyped<RouteMap, N> };
864
+ /**
865
+ * Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
866
+ */
867
+ interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
868
+ name: RouteRecordNameGeneric;
869
+ /**
870
+ * Array of {@link RouteRecordNormalized}
871
+ */
872
+ matched: RouteRecordNormalized[];
873
+ }
874
+ /**
875
+ * Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
876
+ */
877
+ interface RouteLocationNormalizedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedGeneric {
878
+ name: Extract<Name, string | symbol>;
879
+ params: RouteMap[Name]['params'];
880
+ /**
881
+ * Array of {@link RouteRecordNormalized}
882
+ */
883
+ matched: RouteRecordNormalized[];
884
+ }
885
+ /**
886
+ * List of all possible {@link RouteLocationNormalized} indexed by the route name.
887
+ * @internal
888
+ */
889
+ type RouteLocationNormalizedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedTyped<RouteMap, N> };
890
+ /**
891
+ * Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
892
+ */
893
+ interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
894
+ /**
895
+ * Array of {@link RouteLocationMatched} containing only plain components (any
896
+ * lazy-loaded components have been loaded and were replaced inside the
897
+ * `components` object) so it can be directly used to display routes. It
898
+ * cannot contain redirect records either. **This property is non-enumerable**.
899
+ */
900
+ matched: RouteLocationMatched[];
901
+ }
902
+ /**
903
+ * Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
904
+ */
905
+ interface RouteLocationNormalizedLoadedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedLoadedGeneric {
906
+ name: Extract<Name, string | symbol>;
907
+ params: RouteMap[Name]['params'];
908
+ }
909
+ /**
910
+ * List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
911
+ * @internal
912
+ */
913
+ type RouteLocationNormalizedLoadedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedLoadedTyped<RouteMap, N> };
914
+ /**
915
+ * Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
916
+ */
917
+ interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
918
+ name?: RouteRecordNameGeneric;
919
+ params?: RouteParamsRawGeneric;
920
+ /**
921
+ * A relative path to the current location. This property should be removed
922
+ */
923
+ path?: undefined;
924
+ }
925
+ /**
926
+ * Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
927
+ */
928
+ interface RouteLocationAsRelativeTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsRelativeGeneric {
929
+ name?: Extract<Name, string | symbol>;
930
+ params?: RouteMap[Name]['paramsRaw'];
931
+ }
932
+ /**
933
+ * List of all possible {@link RouteLocationAsRelative} indexed by the route name.
934
+ * @internal
935
+ */
936
+ type RouteLocationAsRelativeTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsRelativeTyped<RouteMap, N> };
937
+ /**
938
+ * Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
939
+ */
940
+ interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
941
+ /**
942
+ * Percentage encoded pathname section of the URL.
943
+ */
944
+ path: string;
945
+ }
946
+ /**
947
+ * Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
948
+ */
949
+ interface RouteLocationAsPathTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsPathGeneric {
950
+ path: _LiteralUnion<RouteMap[Name]['path']>;
951
+ }
952
+ /**
953
+ * List of all possible {@link RouteLocationAsPath} indexed by the route name.
954
+ * @internal
955
+ */
956
+ type RouteLocationAsPathTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsPathTyped<RouteMap, N> };
957
+ /**
958
+ * Helper to generate a type safe version of the {@link RouteLocationAsString} type.
959
+ */
960
+ type RouteLocationAsStringTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['path'];
961
+ /**
962
+ * List of all possible {@link RouteLocationAsString} indexed by the route name.
963
+ * @internal
964
+ */
965
+ type RouteLocationAsStringTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsStringTyped<RouteMap, N> };
966
+ /**
967
+ * Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
968
+ */
969
+ interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
970
+ /**
971
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
972
+ */
973
+ href: string;
974
+ }
975
+ /**
976
+ * Helper to generate a type safe version of the {@link RouteLocationResolved} type.
977
+ */
978
+ interface RouteLocationResolvedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric }, Name extends keyof RouteMap> extends RouteLocationTyped<RouteMap, Name> {
979
+ /**
980
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
981
+ */
982
+ href: string;
983
+ }
984
+ /**
985
+ * List of all possible {@link RouteLocationResolved} indexed by the route name.
986
+ * @internal
987
+ */
988
+ type RouteLocationResolvedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationResolvedTyped<RouteMap, N> };
989
+ /**
990
+ * Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
991
+ */
992
+ /**
993
+ * {@link RouteLocationRaw} resolved using the matcher
994
+ */
995
+ type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
996
+ /**
997
+ * Similar to {@link RouteLocation} but its
998
+ * {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
999
+ */
1000
+ type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
1001
+ /**
1002
+ * Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
1003
+ * In other words, it's ready to be rendered by `<RouterView>`.
1004
+ */
1005
+ type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
1006
+ /**
1007
+ * Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
1008
+ * `hash` to conveniently change them.
1009
+ */
1010
+ type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
1011
+ /**
1012
+ * Route location resolved with {@link Router | `router.resolve()`}.
1013
+ */
1014
+ type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
1015
+ /**
1016
+ * Same as {@link RouteLocationAsPath} but as a string literal.
1017
+ */
1018
+ type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
1019
+ /**
1020
+ * Route location as an object with a `path` property.
1021
+ */
1022
+ type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
1023
+ /**
1024
+ * Route location that can be passed to `router.push()` and other user-facing APIs.
1025
+ */
1026
+ type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name]; //#endregion
1027
+ //#region src/errors.d.ts
1028
+ /**
1029
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
1030
+ * {@link NavigationFailureType}.
1031
+ *
1032
+ * @internal
1033
+ */
1034
+ declare const enum ErrorTypes {
1035
+ MATCHER_NOT_FOUND = 1,
1036
+ NAVIGATION_GUARD_REDIRECT = 2,
1037
+ NAVIGATION_ABORTED = 4,
1038
+ NAVIGATION_CANCELLED = 8,
1039
+ NAVIGATION_DUPLICATED = 16
1040
+ }
1041
+ /**
1042
+ * Enumeration with all possible types for navigation failures. Can be passed to
1043
+ * {@link isNavigationFailure} to check for specific failures.
1044
+ */
1045
+ /**
1046
+ * Extended Error that contains extra information regarding a failed navigation.
1047
+ */
1048
+ interface NavigationFailure extends Error {
1049
+ /**
1050
+ * Type of the navigation. One of {@link NavigationFailureType}
1051
+ */
1052
+ type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
1053
+ /**
1054
+ * Route location we were navigating from
1055
+ */
1056
+ from: RouteLocationNormalized;
1057
+ /**
1058
+ * Route location we were navigating to
1059
+ */
1060
+ to: RouteLocationNormalized;
1061
+ }
1062
+ /**
1063
+ * Internal error used to detect a redirection.
1064
+ *
1065
+ * @internal
1066
+ */
1067
+ /**
1068
+ * Internal type to define an ErrorHandler
1069
+ *
1070
+ * @param error - error thrown
1071
+ * @param to - location we were navigating to when the error happened
1072
+ * @param from - location we were navigating from when the error happened
1073
+ * @internal
1074
+ */
1075
+ interface _ErrorListener {
1076
+ (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
1077
+ } //#endregion
1078
+ //#region src/typed-routes/navigation-guards.d.ts
1079
+ /**
1080
+ * Return types for a Navigation Guard. Based on `TypesConfig`
1081
+ *
1082
+ * @see {@link TypesConfig}
1083
+ */
1084
+ type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
1085
+ /**
1086
+ * Navigation Guard with a type parameter for `this`.
1087
+ * @see {@link TypesConfig}
1088
+ */
1089
+ interface NavigationGuardWithThis<T> {
1090
+ (this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded,
1091
+ /**
1092
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
1093
+ * The callback will be removed in a future version of Vue Router.
1094
+ */
1095
+
1096
+ next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
1097
+ }
1098
+ /**
1099
+ * In `router.beforeResolve((to) => {})`, the `to` is typed as `RouteLocationNormalizedLoaded`, not
1100
+ * `RouteLocationNormalized` like in `router.beforeEach()`. In practice it doesn't change much as users do not rely on
1101
+ * the difference between them but if we update the type in vue-router, we will have to update this type too.
1102
+ * @internal
1103
+ */
1104
+ interface _NavigationGuardResolved {
1105
+ (this: undefined, to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded,
1106
+ /**
1107
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
1108
+ * The callback will be removed in a future version of Vue Router.
1109
+ */
1110
+
1111
+ next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
1112
+ }
1113
+ /**
1114
+ * Navigation Guard.
1115
+ */
1116
+ interface NavigationGuard {
1117
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded,
1118
+ /**
1119
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
1120
+ * The callback will be removed in a future version of Vue Router.
1121
+ */
1122
+
1123
+ next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
1124
+ }
1125
+ /**
1126
+ * Navigation hook triggered after a navigation is settled.
1127
+ */
1128
+ interface NavigationHookAfter {
1129
+ (to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
1130
+ }
1131
+ /**
1132
+ * Callback passed to navigation guards to continue or abort the navigation.
1133
+ *
1134
+ * @deprecated Prefer returning a value from the guard instead of calling
1135
+ * `next(value)`. The callback will be removed in a future version of Vue Router.
1136
+ */
1137
+ interface NavigationGuardNext {
1138
+ (): void;
1139
+ (error: Error): void;
1140
+ (location: RouteLocationRaw): void;
1141
+ (valid: boolean | undefined): void;
1142
+ (cb: NavigationGuardNextCallback): void;
1143
+ }
1144
+ /**
1145
+ * Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
1146
+ */
1147
+ type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown; //#endregion
1148
+ //#region src/history/html5.d.ts
1149
+ /**
1150
+ * Creates an HTML5 history. Most common history for single page applications.
1151
+ *
1152
+ * @param base -
1153
+ */
1154
+ //#endregion
1155
+ //#region src/scrollBehavior.d.ts
1156
+ /**
1157
+ * Scroll position similar to
1158
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
1159
+ * Note that not all browsers support `behavior`.
1160
+ */
1161
+ type ScrollPositionCoordinates = {
1162
+ behavior?: ScrollOptions['behavior'];
1163
+ left?: number;
1164
+ top?: number;
1165
+ };
1166
+ /**
1167
+ * Internal normalized version of {@link ScrollPositionCoordinates} that always
1168
+ * has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
1169
+ *
1170
+ * @internal
1171
+ */
1172
+ type _ScrollPositionNormalized = {
1173
+ behavior?: ScrollOptions['behavior'];
1174
+ left: number;
1175
+ top: number;
1176
+ };
1177
+ /**
1178
+ * Type of the `scrollBehavior` option that can be passed to `createRouter`.
1179
+ */
1180
+ interface RouterScrollBehavior {
1181
+ /**
1182
+ * @param to - Route location where we are navigating to
1183
+ * @param from - Route location where we are navigating from
1184
+ * @param savedPosition - saved position if it exists, `null` otherwise
1185
+ */
1186
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
1187
+ }
1188
+ interface ScrollPositionElement extends ScrollToOptions {
1189
+ /**
1190
+ * A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
1191
+ * @example
1192
+ * Here are a few examples:
1193
+ *
1194
+ * - `.title`
1195
+ * - `.content:first-child`
1196
+ * - `#marker`
1197
+ * - `#marker\~with\~symbols`
1198
+ * - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
1199
+ *
1200
+ */
1201
+ el: string | Element;
1202
+ }
1203
+ type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
1204
+ type Awaitable<T> = T | PromiseLike<T>; //#endregion
1205
+ //#region src/experimental/route-resolver/matchers/param-parsers/types.d.ts
1206
+ /**
1207
+ * Defines a parser that can read a param from the url (string-based) and
1208
+ * transform it into a more complex type, or vice versa.
1209
+ *
1210
+ * @see MatcherPattern
1211
+ */
1212
+ //#endregion
1213
+ //#region src/experimental/router.d.ts
1214
+ /**
1215
+ * Options to initialize a {@link Router} instance.
1216
+ */
1217
+ interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
1218
+ /**
1219
+ * History implementation used by the router. Most web applications should use
1220
+ * `createWebHistory` but it requires the server to be properly configured.
1221
+ * You can also use a _hash_ based history with `createWebHashHistory` that
1222
+ * does not require any configuration on the server but isn't handled at all
1223
+ * by search engines and does poorly on SEO.
1224
+ *
1225
+ * @example
1226
+ * ```js
1227
+ * createRouter({
1228
+ * history: createWebHistory(),
1229
+ * // other options...
1230
+ * })
1231
+ * ```
1232
+ */
1233
+ history: RouterHistory;
1234
+ /**
1235
+ * Function to control scrolling when navigating between pages. Can return a
1236
+ * Promise to delay scrolling.
1237
+ *
1238
+ * @see {@link RouterScrollBehavior}.
1239
+ *
1240
+ * @example
1241
+ * ```js
1242
+ * function scrollBehavior(to, from, savedPosition) {
1243
+ * // `to` and `from` are both route locations
1244
+ * // `savedPosition` can be null if there isn't one
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ scrollBehavior?: RouterScrollBehavior;
1249
+ /**
1250
+ * Custom implementation to parse a query. See its counterpart,
1251
+ * {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
1252
+ *
1253
+ * @example
1254
+ * Let's say you want to use the [qs package](https://github.com/ljharb/qs)
1255
+ * to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
1256
+ * ```js
1257
+ * import qs from 'qs'
1258
+ *
1259
+ * createRouter({
1260
+ * // other options...
1261
+ * parseQuery: qs.parse,
1262
+ * stringifyQuery: qs.stringify,
1263
+ * })
1264
+ * ```
1265
+ */
1266
+ parseQuery?: typeof parseQuery;
1267
+ /**
1268
+ * Custom implementation to stringify a query object. Should not prepend a leading `?`.
1269
+ * {@link parseQuery} counterpart to handle query parsing.
1270
+ */
1271
+ stringifyQuery?: typeof stringifyQuery;
1272
+ /**
1273
+ * Default class applied to active {@link RouterLink}. If none is provided,
1274
+ * `router-link-active` will be applied.
1275
+ */
1276
+ linkActiveClass?: string;
1277
+ /**
1278
+ * Default class applied to exact active {@link RouterLink}. If none is provided,
1279
+ * `router-link-exact-active` will be applied.
1280
+ */
1281
+ linkExactActiveClass?: string;
1282
+ }
1283
+ /**
1284
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
1285
+ */
1286
+ /**
1287
+ * Router base instance.
1288
+ *
1289
+ * @experimental This version is not stable, it's meant to replace {@link Router} in the future.
1290
+ */
1291
+ interface EXPERIMENTAL_Router_Base<TRecord> {
1292
+ /**
1293
+ * Current {@link RouteLocationNormalized}
1294
+ */
1295
+ readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
1296
+ /**
1297
+ * Allows turning off the listening of history events. This is a low level api for micro-frontend.
1298
+ */
1299
+ listening: boolean;
1300
+ /**
1301
+ * Checks if a route with a given name exists
1302
+ *
1303
+ * @param name - Name of the route to check
1304
+ */
1305
+ hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
1306
+ /**
1307
+ * Get a full list of all the {@link RouteRecord | route records}.
1308
+ */
1309
+ getRoutes(): TRecord[];
1310
+ /**
1311
+ * Returns the {@link RouteLocation | normalized version} of a
1312
+ * {@link RouteLocationRaw | route location}. Also includes an `href` property
1313
+ * that includes any existing `base`. By default, the `currentLocation` used is
1314
+ * `router.currentRoute` and should only be overridden in advanced use cases.
1315
+ *
1316
+ * @param to - Raw route location to resolve
1317
+ * @param currentLocation - Optional current location to resolve against
1318
+ */
1319
+ resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
1320
+ resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
1321
+ /**
1322
+ * Programmatically navigate to a new URL by pushing an entry in the history
1323
+ * stack.
1324
+ *
1325
+ * @param to - Route location to navigate to
1326
+ */
1327
+ push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1328
+ /**
1329
+ * Programmatically navigate to a new URL by replacing the current entry in
1330
+ * the history stack.
1331
+ *
1332
+ * @param to - Route location to navigate to
1333
+ */
1334
+ replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1335
+ /**
1336
+ * Go back in history if possible by calling `history.back()`. Equivalent to
1337
+ * `router.go(-1)`.
1338
+ */
1339
+ back(): void;
1340
+ /**
1341
+ * Go forward in history if possible by calling `history.forward()`.
1342
+ * Equivalent to `router.go(1)`.
1343
+ */
1344
+ forward(): void;
1345
+ /**
1346
+ * Allows you to move forward or backward through the history. Calls
1347
+ * `history.go()`.
1348
+ *
1349
+ * @param delta - The position in the history to which you want to move,
1350
+ * relative to the current page
1351
+ */
1352
+ go(delta: number): void;
1353
+ /**
1354
+ * Add a navigation guard that executes before any navigation. Returns a
1355
+ * function that removes the registered guard.
1356
+ *
1357
+ * @param guard - navigation guard to add
1358
+ */
1359
+ beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
1360
+ /**
1361
+ * Add a navigation guard that executes before navigation is about to be
1362
+ * resolved. At this state all component have been fetched and other
1363
+ * navigation guards have been successful. Returns a function that removes the
1364
+ * registered guard.
1365
+ *
1366
+ * @param guard - navigation guard to add
1367
+ * @returns a function that removes the registered guard
1368
+ *
1369
+ * @example
1370
+ * ```js
1371
+ * router.beforeResolve(to => {
1372
+ * if (to.meta.requiresAuth && !isAuthenticated) return false
1373
+ * })
1374
+ * ```
1375
+ *
1376
+ */
1377
+ beforeResolve(guard: _NavigationGuardResolved): () => void;
1378
+ /**
1379
+ * Add a navigation hook that is executed after every navigation. Returns a
1380
+ * function that removes the registered hook.
1381
+ *
1382
+ * @param guard - navigation hook to add
1383
+ * @returns a function that removes the registered hook
1384
+ *
1385
+ * @example
1386
+ * ```js
1387
+ * router.afterEach((to, from, failure) => {
1388
+ * if (isNavigationFailure(failure)) {
1389
+ * console.log('failed navigation', failure)
1390
+ * }
1391
+ * })
1392
+ * ```
1393
+ */
1394
+ afterEach(guard: NavigationHookAfter): () => void;
1395
+ /**
1396
+ * Adds an error handler that is called every time a non caught error happens
1397
+ * during navigation. This includes errors thrown synchronously and
1398
+ * asynchronously, errors returned or passed to `next` in any navigation
1399
+ * guard, and errors occurred when trying to resolve an async component that
1400
+ * is required to render a route.
1401
+ *
1402
+ * @param handler - error handler to register
1403
+ */
1404
+ onError(handler: _ErrorListener): () => void;
1405
+ /**
1406
+ * Returns a Promise that resolves when the router has completed the initial
1407
+ * navigation, which means it has resolved all async enter hooks and async
1408
+ * components that are associated with the initial route. If the initial
1409
+ * navigation already happened, the promise resolves immediately.
1410
+ *
1411
+ * This is useful in server-side rendering to ensure consistent output on both
1412
+ * the server and the client. Note that on server side, you need to manually
1413
+ * push the initial location while on client side, the router automatically
1414
+ * picks it up from the URL.
1415
+ */
1416
+ isReady(): Promise<void>;
1417
+ /**
1418
+ * Called automatically by `app.use(router)`. Should not be called manually by
1419
+ * the user. This will trigger the initial navigation when on client side.
1420
+ *
1421
+ * @internal
1422
+ * @param app - Application that uses the router
1423
+ */
1424
+ install(app: App): void;
1425
+ }
1426
+ //#endregion
1427
+ //#region src/router.d.ts
1428
+ /**
1429
+ * Options to initialize a {@link Router} instance.
1430
+ */
1431
+ interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
1432
+ /**
1433
+ * Initial list of routes that should be added to the router.
1434
+ */
1435
+ routes: Readonly<RouteRecordRaw[]>;
1436
+ }
1437
+ /**
1438
+ * Router instance.
1439
+ */
1440
+ interface Router extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
1441
+ /**
1442
+ * Original options object passed to create the Router
1443
+ */
1444
+ readonly options: RouterOptions;
1445
+ /**
1446
+ * Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
1447
+ *
1448
+ * @param parentName - Parent Route Record where `route` should be appended at
1449
+ * @param route - Route Record to add
1450
+ */
1451
+ addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
1452
+ /**
1453
+ * Add a new {@link RouteRecordRaw | route record} to the router.
1454
+ *
1455
+ * @param route - Route Record to add
1456
+ */
1457
+ addRoute(route: RouteRecordRaw): () => void;
1458
+ /**
1459
+ * Remove an existing route by its name.
1460
+ *
1461
+ * @param name - Name of the route to remove
1462
+ */
1463
+ removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
1464
+ /**
1465
+ * Delete all routes from the router.
1466
+ */
1467
+ clearRoutes(): void;
1468
+ }
1469
+ /**
1470
+ * Creates a Router instance that can be used by a Vue app.
1471
+ *
1472
+ * @param options - {@link RouterOptions}
1473
+ */
1474
+ //#endregion
1475
+ //#region src/RouterLink.d.ts
1476
+ interface RouterLinkOptions {
1477
+ /**
1478
+ * Route Location the link should navigate to when clicked on.
1479
+ */
1480
+ to: RouteLocationRaw;
1481
+ /**
1482
+ * Calls `router.replace` instead of `router.push`.
1483
+ */
1484
+ replace?: boolean;
1485
+ }
1486
+ interface RouterLinkProps extends RouterLinkOptions {
1487
+ /**
1488
+ * Whether RouterLink should not wrap its content in an `a` tag. Useful when
1489
+ * using `v-slot` to create a custom RouterLink
1490
+ */
1491
+ custom?: boolean;
1492
+ /**
1493
+ * Class to apply when the link is active
1494
+ */
1495
+ activeClass?: string;
1496
+ /**
1497
+ * Class to apply when the link is exact active
1498
+ */
1499
+ exactActiveClass?: string;
1500
+ /**
1501
+ * Value passed to the attribute `aria-current` when the link is exact active.
1502
+ *
1503
+ * @defaultValue `'page'`
1504
+ */
1505
+ ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
1506
+ /**
1507
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1508
+ */
1509
+ viewTransition?: boolean;
1510
+ }
1511
+ /**
1512
+ * Options passed to {@link useLink}.
1513
+ */
1514
+ interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
1515
+ to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
1516
+ replace?: MaybeRef<boolean | undefined>;
1517
+ /**
1518
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1519
+ */
1520
+ viewTransition?: boolean;
1521
+ }
1522
+ /**
1523
+ * Return type of {@link useLink}.
1524
+ * @internal
1525
+ */
1526
+ interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
1527
+ route: ComputedRef<RouteLocationResolved<Name>>;
1528
+ href: ComputedRef<string>;
1529
+ isActive: ComputedRef<boolean>;
1530
+ isExactActive: ComputedRef<boolean>;
1531
+ navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
1532
+ }
1533
+ /**
1534
+ * Returns the internal behavior of a {@link RouterLink} without the rendering part.
1535
+ *
1536
+ * @param props - a `to` location and an optional `replace` flag
1537
+ */
1538
+ declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
1539
+ /**
1540
+ * Component to render a link that triggers a navigation on click.
1541
+ */
1542
+ declare const RouterLink: _RouterLinkI;
1543
+ /**
1544
+ * @internal
1545
+ */
1546
+ type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
1547
+ /**
1548
+ * @internal
1549
+ */
1550
+ type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
1551
+ custom: true;
1552
+ } : _RouterLinkPropsTypedBase & {
1553
+ custom?: false | undefined;
1554
+ } & Omit<AnchorHTMLAttributes, 'href'>;
1555
+ /**
1556
+ * Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
1557
+ * automatically for JSX.
1558
+ *
1559
+ * @internal
1560
+ */
1561
+ interface _RouterLinkI {
1562
+ new <Custom extends boolean | undefined = boolean | undefined>(): {
1563
+ $props: RouterLinkPropsTyped<Custom>;
1564
+ $slots: {
1565
+ default?: ({
1566
+ route,
1567
+ href,
1568
+ isActive,
1569
+ isExactActive,
1570
+ navigate
1571
+ }: UnwrapRef<UseLinkReturn>) => VNode[];
1572
+ };
1573
+ };
1574
+ /**
1575
+ * Access to `useLink()` without depending on using vue-router
1576
+ *
1577
+ * @internal
1578
+ */
1579
+ useLink: typeof useLink;
1580
+ } //#endregion
1581
+ //#region src/RouterView.d.ts
1582
+ interface RouterViewProps {
1583
+ name?: string;
1584
+ route?: RouteLocationNormalized;
1585
+ }
1586
+ /**
1587
+ * Component to display the current route the user is at.
1588
+ */
1589
+ declare const RouterView: {
1590
+ new (): {
1591
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
1592
+ $slots: {
1593
+ default?: ({
1594
+ Component,
1595
+ route
1596
+ }: {
1597
+ Component: VNode;
1598
+ route: RouteLocationNormalizedLoaded;
1599
+ }) => VNode[];
1600
+ };
1601
+ };
1602
+ }; //#endregion
1603
+ //#region src/useApi.d.ts
1604
+ /**
1605
+ * Returns the router instance. Equivalent to using `$router` inside
1606
+ * templates.
1607
+ */
1608
+ //#endregion
1609
+ //#region src/index.d.ts
1610
+ declare module 'vue' {
1611
+ interface ComponentCustomOptions {
1612
+ /**
1613
+ * Guard called when the router is navigating to the route that is rendering
1614
+ * this component from a different route. Differently from `beforeRouteUpdate`
1615
+ * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
1616
+ * component instance through `this` because it triggers before the component
1617
+ * is even mounted.
1618
+ *
1619
+ * @param to - RouteLocationRaw we are navigating to
1620
+ * @param from - RouteLocationRaw we are navigating from
1621
+ * @param next - function to validate, cancel or modify (by redirecting) the
1622
+ * navigation
1623
+ */
1624
+ beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
1625
+ /**
1626
+ * Guard called whenever the route that renders this component has changed, but
1627
+ * it is reused for the new route. This allows you to guard for changes in
1628
+ * params, the query or the hash.
1629
+ *
1630
+ * @param to - RouteLocationRaw we are navigating to
1631
+ * @param from - RouteLocationRaw we are navigating from
1632
+ * @param next - function to validate, cancel or modify (by redirecting) the
1633
+ * navigation
1634
+ */
1635
+ beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
1636
+ /**
1637
+ * Guard called when the router is navigating away from the current route that
1638
+ * is rendering this component.
1639
+ *
1640
+ * @param to - RouteLocationRaw we are navigating to
1641
+ * @param from - RouteLocationRaw we are navigating from
1642
+ * @param next - function to validate, cancel or modify (by redirecting) the
1643
+ * navigation
1644
+ */
1645
+ beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
1646
+ }
1647
+ interface ComponentCustomProperties {
1648
+ /**
1649
+ * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
1650
+ */
1651
+ $route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
1652
+ /**
1653
+ * {@link Router} instance used by the application.
1654
+ */
1655
+ $router: TypesConfig extends Record<'$router', infer T> ? T : Router;
1656
+ }
1657
+ interface GlobalComponents {
1658
+ RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
1659
+ RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
1660
+ }
1661
+ } //#endregion
1662
+ //#endregion
1663
+ //#region ../../node_modules/.pnpm/vue-router@5.0.4_@vue+compiler-sfc@3.5.30_pinia@3.0.4_typescript@5.9.3_vue@3.5.29_types_d61141097fb336273056f1bc288b9240/node_modules/vue-router/dist/vue-router.d.ts
1664
+ //#endregion
222
1665
  //#region src/fetch/layer-fetch.d.ts
223
1666
  /**
224
1667
  * Initialize the layer-aware fetch system.