@wow-two-beta/fe 0.0.41 → 0.0.43

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 (53) hide show
  1. package/README.md +21 -3
  2. package/dist/auth/BffSession.d.ts +5 -0
  3. package/dist/auth/BffSession.js +2 -0
  4. package/dist/auth/BffSession.js.map +1 -1
  5. package/dist/foundation/net/hooks/UseRunningVersion.d.ts +30 -0
  6. package/dist/foundation/net/hooks/UseRunningVersion.js +19 -0
  7. package/dist/foundation/net/hooks/UseRunningVersion.js.map +1 -0
  8. package/dist/foundation/net/index.d.ts +1 -0
  9. package/dist/foundation/net/index.js +2 -0
  10. package/dist/foundation/net/index.js.map +1 -1
  11. package/dist/foundation/storage/StorageBroker.d.ts +6 -0
  12. package/dist/foundation/storage/StorageBroker.js +41 -36
  13. package/dist/foundation/storage/StorageBroker.js.map +1 -1
  14. package/dist/foundation/storage/index.d.ts +1 -1
  15. package/dist/foundation/storage/index.js +2 -1
  16. package/dist/foundation/themes/constants/Authored.js +21 -0
  17. package/dist/foundation/themes/constants/Authored.js.map +1 -1
  18. package/dist/index.css +16 -0
  19. package/dist/index.js +812 -806
  20. package/dist/index.js.map +1 -1
  21. package/dist/presentation/display/index.d.ts +1 -0
  22. package/dist/presentation/display/index.js +6 -4
  23. package/dist/presentation/display/index.js.map +1 -1
  24. package/dist/presentation/display/versionBadge/VersionBadge.vue.d.ts +27 -0
  25. package/dist/presentation/display/versionBadge/VersionBadge.vue.js +80 -0
  26. package/dist/presentation/display/versionBadge/VersionBadge.vue.js.map +1 -0
  27. package/dist/presentation/display/versionBadge/VersionBadge2.vue.js +5 -0
  28. package/dist/presentation/display/versionBadge/VersionBadge2.vue.js.map +1 -0
  29. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.d.ts +9 -0
  30. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.js +21 -0
  31. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.js.map +1 -0
  32. package/dist/presentation/display/versionBadge/index.d.ts +1 -0
  33. package/dist/presentation/forms/imageEditor/ImageEditor.vue.d.ts +1 -1
  34. package/dist/presentation/layout/appFrame/AppFrame.vue.d.ts +168 -0
  35. package/dist/presentation/layout/appFrame/AppFrame.vue.js +408 -0
  36. package/dist/presentation/layout/appFrame/AppFrame.vue.js.map +1 -0
  37. package/dist/presentation/layout/appFrame/AppFrame2.vue.js +8 -0
  38. package/dist/presentation/layout/appFrame/AppFrame2.vue.js.map +1 -0
  39. package/dist/presentation/layout/appFrame/index.d.ts +1 -0
  40. package/dist/presentation/layout/index.d.ts +1 -0
  41. package/dist/presentation/layout/index.js +90 -86
  42. package/dist/presentation/layout/index.js.map +1 -1
  43. package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +7 -4
  44. package/dist/presentation/nav/accountMenu/AccountMenu.vue.js +20 -5
  45. package/dist/presentation/nav/accountMenu/AccountMenu.vue.js.map +1 -1
  46. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.d.ts +2 -0
  47. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.js +15 -8
  48. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.js.map +1 -1
  49. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.d.ts +8 -1
  50. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.js +38 -19
  51. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.js.map +1 -1
  52. package/dist/themes.css +14 -0
  53. package/package.json +1 -1
