@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.
- package/CHANGELOG.md +10 -0
- package/fixtures/adaptive-shell/src/App.vue +7 -0
- package/fixtures/adaptive-shell/src/OwnBarLayout.vue +24 -0
- package/fixtures/adaptive-shell/src/RecordListPage.vue +22 -0
- package/fixtures/adaptive-shell/src/RecordPage.vue +30 -0
- package/fixtures/adaptive-shell/src/ScreenPage.vue +7 -3
- package/fixtures/adaptive-shell/src/SettingsPage.vue +24 -0
- package/fixtures/adaptive-shell/src/StudioPage.vue +26 -0
- package/fixtures/adaptive-shell/src/main.js +64 -55
- package/fixtures/adaptive-shell/src/records.js +13 -0
- package/fixtures/adaptive-shell/src/theme/index.js +3 -0
- package/locales/en.json +1 -0
- package/package.json +22 -5
- package/patterns/application-shell/PATTERN.md +3 -1
- package/patterns/application-shell/example/expected-existing/src/pages/home/index.vue +5 -18
- package/patterns/application-shell/example/expected-existing/src/views/NotFound.vue +14 -0
- package/patterns/application-shell/example/src/pages/home/index.vue +21 -57
- package/patterns/application-shell/example/src/pages/home/settings/general/index.vue +24 -19
- package/patterns/application-shell/example/src/pages/home/settings.vue +27 -84
- package/patterns/application-shell/example/src/views/NotFound.vue +15 -0
- package/patterns/page-and-placement/example/src/components/SyncStatusElement.vue +2 -2
- package/patterns/page-and-placement/example/src/pages/home/reports/activity.vue +1 -1
- package/patterns/page-and-placement/example/src/pages/home/reports/overview.vue +1 -1
- package/patterns/page-and-placement/example/src/pages/home/reports.vue +6 -3
- package/patterns/page-and-placement/example/src/placement.js +1 -1
- package/src/client/components/ShellErrorHost.vue +13 -15
- package/src/client/components/ShellLayout.vue +340 -187
- package/src/client/components/ShellListDetail.vue +77 -0
- package/src/client/components/ShellMenuLinkItem.vue +10 -24
- package/src/client/components/ShellNavigationItem.vue +175 -0
- package/src/client/components/ShellNavigationScope.vue +18 -0
- package/src/client/components/ShellOutlet.vue +1 -1
- package/src/client/components/ShellOutletMenuWidget.vue +2 -2
- package/src/client/components/ShellPageAction.vue +91 -0
- package/src/client/components/ShellPageActions.vue +32 -0
- package/src/client/components/ShellPageActionsTarget.vue +24 -0
- package/src/client/components/ShellPageTitle.vue +49 -0
- package/src/client/components/ShellSurfaceAwareMenuLinkItem.vue +10 -24
- package/src/client/components/ShellTabLinkItem.vue +77 -3
- package/src/client/components/ShellUpButton.vue +29 -0
- package/src/client/composables/useShellAppBar.js +27 -0
- package/src/client/composables/useShellDrawer.js +28 -18
- package/src/client/composables/useShellPageTitle.js +15 -0
- package/src/client/composables/useShellRouteTransition.js +1 -1
- package/src/client/composables/useShellWindowSizeClass.js +21 -0
- package/src/client/error/presentation.js +3 -5
- package/src/client/index.js +11 -0
- package/src/client/lib/menuIcons.js +21 -65
- package/src/client/navigation/documentNavigation.js +38 -0
- package/src/client/navigation/shellNavigationRuntime.js +480 -0
- package/src/client/navigation/useShellNavigation.js +94 -0
- package/src/client/providers/ShellWebClientProvider.js +11 -0
- package/src/client/support/drawerPresentation.js +9 -4
- package/src/client/support/drawerWidth.js +18 -1
- package/src/client/support/navigationPresentation.js +40 -0
- package/src/client/support/shellLayoutClass.js +6 -25
- package/src/client/support/windowSizeClass.js +29 -0
- package/src/test/adaptiveShellSmoke.js +43 -16
- package/src/test/shellNavigation.js +32 -0
- package/test/adaptiveShell.browser.test.js +251 -111
- package/test/clientUpdate.test.js +6 -1
- package/test/drawerPresentation.test.js +7 -7
- package/test/errorPresentation.test.js +4 -5
- package/test/materialBaselines.browser.test.js +96 -0
- package/test/menuIcons.test.js +14 -22
- package/test/outletMenuWidgetContract.test.js +2 -3
- package/test/playwrightContract.test.js +3 -1
- package/test/provider.test.js +9 -1
- package/test/settingsPlacementContract.test.js +49 -28
- package/test/shellGestureSupport.test.js +21 -9
- package/test/translation.test.js +2 -2
- package/test/useShellDrawer.test.js +20 -5
- package/test/useShellRouteTransition.test.js +3 -3
- package/patterns/application-shell/example/src/pages/home/settings/index.vue +0 -7
- package/src/client/components/ShellNavigationTooltip.vue +0 -39
package/test/menuIcons.test.js
CHANGED
|
@@ -3,12 +3,6 @@ import path from "node:path";
|
|
|
3
3
|
import test from "node:test";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
7
|
-
mdiAccountKeyOutline,
|
|
8
|
-
mdiCogOutline,
|
|
9
|
-
mdiConsoleNetworkOutline,
|
|
10
|
-
mdiViewListOutline
|
|
11
|
-
} from "@mdi/js";
|
|
12
6
|
import {
|
|
13
7
|
resolveMenuLinkIcon,
|
|
14
8
|
resolveSurfaceSwitchIcon
|
|
@@ -17,26 +11,24 @@ import {
|
|
|
17
11
|
const TEST_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
18
12
|
const PACKAGE_DIR = path.resolve(TEST_DIRECTORY, "..");
|
|
19
13
|
|
|
20
|
-
test("
|
|
21
|
-
assert.equal(resolveMenuLinkIcon({ icon: "
|
|
22
|
-
assert.equal(resolveMenuLinkIcon({ icon: "
|
|
23
|
-
assert.equal(
|
|
24
|
-
resolveSurfaceSwitchIcon("home", "mdi-console-network-outline"),
|
|
25
|
-
mdiConsoleNetworkOutline
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("shell-web leaves unknown explicit mdi metadata icons unchanged", () => {
|
|
30
|
-
assert.equal(resolveMenuLinkIcon({ icon: "mdi-not-a-real-supported-icon" }), "mdi-not-a-real-supported-icon");
|
|
14
|
+
test("an explicit menu icon is used as given, an app alias or path alike", () => {
|
|
15
|
+
assert.equal(resolveMenuLinkIcon({ icon: "$receiptLong" }), "$receiptLong");
|
|
16
|
+
assert.equal(resolveMenuLinkIcon({ icon: "svg:M1 1h22v22H1z" }), "svg:M1 1h22v22H1z");
|
|
17
|
+
assert.equal(resolveSurfaceSwitchIcon("home", "$terminal"), "$terminal");
|
|
31
18
|
});
|
|
32
19
|
|
|
33
|
-
test("
|
|
34
|
-
assert.equal(resolveMenuLinkIcon({
|
|
20
|
+
test("menu links without an icon get a Material Symbols alias from their label or target", () => {
|
|
21
|
+
assert.equal(resolveMenuLinkIcon({ label: "Home", to: "/home" }), "$home");
|
|
22
|
+
assert.equal(resolveMenuLinkIcon({ label: "Settings", to: "/home/settings" }), "$settings");
|
|
23
|
+
assert.equal(resolveMenuLinkIcon({ label: "Sign in", to: "/auth/login" }), "$login");
|
|
24
|
+
assert.equal(resolveMenuLinkIcon({ label: "Members", to: "/w/acme/members" }), "$group");
|
|
25
|
+
assert.equal(resolveMenuLinkIcon({ label: "Go to admin" }), "$adminPanelSettings");
|
|
26
|
+
assert.equal(resolveSurfaceSwitchIcon("console"), "$terminal");
|
|
27
|
+
assert.equal(resolveSurfaceSwitchIcon("reports"), "$arrowCircleRight");
|
|
35
28
|
});
|
|
36
29
|
|
|
37
|
-
test("shell-web menu
|
|
30
|
+
test("shell-web menu icons are aliases, not Material Design Icons", async () => {
|
|
38
31
|
const source = await readFile(path.join(PACKAGE_DIR, "src", "client", "lib", "menuIcons.js"), "utf8");
|
|
39
32
|
|
|
40
|
-
assert.doesNotMatch(source,
|
|
41
|
-
assert.doesNotMatch(source, /mdiIcons\[/);
|
|
33
|
+
assert.doesNotMatch(source, /@mdi\/js|mdi-/u);
|
|
42
34
|
});
|
|
@@ -13,12 +13,11 @@ test("shell-web outlet menu widget exposes a configurable nested outlet", async
|
|
|
13
13
|
"utf8"
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
assert.match(source, /import \{ mdiCogOutline \} from "@mdi\/js";/);
|
|
17
16
|
assert.match(source, /:target="props\.target"/);
|
|
18
17
|
assert.doesNotMatch(source, /defaultLinkComponentToken/);
|
|
19
18
|
assert.doesNotMatch(source, /default-link-component-token/);
|
|
20
|
-
assert.match(source, /default:
|
|
21
|
-
assert.doesNotMatch(source,
|
|
19
|
+
assert.match(source, /default: "\$settings"/u);
|
|
20
|
+
assert.doesNotMatch(source, /@mdi\/js|mdi-[a-z0-9-]+/u);
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
test("shell-web exports the outlet menu widget from both client index and package exports", async () => {
|
|
@@ -58,7 +58,9 @@ test("adaptive shell smoke follows rendered layout state and waits for drawer tr
|
|
|
58
58
|
assert.match(source, /data-rail-width/u);
|
|
59
59
|
assert.match(source, /expect\.poll/u);
|
|
60
60
|
assert.match(source, /toBeFocused/u);
|
|
61
|
-
|
|
61
|
+
// The modal drawer opens over the app bar; the smoke closes it from the scrim beside it and with Escape.
|
|
62
|
+
assert.match(source, /toHaveAttribute\("aria-label", "Close navigation menu"\)/u);
|
|
63
|
+
assert.match(source, /page\.mouse\.click\(viewport\.width - 8/u);
|
|
62
64
|
assert.doesNotMatch(source, /v-navigation-drawer__scrim/u);
|
|
63
65
|
assert.match(source, /page\.keyboard\.press\("Escape"\)[\s\S]*data-presentation", "drawer"/u);
|
|
64
66
|
assert.match(source, /centers\.push\(box\.x \+ box\.width \/ 2\)/u);
|
package/test/provider.test.js
CHANGED
|
@@ -57,6 +57,13 @@ function createRouter() {
|
|
|
57
57
|
onError(handler) {
|
|
58
58
|
errorHandlers.push(handler);
|
|
59
59
|
return () => {};
|
|
60
|
+
},
|
|
61
|
+
// The shell's navigation trail hooks every navigation.
|
|
62
|
+
beforeEach() {
|
|
63
|
+
return () => {};
|
|
64
|
+
},
|
|
65
|
+
afterEach() {
|
|
66
|
+
return () => {};
|
|
60
67
|
}
|
|
61
68
|
};
|
|
62
69
|
}
|
|
@@ -129,7 +136,7 @@ async function startShell({
|
|
|
129
136
|
);
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
test("shell capability owns placement, bootstrap, refresh, errors, and recovery without a container", async () => {
|
|
139
|
+
test("shell capability owns placement, navigation, bootstrap, refresh, errors, and recovery without a container", async () => {
|
|
133
140
|
const fixture = await startShell({
|
|
134
141
|
bootstrapPayload: {
|
|
135
142
|
surfaceAccess: {
|
|
@@ -146,6 +153,7 @@ test("shell capability owns placement, bootstrap, refresh, errors, and recovery
|
|
|
146
153
|
"clientUpdate",
|
|
147
154
|
"error",
|
|
148
155
|
"errorPresentationStore",
|
|
156
|
+
"navigation",
|
|
149
157
|
"placement",
|
|
150
158
|
"refresh",
|
|
151
159
|
"requestRecovery"
|
|
@@ -62,15 +62,29 @@ test("shell-web application pattern exposes surface-derived settings outlets", a
|
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
assert.match(source, /target="home-settings:primary-menu"/);
|
|
65
|
-
assert.match(source,
|
|
66
|
-
assert.
|
|
65
|
+
assert.match(source, /<ShellListDetail :detail-open="detailOpen">/u);
|
|
66
|
+
assert.doesNotMatch(source, /<style|border|v-sheet/u);
|
|
67
67
|
assert.doesNotMatch(source, /generated-ui/u);
|
|
68
68
|
assert.doesNotMatch(source, /default-link-component-token/);
|
|
69
69
|
assert.match(source, /<RouterView \/>/);
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
test("shell-web shell layout registers navigation at the app layout level", async () => {
|
|
73
|
+
const layoutSource = await readClientSources("components/ShellLayout.vue");
|
|
73
74
|
const source = await readClientSources("composables/useShellDrawer.js", "components/ShellLayout.vue");
|
|
75
|
+
const barPieces = await readClientSources(
|
|
76
|
+
"components/ShellUpButton.vue",
|
|
77
|
+
"components/ShellPageTitle.vue",
|
|
78
|
+
"components/ShellPageActionsTarget.vue",
|
|
79
|
+
"composables/useShellAppBar.js"
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// ShellLayout's bar is made of the pieces a layout with its own top app bar uses: one owner, no copy.
|
|
83
|
+
assert.match(layoutSource, /useShellAppBar\(\);/u);
|
|
84
|
+
assert.match(layoutSource, /<ShellUpButton v-if="canGoUp" class="shell-layout__leading" \/>/u);
|
|
85
|
+
assert.match(layoutSource, /<ShellPageTitle :title="fallbackTitle" \/>/u);
|
|
86
|
+
assert.match(layoutSource, /<ShellPageActionsTarget \/>/u);
|
|
87
|
+
assert.doesNotMatch(layoutSource, /\$arrowBack|PAGE_TITLE_ID|SHELL_PAGE_ACTIONS_ID|attachShell/u);
|
|
74
88
|
|
|
75
89
|
assert.doesNotMatch(source, /<v-layout\b/);
|
|
76
90
|
assert.doesNotMatch(source, /overflow-hidden/);
|
|
@@ -78,14 +92,19 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
78
92
|
assert.match(source, /ShellRouteTransition/);
|
|
79
93
|
assert.match(source, /<ShellRouteTransition>[\s\S]*<slot \/>[\s\S]*<\/ShellRouteTransition>/);
|
|
80
94
|
assert.match(source, /data-testid="jskit-shell-app-bar"/);
|
|
81
|
-
assert.match(source, /:
|
|
82
|
-
assert.match(source,
|
|
95
|
+
assert.match(source, /:height="64"/u);
|
|
96
|
+
assert.match(source, /:color="scrolled \? 'surface-container' : 'surface'"/u);
|
|
97
|
+
assert.match(barPieces, /data-testid="jskit-shell-back"[\s\S]*:aria-label="t\('jskit\.shell\.actions\.back'\)"/u);
|
|
98
|
+
assert.match(barPieces, /:id="PAGE_TITLE_ID"/u);
|
|
99
|
+
assert.match(barPieces, /:id="SHELL_PAGE_ACTIONS_ID"/u);
|
|
100
|
+
assert.match(barPieces, /provide\(SHELL_PAGE_ACTIONS_TARGET_KEY, `#\$\{SHELL_PAGE_ACTIONS_ID\}`\)/u);
|
|
101
|
+
assert.match(barPieces, /release = navigationRuntime\.attachShell\(\);/u);
|
|
83
102
|
assert.match(source, /shell-layout__surface-label/);
|
|
84
103
|
assert.doesNotMatch(source, /shell-layout__surface-chip/);
|
|
85
104
|
assert.doesNotMatch(source, /<v-chip[^>]*resolvedSurfaceLabel/);
|
|
86
|
-
assert.match(source, /shell-layout__top-right[\s\S]*max-width:\s*min\(45vw, 18rem\)/);
|
|
87
105
|
assert.match(source, /<v-bottom-navigation[\s\S]*target="shell-layout:primary-bottom-nav"/);
|
|
88
|
-
assert.match(source,
|
|
106
|
+
assert.match(source, /bg-color="surface-container"[\s\S]*:height="80"/u);
|
|
107
|
+
assert.doesNotMatch(source, /!important|border-(?:top|bottom|right|left)?-?width:\s*thin/u);
|
|
89
108
|
assert.match(source, /<v-bottom-sheet[\s\S]*target="shell-layout:supporting-bottom-sheet"/);
|
|
90
109
|
assert.match(source, /target="shell-layout:supporting-side-panel"/);
|
|
91
110
|
assert.match(source, /data-testid="jskit-shell-supporting-bottom-sheet"/);
|
|
@@ -129,7 +148,8 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
129
148
|
assert.match(source, /:model-value="drawerPresentation\.visible"/);
|
|
130
149
|
assert.match(source, /data-testid="jskit-shell-nav-toggle"/);
|
|
131
150
|
assert.match(source, /data-testid="jskit-shell-bottom-nav"/);
|
|
132
|
-
assert.match(source, /padding:\s*
|
|
151
|
+
assert.match(source, /padding:\s*8px 24px calc\(24px \+ env\(safe-area-inset-bottom, 0px\)\)/u);
|
|
152
|
+
assert.match(source, /\.shell-layout__content--compact\s*\{\s*padding-inline:\s*16px;/u);
|
|
133
153
|
|
|
134
154
|
const template = await readFile(
|
|
135
155
|
path.join(PACKAGE_DIR, "patterns", "application-shell", "example", "src", "components", "ShellLayout.vue"),
|
|
@@ -142,21 +162,21 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
142
162
|
assert.doesNotMatch(template, /ShellOutlet|ShellRouteTransition|useShellLayoutState|pointerdown|v-navigation-drawer|v-bottom-navigation/);
|
|
143
163
|
});
|
|
144
164
|
|
|
145
|
-
test("shell
|
|
165
|
+
test("shell-web application pattern renders its not-found view in the shell, whose app bar carries the title", async () => {
|
|
146
166
|
const source = await readFile(
|
|
147
|
-
path.join(PACKAGE_DIR, "
|
|
167
|
+
path.join(PACKAGE_DIR, "patterns", "application-shell", "example", "src", "views", "NotFound.vue"),
|
|
148
168
|
"utf8"
|
|
149
169
|
);
|
|
150
170
|
|
|
151
|
-
assert.match(source,
|
|
152
|
-
assert.doesNotMatch(source, /
|
|
171
|
+
assert.match(source, /<ShellLayout title="Not Found"/u);
|
|
172
|
+
assert.doesNotMatch(source, /<h1/u);
|
|
153
173
|
});
|
|
154
174
|
|
|
155
175
|
test("shell-web error host uses one explicit close affordance for banner errors", async () => {
|
|
156
176
|
const source = await readClientSources("components/ShellErrorHost.vue", "error/presentation.js");
|
|
157
177
|
|
|
158
178
|
assert.match(source, /function resolveSeverityIcon/);
|
|
159
|
-
assert.match(source, /
|
|
179
|
+
assert.match(source, /"\$warning"/u);
|
|
160
180
|
assert.match(source, /:icon="resolveSeverityIcon\(entry\.severity\)"/);
|
|
161
181
|
assert.match(source, /closable[\s\S]*@click:close="dismiss\(entry\)"/);
|
|
162
182
|
assert.doesNotMatch(source, /mdi-close/);
|
|
@@ -167,8 +187,9 @@ test("shell-web error host keeps snackbar color stable while closing", async ()
|
|
|
167
187
|
|
|
168
188
|
assert.match(source, /displayedSnackbarEntry/);
|
|
169
189
|
assert.match(source, /@after-leave="onSnackbarAfterLeave"/);
|
|
170
|
-
|
|
171
|
-
assert.doesNotMatch(source,
|
|
190
|
+
// Material 3 snackbars are always inverse-surface, whatever the message's severity.
|
|
191
|
+
assert.doesNotMatch(source, /<v-snackbar[^>]*:color=/u);
|
|
192
|
+
assert.doesNotMatch(source, /!important/u);
|
|
172
193
|
});
|
|
173
194
|
|
|
174
195
|
test("shell-web application pattern uses intent-driven default error presentation", async () => {
|
|
@@ -203,7 +224,9 @@ test("shell-web application pattern includes adaptive shell Playwright coverage"
|
|
|
203
224
|
assert.match(helperSource, /jskit-shell-drawer/);
|
|
204
225
|
assert.match(helperSource, /scrollWidth/);
|
|
205
226
|
assert.match(helperSource, /toBeGreaterThanOrEqual\(48\)/);
|
|
206
|
-
|
|
227
|
+
// The modal drawer opens over the app bar; the smoke closes it from the scrim beside it and with Escape.
|
|
228
|
+
assert.match(helperSource, /toHaveAttribute\("aria-label", "Close navigation menu"\)/);
|
|
229
|
+
assert.match(helperSource, /page\.mouse\.click\(viewport\.width - 8/);
|
|
207
230
|
assert.doesNotMatch(helperSource, /\.v-navigation-drawer__scrim|generated-ui-screen/u);
|
|
208
231
|
|
|
209
232
|
const packageJson = JSON.parse(await readFile(path.join(PACKAGE_DIR, "package.json"), "utf8"));
|
|
@@ -318,15 +341,13 @@ test("shell-web route transition key preserves no-motion surfaces and animated p
|
|
|
318
341
|
);
|
|
319
342
|
});
|
|
320
343
|
|
|
321
|
-
test("shell-web pattern settings
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
"utf8"
|
|
325
|
-
);
|
|
344
|
+
test("shell-web pattern settings page is a list-detail page whose landing shows the list, not a redirect", async () => {
|
|
345
|
+
const settingsRoot = path.join(PACKAGE_DIR, "patterns", "application-shell", "example", "src", "pages", "home");
|
|
346
|
+
const source = await readFile(path.join(settingsRoot, "settings.vue"), "utf8");
|
|
326
347
|
|
|
327
|
-
assert.match(source,
|
|
328
|
-
assert.match(source, /
|
|
329
|
-
assert.
|
|
348
|
+
assert.match(source, /<ShellListDetail :detail-open="detailOpen">/);
|
|
349
|
+
assert.match(source, /title: "Settings"/);
|
|
350
|
+
await assert.rejects(readFile(path.join(settingsRoot, "settings", "index.vue"), "utf8"), { code: "ENOENT" });
|
|
330
351
|
});
|
|
331
352
|
|
|
332
353
|
test("shell-web pattern settings page exposes an adaptive drawer preference", async () => {
|
|
@@ -347,14 +368,15 @@ test("shell-web pattern settings page exposes an adaptive drawer preference", as
|
|
|
347
368
|
);
|
|
348
369
|
|
|
349
370
|
assert.match(source, /useShellLayoutState/);
|
|
350
|
-
assert.match(source, /
|
|
371
|
+
assert.match(source, /parent: "\/settings"/);
|
|
372
|
+
assert.match(source, /<v-card>\s*<v-list lines="three">/);
|
|
351
373
|
assert.doesNotMatch(source, /generated-ui/u);
|
|
352
374
|
assert.match(source, /drawerDefaultOpen/);
|
|
353
375
|
assert.match(source, /setDrawerDefaultOpen/);
|
|
354
376
|
assert.match(source, /collapsed navigation remains available as a rail/);
|
|
355
377
|
assert.match(source, /Phone layouts close the drawer/);
|
|
356
378
|
assert.match(source, /Start with expanded navigation on wider screens/);
|
|
357
|
-
assert.
|
|
379
|
+
assert.doesNotMatch(source, /<style|min-height/u);
|
|
358
380
|
assert.doesNotMatch(source, /live in this browser only|tiny example|starter settings/);
|
|
359
381
|
});
|
|
360
382
|
|
|
@@ -579,13 +601,12 @@ test("shell-web pattern home page relies on adaptive navigation instead of dead
|
|
|
579
601
|
"utf8"
|
|
580
602
|
);
|
|
581
603
|
|
|
582
|
-
assert.
|
|
583
|
-
assert.match(source, /--home-surface-panel-padding/);
|
|
604
|
+
assert.doesNotMatch(source, /<style|--home-surface/u);
|
|
584
605
|
assert.doesNotMatch(source, /generated-ui/u);
|
|
585
606
|
assert.match(source, /Service health/);
|
|
586
607
|
assert.match(source, /<v-skeleton-loader/u);
|
|
587
608
|
assert.doesNotMatch(source, /loading\.\.\.|v-progress-circular/u);
|
|
588
|
-
assert.match(source,
|
|
609
|
+
assert.match(source, /:to="paths\.page\('\/settings'\)"/);
|
|
589
610
|
assert.doesNotMatch(source, /Use bottom navigation|Replace this content|Main public surface/);
|
|
590
611
|
assert.doesNotMatch(source, /\/console/);
|
|
591
612
|
assert.doesNotMatch(source, /\/auth\/signout/);
|
|
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
import { isPrimaryTouchPointer, isShellGestureIgnoredTarget } from "../src/client/support/gestureTargets.js";
|
|
4
4
|
import { resolveShellLayoutClass } from "../src/client/support/shellLayoutClass.js";
|
|
5
|
+
import { resolveWindowSizeClass } from "../src/client/support/windowSizeClass.js";
|
|
5
6
|
|
|
6
7
|
function createTarget(matchingSelectors = []) {
|
|
7
8
|
return {
|
|
@@ -12,15 +13,26 @@ function createTarget(matchingSelectors = []) {
|
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
test("shell layout class
|
|
16
|
-
assert.equal(resolveShellLayoutClass(
|
|
17
|
-
assert.equal(resolveShellLayoutClass(
|
|
18
|
-
assert.equal(resolveShellLayoutClass(
|
|
19
|
-
assert.equal(resolveShellLayoutClass(
|
|
20
|
-
assert.equal(resolveShellLayoutClass(
|
|
21
|
-
assert.equal(resolveShellLayoutClass(
|
|
22
|
-
assert.equal(resolveShellLayoutClass(
|
|
23
|
-
assert.equal(resolveShellLayoutClass(
|
|
16
|
+
test("shell layout class is the Material 3 window size class, with large placed like expanded", () => {
|
|
17
|
+
assert.equal(resolveShellLayoutClass(390), "compact");
|
|
18
|
+
assert.equal(resolveShellLayoutClass(599), "compact");
|
|
19
|
+
assert.equal(resolveShellLayoutClass(600), "medium");
|
|
20
|
+
assert.equal(resolveShellLayoutClass(768), "medium");
|
|
21
|
+
assert.equal(resolveShellLayoutClass(839), "medium");
|
|
22
|
+
assert.equal(resolveShellLayoutClass(840), "expanded");
|
|
23
|
+
assert.equal(resolveShellLayoutClass(1199), "expanded");
|
|
24
|
+
assert.equal(resolveShellLayoutClass(1280), "expanded");
|
|
25
|
+
assert.equal(resolveShellLayoutClass(1920), "expanded");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("window size classes follow the Material 3 breakpoints", () => {
|
|
29
|
+
assert.equal(resolveWindowSizeClass(0), "compact");
|
|
30
|
+
assert.equal(resolveWindowSizeClass(599), "compact");
|
|
31
|
+
assert.equal(resolveWindowSizeClass(600), "medium");
|
|
32
|
+
assert.equal(resolveWindowSizeClass(840), "expanded");
|
|
33
|
+
assert.equal(resolveWindowSizeClass(1199), "expanded");
|
|
34
|
+
assert.equal(resolveWindowSizeClass(1200), "large");
|
|
35
|
+
assert.equal(resolveWindowSizeClass(2400), "large");
|
|
24
36
|
});
|
|
25
37
|
|
|
26
38
|
test("shell gestures follow primary touch and pen pointers only", () => {
|
package/test/translation.test.js
CHANGED
|
@@ -52,7 +52,7 @@ test("shell texts stay English without an app vue-i18n instance", () => {
|
|
|
52
52
|
requestRecoveryMessage(null),
|
|
53
53
|
"The app could not reach the server or network. Check the connection and try again."
|
|
54
54
|
);
|
|
55
|
-
assert.equal(resolveShellDrawerToggleLabel({
|
|
55
|
+
assert.equal(resolveShellDrawerToggleLabel({ modal: true, open: false }), "Open navigation menu");
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
test("shell texts follow the app's active language", () => {
|
|
@@ -65,7 +65,7 @@ test("shell texts follow the app's active language", () => {
|
|
|
65
65
|
requestRecoveryMessage(null, { label: "jskit.shell.recovery.appDataLabel" }),
|
|
66
66
|
"[xx] [xx] App data could not reach the server or network. Check the connection and try again."
|
|
67
67
|
);
|
|
68
|
-
assert.equal(resolveShellDrawerToggleLabel({
|
|
68
|
+
assert.equal(resolveShellDrawerToggleLabel({ modal: false, open: true }), "[xx] Collapse navigation drawer");
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
@@ -65,6 +65,7 @@ function mountDrawer(t, { compact = false, props = {} } = {}) {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
const isCompactLayout = ref(compact);
|
|
68
|
+
const viewportWidth = ref(compact ? 390 : 1280);
|
|
68
69
|
const drawerOpen = ref(true);
|
|
69
70
|
const focused = [];
|
|
70
71
|
const navigationToggle = ref({ $el: { focus: (options) => focused.push(options) } });
|
|
@@ -76,7 +77,8 @@ function mountDrawer(t, { compact = false, props = {} } = {}) {
|
|
|
76
77
|
navigationItemSpacing: 12,
|
|
77
78
|
...props
|
|
78
79
|
},
|
|
79
|
-
isCompactLayout,
|
|
80
|
+
modalLayout: isCompactLayout,
|
|
81
|
+
viewportWidth,
|
|
80
82
|
navigationToggle,
|
|
81
83
|
layoutState: {
|
|
82
84
|
drawerDefaultOpen: ref(true),
|
|
@@ -87,7 +89,7 @@ function mountDrawer(t, { compact = false, props = {} } = {}) {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
}));
|
|
90
|
-
return { app, drawerOpen, focused, fontListeners, frames, isCompactLayout, observers, page, result };
|
|
92
|
+
return { app, drawerOpen, focused, fontListeners, frames, isCompactLayout, observers, page, result, viewportWidth };
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
async function runFrames(frames) {
|
|
@@ -161,8 +163,21 @@ test("Escape closes the compact drawer and returns focus to its toggle", async (
|
|
|
161
163
|
app.unmount();
|
|
162
164
|
});
|
|
163
165
|
|
|
164
|
-
test("the drawer's
|
|
165
|
-
const { app, frames,
|
|
166
|
+
test("the drawer is Material 3's 360dp wide and a modal one leaves 56dp of the page", async (t) => {
|
|
167
|
+
const { app, frames, isCompactLayout, result, viewportWidth } = mountDrawer(t);
|
|
168
|
+
assert.equal(result.fixedDrawerWidth.value, true);
|
|
169
|
+
assert.equal(result.resolvedDrawerWidth.value, 360);
|
|
170
|
+
await runFrames(frames);
|
|
171
|
+
assert.equal(result.resolvedDrawerWidth.value, 360);
|
|
172
|
+
|
|
173
|
+
isCompactLayout.value = true;
|
|
174
|
+
viewportWidth.value = 390;
|
|
175
|
+
assert.equal(result.resolvedDrawerWidth.value, 390 - 56);
|
|
176
|
+
app.unmount();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("a content drawer's width follows its measured labels", async (t) => {
|
|
180
|
+
const { app, frames, observers, result } = mountDrawer(t, { props: { drawerWidth: "content" } });
|
|
166
181
|
assert.equal(result.resolvedDrawerWidth.value, 248);
|
|
167
182
|
|
|
168
183
|
await runFrames(frames);
|
|
@@ -198,7 +213,7 @@ test("a closed wide drawer only ignores a request to open it", (t) => {
|
|
|
198
213
|
});
|
|
199
214
|
|
|
200
215
|
test("unmounting detaches every listener and pending measurement", async (t) => {
|
|
201
|
-
const { app, fontListeners, frames, observers, page } = mountDrawer(t);
|
|
216
|
+
const { app, fontListeners, frames, observers, page } = mountDrawer(t, { props: { drawerWidth: "content" } });
|
|
202
217
|
await nextTick();
|
|
203
218
|
await nextTick();
|
|
204
219
|
assert.equal(page.listeners.size, 2);
|
|
@@ -28,7 +28,7 @@ function createPlacementRuntime() {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function mountTransition(t, { path = "/home/contacts",
|
|
31
|
+
function mountTransition(t, { path = "/home/contacts", width = 390, props = {} } = {}) {
|
|
32
32
|
const page = installPage(t);
|
|
33
33
|
const route = reactive({ path, params: {} });
|
|
34
34
|
const pushes = [];
|
|
@@ -50,7 +50,7 @@ function mountTransition(t, { path = "/home/contacts", displayName = "xs", props
|
|
|
50
50
|
provide: [
|
|
51
51
|
[routerKey, router],
|
|
52
52
|
[routeLocationKey, route],
|
|
53
|
-
[Symbol.for("vuetify:display"), {
|
|
53
|
+
[Symbol.for("vuetify:display"), { width: ref(width), mobile: ref(false) }],
|
|
54
54
|
[SHELL_WEB_PLACEMENT_RUNTIME_KEY, createPlacementRuntime()]
|
|
55
55
|
]
|
|
56
56
|
}
|
|
@@ -93,7 +93,7 @@ test("a route change away from every destination has no motion", (t) => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test("wide layouts keep the pane still and never start a swipe", (t) => {
|
|
96
|
-
const { app, page, pushes, result, route } = mountTransition(t, {
|
|
96
|
+
const { app, page, pushes, result, route } = mountTransition(t, { width: 1280 });
|
|
97
97
|
assert.equal(page.classes.has("shell-route-swipe-enabled"), false);
|
|
98
98
|
|
|
99
99
|
page.dispatch("pointerdown", { ...touch, clientX: 300, clientY: 100 });
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useTheme } from "vuetify";
|
|
3
|
-
import { useJskitText } from "../i18n.js";
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
label: {
|
|
7
|
-
type: [String, Object],
|
|
8
|
-
default: ""
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const { text } = useJskitText();
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<template>
|
|
17
|
-
<v-tooltip
|
|
18
|
-
:text="text(props.label)"
|
|
19
|
-
:theme="theme.name.value"
|
|
20
|
-
location="end"
|
|
21
|
-
content-class="shell-navigation-tooltip"
|
|
22
|
-
:open-delay="400"
|
|
23
|
-
:open-on-focus="true"
|
|
24
|
-
:open-on-hover="true"
|
|
25
|
-
>
|
|
26
|
-
<template #activator="{ props: activatorProps }">
|
|
27
|
-
<slot :activator-props="activatorProps" />
|
|
28
|
-
</template>
|
|
29
|
-
</v-tooltip>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<style>
|
|
33
|
-
.shell-navigation-tooltip {
|
|
34
|
-
background-color:
|
|
35
|
-
rgb(var(--v-theme-inverse-surface, var(--v-theme-on-surface))) !important;
|
|
36
|
-
color:
|
|
37
|
-
rgb(var(--v-theme-inverse-on-surface, var(--v-theme-surface))) !important;
|
|
38
|
-
}
|
|
39
|
-
</style>
|