@shwfed/nuxt 0.11.45 → 0.11.46

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.11.45",
4
+ "version": "0.11.46",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,6 +1,6 @@
1
1
  import { useRoute, useRouter } from "#app";
2
2
  import { useSessionStorage } from "@vueuse/core";
3
- import { computed, toValue, onMounted } from "vue";
3
+ import { computed, toValue, watch } from "vue";
4
4
  export function useNavigationTabs(navigations) {
5
5
  const tabs = useSessionStorage("navigation-tabs", /* @__PURE__ */ new Set(), {
6
6
  writeDefaults: false
@@ -11,11 +11,31 @@ export function useNavigationTabs(navigations) {
11
11
  const clean = (path) => path.replace(/\/$/g, "");
12
12
  const route = useRoute();
13
13
  const router = useRouter();
14
- onMounted(() => {
15
- const path = clean(route.path);
14
+ const matchedRoute = computed(() => {
15
+ const currentPath = clean(route.path);
16
+ for (const group of toValue(navigations)) {
17
+ if ("children" in group) {
18
+ for (const item of group.children) {
19
+ if (clean(item.route) === currentPath) {
20
+ return currentPath;
21
+ }
22
+ }
23
+ } else {
24
+ if (clean(group.route) === currentPath) {
25
+ return currentPath;
26
+ }
27
+ }
28
+ }
29
+ });
30
+ watch(matchedRoute, (path) => {
31
+ if (!path) {
32
+ return;
33
+ }
16
34
  if (!tabs.value.has(path))
17
35
  tabs.value.add(path);
18
36
  active.value = path;
37
+ }, {
38
+ immediate: true
19
39
  });
20
40
  return {
21
41
  tabs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.11.45",
3
+ "version": "0.11.46",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",