package/README.md CHANGED
@@ -62,11 +62,12 @@ wherever the bar does; `prefers-reduced-motion` makes it instant.
62
62
  `platform` is the validated theme every wow-two platform app shares (Wheelhouse's chalk and forest palette).
63
63
  A platform app imports `themes.css` after `styles.css` and sets `class="theme-platform"` on its root, plus `dark`
64
64
  for dark mode and `surface-ambient` on the page for the backdrop; the `glass` variants of `Navbar`,
65
- `AppShellHeader` and `Card` take their translucent fill from its card and popover tokens.
65
+ `AppShellHeader`, `AppFrame` and `Card` take Wheelhouse's frame glass from it: an 86% chrome fill, a 16px blur, a
66
+ forest-tinted hairline and a top highlight.
66
67
 
67
68
  Glass strength is a theme setting. The glass surfaces read ten custom properties, which a theme sets in its
68
- `.theme-{id}` blocks (`Theme.glass`; the `ocharo` theme sets the approved frame values) and an app may set on any
69
- subtree: `--glass-fill` (top bar, bottom bar, cards), `--glass-side-fill`, `--glass-menu-fill`, `--glass-blur`,
69
+ `.theme-{id}` blocks (`Theme.glass`; the `platform` and `ocharo` themes set their frame values) and an app may set
70
+ on any subtree: `--glass-fill` (top bar, bottom bar, cards), `--glass-side-fill`, `--glass-menu-fill`, `--glass-blur`,
70
71
  `--glass-saturate`, `--glass-edge`, `--glass-highlight`, `--glass-shadow`, `--glass-bottom-shadow` (the bottom bar's,
71
72
  cast upward) and `--glass-menu-shadow`. Unset, every surface keeps the SDK's own glass. Use them through the
72
73
  components — `AppShellHeader variant="glass"`, `AppShellSidebar variant="glass"`, `BottomNavMenu variant="glass"`,
@@ -76,6 +77,23 @@ and `variant="glass-menu"` on `DropdownMenuContent`, `PopoverContent`, `ModalCon
76
77
  `shadow-(--glass-menu-shadow)`. Each material is the solid card (popover for menus) where blur is unsupported and
77
78
  under `prefers-reduced-transparency`.
78
79
 
80
+ `AppFrame` (`@wow-two-beta/fe/presentation/layout`) is the frame every app shares: a 56px bar with the brand or app
81
+ switcher and a `VersionBadge` above the sidebar, the sidebar toggle, the trail, the app's own bar controls and the
82
+ `AccountMenu`; a sidebar that collapses to an icon rail and is remembered; and the page column. Its dimensions are
83
+ four custom properties in `styles.css`, the same in every theme, so moving between two apps never moves the bar:
84
+ `--frame-bar-height` (56px), `--frame-sidebar-width` (248px), `--frame-rail-width` (64px) and `--frame-content-max`
85
+ (1536px). An app passes its brand, navigation, app list and slots; `useRunningVersion`
86
+ (`@wow-two-beta/fe/foundation/net`) feeds the badge the release the host serves, so a tab left open offers a reload
87
+ after a deployment.
88
+
89
+ ```vue
90
+ <AppFrame :version="appVersion" :running-version="runningVersion" :crumbs="crumbs" :account="account">
91
+ <template #brand="{ isRail }"><RouterLink to="/">…</RouterLink></template>
92
+ <template #nav="{ isRail }"><SidebarMenu :is-collapsed="isRail">…</SidebarMenu></template>
93
+ <RouterView />
94
+ </AppFrame>
95
+ ```
96
+
79
97
  The root exports presentation components and the `styles`, `dom`, `optionals`, `state`, `numbers`, `json`, `icons`, `primitives`, `themes`,
80
98
  `color` and `emoji` namespaces. Dedicated subpaths expose application adapters:
81
99
 
@@ -5,6 +5,11 @@ export interface BffPerson {
5
5
  /** The stable subject id — the identity key, never the display name. */
6
6
  readonly sub: string;
7
7
  readonly name: string | null;
8
+ /**
9
+ * The link to the person's picture (the ID token's `picture`); `null` without one or without the `profile` scope.
10
+ * Bind it to `AccountMenu`'s `avatarSrc` as is — the avatar shows initials while it is `null` or fails to load.
11
+ */
12
+ readonly picture: string | null;
8
13
  readonly email: string | null;
9
14
  readonly phoneNumber: string | null;
10
15
  }
@@ -3,6 +3,7 @@ import { ResultExtensions } from "../foundation/results/ResultExtensions.js";
3
3
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
4
  const isText = (value) => typeof value === "string" && value !== "";
5
5
  const optionalText = (value) => typeof value === "string" ? value : null;
6
+ const optionalLink = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : null;
6
7
  const protocol = () => ApiFailureFactory.create("protocol");
7
8
  function decodeBffSession(value) {
8
9
  if (!isRecord(value) || typeof value["isAuthenticated"] !== "boolean") return ResultExtensions.fail(protocol());
@@ -24,6 +25,7 @@ function decodeBffSession(value) {
24
25
  person: {
25
26
  sub: person["sub"],
26
27
  name: optionalText(person["name"]),
28
+ picture: optionalLink(person["picture"]),
27
29
  email: optionalText(person["email"]),
28
30
  phoneNumber: optionalText(person["phoneNumber"])
29
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"BffSession.js","sources":["../../src/auth/BffSession.ts"],"sourcesContent":["import { ApiFailureFactory, type ApiFailure } from '../foundation/http';\nimport { ResultExtensions, type Result } from '../foundation/results';\n\n/** Defines the signed-in person a BFF session names. */\nexport interface BffPerson {\n /** The stable subject id — the identity key, never the display name. */\n readonly sub: string;\n readonly name: string | null;\n readonly email: string | null;\n readonly phoneNumber: string | null;\n}\n\n/** Defines the organization the session acts in, and the person's role there. */\nexport interface BffOrganization {\n readonly id: string;\n readonly role: string;\n}\n\n/**\n * Defines the user a BFF session resolves to. The CSRF token is deliberately absent: it never renders, so the\n * strategy keeps it and the HTTP layer echoes it.\n */\nexport interface BffUser {\n readonly person: BffPerson;\n /** `null` for a person acting in no organization. */\n readonly organization: BffOrganization | null;\n readonly permissions: readonly string[];\n /** When the session ends (ISO 8601); `null` when the server sent none that parses. */\n readonly expiresAt: string | null;\n}\n\n/** Defines one decoded `GET {prefix}/session` response. */\nexport interface BffSessionSnapshot {\n /** `null` while signed out. */\n readonly user: BffUser | null;\n /** The token unsafe requests echo; `null` while signed out. */\n readonly csrfToken: string | null;\n}\n\n/** Defines one decoded `POST {prefix}/sign-out` response. */\nexport interface BffSignOut {\n /** Where the page navigates to end the identity provider's session. */\n readonly endSessionUrl: string;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\nconst isText = (value: unknown): value is string => typeof value === 'string' && value !== '';\n/** Reads an optional text field; anything but text reads as absent. */\nconst optionalText = (value: unknown): string | null => (typeof value === 'string' ? value : null);\nconst protocol = (): ApiFailure => ApiFailureFactory.create('protocol');\n\n/** Decodes the session response; a payload that breaks the contract is a `protocol` failure. */\nexport function decodeBffSession(value: unknown): Result<BffSessionSnapshot, ApiFailure> {\n if (!isRecord(value) || typeof value['isAuthenticated'] !== 'boolean') return ResultExtensions.fail(protocol());\n if (!value['isAuthenticated']) return ResultExtensions.ok({ user: null, csrfToken: null });\n\n const person = value['person'];\n const organization = value['organization'];\n const permissions = value['permissions'] ?? [];\n const expiresAt = value['expiresAt'];\n if (!isRecord(person) || !isText(person['sub']) || !isText(value['csrfToken'])) {\n return ResultExtensions.fail(protocol());\n }\n if (organization != null && (!isRecord(organization) || !isText(organization['id']))) {\n return ResultExtensions.fail(protocol());\n }\n if (!Array.isArray(permissions) || !permissions.every(isText)) return ResultExtensions.fail(protocol());\n\n return ResultExtensions.ok({\n csrfToken: value['csrfToken'],\n user: {\n person: {\n sub: person['sub'],\n name: optionalText(person['name']),\n email: optionalText(person['email']),\n phoneNumber: optionalText(person['phoneNumber']),\n },\n organization: isRecord(organization)\n ? { id: organization['id'] as string, role: optionalText(organization['role']) ?? '' }\n : null,\n permissions: Object.freeze([...(permissions as string[])]),\n expiresAt: typeof expiresAt === 'string' && Number.isFinite(Date.parse(expiresAt)) ? expiresAt : null,\n },\n });\n}\n\n/** Whether a page may navigate to `url` to end the provider session: a local path, or an absolute http(s) URL. */\nfunction isNavigable(url: string): boolean {\n if (url.startsWith('/')) return !url.startsWith('//') && !url.includes('\\\\');\n try {\n const { protocol: scheme } = new URL(url);\n return scheme === 'https:' || scheme === 'http:';\n } catch {\n return false;\n }\n}\n\n/** Decodes the logout response; an end-session URL the page may not navigate to is a `protocol` failure. */\nexport function decodeBffSignOut(value: unknown): Result<BffSignOut, ApiFailure> {\n if (!isRecord(value) || !isText(value['endSessionUrl']) || !isNavigable(value['endSessionUrl'])) {\n return ResultExtensions.fail(protocol());\n }\n return ResultExtensions.ok({ endSessionUrl: value['endSessionUrl'] });\n}\n\n/** Extends a {@link BffUser} with the checks a screen and a bridge need. */\nexport const BffSessionExtensions = {\n /** Whether the user holds `permission`; `false` while signed out. */\n hasPermission(user: BffUser | null | undefined, permission: string): boolean {\n return user?.permissions.includes(permission) ?? false;\n },\n\n /**\n * The stable user-and-organization key: pass it as `createAuthBridge({ getIdentity })` so a refreshed session\n * keeps its caches and a person or organization switch drops them.\n */\n identity(user: BffUser): string {\n return `${user.person.sub}\\u0000${user.organization?.id ?? ''}`;\n },\n\n /** The session end as epoch milliseconds; `null` when the server sent none that parses. */\n expiresAtM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AA,EACnE;AACF;"}
1
+ {"version":3,"file":"BffSession.js","sources":["../../src/auth/BffSession.ts"],"sourcesContent":["import { ApiFailureFactory, type ApiFailure } from '../foundation/http';\nimport { ResultExtensions, type Result } from '../foundation/results';\n\n/** Defines the signed-in person a BFF session names. */\nexport interface BffPerson {\n /** The stable subject id — the identity key, never the display name. */\n readonly sub: string;\n readonly name: string | null;\n /**\n * The link to the person's picture (the ID token's `picture`); `null` without one or without the `profile` scope.\n * Bind it to `AccountMenu`'s `avatarSrc` as is — the avatar shows initials while it is `null` or fails to load.\n */\n readonly picture: string | null;\n readonly email: string | null;\n readonly phoneNumber: string | null;\n}\n\n/** Defines the organization the session acts in, and the person's role there. */\nexport interface BffOrganization {\n readonly id: string;\n readonly role: string;\n}\n\n/**\n * Defines the user a BFF session resolves to. The CSRF token is deliberately absent: it never renders, so the\n * strategy keeps it and the HTTP layer echoes it.\n */\nexport interface BffUser {\n readonly person: BffPerson;\n /** `null` for a person acting in no organization. */\n readonly organization: BffOrganization | null;\n readonly permissions: readonly string[];\n /** When the session ends (ISO 8601); `null` when the server sent none that parses. */\n readonly expiresAt: string | null;\n}\n\n/** Defines one decoded `GET {prefix}/session` response. */\nexport interface BffSessionSnapshot {\n /** `null` while signed out. */\n readonly user: BffUser | null;\n /** The token unsafe requests echo; `null` while signed out. */\n readonly csrfToken: string | null;\n}\n\n/** Defines one decoded `POST {prefix}/sign-out` response. */\nexport interface BffSignOut {\n /** Where the page navigates to end the identity provider's session. */\n readonly endSessionUrl: string;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\nconst isText = (value: unknown): value is string => typeof value === 'string' && value !== '';\n/** Reads an optional text field; anything but text reads as absent. */\nconst optionalText = (value: unknown): string | null => (typeof value === 'string' ? value : null);\n/** Reads an optional link; anything but non-blank text reads as absent, since an empty link names no resource. */\nconst optionalLink = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value.trim() : null;\nconst protocol = (): ApiFailure => ApiFailureFactory.create('protocol');\n\n/** Decodes the session response; a payload that breaks the contract is a `protocol` failure. */\nexport function decodeBffSession(value: unknown): Result<BffSessionSnapshot, ApiFailure> {\n if (!isRecord(value) || typeof value['isAuthenticated'] !== 'boolean') return ResultExtensions.fail(protocol());\n if (!value['isAuthenticated']) return ResultExtensions.ok({ user: null, csrfToken: null });\n\n const person = value['person'];\n const organization = value['organization'];\n const permissions = value['permissions'] ?? [];\n const expiresAt = value['expiresAt'];\n if (!isRecord(person) || !isText(person['sub']) || !isText(value['csrfToken'])) {\n return ResultExtensions.fail(protocol());\n }\n if (organization != null && (!isRecord(organization) || !isText(organization['id']))) {\n return ResultExtensions.fail(protocol());\n }\n if (!Array.isArray(permissions) || !permissions.every(isText)) return ResultExtensions.fail(protocol());\n\n return ResultExtensions.ok({\n csrfToken: value['csrfToken'],\n user: {\n person: {\n sub: person['sub'],\n name: optionalText(person['name']),\n picture: optionalLink(person['picture']),\n email: optionalText(person['email']),\n phoneNumber: optionalText(person['phoneNumber']),\n },\n organization: isRecord(organization)\n ? { id: organization['id'] as string, role: optionalText(organization['role']) ?? '' }\n : null,\n permissions: Object.freeze([...(permissions as string[])]),\n expiresAt: typeof expiresAt === 'string' && Number.isFinite(Date.parse(expiresAt)) ? expiresAt : null,\n },\n });\n}\n\n/** Whether a page may navigate to `url` to end the provider session: a local path, or an absolute http(s) URL. */\nfunction isNavigable(url: string): boolean {\n if (url.startsWith('/')) return !url.startsWith('//') && !url.includes('\\\\');\n try {\n const { protocol: scheme } = new URL(url);\n return scheme === 'https:' || scheme === 'http:';\n } catch {\n return false;\n }\n}\n\n/** Decodes the logout response; an end-session URL the page may not navigate to is a `protocol` failure. */\nexport function decodeBffSignOut(value: unknown): Result<BffSignOut, ApiFailure> {\n if (!isRecord(value) || !isText(value['endSessionUrl']) || !isNavigable(value['endSessionUrl'])) {\n return ResultExtensions.fail(protocol());\n }\n return ResultExtensions.ok({ endSessionUrl: value['endSessionUrl'] });\n}\n\n/** Extends a {@link BffUser} with the checks a screen and a bridge need. */\nexport const BffSessionExtensions = {\n /** Whether the user holds `permission`; `false` while signed out. */\n hasPermission(user: BffUser | null | undefined, permission: string): boolean {\n return user?.permissions.includes(permission) ?? false;\n },\n\n /**\n * The stable user-and-organization key: pass it as `createAuthBridge({ getIdentity })` so a refreshed session\n * keeps its caches and a person or organization switch drops them.\n */\n identity(user: BffUser): string {\n return `${user.person.sub}\\u0000${user.organization?.id ?? ''}`;\n },\n\n /** The session end as epoch milliseconds; `null` when the server sent none that parses. */\n expiresAtMs(user: BffUser): number | null {\n return user.expiresAt === null ? null : Date.parse(user.expiresAt);\n },\n} as const;\n"],"names":[],"mappings":";;AAkDA,MAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACrE,MAAM,SAAS,CAAC,UAAoC,OAAO,UAAU,YAAY,UAAU;AAE3F,MAAM,eAAe,CAAC,UAAmC,OAAO,UAAU,WAAW,QAAQ;AAE7F,MAAM,eAAe,CAAC,UACpB,OAAO,UAAU,YAAY,MAAM,KAAA,MAAW,KAAK,MAAM,KAAA,IAAS;AACpE,MAAM,WAAW,MAAkB,kBAAkB,OAAO,UAAU;AAG/D,SAAS,iBAAiB,OAAwD;AACvF,MAAI,CAAC,SAAS,KAAK,KAAK,OAAO,MAAM,iBAAiB,MAAM,UAAW,QAAO,iBAAiB,KAAK,UAAU;AAC9G,MAAI,CAAC,MAAM,iBAAiB,EAAG,QAAO,iBAAiB,GAAG,EAAE,MAAM,MAAM,WAAW,KAAA,CAAM;AAEzF,QAAM,SAAS,MAAM,QAAQ;AAC7B,QAAM,eAAe,MAAM,cAAc;AACzC,QAAM,cAAc,MAAM,aAAa,KAAK,CAAA;AAC5C,QAAM,YAAY,MAAM,WAAW;AACnC,MAAI,CAAC,SAAS,MAAM,KAAK,CAAC,OAAO,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,MAAM,WAAW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AAC,KAAK,CAAC,YAAY,MAAM,eAAe,CAAC,GAAG;AAC/F,WAAO,iBAAiB,KAAK,UAAU;AAAA,EACzC;AACA,SAAO,iBAAiB,GAAG,EAAE,eAAe,MAAM,eAAe,GAAG;AACtE;AAGO,MAAM,uBAAuB;AAAA;AAAA,EAElC,cAAc,MAAkC,YAA6B;AAC3E,WAAO,MAAM,YAAY,SAAS,UAAU,KAAK;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAS,MAAuB;AAC9B,WAAO,GAAG,KAAK,OAAO,GAAG,KAAS,KAAK,cAAc,MAAM,EAAE;AAAA,EAC/D;AAAA;AAAA,EAGA,YAAY,MAA8B;AACxC,WAAO,KAAK,cAAc,OAAO,OAAO,KAAK,MAAM,KAAK,SAAS;AAAA,EACnE;AACF;"}
@@ -0,0 +1,30 @@
1
+ import { ShallowRef } from 'vue';
2
+ /**
3
+ * Answers with the version the host serves now: the API's status call where the app and its API ship in one image,
4
+ * else a `version.json` the build writes beside `index.html`, read with `cache: 'no-store'`. An empty answer or a
5
+ * failure keeps the last version.
6
+ */
7
+ export type RunningVersionSource = () => Promise<string | null | undefined> | string | null | undefined;
8
+ /** Tunes how often the running version is read. */
9
+ export interface RunningVersionOptions {
10
+ /** The gap (ms) between reads while the tab is visible and online. Default five minutes. */
11
+ readonly intervalMs?: number;
12
+ }
13
+ /** The live view a scope gets over the version its host serves. */
14
+ export interface RunningVersionHandle {
15
+ /** The version the host served at the last successful read; `null` until one succeeds. */
16
+ readonly version: Readonly<ShallowRef<string | null>>;
17
+ /** Reads now, outside the schedule — after a deployment the app itself started, say. */
18
+ readonly refresh: () => Promise<void>;
19
+ }
20
+ /**
21
+ * Follows the version the host serves while this tab stays open, so a badge can tell a reader that the tab runs an
22
+ * older build than the one deployed. It reads once on mount, then on an interval, and at once when the tab returns
23
+ * from hidden or offline; the loop stops with the scope. The bundle's own version is a build-time constant and
24
+ * cannot know about a later deployment, so the two are compared where they are shown (`VersionBadge`).
25
+ *
26
+ * @param load - The read; see `RunningVersionSource`.
27
+ * @param options - The interval.
28
+ * @returns The served version and a manual `refresh`.
29
+ */
30
+ export declare function useRunningVersion(load: RunningVersionSource, options?: RunningVersionOptions): RunningVersionHandle;
@@ -0,0 +1,19 @@
1
+ import { shallowRef } from "vue";
2
+ import { usePolling } from "./UsePolling.js";
3
+ const DefaultIntervalMs = 5 * 6e4;
4
+ function useRunningVersion(load, options = {}) {
5
+ const version = shallowRef(null);
6
+ async function refresh() {
7
+ try {
8
+ const next = await load();
9
+ if (typeof next === "string" && next.trim() !== "") version.value = next.trim();
10
+ } catch {
11
+ }
12
+ }
13
+ usePolling(refresh, { intervalMs: options.intervalMs ?? DefaultIntervalMs, immediate: true });
14
+ return { version, refresh };
15
+ }
16
+ export {
17
+ useRunningVersion
18
+ };
19
+ //# sourceMappingURL=UseRunningVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseRunningVersion.js","sources":["../../../../src/foundation/net/hooks/UseRunningVersion.ts"],"sourcesContent":["import { shallowRef, type ShallowRef } from 'vue';\n\nimport { usePolling } from './UsePolling';\n\n/**\n * Answers with the version the host serves now: the API's status call where the app and its API ship in one image,\n * else a `version.json` the build writes beside `index.html`, read with `cache: 'no-store'`. An empty answer or a\n * failure keeps the last version.\n */\nexport type RunningVersionSource = () => Promise<string | null | undefined> | string | null | undefined;\n\n/** Tunes how often the running version is read. */\nexport interface RunningVersionOptions {\n /** The gap (ms) between reads while the tab is visible and online. Default five minutes. */\n readonly intervalMs?: number;\n}\n\n/** The live view a scope gets over the version its host serves. */\nexport interface RunningVersionHandle {\n /** The version the host served at the last successful read; `null` until one succeeds. */\n readonly version: Readonly<ShallowRef<string | null>>;\n\n /** Reads now, outside the schedule — after a deployment the app itself started, say. */\n readonly refresh: () => Promise<void>;\n}\n\n/** @internal Five minutes: a deployment shows in an open tab within one coffee, at twelve small reads an hour. */\nconst DefaultIntervalMs = 5 * 60_000;\n\n/**\n * Follows the version the host serves while this tab stays open, so a badge can tell a reader that the tab runs an\n * older build than the one deployed. It reads once on mount, then on an interval, and at once when the tab returns\n * from hidden or offline; the loop stops with the scope. The bundle's own version is a build-time constant and\n * cannot know about a later deployment, so the two are compared where they are shown (`VersionBadge`).\n *\n * @param load - The read; see `RunningVersionSource`.\n * @param options - The interval.\n * @returns The served version and a manual `refresh`.\n */\nexport function useRunningVersion(\n load: RunningVersionSource,\n options: RunningVersionOptions = {},\n): RunningVersionHandle {\n const version = shallowRef<string | null>(null);\n\n async function refresh(): Promise<void> {\n try {\n const next = await load();\n if (typeof next === 'string' && next.trim() !== '') version.value = next.trim();\n } catch {\n /* A failed read says nothing about the version; the last answer stands. */\n }\n }\n\n usePolling(refresh, { intervalMs: options.intervalMs ?? DefaultIntervalMs, immediate: true });\n\n return { version, refresh };\n}\n"],"names":[],"mappings":";;AA2BA,MAAM,oBAAoB,IAAI;AAYvB,SAAS,kBACd,MACA,UAAiC,IACX;AACtB,QAAM,UAAU,WAA0B,IAAI;AAE9C,iBAAe,UAAyB;AACtC,QAAI;AACF,YAAM,OAAO,MAAM,KAAA;AACnB,UAAI,OAAO,SAAS,YAAY,KAAK,KAAA,MAAW,GAAI,SAAQ,QAAQ,KAAK,KAAA;AAAA,IAC3E,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,aAAW,SAAS,EAAE,YAAY,QAAQ,cAAc,mBAAmB,WAAW,MAAM;AAE5F,SAAO,EAAE,SAAS,QAAA;AACpB;"}
@@ -6,4 +6,5 @@ export { createSocketClient, type SocketClient, type SocketClientOptions, type S
6
6
  export { useSocket, type SocketHandle } from './hooks/UseSocket';
7
7
  export { PollerState, createPoller, type PollFn, type Poller, type PollerOptions } from './CreatePoller';
8
8
  export { usePolling, type PollingHandle } from './hooks/UsePolling';
9
+ export { useRunningVersion, type RunningVersionHandle, type RunningVersionOptions, type RunningVersionSource, } from './hooks/UseRunningVersion';
9
10
  export { readOnlineStatus, subscribeOnline, waitForOnline, type WaitForOnlineOptions } from './Liveness';
@@ -6,6 +6,7 @@ import { createSocketClient } from "./CreateSocketClient.js";
6
6
  import { useSocket } from "./hooks/UseSocket.js";
7
7
  import { PollerState, createPoller } from "./CreatePoller.js";
8
8
  import { usePolling } from "./hooks/UsePolling.js";
9
+ import { useRunningVersion } from "./hooks/UseRunningVersion.js";
9
10
  import { readOnlineStatus, subscribeOnline, waitForOnline } from "./Liveness.js";
10
11
  export {
11
12
  ConnectionState,
@@ -22,6 +23,7 @@ export {
22
23
  subscribeOnline,
23
24
  useEventStream,
24
25
  usePolling,
26
+ useRunningVersion,
25
27
  useSocket,
26
28
  waitForOnline
27
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -13,5 +13,11 @@ export interface StorageBroker {
13
13
  * swallowed. Never throws, so a caller never has to guard the storage call.
14
14
  */
15
15
  export declare const localStorageStorageBroker: StorageBroker;
16
+ /**
17
+ * The tab-scoped broker — the {@link localStorageStorageBroker} contract over the browser's `sessionStorage`: the value
18
+ * lives as long as the tab, survives its reloads, and is never shared with another tab, so nothing syncs across tabs.
19
+ * SSR-safe and failure-tolerant the same way; never throws.
20
+ */
21
+ export declare const sessionStorageStorageBroker: StorageBroker;
16
22
  /** Builds an isolated in-memory `StorageBroker` backed by a `Map` — the test double: no cross-tab sync, no DOM. */
17
23
  export declare function memoryStorageBroker(): StorageBroker;
@@ -1,45 +1,49 @@
1
- function resolveLocalStorage() {
1
+ function resolveWebStorage(area) {
2
2
  if (typeof window === "undefined") return null;
3
3
  try {
4
- return window.localStorage;
4
+ return window[area] ?? null;
5
5
  } catch {
6
6
  return null;
7
7
  }
8
8
  }
9
- const localStorageStorageBroker = {
10
- read(key) {
11
- const store = resolveLocalStorage();
12
- if (store === null) return null;
13
- try {
14
- const raw = store.getItem(key);
15
- return raw === null ? null : JSON.parse(raw);
16
- } catch {
17
- return null;
18
- }
19
- },
20
- write(key, value) {
21
- const store = resolveLocalStorage();
22
- if (store === null) return false;
23
- try {
24
- const serialized = JSON.stringify(value);
25
- if (serialized === void 0) return false;
26
- store.setItem(key, serialized);
27
- return true;
28
- } catch {
29
- return false;
30
- }
31
- },
32
- remove(key) {
33
- const store = resolveLocalStorage();
34
- if (store === null) return false;
35
- try {
36
- store.removeItem(key);
37
- return true;
38
- } catch {
39
- return false;
9
+ function webStorageBroker(area) {
10
+ return {
11
+ read(key) {
12
+ const store = resolveWebStorage(area);
13
+ if (store === null) return null;
14
+ try {
15
+ const raw = store.getItem(key);
16
+ return raw === null ? null : JSON.parse(raw);
17
+ } catch {
18
+ return null;
19
+ }
20
+ },
21
+ write(key, value) {
22
+ const store = resolveWebStorage(area);
23
+ if (store === null) return false;
24
+ try {
25
+ const serialized = JSON.stringify(value);
26
+ if (serialized === void 0) return false;
27
+ store.setItem(key, serialized);
28
+ return true;
29
+ } catch {
30
+ return false;
31
+ }
32
+ },
33
+ remove(key) {
34
+ const store = resolveWebStorage(area);
35
+ if (store === null) return false;
36
+ try {
37
+ store.removeItem(key);
38
+ return true;
39
+ } catch {
40
+ return false;
41
+ }
40
42
  }
41
- }
42
- };
43
+ };
44
+ }
45
+ const localStorageStorageBroker = webStorageBroker("localStorage");
46
+ const sessionStorageStorageBroker = webStorageBroker("sessionStorage");
43
47
  function memoryStorageBroker() {
44
48
  const store = /* @__PURE__ */ new Map();
45
49
  return {
@@ -70,6 +74,7 @@ function memoryStorageBroker() {
70
74
  }
71
75
  export {
72
76
  localStorageStorageBroker,
73
- memoryStorageBroker
77
+ memoryStorageBroker,
78
+ sessionStorageStorageBroker
74
79
  };
75
80
  //# sourceMappingURL=StorageBroker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StorageBroker.js","sources":["../../../src/foundation/storage/StorageBroker.ts"],"sourcesContent":["// Generic, domain-agnostic client-side persistence seam. A `StorageBroker` is the sole surface the\n// persistence hooks touch, so a component tree can swap `localStorage` for an in-memory map (tests) or a\n// no-op (SSR) without any hook change. JSON is the wire format; every method is failure-tolerant — a quota,\n// serialization, or parse error degrades to a miss, never a throw.\n\n/** Defines a JSON key/value persistence seam the storage hooks read and write through. */\nexport interface StorageBroker {\n /** Reads and parses the value stored under `key`, or null when absent or unreadable. */\n read<T>(key: string): T | null;\n\n /** Serializes and writes `value`; reports false when storage or serialization is unavailable. */\n write<T>(key: string, value: T): boolean;\n\n /** Removes any value stored under `key`; reports false when storage is unavailable. */\n remove(key: string): boolean;\n}\n\n/** Resolves the ambient `localStorage`, or null when unavailable — SSR, private mode, security exception. */\nfunction resolveLocalStorage(): Storage | null {\n // `typeof window === 'undefined'` guards SSR; the try/catch guards a `localStorage` getter that throws\n // (Safari private mode, sandboxed iframes) rather than merely being absent.\n if (typeof window === 'undefined') return null;\n\n try {\n return window.localStorage;\n } catch {\n return null;\n }\n}\n\n/**\n * The production broker — persists through the browser's `localStorage` as JSON, SSR-safe and failure-tolerant.\n * A read that is absent, malformed, or blocked returns null; a write that exceeds quota or fails to serialize is\n * swallowed. Never throws, so a caller never has to guard the storage call.\n */\nexport const localStorageStorageBroker: StorageBroker = {\n read<T>(key: string): T | null {\n const store = resolveLocalStorage();\n if (store === null) return null;\n\n try {\n const raw = store.getItem(key);\n return raw === null ? null : (JSON.parse(raw) as T);\n } catch {\n return null;\n }\n },\n\n write<T>(key: string, value: T): boolean {\n const store = resolveLocalStorage();\n if (store === null) return false;\n\n try {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) return false;\n store.setItem(key, serialized);\n return true;\n } catch {\n return false;\n }\n },\n\n remove(key: string): boolean {\n const store = resolveLocalStorage();\n if (store === null) return false;\n\n try {\n store.removeItem(key);\n return true;\n } catch {\n return false;\n }\n },\n};\n\n/** Builds an isolated in-memory `StorageBroker` backed by a `Map` — the test double: no cross-tab sync, no DOM. */\nexport function memoryStorageBroker(): StorageBroker {\n const store = new Map<string, string>();\n\n return {\n read<T>(key: string): T | null {\n const raw = store.get(key);\n if (raw === undefined) return null;\n\n try {\n return JSON.parse(raw) as T;\n } catch {\n return null;\n }\n },\n\n write<T>(key: string, value: T): boolean {\n try {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) return false;\n store.set(key, serialized);\n return true;\n } catch {\n return false;\n }\n },\n\n remove(key: string): boolean {\n store.delete(key);\n return true;\n },\n };\n}\n"],"names":[],"mappings":"AAkBA,SAAS,sBAAsC;AAG7C,MAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,MAAI;AACF,WAAO,OAAO;AAAA,EAChB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,MAAM,4BAA2C;AAAA,EACtD,KAAQ,KAAuB;AAC7B,UAAM,QAAQ,oBAAA;AACd,QAAI,UAAU,KAAM,QAAO;AAE3B,QAAI;AACF,YAAM,MAAM,MAAM,QAAQ,GAAG;AAC7B,aAAO,QAAQ,OAAO,OAAQ,KAAK,MAAM,GAAG;AAAA,IAC9C,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAS,KAAa,OAAmB;AACvC,UAAM,QAAQ,oBAAA;AACd,QAAI,UAAU,KAAM,QAAO;AAE3B,QAAI;AACF,YAAM,aAAa,KAAK,UAAU,KAAK;AACvC,UAAI,eAAe,OAAW,QAAO;AACrC,YAAM,QAAQ,KAAK,UAAU;AAC7B,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,OAAO,KAAsB;AAC3B,UAAM,QAAQ,oBAAA;AACd,QAAI,UAAU,KAAM,QAAO;AAE3B,QAAI;AACF,YAAM,WAAW,GAAG;AACpB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAGO,SAAS,sBAAqC;AACnD,QAAM,4BAAY,IAAA;AAElB,SAAO;AAAA,IACL,KAAQ,KAAuB;AAC7B,YAAM,MAAM,MAAM,IAAI,GAAG;AACzB,UAAI,QAAQ,OAAW,QAAO;AAE9B,UAAI;AACF,eAAO,KAAK,MAAM,GAAG;AAAA,MACvB,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IAEA,MAAS,KAAa,OAAmB;AACvC,UAAI;AACF,cAAM,aAAa,KAAK,UAAU,KAAK;AACvC,YAAI,eAAe,OAAW,QAAO;AACrC,cAAM,IAAI,KAAK,UAAU;AACzB,eAAO;AAAA,MACT,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IAEA,OAAO,KAAsB;AAC3B,YAAM,OAAO,GAAG;AAChB,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"StorageBroker.js","sources":["../../../src/foundation/storage/StorageBroker.ts"],"sourcesContent":["// Generic, domain-agnostic client-side persistence seam. A `StorageBroker` is the sole surface the\n// persistence hooks touch, so a component tree can swap `localStorage` for an in-memory map (tests) or a\n// no-op (SSR) without any hook change. JSON is the wire format; every method is failure-tolerant — a quota,\n// serialization, or parse error degrades to a miss, never a throw.\n\n/** Defines a JSON key/value persistence seam the storage hooks read and write through. */\nexport interface StorageBroker {\n /** Reads and parses the value stored under `key`, or null when absent or unreadable. */\n read<T>(key: string): T | null;\n\n /** Serializes and writes `value`; reports false when storage or serialization is unavailable. */\n write<T>(key: string, value: T): boolean;\n\n /** Removes any value stored under `key`; reports false when storage is unavailable. */\n remove(key: string): boolean;\n}\n\n/** Names a Web Storage area on `window`: `localStorage` outlives the tab, `sessionStorage` ends with it. */\ntype WebStorageArea = 'localStorage' | 'sessionStorage';\n\n/** Resolves the ambient storage `area`, or null when unavailable — SSR, private mode, security exception. */\nfunction resolveWebStorage(area: WebStorageArea): Storage | null {\n // `typeof window === 'undefined'` guards SSR; the try/catch guards a storage getter that throws\n // (Safari private mode, sandboxed iframes, blocked site data) rather than merely being absent.\n if (typeof window === 'undefined') return null;\n\n try {\n return window[area] ?? null;\n } catch {\n return null;\n }\n}\n\n/** Builds a JSON broker over one Web Storage area, resolved per call and never cached: a blocked store is a miss. */\nfunction webStorageBroker(area: WebStorageArea): StorageBroker {\n return {\n read<T>(key: string): T | null {\n const store = resolveWebStorage(area);\n if (store === null) return null;\n\n try {\n const raw = store.getItem(key);\n return raw === null ? null : (JSON.parse(raw) as T);\n } catch {\n return null;\n }\n },\n\n write<T>(key: string, value: T): boolean {\n const store = resolveWebStorage(area);\n if (store === null) return false;\n\n try {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) return false;\n store.setItem(key, serialized);\n return true;\n } catch {\n return false;\n }\n },\n\n remove(key: string): boolean {\n const store = resolveWebStorage(area);\n if (store === null) return false;\n\n try {\n store.removeItem(key);\n return true;\n } catch {\n return false;\n }\n },\n };\n}\n\n/**\n * The production broker — persists through the browser's `localStorage` as JSON, SSR-safe and failure-tolerant.\n * A read that is absent, malformed, or blocked returns null; a write that exceeds quota or fails to serialize is\n * swallowed. Never throws, so a caller never has to guard the storage call.\n */\nexport const localStorageStorageBroker: StorageBroker = webStorageBroker('localStorage');\n\n/**\n * The tab-scoped broker — the {@link localStorageStorageBroker} contract over the browser's `sessionStorage`: the value\n * lives as long as the tab, survives its reloads, and is never shared with another tab, so nothing syncs across tabs.\n * SSR-safe and failure-tolerant the same way; never throws.\n */\nexport const sessionStorageStorageBroker: StorageBroker = webStorageBroker('sessionStorage');\n\n/** Builds an isolated in-memory `StorageBroker` backed by a `Map` — the test double: no cross-tab sync, no DOM. */\nexport function memoryStorageBroker(): StorageBroker {\n const store = new Map<string, string>();\n\n return {\n read<T>(key: string): T | null {\n const raw = store.get(key);\n if (raw === undefined) return null;\n\n try {\n return JSON.parse(raw) as T;\n } catch {\n return null;\n }\n },\n\n write<T>(key: string, value: T): boolean {\n try {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) return false;\n store.set(key, serialized);\n return true;\n } catch {\n return false;\n }\n },\n\n remove(key: string): boolean {\n store.delete(key);\n return true;\n },\n };\n}\n"],"names":[],"mappings":"AAqBA,SAAS,kBAAkB,MAAsC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OAAmB;AACvC,UAAI;AACF,cAAM,aAAa,KAAK,UAAU,KAAK;AACvC,YAAI,eAAe,OAAW,QAAO;AACrC,cAAM,IAAI,KAAK,UAAU;AACzB,eAAO;AAAA,MACT,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IAEA,OAAO,KAAsB;AAC3B,YAAM,OAAO,GAAG;AAChB,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;"}
@@ -1,4 +1,4 @@
1
- export { type StorageBroker, localStorageStorageBroker, memoryStorageBroker } from './StorageBroker';
1
+ export { type StorageBroker, localStorageStorageBroker, memoryStorageBroker, sessionStorageStorageBroker, } from './StorageBroker';
2
2
  export { namespacedBroker } from './NamespacedBroker';
3
3
  export { type PersistentDecoder, type PersistentRefOptions, createPersistentRef } from './PersistentRef';
4
4
  export { type Migration, type MigrationMap, type VersionedStore, type VersionedStoreOptions, createVersionedStore, } from './VersionedStore';
@@ -1,4 +1,4 @@
1
- import { localStorageStorageBroker, memoryStorageBroker } from "./StorageBroker.js";
1
+ import { localStorageStorageBroker, memoryStorageBroker, sessionStorageStorageBroker } from "./StorageBroker.js";
2
2
  import { namespacedBroker } from "./NamespacedBroker.js";
3
3
  import { createPersistentRef } from "./PersistentRef.js";
4
4
  import { createVersionedStore } from "./VersionedStore.js";
@@ -12,6 +12,7 @@ export {
12
12
  memoryStorageBroker,
13
13
  namespacedBroker,
14
14
  prependRecent,
15
+ sessionStorageStorageBroker,
15
16
  useAutosave,
16
17
  usePersistentState,
17
18
  useRecentItems
@@ -109,6 +109,26 @@ const platformAmbient = {
109
109
  "radial-gradient(ellipse 58rem 42rem at 100% 10%, #aa854d1a, transparent 74%)"
110
110
  ].join(", ")
111
111
  };
112
+ const platformGlass = {
113
+ light: {
114
+ fill: "#ffffffdb",
115
+ sideFill: "transparent",
116
+ blur: "16px",
117
+ edge: "#24433224",
118
+ highlight: "#ffffffd9",
119
+ shadow: "0 10px 30px #203b2910",
120
+ bottomShadow: "0 -10px 30px #203b2910"
121
+ },
122
+ dark: {
123
+ fill: "#1b2420e6",
124
+ sideFill: "transparent",
125
+ blur: "16px",
126
+ edge: "#c1dfcb26",
127
+ highlight: "#d5ead91a",
128
+ shadow: "0 12px 32px #00000024",
129
+ bottomShadow: "0 -12px 32px #00000024"
130
+ }
131
+ };
112
132
  const platform = {
113
133
  id: "platform",
114
134
  name: "Platform",
@@ -117,6 +137,7 @@ const platform = {
117
137
  light: platformLight,
118
138
  dark: platformDark,
119
139
  ambient: platformAmbient,
140
+ glass: platformGlass,
120
141
  status: ThemeStatus.Validated,
121
142
  meta: validateTheme({ light: platformLight, dark: platformDark })
122
143
  };