@simonbackx/vue-app-navigation 2.8.2 → 2.10.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 +211 -198
- package/dist/src/ComponentWithProperties.d.ts +1 -1
- package/dist/src/HistoryManager.d.ts +2 -1
- package/dist/src/NavigationController.vue.d.ts +8 -24
- package/dist/src/NavigationMixin.d.ts +3 -2
- package/dist/src/SplitViewController.vue.d.ts +13 -44
- package/dist/src/index.d.ts +2 -2
- package/dist/src/useNavigationController.d.ts +4 -0
- package/dist/src/useSplitViewController.d.ts +4 -0
- package/dist/src/utils/navigationHooks.d.ts +8 -8
- package/package.json +4 -10
package/dist/index.js
CHANGED
|
@@ -137,9 +137,9 @@ const _UrlHelper = class _UrlHelper {
|
|
|
137
137
|
return matchPath(this.getParts(), this.getSearchParams(), template, params);
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
/**
|
|
140
|
+
/**
|
|
141
141
|
* Use this for the universal fixed prefix
|
|
142
|
-
*
|
|
142
|
+
*
|
|
143
143
|
* Always remove this prefix when getting an url, and add it when doing setUrl.
|
|
144
144
|
* When you want to host an app in a subdirectory
|
|
145
145
|
* Slashes are added automatically on the sides if needed
|
|
@@ -235,6 +235,13 @@ class HistoryManagerStatic {
|
|
|
235
235
|
this.runQueue();
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
+
waitForQueue() {
|
|
239
|
+
return new Promise((resolve) => {
|
|
240
|
+
this.addToQueue(() => {
|
|
241
|
+
resolve();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
238
245
|
runQueue() {
|
|
239
246
|
this.isQueueRunning = true;
|
|
240
247
|
const action = this.historyQueue.shift();
|
|
@@ -304,6 +311,7 @@ class HistoryManagerStatic {
|
|
|
304
311
|
}
|
|
305
312
|
const didJustLoadPage = Date.now() - this.pageLoadedAt < 1e3 * 5;
|
|
306
313
|
this.changeUrlTimeout = setTimeout(() => {
|
|
314
|
+
this.changeUrlTimeout = null;
|
|
307
315
|
if (this.counter !== count || state.url !== url) {
|
|
308
316
|
return;
|
|
309
317
|
}
|
|
@@ -341,18 +349,24 @@ class HistoryManagerStatic {
|
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
351
|
// Call this when url formatting or prefix has changed
|
|
344
|
-
updateUrl() {
|
|
352
|
+
async updateUrl() {
|
|
345
353
|
if (!this.active) {
|
|
346
354
|
return;
|
|
347
355
|
}
|
|
348
356
|
if (this.changeUrlTimeout) {
|
|
357
|
+
await this.waitForQueue();
|
|
349
358
|
return;
|
|
350
359
|
}
|
|
360
|
+
const state = this.states[this.states.length - 1];
|
|
361
|
+
const count = state.index;
|
|
351
362
|
this.addToQueue(() => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
363
|
+
if (this.counter !== count) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const formattedUrl = this.resolveUrl(count);
|
|
367
|
+
history.replaceState({ counter: count }, "", formattedUrl);
|
|
355
368
|
});
|
|
369
|
+
await this.waitForQueue();
|
|
356
370
|
}
|
|
357
371
|
formatTitle(title) {
|
|
358
372
|
return title + (this.titleSuffix ? " | " + this.titleSuffix : "");
|
|
@@ -847,7 +861,7 @@ __publicField(_ComponentWithProperties, "debug", false);
|
|
|
847
861
|
__publicField(_ComponentWithProperties, "historyIndexOwners", /* @__PURE__ */ new Map());
|
|
848
862
|
let ComponentWithProperties = _ComponentWithProperties;
|
|
849
863
|
/**
|
|
850
|
-
* @vue/shared v3.5.
|
|
864
|
+
* @vue/shared v3.5.16
|
|
851
865
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
852
866
|
* @license MIT
|
|
853
867
|
**/
|
|
@@ -1153,11 +1167,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1153
1167
|
]);
|
|
1154
1168
|
}
|
|
1155
1169
|
const FramedComponent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
|
|
1156
|
-
|
|
1157
|
-
const c = inject("reactive_navigationController");
|
|
1158
|
-
return shallowRef(c);
|
|
1159
|
-
}
|
|
1160
|
-
const NavigationController$1 = defineComponent({
|
|
1170
|
+
const _sfc_main$4 = defineComponent({
|
|
1161
1171
|
name: "NavigationController",
|
|
1162
1172
|
components: {
|
|
1163
1173
|
FramedComponent
|
|
@@ -1557,7 +1567,7 @@ const NavigationController$1 = defineComponent({
|
|
|
1557
1567
|
}
|
|
1558
1568
|
},
|
|
1559
1569
|
enter(element, done) {
|
|
1560
|
-
if (this.transitionName
|
|
1570
|
+
if (this.transitionName === "none") {
|
|
1561
1571
|
this.getScrollElement().scrollTop = this.nextScrollPosition;
|
|
1562
1572
|
const internal = this.getInternalScrollElement(element);
|
|
1563
1573
|
if (internal) {
|
|
@@ -1674,7 +1684,6 @@ const NavigationController$1 = defineComponent({
|
|
|
1674
1684
|
}
|
|
1675
1685
|
}
|
|
1676
1686
|
});
|
|
1677
|
-
const _sfc_main$4 = NavigationController$1;
|
|
1678
1687
|
const _hoisted_1$3 = {
|
|
1679
1688
|
key: 0,
|
|
1680
1689
|
class: "navigation-controller"
|
|
@@ -1744,8 +1753,9 @@ function useNavigate() {
|
|
|
1744
1753
|
return;
|
|
1745
1754
|
}
|
|
1746
1755
|
let component;
|
|
1747
|
-
|
|
1748
|
-
|
|
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;
|
|
1749
1759
|
const originalProperties = componentProperties;
|
|
1750
1760
|
if (!("PromiseComponent" in window)) {
|
|
1751
1761
|
throw new Error("Required PromiseComponent window variable to make async components work in routes");
|
|
@@ -1754,7 +1764,7 @@ function useNavigate() {
|
|
|
1754
1764
|
componentProperties = {
|
|
1755
1765
|
promise: async () => {
|
|
1756
1766
|
const realComponent = await method();
|
|
1757
|
-
return new ComponentWithProperties(realComponent, await originalProperties);
|
|
1767
|
+
return new ComponentWithProperties(realComponent === "self" ? instance == null ? void 0 : instance.type : realComponent, await originalProperties);
|
|
1758
1768
|
}
|
|
1759
1769
|
};
|
|
1760
1770
|
} else {
|
|
@@ -2372,7 +2382,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2372
2382
|
const style = options.modalDisplayStyle ?? component.modalDisplayStyle ?? "cover";
|
|
2373
2383
|
component.setDisplayStyle(style);
|
|
2374
2384
|
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) {
|
|
2375
|
-
const c = new ComponentWithProperties(_sfc_main, {
|
|
2385
|
+
const c = new ComponentWithProperties(_sfc_main$1, {
|
|
2376
2386
|
root: component,
|
|
2377
2387
|
className: options.modalClass ?? style,
|
|
2378
2388
|
style: options.modalCssStyle ?? void 0
|
|
@@ -2439,6 +2449,14 @@ const ModalStackComponentFinderMixin = defineComponent({
|
|
|
2439
2449
|
}
|
|
2440
2450
|
}
|
|
2441
2451
|
});
|
|
2452
|
+
function useNavigationController() {
|
|
2453
|
+
const c = inject("reactive_navigationController");
|
|
2454
|
+
return shallowRef(c);
|
|
2455
|
+
}
|
|
2456
|
+
function useSplitViewController() {
|
|
2457
|
+
const c = inject("reactive_splitViewController");
|
|
2458
|
+
return shallowRef(c);
|
|
2459
|
+
}
|
|
2442
2460
|
function injectHooks(instanceProxy, definitions) {
|
|
2443
2461
|
const ctx = instanceProxy.$.ctx;
|
|
2444
2462
|
for (const key in definitions) {
|
|
@@ -2459,6 +2477,176 @@ function injectHooks(instanceProxy, definitions) {
|
|
|
2459
2477
|
}
|
|
2460
2478
|
}
|
|
2461
2479
|
}
|
|
2480
|
+
function useModalStackComponent() {
|
|
2481
|
+
const c = inject("reactive_modalStackComponent");
|
|
2482
|
+
return c;
|
|
2483
|
+
}
|
|
2484
|
+
function usePopup() {
|
|
2485
|
+
return inject("reactive_popup", null);
|
|
2486
|
+
}
|
|
2487
|
+
const navigationMethods = {
|
|
2488
|
+
setTitle() {
|
|
2489
|
+
var _a;
|
|
2490
|
+
const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
|
|
2491
|
+
if (!navigationOptions)
|
|
2492
|
+
return;
|
|
2493
|
+
const title = navigationOptions.title;
|
|
2494
|
+
if (typeof title === "function") {
|
|
2495
|
+
this.$url.setTitle(title.call(this));
|
|
2496
|
+
} else {
|
|
2497
|
+
this.$url.setTitle(title ?? "");
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
};
|
|
2501
|
+
const NavigationMixin = {
|
|
2502
|
+
created() {
|
|
2503
|
+
var _a;
|
|
2504
|
+
const definitions = {
|
|
2505
|
+
pop: usePop(),
|
|
2506
|
+
showDetail: useShowDetail(),
|
|
2507
|
+
show: useShow(),
|
|
2508
|
+
present: usePresent(),
|
|
2509
|
+
dismiss: useDismiss(),
|
|
2510
|
+
canPop: useCanPop(),
|
|
2511
|
+
canDismiss: useCanDismiss(),
|
|
2512
|
+
isFocused: useFocused(),
|
|
2513
|
+
emitParents: () => {
|
|
2514
|
+
throw new Error("emitParents has been removed and should no longer be needed");
|
|
2515
|
+
},
|
|
2516
|
+
popup: usePopup(),
|
|
2517
|
+
modalStackComponent: useModalStackComponent(),
|
|
2518
|
+
navigationController: useNavigationController(),
|
|
2519
|
+
splitViewController: useSplitViewController(),
|
|
2520
|
+
$url: useUrl(),
|
|
2521
|
+
$navigate: useNavigate()
|
|
2522
|
+
};
|
|
2523
|
+
const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
|
|
2524
|
+
if (navigationOptions || this.customRoutes) {
|
|
2525
|
+
defineRoutes((navigationOptions == null ? void 0 : navigationOptions.routes) ?? (this.customRoutes ? this.customRoutes.bind(this) : null) ?? []);
|
|
2526
|
+
}
|
|
2527
|
+
injectHooks(this, definitions);
|
|
2528
|
+
},
|
|
2529
|
+
computed: {
|
|
2530
|
+
modalNavigationController() {
|
|
2531
|
+
return this.modalStackComponent.navigationController;
|
|
2532
|
+
}
|
|
2533
|
+
},
|
|
2534
|
+
activated() {
|
|
2535
|
+
navigationMethods.setTitle.call(this);
|
|
2536
|
+
}
|
|
2537
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2538
|
+
};
|
|
2539
|
+
const _hoisted_1$1 = { class: "scrollable-container" };
|
|
2540
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2541
|
+
__name: "Popup",
|
|
2542
|
+
props: {
|
|
2543
|
+
root: {},
|
|
2544
|
+
className: { default: "popup" },
|
|
2545
|
+
style: { default: "" }
|
|
2546
|
+
},
|
|
2547
|
+
setup(__props, { expose: __expose }) {
|
|
2548
|
+
const instance = getCurrentInstance();
|
|
2549
|
+
const Popup = instance.type;
|
|
2550
|
+
const props = __props;
|
|
2551
|
+
const hide = ref(false);
|
|
2552
|
+
const modalStackComponent = useModalStackComponent();
|
|
2553
|
+
const pop = usePop();
|
|
2554
|
+
const mainContent = ref(null);
|
|
2555
|
+
const component = useCurrentComponent();
|
|
2556
|
+
provide("reactive_navigation_dismiss", async (options) => {
|
|
2557
|
+
return await dismiss(options);
|
|
2558
|
+
});
|
|
2559
|
+
provide("reactive_navigation_pop", async (options) => {
|
|
2560
|
+
console.warn("Using .pop() inside a Popup without a NavigationController dismisses the Popup. It is recommended to use .dismiss() instead.");
|
|
2561
|
+
return await dismiss(options);
|
|
2562
|
+
});
|
|
2563
|
+
provide("reactive_navigation_can_pop", false);
|
|
2564
|
+
provide("reactive_navigation_can_dismiss", true);
|
|
2565
|
+
provide("reactive_popup", computed(() => getExposeProxy(instance)));
|
|
2566
|
+
const pushDown = computed(() => {
|
|
2567
|
+
var _a, _b;
|
|
2568
|
+
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)) ?? [];
|
|
2569
|
+
if (popups.length > 0 && popups[popups.length - 1] !== component) {
|
|
2570
|
+
if (popups.length > 1 && popups[popups.length - 2] === component) {
|
|
2571
|
+
return 1;
|
|
2572
|
+
}
|
|
2573
|
+
return 2;
|
|
2574
|
+
}
|
|
2575
|
+
return 0;
|
|
2576
|
+
});
|
|
2577
|
+
const buildClass = computed(() => {
|
|
2578
|
+
const vvv = { "push-down": pushDown.value == 1, "push-down-full": pushDown.value > 1 };
|
|
2579
|
+
const j = Object.keys(vvv).filter((p) => !!vvv[p]).join(" ");
|
|
2580
|
+
return j + (j ? " " : "") + (props.className ? props.className : "popup") + (props.root.animated ? " animated" : "") + (isFocused.value ? " focused" : "");
|
|
2581
|
+
});
|
|
2582
|
+
const isFocused = useFocused();
|
|
2583
|
+
const onKey = (event) => {
|
|
2584
|
+
if (event.defaultPrevented || event.repeat) {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
if (!isFocused.value) {
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
const key = event.key || event.keyCode;
|
|
2591
|
+
if (key === "Escape" || key === "Esc" || key === 27) {
|
|
2592
|
+
dismiss().catch(console.error);
|
|
2593
|
+
event.preventDefault();
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
const shouldNavigateAway = () => {
|
|
2597
|
+
return props.root.shouldNavigateAway();
|
|
2598
|
+
};
|
|
2599
|
+
const dismiss = async (options) => {
|
|
2600
|
+
var _a;
|
|
2601
|
+
if (hide.value) {
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
if (!(options == null ? void 0 : options.force)) {
|
|
2605
|
+
const r = await shouldNavigateAway();
|
|
2606
|
+
if (!r) {
|
|
2607
|
+
return false;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
component.isDismissing.value = true;
|
|
2611
|
+
(_a = pop(options)) == null ? void 0 : _a.catch(console.error);
|
|
2612
|
+
};
|
|
2613
|
+
const onClick = (event) => {
|
|
2614
|
+
if (mainContent.value && !mainContent.value.contains(event.target) && document.body.contains(event.target)) {
|
|
2615
|
+
dismiss().catch(console.error);
|
|
2616
|
+
event.preventDefault();
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
onActivated(() => {
|
|
2620
|
+
document.addEventListener("keydown", onKey);
|
|
2621
|
+
});
|
|
2622
|
+
onDeactivated(() => {
|
|
2623
|
+
document.removeEventListener("keydown", onKey);
|
|
2624
|
+
});
|
|
2625
|
+
__expose({
|
|
2626
|
+
dismiss: shallowRef(dismiss),
|
|
2627
|
+
pop: shallowRef(dismiss)
|
|
2628
|
+
});
|
|
2629
|
+
return (_ctx, _cache) => {
|
|
2630
|
+
return openBlock(), createElementBlock("div", {
|
|
2631
|
+
class: normalizeClass(buildClass.value),
|
|
2632
|
+
style: normalizeStyle(_ctx.style),
|
|
2633
|
+
onClick
|
|
2634
|
+
}, [
|
|
2635
|
+
createElementVNode("div", {
|
|
2636
|
+
ref_key: "mainContent",
|
|
2637
|
+
ref: mainContent
|
|
2638
|
+
}, [
|
|
2639
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
2640
|
+
(openBlock(), createBlock(unref(ComponentWithPropertiesInstance), {
|
|
2641
|
+
key: _ctx.root.key,
|
|
2642
|
+
component: _ctx.root
|
|
2643
|
+
}, null, 8, ["component"]))
|
|
2644
|
+
])
|
|
2645
|
+
], 512)
|
|
2646
|
+
], 6);
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
});
|
|
2462
2650
|
const throttle = (func, limit) => {
|
|
2463
2651
|
let lastFunc;
|
|
2464
2652
|
let lastRan;
|
|
@@ -2479,11 +2667,7 @@ const throttle = (func, limit) => {
|
|
|
2479
2667
|
}
|
|
2480
2668
|
};
|
|
2481
2669
|
};
|
|
2482
|
-
|
|
2483
|
-
const c = inject("reactive_splitViewController");
|
|
2484
|
-
return shallowRef(c);
|
|
2485
|
-
}
|
|
2486
|
-
const SplitViewController$1 = defineComponent({
|
|
2670
|
+
const _sfc_main = defineComponent({
|
|
2487
2671
|
name: "SplitViewController",
|
|
2488
2672
|
components: {
|
|
2489
2673
|
NavigationController,
|
|
@@ -2742,8 +2926,7 @@ const SplitViewController$1 = defineComponent({
|
|
|
2742
2926
|
}
|
|
2743
2927
|
}
|
|
2744
2928
|
});
|
|
2745
|
-
const
|
|
2746
|
-
const _hoisted_1$1 = ["data-has-detail"];
|
|
2929
|
+
const _hoisted_1 = ["data-has-detail"];
|
|
2747
2930
|
const _hoisted_2 = {
|
|
2748
2931
|
ref: "masterElement",
|
|
2749
2932
|
class: "master"
|
|
@@ -2772,179 +2955,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2772
2955
|
root: _ctx.detail
|
|
2773
2956
|
}, null, 8, ["root"]))
|
|
2774
2957
|
])) : createCommentVNode("", true)
|
|
2775
|
-
], 8, _hoisted_1
|
|
2958
|
+
], 8, _hoisted_1);
|
|
2776
2959
|
}
|
|
2777
|
-
const SplitViewController = /* @__PURE__ */ _export_sfc(_sfc_main
|
|
2778
|
-
function useModalStackComponent() {
|
|
2779
|
-
const c = inject("reactive_modalStackComponent");
|
|
2780
|
-
return c;
|
|
2781
|
-
}
|
|
2782
|
-
function usePopup() {
|
|
2783
|
-
return inject("reactive_popup", null);
|
|
2784
|
-
}
|
|
2785
|
-
const navigationMethods = {
|
|
2786
|
-
setTitle() {
|
|
2787
|
-
var _a;
|
|
2788
|
-
const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
|
|
2789
|
-
if (!navigationOptions)
|
|
2790
|
-
return;
|
|
2791
|
-
const title = navigationOptions.title;
|
|
2792
|
-
if (typeof title === "function") {
|
|
2793
|
-
this.$url.setTitle(title.call(this));
|
|
2794
|
-
} else {
|
|
2795
|
-
this.$url.setTitle(title ?? "");
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
};
|
|
2799
|
-
const NavigationMixin = {
|
|
2800
|
-
created() {
|
|
2801
|
-
var _a;
|
|
2802
|
-
const definitions = {
|
|
2803
|
-
pop: usePop(),
|
|
2804
|
-
showDetail: useShowDetail(),
|
|
2805
|
-
show: useShow(),
|
|
2806
|
-
present: usePresent(),
|
|
2807
|
-
dismiss: useDismiss(),
|
|
2808
|
-
canPop: useCanPop(),
|
|
2809
|
-
canDismiss: useCanDismiss(),
|
|
2810
|
-
isFocused: useFocused(),
|
|
2811
|
-
emitParents: () => {
|
|
2812
|
-
throw new Error("emitParents has been removed and should no longer be needed");
|
|
2813
|
-
},
|
|
2814
|
-
popup: usePopup(),
|
|
2815
|
-
modalStackComponent: useModalStackComponent(),
|
|
2816
|
-
navigationController: useNavigationController(),
|
|
2817
|
-
splitViewController: useSplitViewController(),
|
|
2818
|
-
$url: useUrl(),
|
|
2819
|
-
$navigate: useNavigate()
|
|
2820
|
-
};
|
|
2821
|
-
const navigationOptions = (_a = this.$options) == null ? void 0 : _a.navigation;
|
|
2822
|
-
if (navigationOptions || this.customRoutes) {
|
|
2823
|
-
defineRoutes((navigationOptions == null ? void 0 : navigationOptions.routes) ?? (this.customRoutes ? this.customRoutes.bind(this) : null) ?? []);
|
|
2824
|
-
}
|
|
2825
|
-
injectHooks(this, definitions);
|
|
2826
|
-
},
|
|
2827
|
-
computed: {
|
|
2828
|
-
modalNavigationController() {
|
|
2829
|
-
return this.modalStackComponent.navigationController;
|
|
2830
|
-
}
|
|
2831
|
-
},
|
|
2832
|
-
activated() {
|
|
2833
|
-
navigationMethods.setTitle.call(this);
|
|
2834
|
-
}
|
|
2835
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2836
|
-
};
|
|
2837
|
-
const _hoisted_1 = { class: "scrollable-container" };
|
|
2838
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2839
|
-
__name: "Popup",
|
|
2840
|
-
props: {
|
|
2841
|
-
root: {},
|
|
2842
|
-
className: { default: "popup" },
|
|
2843
|
-
style: { default: "" }
|
|
2844
|
-
},
|
|
2845
|
-
setup(__props, { expose: __expose }) {
|
|
2846
|
-
const instance = getCurrentInstance();
|
|
2847
|
-
const Popup = instance.type;
|
|
2848
|
-
const props = __props;
|
|
2849
|
-
const hide = ref(false);
|
|
2850
|
-
const modalStackComponent = useModalStackComponent();
|
|
2851
|
-
const pop = usePop();
|
|
2852
|
-
const mainContent = ref(null);
|
|
2853
|
-
const component = useCurrentComponent();
|
|
2854
|
-
provide("reactive_navigation_dismiss", async (options) => {
|
|
2855
|
-
return await dismiss(options);
|
|
2856
|
-
});
|
|
2857
|
-
provide("reactive_navigation_pop", async (options) => {
|
|
2858
|
-
console.warn("Using .pop() inside a Popup without a NavigationController dismisses the Popup. It is recommended to use .dismiss() instead.");
|
|
2859
|
-
return await dismiss(options);
|
|
2860
|
-
});
|
|
2861
|
-
provide("reactive_navigation_can_pop", false);
|
|
2862
|
-
provide("reactive_navigation_can_dismiss", true);
|
|
2863
|
-
provide("reactive_popup", computed(() => getExposeProxy(instance)));
|
|
2864
|
-
const pushDown = computed(() => {
|
|
2865
|
-
var _a, _b;
|
|
2866
|
-
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)) ?? [];
|
|
2867
|
-
if (popups.length > 0 && popups[popups.length - 1] !== component) {
|
|
2868
|
-
if (popups.length > 1 && popups[popups.length - 2] === component) {
|
|
2869
|
-
return 1;
|
|
2870
|
-
}
|
|
2871
|
-
return 2;
|
|
2872
|
-
}
|
|
2873
|
-
return 0;
|
|
2874
|
-
});
|
|
2875
|
-
const buildClass = computed(() => {
|
|
2876
|
-
const vvv = { "push-down": pushDown.value == 1, "push-down-full": pushDown.value > 1 };
|
|
2877
|
-
const j = Object.keys(vvv).filter((p) => !!vvv[p]).join(" ");
|
|
2878
|
-
return j + (j ? " " : "") + (props.className ? props.className : "popup") + (props.root.animated ? " animated" : "") + (isFocused.value ? " focused" : "");
|
|
2879
|
-
});
|
|
2880
|
-
const isFocused = useFocused();
|
|
2881
|
-
const onKey = (event) => {
|
|
2882
|
-
if (event.defaultPrevented || event.repeat) {
|
|
2883
|
-
return;
|
|
2884
|
-
}
|
|
2885
|
-
if (!isFocused.value) {
|
|
2886
|
-
return;
|
|
2887
|
-
}
|
|
2888
|
-
const key = event.key || event.keyCode;
|
|
2889
|
-
if (key === "Escape" || key === "Esc" || key === 27) {
|
|
2890
|
-
dismiss().catch(console.error);
|
|
2891
|
-
event.preventDefault();
|
|
2892
|
-
}
|
|
2893
|
-
};
|
|
2894
|
-
const shouldNavigateAway = () => {
|
|
2895
|
-
return props.root.shouldNavigateAway();
|
|
2896
|
-
};
|
|
2897
|
-
const dismiss = async (options) => {
|
|
2898
|
-
var _a;
|
|
2899
|
-
if (hide.value) {
|
|
2900
|
-
return;
|
|
2901
|
-
}
|
|
2902
|
-
if (!(options == null ? void 0 : options.force)) {
|
|
2903
|
-
const r = await shouldNavigateAway();
|
|
2904
|
-
if (!r) {
|
|
2905
|
-
return false;
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
component.isDismissing.value = true;
|
|
2909
|
-
(_a = pop(options)) == null ? void 0 : _a.catch(console.error);
|
|
2910
|
-
};
|
|
2911
|
-
const onClick = (event) => {
|
|
2912
|
-
if (mainContent.value && !mainContent.value.contains(event.target) && document.body.contains(event.target)) {
|
|
2913
|
-
dismiss().catch(console.error);
|
|
2914
|
-
event.preventDefault();
|
|
2915
|
-
}
|
|
2916
|
-
};
|
|
2917
|
-
onActivated(() => {
|
|
2918
|
-
document.addEventListener("keydown", onKey);
|
|
2919
|
-
});
|
|
2920
|
-
onDeactivated(() => {
|
|
2921
|
-
document.removeEventListener("keydown", onKey);
|
|
2922
|
-
});
|
|
2923
|
-
__expose({
|
|
2924
|
-
dismiss: shallowRef(dismiss),
|
|
2925
|
-
pop: shallowRef(dismiss)
|
|
2926
|
-
});
|
|
2927
|
-
return (_ctx, _cache) => {
|
|
2928
|
-
return openBlock(), createElementBlock("div", {
|
|
2929
|
-
class: normalizeClass(buildClass.value),
|
|
2930
|
-
style: normalizeStyle(_ctx.style),
|
|
2931
|
-
onClick
|
|
2932
|
-
}, [
|
|
2933
|
-
createElementVNode("div", {
|
|
2934
|
-
ref_key: "mainContent",
|
|
2935
|
-
ref: mainContent
|
|
2936
|
-
}, [
|
|
2937
|
-
createElementVNode("div", _hoisted_1, [
|
|
2938
|
-
(openBlock(), createBlock(unref(ComponentWithPropertiesInstance), {
|
|
2939
|
-
key: _ctx.root.key,
|
|
2940
|
-
component: _ctx.root
|
|
2941
|
-
}, null, 8, ["component"]))
|
|
2942
|
-
])
|
|
2943
|
-
], 512)
|
|
2944
|
-
], 6);
|
|
2945
|
-
};
|
|
2946
|
-
}
|
|
2947
|
-
});
|
|
2960
|
+
const SplitViewController = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
2948
2961
|
export {
|
|
2949
2962
|
ComponentWithProperties,
|
|
2950
2963
|
ComponentWithPropertiesInstance,
|
|
@@ -2954,7 +2967,7 @@ export {
|
|
|
2954
2967
|
ModalStackComponentFinderMixin,
|
|
2955
2968
|
NavigationController,
|
|
2956
2969
|
NavigationMixin,
|
|
2957
|
-
_sfc_main as Popup,
|
|
2970
|
+
_sfc_main$1 as Popup,
|
|
2958
2971
|
SplitViewController,
|
|
2959
2972
|
_sfc_main$3 as StackComponent,
|
|
2960
2973
|
UrlHelper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HistoryUrl } from './HistoryManager';
|
|
2
2
|
import { ComponentInternalInstance, ComponentPublicInstance, Raw, VNode } from 'vue';
|
|
3
3
|
|
|
4
|
-
export type ModalDisplayStyle =
|
|
4
|
+
export type ModalDisplayStyle = 'cover' | 'popup' | 'overlay' | 'sheet' | 'side-view';
|
|
5
5
|
export declare function useCurrentComponent(): ComponentWithPropertiesType | null;
|
|
6
6
|
export declare function getExposeProxy(instance: ComponentInternalInstance | null | undefined): ComponentPublicInstance | undefined;
|
|
7
7
|
export declare function forAllRoots(root: ComponentWithProperties, handler: (root: ComponentWithPropertiesType) => void, alreadyProcessed?: Set<ComponentWithPropertiesType>): void;
|
|
@@ -28,12 +28,13 @@ declare class HistoryManagerStatic {
|
|
|
28
28
|
removeListener(owner: unknown): void;
|
|
29
29
|
callListeners(): void;
|
|
30
30
|
private addToQueue;
|
|
31
|
+
private waitForQueue;
|
|
31
32
|
private runQueue;
|
|
32
33
|
private go;
|
|
33
34
|
getStateUrl(index: number): string;
|
|
34
35
|
resolveUrl(index: number): string;
|
|
35
36
|
setUrl(url: HistoryUrl, title?: string, index?: number): void;
|
|
36
|
-
updateUrl(): void
|
|
37
|
+
updateUrl(): Promise<void>;
|
|
37
38
|
formatTitle(title: string): string;
|
|
38
39
|
/**
|
|
39
40
|
* Set the saved title for a given state. If that state is the current one, it will also get set immediately
|
|
@@ -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
|
|
4
|
+
import { PropType } from 'vue';
|
|
5
5
|
|
|
6
|
-
|
|
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,
|
|
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,
|
|
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
|
|
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 './
|
|
4
|
+
import { useSplitViewController } from './useSplitViewController';
|
|
4
5
|
import { default as Popup } from './Popup.vue';
|
|
5
|
-
import { default as NavigationController
|
|
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
|
|
5
|
+
import { PropType } from 'vue';
|
|
6
6
|
|
|
7
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
729
|
+
export default _default;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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 './
|
|
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 './
|
|
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';
|
|
@@ -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 {
|
|
6
|
+
import { Component, Ref } from 'vue';
|
|
7
7
|
|
|
8
|
-
export type Route<Params
|
|
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:
|
|
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
|
|
61
|
+
route: Route<Params>;
|
|
62
62
|
};
|
|
63
63
|
export type NavigationOptions<T> = {
|
|
64
64
|
title: string | ((this: T) => string);
|
|
65
|
-
routes?: Route<
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
5
|
+
"version": "2.10.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build": "vite build",
|
|
25
25
|
"dev": "vite serve test --mode development",
|
|
26
26
|
"build:dev": "vite build --mode development",
|
|
27
|
-
"lint": "eslint
|
|
27
|
+
"lint": "eslint"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|
|
@@ -32,18 +32,12 @@
|
|
|
32
32
|
"type": "module",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^20.12.7",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
36
|
-
"@typescript-eslint/parser": "^7.7.1",
|
|
37
35
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
38
|
-
"@vue/eslint-config-typescript": "^13.0.0",
|
|
39
36
|
"@vue/runtime-core": "^3.5.12",
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
42
|
-
"eslint-plugin-vue": "^9.25.0",
|
|
37
|
+
"eslint-plugin-stamhoofd": "^2.74.0",
|
|
43
38
|
"sass": "^1.32.4",
|
|
44
|
-
"tslib": "^2.
|
|
39
|
+
"tslib": "^2.8.1",
|
|
45
40
|
"typescript": "^5.6.2",
|
|
46
|
-
"typescript-eslint": "^7.7.1",
|
|
47
41
|
"vite": "^5.2.10",
|
|
48
42
|
"vite-plugin-dts": "^3.9.0",
|
|
49
43
|
"vue": "^3.5.12"
|