@shwfed/nuxt 0.1.75 → 0.1.76

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.
@@ -1,65 +1,90 @@
1
1
  import { useRoute, useRouter } from "#app";
2
2
  import { useSessionStorage } from "@vueuse/core";
3
- import { computed, watch } from "vue";
4
- import { normalizeRoutePath } from "../utils/route.js";
5
- export function useNavigationTabs() {
3
+ import { computed, toValue, onMounted } from "vue";
4
+ export function useNavigationTabs(navigations) {
6
5
  const tabs = useSessionStorage("navigation-tabs", /* @__PURE__ */ new Set(), {
7
6
  writeDefaults: false
8
7
  });
9
8
  const active = useSessionStorage("navigation-active-tab", void 0, {
10
9
  writeDefaults: false
11
10
  });
11
+ const clean = (path) => path.replace(/\/$/g, "");
12
12
  const route = useRoute();
13
13
  const router = useRouter();
14
- const tabList = computed(() => Array.from(tabs.value));
15
- const activateTab = (tab) => {
16
- active.value = normalizeRoutePath(tab);
17
- };
18
- const closeTab = (tab) => {
19
- const normalizedTab = normalizeRoutePath(tab);
20
- const nextTabs = tabList.value;
21
- const closedIndex = nextTabs.findIndex((tab2) => tab2 === normalizedTab);
22
- tabs.value.delete(normalizedTab);
23
- if (active.value !== normalizedTab)
24
- return;
25
- const previousTab = closedIndex > 0 ? nextTabs[closedIndex - 1] : void 0;
26
- const nextTab = closedIndex >= 0 ? nextTabs[closedIndex + 1] : void 0;
27
- const fallbackTab = previousTab ?? nextTab;
28
- if (fallbackTab) {
29
- activateTab(fallbackTab);
30
- return;
14
+ const has = (raw) => {
15
+ const path = clean(raw);
16
+ for (const group of toValue(navigations)) {
17
+ if ("children" in group) {
18
+ for (const item of group.children) {
19
+ if (item.route === path) {
20
+ return true;
21
+ }
22
+ }
23
+ } else {
24
+ if (group.route === path) {
25
+ return true;
26
+ }
27
+ }
31
28
  }
32
- activateTab("/");
33
29
  };
34
- watch(active, (tab) => {
35
- if (!tab)
36
- return;
37
- const normalizedTab = normalizeRoutePath(tab);
38
- if (tab !== normalizedTab) {
39
- active.value = normalizedTab;
30
+ onMounted(() => {
31
+ const path = clean(route.path);
32
+ if (!has(path)) {
33
+ const [first] = Array.from(tabs.value);
34
+ if (first) {
35
+ active.value = first;
36
+ router.replace(first);
37
+ return;
38
+ }
39
+ const nav = toValue(navigations)[0];
40
+ const fallback = nav && "children" in nav ? nav.children[0]?.route : nav?.route;
41
+ if (fallback) {
42
+ router.replace(fallback);
43
+ active.value = fallback;
44
+ tabs.value.add(fallback);
45
+ }
40
46
  return;
41
47
  }
42
- if (route.path !== normalizedTab)
43
- router.replace(normalizedTab);
44
- if (!tabs.value.has(normalizedTab))
45
- tabs.value.add(normalizedTab);
48
+ if (!tabs.value.has(path))
49
+ tabs.value.add(path);
50
+ active.value = path;
46
51
  });
47
- watch(
48
- () => route.path,
49
- (path) => {
50
- const normalizedPath = normalizeRoutePath(path);
51
- if (active.value !== normalizedPath)
52
- active.value = normalizedPath;
53
- if (!tabs.value.has(normalizedPath))
54
- tabs.value.add(normalizedPath);
55
- },
56
- { immediate: true }
57
- );
58
52
  return {
59
53
  tabs,
60
- tabList,
61
- active,
62
- activateTab,
63
- closeTab
54
+ nameOf: (path) => {
55
+ for (const group of toValue(navigations)) {
56
+ if ("children" in group) {
57
+ for (const item of group.children) {
58
+ if (clean(item.route) === clean(path)) {
59
+ return item.title;
60
+ }
61
+ }
62
+ } else {
63
+ if (clean(group.route) === clean(path)) {
64
+ return group.title;
65
+ }
66
+ }
67
+ }
68
+ },
69
+ close: (raw) => {
70
+ const path = clean(raw);
71
+ if (path === active.value)
72
+ active.value = Array.from(tabs.value).at(Array.from(tabs.value).findIndex((tab) => tab === active.value) - 1);
73
+ tabs.value.delete(path);
74
+ },
75
+ active: computed({
76
+ get: () => {
77
+ if (!active.value) return;
78
+ return clean(active.value);
79
+ },
80
+ set: (raw) => {
81
+ const path = clean(raw);
82
+ if (!path) return;
83
+ router.replace(path);
84
+ if (!tabs.value.has(path))
85
+ tabs.value.add(path);
86
+ active.value = path;
87
+ }
88
+ })
64
89
  };
65
90
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("#app").RouteMiddleware;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { defineNuxtRouteMiddleware } from "#app";
2
+ export default defineNuxtRouteMiddleware((to, from) => {
3
+ if (from.name) return;
4
+ const token = to.query["code"] ?? to.query["token"] ?? to.query["access_token"];
5
+ if (!token || Array.isArray(token)) return;
6
+ if (import.meta.client) {
7
+ sessionStorage.setItem("token", token);
8
+ }
9
+ });
@@ -1,8 +1,6 @@
1
1
  declare const _default: import("#app").Plugin<{
2
2
  api: import("nitropack").$Fetch<unknown, import("nitropack").NitroFetchRequest>;
3
- logout: () => void;
4
3
  }> & import("#app").ObjectPlugin<{
5
4
  api: import("nitropack").$Fetch<unknown, import("nitropack").NitroFetchRequest>;
6
- logout: () => void;
7
5
  }>;
8
6
  export default _default;
@@ -1,75 +1,25 @@
1
- import { defineNuxtPlugin, navigateTo, useNuxtApp, useRuntimeConfig } from "#app";
1
+ import { defineNuxtPlugin, useRuntimeConfig } from "#app";
2
2
  import { useNavigatorLanguage } from "@vueuse/core";
3
- import { getProperty } from "dot-prop";
4
- import z from "zod";
5
3
  export default defineNuxtPlugin({
6
4
  name: "shwfed-nuxt:api",
7
- dependsOn: ["shwfed-nuxt:cel"],
8
- setup: (nuxt) => {
5
+ setup: () => {
9
6
  const locale = useNavigatorLanguage();
10
7
  const config = useRuntimeConfig().public.shwfed;
11
- const { $dsl } = useNuxtApp();
12
8
  const api = $fetch.create({
13
- baseURL: config.apis.apiHost,
9
+ baseURL: config.api.host,
14
10
  onRequest: ({
15
11
  options
16
12
  }) => {
17
- const headersExpression = getProperty(config.apis, "headers");
18
- const tokenExpression = getProperty(config.apis, "token");
19
- if (typeof headersExpression === "string" && typeof tokenExpression === "string") {
20
- try {
21
- const token = $dsl.evaluate`${tokenExpression}`();
22
- if (token === void 0 || typeof token !== "string")
23
- throw new Error("Token is undefined");
24
- const headers = $dsl.evaluate`${headersExpression}`({
25
- token
26
- });
27
- for (const [key, value] of Object.entries(z.record(z.string(), z.string()).parse(headers))) {
28
- if (!options.headers.has(key))
29
- options.headers.set(key, value);
30
- }
31
- } catch {
32
- }
33
- }
34
13
  if (locale.isSupported && locale.language.value) {
35
14
  options.headers.set("Accept-Language", locale.language.value);
36
15
  }
37
- },
38
- onResponse: ({ response }) => {
39
- const expiredExpression = getProperty(config.apis, "expired");
40
- const logoutUri = getProperty(config.apis, "logoutUri");
41
- if (typeof expiredExpression === "string" && typeof logoutUri === "string") {
42
- try {
43
- const expired = $dsl.evaluate`${expiredExpression}`({
44
- response: response._data
45
- });
46
- if (expired === true) {
47
- nuxt.runWithContext(() => {
48
- window.sessionStorage.clear();
49
- navigateTo(logoutUri, {
50
- external: true,
51
- replace: true
52
- });
53
- });
54
- }
55
- } catch {
56
- }
57
- }
16
+ const name = config.headers.token ?? "Authorization";
17
+ options.headers.set(name, sessionStorage.getItem("token") ?? "");
58
18
  }
59
19
  });
60
20
  return {
61
21
  provide: {
62
- api,
63
- logout: () => {
64
- const logoutUri = getProperty(config.apis, "logoutUri");
65
- if (typeof logoutUri !== "string")
66
- return;
67
- window.sessionStorage.clear();
68
- navigateTo(logoutUri, {
69
- external: true,
70
- replace: true
71
- });
72
- }
22
+ api
73
23
  }
74
24
  };
75
25
  }
@@ -68,7 +68,7 @@ export function createEnvironment() {
68
68
  return Optional.of(value);
69
69
  }).registerType("URL", URL).registerFunction("URL.searchParams(): URLSearchParams", (url) => {
70
70
  return url.searchParams;
71
- }).registerVariable("location", "URL").registerType("Date", TZDate).registerVariable("now", "Date").registerVariable("today", "Date").registerFunction("date(string): Date", (date) => {
71
+ }).registerVariable("location", "URL").registerType("Date", TZDate).registerVariable("token", "string").registerVariable("now", "Date").registerVariable("today", "Date").registerFunction("date(string): Date", (date) => {
72
72
  return new TZDate(date);
73
73
  }).registerOperator("Date < Date", (date1, date2) => {
74
74
  return isBefore(date1, date2);
@@ -9,12 +9,13 @@ export default defineNuxtPlugin({
9
9
  const env = createEnvironment().registerConstant("git", "map<string, string>", config.git).registerConstant("ci", "map<string, dyn>", {
10
10
  ...config.ci,
11
11
  build: config.ci.build !== void 0 ? BigInt(config.ci.build) : void 0
12
- }).registerConstant("apis", "map<string, string>", config.apis);
12
+ });
13
13
  const evaluate = (...args) => (context) => {
14
14
  return env.evaluate(String.raw(...args), defu({}, getGlobalDslContext(), context, {
15
15
  now: /* @__PURE__ */ new Date(),
16
16
  today: /* @__PURE__ */ new Date(),
17
- location: new URL(location.href)
17
+ location: new URL(location.href),
18
+ token: sessionStorage.getItem("token") ?? ""
18
19
  }));
19
20
  };
20
21
  if (import.meta.client) {
@@ -8,9 +8,9 @@ declare const _default: import("#app").Plugin<{
8
8
  message: (message: string | (() => string | import("vue").Component) | import("vue").Component, data?: import("vue-sonner").ExternalToast) => string | number;
9
9
  promise: <ToastData>(promise: Promise<ToastData> | (() => Promise<ToastData>), data?: ({
10
10
  id?: number | string | undefined;
11
+ icon?: import("vue").Component | undefined;
11
12
  class?: string | undefined;
12
13
  style?: import("vue").CSSProperties | undefined;
13
- icon?: import("vue").Component | undefined;
14
14
  toasterId?: string | undefined;
15
15
  component?: import("vue").Component | undefined;
16
16
  componentProps?: any;
@@ -61,9 +61,9 @@ declare const _default: import("#app").Plugin<{
61
61
  message: (message: string | (() => string | import("vue").Component) | import("vue").Component, data?: import("vue-sonner").ExternalToast) => string | number;
62
62
  promise: <ToastData>(promise: Promise<ToastData> | (() => Promise<ToastData>), data?: ({
63
63
  id?: number | string | undefined;
64
+ icon?: import("vue").Component | undefined;
64
65
  class?: string | undefined;
65
66
  style?: import("vue").CSSProperties | undefined;
66
- icon?: import("vue").Component | undefined;
67
67
  toasterId?: string | undefined;
68
68
  component?: import("vue").Component | undefined;
69
69
  componentProps?: any;
package/dist/types.d.mts CHANGED
@@ -1,3 +1,9 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
1
7
  export { default } from './module.mjs'
2
8
 
3
- export { type Env, type ModuleOptions } from './module.mjs'
9
+ export { type Env } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,71 +0,0 @@
1
- export type PaletteId = string | number;
2
- export type NavigationPaletteInputItem = Readonly<{
3
- id: PaletteId;
4
- title: string;
5
- icon?: string;
6
- route: string;
7
- keywords?: ReadonlyArray<string>;
8
- }>;
9
- export type NavigationPaletteInputGroup = Readonly<{
10
- id: PaletteId;
11
- title: string;
12
- icon?: string;
13
- children: ReadonlyArray<NavigationPaletteInputItem>;
14
- }>;
15
- export type NavigationPaletteInputEntry = NavigationPaletteInputItem | NavigationPaletteInputGroup;
16
- export type NavigationPaletteItem = Readonly<{
17
- id: PaletteId;
18
- title: string;
19
- icon?: string;
20
- route: string;
21
- keywords: Array<string>;
22
- }>;
23
- export type NavigationPaletteGroup = Readonly<{
24
- id: PaletteId;
25
- title: string;
26
- icon?: string;
27
- children: Array<NavigationPaletteItem>;
28
- }>;
29
- export type NavigationPaletteEntry = NavigationPaletteItem | NavigationPaletteGroup;
30
- export type CommandPaletteInputItem = Readonly<{
31
- id: PaletteId;
32
- title: string;
33
- icon?: string;
34
- disabled: boolean;
35
- effect?: string;
36
- keywords?: ReadonlyArray<string>;
37
- }>;
38
- export type CommandPaletteInputGroup = Readonly<{
39
- id: PaletteId;
40
- title: string;
41
- icon?: string;
42
- children: ReadonlyArray<CommandPaletteInputItem>;
43
- }>;
44
- export type CommandPaletteInputEntry = CommandPaletteInputItem | CommandPaletteInputGroup;
45
- export type CommandPaletteItem = Readonly<{
46
- id: PaletteId;
47
- title: string;
48
- icon?: string;
49
- disabled: boolean;
50
- effect?: string;
51
- keywords: Array<string>;
52
- }>;
53
- export type CommandPaletteGroup = Readonly<{
54
- id: PaletteId;
55
- title: string;
56
- icon?: string;
57
- children: Array<CommandPaletteItem>;
58
- }>;
59
- export type CommandPaletteEntry = CommandPaletteItem | CommandPaletteGroup;
60
- export declare const splitNavigationForPalette: (entries: ReadonlyArray<NavigationPaletteInputEntry>) => {
61
- favoriteRoutes: Readonly<{
62
- id: PaletteId;
63
- title: string;
64
- icon?: string;
65
- route: string;
66
- keywords: Array<string>;
67
- }>[];
68
- navigationEntries: NavigationPaletteEntry[];
69
- };
70
- export declare const normalizeCommandsForPalette: (entries: ReadonlyArray<CommandPaletteInputEntry>) => Array<CommandPaletteEntry>;
71
- export declare const createPaletteItemValue: (prefix: "fav" | "nav" | "cmd", itemId: PaletteId, groupId?: PaletteId) => string;
@@ -1,72 +0,0 @@
1
- const normalizeKeywords = (keywords) => {
2
- if (keywords === void 0)
3
- return [];
4
- return [...keywords];
5
- };
6
- const normalizeNavigationItem = (item) => {
7
- return {
8
- id: item.id,
9
- title: item.title,
10
- icon: item.icon,
11
- route: item.route,
12
- keywords: normalizeKeywords(item.keywords)
13
- };
14
- };
15
- export const splitNavigationForPalette = (entries) => {
16
- const favoriteRoutes = [];
17
- const navigationEntries = [];
18
- for (const entry of entries) {
19
- if ("children" in entry) {
20
- const children = entry.children.map((child) => normalizeNavigationItem(child));
21
- if (entry.id === "$favorites") {
22
- favoriteRoutes.push(...children);
23
- continue;
24
- }
25
- navigationEntries.push({
26
- id: entry.id,
27
- title: entry.title,
28
- icon: entry.icon,
29
- children
30
- });
31
- continue;
32
- }
33
- navigationEntries.push(normalizeNavigationItem(entry));
34
- }
35
- return {
36
- favoriteRoutes,
37
- navigationEntries
38
- };
39
- };
40
- const normalizeCommandItem = (item) => {
41
- return {
42
- id: item.id,
43
- title: item.title,
44
- icon: item.icon,
45
- disabled: item.disabled,
46
- effect: item.effect,
47
- keywords: normalizeKeywords(item.keywords)
48
- };
49
- };
50
- export const normalizeCommandsForPalette = (entries) => {
51
- const commandEntries = [];
52
- for (const entry of entries) {
53
- if ("children" in entry) {
54
- commandEntries.push({
55
- id: entry.id,
56
- title: entry.title,
57
- icon: entry.icon,
58
- children: entry.children.map((child) => normalizeCommandItem(child))
59
- });
60
- continue;
61
- }
62
- commandEntries.push(normalizeCommandItem(entry));
63
- }
64
- return commandEntries;
65
- };
66
- export const createPaletteItemValue = (prefix, itemId, groupId) => {
67
- const parts = [prefix];
68
- if (groupId !== void 0)
69
- parts.push(String(groupId));
70
- parts.push(String(itemId));
71
- return parts.join(":");
72
- };
@@ -1,31 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const commandActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
- type: z.ZodLiteral<"route">;
4
- to: z.ZodString;
5
- }, z.core.$strip>, z.ZodObject<{
6
- type: z.ZodLiteral<"external">;
7
- href: z.ZodString;
8
- }, z.core.$strip>, z.ZodObject<{
9
- type: z.ZodLiteral<"logout">;
10
- }, z.core.$strip>, z.ZodObject<{
11
- type: z.ZodLiteral<"request">;
12
- url: z.ZodString;
13
- method: z.ZodOptional<z.ZodEnum<{
14
- GET: "GET";
15
- POST: "POST";
16
- PUT: "PUT";
17
- PATCH: "PATCH";
18
- DELETE: "DELETE";
19
- }>>;
20
- body: z.ZodOptional<z.ZodUnknown>;
21
- query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
23
- }, z.core.$strip>], "type">;
24
- export type CommandAction = z.infer<typeof commandActionSchema>;
25
- export type ExecuteCommandActionOptions = {
26
- logout: () => void;
27
- request: (action: Extract<CommandAction, {
28
- type: 'request';
29
- }>) => Promise<unknown>;
30
- };
31
- export declare const executeCommandAction: (action: CommandAction, options: ExecuteCommandActionOptions) => Promise<void>;
@@ -1,40 +0,0 @@
1
- import { navigateTo } from "#app";
2
- import { z } from "zod";
3
- const requestMethodSchema = z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]);
4
- export const commandActionSchema = z.discriminatedUnion("type", [
5
- z.object({
6
- type: z.literal("route"),
7
- to: z.string()
8
- }),
9
- z.object({
10
- type: z.literal("external"),
11
- href: z.string()
12
- }),
13
- z.object({
14
- type: z.literal("logout")
15
- }),
16
- z.object({
17
- type: z.literal("request"),
18
- url: z.string(),
19
- method: requestMethodSchema.optional(),
20
- body: z.unknown().optional(),
21
- query: z.record(z.string(), z.unknown()).optional(),
22
- headers: z.record(z.string(), z.string()).optional()
23
- })
24
- ]);
25
- export const executeCommandAction = async (action, options) => {
26
- switch (action.type) {
27
- case "route":
28
- navigateTo(action.to);
29
- return;
30
- case "external":
31
- navigateTo(action.href, { external: true });
32
- return;
33
- case "logout":
34
- options.logout();
35
- return;
36
- case "request":
37
- await options.request(action);
38
- return;
39
- }
40
- };
@@ -1,10 +0,0 @@
1
- type NavigationLeaf = Readonly<{
2
- title: string;
3
- route: string;
4
- }>;
5
- type NavigationGroup = Readonly<{
6
- children: Array<NavigationLeaf>;
7
- }>;
8
- type NavigationEntry = NavigationLeaf | NavigationGroup;
9
- export declare function resolveNavigationTitle(entries: Array<NavigationEntry>, path: string): string;
10
- export {};
@@ -1,28 +0,0 @@
1
- import { isRouteActive, normalizeRoutePath } from "./route.js";
2
- export function resolveNavigationTitle(entries, path) {
3
- const normalizedPath = normalizeRoutePath(path);
4
- let bestTitle;
5
- let bestRouteLength = -1;
6
- for (const entry of entries) {
7
- if ("children" in entry) {
8
- for (const child of entry.children) {
9
- const normalizedRoute2 = normalizeRoutePath(child.route);
10
- if (!isRouteActive(normalizedPath, normalizedRoute2))
11
- continue;
12
- if (normalizedRoute2.length <= bestRouteLength)
13
- continue;
14
- bestRouteLength = normalizedRoute2.length;
15
- bestTitle = child.title;
16
- }
17
- continue;
18
- }
19
- const normalizedRoute = normalizeRoutePath(entry.route);
20
- if (!isRouteActive(normalizedPath, normalizedRoute))
21
- continue;
22
- if (normalizedRoute.length <= bestRouteLength)
23
- continue;
24
- bestRouteLength = normalizedRoute.length;
25
- bestTitle = entry.title;
26
- }
27
- return bestTitle ?? normalizedPath;
28
- }
@@ -1,2 +0,0 @@
1
- export declare function normalizeRoutePath(path: string): string;
2
- export declare function isRouteActive(currentPath: string, itemRoute: string): boolean;
@@ -1,14 +0,0 @@
1
- export function normalizeRoutePath(path) {
2
- if (!path)
3
- return "/";
4
- const pathWithoutQueryOrHash = path.split(/[?#]/)[0] ?? "/";
5
- const normalized = pathWithoutQueryOrHash.replace(/\/+$/, "");
6
- return normalized || "/";
7
- }
8
- export function isRouteActive(currentPath, itemRoute) {
9
- const current = normalizeRoutePath(currentPath);
10
- const item = normalizeRoutePath(itemRoute);
11
- if (item === "/")
12
- return current === "/";
13
- return current === item || current.startsWith(`${item}/`);
14
- }
@@ -1,16 +0,0 @@
1
- type RouteItem = Readonly<{
2
- route: string;
3
- }>;
4
- type GroupItem = Readonly<{
5
- children: Array<RouteItem>;
6
- }>;
7
- export type SidebarNavigationItem = RouteItem | GroupItem;
8
- export declare function getDefaultNavigationRoute(items: Array<SidebarNavigationItem>): string | undefined;
9
- export declare function hasRootNavigation(items: Array<SidebarNavigationItem>): boolean;
10
- export declare function applyRootNavigationFallback(options: {
11
- path: string;
12
- items: Array<SidebarNavigationItem>;
13
- tabs: Set<string>;
14
- activateTab: (route: string) => void;
15
- }): void;
16
- export {};
@@ -1,32 +0,0 @@
1
- import { normalizeRoutePath } from "./route.js";
2
- function isRouteItem(item) {
3
- return "route" in item;
4
- }
5
- export function getDefaultNavigationRoute(items) {
6
- for (const item of items) {
7
- if (isRouteItem(item))
8
- return normalizeRoutePath(item.route);
9
- const firstChildRoute = item.children[0]?.route;
10
- if (firstChildRoute)
11
- return normalizeRoutePath(firstChildRoute);
12
- }
13
- return void 0;
14
- }
15
- export function hasRootNavigation(items) {
16
- return items.some((item) => {
17
- if (isRouteItem(item))
18
- return normalizeRoutePath(item.route) === "/";
19
- return item.children.some((child) => normalizeRoutePath(child.route) === "/");
20
- });
21
- }
22
- export function applyRootNavigationFallback(options) {
23
- if (normalizeRoutePath(options.path) !== "/")
24
- return;
25
- if (hasRootNavigation(options.items))
26
- return;
27
- const fallbackRoute = getDefaultNavigationRoute(options.items);
28
- if (!fallbackRoute || fallbackRoute === "/")
29
- return;
30
- options.tabs.delete("/");
31
- options.activateTab(fallbackRoute);
32
- }