@simonbackx/vue-app-navigation 2.5.1 → 2.5.3
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
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { inject, ref, reactive, markRaw, proxyRefs, getCurrentInstance, provide, computed, unref, onActivated, onMounted, queuePostFlushCb, onBeforeUnmount, onBeforeMount, onUpdated, warn, h, setTransitionHooks, callWithAsyncErrorHandling, ErrorCodes, shallowRef, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, defineComponent, Transition, withCtx, createBlock, createCommentVNode, customRef, onScopeDispose, onDeactivated, normalizeClass, normalizeStyle, TransitionGroup, Fragment, renderList
|
|
7
|
+
import { inject, ref, reactive, markRaw, proxyRefs, getCurrentInstance, provide, computed, unref, onActivated, onMounted, queuePostFlushCb, onBeforeUnmount, onBeforeMount, onUpdated, warn, h, setTransitionHooks, callWithAsyncErrorHandling, ErrorCodes, shallowRef, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, defineComponent, Transition, withCtx, createBlock, createCommentVNode, customRef, onScopeDispose, onDeactivated, normalizeClass, normalizeStyle, isRef, TransitionGroup, Fragment, renderList } from "vue";
|
|
8
8
|
const _UrlHelper = class _UrlHelper {
|
|
9
9
|
constructor(url, localFixedPrefix) {
|
|
10
10
|
__publicField(this, "url");
|
|
@@ -2136,7 +2136,8 @@ function useCanDismiss() {
|
|
|
2136
2136
|
return computed(() => !!unref(rawDismiss));
|
|
2137
2137
|
}
|
|
2138
2138
|
function useFocused() {
|
|
2139
|
-
|
|
2139
|
+
const rawFocused = inject("reactive_navigation_focused", true);
|
|
2140
|
+
return computed(() => !!unref(rawFocused));
|
|
2140
2141
|
}
|
|
2141
2142
|
function extendUrl(url) {
|
|
2142
2143
|
const urlHelpers = useUrl();
|
|
@@ -2256,15 +2257,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2256
2257
|
const j = Object.keys(vvv).filter((p) => !!vvv[p]).join(" ");
|
|
2257
2258
|
return j + (j ? " " : "") + (props.className ? props.className : "popup") + (props.root.animated ? " animated" : "");
|
|
2258
2259
|
});
|
|
2259
|
-
const isFocused =
|
|
2260
|
-
var _a;
|
|
2261
|
-
const popups = (_a = modalStackComponent.value.stackComponent) == null ? void 0 : _a.getFocusedComponent();
|
|
2262
|
-
if (popups !== component) {
|
|
2263
|
-
return false;
|
|
2264
|
-
}
|
|
2265
|
-
return true;
|
|
2266
|
-
});
|
|
2267
|
-
provide("reactive_navigation_focused", isFocused);
|
|
2260
|
+
const isFocused = useFocused();
|
|
2268
2261
|
const onKey = (event) => {
|
|
2269
2262
|
if (event.defaultPrevented || event.repeat) {
|
|
2270
2263
|
return;
|
|
@@ -2332,6 +2325,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2332
2325
|
};
|
|
2333
2326
|
}
|
|
2334
2327
|
});
|
|
2328
|
+
function injectHooks(instanceProxy, definitions) {
|
|
2329
|
+
const ctx = instanceProxy.$.ctx;
|
|
2330
|
+
for (const key in definitions) {
|
|
2331
|
+
if (!isRef(definitions[key])) {
|
|
2332
|
+
ctx[key] = definitions[key];
|
|
2333
|
+
} else {
|
|
2334
|
+
const val = definitions[key];
|
|
2335
|
+
Object.defineProperty(ctx, key, {
|
|
2336
|
+
enumerable: true,
|
|
2337
|
+
configurable: true,
|
|
2338
|
+
get: () => {
|
|
2339
|
+
return val.value;
|
|
2340
|
+
},
|
|
2341
|
+
set: () => {
|
|
2342
|
+
warn(`Cannot assign to '${key}' of navigation mixin. This is a read-only property.`);
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2335
2348
|
const StackComponent$1 = defineComponent({
|
|
2336
2349
|
name: "StackComponent",
|
|
2337
2350
|
components: {
|
|
@@ -2346,6 +2359,12 @@ const StackComponent$1 = defineComponent({
|
|
|
2346
2359
|
beforeUnmount() {
|
|
2347
2360
|
this.components = [];
|
|
2348
2361
|
},
|
|
2362
|
+
created() {
|
|
2363
|
+
const definitions = {
|
|
2364
|
+
parentIsFocused: useFocused()
|
|
2365
|
+
};
|
|
2366
|
+
injectHooks(this, definitions);
|
|
2367
|
+
},
|
|
2349
2368
|
methods: {
|
|
2350
2369
|
getCustomProvide(index, key) {
|
|
2351
2370
|
return {
|
|
@@ -2357,7 +2376,8 @@ const StackComponent$1 = defineComponent({
|
|
|
2357
2376
|
console.warn("Avoid calling dismiss in components on the StackComponent, since options are not supported here");
|
|
2358
2377
|
this.removeAt(index, key);
|
|
2359
2378
|
},
|
|
2360
|
-
reactive_navigation_can_dismiss: false
|
|
2379
|
+
reactive_navigation_can_dismiss: false,
|
|
2380
|
+
reactive_navigation_focused: !!this.parentIsFocused && this.getFocusedComponent() === this.components[index]
|
|
2361
2381
|
};
|
|
2362
2382
|
},
|
|
2363
2383
|
show(component) {
|
|
@@ -2423,26 +2443,6 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2423
2443
|
]);
|
|
2424
2444
|
}
|
|
2425
2445
|
const StackComponent = /* @__PURE__ */ _export_sfc(StackComponent$1, [["render", _sfc_render$2]]);
|
|
2426
|
-
function injectHooks(instanceProxy, definitions) {
|
|
2427
|
-
const ctx = instanceProxy.$.ctx;
|
|
2428
|
-
for (const key in definitions) {
|
|
2429
|
-
if (!isRef(definitions[key])) {
|
|
2430
|
-
ctx[key] = definitions[key];
|
|
2431
|
-
} else {
|
|
2432
|
-
const val = definitions[key];
|
|
2433
|
-
Object.defineProperty(ctx, key, {
|
|
2434
|
-
enumerable: true,
|
|
2435
|
-
configurable: true,
|
|
2436
|
-
get: () => {
|
|
2437
|
-
return val.value;
|
|
2438
|
-
},
|
|
2439
|
-
set: () => {
|
|
2440
|
-
warn(`Cannot assign to '${key}' of navigation mixin. This is a read-only property.`);
|
|
2441
|
-
}
|
|
2442
|
-
});
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
2446
|
function useModalStackComponent() {
|
|
2447
2447
|
const c = inject("reactive_modalStackComponent");
|
|
2448
2448
|
return shallowRef(c);
|
|
@@ -2483,6 +2483,13 @@ const ModalStackComponent$1 = defineComponent({
|
|
|
2483
2483
|
// Can also be wrapped in modal stack component
|
|
2484
2484
|
modalStackComponent() {
|
|
2485
2485
|
return this;
|
|
2486
|
+
},
|
|
2487
|
+
isFocused() {
|
|
2488
|
+
return !!this.parentIsFocused;
|
|
2489
|
+
},
|
|
2490
|
+
isNavigationControllerFocused() {
|
|
2491
|
+
var _a;
|
|
2492
|
+
return this.isFocused && !((_a = this.stackComponent) == null ? void 0 : _a.getFocusedComponent());
|
|
2486
2493
|
}
|
|
2487
2494
|
},
|
|
2488
2495
|
created() {
|
|
@@ -2490,7 +2497,8 @@ const ModalStackComponent$1 = defineComponent({
|
|
|
2490
2497
|
parentPresent: usePresent(),
|
|
2491
2498
|
parentDismiss: useDismiss(),
|
|
2492
2499
|
parentPop: usePop(),
|
|
2493
|
-
parentShow: useShow()
|
|
2500
|
+
parentShow: useShow(),
|
|
2501
|
+
parentIsFocused: useFocused()
|
|
2494
2502
|
};
|
|
2495
2503
|
injectHooks(this, definitions);
|
|
2496
2504
|
},
|
|
@@ -2555,8 +2563,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2555
2563
|
ref: "navigationController",
|
|
2556
2564
|
"animation-type": "modal",
|
|
2557
2565
|
root: _ctx.root,
|
|
2558
|
-
"initial-components": _ctx.initialComponents
|
|
2559
|
-
|
|
2566
|
+
"initial-components": _ctx.initialComponents,
|
|
2567
|
+
"custom-provide": {
|
|
2568
|
+
reactive_navigation_focused: _ctx.isNavigationControllerFocused
|
|
2569
|
+
}
|
|
2570
|
+
}, null, 8, ["root", "initial-components", "custom-provide"]),
|
|
2560
2571
|
createVNode(_component_StackComponent, {
|
|
2561
2572
|
ref: "stackComponent",
|
|
2562
2573
|
onReturnToHistoryIndex: _ctx.returnToHistoryIndex
|
package/dist/src/ModalMixin.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
29
29
|
reactive_navigation_can_pop: boolean;
|
|
30
30
|
reactive_navigation_dismiss: () => void;
|
|
31
31
|
reactive_navigation_can_dismiss: boolean;
|
|
32
|
+
reactive_navigation_focused: boolean;
|
|
32
33
|
};
|
|
33
34
|
show(component: import('./ComponentWithProperties').ComponentWithProperties): void;
|
|
34
35
|
getFocusedComponent(): {
|
|
@@ -100,6 +101,7 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
100
101
|
reactive_navigation_can_pop: boolean;
|
|
101
102
|
reactive_navigation_dismiss: () => void;
|
|
102
103
|
reactive_navigation_can_dismiss: boolean;
|
|
104
|
+
reactive_navigation_focused: boolean;
|
|
103
105
|
};
|
|
104
106
|
show(component: import('./ComponentWithProperties').ComponentWithProperties): void;
|
|
105
107
|
getFocusedComponent(): {
|
|
@@ -351,6 +353,8 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
351
353
|
initialComponents: import('./ComponentWithProperties').ComponentWithProperties[] | null;
|
|
352
354
|
initialPresents: import('./PushOptions').PushOptions[] | null;
|
|
353
355
|
}>;
|
|
356
|
+
isFocused(): boolean;
|
|
357
|
+
isNavigationControllerFocused(): boolean;
|
|
354
358
|
}, {
|
|
355
359
|
present(options: import('./PushOptions').PushOptions): void;
|
|
356
360
|
returnToHistoryIndex(): boolean;
|
|
@@ -405,6 +409,7 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
405
409
|
reactive_navigation_can_pop: boolean;
|
|
406
410
|
reactive_navigation_dismiss: () => void;
|
|
407
411
|
reactive_navigation_can_dismiss: boolean;
|
|
412
|
+
reactive_navigation_focused: boolean;
|
|
408
413
|
};
|
|
409
414
|
show(component: import('./ComponentWithProperties').ComponentWithProperties): void;
|
|
410
415
|
getFocusedComponent(): {
|
|
@@ -476,6 +481,7 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
476
481
|
reactive_navigation_can_pop: boolean;
|
|
477
482
|
reactive_navigation_dismiss: () => void;
|
|
478
483
|
reactive_navigation_can_dismiss: boolean;
|
|
484
|
+
reactive_navigation_focused: boolean;
|
|
479
485
|
};
|
|
480
486
|
show(component: import('./ComponentWithProperties').ComponentWithProperties): void;
|
|
481
487
|
getFocusedComponent(): {
|
|
@@ -727,6 +733,8 @@ export declare const ModalMixin: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
|
727
733
|
initialComponents: import('./ComponentWithProperties').ComponentWithProperties[] | null;
|
|
728
734
|
initialPresents: import('./PushOptions').PushOptions[] | null;
|
|
729
735
|
}>;
|
|
736
|
+
isFocused(): boolean;
|
|
737
|
+
isNavigationControllerFocused(): boolean;
|
|
730
738
|
}, {
|
|
731
739
|
present(options: import('./PushOptions').PushOptions): void;
|
|
732
740
|
returnToHistoryIndex(): boolean;
|
|
@@ -28,6 +28,7 @@ declare const ModalStackComponent: import('vue').DefineComponent<{
|
|
|
28
28
|
reactive_navigation_can_pop: boolean;
|
|
29
29
|
reactive_navigation_dismiss: () => void;
|
|
30
30
|
reactive_navigation_can_dismiss: boolean;
|
|
31
|
+
reactive_navigation_focused: boolean;
|
|
31
32
|
};
|
|
32
33
|
show(component: ComponentWithProperties): void;
|
|
33
34
|
getFocusedComponent(): {
|
|
@@ -99,6 +100,7 @@ declare const ModalStackComponent: import('vue').DefineComponent<{
|
|
|
99
100
|
reactive_navigation_can_pop: boolean;
|
|
100
101
|
reactive_navigation_dismiss: () => void;
|
|
101
102
|
reactive_navigation_can_dismiss: boolean;
|
|
103
|
+
reactive_navigation_focused: boolean;
|
|
102
104
|
};
|
|
103
105
|
show(component: ComponentWithProperties): void;
|
|
104
106
|
getFocusedComponent(): {
|
|
@@ -350,6 +352,8 @@ declare const ModalStackComponent: import('vue').DefineComponent<{
|
|
|
350
352
|
initialComponents: ComponentWithProperties[] | null;
|
|
351
353
|
initialPresents: PushOptions[] | null;
|
|
352
354
|
}>;
|
|
355
|
+
isFocused(): boolean;
|
|
356
|
+
isNavigationControllerFocused(): boolean;
|
|
353
357
|
}, {
|
|
354
358
|
present(options: PushOptions): void;
|
|
355
359
|
returnToHistoryIndex(): boolean;
|
|
@@ -8,6 +8,7 @@ declare const StackComponent: import('vue').DefineComponent<{}, {}, {
|
|
|
8
8
|
reactive_navigation_can_pop: boolean;
|
|
9
9
|
reactive_navigation_dismiss: () => void;
|
|
10
10
|
reactive_navigation_can_dismiss: boolean;
|
|
11
|
+
reactive_navigation_focused: boolean;
|
|
11
12
|
};
|
|
12
13
|
show(component: ComponentWithProperties): void;
|
|
13
14
|
getFocusedComponent(): {
|
|
@@ -80,7 +80,7 @@ export declare function usePresent(): (options: PushOptions | ComponentWithPrope
|
|
|
80
80
|
export declare function useDismiss(): (options?: PopOptions) => Promise<void>;
|
|
81
81
|
export declare function useCanPop(): Ref<boolean>;
|
|
82
82
|
export declare function useCanDismiss(): Ref<boolean>;
|
|
83
|
-
export declare function useFocused():
|
|
83
|
+
export declare function useFocused(): import('vue').ComputedRef<boolean>;
|
|
84
84
|
/**
|
|
85
85
|
* Add a url 'prefix' to the current url and all its children
|
|
86
86
|
*/
|
|
@@ -92,6 +92,7 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
92
92
|
reactive_navigation_can_pop: boolean;
|
|
93
93
|
reactive_navigation_dismiss: () => void;
|
|
94
94
|
reactive_navigation_can_dismiss: boolean;
|
|
95
|
+
reactive_navigation_focused: boolean;
|
|
95
96
|
};
|
|
96
97
|
show(component: import('..').ComponentWithProperties): void;
|
|
97
98
|
getFocusedComponent(): {
|
|
@@ -163,6 +164,7 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
163
164
|
reactive_navigation_can_pop: boolean;
|
|
164
165
|
reactive_navigation_dismiss: () => void;
|
|
165
166
|
reactive_navigation_can_dismiss: boolean;
|
|
167
|
+
reactive_navigation_focused: boolean;
|
|
166
168
|
};
|
|
167
169
|
show(component: import('..').ComponentWithProperties): void;
|
|
168
170
|
getFocusedComponent(): {
|
|
@@ -414,6 +416,8 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
414
416
|
initialComponents: import('..').ComponentWithProperties[] | null;
|
|
415
417
|
initialPresents: import('..').PushOptions[] | null;
|
|
416
418
|
}>;
|
|
419
|
+
isFocused(): boolean;
|
|
420
|
+
isNavigationControllerFocused(): boolean;
|
|
417
421
|
}, {
|
|
418
422
|
present(options: import('..').PushOptions): void;
|
|
419
423
|
returnToHistoryIndex(): boolean;
|
|
@@ -468,6 +472,7 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
468
472
|
reactive_navigation_can_pop: boolean;
|
|
469
473
|
reactive_navigation_dismiss: () => void;
|
|
470
474
|
reactive_navigation_can_dismiss: boolean;
|
|
475
|
+
reactive_navigation_focused: boolean;
|
|
471
476
|
};
|
|
472
477
|
show(component: import('..').ComponentWithProperties): void;
|
|
473
478
|
getFocusedComponent(): {
|
|
@@ -539,6 +544,7 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
539
544
|
reactive_navigation_can_pop: boolean;
|
|
540
545
|
reactive_navigation_dismiss: () => void;
|
|
541
546
|
reactive_navigation_can_dismiss: boolean;
|
|
547
|
+
reactive_navigation_focused: boolean;
|
|
542
548
|
};
|
|
543
549
|
show(component: import('..').ComponentWithProperties): void;
|
|
544
550
|
getFocusedComponent(): {
|
|
@@ -790,6 +796,8 @@ declare const EditWebshopMixin_base: new (...args: any) => import('../src/class-
|
|
|
790
796
|
initialComponents: import('..').ComponentWithProperties[] | null;
|
|
791
797
|
initialPresents: import('..').PushOptions[] | null;
|
|
792
798
|
}>;
|
|
799
|
+
isFocused(): boolean;
|
|
800
|
+
isNavigationControllerFocused(): boolean;
|
|
793
801
|
}, {
|
|
794
802
|
present(options: import('..').PushOptions): void;
|
|
795
803
|
returnToHistoryIndex(): boolean;
|