vue-micro-router 1.0.61 → 1.0.63

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 CHANGED
@@ -445,6 +445,11 @@ const { stepWisePush, stepWiseBack } = useMicroRouter();
445
445
  // Walk through: home → home/onboarding → home/onboarding/step1
446
446
  await stepWisePush('/home/onboarding/step1');
447
447
 
448
+ // Relative multi-segment paths are type-checked: every segment must be a
449
+ // known route, joined by `/`, in any order and to any depth.
450
+ await stepWisePush('onboarding/step1'); // ✅ each segment validated
451
+ await stepWisePush('onboarding/oops'); // ❌ compile error — unknown segment
452
+
448
453
  // Step back through each page with animation
449
454
  await stepWiseBack(3);
450
455
  ```
package/dist/index.d.ts CHANGED
@@ -25,9 +25,7 @@ Defaults: {};
25
25
  }, Readonly<TransitionGroupProps>, {}, {}, ComputedOptions, MethodOptions, {}> | null;
26
26
  }, any>;
27
27
 
28
- declare const __VLS_component_2: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
29
- pageRef: HTMLDivElement;
30
- }, HTMLDivElement>;
28
+ declare const __VLS_component_2: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
31
29
 
32
30
  declare const __VLS_component_3: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
33
31
  close: (path: string) => any;
@@ -60,9 +58,7 @@ declare function __VLS_template_2(): {
60
58
  slots: {
61
59
  default?(_: {}): any;
62
60
  };
63
- refs: {
64
- pageRef: HTMLDivElement;
65
- };
61
+ refs: {};
66
62
  rootEl: HTMLDivElement;
67
63
  };
68
64
 
@@ -330,9 +326,7 @@ export declare interface MicroControl {
330
326
  componentKey?: number;
331
327
  }
332
328
 
333
- export declare const MicroControlWrapper: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
334
- wrapperRef: HTMLDivElement;
335
- }, HTMLDivElement>;
329
+ export declare const MicroControlWrapper: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
336
330
 
337
331
  export declare interface MicroDialog {
338
332
  /** Unique dialog identifier, e.g. "confirm", "settings-modal" */
@@ -641,6 +635,7 @@ declare interface PluginTypedStepWiseBack {
641
635
 
642
636
  declare interface PluginTypedStepWisePush<Routes extends string, AttrsMap = {}> {
643
637
  <K extends Routes>(targetPath: K, ...args: PropsArgs<K, AttrsMap>): Promise<void>;
638
+ <S extends string>(targetPath: S & RouteSegmentPath<S, Routes>, props?: Record<string, unknown>): Promise<void>;
644
639
  (targetPath: `/${string}`, props?: Record<string, unknown>): Promise<void>;
645
640
  }
646
641
 
@@ -762,6 +757,15 @@ export declare type RouteMap = Record<string, Record<string, unknown> | undefine
762
757
 
763
758
  export declare const RoutePage: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
764
759
 
760
+ /**
761
+ * Validate a `/`-joined path where every segment must be a known route.
762
+ * Returns `S` when valid, else `never`. Given routes `'a' | 'b'`:
763
+ * 'a' ✓ 'a/b' ✓ 'b/a/b' ✓ 'a/x' ✗ (→ never) 'x' ✗ (→ never)
764
+ * Walks the string via `infer` (bounded by segment count) — no infinite union,
765
+ * so it stays cheap for arbitrary depth like `'a/b/c/d/f'`.
766
+ */
767
+ declare type RouteSegmentPath<S extends string, Routes extends string> = S extends `${infer Head}/${infer Rest}` ? [Head] extends [Routes] ? [RouteSegmentPath<Rest, Routes>] extends [never] ? never : S : never : [S] extends [Routes] ? S : never;
768
+
765
769
  /** Extract route names that don't require props */
766
770
  export declare type RoutesWithoutProps<T extends RouteMap> = {
767
771
  [K in keyof T]: T[K] extends undefined ? K : never;