@jskit-ai/shell-web 0.2.13 → 0.2.15

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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/fixtures/adaptive-shell/src/ActionsFormPage.vue +22 -0
  3. package/fixtures/adaptive-shell/src/ActionsPage.vue +74 -0
  4. package/fixtures/adaptive-shell/src/App.vue +1 -0
  5. package/fixtures/adaptive-shell/src/ButtonStatesPage.vue +63 -0
  6. package/fixtures/adaptive-shell/src/ButtonsPage.vue +33 -3
  7. package/fixtures/adaptive-shell/src/ComponentsPage.vue +178 -0
  8. package/fixtures/adaptive-shell/src/FeedbackPage.vue +59 -0
  9. package/fixtures/adaptive-shell/src/ReportsPage.vue +29 -0
  10. package/fixtures/adaptive-shell/src/StatusButton.vue +17 -0
  11. package/fixtures/adaptive-shell/src/TitleClaim.vue +17 -0
  12. package/fixtures/adaptive-shell/src/main.js +131 -5
  13. package/fixtures/production-build/index.html +15 -0
  14. package/fixtures/production-build/package.json +5 -0
  15. package/fixtures/production-build/src/App.vue +27 -0
  16. package/fixtures/production-build/src/componentChunk.css +5 -0
  17. package/fixtures/production-build/src/main.js +10 -0
  18. package/fixtures/production-build/vite.config.mjs +12 -0
  19. package/locales/en.json +1 -0
  20. package/package.json +9 -5
  21. package/patterns/application-shell/PATTERN.md +11 -6
  22. package/patterns/application-shell/example/src/components/menus/SectionTabLinkItem.vue +42 -0
  23. package/patterns/application-shell/example/src/pages/home.vue +1 -1
  24. package/patterns/application-shell/example/src/views/NotFound.vue +1 -1
  25. package/patterns/page-and-placement/PATTERN.md +6 -0
  26. package/patterns/page-and-placement/example/src/pages/home/reports.vue +9 -4
  27. package/patterns/page-and-placement/example/src/placementTopology.js +5 -3
  28. package/src/client/components/ShellErrorHost.vue +20 -1
  29. package/src/client/components/ShellLayout.vue +42 -27
  30. package/src/client/components/ShellNavigationItem.vue +8 -3
  31. package/src/client/components/ShellNavigationScope.vue +1 -1
  32. package/src/client/components/ShellOutlet.vue +12 -1
  33. package/src/client/components/ShellPageAction.vue +107 -28
  34. package/src/client/components/ShellPageActionsTarget.vue +81 -2
  35. package/src/client/components/ShellPrimaryAction.vue +69 -0
  36. package/src/client/components/ShellSectionTabLinkItem.vue +104 -0
  37. package/src/client/components/ShellTabLinkItem.vue +18 -3
  38. package/src/client/components/ShellUpButton.vue +13 -8
  39. package/src/client/composables/useShellAppBar.js +10 -1
  40. package/src/client/composables/useShellPageClose.js +18 -0
  41. package/src/client/index.js +3 -0
  42. package/src/client/navigation/shellNavigationRuntime.js +59 -12
  43. package/src/client/navigation/usePaths.js +13 -0
  44. package/src/client/navigation/useShellNavigation.js +2 -0
  45. package/src/client/providers/ShellWebClientProvider.js +25 -9
  46. package/src/client/support/drawerPresentation.js +23 -6
  47. package/src/client/support/navigationPresentation.js +1 -1
  48. package/src/client/support/pageActions.js +126 -0
  49. package/src/test/adaptiveShellSmoke.js +31 -16
  50. package/test/adaptiveShell.browser.test.js +1019 -334
  51. package/test/drawerPresentation.test.js +20 -2
  52. package/test/linkResolver.test.js +4 -0
  53. package/test/materialBaselines.browser.test.js +142 -27
  54. package/test/packageRouteParent.test.js +41 -0
  55. package/test/pageActions.test.js +84 -0
  56. package/test/productionBuild.browser.test.js +98 -0
  57. package/test/settingsPlacementContract.test.js +11 -4
  58. package/test/shellNavigationRuntime.test.js +272 -0
