@jskit-ai/shell-web 0.2.10 → 0.2.12

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/fixtures/adaptive-shell/src/App.vue +7 -0
  3. package/fixtures/adaptive-shell/src/OwnBarLayout.vue +24 -0
  4. package/fixtures/adaptive-shell/src/RecordListPage.vue +22 -0
  5. package/fixtures/adaptive-shell/src/RecordPage.vue +30 -0
  6. package/fixtures/adaptive-shell/src/ScreenPage.vue +7 -3
  7. package/fixtures/adaptive-shell/src/SettingsPage.vue +24 -0
  8. package/fixtures/adaptive-shell/src/StudioPage.vue +26 -0
  9. package/fixtures/adaptive-shell/src/main.js +64 -55
  10. package/fixtures/adaptive-shell/src/records.js +13 -0
  11. package/fixtures/adaptive-shell/src/theme/index.js +3 -0
  12. package/locales/en.json +1 -0
  13. package/package.json +22 -5
  14. package/patterns/application-shell/PATTERN.md +3 -1
  15. package/patterns/application-shell/example/expected-existing/src/pages/home/index.vue +5 -18
  16. package/patterns/application-shell/example/expected-existing/src/views/NotFound.vue +14 -0
  17. package/patterns/application-shell/example/src/pages/home/index.vue +21 -57
  18. package/patterns/application-shell/example/src/pages/home/settings/general/index.vue +24 -19
  19. package/patterns/application-shell/example/src/pages/home/settings.vue +27 -84
  20. package/patterns/application-shell/example/src/views/NotFound.vue +15 -0
  21. package/patterns/page-and-placement/example/src/components/SyncStatusElement.vue +2 -2
  22. package/patterns/page-and-placement/example/src/pages/home/reports/activity.vue +1 -1
  23. package/patterns/page-and-placement/example/src/pages/home/reports/overview.vue +1 -1
  24. package/patterns/page-and-placement/example/src/pages/home/reports.vue +6 -3
  25. package/patterns/page-and-placement/example/src/placement.js +1 -1
  26. package/src/client/components/ShellErrorHost.vue +13 -15
  27. package/src/client/components/ShellLayout.vue +340 -187
  28. package/src/client/components/ShellListDetail.vue +77 -0
  29. package/src/client/components/ShellMenuLinkItem.vue +10 -24
  30. package/src/client/components/ShellNavigationItem.vue +175 -0
  31. package/src/client/components/ShellNavigationScope.vue +18 -0
  32. package/src/client/components/ShellOutlet.vue +1 -1
  33. package/src/client/components/ShellOutletMenuWidget.vue +2 -2
  34. package/src/client/components/ShellPageAction.vue +91 -0
  35. package/src/client/components/ShellPageActions.vue +32 -0
  36. package/src/client/components/ShellPageActionsTarget.vue +24 -0
  37. package/src/client/components/ShellPageTitle.vue +49 -0
  38. package/src/client/components/ShellSurfaceAwareMenuLinkItem.vue +10 -24
  39. package/src/client/components/ShellTabLinkItem.vue +77 -3
  40. package/src/client/components/ShellUpButton.vue +29 -0
  41. package/src/client/composables/useShellAppBar.js +27 -0
  42. package/src/client/composables/useShellDrawer.js +28 -18
  43. package/src/client/composables/useShellPageTitle.js +15 -0
  44. package/src/client/composables/useShellRouteTransition.js +1 -1
  45. package/src/client/composables/useShellWindowSizeClass.js +21 -0
  46. package/src/client/error/presentation.js +3 -5
  47. package/src/client/index.js +11 -0
  48. package/src/client/lib/menuIcons.js +21 -65
  49. package/src/client/navigation/documentNavigation.js +38 -0
  50. package/src/client/navigation/shellNavigationRuntime.js +480 -0
  51. package/src/client/navigation/useShellNavigation.js +94 -0
  52. package/src/client/providers/ShellWebClientProvider.js +11 -0
  53. package/src/client/support/drawerPresentation.js +9 -4
  54. package/src/client/support/drawerWidth.js +18 -1
  55. package/src/client/support/navigationPresentation.js +40 -0
  56. package/src/client/support/shellLayoutClass.js +6 -25
  57. package/src/client/support/windowSizeClass.js +29 -0
  58. package/src/test/adaptiveShellSmoke.js +43 -16
  59. package/src/test/shellNavigation.js +32 -0
  60. package/test/adaptiveShell.browser.test.js +251 -111
  61. package/test/clientUpdate.test.js +6 -1
  62. package/test/drawerPresentation.test.js +7 -7
  63. package/test/errorPresentation.test.js +4 -5
  64. package/test/materialBaselines.browser.test.js +96 -0
  65. package/test/menuIcons.test.js +14 -22
  66. package/test/outletMenuWidgetContract.test.js +2 -3
  67. package/test/playwrightContract.test.js +3 -1
  68. package/test/provider.test.js +9 -1
  69. package/test/settingsPlacementContract.test.js +49 -28
  70. package/test/shellGestureSupport.test.js +21 -9
  71. package/test/translation.test.js +2 -2
  72. package/test/useShellDrawer.test.js +20 -5
  73. package/test/useShellRouteTransition.test.js +3 -3
  74. package/patterns/application-shell/example/src/pages/home/settings/index.vue +0 -7
  75. package/src/client/components/ShellNavigationTooltip.vue +0 -39
