@wow-two-beta/fe 0.0.41 → 0.0.42
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/dist/auth/BffSession.d.ts +5 -0
- package/dist/auth/BffSession.js +2 -0
- package/dist/auth/BffSession.js.map +1 -1
- package/dist/foundation/storage/StorageBroker.d.ts +6 -0
- package/dist/foundation/storage/StorageBroker.js +41 -36
- package/dist/foundation/storage/StorageBroker.js.map +1 -1
- package/dist/foundation/storage/index.d.ts +1 -1
- package/dist/foundation/storage/index.js +2 -1
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +6 -3
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.js +20 -5
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
}
|
package/dist/auth/BffSession.js
CHANGED
|
@@ -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 expiresAtMs(user: BffUser): number | null {\n return user.expiresAt === null ? null : Date.parse(user.expiresAt);\n },\n} as const;\n"],"names":[],"mappings":";;
|
|
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,WA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AwB,CAAC;AAAA,MACzD,WAAW,OAAO,cAAc,YAAY,OAAO,SAAS,KAAK,MAAM,SAAS,CAAC,IAAI,YAAY;AAAA,IAAA;AAAA,EACnG,CACD;AACH;AAGA,SAAS,YAAY,KAAsB;AACzC,MAAI,IAAI,WAAW,GAAG,EAAG,QAAO,CAAC,IAAI,WAAW,IAAI,KAAK,CAAC,IAAI,SAAS,IAAI;AAC3E,MAAI;AACF,UAAM,EAAE,UAAU,OAAA,IAAW,IAAI,IAAI,GAAG;AACxC,WAAO,WAAW,YAAY,WAAW;AAAA,EAC3C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,iBAAiB,OAAgD;AAC/E,MAAI,CAAC,SAAS,KAAK,KAAK,CAAC,OAAO,MAAM,eAAe,CAAC,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;"}
|
|
@@ -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
|
|
1
|
+
function resolveWebStorage(area) {
|
|
2
2
|
if (typeof window === "undefined") return null;
|
|
3
3
|
try {
|
|
4
|
-
return window
|
|
4
|
+
return window[area] ?? null;
|
|
5
5
|
} catch {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 `
|
|
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;AAG/D,MAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,MAAI;AACF,WAAO,OAAO,IAAI,KAAK;AAAA,EACzB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,SAAS,iBAAiB,MAAqC;AAC7D,SAAO;AAAA,IACL,KAAQ,KAAuB;AAC7B,YAAM,QAAQ,kBAAkB,IAAI;AACpC,UAAI,UAAU,KAAM,QAAO;AAE3B,UAAI;AACF,cAAM,MAAM,MAAM,QAAQ,GAAG;AAC7B,eAAO,QAA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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
|
|
@@ -32,8 +32,11 @@ export interface AccountMenuProps {
|
|
|
32
32
|
readonly name?: string;
|
|
33
33
|
/** The header's second line — the email or the role. */
|
|
34
34
|
readonly description?: string;
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The avatar image — a BFF session's `person.picture` binds as is. Without it (`null` included), or when it fails,
|
|
37
|
+
* the avatar shows the name's initials, or the person glyph without a name.
|
|
38
|
+
*/
|
|
39
|
+
readonly avatarSrc?: string | null;
|
|
37
40
|
/** The open state, controlled. The `v-model:open` binding target. */
|
|
38
41
|
readonly open?: boolean;
|
|
39
42
|
/** The initial open state when uncontrolled. Default `false`. */
|
|
@@ -113,7 +116,7 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<AccountMen
|
|
|
113
116
|
readonly organization: string;
|
|
114
117
|
readonly isBusy: boolean;
|
|
115
118
|
readonly triggerLabel: string;
|
|
116
|
-
readonly avatarSrc: string;
|
|
119
|
+
readonly avatarSrc: string | null;
|
|
117
120
|
readonly showAppearance: boolean;
|
|
118
121
|
readonly locales: ReadonlyArray<AccountMenuLocale>;
|
|
119
122
|
readonly organizations: ReadonlyArray<AccountMenuOrganization>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useSlots, useAttrs, useTemplateRef, inject, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, mergeProps, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createTextVNode, Fragment, renderList, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, useSlots, useAttrs, useTemplateRef, inject, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, mergeProps, createSlots, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createTextVNode, Fragment, renderList, renderSlot } from "vue";
|
|
2
2
|
import { Monitor, Sun, Moon, UserRound, ChevronDown, Check, LogOut } from "lucide-vue-next";
|
|
3
3
|
import { dataAttr } from "../../../foundation/dom/DataAttr.js";
|
|
4
4
|
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
@@ -131,6 +131,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
131
131
|
if (blocked && isOpen.value) controlled.setValue(false);
|
|
132
132
|
});
|
|
133
133
|
const hasName = computed(() => (props.name ?? "").trim() !== "");
|
|
134
|
+
const pictureSrc = computed(() => {
|
|
135
|
+
const src = (props.avatarSrc ?? "").trim();
|
|
136
|
+
return src === "" ? void 0 : src;
|
|
137
|
+
});
|
|
134
138
|
const triggerName = computed(() => {
|
|
135
139
|
if (!hasName.value) return props.anonymousTriggerLabel;
|
|
136
140
|
const name = (props.name ?? "").trim();
|
|
@@ -228,15 +232,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
228
232
|
disabled: isBlocked.value,
|
|
229
233
|
"data-busy": unref(dataAttr)(unref(props).isBusy)
|
|
230
234
|
}, rest.value, { class: triggerClasses.value }), [
|
|
231
|
-
hasName.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
235
|
+
hasName.value || pictureSrc.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
232
236
|
key: 0,
|
|
233
|
-
name: unref(props).name,
|
|
234
|
-
src:
|
|
237
|
+
name: hasName.value ? unref(props).name : void 0,
|
|
238
|
+
src: pictureSrc.value,
|
|
235
239
|
alt: "",
|
|
236
240
|
size: "sm",
|
|
237
241
|
"is-loading": unref(props).isBusy,
|
|
238
242
|
"data-account-menu-avatar": ""
|
|
239
|
-
},
|
|
243
|
+
}, createSlots({ _: 2 }, [
|
|
244
|
+
!hasName.value ? {
|
|
245
|
+
name: "fallback",
|
|
246
|
+
fn: withCtx(() => [
|
|
247
|
+
createVNode(unref(_sfc_main$4), {
|
|
248
|
+
icon: unref(UserRound),
|
|
249
|
+
size: 18
|
|
250
|
+
}, null, 8, ["icon"])
|
|
251
|
+
]),
|
|
252
|
+
key: "0"
|
|
253
|
+
} : void 0
|
|
254
|
+
]), 1032, ["name", "src", "is-loading"])) : (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
240
255
|
createVNode(unref(_sfc_main$4), {
|
|
241
256
|
icon: unref(UserRound),
|
|
242
257
|
size: 18
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountMenu.vue.js","sources":["../../../../src/presentation/nav/accountMenu/AccountMenu.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { Placement } from '@floating-ui/vue';\nimport type { SurfaceVariant } from '../../../foundation/styles';\n\n/** Represents one interface language an `AccountMenu` offers. */\nexport interface AccountMenuLocale {\n /** The locale tag the `locale` model holds — `uz`, `ru`, `en-GB`; also the row's `lang`. */\n readonly value: string;\n\n /** The language's own name in its own language — `O‘zbekcha`, `Русский`, `English`. */\n readonly label: string;\n}\n\n/** Represents one organization the signed-in person belongs to. */\nexport interface AccountMenuOrganization {\n /** The stable identity the `organization` model holds. */\n readonly id: string;\n\n /** The organization name, already translated. */\n readonly label: string;\n\n /** One muted line beside the name — the person's role there, already translated. */\n readonly description?: string;\n}\n\n/** Represents one running service whose version the menu reports. */\nexport interface AccountMenuVersion {\n /** The service name, already translated — `Catalogue`, `API`. */\n readonly label: string;\n\n /** The running version — `0.1.3`, or the caller's translated placeholder while it loads. */\n readonly version: string;\n\n /** The commit the service was built from; the menu shows its first seven characters. */\n readonly commit?: string;\n}\n\n/** Defines props for the avatar menu that ends an app's top bar. */\nexport interface AccountMenuProps {\n /** The signed-in person's display name. Omitted, the trigger shows a person glyph and the header hides. */\n readonly name?: string;\n\n /** The header's second line — the email or the role. */\n readonly description?: string;\n\n /** The avatar image. Without it, or when it fails, the avatar shows the name's initials. */\n readonly avatarSrc?: string;\n\n /** The open state, controlled. The `v-model:open` binding target. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** The Floating UI placement. Default `bottom-end`, for a trigger at the end of the bar. */\n readonly placement?: Placement;\n\n /** The disabled state — the trigger cannot open the menu, and an open menu closes. */\n readonly isDisabled?: boolean;\n\n /** The busy state — a session or sign-out in flight; blocks the trigger like `isDisabled` and marks it busy. */\n readonly isBusy?: boolean;\n\n /** The appearance toggle — the system, light and dark rows. Default `true`; needs a `ColorModeProvider`. */\n readonly showAppearance?: boolean;\n\n /** The interface languages, in display order. Fewer than two hide the language rows. */\n readonly locales?: ReadonlyArray<AccountMenuLocale>;\n\n /** The current interface language's `value`. The `v-model:locale` binding target. */\n readonly locale?: string;\n\n /** The person's organizations, in display order. Fewer than two hide the switcher. */\n readonly organizations?: ReadonlyArray<AccountMenuOrganization>;\n\n /** The current organization's `id`. The `v-model:organization` binding target. */\n readonly organization?: string;\n\n /** Every running service's version, in display order — the frontend first, then each backend service. */\n readonly versions?: ReadonlyArray<AccountMenuVersion>;\n\n /**\n * Fires when the reader picks sign out.\n *\n * Kept a PROP, not an emit: its presence renders the sign-out row, and Vue strips a declared emit's\n * listener out of `useAttrs()`, so an emit could never be detected. Bind it as `@sign-out`.\n */\n readonly onSignOut?: () => unknown;\n\n /** The menu's accessible name. Default `\"Account\"`, localized. */\n readonly menuLabel?: string;\n\n /** The trigger's accessible name; `{name}` becomes the name. Default `\"Account menu for {name}\"`, localized. */\n readonly triggerLabel?: string;\n\n /** The trigger's accessible name without a `name`. Default `\"Account menu\"`, localized. */\n readonly anonymousTriggerLabel?: string;\n\n /** The appearance group heading. Default `\"Appearance\"`, localized. */\n readonly appearanceLabel?: string;\n\n /** The row that follows the device setting. Default `\"System\"`, localized. */\n readonly systemModeLabel?: string;\n\n /** The light row. Default `\"Light\"`, localized. */\n readonly lightModeLabel?: string;\n\n /** The dark row. Default `\"Dark\"`, localized. */\n readonly darkModeLabel?: string;\n\n /** The language group heading. Default `\"Language\"`, localized. */\n readonly languageLabel?: string;\n\n /** The organization group heading. Default `\"Organization\"`, localized. */\n readonly organizationLabel?: string;\n\n /** The versions group heading. Default `\"Versions\"`, localized. */\n readonly versionsLabel?: string;\n\n /** The sign-out row. Default `\"Sign out\"`, localized. */\n readonly signOutLabel?: string;\n\n /** The panel's surface recipe — `glass` or `glass-outline` for translucent chrome. Default the menu's own. */\n readonly variant?: SurfaceVariant;\n\n /** The panel class — the hook for an app's own material. */\n readonly panelClass?: HTMLAttributes['class'];\n}\n\n/** @internal The appearance rows' values; `system` hands the mode back to the device. */\nconst Appearance = {\n System: 'system',\n Light: 'light',\n Dark: 'dark',\n} as const;\n\ntype Appearance = (typeof Appearance)[keyof typeof Appearance];\n\n/** @internal The visible length of a commit hash. */\nconst CommitLength = 7;\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, inject, useAttrs, useTemplateRef, watch } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { Check, ChevronDown, LogOut, Monitor, Moon, Sun, UserRound } from 'lucide-vue-next';\nimport { dataAttr } from '../../../foundation/dom';\nimport { Icon, type IconAdapter } from '../../../foundation/icons';\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { useId } from '../../../foundation/identifiers';\nimport { ColorMode, ColorModeKey } from '../../../foundation/primitives';\nimport { useControlled } from '../../../foundation/state';\nimport { cn } from '../../../foundation/styles';\nimport Avatar from '../../display/avatar/Avatar.vue';\nimport DropdownMenu from '../dropdownMenu/DropdownMenu.vue';\nimport DropdownMenuContent from '../dropdownMenu/DropdownMenuContent.vue';\nimport DropdownMenuTrigger from '../dropdownMenu/DropdownMenuTrigger.vue';\nimport MenuGroup from '../menu/MenuGroup.vue';\nimport MenuItem from '../menu/MenuItem.vue';\nimport MenuRadioGroup from '../menu/MenuRadioGroup.vue';\nimport MenuRadioItem from '../menu/MenuRadioItem.vue';\nimport MenuSeparator from '../menu/MenuSeparator.vue';\n\n/**\n * Renders the account menu that ends an app's top bar: an avatar trigger that opens who is signed in, the\n * organization switcher, the caller's account destinations, the colour mode, the interface language, each\n * service's version and sign out — always last.\n */\ndefineOptions({ name: 'AccountMenu', inheritAttrs: false });\n\nconst slots = defineSlots<{\n /** The account-level destinations — `MenuItem` rows such as account settings, placed after the switcher. */\n items?(): unknown;\n}>();\n\nconst componentProps = withDefaults(defineProps<AccountMenuProps>(), {\n name: undefined,\n description: undefined,\n avatarSrc: undefined,\n open: undefined,\n defaultOpen: false,\n placement: 'bottom-end',\n isDisabled: false,\n isBusy: false,\n showAppearance: true,\n locales: () => [],\n locale: undefined,\n organizations: () => [],\n organization: undefined,\n versions: () => [],\n onSignOut: undefined,\n triggerLabel: undefined,\n variant: undefined,\n panelClass: undefined,\n});\n\nconst props = useLocaleDefaults(componentProps, 'AccountMenu', {\n menuLabel: 'Account',\n anonymousTriggerLabel: 'Account menu',\n appearanceLabel: 'Appearance',\n systemModeLabel: 'System',\n lightModeLabel: 'Light',\n darkModeLabel: 'Dark',\n languageLabel: 'Language',\n organizationLabel: 'Organization',\n versionsLabel: 'Versions',\n signOutLabel: 'Sign out',\n});\n\nconst emit = defineEmits<{\n /** Fires when the menu opens or closes — the `v-model:open` half. */\n 'update:open': [open: boolean];\n\n /** Fires when the reader picks another interface language — the `v-model:locale` half. */\n 'update:locale': [locale: string];\n\n /** Fires when the reader picks another organization — the `v-model:organization` half. */\n 'update:organization': [organization: string];\n}>();\n\nconst attrs = useAttrs();\nconst i18n = useLocale();\nconst identityId = useId('account-menu-identity');\nconst trigger = useTemplateRef<InstanceType<typeof DropdownMenuTrigger>>('trigger');\n\n/* Optional: without a provider the appearance rows hide instead of throwing. */\nconst colorMode = inject(ColorModeKey, null);\n\nconst controlled = useControlled<boolean>({\n controlled: () => props.open,\n default: () => props.defaultOpen,\n onChange: (value) => {\n emit('update:open', value);\n },\n});\n\nconst isOpen = controlled.value;\n\n/** Whether the trigger refuses to open the menu. */\nconst isBlocked = computed(() => props.isDisabled || props.isBusy);\n\nfunction setOpen(open: boolean): void {\n if (open && isBlocked.value) return;\n controlled.setValue(open);\n}\n\n/* A menu open when the trigger becomes disabled or busy closes, since nothing in it may act now. */\nwatch(isBlocked, (blocked) => {\n if (blocked && isOpen.value) controlled.setValue(false);\n});\n\nconst hasName = computed(() => (props.name ?? '').trim() !== '');\n\nconst triggerName = computed(() => {\n if (!hasName.value) return props.anonymousTriggerLabel;\n const name = (props.name ?? '').trim();\n return props.triggerLabel === undefined\n ? i18n.t('AccountMenu.triggerLabel', { name }, 'Account menu for {name}')\n : props.triggerLabel.replaceAll('{name}', name);\n});\n\nconst hasOrganizationSwitcher = computed(() => props.organizations.length > 1);\n\n/** The one organization a person belongs to, named in the header instead of a one-row switcher. */\nconst soleOrganization = computed(() => (props.organizations.length === 1 ? props.organizations[0] : undefined));\n\nconst hasIdentity = computed(() => hasName.value || Boolean(props.description) || soleOrganization.value !== undefined);\n\nconst hasAppearance = computed(() => props.showAppearance && colorMode !== null);\nconst hasLanguages = computed(() => props.locales.length > 1);\nconst hasVersions = computed(() => props.versions.length > 0);\nconst hasSignOut = computed(() => typeof props.onSignOut === 'function');\n\nconst appearances = computed((): ReadonlyArray<{ value: Appearance; label: string; icon: IconAdapter }> => [\n { value: Appearance.System, label: props.systemModeLabel, icon: Monitor },\n { value: Appearance.Light, label: props.lightModeLabel, icon: Sun },\n { value: Appearance.Dark, label: props.darkModeLabel, icon: Moon },\n]);\n\n/** The row the ambient mode marks: `system` while it follows the device, else the mode itself. */\nconst appearance = computed<Appearance | null>(() => {\n if (!colorMode) return null;\n if (colorMode.followsSystem) return Appearance.System;\n return colorMode.mode === ColorMode.Dark ? Appearance.Dark : Appearance.Light;\n});\n\nfunction chooseAppearance(value: string | null): void {\n if (!colorMode) return;\n if (value === Appearance.System) colorMode.followSystem();\n else if (value === Appearance.Light) colorMode.setMode(ColorMode.Light);\n else if (value === Appearance.Dark) colorMode.setMode(ColorMode.Dark);\n}\n\nfunction chooseLocale(value: string | null): void {\n if (value !== null && value !== props.locale) emit('update:locale', value);\n}\n\nfunction chooseOrganization(id: string | null): void {\n if (id !== null && id !== props.organization) emit('update:organization', id);\n}\n\nfunction signOut(): void {\n void props.onSignOut?.();\n}\n\nfunction shortCommit(commit: string): string {\n return commit.trim().slice(0, CommitLength);\n}\n\n/**\n * The sections present, in display order. Read during render, so a section that appears or a slot that is\n * added re-places every separator; a separator sits before each section but the first.\n */\nfunction sections(): ReadonlyArray<string> {\n return [\n hasIdentity.value && 'identity',\n hasOrganizationSwitcher.value && 'organizations',\n slots.items !== undefined && 'items',\n hasAppearance.value && 'appearance',\n hasLanguages.value && 'languages',\n hasVersions.value && 'versions',\n hasSignOut.value && 'signOut',\n ].filter((section): section is string => typeof section === 'string');\n}\n\nfunction isSeparated(section: string): boolean {\n return sections().indexOf(section) > 0;\n}\n\nconst triggerClasses = computed(() =>\n cn(\n 'group/account-menu inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-xl border border-transparent',\n 'py-1 ps-1 pe-2 text-foreground transition-colors motion-reduce:transition-none',\n 'hover:border-primary/15 hover:bg-primary-soft',\n 'data-[state=open]:border-primary/15 data-[state=open]:bg-primary-soft',\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60',\n attrs.class as ClassValue,\n ),\n);\n\n/* The panel fits a phone: never wider than the viewport, never taller than the space under a top bar, and\n scrolling inside itself when the sections outgrow it. As the scroll box it spans the surface's inline padding\n (`-mx-1 px-1`): a separator bleeds that padding to meet the surface edges, and inside a narrower scroll box the\n bleed overflowed it by 4px and drew a sideways scrollbar. The width adds the padding back, so the surface keeps\n its size. */\nconst panelClasses = computed(() =>\n cn(\n '-mx-1 flex w-[min(18.5rem,calc(100vw-1.5rem))] max-h-[calc(100dvh-5rem)] flex-col gap-0.5 px-1',\n 'overflow-y-auto overscroll-contain',\n props.panelClass as ClassValue,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** The trigger button. */\nconst el = computed(() => trigger.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <DropdownMenu :open=\"isOpen\" :placement=\"props.placement\" @update:open=\"setOpen\">\n <DropdownMenuTrigger ref=\"trigger\" as-child>\n <button\n type=\"button\"\n :aria-label=\"triggerName\"\n :aria-busy=\"props.isBusy || undefined\"\n :disabled=\"isBlocked\"\n :data-busy=\"dataAttr(props.isBusy)\"\n v-bind=\"rest\"\n :class=\"triggerClasses\"\n >\n <Avatar\n v-if=\"hasName\"\n :name=\"props.name\"\n :src=\"props.avatarSrc\"\n alt=\"\"\n size=\"sm\"\n :is-loading=\"props.isBusy\"\n data-account-menu-avatar\n />\n <span\n v-else\n aria-hidden=\"true\"\n class=\"grid size-8 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground\"\n data-account-menu-avatar\n >\n <Icon :icon=\"UserRound\" :size=\"18\" />\n </span>\n <Icon\n :icon=\"ChevronDown\"\n :size=\"14\"\n class=\"shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/account-menu:rotate-180 motion-reduce:transition-none\"\n data-account-menu-chevron\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n :aria-label=\"props.menuLabel\"\n :aria-describedby=\"hasIdentity ? identityId : undefined\"\n :variant=\"props.variant\"\n :class=\"panelClasses\"\n >\n <div v-if=\"hasIdentity\" :id=\"identityId\" class=\"min-w-0 px-2 py-1.5\" data-account-menu-identity>\n <p v-if=\"hasName\" class=\"truncate text-sm font-semibold text-foreground\">{{ props.name }}</p>\n <p v-if=\"props.description\" class=\"truncate text-xs text-muted-foreground\">{{ props.description }}</p>\n <p v-if=\"soleOrganization\" class=\"truncate text-xs text-muted-foreground\" data-account-menu-organization>\n {{ soleOrganization.label\n }}<template v-if=\"soleOrganization.description\"> · {{ soleOrganization.description }}</template>\n </p>\n </div>\n\n <template v-if=\"hasOrganizationSwitcher\">\n <MenuSeparator v-if=\"isSeparated('organizations')\" />\n <MenuRadioGroup\n :label=\"props.organizationLabel\"\n :model-value=\"props.organization ?? null\"\n data-account-menu-organizations\n @update:model-value=\"chooseOrganization\"\n >\n <!-- Many memberships scroll inside their own band, so appearance and sign out stay in reach. -->\n <div class=\"max-h-44 overflow-y-auto overscroll-contain\" data-account-menu-organization-list>\n <MenuRadioItem v-for=\"entry in props.organizations\" :key=\"entry.id\" :value=\"entry.id\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n <span class=\"min-w-0 truncate\">{{ entry.label }}</span>\n <span v-if=\"entry.description\" class=\"ms-auto shrink-0 text-xs text-muted-foreground\">\n {{ entry.description }}\n </span>\n </MenuRadioItem>\n </div>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"slots.items\">\n <MenuSeparator v-if=\"isSeparated('items')\" />\n <slot name=\"items\" />\n </template>\n\n <template v-if=\"hasAppearance\">\n <MenuSeparator v-if=\"isSeparated('appearance')\" />\n <MenuRadioGroup\n :label=\"props.appearanceLabel\"\n :model-value=\"appearance\"\n data-account-menu-appearance\n @update:model-value=\"chooseAppearance\"\n >\n <MenuRadioItem v-for=\"entry in appearances\" :key=\"entry.value\" :value=\"entry.value\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n <Icon :icon=\"entry.icon\" :size=\"15\" class=\"shrink-0 text-muted-foreground\" />\n {{ entry.label }}\n </MenuRadioItem>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"hasLanguages\">\n <MenuSeparator v-if=\"isSeparated('languages')\" />\n <MenuRadioGroup\n :label=\"props.languageLabel\"\n :model-value=\"props.locale ?? null\"\n data-account-menu-languages\n @update:model-value=\"chooseLocale\"\n >\n <MenuRadioItem v-for=\"entry in props.locales\" :key=\"entry.value\" :value=\"entry.value\" :lang=\"entry.value\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n {{ entry.label }}\n </MenuRadioItem>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"hasVersions\">\n <MenuSeparator v-if=\"isSeparated('versions')\" />\n <MenuGroup :label=\"props.versionsLabel\" data-account-menu-versions>\n <div\n v-for=\"(entry, index) in props.versions\"\n :key=\"`${index}:${entry.label}`\"\n class=\"flex items-baseline justify-between gap-3 px-2 py-0.5 text-xs\"\n data-account-menu-version\n >\n <span class=\"min-w-0 truncate text-muted-foreground\">{{ entry.label }}</span>\n <span class=\"shrink-0 font-mono tabular-nums text-foreground\"\n >{{ entry.version\n }}<span v-if=\"entry.commit\" class=\"text-muted-foreground\"> · {{ shortCommit(entry.commit) }}</span></span\n >\n </div>\n </MenuGroup>\n </template>\n\n <template v-if=\"hasSignOut\">\n <MenuSeparator v-if=\"isSeparated('signOut')\" />\n <MenuItem state=\"destructive\" data-account-menu-sign-out @select=\"signOut\">\n <Icon :icon=\"LogOut\" :size=\"15\" class=\"shrink-0\" />\n {{ props.signOutLabel }}\n </MenuItem>\n </template>\n </DropdownMenuContent>\n </DropdownMenu>\n</template>\n"],"names":["_useSlots","_createBlock","DropdownMenu","_unref","_createVNode","DropdownMenuTrigger","_createElementVNode","_mergeProps","Avatar","_openBlock","_createElementBlock","Icon","DropdownMenuContent","_toDisplayString","_createTextVNode","_Fragment","MenuSeparator","MenuRadioGroup","_renderList","MenuRadioItem","_withCtx","_renderSlot","MenuGroup","MenuItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIA,MAAM,aAAa;AAAA,EACjB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AACR;AAKA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BrB,UAAM,QAAQA,SAAA;AAKd,UAAM,iBAAiB;AAqBvB,UAAM,QAAQ,kBAAkB,gBAAgB,eAAe;AAAA,MAC7D,WAAW;AAAA,MACX,uBAAuB;AAAA,MACvB,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,eAAe;AAAA,MACf,cAAc;AAAA,IAAA,CACf;AAED,UAAM,OAAO;AAWb,UAAM,QAAQ,SAAA;AACd,UAAM,OAAO,UAAA;AACb,UAAM,aAAa,MAAM,uBAAuB;AAChD,UAAM,UAAU,eAAyD,SAAS;AAGlF,UAAM,YAAY,OAAO,cAAc,IAAI;AAE3C,UAAM,aAAa,cAAuB;AAAA,MACxC,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM,MAAM;AAAA,MACrB,UAAU,CAAC,UAAU;AACnB,aAAK,eAAe,KAAK;AAAA,MAC3B;AAAA,IAAA,CACD;AAED,UAAM,SAAS,WAAW;AAG1B,UAAM,YAAY,SAAS,MAAM,MAAM,cAAc,MAAM,MAAM;AAEjE,aAAS,QAAQ,MAAqB;AACpC,UAAI,QAAQ,UAAU,MAAO;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AAe,8BAAA;AAAA,gBAAA;mCAEpC,MAAwC;AAAA,qBAD1CM,UAAA,IAAA,GAAAC,mBAWMK,2BAVqBZ,MAAA,KAAA,EAAM,UAAQ,CAA/B,OAAO,UAAK;0CADtBO,mBAWM,OAAA;AAAA,wBATH,KAAG,GAAK,KAAK,IAAI,MAAM,KAAK;AAAA,wBAC7B,OAAM;AAAA,wBACN,6BAAA;AAAA,sBAAA;wBAEAJ,mBAA6E,QAA7E,aAA6EO,gBAArB,MAAM,KAAK,GAAA,CAAA;AAAA,wBACnEP,mBAGC,QAHD,aAGC;AAAA,0BAFKQ,gBAAAD,gBAAA,MAAM,OAAO,GAAA,CAAA;AAAA,0BACH,MAAM,uBAAlBH,mBAAiG,QAAjG,aAAwD,wBAAM,YAAY,MAAM,MAAM,CAAA,GAAA,CAAA;;;;;;;;cAMhF,WAAA,sBAAhBA,mBAMWK,UAAA,EAAA,KAAA,KAAA;AAAA,gBALY,YAAW,SAAA,kBAAhCd,YAA+Ce,aAAA,EAAA,KAAA,EAAA,CAAA;gBAC/CZ,YAGWmB,aAAA;AAAA,kBAHD,OAAM;AAAA,kBAAc,8BAAA;AAAA,kBAA4B,UAAQ;AAAA,gBAAA;mCAChE,MAAmD;AAAA,oBAAnDnB,YAAmDD,MAAAQ,WAAA,GAAA;AAAA,sBAA5C,MAAMR,MAAA,MAAA;AAAA,sBAAS,MAAM;AAAA,sBAAI,OAAM;AAAA,oBAAA;oCAAa,MACnDU,gBAAGV,MAAA,KAAA,EAAM,YAAY,GAAA,CAAA;AAAA,kBAAA;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"AccountMenu.vue.js","sources":["../../../../src/presentation/nav/accountMenu/AccountMenu.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { Placement } from '@floating-ui/vue';\nimport type { SurfaceVariant } from '../../../foundation/styles';\n\n/** Represents one interface language an `AccountMenu` offers. */\nexport interface AccountMenuLocale {\n /** The locale tag the `locale` model holds — `uz`, `ru`, `en-GB`; also the row's `lang`. */\n readonly value: string;\n\n /** The language's own name in its own language — `O‘zbekcha`, `Русский`, `English`. */\n readonly label: string;\n}\n\n/** Represents one organization the signed-in person belongs to. */\nexport interface AccountMenuOrganization {\n /** The stable identity the `organization` model holds. */\n readonly id: string;\n\n /** The organization name, already translated. */\n readonly label: string;\n\n /** One muted line beside the name — the person's role there, already translated. */\n readonly description?: string;\n}\n\n/** Represents one running service whose version the menu reports. */\nexport interface AccountMenuVersion {\n /** The service name, already translated — `Catalogue`, `API`. */\n readonly label: string;\n\n /** The running version — `0.1.3`, or the caller's translated placeholder while it loads. */\n readonly version: string;\n\n /** The commit the service was built from; the menu shows its first seven characters. */\n readonly commit?: string;\n}\n\n/** Defines props for the avatar menu that ends an app's top bar. */\nexport interface AccountMenuProps {\n /** The signed-in person's display name. Omitted, the trigger shows a person glyph and the header hides. */\n readonly name?: string;\n\n /** The header's second line — the email or the role. */\n readonly description?: string;\n\n /**\n * The avatar image — a BFF session's `person.picture` binds as is. Without it (`null` included), or when it fails,\n * the avatar shows the name's initials, or the person glyph without a name.\n */\n readonly avatarSrc?: string | null;\n\n /** The open state, controlled. The `v-model:open` binding target. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** The Floating UI placement. Default `bottom-end`, for a trigger at the end of the bar. */\n readonly placement?: Placement;\n\n /** The disabled state — the trigger cannot open the menu, and an open menu closes. */\n readonly isDisabled?: boolean;\n\n /** The busy state — a session or sign-out in flight; blocks the trigger like `isDisabled` and marks it busy. */\n readonly isBusy?: boolean;\n\n /** The appearance toggle — the system, light and dark rows. Default `true`; needs a `ColorModeProvider`. */\n readonly showAppearance?: boolean;\n\n /** The interface languages, in display order. Fewer than two hide the language rows. */\n readonly locales?: ReadonlyArray<AccountMenuLocale>;\n\n /** The current interface language's `value`. The `v-model:locale` binding target. */\n readonly locale?: string;\n\n /** The person's organizations, in display order. Fewer than two hide the switcher. */\n readonly organizations?: ReadonlyArray<AccountMenuOrganization>;\n\n /** The current organization's `id`. The `v-model:organization` binding target. */\n readonly organization?: string;\n\n /** Every running service's version, in display order — the frontend first, then each backend service. */\n readonly versions?: ReadonlyArray<AccountMenuVersion>;\n\n /**\n * Fires when the reader picks sign out.\n *\n * Kept a PROP, not an emit: its presence renders the sign-out row, and Vue strips a declared emit's\n * listener out of `useAttrs()`, so an emit could never be detected. Bind it as `@sign-out`.\n */\n readonly onSignOut?: () => unknown;\n\n /** The menu's accessible name. Default `\"Account\"`, localized. */\n readonly menuLabel?: string;\n\n /** The trigger's accessible name; `{name}` becomes the name. Default `\"Account menu for {name}\"`, localized. */\n readonly triggerLabel?: string;\n\n /** The trigger's accessible name without a `name`. Default `\"Account menu\"`, localized. */\n readonly anonymousTriggerLabel?: string;\n\n /** The appearance group heading. Default `\"Appearance\"`, localized. */\n readonly appearanceLabel?: string;\n\n /** The row that follows the device setting. Default `\"System\"`, localized. */\n readonly systemModeLabel?: string;\n\n /** The light row. Default `\"Light\"`, localized. */\n readonly lightModeLabel?: string;\n\n /** The dark row. Default `\"Dark\"`, localized. */\n readonly darkModeLabel?: string;\n\n /** The language group heading. Default `\"Language\"`, localized. */\n readonly languageLabel?: string;\n\n /** The organization group heading. Default `\"Organization\"`, localized. */\n readonly organizationLabel?: string;\n\n /** The versions group heading. Default `\"Versions\"`, localized. */\n readonly versionsLabel?: string;\n\n /** The sign-out row. Default `\"Sign out\"`, localized. */\n readonly signOutLabel?: string;\n\n /** The panel's surface recipe — `glass` or `glass-outline` for translucent chrome. Default the menu's own. */\n readonly variant?: SurfaceVariant;\n\n /** The panel class — the hook for an app's own material. */\n readonly panelClass?: HTMLAttributes['class'];\n}\n\n/** @internal The appearance rows' values; `system` hands the mode back to the device. */\nconst Appearance = {\n System: 'system',\n Light: 'light',\n Dark: 'dark',\n} as const;\n\ntype Appearance = (typeof Appearance)[keyof typeof Appearance];\n\n/** @internal The visible length of a commit hash. */\nconst CommitLength = 7;\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, inject, useAttrs, useTemplateRef, watch } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { Check, ChevronDown, LogOut, Monitor, Moon, Sun, UserRound } from 'lucide-vue-next';\nimport { dataAttr } from '../../../foundation/dom';\nimport { Icon, type IconAdapter } from '../../../foundation/icons';\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { useId } from '../../../foundation/identifiers';\nimport { ColorMode, ColorModeKey } from '../../../foundation/primitives';\nimport { useControlled } from '../../../foundation/state';\nimport { cn } from '../../../foundation/styles';\nimport Avatar from '../../display/avatar/Avatar.vue';\nimport DropdownMenu from '../dropdownMenu/DropdownMenu.vue';\nimport DropdownMenuContent from '../dropdownMenu/DropdownMenuContent.vue';\nimport DropdownMenuTrigger from '../dropdownMenu/DropdownMenuTrigger.vue';\nimport MenuGroup from '../menu/MenuGroup.vue';\nimport MenuItem from '../menu/MenuItem.vue';\nimport MenuRadioGroup from '../menu/MenuRadioGroup.vue';\nimport MenuRadioItem from '../menu/MenuRadioItem.vue';\nimport MenuSeparator from '../menu/MenuSeparator.vue';\n\n/**\n * Renders the account menu that ends an app's top bar: an avatar trigger that opens who is signed in, the\n * organization switcher, the caller's account destinations, the colour mode, the interface language, each\n * service's version and sign out — always last.\n */\ndefineOptions({ name: 'AccountMenu', inheritAttrs: false });\n\nconst slots = defineSlots<{\n /** The account-level destinations — `MenuItem` rows such as account settings, placed after the switcher. */\n items?(): unknown;\n}>();\n\nconst componentProps = withDefaults(defineProps<AccountMenuProps>(), {\n name: undefined,\n description: undefined,\n avatarSrc: undefined,\n open: undefined,\n defaultOpen: false,\n placement: 'bottom-end',\n isDisabled: false,\n isBusy: false,\n showAppearance: true,\n locales: () => [],\n locale: undefined,\n organizations: () => [],\n organization: undefined,\n versions: () => [],\n onSignOut: undefined,\n triggerLabel: undefined,\n variant: undefined,\n panelClass: undefined,\n});\n\nconst props = useLocaleDefaults(componentProps, 'AccountMenu', {\n menuLabel: 'Account',\n anonymousTriggerLabel: 'Account menu',\n appearanceLabel: 'Appearance',\n systemModeLabel: 'System',\n lightModeLabel: 'Light',\n darkModeLabel: 'Dark',\n languageLabel: 'Language',\n organizationLabel: 'Organization',\n versionsLabel: 'Versions',\n signOutLabel: 'Sign out',\n});\n\nconst emit = defineEmits<{\n /** Fires when the menu opens or closes — the `v-model:open` half. */\n 'update:open': [open: boolean];\n\n /** Fires when the reader picks another interface language — the `v-model:locale` half. */\n 'update:locale': [locale: string];\n\n /** Fires when the reader picks another organization — the `v-model:organization` half. */\n 'update:organization': [organization: string];\n}>();\n\nconst attrs = useAttrs();\nconst i18n = useLocale();\nconst identityId = useId('account-menu-identity');\nconst trigger = useTemplateRef<InstanceType<typeof DropdownMenuTrigger>>('trigger');\n\n/* Optional: without a provider the appearance rows hide instead of throwing. */\nconst colorMode = inject(ColorModeKey, null);\n\nconst controlled = useControlled<boolean>({\n controlled: () => props.open,\n default: () => props.defaultOpen,\n onChange: (value) => {\n emit('update:open', value);\n },\n});\n\nconst isOpen = controlled.value;\n\n/** Whether the trigger refuses to open the menu. */\nconst isBlocked = computed(() => props.isDisabled || props.isBusy);\n\nfunction setOpen(open: boolean): void {\n if (open && isBlocked.value) return;\n controlled.setValue(open);\n}\n\n/* A menu open when the trigger becomes disabled or busy closes, since nothing in it may act now. */\nwatch(isBlocked, (blocked) => {\n if (blocked && isOpen.value) controlled.setValue(false);\n});\n\nconst hasName = computed(() => (props.name ?? '').trim() !== '');\n\n/** The picture to show, or `undefined` for none — the avatar then falls back to initials or the glyph. */\nconst pictureSrc = computed(() => {\n const src = (props.avatarSrc ?? '').trim();\n return src === '' ? undefined : src;\n});\n\nconst triggerName = computed(() => {\n if (!hasName.value) return props.anonymousTriggerLabel;\n const name = (props.name ?? '').trim();\n return props.triggerLabel === undefined\n ? i18n.t('AccountMenu.triggerLabel', { name }, 'Account menu for {name}')\n : props.triggerLabel.replaceAll('{name}', name);\n});\n\nconst hasOrganizationSwitcher = computed(() => props.organizations.length > 1);\n\n/** The one organization a person belongs to, named in the header instead of a one-row switcher. */\nconst soleOrganization = computed(() => (props.organizations.length === 1 ? props.organizations[0] : undefined));\n\nconst hasIdentity = computed(() => hasName.value || Boolean(props.description) || soleOrganization.value !== undefined);\n\nconst hasAppearance = computed(() => props.showAppearance && colorMode !== null);\nconst hasLanguages = computed(() => props.locales.length > 1);\nconst hasVersions = computed(() => props.versions.length > 0);\nconst hasSignOut = computed(() => typeof props.onSignOut === 'function');\n\nconst appearances = computed((): ReadonlyArray<{ value: Appearance; label: string; icon: IconAdapter }> => [\n { value: Appearance.System, label: props.systemModeLabel, icon: Monitor },\n { value: Appearance.Light, label: props.lightModeLabel, icon: Sun },\n { value: Appearance.Dark, label: props.darkModeLabel, icon: Moon },\n]);\n\n/** The row the ambient mode marks: `system` while it follows the device, else the mode itself. */\nconst appearance = computed<Appearance | null>(() => {\n if (!colorMode) return null;\n if (colorMode.followsSystem) return Appearance.System;\n return colorMode.mode === ColorMode.Dark ? Appearance.Dark : Appearance.Light;\n});\n\nfunction chooseAppearance(value: string | null): void {\n if (!colorMode) return;\n if (value === Appearance.System) colorMode.followSystem();\n else if (value === Appearance.Light) colorMode.setMode(ColorMode.Light);\n else if (value === Appearance.Dark) colorMode.setMode(ColorMode.Dark);\n}\n\nfunction chooseLocale(value: string | null): void {\n if (value !== null && value !== props.locale) emit('update:locale', value);\n}\n\nfunction chooseOrganization(id: string | null): void {\n if (id !== null && id !== props.organization) emit('update:organization', id);\n}\n\nfunction signOut(): void {\n void props.onSignOut?.();\n}\n\nfunction shortCommit(commit: string): string {\n return commit.trim().slice(0, CommitLength);\n}\n\n/**\n * The sections present, in display order. Read during render, so a section that appears or a slot that is\n * added re-places every separator; a separator sits before each section but the first.\n */\nfunction sections(): ReadonlyArray<string> {\n return [\n hasIdentity.value && 'identity',\n hasOrganizationSwitcher.value && 'organizations',\n slots.items !== undefined && 'items',\n hasAppearance.value && 'appearance',\n hasLanguages.value && 'languages',\n hasVersions.value && 'versions',\n hasSignOut.value && 'signOut',\n ].filter((section): section is string => typeof section === 'string');\n}\n\nfunction isSeparated(section: string): boolean {\n return sections().indexOf(section) > 0;\n}\n\nconst triggerClasses = computed(() =>\n cn(\n 'group/account-menu inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-xl border border-transparent',\n 'py-1 ps-1 pe-2 text-foreground transition-colors motion-reduce:transition-none',\n 'hover:border-primary/15 hover:bg-primary-soft',\n 'data-[state=open]:border-primary/15 data-[state=open]:bg-primary-soft',\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60',\n attrs.class as ClassValue,\n ),\n);\n\n/* The panel fits a phone: never wider than the viewport, never taller than the space under a top bar, and\n scrolling inside itself when the sections outgrow it. As the scroll box it spans the surface's inline padding\n (`-mx-1 px-1`): a separator bleeds that padding to meet the surface edges, and inside a narrower scroll box the\n bleed overflowed it by 4px and drew a sideways scrollbar. The width adds the padding back, so the surface keeps\n its size. */\nconst panelClasses = computed(() =>\n cn(\n '-mx-1 flex w-[min(18.5rem,calc(100vw-1.5rem))] max-h-[calc(100dvh-5rem)] flex-col gap-0.5 px-1',\n 'overflow-y-auto overscroll-contain',\n props.panelClass as ClassValue,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** The trigger button. */\nconst el = computed(() => trigger.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <DropdownMenu :open=\"isOpen\" :placement=\"props.placement\" @update:open=\"setOpen\">\n <DropdownMenuTrigger ref=\"trigger\" as-child>\n <button\n type=\"button\"\n :aria-label=\"triggerName\"\n :aria-busy=\"props.isBusy || undefined\"\n :disabled=\"isBlocked\"\n :data-busy=\"dataAttr(props.isBusy)\"\n v-bind=\"rest\"\n :class=\"triggerClasses\"\n >\n <Avatar\n v-if=\"hasName || pictureSrc\"\n :name=\"hasName ? props.name : undefined\"\n :src=\"pictureSrc\"\n alt=\"\"\n size=\"sm\"\n :is-loading=\"props.isBusy\"\n data-account-menu-avatar\n >\n <!-- A picture without a name that fails to load falls back to the glyph, not to empty initials. -->\n <template v-if=\"!hasName\" #fallback><Icon :icon=\"UserRound\" :size=\"18\" /></template>\n </Avatar>\n <span\n v-else\n aria-hidden=\"true\"\n class=\"grid size-8 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground\"\n data-account-menu-avatar\n >\n <Icon :icon=\"UserRound\" :size=\"18\" />\n </span>\n <Icon\n :icon=\"ChevronDown\"\n :size=\"14\"\n class=\"shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/account-menu:rotate-180 motion-reduce:transition-none\"\n data-account-menu-chevron\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n :aria-label=\"props.menuLabel\"\n :aria-describedby=\"hasIdentity ? identityId : undefined\"\n :variant=\"props.variant\"\n :class=\"panelClasses\"\n >\n <div v-if=\"hasIdentity\" :id=\"identityId\" class=\"min-w-0 px-2 py-1.5\" data-account-menu-identity>\n <p v-if=\"hasName\" class=\"truncate text-sm font-semibold text-foreground\">{{ props.name }}</p>\n <p v-if=\"props.description\" class=\"truncate text-xs text-muted-foreground\">{{ props.description }}</p>\n <p v-if=\"soleOrganization\" class=\"truncate text-xs text-muted-foreground\" data-account-menu-organization>\n {{ soleOrganization.label\n }}<template v-if=\"soleOrganization.description\"> · {{ soleOrganization.description }}</template>\n </p>\n </div>\n\n <template v-if=\"hasOrganizationSwitcher\">\n <MenuSeparator v-if=\"isSeparated('organizations')\" />\n <MenuRadioGroup\n :label=\"props.organizationLabel\"\n :model-value=\"props.organization ?? null\"\n data-account-menu-organizations\n @update:model-value=\"chooseOrganization\"\n >\n <!-- Many memberships scroll inside their own band, so appearance and sign out stay in reach. -->\n <div class=\"max-h-44 overflow-y-auto overscroll-contain\" data-account-menu-organization-list>\n <MenuRadioItem v-for=\"entry in props.organizations\" :key=\"entry.id\" :value=\"entry.id\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n <span class=\"min-w-0 truncate\">{{ entry.label }}</span>\n <span v-if=\"entry.description\" class=\"ms-auto shrink-0 text-xs text-muted-foreground\">\n {{ entry.description }}\n </span>\n </MenuRadioItem>\n </div>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"slots.items\">\n <MenuSeparator v-if=\"isSeparated('items')\" />\n <slot name=\"items\" />\n </template>\n\n <template v-if=\"hasAppearance\">\n <MenuSeparator v-if=\"isSeparated('appearance')\" />\n <MenuRadioGroup\n :label=\"props.appearanceLabel\"\n :model-value=\"appearance\"\n data-account-menu-appearance\n @update:model-value=\"chooseAppearance\"\n >\n <MenuRadioItem v-for=\"entry in appearances\" :key=\"entry.value\" :value=\"entry.value\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n <Icon :icon=\"entry.icon\" :size=\"15\" class=\"shrink-0 text-muted-foreground\" />\n {{ entry.label }}\n </MenuRadioItem>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"hasLanguages\">\n <MenuSeparator v-if=\"isSeparated('languages')\" />\n <MenuRadioGroup\n :label=\"props.languageLabel\"\n :model-value=\"props.locale ?? null\"\n data-account-menu-languages\n @update:model-value=\"chooseLocale\"\n >\n <MenuRadioItem v-for=\"entry in props.locales\" :key=\"entry.value\" :value=\"entry.value\" :lang=\"entry.value\">\n <template #indicator=\"{ checked }\"><Icon v-if=\"checked\" :icon=\"Check\" :size=\"14\" /></template>\n {{ entry.label }}\n </MenuRadioItem>\n </MenuRadioGroup>\n </template>\n\n <template v-if=\"hasVersions\">\n <MenuSeparator v-if=\"isSeparated('versions')\" />\n <MenuGroup :label=\"props.versionsLabel\" data-account-menu-versions>\n <div\n v-for=\"(entry, index) in props.versions\"\n :key=\"`${index}:${entry.label}`\"\n class=\"flex items-baseline justify-between gap-3 px-2 py-0.5 text-xs\"\n data-account-menu-version\n >\n <span class=\"min-w-0 truncate text-muted-foreground\">{{ entry.label }}</span>\n <span class=\"shrink-0 font-mono tabular-nums text-foreground\"\n >{{ entry.version\n }}<span v-if=\"entry.commit\" class=\"text-muted-foreground\"> · {{ shortCommit(entry.commit) }}</span></span\n >\n </div>\n </MenuGroup>\n </template>\n\n <template v-if=\"hasSignOut\">\n <MenuSeparator v-if=\"isSeparated('signOut')\" />\n <MenuItem state=\"destructive\" data-account-menu-sign-out @select=\"signOut\">\n <Icon :icon=\"LogOut\" :size=\"15\" class=\"shrink-0\" />\n {{ props.signOutLabel }}\n </MenuItem>\n </template>\n </DropdownMenuContent>\n </DropdownMenu>\n</template>\n"],"names":["_useSlots","_createBlock","DropdownMenu","_unref","_createVNode","DropdownMenuTrigger","_createElementVNode","_mergeProps","Avatar","Icon","_openBlock","_createElementBlock","DropdownMenuContent","_toDisplayString","_createTextVNode","_Fragment","MenuSeparator","MenuRadioGroup","_renderList","MenuRadioItem","_withCtx","_renderSlot","MenuGroup","MenuItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIA,MAAM,aAAa;AAAA,EACjB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AACR;AAKA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BrB,UAAM,QAAQA,SAAA;AAKd,UAAM,iBAAiB;AAqBvB,UAAM,QAAQ,kBAAkB,gBAAgB,eAAe;AAAA,MAC7D,WAAW;AAAA,MACX,uBAAuB;AAAA,MACvB,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,eAAe;AAAA,MACf,cAAc;AAAA,IAAA,CACf;AAED,UAAM,OAAO;AAWb,UAAM,QAAQ,SAAA;AACd,UAAM,OAAO,UAAA;AACb,UAAM,aAAa,MAAM,u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