@jskit-ai/shell-web 0.2.10 → 0.2.11

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 (69) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/fixtures/adaptive-shell/src/App.vue +2 -0
  3. package/fixtures/adaptive-shell/src/RecordListPage.vue +22 -0
  4. package/fixtures/adaptive-shell/src/RecordPage.vue +30 -0
  5. package/fixtures/adaptive-shell/src/ScreenPage.vue +7 -3
  6. package/fixtures/adaptive-shell/src/SettingsPage.vue +24 -0
  7. package/fixtures/adaptive-shell/src/main.js +60 -55
  8. package/fixtures/adaptive-shell/src/records.js +13 -0
  9. package/fixtures/adaptive-shell/src/theme/index.js +3 -0
  10. package/locales/en.json +1 -0
  11. package/package.json +17 -5
  12. package/patterns/application-shell/PATTERN.md +3 -1
  13. package/patterns/application-shell/example/expected-existing/src/pages/home/index.vue +5 -18
  14. package/patterns/application-shell/example/expected-existing/src/views/NotFound.vue +14 -0
  15. package/patterns/application-shell/example/src/pages/home/index.vue +21 -57
  16. package/patterns/application-shell/example/src/pages/home/settings/general/index.vue +24 -19
  17. package/patterns/application-shell/example/src/pages/home/settings.vue +27 -84
  18. package/patterns/application-shell/example/src/views/NotFound.vue +15 -0
  19. package/patterns/page-and-placement/example/src/components/SyncStatusElement.vue +2 -2
  20. package/patterns/page-and-placement/example/src/pages/home/reports/activity.vue +1 -1
  21. package/patterns/page-and-placement/example/src/pages/home/reports/overview.vue +1 -1
  22. package/patterns/page-and-placement/example/src/pages/home/reports.vue +6 -3
  23. package/patterns/page-and-placement/example/src/placement.js +1 -1
  24. package/src/client/components/ShellErrorHost.vue +13 -15
  25. package/src/client/components/ShellLayout.vue +388 -186
  26. package/src/client/components/ShellListDetail.vue +77 -0
  27. package/src/client/components/ShellMenuLinkItem.vue +10 -24
  28. package/src/client/components/ShellNavigationItem.vue +175 -0
  29. package/src/client/components/ShellNavigationScope.vue +18 -0
  30. package/src/client/components/ShellOutlet.vue +1 -1
  31. package/src/client/components/ShellOutletMenuWidget.vue +2 -2
  32. package/src/client/components/ShellPageAction.vue +91 -0
  33. package/src/client/components/ShellPageActions.vue +32 -0
  34. package/src/client/components/ShellSurfaceAwareMenuLinkItem.vue +10 -24
  35. package/src/client/components/ShellTabLinkItem.vue +77 -3
  36. package/src/client/composables/useShellDrawer.js +28 -18
  37. package/src/client/composables/useShellPageTitle.js +15 -0
  38. package/src/client/composables/useShellRouteTransition.js +1 -1
  39. package/src/client/composables/useShellWindowSizeClass.js +21 -0
  40. package/src/client/error/presentation.js +3 -5
  41. package/src/client/index.js +7 -0
  42. package/src/client/lib/menuIcons.js +21 -65
  43. package/src/client/navigation/documentNavigation.js +38 -0
  44. package/src/client/navigation/shellNavigationRuntime.js +480 -0
  45. package/src/client/navigation/useShellNavigation.js +94 -0
  46. package/src/client/providers/ShellWebClientProvider.js +11 -0
  47. package/src/client/support/drawerPresentation.js +9 -4
  48. package/src/client/support/drawerWidth.js +18 -1
  49. package/src/client/support/navigationPresentation.js +40 -0
  50. package/src/client/support/shellLayoutClass.js +6 -25
  51. package/src/client/support/windowSizeClass.js +29 -0
  52. package/src/test/adaptiveShellSmoke.js +43 -16
  53. package/src/test/shellNavigation.js +32 -0
  54. package/test/adaptiveShell.browser.test.js +207 -111
  55. package/test/clientUpdate.test.js +6 -1
  56. package/test/drawerPresentation.test.js +7 -7
  57. package/test/errorPresentation.test.js +4 -5
  58. package/test/materialBaselines.browser.test.js +96 -0
  59. package/test/menuIcons.test.js +14 -22
  60. package/test/outletMenuWidgetContract.test.js +2 -3
  61. package/test/playwrightContract.test.js +3 -1
  62. package/test/provider.test.js +9 -1
  63. package/test/settingsPlacementContract.test.js +33 -28
  64. package/test/shellGestureSupport.test.js +21 -9
  65. package/test/translation.test.js +2 -2
  66. package/test/useShellDrawer.test.js +20 -5
  67. package/test/useShellRouteTransition.test.js +3 -3
  68. package/patterns/application-shell/example/src/pages/home/settings/index.vue +0 -7
  69. package/src/client/components/ShellNavigationTooltip.vue +0 -39