@@ -0,0 +1,77 @@
1
+ <script setup>
2
+ import { computed, onBeforeUnmount, watch } from "vue";
3
+ import { useShellWindowSizeClass } from "../composables/useShellWindowSizeClass.js";
4
+ import { useShellNavigationRuntime } from "../navigation/useShellNavigation.js";
5
+
6
+ // Material 3's list-detail layout. Expanded and large windows show the list pane beside the detail pane, so the
7
+ // detail page needs no Up arrow to reach the list, and with nothing open the detail pane shows the page's own landing
8
+ // child (a placeholder) if it has one. Compact and medium windows show one pane at a time, the detail (with its arrow
9
+ // back to the list) while one is open. The detail page declares the list page as its parent.
10
+ const props = defineProps({
11
+ // Whether a detail page is open, such as `route.name !== "settings"`.
12
+ detailOpen: {
13
+ type: Boolean,
14
+ default: false
15
+ }
16
+ });
17
+
18
+ const runtime = useShellNavigationRuntime();
19
+ const { isExpanded, isLarge } = useShellWindowSizeClass();
20
+ const twoPane = computed(() => isExpanded.value || isLarge.value);
21
+ let releaseParentPane = null;
22
+
23
+ function releasePane() {
24
+ releaseParentPane?.();
25
+ releaseParentPane = null;
26
+ }
27
+
28
+ watch(
29
+ () => twoPane.value && props.detailOpen,
30
+ (parentVisible) => {
31
+ if (parentVisible && !releaseParentPane) {
32
+ releaseParentPane = runtime.showParentPane();
33
+ } else if (!parentVisible) {
34
+ releasePane();
35
+ }
36
+ },
37
+ { immediate: true }
38
+ );
39
+
40
+ onBeforeUnmount(releasePane);
41
+ </script>
42
+
43
+ <template>
44
+ <div
45
+ class="shell-list-detail"
46
+ :class="{ 'shell-list-detail--two-pane': twoPane }"
47
+ data-testid="jskit-shell-list-detail"
48
+ >
49
+ <section v-show="twoPane || !props.detailOpen" class="shell-list-detail__list">
50
+ <slot name="list" />
51
+ </section>
52
+ <section v-if="twoPane || props.detailOpen" class="shell-list-detail__detail">
53
+ <slot name="detail" />
54
+ </section>
55
+ </div>
56
+ </template>
57
+
58
+ <style scoped>
59
+ .shell-list-detail {
60
+ display: grid;
61
+ gap: 24px;
62
+ grid-template-columns: minmax(0, 1fr);
63
+ }
64
+
65
+ .shell-list-detail--two-pane {
66
+ grid-template-columns: 360px minmax(0, 1fr);
67
+ }
68
+
69
+ .shell-list-detail__list,
70
+ .shell-list-detail__detail {
71
+ min-width: 0;
72
+ }
73
+
74
+ .shell-list-detail:not(.shell-list-detail--two-pane) .shell-list-detail__list {
75
+ max-width: 840px;
76
+ }
77
+ </style>
@@ -3,8 +3,7 @@ import { computed } from "vue";
3
3
  import { useWebPlacementContext } from "../placement/index.js";