@@ -69,7 +69,16 @@ async function expectElementVisibility(page, expect, testId, visible) {
69
69
  ).toBe(visible);
70
70
  }
71
71
 
72
- async function readShellLayoutClass(drawer) {
72
+ // The layout class comes from the drawer, which carries it; a phone shell whose destinations are all in the
73
+ // navigation bar draws no drawer (or menu control), and its navigation bar says it is compact.
74
+ async function readShellLayoutClass(drawer, bottomNavigation, expect) {
75
+ await expect(
76
+ drawer.or(bottomNavigation).first(),
77
+ "The shell drew neither a drawer nor a navigation bar."
78
+ ).toBeAttached();
79
+ if (await drawer.count() === 0) {
80
+ return "compact";
81
+ }
73
82
  const layoutClass = String(await drawer.getAttribute("data-layout") || "");
74
83
  if (!["compact", "medium", "expanded"].includes(layoutClass)) {
75
84
  throw new Error(`Shell drawer exposed an invalid data-layout value: ${layoutClass || "(empty)"}.`);
@@ -290,8 +299,9 @@ async function runAdaptiveShellSmokeCase({
290
299
  await expect(page.getByRole("main").first()).toBeVisible();
291
300
  await expectNoHorizontalOverflow(page, expect);
292
301
  const drawer = page.getByTestId("jskit-shell-drawer");
302
+ const bottomNavigation = page.getByTestId("jskit-shell-bottom-nav");
293
303
  const toggle = page.getByTestId("jskit-shell-nav-toggle");
294
- const layoutClass = await readShellLayoutClass(drawer);
304
+ const layoutClass = await readShellLayoutClass(drawer, bottomNavigation, expect);
295
305
 
296
306
  if (layoutClass === "compact") {
297
307
  let bootstrapRequests = 0;
@@ -301,21 +311,26 @@ async function runAdaptiveShellSmokeCase({
301
311
  });
302
312
  const bootstrapRequestsBeforePull = bootstrapRequests;
303
313
 
304
- await expect(page.getByTestId("jskit-shell-bottom-nav")).toBeVisible();
305
- await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
306
-
307
- // The modal drawer opens over the app bar, as Material 3 draws it; tapping the scrim beside it closes it.
308
- await openCompactDrawer(page, expect);
309
- await expect(toggle).toHaveAttribute("aria-label", "Close navigation menu");
310
- await page.mouse.click(viewport.width - 8, Math.round(viewport.height / 2));
311
- await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
312
-
313
- await openCompactDrawer(page, expect);
314
- await page.keyboard.press("Escape");
315
- await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
316
- await expect(toggle).toBeFocused();
314
+ await expect(bottomNavigation).toBeVisible();
315
+ if (await drawer.count() === 0) {
316
+ // Every destination is in the navigation bar, so there is no drawer to open and no menu control.
317
+ await expect(toggle).toHaveCount(0);
318
+ } else {
319
+ await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
320
+
321
+ // The modal drawer opens over the app bar, as Material 3 draws it; tapping the scrim beside it closes it.
322
+ await openCompactDrawer(page, expect);
323
+ await expect(toggle).toHaveAttribute("aria-label", "Close navigation menu");
324
+ await page.mouse.click(viewport.width - 8, Math.round(viewport.height / 2));
325
+ await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
326
+
327
+ await openCompactDrawer(page, expect);
328
+ await page.keyboard.press("Escape");
329
+ await expectElementVisibility(page, expect, "jskit-shell-drawer", false);
330
+ await expect(toggle).toBeFocused();
331
+ }
317
332
 
318
- const navButtonHeights = await page.getByTestId("jskit-shell-bottom-nav").locator(".v-btn").evaluateAll((buttons) =>
333
+ const navButtonHeights = await bottomNavigation.locator(".v-btn").evaluateAll((buttons) =>
319
334
  buttons.map((button) => button.getBoundingClientRect().height)
320
335
  );
321
336
  expect(navButtonHeights.length).toBeGreaterThan(0);