@jskit-ai/shell-web 0.1.56 → 0.1.57

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,7 +1,7 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/shell-web",
4
- version: "0.1.56",
4
+ version: "0.1.57",
5
5
  kind: "runtime",
6
6
  description: "Web shell layout runtime with outlet-based placement contributions.",
7
7
  dependsOn: [],
@@ -122,7 +122,7 @@ export default Object.freeze({
122
122
  runtime: {
123
123
  "@mdi/js": "^7.4.47",
124
124
  "@tanstack/vue-query": "^5.90.5",
125
- "@jskit-ai/kernel": "0.1.57",
125
+ "@jskit-ai/kernel": "0.1.58",
126
126
  "vuetify": "^4.0.0"
127
127
  },
128
128
  dev: {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/shell-web",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@mdi/js": "^7.4.47",
27
27
  "@tanstack/vue-query": "^5.90.5",
28
- "@jskit-ai/kernel": "0.1.57",
28
+ "@jskit-ai/kernel": "0.1.58",
29
29
  "pinia": "^3.0.4",
30
30
  "vuetify": "^4.0.0"
31
31
  },
@@ -7,10 +7,8 @@ import {
7
7
  resolveSurfaceNavigationTargetFromPlacementContext,
8
8
  useWebPlacementContext
9
9
  } from "../placement/index.js";
10
- import {
11
- normalizeMenuLinkPathname,
12
- resolveMenuLinkTarget
13
- } from "../support/menuLinkTarget.js";
10
+ import { resolveMenuLinkIcon } from "../lib/menuIcons.js";
11
+ import { resolveMenuLinkTarget } from "../support/menuLinkTarget.js";
14
12
 
15
13
  const props = defineProps({
16
14
  label: {
@@ -21,6 +19,10 @@ const props = defineProps({
21
19
  type: String,
22
20
  default: ""
23
21
  },
22
+ icon: {
23
+ type: String,
24
+ default: ""
25
+ },
24
26
  surface: {
25
27
  type: String,
26
28
  default: ""
@@ -88,41 +90,30 @@ const resolvedTarget = computed(() => {
88
90
  };
89
91
  });
90
92
 
91
- const isActive = computed(() => {
92
- if (!resolvedTarget.value.sameOrigin) {
93
- return false;
94
- }
95
-
96
- const targetPath = normalizeMenuLinkPathname(resolvedTarget.value.href);
97
- const currentPath = normalizeMenuLinkPathname(route.fullPath || route.path || "");
98
- if (!targetPath || !currentPath) {
99
- return false;
100
- }
93
+ const resolvedIcon = computed(() =>
94
+ resolveMenuLinkIcon({
95
+ icon: props.icon,
96
+ label: props.label,
97
+ to: resolvedTarget.value.href || resolvedTo.value
98
+ })
99
+ );
101
100
 
102
- return currentPath === targetPath || currentPath.startsWith(`${targetPath}/`);
103
- });
104
101
  </script>
105
102
 
106
103
  <template>
107
- <v-btn
104
+ <v-list-item
108
105
  v-if="resolvedTarget.href"
109
106
  class="tab-link-item"
110
- variant="text"
111
- size="small"
112
107
  :to="resolvedTarget.sameOrigin ? resolvedTarget.href : undefined"
113
108
  :href="resolvedTarget.sameOrigin ? undefined : resolvedTarget.href"
114
- :active="isActive"
109
+ :prepend-icon="resolvedIcon || undefined"
115
110
  :disabled="disabled"
116
- color="primary"
117
- >
118
- {{ label || "Tab" }}
119
- </v-btn>
111
+ :title="label || 'Tab'"
112
+ />
120
113
  </template>
121
114
 
122
115
  <style scoped>
123
116
  .tab-link-item {
124
- text-transform: none;
125
- font-weight: 600;
126
- border-radius: 999px;
117
+ flex: 0 0 auto;
127
118
  }
128
119
  </style>
@@ -10,6 +10,10 @@ const props = defineProps({
10
10
  type: String,
11
11
  default: ""
12
12
  },
13
+ icon: {
14
+ type: String,
15
+ default: ""
16
+ },
13
17
  surface: {
14
18
  type: String,
15
19
  default: ""
@@ -71,6 +71,7 @@ test("shell-web scaffolds app-owned local link-item wrappers under src/component
71
71
  assert.match(tabWrapperSource, /@jskit-ai\/shell-web\/client\/components\/ShellTabLinkItem/);
72
72
  assert.match(menuWrapperSource, /exact:\s*\{/);
73
73
  assert.match(surfaceAwareWrapperSource, /exact:\s*\{/);
74
+ assert.match(tabWrapperSource, /icon:\s*\{/);
74
75
 
75
76
  assert.deepEqual(findFileMutation("shell-web-component-menu-link-item"), {
76
77
  from: "templates/src/components/menus/MenuLinkItem.vue",
@@ -129,7 +130,7 @@ test("shell-web scaffolds app-owned local link-item wrappers under src/component
129
130
  assert.equal(await readLocalLinkItemComponentSource("local.main.ui.tab-link-item"), tabWrapperSource);
130
131
  });
131
132
 
132
- test("shell-web generic menu link items support exact route matching", async () => {
133
+ test("shell-web generic link items support the expected shared route and icon behavior", async () => {
133
134
  const shellMenuSource = await readFile(
134
135
  path.join(PACKAGE_DIR, "src", "client", "components", "ShellMenuLinkItem.vue"),
135
136
  "utf8"
@@ -138,11 +139,19 @@ test("shell-web generic menu link items support exact route matching", async ()
138
139
  path.join(PACKAGE_DIR, "src", "client", "components", "ShellSurfaceAwareMenuLinkItem.vue"),
139
140
  "utf8"
140
141
  );
142
+ const shellTabSource = await readFile(
143
+ path.join(PACKAGE_DIR, "src", "client", "components", "ShellTabLinkItem.vue"),
144
+ "utf8"
145
+ );
141
146
 
142
147
  assert.match(shellMenuSource, /exact:\s*\{/);
143
148
  assert.match(shellMenuSource, /:exact="props\.exact"/);
144
149
  assert.match(shellSurfaceAwareSource, /exact:\s*\{/);
145
150
  assert.match(shellSurfaceAwareSource, /:exact="props\.exact"/);
151
+ assert.match(shellTabSource, /icon:\s*\{/);
152
+ assert.match(shellTabSource, /resolveMenuLinkIcon/);
153
+ assert.match(shellTabSource, /<v-list-item/);
154
+ assert.match(shellTabSource, /:prepend-icon="resolvedIcon \|\| undefined"/);
146
155
  });
147
156
 
148
157
  test("shell-web binds the local link-item wrapper tokens into MainClientProvider", () => {