4
4
  import { resolveMenuLinkIcon } from "../lib/menuIcons.js";
5
5
  import { resolveMenuLinkHref } from "../support/menuLinkTarget.js";
6
- import { activateShellNavigationLinkOnSpace } from "../support/navigationLinkKeyboard.js";
7
- import ShellNavigationTooltip from "./ShellNavigationTooltip.vue";
6
+ import ShellNavigationItem from "./ShellNavigationItem.vue";
8
7
  import { useJskitText } from "../i18n.js";
9
8
 
10
9
  // The label may be a message key, { key, fallback } or plain text.
@@ -48,26 +47,13 @@ const resolvedIcon = computed(() =>
48
47
  </script>
49
48
 
50
49
  <template>
51
- <ShellNavigationTooltip v-if="resolvedTarget.href" :label="resolvedLabel">
52
- <template #default="{ activatorProps }">
53
- <v-list-item
54
- v-bind="activatorProps"
55
- class="shell-menu-link-item"
56
- :title="resolvedLabel"
57
- :to="resolvedTarget.sameOrigin ? resolvedTarget.href : undefined"
58
- :href="resolvedTarget.sameOrigin ? undefined : resolvedTarget.href"
59
- :prepend-icon="resolvedIcon || undefined"
60
- :disabled="props.disabled"
61
- :exact="props.exact"
62
- :aria-label="resolvedLabel"
63
- @keydown.space="activateShellNavigationLinkOnSpace"
64
- />
65
- </template>
66
- </ShellNavigationTooltip>
50
+ <ShellNavigationItem
51
+ v-if="resolvedTarget.href"
52
+ :label="resolvedLabel"
53
+ :href="resolvedTarget.href"
54
+ :same-origin="resolvedTarget.sameOrigin"
55
+ :icon="resolvedIcon"
56
+ :disabled="props.disabled"
57
+ :exact="props.exact"
58
+ />
67
59
  </template>
68
-
69
- <style scoped>
70
- .shell-menu-link-item {
71
- min-height: 48px;
72
- }
73
- </style>
@@ -0,0 +1,175 @@
1
+ <script setup>
2
+ import { computed, inject } from "vue";
3
+ import { useLink } from "vue-router";
4
+ import {
5
+ NO_SHELL_NAVIGATION_PRESENTATION,
6
+ NO_VUETIFY_ICONS,
7
+ SHELL_NAVIGATION_PRESENTATION_KEY,
8
+ VUETIFY_ICONS_KEY,
9
+ filledIconAlias
10
+ } from "../support/navigationPresentation.js";
11
+ import { activateShellNavigationLinkOnSpace } from "../support/navigationLinkKeyboard.js";
12
+
13
+ // One navigation destination as Material 3 draws it where it sits: a drawer item (a 56dp pill), a rail item (icon in a
14
+ // 56x32 indicator with its label below) or a list item. The active destination's icon is filled.
15
+ const props = defineProps({
16
+ label: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ href: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ sameOrigin: {
25
+ type: Boolean,
26
+ default: true
27
+ },
28
+ icon: {
29
+ type: String,
30
+ default: ""
31
+ },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ exact: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ });
41
+
42
+ /** @type {{ value: string }} */
43
+ const presentation = inject(SHELL_NAVIGATION_PRESENTATION_KEY, NO_SHELL_NAVIGATION_PRESENTATION);
44
+ /** @type {{ aliases?: Record<string, unknown> }} */
45
+ const iconOptions = inject(VUETIFY_ICONS_KEY, NO_VUETIFY_ICONS);
46
+ const link = useLink({ to: computed(() => (props.sameOrigin && props.href) || "/") });
47
+ const active = computed(() =>
48
+ props.sameOrigin && Boolean(props.exact ? link.isExactActive.value : link.isActive.value)
49
+ );
50
+ const displayIcon = computed(() => (active.value ? filledIconAlias(props.icon, iconOptions.aliases) : props.icon));
51
+ const rail = computed(() => presentation.value === "rail");
52
+ </script>
53
+
54
+ <template>
55
+ <v-list-item
56
+ v-if="rail"
57
+ class="shell-menu-link-item shell-menu-link-item--rail"
58
+ :to="props.sameOrigin ? props.href : undefined"
59
+ :href="props.sameOrigin ? undefined : props.href"
60
+ :active="active"
61
+ :disabled="props.disabled"
62
+ :ripple="false"
63
+ @keydown.space="activateShellNavigationLinkOnSpace"
64
+ >
65
+ <span class="shell-menu-link-item__indicator">
66
+ <v-icon v-if="displayIcon" :icon="displayIcon" />
67
+ </span>
68
+ <span class="shell-menu-link-item__rail-label">{{ props.label }}</span>
69
+ </v-list-item>
70
+ <v-list-item
71
+ v-else
72
+ class="shell-menu-link-item"
73
+ :title="props.label"
74
+ :to="props.sameOrigin ? props.href : undefined"
75
+ :href="props.sameOrigin ? undefined : props.href"
76
+ :prepend-icon="displayIcon || undefined"
77
+ :active="active"
78
+ :disabled="props.disabled"
79
+ @keydown.space="activateShellNavigationLinkOnSpace"
80
+ />
81
+ </template>
82
+
83
+ <style scoped>
84
+ .shell-menu-link-item {
85
+ --v-activated-opacity: 0;
86
+ border-radius: 9999px;
87
+ color: rgb(var(--v-theme-on-surface-variant));
88
+ min-height: 56px;
89
+ }
90
+
91
+ .shell-menu-link-item :deep(.v-list-item-title) {
92
+ font-size: 0.875rem;
93
+ font-weight: 500;
94
+ letter-spacing: 0.00625rem;
95
+ line-height: 1.25rem;
96
+ }
97
+
98
+ .shell-menu-link-item:not(.shell-menu-link-item--rail).v-list-item--active {
99
+ background: rgb(var(--v-theme-secondary-container));
100
+ color: rgb(var(--v-theme-on-secondary-container));
101
+ }
102
+
103
+ .shell-menu-link-item :deep(.v-list-item__prepend > .v-icon) {
104
+ opacity: 1;
105
+ }
106
+
107
+ .shell-menu-link-item--rail {
108
+ background: transparent;
109
+ border-radius: 0;
110
+ min-height: 56px;
111
+ padding: 0;
112
+ }
113
+
114
+ .shell-menu-link-item--rail > :deep(.v-list-item__overlay) {
115
+ display: none;
116
+ }
117
+
118
+ .shell-menu-link-item--rail :deep(.v-list-item__content) {
119
+ align-items: center;
120
+ display: flex;
121
+ flex-direction: column;
122
+ gap: 4px;
123
+ overflow: visible;
124
+ }
125
+
126
+ .shell-menu-link-item__indicator {
127
+ align-items: center;
128
+ border-radius: 16px;
129
+ display: flex;
130
+ height: 32px;
131
+ justify-content: center;
132
+ overflow: hidden;
133
+ position: relative;
134
+ width: 56px;
135
+ }
136
+
137
+ .shell-menu-link-item__indicator::before {
138
+ background: currentColor;
139
+ content: "";
140
+ inset: 0;
141
+ opacity: 0;
142
+ position: absolute;
143
+ transition: opacity 200ms cubic-bezier(0.2, 0, 0, 1);
144
+ }
145
+
146
+ .shell-menu-link-item--rail:hover .shell-menu-link-item__indicator::before {
147
+ opacity: var(--v-hover-opacity);
148
+ }
149
+
150
+ .shell-menu-link-item--rail:focus-visible .shell-menu-link-item__indicator::before,
151
+ .shell-menu-link-item--rail:active .shell-menu-link-item__indicator::before {
152
+ opacity: var(--v-focus-opacity);
153
+ }
154
+
155
+ .shell-menu-link-item--rail.v-list-item--active .shell-menu-link-item__indicator {
156
+ background: rgb(var(--v-theme-secondary-container));
157
+ color: rgb(var(--v-theme-on-secondary-container));
158
+ }
159
+
160
+ .shell-menu-link-item__rail-label {
161
+ font-size: 0.75rem;
162
+ font-weight: 500;
163
+ letter-spacing: 0.03125rem;
164
+ line-height: 1rem;
165
+ max-width: 72px;
166
+ overflow: hidden;
167
+ text-align: center;
168
+ text-overflow: ellipsis;
169
+ white-space: nowrap;
170
+ }
171
+
172
+ .shell-menu-link-item--rail.v-list-item--active .shell-menu-link-item__rail-label {
173
+ color: rgb(var(--v-theme-on-surface));
174
+ }
175
+ </style>
@@ -0,0 +1,18 @@
1
+ <script setup>
2
+ import { provide, toRef } from "vue";
3
+ import { SHELL_NAVIGATION_PRESENTATION_KEY } from "../support/navigationPresentation.js";
4
+
5
+ // Tells the navigation items inside it how to present: as a "rail" or a "drawer".
6
+ const props = defineProps({
7
+ presentation: {
8
+ type: String,
9
+ default: "drawer"
10
+ }
11
+ });
12
+
13
+ provide(SHELL_NAVIGATION_PRESENTATION_KEY, toRef(props, "presentation"));
14
+ </script>
15
+
16
+ <template>
17
+ <slot />
18
+ </template>
@@ -74,7 +74,7 @@ const resolvedTargetId = computed(() => {
74
74
  return String(props.target || "").trim();
75
75
  });
76
76
 
77
- const resolvedLayoutClass = computed(() => resolveShellLayoutClass(display.name.value));
77
+ const resolvedLayoutClass = computed(() => resolveShellLayoutClass(display.width.value));
78
78
 
79
79
  const placements = computed(() => {
80
80
  void revision.value;
@@ -1,5 +1,4 @@
1
1
  <script setup>
2
- import { mdiCogOutline } from "@mdi/js";
3
2
  import ShellOutlet from "./ShellOutlet.vue";
4
3
  import { useJskitText } from "../i18n.js";
5
4
 
@@ -12,7 +11,7 @@ const props = defineProps({
12
11
  },
13
12
  icon: {
14
13
  type: String,
15
- default: mdiCogOutline
14
+ default: "$settings"
16
15
  },
17
16
  // Defaults to the translated "Tools"; a passed label may be a message key.
18
17
  ariaLabel: {
@@ -41,6 +40,7 @@ const props = defineProps({
41
40
  v-bind="activatorProps"
42
41
  icon
43
42
  variant="text"
43
+ color="on-surface-variant"
44
44
  :aria-label="props.ariaLabel === undefined ? t('jskit.shell.layout.tools') : text(props.ariaLabel)"
45
45
  >
46
46
  <v-icon :icon="props.icon" />
@@ -0,0 +1,91 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useShellWindowSizeClass } from "../composables/useShellWindowSizeClass.js";
4
+ import { useJskitText } from "../i18n.js";
5
+
6
+ // One page action in the top app bar. On compact windows a secondary action shows as an icon button named by its
7
+ // label; the page's primary action (`primary`, at most one) keeps its label as a filled button. Native button
8
+ // attributes such as `type="submit"` and `form` pass through, so an app bar Save can submit the page's form.
9
+ const props = defineProps({
10
+ // A message key, { key, fallback } or plain text.
11
+ label: {
12
+ type: [String, Object],
13
+ required: true
14
+ },
15
+ icon: {
16
+ type: String,
17
+ default: ""
18
+ },
19
+ to: {
20
+ type: [String, Object],
21
+ default: undefined
22
+ },
23
+ // A link outside the app (another origin); `to` is for the app's own pages.
24
+ href: {
25
+ type: String,
26
+ default: undefined
27
+ },
28
+ primary: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ loading: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ });
41
+ const emit = defineEmits(["click"]);
42
+
43
+ const { text } = useJskitText();
44
+ const { isCompact } = useShellWindowSizeClass();
45
+ const resolvedLabel = computed(() => text(props.label));
46
+ const iconOnly = computed(() => Boolean(props.icon) && isCompact.value && !props.primary);
47
+
48
+ function handleClick(event) {
49
+ emit("click", event);
50
+ }
51
+ </script>
52
+
53
+ <template>
54
+ <v-tooltip v-if="iconOnly" :text="resolvedLabel" location="bottom">
55
+ <template #activator="{ props: tooltipProps }">
56
+ <v-btn
57
+ v-bind="tooltipProps"
58
+ class="shell-page-action"
59
+ :icon="props.icon"
60
+ variant="text"
61
+ color="on-surface-variant"
62
+ :to="props.to"
63
+ :href="props.href"
64
+ :disabled="props.disabled"
65
+ :loading="props.loading"
66
+ :aria-label="resolvedLabel"
67
+ @click="handleClick"
68
+ />
69
+ </template>
70
+ </v-tooltip>
71
+ <v-btn
72
+ v-else
73
+ class="shell-page-action shell-page-action--labelled"
74
+ :variant="props.primary ? 'flat' : 'text'"
75
+ :color="props.primary ? 'primary' : 'on-surface-variant'"
76
+ :prepend-icon="props.icon || undefined"
77
+ :to="props.to"
78
+ :href="props.href"
79
+ :disabled="props.disabled"
80
+ :loading="props.loading"
81
+ @click="handleClick"
82
+ >
83
+ {{ resolvedLabel }}
84
+ </v-btn>
85
+ </template>
86
+
87
+ <style scoped>
88
+ .shell-page-action--labelled {
89
+ margin-inline: 4px;
90
+ }
91
+ </style>
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import { inject } from "vue";
3
+ import {
4
+ NO_SHELL_PAGE_ACTIONS_TARGET,
5
+ SHELL_PAGE_ACTIONS_TARGET_KEY
6
+ } from "../support/navigationPresentation.js";
7
+
8
+ /**
9
+ * The app bar's actions target. The current page's actions show in the shell's top app bar after the page title
10
+ * (Material 3 puts a page's actions there); put ShellPageAction buttons inside. Outside a layout that owns the top
11
+ * app bar (ShellLayout, or one that calls useShellAppBar()) they render where they are written.
12
+ * @type {string}
13
+ */
14
+ const target = inject(SHELL_PAGE_ACTIONS_TARGET_KEY, NO_SHELL_PAGE_ACTIONS_TARGET);
15
+ </script>
16
+
17
+ <template>
18
+ <Teleport defer :to="target || 'body'" :disabled="!target">
19
+ <div class="shell-page-actions" data-testid="jskit-shell-page-actions">
20
+ <slot />
21
+ </div>
22
+ </Teleport>
23
+ </template>
24
+
25
+ <style scoped>
26
+ .shell-page-actions {
27
+ align-items: center;
28
+ display: flex;
29
+ flex: 0 0 auto;
30
+ gap: 0;
31
+ }
32
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { SHELL_PAGE_ACTIONS_ID } from "../support/navigationPresentation.js";
3
+
4
+ // Where the current page's ShellPageActions show: after the page title in the top app bar. ShellLayout's bar has it;
5
+ // a layout that draws its own top app bar renders it once there and calls useShellAppBar().
6
+ </script>
7
+
8
+ <template>
9
+ <div :id="SHELL_PAGE_ACTIONS_ID" class="shell-page-actions-target" />
10
+ </template>
11
+
12
+ <style scoped>
13
+ .shell-page-actions-target {
14
+ align-items: center;
15
+ color: rgb(var(--v-theme-on-surface-variant));
16
+ display: flex;
17
+ flex: 0 0 auto;
18
+ min-width: 0;
19
+ }
20
+
21
+ .shell-page-actions-target:empty {
22
+ display: none;
23
+ }
24
+ </style>
@@ -0,0 +1,49 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useRoute } from "vue-router";
4
+ import { useJskitText } from "../i18n.js";
5
+ import { PAGE_TITLE_ID, resolvePageTitle } from "../navigation/shellNavigationRuntime.js";
6
+ import { useShellNavigationRuntime } from "../navigation/useShellNavigation.js";
7
+
8
+ // The page's one h1, in the top app bar: the title the page sets (useShellPageTitle), else its route's
9
+ // meta.jskit.title, else `title`. The shell moves focus here after navigation. ShellLayout's bar shows it; a layout
10
+ // that draws its own top app bar renders it once in that bar.
11
+ const props = defineProps({
12
+ // The title of pages that declare none and set none. A message key or plain text.
13
+ title: {
14
+ type: String,
15
+ default: ""
16
+ }
17
+ });
18
+
19
+ const { text } = useJskitText();
20
+ const route = useRoute();
21
+ const navigationRuntime = useShellNavigationRuntime();
22
+ const pageTitle = computed(() => {
23
+ const source = navigationRuntime.pageTitleSource.value;
24
+ const runtimeTitle = typeof source === "function" ? source() : "";
25
+ return text(runtimeTitle) || text(resolvePageTitle(route.matched)) || text(props.title);
26
+ });
27
+ </script>
28
+
29
+ <template>
30
+ <h1 :id="PAGE_TITLE_ID" class="shell-page-title" tabindex="-1" data-testid="jskit-shell-page-title">
31
+ {{ pageTitle }}
32
+ </h1>
33
+ </template>
34
+
35
+ <style scoped>
36
+ /* Material 3 small top app bar headline: title-large. */
37
+ .shell-page-title {
38
+ color: rgb(var(--v-theme-on-surface));
39
+ font-size: 1.375rem;
40
+ font-weight: 400;
41
+ letter-spacing: 0;
42
+ line-height: 1.75rem;
43
+ margin: 0;
44
+ outline: none;
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ white-space: nowrap;
48
+ }
49
+ </style>
@@ -3,34 +3,20 @@ import {
3
3
  shellNavigationLinkProps,
4
4
  useShellNavigationLink
5
5
  } from "../composables/useShellNavigationLink.js";
6
- import { activateShellNavigationLinkOnSpace } from "../support/navigationLinkKeyboard.js";
7
- import ShellNavigationTooltip from "./ShellNavigationTooltip.vue";
6
+ import ShellNavigationItem from "./ShellNavigationItem.vue";
8
7
 
9
8
  const props = defineProps(shellNavigationLinkProps);
10
9
  const { resolvedLabel, resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
11
10
  </script>
12
11
 
13
12
  <template>
14
- <ShellNavigationTooltip v-if="resolvedTarget.href" :label="resolvedLabel">
15
- <template #default="{ activatorProps }">
16
- <v-list-item
17
- v-bind="activatorProps"
18
- class="shell-menu-link-item"
19
- :title="resolvedLabel"
20
- :to="resolvedTarget.sameOrigin ? resolvedTarget.href : undefined"
21
- :href="resolvedTarget.sameOrigin ? undefined : resolvedTarget.href"
22
- :prepend-icon="resolvedIcon || undefined"
23
- :disabled="props.disabled"
24
- :exact="props.exact"
25
- :aria-label="resolvedLabel"
26
- @keydown.space="activateShellNavigationLinkOnSpace"
27
- />
28
- </template>
29
- </ShellNavigationTooltip>
13
+ <ShellNavigationItem
14
+ v-if="resolvedTarget.href"
15
+ :label="resolvedLabel"
16
+ :href="resolvedTarget.href"
17
+ :same-origin="resolvedTarget.sameOrigin"
18
+ :icon="resolvedIcon"
19
+ :disabled="props.disabled"
20
+ :exact="props.exact"
21
+ />
30
22
  </template>
31
-
32
- <style scoped>
33
- .shell-menu-link-item {
34
- min-height: 48px;
35
- }
36
- </style>