@simonbackx/vue-app-navigation 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -861,7 +861,7 @@ __publicField(_ComponentWithProperties, "debug", false);
861
861
  __publicField(_ComponentWithProperties, "historyIndexOwners", /* @__PURE__ */ new Map());
862
862
  let ComponentWithProperties = _ComponentWithProperties;
863
863
  /**
864
- * @vue/shared v3.5.12
864
+ * @vue/shared v3.5.16
865
865
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
866
866
  * @license MIT
867
867
  **/
@@ -1167,11 +1167,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1167
1167
  ]);
1168
1168
  }
1169
1169
  const FramedComponent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
1170
- function useNavigationController() {
1171
- const c = inject("reactive_navigationController");
1172
- return shallowRef(c);
1173
- }
1174
- const NavigationController$1 = defineComponent({
1170
+ const _sfc_main$4 = defineComponent({
1175
1171
  name: "NavigationController",
1176
1172
  components: {
1177
1173
  FramedComponent
@@ -1571,7 +1567,7 @@ const NavigationController$1 = defineComponent({
1571
1567
  }
1572
1568
  },
1573
1569
  enter(element, done) {
1574
- if (this.transitionName == "none") {
1570
+ if (this.transitionName === "none") {
1575
1571
  this.getScrollElement().scrollTop = this.nextScrollPosition;
1576
1572
  const internal = this.getInternalScrollElement(element);
1577
1573
  if (internal) {
@@ -1688,7 +1684,6 @@ const NavigationController$1 = defineComponent({
1688
1684
  }
1689
1685
  }
1690
1686
  });
1691
- const _sfc_main$4 = NavigationController$1;
1692
1687
  const _hoisted_1$3 = {
1693
1688
  key: 0,
1694
1689
  class: "navigation-controller"
@@ -1758,8 +1753,9 @@ function useNavigate() {
1758
1753
  return;
1759
1754
  }
1760
1755
  let component;
1761
- if (typeof route.component === "function" || componentProperties.then) {
1762
- const method = typeof route.component === "function" ? route.component : () => route.component;
1756
+ const isComponentFunction = typeof route.component === "function" && !(!!route.component.prototype && route.component.prototype.constructor === route.component);
1757
+ if (isComponentFunction || componentProperties.then) {
1758
+ const method = isComponentFunction ? route.component : () => route.component;
1763
1759
  const originalProperties = componentProperties;
1764
1760
  if (!("PromiseComponent" in window)) {
1765
1761
  throw new Error("Required PromiseComponent window variable to make async components work in routes");
@@ -1768,7 +1764,7 @@ function useNavigate() {
1768
1764
  componentProperties = {
1769
1765
  promise: async () => {
1770
1766
  const realComponent = await method();
1771
- return new ComponentWithProperties(realComponent, await originalProperties);
1767
+ return new ComponentWithProperties(realComponent === "self" ? instance == null ? void 0 : instance.type : realComponent, await originalProperties);
1772
1768
  }
1773
1769
  };
1774
1770
  } else {
@@ -2356,11 +2352,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2356
2352
  const instance = getCurrentInstance();
2357
2353
  provide("reactive_modalStackComponent", computed(() => getExposeProxy(instance)));
2358
2354
  provide("reactive_navigation_present", present);
2359
- onMounted(() => {
2360
- var _a;
2355
+ onMounted(async () => {
2361
2356
  if (props.initialPresents) {
2362
2357
  for (const p of props.initialPresents) {
2363
- (_a = navigationController.value) == null ? void 0 : _a.push(p);
2358
+ await present(p);
2364
2359
  }
2365
2360
  }
2366
2361
  });
@@ -2386,7 +2381,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2386
2381
  const style = options.modalDisplayStyle ?? component.modalDisplayStyle ?? "cover";
2387
2382
  component.setDisplayStyle(style);
2388
2383
  if ((style === "popup" || style === "sheet" || style === "side-view") && ((_a = stackComponent.value) == null ? void 0 : _a.$el).offsetWidth > 800 || style === "sheet" && ((_b = stackComponent.value) == null ? void 0 : _b.$el).offsetWidth > 700) {
2389
- const c = new ComponentWithProperties(_sfc_main, {
2384
+ const c = new ComponentWithProperties(_sfc_main$1, {
2390
2385
  root: component,
2391
2386
  className: options.modalClass ?? style,
2392
2387
  style: options.modalCssStyle ?? void 0
@@ -2453,6 +2448,14 @@ const ModalStackComponentFinderMixin = defineComponent({
2453
2448
  }
2454
2449
  }
2455
2450
  });
2451
+ function useNavigationController() {
2452
+ const c = inject("reactive_navigationController");
2453
+ return shallowRef(c);
2454
+ }
2455
+ function useSplitViewController() {
2456
+ const c = inject("reactive_splitViewController");
2457
+ return shallowRef(c);
2458
+ }
2456
2459
  function injectHooks(instanceProxy, definitions) {
2457
2460
  const ctx = instanceProxy.$.ctx;
2458
2461
  for (const key in definitions) {
@@ -2473,6 +2476,176 @@ function injectHooks(instanceProxy, definitions) {
2473
2476
  }
2474
2477
  }
2475
2478
  }
2479
+ function useModalStackComponent() {
2480
+ const c = inject("reactive_modalStackComponent");
2481
+ return c;
2482
+ }
2483
+ function usePopup() {
2484
+ return inject("reactive_popup", null);
2485
+ }
2486
+ const navigationMethods = {
2487
+ setTitle() {
2488
+ var _a;
2489
+ const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
2490
+ if (!navigationOptions)
2491
+ return;
2492
+ const title = navigationOptions.title;
2493
+ if (typeof title === "function") {
2494
+ this.$url.setTitle(title.call(this));
2495
+ } else {
2496
+ this.$url.setTitle(title ?? "");
2497
+ }
2498
+ }
2499
+ };
2500
+ const NavigationMixin = {
2501
+ created() {
2502
+ var _a;
2503
+ const definitions = {
2504
+ pop: usePop(),
2505
+ showDetail: useShowDetail(),
2506
+ show: useShow(),
2507
+ present: usePresent(),
2508
+ dismiss: useDismiss(),
2509
+ canPop: useCanPop(),
2510
+ canDismiss: useCanDismiss(),
2511
+ isFocused: useFocused(),
2512
+ emitParents: () => {
2513
+ throw new Error("emitParents has been removed and should no longer be needed");
2514
+ },
2515
+ popup: usePopup(),
2516
+ modalStackComponent: useModalStackComponent(),
2517
+ navigationController: useNavigationController(),
2518
+ splitViewController: useSplitViewController(),
2519
+ $url: useUrl(),
2520
+ $navigate: useNavigate()
2521
+ };
2522
+ const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
2523
+ if (navigationOptions || this.customRoutes) {
2524
+ defineRoutes((navigationOptions == null ? void 0 : navigationOptions.routes) ?? (this.customRoutes ? this.customRoutes.bind(this) : null) ?? []);
2525
+ }
2526
+ injectHooks(this, definitions);
2527
+ },
2528
+ computed: {
2529
+ modalNavigationController() {
2530
+ return this.modalStackComponent.navigationController;
2531
+ }
2532
+ },
2533
+ activated() {
2534
+ navigationMethods.setTitle.call(this);
2535
+ }
2536
+ // eslint-disable-next-line @typescript-eslint/ban-types
2537
+ };
2538
+ const _hoisted_1$1 = { class: "scrollable-container" };
2539
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2540
+ __name: "Popup",
2541
+ props: {
2542
+ root: {},
2543
+ className: { default: "popup" },
2544
+ style: { default: "" }
2545
+ },
2546
+ setup(__props, { expose: __expose }) {
2547
+ const instance = getCurrentInstance();
2548
+ const Popup = instance.type;
2549
+ const props = __props;
2550
+ const hide = ref(false);
2551
+ const modalStackComponent = useModalStackComponent();
2552
+ const pop = usePop();
2553
+ const mainContent = ref(null);
2554
+ const component = useCurrentComponent();
2555
+ provide("reactive_navigation_dismiss", async (options) => {
2556
+ return await dismiss(options);
2557
+ });
2558
+ provide("reactive_navigation_pop", async (options) => {
2559
+ console.warn("Using .pop() inside a Popup without a NavigationController dismisses the Popup. It is recommended to use .dismiss() instead.");
2560
+ return await dismiss(options);
2561
+ });
2562
+ provide("reactive_navigation_can_pop", false);
2563
+ provide("reactive_navigation_can_dismiss", true);
2564
+ provide("reactive_popup", computed(() => getExposeProxy(instance)));
2565
+ const pushDown = computed(() => {
2566
+ var _a, _b;
2567
+ const popups = ((_b = (_a = modalStackComponent.value) == null ? void 0 : _a.stackComponent) == null ? void 0 : _b.children.filter((c) => c.component === Popup && (c.properties.className ?? "popup") === (props.className ?? "popup") && !c.isDismissing.value)) ?? [];
2568
+ if (popups.length > 0 && popups[popups.length - 1] !== component) {
2569
+ if (popups.length > 1 && popups[popups.length - 2] === component) {
2570
+ return 1;
2571
+ }
2572
+ return 2;
2573
+ }
2574
+ return 0;
2575
+ });
2576
+ const buildClass = computed(() => {
2577
+ const vvv = { "push-down": pushDown.value == 1, "push-down-full": pushDown.value > 1 };
2578
+ const j = Object.keys(vvv).filter((p) => !!vvv[p]).join(" ");
2579
+ return j + (j ? " " : "") + (props.className ? props.className : "popup") + (props.root.animated ? " animated" : "") + (isFocused.value ? " focused" : "");
2580
+ });
2581
+ const isFocused = useFocused();
2582
+ const onKey = (event) => {
2583
+ if (event.defaultPrevented || event.repeat) {
2584
+ return;
2585
+ }
2586
+ if (!isFocused.value) {
2587
+ return;
2588
+ }
2589
+ const key = event.key || event.keyCode;
2590
+ if (key === "Escape" || key === "Esc" || key === 27) {
2591
+ dismiss().catch(console.error);
2592
+ event.preventDefault();
2593
+ }
2594
+ };
2595
+ const shouldNavigateAway = () => {
2596
+ return props.root.shouldNavigateAway();
2597
+ };
2598
+ const dismiss = async (options) => {
2599
+ var _a;
2600
+ if (hide.value) {
2601
+ return;
2602
+ }
2603
+ if (!(options == null ? void 0 : options.force)) {
2604
+ const r = await shouldNavigateAway();
2605
+ if (!r) {
2606
+ return false;
2607
+ }
2608
+ }
2609
+ component.isDismissing.value = true;
2610
+ (_a = pop(options)) == null ? void 0 : _a.catch(console.error);
2611
+ };
2612
+ const onClick = (event) => {
2613
+ if (mainContent.value && !mainContent.value.contains(event.target) && document.body.contains(event.target)) {
2614
+ dismiss().catch(console.error);
2615
+ event.preventDefault();
2616
+ }
2617
+ };
2618
+ onActivated(() => {
2619
+ document.addEventListener("keydown", onKey);
2620
+ });
2621
+ onDeactivated(() => {
2622
+ document.removeEventListener("keydown", onKey);
2623
+ });
2624
+ __expose({
2625
+ dismiss: shallowRef(dismiss),
2626
+ pop: shallowRef(dismiss)
2627
+ });
2628
+ return (_ctx, _cache) => {
2629
+ return openBlock(), createElementBlock("div", {
2630
+ class: normalizeClass(buildClass.value),
2631
+ style: normalizeStyle(_ctx.style),
2632
+ onClick
2633
+ }, [
2634
+ createElementVNode("div", {
2635
+ ref_key: "mainContent",
2636
+ ref: mainContent
2637
+ }, [
2638
+ createElementVNode("div", _hoisted_1$1, [
2639
+ (openBlock(), createBlock(unref(ComponentWithPropertiesInstance), {
2640
+ key: _ctx.root.key,
2641
+ component: _ctx.root
2642
+ }, null, 8, ["component"]))
2643
+ ])
2644
+ ], 512)
2645
+ ], 6);
2646
+ };
2647
+ }
2648
+ });
2476
2649
  const throttle = (func, limit) => {
2477
2650
  let lastFunc;
2478
2651
  let lastRan;
@@ -2493,11 +2666,7 @@ const throttle = (func, limit) => {
2493
2666
  }
2494
2667
  };
2495
2668
  };
2496
- function useSplitViewController() {
2497
- const c = inject("reactive_splitViewController");
2498
- return shallowRef(c);
2499
- }
2500
- const SplitViewController$1 = defineComponent({
2669
+ const _sfc_main = defineComponent({
2501
2670
  name: "SplitViewController",
2502
2671
  components: {
2503
2672
  NavigationController,
@@ -2756,8 +2925,7 @@ const SplitViewController$1 = defineComponent({
2756
2925
  }
2757
2926
  }
2758
2927
  });
2759
- const _sfc_main$1 = SplitViewController$1;
2760
- const _hoisted_1$1 = ["data-has-detail"];
2928
+ const _hoisted_1 = ["data-has-detail"];
2761
2929
  const _hoisted_2 = {
2762
2930
  ref: "masterElement",
2763
2931
  class: "master"
@@ -2786,179 +2954,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2786
2954
  root: _ctx.detail
2787
2955
  }, null, 8, ["root"]))
2788
2956
  ])) : createCommentVNode("", true)
2789
- ], 8, _hoisted_1$1);
2790
- }
2791
- const SplitViewController = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
2792
- function useModalStackComponent() {
2793
- const c = inject("reactive_modalStackComponent");
2794
- return c;
2795
- }
2796
- function usePopup() {
2797
- return inject("reactive_popup", null);
2957
+ ], 8, _hoisted_1);
2798
2958
  }
2799
- const navigationMethods = {
2800
- setTitle() {
2801
- var _a;
2802
- const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
2803
- if (!navigationOptions)
2804
- return;
2805
- const title = navigationOptions.title;
2806
- if (typeof title === "function") {
2807
- this.$url.setTitle(title.call(this));
2808
- } else {
2809
- this.$url.setTitle(title ?? "");
2810
- }
2811
- }
2812
- };
2813
- const NavigationMixin = {
2814
- created() {
2815
- var _a;
2816
- const definitions = {
2817
- pop: usePop(),
2818
- showDetail: useShowDetail(),
2819
- show: useShow(),
2820
- present: usePresent(),
2821
- dismiss: useDismiss(),
2822
- canPop: useCanPop(),
2823
- canDismiss: useCanDismiss(),
2824
- isFocused: useFocused(),
2825
- emitParents: () => {
2826
- throw new Error("emitParents has been removed and should no longer be needed");
2827
- },
2828
- popup: usePopup(),
2829
- modalStackComponent: useModalStackComponent(),
2830
- navigationController: useNavigationController(),
2831
- splitViewController: useSplitViewController(),
2832
- $url: useUrl(),
2833
- $navigate: useNavigate()
2834
- };
2835
- const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
2836
- if (navigationOptions || this.customRoutes) {
2837
- defineRoutes((navigationOptions == null ? void 0 : navigationOptions.routes) ?? (this.customRoutes ? this.customRoutes.bind(this) : null) ?? []);
2838
- }
2839
- injectHooks(this, definitions);
2840
- },
2841
- computed: {
2842
- modalNavigationController() {
2843
- return this.modalStackComponent.navigationController;
2844
- }
2845
- },
2846
- activated() {
2847
- navigationMethods.setTitle.call(this);
2848
- }
2849
- // eslint-disable-next-line @typescript-eslint/ban-types
2850
- };
2851
- const _hoisted_1 = { class: "scrollable-container" };
2852
- const _sfc_main = /* @__PURE__ */ defineComponent({
2853
- __name: "Popup",
2854
- props: {
2855
- root: {},
2856
- className: { default: "popup" },
2857
- style: { default: "" }
2858
- },
2859
- setup(__props, { expose: __expose }) {
2860
- const instance = getCurrentInstance();
2861
- const Popup = instance.type;
2862
- const props = __props;
2863
- const hide = ref(false);
2864
- const modalStackComponent = useModalStackComponent();
2865
- const pop = usePop();
2866
- const mainContent = ref(null);
2867
- const component = useCurrentComponent();
2868
- provide("reactive_navigation_dismiss", async (options) => {
2869
- return await dismiss(options);
2870
- });
2871
- provide("reactive_navigation_pop", async (options) => {
2872
- console.warn("Using .pop() inside a Popup without a NavigationController dismisses the Popup. It is recommended to use .dismiss() instead.");
2873
- return await dismiss(options);
2874
- });
2875
- provide("reactive_navigation_can_pop", false);
2876
- provide("reactive_navigation_can_dismiss", true);
2877
- provide("reactive_popup", computed(() => getExposeProxy(instance)));
2878
- const pushDown = computed(() => {
2879
- var _a, _b;
2880
- const popups = ((_b = (_a = modalStackComponent.value) == null ? void 0 : _a.stackComponent) == null ? void 0 : _b.children.filter((c) => c.component === Popup && (c.properties.className ?? "popup") === (props.className ?? "popup") && !c.isDismissing.value)) ?? [];
2881
- if (popups.length > 0 && popups[popups.length - 1] !== component) {
2882
- if (popups.length > 1 && popups[popups.length - 2] === component) {
2883
- return 1;
2884
- }
2885
- return 2;
2886
- }
2887
- return 0;
2888
- });
2889
- const buildClass = computed(() => {
2890
- const vvv = { "push-down": pushDown.value == 1, "push-down-full": pushDown.value > 1 };
2891
- const j = Object.keys(vvv).filter((p) => !!vvv[p]).join(" ");
2892
- return j + (j ? " " : "") + (props.className ? props.className : "popup") + (props.root.animated ? " animated" : "") + (isFocused.value ? " focused" : "");
2893
- });
2894
- const isFocused = useFocused();
2895
- const onKey = (event) => {
2896
- if (event.defaultPrevented || event.repeat) {
2897
- return;
2898
- }
2899
- if (!isFocused.value) {
2900
- return;
2901
- }
2902
- const key = event.key || event.keyCode;
2903
- if (key === "Escape" || key === "Esc" || key === 27) {
2904
- dismiss().catch(console.error);
2905
- event.preventDefault();
2906
- }
2907
- };
2908
- const shouldNavigateAway = () => {
2909
- return props.root.shouldNavigateAway();
2910
- };
2911
- const dismiss = async (options) => {
2912
- var _a;
2913
- if (hide.value) {
2914
- return;
2915
- }
2916
- if (!(options == null ? void 0 : options.force)) {
2917
- const r = await shouldNavigateAway();
2918
- if (!r) {
2919
- return false;
2920
- }
2921
- }
2922
- component.isDismissing.value = true;
2923
- (_a = pop(options)) == null ? void 0 : _a.catch(console.error);
2924
- };
2925
- const onClick = (event) => {
2926
- if (mainContent.value && !mainContent.value.contains(event.target) && document.body.contains(event.target)) {
2927
- dismiss().catch(console.error);
2928
- event.preventDefault();
2929
- }
2930
- };
2931
- onActivated(() => {
2932
- document.addEventListener("keydown", onKey);
2933
- });
2934
- onDeactivated(() => {
2935
- document.removeEventListener("keydown", onKey);
2936
- });
2937
- __expose({
2938
- dismiss: shallowRef(dismiss),
2939
- pop: shallowRef(dismiss)
2940
- });
2941
- return (_ctx, _cache) => {
2942
- return openBlock(), createElementBlock("div", {
2943
- class: normalizeClass(buildClass.value),
2944
- style: normalizeStyle(_ctx.style),
2945
- onClick
2946
- }, [
2947
- createElementVNode("div", {
2948
- ref_key: "mainContent",
2949
- ref: mainContent
2950
- }, [
2951
- createElementVNode("div", _hoisted_1, [
2952
- (openBlock(), createBlock(unref(ComponentWithPropertiesInstance), {
2953
- key: _ctx.root.key,
2954
- component: _ctx.root
2955
- }, null, 8, ["component"]))
2956
- ])
2957
- ], 512)
2958
- ], 6);
2959
- };
2960
- }
2961
- });
2959
+ const SplitViewController = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
2962
2960
  export {
2963
2961
  ComponentWithProperties,
2964
2962
  ComponentWithPropertiesInstance,
@@ -2968,7 +2966,7 @@ export {
2968
2966
  ModalStackComponentFinderMixin,
2969
2967
  NavigationController,
2970
2968
  NavigationMixin,
2971
- _sfc_main as Popup,
2969
+ _sfc_main$1 as Popup,
2972
2970
  SplitViewController,
2973
2971
  _sfc_main$3 as StackComponent,
2974
2972
  UrlHelper,
@@ -1,10 +1,9 @@
1
1
  import { PushOptions } from './PushOptions';
2
2
  import { PopOptions } from './PopOptions';
3
3
  import { ComponentWithProperties, ComponentWithPropertiesType } from './ComponentWithProperties';
4
- import { PropType, Ref } from 'vue';
4
+ import { PropType } from 'vue';
5
5
 
6
- export declare function useNavigationController(): Ref<InstanceType<typeof NavigationController>>;
7
- declare const NavigationController: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
7
  root: {
9
8
  default: null;
10
9
  type: PropType<ComponentWithProperties | null>;
@@ -60,7 +59,7 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
60
59
  afterLeave(element: any): void;
61
60
  afterEnter(element: any): void;
62
61
  enterCancelled(_element: any): void;
63
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], "present" | "didPush" | "didPop" | "showDetail", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
62
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
64
63
  root: {
65
64
  default: null;
66
65
  type: PropType<ComponentWithProperties | null>;
@@ -77,12 +76,7 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
77
76
  type: ObjectConstructor;
78
77
  default: null;
79
78
  };
80
- }>> & Readonly<{
81
- onPresent?: ((...args: any[]) => any) | undefined;
82
- onDidPush?: ((...args: any[]) => any) | undefined;
83
- onDidPop?: ((...args: any[]) => any) | undefined;
84
- onShowDetail?: ((...args: any[]) => any) | undefined;
85
- }>, {
79
+ }>> & Readonly<{}>, {
86
80
  root: ComponentWithProperties | null;
87
81
  customProvide: Record<string, any>;
88
82
  initialComponents: ComponentWithProperties[] | null;
@@ -135,12 +129,7 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
135
129
  type: ObjectConstructor;
136
130
  default: null;
137
131
  };
138
- }>> & Readonly<{
139
- onPresent?: ((...args: any[]) => any) | undefined;
140
- onDidPush?: ((...args: any[]) => any) | undefined;
141
- onDidPop?: ((...args: any[]) => any) | undefined;
142
- onShowDetail?: ((...args: any[]) => any) | undefined;
143
- }>, {}, {
132
+ }>> & Readonly<{}>, {}, {
144
133
  components: ComponentWithPropertiesType[];
145
134
  mainComponent: ComponentWithPropertiesType | null;
146
135
  transitionName: string;
@@ -179,7 +168,7 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
179
168
  afterLeave(element: any): void;
180
169
  afterEnter(element: any): void;
181
170
  enterCancelled(_element: any): void;
182
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], {}, {}, false, {
171
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, {}, {}, false, {
183
172
  reactive_navigation_pop: {
184
173
  default: null;
185
174
  };
@@ -243,12 +232,7 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
243
232
  type: ObjectConstructor;
244
233
  default: null;
245
234
  };
246
- }>> & Readonly<{
247
- onPresent?: ((...args: any[]) => any) | undefined;
248
- onDidPush?: ((...args: any[]) => any) | undefined;
249
- onDidPop?: ((...args: any[]) => any) | undefined;
250
- onShowDetail?: ((...args: any[]) => any) | undefined;
251
- }>, {}, {
235
+ }>> & Readonly<{}>, {}, {
252
236
  components: ComponentWithPropertiesType[];
253
237
  mainComponent: ComponentWithPropertiesType | null;
254
238
  transitionName: string;
@@ -291,4 +275,4 @@ declare const NavigationController: import('vue').DefineComponent<import('vue').
291
275
  reactive_navigation_show: (options: PushOptions) => Promise<void>;
292
276
  reactive_navigation_pop: import('vue').ComputedRef<unknown>;
293
277
  }, true, {}, any>;
294
- export default NavigationController;
278
+ export default _default;
@@ -1,8 +1,9 @@
1
+ import { useNavigationController } from './useNavigationController';
1
2
  import { useModalStackComponent } from './utils/useModalStackComponent';
2
3
  import { NavigationOptions, useCanDismiss, useCanPop, useDismiss, useFocused, useNavigate, usePop, usePresent, useShow, useShowDetail, useUrl } from './utils/navigationHooks';
3
- import { useSplitViewController } from './SplitViewController.vue';
4
+ import { useSplitViewController } from './useSplitViewController';
4
5
  import { default as Popup } from './Popup.vue';
5
- import { default as NavigationController, useNavigationController } from './NavigationController.vue';
6
+ import { default as NavigationController } from './NavigationController.vue';
6
7
  import { DefineComponent, Ref } from 'vue';
7
8
 
8
9
  /**
@@ -2,10 +2,9 @@ import { DefaultRouteHandler } from './utils/navigationHooks';
2
2
  import { PushOptions } from './PushOptions';
3
3
  import { default as NavigationController } from './NavigationController.vue';
4
4
  import { ComponentWithProperties, ComponentWithPropertiesType } from './ComponentWithProperties';
5
- import { PropType, Ref } from 'vue';
5
+ import { PropType } from 'vue';
6
6
 
7
- export declare function useSplitViewController(): Ref<InstanceType<typeof SplitViewController>>;
8
- declare const SplitViewController: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
7
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
9
8
  root: {
10
9
  required: true;
11
10
  type: PropType<ComponentWithPropertiesType>;
@@ -105,7 +104,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
105
104
  afterLeave(element: any): void;
106
105
  afterEnter(element: any): void;
107
106
  enterCancelled(_element: any): void;
108
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], "present" | "didPush" | "didPop" | "showDetail", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
107
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
109
108
  root: {
110
109
  default: null;
111
110
  type: PropType<ComponentWithProperties | null>;
@@ -122,12 +121,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
122
121
  type: ObjectConstructor;
123
122
  default: null;
124
123
  };
125
- }>> & Readonly<{
126
- onPresent?: ((...args: any[]) => any) | undefined;
127
- onDidPush?: ((...args: any[]) => any) | undefined;
128
- onDidPop?: ((...args: any[]) => any) | undefined;
129
- onShowDetail?: ((...args: any[]) => any) | undefined;
130
- }>, {
124
+ }>> & Readonly<{}>, {
131
125
  root: ComponentWithProperties | null;
132
126
  customProvide: Record<string, any>;
133
127
  initialComponents: ComponentWithProperties[] | null;
@@ -180,12 +174,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
180
174
  type: ObjectConstructor;
181
175
  default: null;
182
176
  };
183
- }>> & Readonly<{
184
- onPresent?: ((...args: any[]) => any) | undefined;
185
- onDidPush?: ((...args: any[]) => any) | undefined;
186
- onDidPop?: ((...args: any[]) => any) | undefined;
187
- onShowDetail?: ((...args: any[]) => any) | undefined;
188
- }>, {}, {
177
+ }>> & Readonly<{}>, {}, {
189
178
  components: ComponentWithPropertiesType[];
190
179
  mainComponent: ComponentWithPropertiesType | null;
191
180
  transitionName: string;
@@ -224,7 +213,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
224
213
  afterLeave(element: any): void;
225
214
  afterEnter(element: any): void;
226
215
  enterCancelled(_element: any): void;
227
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], {}, {}, false, {
216
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, {}, {}, false, {
228
217
  reactive_navigation_pop: {
229
218
  default: null;
230
219
  };
@@ -288,12 +277,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
288
277
  type: ObjectConstructor;
289
278
  default: null;
290
279
  };
291
- }>> & Readonly<{
292
- onPresent?: ((...args: any[]) => any) | undefined;
293
- onDidPush?: ((...args: any[]) => any) | undefined;
294
- onDidPop?: ((...args: any[]) => any) | undefined;
295
- onShowDetail?: ((...args: any[]) => any) | undefined;
296
- }>, {}, {
280
+ }>> & Readonly<{}>, {}, {
297
281
  components: ComponentWithPropertiesType[];
298
282
  mainComponent: ComponentWithPropertiesType | null;
299
283
  transitionName: string;
@@ -455,7 +439,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
455
439
  afterLeave(element: any): void;
456
440
  afterEnter(element: any): void;
457
441
  enterCancelled(_element: any): void;
458
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], "present" | "didPush" | "didPop" | "showDetail", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
442
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
459
443
  root: {
460
444
  default: null;
461
445
  type: PropType<ComponentWithProperties | null>;
@@ -472,12 +456,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
472
456
  type: ObjectConstructor;
473
457
  default: null;
474
458
  };
475
- }>> & Readonly<{
476
- onPresent?: ((...args: any[]) => any) | undefined;
477
- onDidPush?: ((...args: any[]) => any) | undefined;
478
- onDidPop?: ((...args: any[]) => any) | undefined;
479
- onShowDetail?: ((...args: any[]) => any) | undefined;
480
- }>, {
459
+ }>> & Readonly<{}>, {
481
460
  root: ComponentWithProperties | null;
482
461
  customProvide: Record<string, any>;
483
462
  initialComponents: ComponentWithProperties[] | null;
@@ -530,12 +509,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
530
509
  type: ObjectConstructor;
531
510
  default: null;
532
511
  };
533
- }>> & Readonly<{
534
- onPresent?: ((...args: any[]) => any) | undefined;
535
- onDidPush?: ((...args: any[]) => any) | undefined;
536
- onDidPop?: ((...args: any[]) => any) | undefined;
537
- onShowDetail?: ((...args: any[]) => any) | undefined;
538
- }>, {}, {
512
+ }>> & Readonly<{}>, {}, {
539
513
  components: ComponentWithPropertiesType[];
540
514
  mainComponent: ComponentWithPropertiesType | null;
541
515
  transitionName: string;
@@ -574,7 +548,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
574
548
  afterLeave(element: any): void;
575
549
  afterEnter(element: any): void;
576
550
  enterCancelled(_element: any): void;
577
- }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("present" | "didPush" | "didPop" | "showDetail")[], {}, {}, false, {
551
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, {}, {}, false, {
578
552
  reactive_navigation_pop: {
579
553
  default: null;
580
554
  };
@@ -638,12 +612,7 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
638
612
  type: ObjectConstructor;
639
613
  default: null;
640
614
  };
641
- }>> & Readonly<{
642
- onPresent?: ((...args: any[]) => any) | undefined;
643
- onDidPush?: ((...args: any[]) => any) | undefined;
644
- onDidPop?: ((...args: any[]) => any) | undefined;
645
- onShowDetail?: ((...args: any[]) => any) | undefined;
646
- }>, {}, {
615
+ }>> & Readonly<{}>, {}, {
647
616
  components: ComponentWithPropertiesType[];
648
617
  mainComponent: ComponentWithPropertiesType | null;
649
618
  transitionName: string;
@@ -757,4 +726,4 @@ declare const SplitViewController: import('vue').DefineComponent<import('vue').E
757
726
  }, {}>;
758
727
  reactive_navigation_show_detail: (options: PushOptions) => Promise<boolean>;
759
728
  }, true, {}, any>;
760
- export default SplitViewController;
729
+ export default _default;
@@ -5,13 +5,13 @@ export * from './HistoryManager';
5
5
  export { default as ModalStackComponent } from './ModalStackComponent.vue';
6
6
  export * from './ModalStackComponentFinderMixin';
7
7
  export { default as NavigationController } from './NavigationController.vue';
8
- export { useNavigationController } from './NavigationController.vue';
8
+ export { useNavigationController } from './useNavigationController.ts';
9
9
  export * from './NavigationMixin';
10
10
  export * from './PopOptions';
11
11
  export { default as Popup } from './Popup.vue';
12
12
  export * from './PushOptions';
13
13
  export { default as SplitViewController } from './SplitViewController.vue';
14
- export { useSplitViewController } from './SplitViewController.vue';
14
+ export { useSplitViewController } from './useSplitViewController.ts';
15
15
  export { default as StackComponent } from './StackComponent.vue';
16
16
  export * from './utils/injectHooks';
17
17
  export * from './utils/navigationHooks';
@@ -0,0 +1,4 @@
1
+ import { default as NavigationController } from './NavigationController.vue';
2
+ import { Ref } from 'vue';
3
+
4
+ export declare function useNavigationController(): Ref<InstanceType<typeof NavigationController>>;
@@ -0,0 +1,4 @@
1
+ import { default as SplitViewController } from './SplitViewController.vue';
2
+ import { Ref } from 'vue';
3
+
4
+ export declare function useSplitViewController(): Ref<InstanceType<typeof SplitViewController>>;
@@ -3,14 +3,14 @@ import { PushOptions } from '../PushOptions';
3
3
  import { PopOptions } from '../PopOptions';
4
4
  import { HistoryUrl } from '../HistoryManager';
5
5
  import { ComponentWithProperties } from '../ComponentWithProperties';
6
- import { ComponentOptions, Ref } from 'vue';
6
+ import { Component, Ref } from 'vue';
7
7
 
8
- export type Route<Params, T> = {
8
+ export type Route<Params> = {
9
9
  name?: string;
10
10
  url: string;
11
11
  params?: UrlParamsConstructors<Params>;
12
12
  query?: UrlParamsConstructors<unknown>;
13
- component: ComponentOptions | (() => Promise<ComponentOptions>) | 'self';
13
+ component: Component | (() => Promise<Component>) | 'self';
14
14
  present?: 'popup' | 'sheet' | true;
15
15
  show?: true | 'detail';
16
16
  isDefault?: RouteNavigationOptions<Params>;
@@ -58,21 +58,21 @@ export type RouteIdentification<Params> = {
58
58
  } | {
59
59
  url: string;
60
60
  } | {
61
- route: Route<Params, any>;
61
+ route: Route<Params>;
62
62
  };
63
63
  export type NavigationOptions<T> = {
64
64
  title: string | ((this: T) => string);
65
- routes?: Route<{}, T>[];
65
+ routes?: Route<any>[];
66
66
  };
67
67
  export declare function usePop(): (options?: PopOptions) => Promise<void> | undefined;
68
- export declare function useNavigate(): <Params extends Record<string, unknown>>(prop1: string | Route<Params, unknown>, prop2?: RouteNavigationOptions<Params>) => Promise<void>;
68
+ export declare function useNavigate(): <Params extends Record<string, unknown>>(prop1: string | Route<Params>, prop2?: RouteNavigationOptions<Params>) => Promise<void>;
69
69
  export type DefaultRouteHandler = () => Promise<boolean>;
70
70
  export type OnCheckRoutesHandler = () => Promise<void> | void;
71
71
  export declare function onCheckRoutes(handler: OnCheckRoutesHandler): void;
72
72
  export declare function onNotCheckRoutes(handler: OnCheckRoutesHandler): void;
73
- export declare function defineRoutes(routes: (Route<any, undefined>[]) | (() => Promise<boolean | (Route<any, undefined>[])>)): void;
73
+ export declare function defineRoutes(routes: (Route<any>[]) | (() => Promise<boolean | (Route<any>[])>)): void;
74
74
  export declare function useCurrentHref(): Ref<string, string>;
75
- export declare function useCheckRoute(): <Params extends Record<string, unknown>>(prop1: string | Route<Params, unknown>, prop2?: RouteNavigationOptions<Params>) => boolean;
75
+ export declare function useCheckRoute(): <Params extends Record<string, unknown>>(prop1: string | Route<Params>, prop2?: RouteNavigationOptions<Params>) => boolean;
76
76
  export declare function normalizePushOptions(o: PushOptions | ComponentWithProperties, currentComponent: ComponentWithProperties | null, urlHelpers: ReturnType<typeof useUrl>): PushOptions;
77
77
  export declare function useManualPresent(): (present: (options: PushOptions) => Promise<void> | void, options: PushOptions | ComponentWithProperties) => void | Promise<void>;
78
78
  export declare function useShow(): (options: PushOptions | ComponentWithProperties) => Promise<void>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@simonbackx/vue-app-navigation",
3
3
  "main": "./dist/index.js",
4
4
  "types": "./dist/index.d.ts",
5
- "version": "2.9.0",
5
+ "version": "2.11.0",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.js",
@@ -31,17 +31,13 @@
31
31
  ],
32
32
  "type": "module",
33
33
  "devDependencies": {
34
- "@eslint/js": "^9.11.1",
35
34
  "@types/node": "^20.12.7",
36
35
  "@vitejs/plugin-vue": "^5.0.4",
37
- "@vue/eslint-config-typescript": "^13.0.0",
38
36
  "@vue/runtime-core": "^3.5.12",
39
- "eslint": "^9.11.1",
40
37
  "eslint-plugin-stamhoofd": "^2.74.0",
41
38
  "sass": "^1.32.4",
42
- "tslib": "^2.6.2",
39
+ "tslib": "^2.8.1",
43
40
  "typescript": "^5.6.2",
44
- "typescript-eslint": "^7.7.1",
45
41
  "vite": "^5.2.10",
46
42
  "vite-plugin-dts": "^3.9.0",
47
43
  "vue": "^3.5.12"