@@ -1,90 +1,33 @@
1
1
  <script setup>
2
+ import { computed } from "vue";
3
+ import { RouterView, useRoute } from "vue-router";
4
+ import ShellListDetail from "@jskit-ai/shell-web/client/components/ShellListDetail";
2
5
  import ShellOutlet from "@jskit-ai/shell-web/client/components/ShellOutlet";
3
- import { RouterView } from "vue-router";
4
- </script>
5
-
6
- <template>
7
- <section class="settings-shell d-flex flex-column ga-4">
8
- <v-sheet rounded="lg" border class="settings-shell__panel">
9
- <div class="settings-shell__body">
10
- <nav class="settings-shell__nav" aria-label="Home settings sections">
11
- <v-list nav density="compact" rounded="lg">
12
- <ShellOutlet target="home-settings:primary-menu" />
13
- </v-list>
14
- </nav>
15
-
16
- <main class="settings-shell__content">
17
- <RouterView />
18
- </main>
19
- </div>
20
- </v-sheet>
21
- </section>
22
- </template>
23
-
24
- <style scoped>
25
- .settings-shell {
26
- --settings-shell-panel-padding: 1rem;
27
- }
28
-
29
- .settings-shell__panel {
30
- overflow: hidden;
31
- }
32
-
33
- .settings-shell__body {
34
- display: grid;
35
- gap: 1rem;
36
- grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
37
- padding: var(--settings-shell-panel-padding);
38
- }
39
-
40
- .settings-shell__content {
41
- border-left: 1px solid rgba(var(--v-theme-on-surface), 0.18);
42
- min-width: 0;
43
- padding-left: 1rem;
44
- }
45
-
46
- .settings-shell__nav :deep(.v-list) {
47
- padding: 0.35rem;
48
- }
49
-
50
- .settings-shell__nav :deep(.v-list-item) {
51
- min-height: 48px;
52
- padding-inline: 0.6rem 0.7rem;
53
- }
54
6
 
55
- .settings-shell__nav :deep(.v-list-item__prepend) {
56
- margin-inline-end: 0;
57
- }
58
-
59
- .settings-shell__nav :deep(.v-list-item__spacer) {
60
- min-width: 0.5rem;
61
- width: 0.5rem;
62
- }
63
-
64
- .settings-shell__nav :deep(.v-list-item-title) {
65
- line-height: 1.2;
66
- }
67
-
68
- @media (max-width: 960px) {
69
- .settings-shell__body {
70
- grid-template-columns: 1fr;
71
- }
72
-
73
- .settings-shell__nav :deep(.v-list) {
74
- display: flex;
75
- gap: 0.25rem;
76
- overflow-x: auto;
77
- scrollbar-width: thin;
7
+ definePage({
8
+ meta: {
9
+ jskit: {
10
+ title: "Settings"
11
+ }
78
12
  }
13
+ });
79
14
 
80
- .settings-shell__nav :deep(.v-list-item) {
81
- flex: 0 0 auto;
82
- min-height: 48px;
83
- }
15
+ const route = useRoute();
16
+ // The section list shows beside the open section on wide windows, and on its own at /home/settings.
17
+ const detailOpen = computed(() => !/\/settings\/?$/u.test(route.path));
18
+ </script>
84
19
 
85
- .settings-shell__content {
86
- border-left: 0;
87
- padding-left: 0;
88
- }
89
- }
90
- </style>
20
+ <template>
21
+ <ShellListDetail :detail-open="detailOpen">
22
+ <template #list>
23
+ <nav aria-label="Home settings sections">
24
+ <v-list nav>
25
+ <ShellOutlet target="home-settings:primary-menu" />
26
+ </v-list>
27
+ </nav>
28
+ </template>
29
+ <template #detail>
30
+ <RouterView />
31
+ </template>
32
+ </ShellListDetail>
33
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup>
2
+ import ShellLayout from "@/components/ShellLayout.vue";
3
+
4
+ const message = "The page you requested does not exist.";
5
+ </script>
6
+
7
+ <template>
8
+ <!-- The shell's top app bar carries the title, and its navigation leads back into the app. -->
9
+ <ShellLayout title="Not Found" subtitle="">
10
+ <section class="d-flex flex-column align-center text-center on-surface-variant py-16">
11
+ <v-icon icon="$searchOff" size="48" />
12
+ <p class="text-body-large mt-4 mb-0">{{ message }}</p>
13
+ </section>
14
+ </ShellLayout>
15
+ </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="sync-status" role="status" aria-label="Catalogue synchronized">
3
- <v-icon icon="mdi-cloud-check-outline" size="small" aria-hidden="true" />
4
- <span class="text-body-2">Synced</span>
3
+ <v-icon icon="$cloudDone" size="small" aria-hidden="true" />
4
+ <span class="text-body-medium">Synced</span>
5
5
  </div>
6
6
  </template>
7
7
 
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <section>
3
- <p class="text-body-1 text-medium-emphasis mb-0">
3
+ <p class="text-body-large on-surface-variant mb-0">
4
4
  Recent catalogue changes appear here.
5
5
  </p>
6
6
  </section>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <section>
3
- <p class="text-body-1 text-medium-emphasis mb-0">
3
+ <p class="text-body-large on-surface-variant mb-0">
4
4
  Your reading and catalogue summary appears here.
5
5
  </p>
6
6
  </section>
@@ -1,19 +1,22 @@
1
1
  <script setup>
2
2
  import ShellOutlet from "@jskit-ai/shell-web/client/components/ShellOutlet";
3
3
  import { RouterView } from "vue-router";
4
+
5
+ // A main menu destination whose tabs are its own sub-views: the app bar shows its title and no Up arrow.
6
+ definePage({ meta: { jskit: { title: "Reports" } } });
4
7
  </script>
5
8
 
6
9
  <template>
7
10
  <section class="reports-section d-flex flex-column ga-4">
8
11
  <nav aria-label="Report sections">
9
- <v-tabs density="comfortable">
12
+ <v-tabs>
10
13
  <ShellOutlet target="reports:section-nav" />
11
14
  </v-tabs>
12
15
  </nav>
13
16
 
14
- <main class="reports-section__content">
17
+ <div class="reports-section__content">
15
18
  <RouterView />
16
- </main>
19
+ </div>
17
20
  </section>
18
21
  </template>
19
22
 
@@ -11,7 +11,7 @@ addPlacement({
11
11
  order: 120,
12
12
  props: {
13
13
  label: "Reports",
14
- icon: "mdi-chart-box-outline",
14
+ icon: "$assignment",
15
15
  surface: "home",
16
16
  scopedSuffix: "/reports",
17
17
  unscopedSuffix: "/reports"
@@ -44,12 +44,11 @@ const {
44
44
  <v-alert
45
45
  v-for="entry in bannerEntries"
46
46
  :key="entry.id"
47
- :type="resolveSeverityColor(entry.severity)"
47
+ :color="`${resolveSeverityColor(entry.severity)}-container`"
48
48
  :icon="resolveSeverityIcon(entry.severity)"
49
- variant="elevated"
49
+ variant="flat"
50
50
  density="comfortable"
51
- rounded="lg"
52
- border="start"
51
+ :rounded="12"
53
52
  class="shell-error-host__banner"
54
53
  closable
55
54
  :close-label="t('jskit.shell.actions.close')"
@@ -78,7 +77,6 @@ const {
78
77
  location="bottom end"
79
78
  :timeout="resolveTimeout(displayedSnackbarEntry)"
80
79
  :vertical="actionsFor(displayedSnackbarEntry).length > 1"
81
- :color="displayedSnackbarEntry ? resolveSeverityColor(displayedSnackbarEntry.severity) : undefined"
82
80
  @update:model-value="onSnackbarModelValue"
83
81
  @after-leave="onSnackbarAfterLeave"
84
82
  >
@@ -89,19 +87,18 @@ const {
89
87
  v-for="(action, index) in actionsFor(displayedSnackbarEntry)"
90
88
  :key="index"
91
89
  variant="text"
92
- min-height="48"
93
90
  @click="runAction(displayedSnackbarEntry, action)"
94
91
  >
95
92
  {{ text(action.label) }}
96
93
  </v-btn>
97
94
  <v-btn
98
95
  v-if="displayedSnackbarEntry"
96
+ icon="$close"
99
97
  variant="text"
100
- size="small"
98
+ color="inverse-on-surface"
99
+ :aria-label="t('jskit.shell.actions.dismiss')"
101
100
  @click="dismiss(displayedSnackbarEntry)"
102
- >
103
- {{ t("jskit.shell.actions.dismiss") }}
104
- </v-btn>
101
+ />
105
102
  </template>
106
103
  </v-snackbar>
107
104
 
@@ -112,7 +109,7 @@ const {
112
109
  @update:model-value="onDialogModelValue"
113
110
  >
114
111
  <v-card v-if="dialogEntry">
115
- <v-card-title class="text-subtitle-1">{{ t("jskit.shell.error.attentionRequired") }}</v-card-title>
112
+ <v-card-title>{{ t("jskit.shell.error.attentionRequired") }}</v-card-title>
116
113
  <v-card-text>{{ serverMessage(dialogEntry) }}</v-card-text>
117
114
  <v-card-actions>
118
115
  <v-spacer />
@@ -125,8 +122,7 @@ const {
125
122
  {{ text(action.label) }}
126
123
  </v-btn>
127
124
  <v-btn
128
- color="primary"
129
- variant="tonal"
125
+ variant="text"
130
126
  @click="dismiss(dialogEntry)"
131
127
  >
132
128
  {{ t("jskit.shell.actions.close") }}
@@ -165,7 +161,9 @@ const {
165
161
 
166
162
  .shell-error-host__banner {
167
163
  pointer-events: auto;
168
- box-shadow: var(--v-shadow-4);
164
+ box-shadow:
165
+ 0 1px 3px 0 rgba(var(--v-theme-shadow), 0.3),
166
+ 0 4px 8px 3px rgba(var(--v-theme-shadow), 0.15);
169
167
  }
170
168
 
171
169
  /*
@@ -174,7 +172,7 @@ const {
174
172
  * a low-contrast red-on-red mark, in light or dark themes.
175
173
  */
176
174
  .shell-error-host__banner :deep(.v-alert__close .v-btn) {
177
- color: inherit !important;
175
+ color: inherit;
178
176
  opacity: 1;
179
177
  background-color: color-mix(in srgb, currentColor 18%, transparent);
180
178
  }