@happyvertical/smrt-svelte 0.60.17 → 0.61.0
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/AGENTS.md +6 -0
- package/agents/components.md +15 -0
- package/agents/connect-ai.md +180 -0
- package/agents/cookbook-shell.md +173 -6
- package/agents/import-export.md +10 -0
- package/agents/screens.md +233 -12
- package/agents/settings.md +84 -0
- package/agents/testing.md +6 -0
- package/agents/workspace.md +64 -1
- package/dist/components/app/AppShell.svelte +220 -7
- package/dist/components/app/AppShell.svelte.d.ts +49 -3
- package/dist/components/app/AppShell.svelte.d.ts.map +1 -1
- package/dist/components/app/OwnerSetupForm.svelte +5 -3
- package/dist/components/app/OwnerSetupForm.svelte.d.ts.map +1 -1
- package/dist/components/app/PhoneTabBar.svelte +28 -1
- package/dist/components/app/PhoneTabBar.svelte.d.ts +10 -0
- package/dist/components/app/PhoneTabBar.svelte.d.ts.map +1 -1
- package/dist/components/app/ShellAccountMenu.svelte +46 -0
- package/dist/components/app/ShellAccountMenu.svelte.d.ts +13 -0
- package/dist/components/app/ShellAccountMenu.svelte.d.ts.map +1 -0
- package/dist/components/app/ShellSettingsPage.svelte +119 -4
- package/dist/components/app/ShellSettingsPage.svelte.d.ts +18 -0
- package/dist/components/app/ShellSettingsPage.svelte.d.ts.map +1 -1
- package/dist/components/app/index.d.ts +3 -2
- package/dist/components/app/index.d.ts.map +1 -1
- package/dist/components/app/index.js +1 -1
- package/dist/components/app/owner-setup-types.d.ts +1 -0
- package/dist/components/app/owner-setup-types.d.ts.map +1 -1
- package/dist/components/app/settings-menu-item.d.ts +8 -0
- package/dist/components/app/settings-menu-item.d.ts.map +1 -0
- package/dist/components/app/settings-menu-item.js +1 -0
- package/dist/components/app/slot-item.d.ts +53 -0
- package/dist/components/app/slot-item.d.ts.map +1 -1
- package/dist/components/audit/RecordHistory.svelte +30 -22
- package/dist/components/audit/RecordHistory.svelte.d.ts +31 -10
- package/dist/components/audit/RecordHistory.svelte.d.ts.map +1 -1
- package/dist/components/audit/index.d.ts +1 -1
- package/dist/components/audit/index.d.ts.map +1 -1
- package/dist/components/audit/types.d.ts +12 -6
- package/dist/components/audit/types.d.ts.map +1 -1
- package/dist/components/connect-ai/ConnectAi.svelte +584 -0
- package/dist/components/connect-ai/ConnectAi.svelte.d.ts +23 -0
- package/dist/components/connect-ai/ConnectAi.svelte.d.ts.map +1 -0
- package/dist/components/connect-ai/client.d.ts +68 -0
- package/dist/components/connect-ai/client.d.ts.map +1 -0
- package/dist/components/connect-ai/client.js +121 -0
- package/dist/components/connect-ai/index.d.ts +4 -0
- package/dist/components/connect-ai/index.d.ts.map +1 -0
- package/dist/components/connect-ai/index.js +2 -0
- package/dist/components/connect-ai/server.d.ts +33 -0
- package/dist/components/connect-ai/server.d.ts.map +1 -0
- package/dist/components/connect-ai/server.js +190 -0
- package/dist/components/connect-ai/types.d.ts +48 -0
- package/dist/components/connect-ai/types.d.ts.map +1 -0
- package/dist/components/connect-ai/types.js +1 -0
- package/dist/components/cookbook/CookbookApp.svelte +84 -5
- package/dist/components/cookbook/CookbookApp.svelte.d.ts +1 -1
- package/dist/components/cookbook/CookbookApp.svelte.d.ts.map +1 -1
- package/dist/components/cookbook/app-props.d.ts +65 -0
- package/dist/components/cookbook/app-props.d.ts.map +1 -0
- package/dist/components/cookbook/app-props.js +1 -0
- package/dist/components/cookbook/build.d.ts +3 -0
- package/dist/components/cookbook/build.d.ts.map +1 -1
- package/dist/components/cookbook/build.js +92 -8
- package/dist/components/cookbook/catalog.d.ts +2 -1
- package/dist/components/cookbook/catalog.d.ts.map +1 -1
- package/dist/components/cookbook/catalog.js +5 -2
- package/dist/components/cookbook/context.d.ts +6 -0
- package/dist/components/cookbook/context.d.ts.map +1 -1
- package/dist/components/cookbook/index.d.ts +2 -1
- package/dist/components/cookbook/index.d.ts.map +1 -1
- package/dist/components/cookbook/index.js +1 -1
- package/dist/components/cookbook/registry.d.ts +3 -0
- package/dist/components/cookbook/registry.d.ts.map +1 -1
- package/dist/components/cookbook/registry.js +5 -0
- package/dist/components/cookbook/server.d.ts +1 -0
- package/dist/components/cookbook/server.d.ts.map +1 -1
- package/dist/components/cookbook/surfaces.d.ts +14 -0
- package/dist/components/cookbook/surfaces.d.ts.map +1 -0
- package/dist/components/cookbook/surfaces.js +6 -0
- package/dist/components/cookbook/types.d.ts +0 -28
- package/dist/components/cookbook/types.d.ts.map +1 -1
- package/dist/components/import-export/ImportExport.svelte +21 -2
- package/dist/components/import-export/ImportExport.svelte.d.ts.map +1 -1
- package/dist/components/import-export/fields.d.ts +1 -0
- package/dist/components/import-export/fields.d.ts.map +1 -1
- package/dist/components/import-export/fields.js +8 -3
- package/dist/components/import-export/props.d.ts +5 -1
- package/dist/components/import-export/props.d.ts.map +1 -1
- package/dist/components/onboarding/FirstRunOnboarding.svelte +249 -0
- package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts +21 -0
- package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts.map +1 -0
- package/dist/components/onboarding/OnboardingAssistant.svelte +82 -0
- package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts +19 -0
- package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts.map +1 -0
- package/dist/components/onboarding/client.d.ts +7 -0
- package/dist/components/onboarding/client.d.ts.map +1 -0
- package/dist/components/onboarding/client.js +26 -0
- package/dist/components/onboarding/index.d.ts +5 -0
- package/dist/components/onboarding/index.d.ts.map +1 -0
- package/dist/components/onboarding/index.js +3 -0
- package/dist/components/onboarding/types.d.ts +38 -0
- package/dist/components/onboarding/types.d.ts.map +1 -0
- package/dist/components/onboarding/types.js +1 -0
- package/dist/components/overview/recipe-widgets.d.ts +2 -18
- package/dist/components/overview/recipe-widgets.d.ts.map +1 -1
- package/dist/components/overview/recipe-widgets.js +14 -14
- package/dist/components/screens/DetailScreen.svelte +40 -16
- package/dist/components/screens/DetailScreen.svelte.d.ts.map +1 -1
- package/dist/components/screens/EditForm.svelte +83 -18
- package/dist/components/screens/EditForm.svelte.d.ts.map +1 -1
- package/dist/components/screens/ListScreen.svelte +35 -9
- package/dist/components/screens/ListScreen.svelte.d.ts.map +1 -1
- package/dist/components/screens/RecipeScreens.svelte +78 -6
- package/dist/components/screens/RecipeScreens.svelte.d.ts +2 -1
- package/dist/components/screens/RecipeScreens.svelte.d.ts.map +1 -1
- package/dist/components/screens/RecordHeader.svelte +18 -4
- package/dist/components/screens/RecordHeader.svelte.d.ts +2 -1
- package/dist/components/screens/RecordHeader.svelte.d.ts.map +1 -1
- package/dist/components/screens/RecordScreen.svelte +22 -3
- package/dist/components/screens/RecordScreen.svelte.d.ts.map +1 -1
- package/dist/components/screens/ReferencePicker.svelte +103 -0
- package/dist/components/screens/ReferencePicker.svelte.d.ts +12 -0
- package/dist/components/screens/ReferencePicker.svelte.d.ts.map +1 -0
- package/dist/components/screens/fields.d.ts +6 -14
- package/dist/components/screens/fields.d.ts.map +1 -1
- package/dist/components/screens/fields.js +67 -10
- package/dist/components/screens/index.d.ts +3 -1
- package/dist/components/screens/index.d.ts.map +1 -1
- package/dist/components/screens/index.js +2 -0
- package/dist/components/screens/reference-labels.svelte.d.ts +11 -0
- package/dist/components/screens/reference-labels.svelte.d.ts.map +1 -0
- package/dist/components/screens/reference-labels.svelte.js +50 -0
- package/dist/components/screens/references.d.ts +6 -0
- package/dist/components/screens/references.d.ts.map +1 -0
- package/dist/components/screens/references.js +26 -0
- package/dist/components/screens/relations.d.ts +3 -1
- package/dist/components/screens/relations.d.ts.map +1 -1
- package/dist/components/screens/relations.js +4 -3
- package/dist/components/screens/roles.d.ts.map +1 -1
- package/dist/components/screens/roles.js +3 -2
- package/dist/components/screens/source.d.ts +37 -0
- package/dist/components/screens/source.d.ts.map +1 -0
- package/dist/components/screens/source.js +96 -0
- package/dist/components/screens/types.d.ts +63 -2
- package/dist/components/screens/types.d.ts.map +1 -1
- package/dist/components/screens/values.d.ts.map +1 -1
- package/dist/components/screens/values.js +5 -0
- package/dist/components/settings/OwnerApprovalsSettings.svelte +169 -0
- package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts +13 -0
- package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts.map +1 -0
- package/dist/components/settings/PrebuiltComponentsSettings.svelte +83 -0
- package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts +14 -0
- package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts.map +1 -0
- package/dist/components/settings/WorkProfileSettings.svelte +250 -0
- package/dist/components/settings/WorkProfileSettings.svelte.d.ts +22 -0
- package/dist/components/settings/WorkProfileSettings.svelte.d.ts.map +1 -0
- package/dist/components/settings/index.d.ts +3 -0
- package/dist/components/settings/index.d.ts.map +1 -1
- package/dist/components/settings/index.js +3 -0
- package/dist/components/workspace/admin-shell/AdminShell.svelte +186 -18
- package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts +26 -1
- package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte +18 -3
- package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts +6 -0
- package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte +89 -5
- package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts +7 -1
- package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/layout.d.ts +4 -0
- package/dist/components/workspace/admin-shell/layout.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/layout.js +17 -4
- package/dist/components/workspace/admin-shell/settings-delta.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/settings-delta.js +4 -3
- package/dist/components/workspace/admin-shell/settings-sections.d.ts +10 -0
- package/dist/components/workspace/admin-shell/settings-sections.d.ts.map +1 -0
- package/dist/components/workspace/admin-shell/settings-sections.js +16 -0
- package/dist/components/workspace/admin-shell/settings.d.ts +7 -0
- package/dist/components/workspace/admin-shell/settings.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/settings.js +26 -0
- package/dist/components/workspace/admin-shell/shell-icons.d.ts +4 -0
- package/dist/components/workspace/admin-shell/shell-icons.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/shell-icons.js +4 -0
- package/dist/components/workspace/admin-shell/state.svelte.d.ts +13 -5
- package/dist/components/workspace/admin-shell/state.svelte.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/state.svelte.js +37 -2
- package/dist/components/workspace/admin-shell/types.d.ts +32 -1
- package/dist/components/workspace/admin-shell/types.d.ts.map +1 -1
- package/dist/components/workspace/index.d.ts +3 -2
- package/dist/components/workspace/index.d.ts.map +1 -1
- package/dist/components/workspace/index.js +2 -1
- package/dist/i18n/server.d.ts +2 -0
- package/dist/i18n/server.d.ts.map +1 -1
- package/dist/i18n/server.js +2 -0
- package/dist/i18n/strings.connect-ai.d.ts +57 -0
- package/dist/i18n/strings.connect-ai.d.ts.map +1 -0
- package/dist/i18n/strings.connect-ai.js +57 -0
- package/dist/i18n/strings.onboarding.d.ts +51 -0
- package/dist/i18n/strings.onboarding.d.ts.map +1 -0
- package/dist/i18n/strings.onboarding.js +51 -0
- package/dist/i18n/strings.screens.d.ts +12 -0
- package/dist/i18n/strings.screens.d.ts.map +1 -1
- package/dist/i18n/strings.screens.js +13 -1
- package/dist/i18n/strings.settings.d.ts +2 -0
- package/dist/i18n/strings.settings.d.ts.map +1 -1
- package/dist/i18n/strings.settings.js +2 -0
- package/dist/i18n/strings.workspace.d.ts +14 -0
- package/dist/i18n/strings.workspace.d.ts.map +1 -1
- package/dist/i18n/strings.workspace.js +15 -1
- package/dist/smrt-knowledge.okf.md +21 -10
- package/package.json +46 -17
|
@@ -80,6 +80,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
80
80
|
import {
|
|
81
81
|
clampPanelSize,
|
|
82
82
|
DEFAULT_PANEL_CONFIG,
|
|
83
|
+
resolveDockedPanelResize,
|
|
83
84
|
resolveHotkey,
|
|
84
85
|
} from './settings.js';
|
|
85
86
|
import { createShellState, type ShellState } from './state.svelte.js';
|
|
@@ -95,6 +96,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
95
96
|
PanelEdge,
|
|
96
97
|
ShellLayoutEditSurface,
|
|
97
98
|
ShellFocusTool,
|
|
99
|
+
ShellPanelResize,
|
|
98
100
|
ShellViewport,
|
|
99
101
|
} from './types.js';
|
|
100
102
|
|
|
@@ -208,6 +210,28 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
208
210
|
* sheets close and the phone top bar comes back.
|
|
209
211
|
*/
|
|
210
212
|
path?: string;
|
|
213
|
+
/**
|
|
214
|
+
* A docked panel between the left sidebar and the main area (the order is
|
|
215
|
+
* sidebar, panel, content). Only rendered when given, so existing shells
|
|
216
|
+
* are unchanged. The panel stays mounted while closed (`panelOpen`
|
|
217
|
+
* false hides it), so its state survives a toggle. Off phones it sits
|
|
218
|
+
* beside main with a draggable, keyboard-operable separator; on phones it
|
|
219
|
+
* is a full-size view over main.
|
|
220
|
+
*/
|
|
221
|
+
panel?: Snippet<[{ viewport: ShellViewport; open: boolean }]>;
|
|
222
|
+
/** Whether the docked panel is shown (default true). Host-owned. */
|
|
223
|
+
panelOpen?: boolean;
|
|
224
|
+
/** Accessible name of the panel (default "Panel"). */
|
|
225
|
+
panelLabel?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Resizing of the docked panel: `true` (default) uses the docked-panel
|
|
228
|
+
* limits (280-800 px, 16 px step), an object overrides them, `false`
|
|
229
|
+
* keeps the panel at `panelSize`. The width persists through the shell
|
|
230
|
+
* settings adapter (`ShellSettingsDelta.sizes.panel`).
|
|
231
|
+
*/
|
|
232
|
+
panelResize?: boolean | ShellPanelResize;
|
|
233
|
+
/** The panel's width in px until the user resizes it (default 400). */
|
|
234
|
+
panelSize?: number;
|
|
211
235
|
children: Snippet;
|
|
212
236
|
}
|
|
213
237
|
|
|
@@ -216,6 +240,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
216
240
|
homeHref,
|
|
217
241
|
showTenantToggle,
|
|
218
242
|
edgeToggles = false,
|
|
243
|
+
sidebarFooterDivider = true,
|
|
219
244
|
hotkeys,
|
|
220
245
|
brandInSlot = false,
|
|
221
246
|
logoSrc,
|
|
@@ -257,6 +282,11 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
257
282
|
phoneDockOpener = true,
|
|
258
283
|
pinChrome = false,
|
|
259
284
|
path,
|
|
285
|
+
panel,
|
|
286
|
+
panelOpen = true,
|
|
287
|
+
panelLabel,
|
|
288
|
+
panelResize = true,
|
|
289
|
+
panelSize = 400,
|
|
260
290
|
children,
|
|
261
291
|
}: Props = $props();
|
|
262
292
|
|
|
@@ -272,6 +302,19 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
272
302
|
}),
|
|
273
303
|
);
|
|
274
304
|
setAdminShell(shell);
|
|
305
|
+
// The docked panel's resize limits live on the shell state, beside the
|
|
306
|
+
// edges', so the one set of size helpers (`clampPanelSize`, `panelSize`,
|
|
307
|
+
// `setPanelSize`) serves it.
|
|
308
|
+
untrack(() => {
|
|
309
|
+
shell.dockedPanelLimits = panel ? resolveDockedPanelResize(panelResize) : null;
|
|
310
|
+
});
|
|
311
|
+
$effect(() => {
|
|
312
|
+
const limits = panel ? resolveDockedPanelResize(panelResize) : null;
|
|
313
|
+
untrack(() => {
|
|
314
|
+
shell.dockedPanelLimits = limits;
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
const panelShown = $derived(Boolean(panel) && panelOpen);
|
|
275
318
|
|
|
276
319
|
let shortcutsOpen = $state(false);
|
|
277
320
|
function resolveActiveFocusTool(): ShellFocusTool | null {
|
|
@@ -290,7 +333,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
290
333
|
let keyboardOpen = $state(false);
|
|
291
334
|
let formActions = $state(false);
|
|
292
335
|
let chromeHidden = $state(false);
|
|
293
|
-
let resizing = $state<SideEdge | null>(null);
|
|
336
|
+
let resizing = $state<SideEdge | 'panel' | null>(null);
|
|
294
337
|
/** Set after hydration and two frames, so first paint never animates. */
|
|
295
338
|
let motionReady = $state(false);
|
|
296
339
|
const sideElements = $state<Partial<Record<SideEdge, HTMLElement>>>({});
|
|
@@ -764,10 +807,13 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
764
807
|
* The edge's expanded width in px: the resized width, else the configured
|
|
765
808
|
* `expandedSize` (measured when it is not a plain px/rem length).
|
|
766
809
|
*/
|
|
767
|
-
function currentSize(edge: SideEdge): number {
|
|
810
|
+
function currentSize(edge: SideEdge | 'panel'): number {
|
|
768
811
|
const limits = shell.resizeLimits(edge);
|
|
769
812
|
const resized = shell.panelSize(edge);
|
|
770
813
|
if (resized !== null) return resized;
|
|
814
|
+
if (edge === 'panel') {
|
|
815
|
+
return limits ? clampPanelSize(panelSize, limits) : Math.round(panelSize);
|
|
816
|
+
}
|
|
771
817
|
const width =
|
|
772
818
|
cssLengthToPx(shell.config.panels[edge].expandedSize) ??
|
|
773
819
|
sideElements[edge]?.getBoundingClientRect().width ??
|
|
@@ -775,7 +821,10 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
775
821
|
return limits ? clampPanelSize(width, limits) : Math.round(width);
|
|
776
822
|
}
|
|
777
823
|
|
|
778
|
-
function canResize(edge: SideEdge): boolean {
|
|
824
|
+
function canResize(edge: SideEdge | 'panel'): boolean {
|
|
825
|
+
if (edge === 'panel') {
|
|
826
|
+
return !isPhone && panelShown && shell.resizeLimits('panel') !== null;
|
|
827
|
+
}
|
|
779
828
|
return (
|
|
780
829
|
!isPhone &&
|
|
781
830
|
edgeExpanded(edge) &&
|
|
@@ -784,12 +833,16 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
784
833
|
);
|
|
785
834
|
}
|
|
786
835
|
|
|
787
|
-
function onResizeKeydown(
|
|
836
|
+
function onResizeKeydown(
|
|
837
|
+
event: KeyboardEvent,
|
|
838
|
+
edge: SideEdge | 'panel',
|
|
839
|
+
): void {
|
|
788
840
|
const limits = shell.resizeLimits(edge);
|
|
789
841
|
if (!limits) return;
|
|
790
842
|
const step = limits.step * (event.shiftKey ? 4 : 1);
|
|
791
|
-
|
|
792
|
-
const
|
|
843
|
+
// The left sidebar and the docked panel grow toward the inline end.
|
|
844
|
+
const grow = edge !== 'right' ? 'ArrowRight' : 'ArrowLeft';
|
|
845
|
+
const shrink = edge !== 'right' ? 'ArrowLeft' : 'ArrowRight';
|
|
793
846
|
let next: number | null;
|
|
794
847
|
if (event.key === grow) next = currentSize(edge) + step;
|
|
795
848
|
else if (event.key === shrink) next = currentSize(edge) - step;
|
|
@@ -808,7 +861,10 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
808
861
|
// state that outlives this component, nor a stale `resizing` flag.
|
|
809
862
|
$effect(() => () => stopActiveResize?.(false));
|
|
810
863
|
|
|
811
|
-
function onResizePointerdown(
|
|
864
|
+
function onResizePointerdown(
|
|
865
|
+
event: PointerEvent,
|
|
866
|
+
edge: SideEdge | 'panel',
|
|
867
|
+
): void {
|
|
812
868
|
if (event.button !== 0 || !shell.resizeLimits(edge)) return;
|
|
813
869
|
event.preventDefault();
|
|
814
870
|
stopActiveResize?.(true);
|
|
@@ -822,7 +878,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
822
878
|
|
|
823
879
|
function onMove(move: PointerEvent): void {
|
|
824
880
|
const dx = move.clientX - startX;
|
|
825
|
-
latest = startSize + (edge
|
|
881
|
+
latest = startSize + (edge !== 'right' ? dx : -dx);
|
|
826
882
|
shell.setPanelSize(edge, latest, { persist: false });
|
|
827
883
|
}
|
|
828
884
|
|
|
@@ -1041,6 +1097,8 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
1041
1097
|
return shownOpen(edge) || keepsContent(edge);
|
|
1042
1098
|
}
|
|
1043
1099
|
|
|
1100
|
+
const panelName = $derived(panelLabel ?? t(M['ui.admin_shell.panel']));
|
|
1101
|
+
|
|
1044
1102
|
function labelFor(edge: PanelEdge): string {
|
|
1045
1103
|
return shell.config.panels[edge].label;
|
|
1046
1104
|
}
|
|
@@ -1288,7 +1346,19 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
1288
1346
|
</button>
|
|
1289
1347
|
{/snippet}
|
|
1290
1348
|
|
|
1291
|
-
{#snippet
|
|
1349
|
+
{#snippet mainRegion()}
|
|
1350
|
+
<main
|
|
1351
|
+
id="smrt-admin-shell-main"
|
|
1352
|
+
class="smrt-admin-shell__main"
|
|
1353
|
+
bind:this={mainElement}
|
|
1354
|
+
inert={overlayEdge !== null || (isPhone && panelShown)}
|
|
1355
|
+
data-smrt-part="body"
|
|
1356
|
+
>
|
|
1357
|
+
{@render children()}
|
|
1358
|
+
</main>
|
|
1359
|
+
{/snippet}
|
|
1360
|
+
|
|
1361
|
+
{#snippet resizer(edge: SideEdge | 'panel')}
|
|
1292
1362
|
{#if canResize(edge)}
|
|
1293
1363
|
{@const limits = shell.resizeLimits(edge)}
|
|
1294
1364
|
<!-- A focusable separator is the WAI-ARIA window-splitter widget; Svelte's
|
|
@@ -1299,7 +1369,9 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
1299
1369
|
role="separator"
|
|
1300
1370
|
aria-orientation="vertical"
|
|
1301
1371
|
aria-controls={`smrt-admin-shell-${edge}-panel`}
|
|
1302
|
-
aria-label={t(M['ui.admin_shell.resize_panel'], {
|
|
1372
|
+
aria-label={t(M['ui.admin_shell.resize_panel'], {
|
|
1373
|
+
label: edge === 'panel' ? panelName : labelFor(edge),
|
|
1374
|
+
})}
|
|
1303
1375
|
aria-valuemin={limits?.min}
|
|
1304
1376
|
aria-valuemax={limits?.max}
|
|
1305
1377
|
aria-valuenow={currentSize(edge)}
|
|
@@ -1380,6 +1452,7 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
1380
1452
|
data-right-state={panelState('right')}
|
|
1381
1453
|
data-bottom-state={panelState('bottom')}
|
|
1382
1454
|
data-viewport={viewport}
|
|
1455
|
+
data-footer-divider={sidebarFooterDivider ? undefined : 'off'}
|
|
1383
1456
|
data-bottom-bar={bottomBar}
|
|
1384
1457
|
data-phone-top={showPhoneTop ? '' : undefined}
|
|
1385
1458
|
data-chrome-hidden={chromeHidden ? '' : undefined}
|
|
@@ -1546,14 +1619,27 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
1546
1619
|
</aside>
|
|
1547
1620
|
{/if}
|
|
1548
1621
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1622
|
+
{#if panel}
|
|
1623
|
+
<div class="smrt-admin-shell__body" data-panel-open={panelShown ? '' : undefined}>
|
|
1624
|
+
<aside
|
|
1625
|
+
id="smrt-admin-shell-panel-panel"
|
|
1626
|
+
class="smrt-admin-shell__dock-panel"
|
|
1627
|
+
aria-label={panelName}
|
|
1628
|
+
data-testid="admin-shell-panel"
|
|
1629
|
+
hidden={!panelShown}
|
|
1630
|
+
inert={!panelShown || overlayEdge !== null}
|
|
1631
|
+
style={`--smrt-admin-shell-panel-width: ${currentSize('panel')}px`}
|
|
1632
|
+
>
|
|
1633
|
+
<div class="smrt-admin-shell__dock-panel-body" data-smrt-part="body">
|
|
1634
|
+
{@render panel({ viewport, open: panelShown })}
|
|
1635
|
+
</div>
|
|
1636
|
+
{@render resizer('panel')}
|
|
1637
|
+
</aside>
|
|
1638
|
+
{@render mainRegion()}
|
|
1639
|
+
</div>
|
|
1640
|
+
{:else}
|
|
1641
|
+
{@render mainRegion()}
|
|
1642
|
+
{/if}
|
|
1557
1643
|
|
|
1558
1644
|
{#if showPhoneTop}
|
|
1559
1645
|
<div class="smrt-admin-shell__phone-top" data-testid="admin-shell-phone-top" data-smrt-part="header">
|
|
@@ -3200,4 +3286,86 @@ function buildLayoutStyle(shell: ModuleShellState): string {
|
|
|
3200
3286
|
}
|
|
3201
3287
|
}
|
|
3202
3288
|
}
|
|
3289
|
+
|
|
3290
|
+
@layer smrt.structure {
|
|
3291
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__slot--leftSidebar-footer,
|
|
3292
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__slot--rightSidebar-footer,
|
|
3293
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__tenant-rail-footer {
|
|
3294
|
+
padding-block-start: 0;
|
|
3295
|
+
}
|
|
3296
|
+
.smrt-admin-shell__slot--leftSidebar-footer {
|
|
3297
|
+
flex-wrap: wrap;
|
|
3298
|
+
}
|
|
3299
|
+
.smrt-admin-shell__body {
|
|
3300
|
+
grid-column: 2;
|
|
3301
|
+
grid-row: 3;
|
|
3302
|
+
position: relative;
|
|
3303
|
+
display: flex;
|
|
3304
|
+
min-width: 0;
|
|
3305
|
+
min-height: 0;
|
|
3306
|
+
}
|
|
3307
|
+
.smrt-admin-shell__body > .smrt-admin-shell__main {
|
|
3308
|
+
flex: 1 1 0;
|
|
3309
|
+
}
|
|
3310
|
+
.smrt-admin-shell__dock-panel {
|
|
3311
|
+
position: relative;
|
|
3312
|
+
display: flex;
|
|
3313
|
+
flex-direction: column;
|
|
3314
|
+
flex: 0 0 auto;
|
|
3315
|
+
box-sizing: border-box;
|
|
3316
|
+
inline-size: var(--smrt-admin-shell-panel-width, 25rem);
|
|
3317
|
+
max-inline-size: calc(100% - var(--smrt-admin-shell-panel-main-min));
|
|
3318
|
+
min-inline-size: 0;
|
|
3319
|
+
min-block-size: 0;
|
|
3320
|
+
z-index: 15;
|
|
3321
|
+
}
|
|
3322
|
+
.smrt-admin-shell__dock-panel-body {
|
|
3323
|
+
display: flex;
|
|
3324
|
+
flex-direction: column;
|
|
3325
|
+
flex: 1 1 auto;
|
|
3326
|
+
min-inline-size: 0;
|
|
3327
|
+
min-block-size: 0;
|
|
3328
|
+
overflow: hidden;
|
|
3329
|
+
}
|
|
3330
|
+
.smrt-admin-shell__dock-panel[hidden] {
|
|
3331
|
+
display: none;
|
|
3332
|
+
}
|
|
3333
|
+
.smrt-admin-shell__resizer--panel {
|
|
3334
|
+
inset-inline-end: -0.375rem;
|
|
3335
|
+
}
|
|
3336
|
+
@media (max-width: 48rem) {
|
|
3337
|
+
.smrt-admin-shell__dock-panel {
|
|
3338
|
+
position: absolute;
|
|
3339
|
+
inset: 0;
|
|
3340
|
+
inline-size: auto;
|
|
3341
|
+
max-inline-size: none;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
@layer smrt.theme {
|
|
3347
|
+
.smrt-admin-shell {
|
|
3348
|
+
}
|
|
3349
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__slot--leftSidebar-footer,
|
|
3350
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__slot--rightSidebar-footer,
|
|
3351
|
+
.smrt-admin-shell[data-footer-divider='off'] .smrt-admin-shell__tenant-rail-footer {
|
|
3352
|
+
border-block-start: 0;
|
|
3353
|
+
}
|
|
3354
|
+
.smrt-admin-shell__dock-panel {
|
|
3355
|
+
border-inline-end: var(--smrt-hairline);
|
|
3356
|
+
background: var(--smrt-surface-raised);
|
|
3357
|
+
color: var(--smrt-color-on-surface);
|
|
3358
|
+
}
|
|
3359
|
+
@media (max-width: 48rem) {
|
|
3360
|
+
.smrt-admin-shell__dock-panel {
|
|
3361
|
+
border-inline-end: 0;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
@layer smrt.structure {
|
|
3367
|
+
.smrt-admin-shell {
|
|
3368
|
+
--smrt-admin-shell-panel-main-min: 20rem;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3203
3371
|
</style>
|
|
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import { type BottomBarMode } from './mobile-shell.js';
|
|
3
3
|
import { type ShellState } from './state.svelte.js';
|
|
4
4
|
import { type ShellSlot } from './slots.js';
|
|
5
|
-
import type { AdminShellPhoneOptions, AdminShellProps, ShellLayoutEditSurface, ShellFocusTool, ShellViewport } from './types.js';
|
|
5
|
+
import type { AdminShellPhoneOptions, AdminShellProps, ShellLayoutEditSurface, ShellFocusTool, ShellPanelResize, ShellViewport } from './types.js';
|
|
6
6
|
interface Props extends AdminShellProps {
|
|
7
7
|
/** Pre-configured shell state. Creates one from config if omitted. */
|
|
8
8
|
state?: ShellState;
|
|
@@ -126,6 +126,31 @@ interface Props extends AdminShellProps {
|
|
|
126
126
|
* sheets close and the phone top bar comes back.
|
|
127
127
|
*/
|
|
128
128
|
path?: string;
|
|
129
|
+
/**
|
|
130
|
+
* A docked panel between the left sidebar and the main area (the order is
|
|
131
|
+
* sidebar, panel, content). Only rendered when given, so existing shells
|
|
132
|
+
* are unchanged. The panel stays mounted while closed (`panelOpen`
|
|
133
|
+
* false hides it), so its state survives a toggle. Off phones it sits
|
|
134
|
+
* beside main with a draggable, keyboard-operable separator; on phones it
|
|
135
|
+
* is a full-size view over main.
|
|
136
|
+
*/
|
|
137
|
+
panel?: Snippet<[{
|
|
138
|
+
viewport: ShellViewport;
|
|
139
|
+
open: boolean;
|
|
140
|
+
}]>;
|
|
141
|
+
/** Whether the docked panel is shown (default true). Host-owned. */
|
|
142
|
+
panelOpen?: boolean;
|
|
143
|
+
/** Accessible name of the panel (default "Panel"). */
|
|
144
|
+
panelLabel?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Resizing of the docked panel: `true` (default) uses the docked-panel
|
|
147
|
+
* limits (280-800 px, 16 px step), an object overrides them, `false`
|
|
148
|
+
* keeps the panel at `panelSize`. The width persists through the shell
|
|
149
|
+
* settings adapter (`ShellSettingsDelta.sizes.panel`).
|
|
150
|
+
*/
|
|
151
|
+
panelResize?: boolean | ShellPanelResize;
|
|
152
|
+
/** The panel's width in px until the user resizes it (default 400). */
|
|
153
|
+
panelSize?: number;
|
|
129
154
|
children: Snippet;
|
|
130
155
|
}
|
|
131
156
|
declare const AdminShell: import("svelte").Component<Props, {}, "rootElement">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminShell.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/AdminShell.svelte.ts"],"names":[],"mappings":"AA6DA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAUtC,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"AdminShell.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/AdminShell.svelte.ts"],"names":[],"mappings":"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"}
|
|
@@ -11,6 +11,7 @@ import { useAdminShell } from './context.js';
|
|
|
11
11
|
import HotkeyInput from './HotkeyInput.svelte';
|
|
12
12
|
import { tryUseShellLayout } from './layout-context.js';
|
|
13
13
|
import { resolveHotkey } from './settings.js';
|
|
14
|
+
import type { ShellSettingsSection } from './settings-sections.js';
|
|
14
15
|
import { SHELL_REGION_MESSAGES } from './slot-labels.js';
|
|
15
16
|
import type { ShellRegion } from './slots.js';
|
|
16
17
|
import type { PanelEdge, ShellHotkeyBinding } from './types.js';
|
|
@@ -28,6 +29,11 @@ interface Props {
|
|
|
28
29
|
* a rejection shows an inline error and leaves the section as it was.
|
|
29
30
|
*/
|
|
30
31
|
onSignOut?: () => unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Render only this section (Appearance and Account then show without their
|
|
34
|
+
* flags). Omit for the one-page mode the flags control.
|
|
35
|
+
*/
|
|
36
|
+
section?: ShellSettingsSection;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
const {
|
|
@@ -35,12 +41,19 @@ const {
|
|
|
35
41
|
account = false,
|
|
36
42
|
signOutHref,
|
|
37
43
|
onSignOut,
|
|
44
|
+
section,
|
|
38
45
|
}: Props = $props();
|
|
39
46
|
|
|
40
47
|
const { t } = useI18n();
|
|
41
48
|
const shell = useAdminShell();
|
|
42
49
|
const layout = tryUseShellLayout();
|
|
43
|
-
const
|
|
50
|
+
const showAppearance = $derived(
|
|
51
|
+
section ? section === 'appearance' : appearance,
|
|
52
|
+
);
|
|
53
|
+
const showAccount = section ? section === 'account' : account;
|
|
54
|
+
const showLayout = $derived(!section || section === 'layout');
|
|
55
|
+
const showShortcuts = $derived(!section || section === 'shortcuts');
|
|
56
|
+
const auth = showAccount ? useAuth() : null;
|
|
44
57
|
const edges: PanelEdge[] = ['top', 'left', 'bottom', 'right'];
|
|
45
58
|
/** The identity `User` carries no display name; hosts may attach one (e.g. from the profile). */
|
|
46
59
|
const accountName = $derived.by(() => {
|
|
@@ -126,7 +139,7 @@ function conflictFor(edge: PanelEdge): string | null {
|
|
|
126
139
|
class="smrt-shell-settings-panel"
|
|
127
140
|
aria-label={t(M['ui.shell_settings_panel.shell_settings'])} data-smrt-component="ShellSettingsPanel"
|
|
128
141
|
>
|
|
129
|
-
{#if
|
|
142
|
+
{#if showAppearance}
|
|
130
143
|
<section data-smrt-part="appearance" aria-labelledby="smrt-shell-settings-appearance">
|
|
131
144
|
<h3 id="smrt-shell-settings-appearance">{t(M['ui.shell_settings.appearance'])}</h3>
|
|
132
145
|
<div class="smrt-shell-settings-panel__controls" data-smrt-part="controls">
|
|
@@ -175,6 +188,7 @@ function conflictFor(edge: PanelEdge): string | null {
|
|
|
175
188
|
</section>
|
|
176
189
|
{/if}
|
|
177
190
|
|
|
191
|
+
{#if showLayout}
|
|
178
192
|
<section data-smrt-part="layout" aria-labelledby="smrt-shell-settings-layout">
|
|
179
193
|
<h3 id="smrt-shell-settings-layout">{t(M['ui.shell_settings.layout'])}</h3>
|
|
180
194
|
<p>{t(M['ui.shell_settings_panel.description'])}</p>
|
|
@@ -262,8 +276,9 @@ function conflictFor(edge: PanelEdge): string | null {
|
|
|
262
276
|
{/each}
|
|
263
277
|
</div>
|
|
264
278
|
</section>
|
|
279
|
+
{/if}
|
|
265
280
|
|
|
266
|
-
{#if shell.hotkeysAvailable}
|
|
281
|
+
{#if showShortcuts && shell.hotkeysAvailable}
|
|
267
282
|
<section data-smrt-part="shortcuts" aria-labelledby="smrt-shell-settings-shortcuts">
|
|
268
283
|
<header>
|
|
269
284
|
<h3 id="smrt-shell-settings-shortcuts">{t(M['ui.shell_settings.shortcuts'])}</h3>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ShellSettingsSection } from './settings-sections.js';
|
|
1
2
|
interface Props {
|
|
2
3
|
/** Show the Appearance section (needs a `ThemeProvider` above). */
|
|
3
4
|
appearance?: boolean;
|
|
@@ -11,6 +12,11 @@ interface Props {
|
|
|
11
12
|
* a rejection shows an inline error and leaves the section as it was.
|
|
12
13
|
*/
|
|
13
14
|
onSignOut?: () => unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Render only this section (Appearance and Account then show without their
|
|
17
|
+
* flags). Omit for the one-page mode the flags control.
|
|
18
|
+
*/
|
|
19
|
+
section?: ShellSettingsSection;
|
|
14
20
|
}
|
|
15
21
|
declare const ShellSettingsPanel: import("svelte").Component<Props, {}, "">;
|
|
16
22
|
type ShellSettingsPanel = ReturnType<typeof ShellSettingsPanel>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellSettingsPanel.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ShellSettingsPanel.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShellSettingsPanel.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ShellSettingsPanel.svelte.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAMnE,UAAU,KAAK;IACb,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AA6PD,QAAA,MAAM,kBAAkB,2CAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
|
@@ -4,11 +4,15 @@ import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
|
4
4
|
import { Avatar, Button } from '@happyvertical/smrt-ui/ui';
|
|
5
5
|
import { tick } from 'svelte';
|
|
6
6
|
import { M } from '../../../i18n/strings.workspace.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
WorkspaceAccountMenuItem,
|
|
9
|
+
WorkspaceAccountTenant,
|
|
10
|
+
} from './types.js';
|
|
8
11
|
|
|
9
12
|
const SIGN_OUT_ID = 'workspace-account:sign-out';
|
|
10
13
|
const SETTINGS_ID = 'workspace-account:settings';
|
|
11
14
|
const TENANT_PREFIX = 'workspace-account:tenant:';
|
|
15
|
+
const ITEM_PREFIX = 'workspace-account:item:';
|
|
12
16
|
|
|
13
17
|
export interface Props {
|
|
14
18
|
/** Username or identifier displayed in the account menu. */
|
|
@@ -38,6 +42,12 @@ export interface Props {
|
|
|
38
42
|
placement?: DropdownPlacement | 'inline-end';
|
|
39
43
|
/** Disables the account menu button. */
|
|
40
44
|
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Host destinations and actions (caller-owned, e.g. Approvals, History),
|
|
47
|
+
* listed after tenants and before Settings. Their badges also show on the
|
|
48
|
+
* closed trigger (the total), so a pending count is visible without opening.
|
|
49
|
+
*/
|
|
50
|
+
items?: WorkspaceAccountMenuItem[];
|
|
41
51
|
/** Adds a Settings link to the menu. */
|
|
42
52
|
settingsHref?: string;
|
|
43
53
|
/**
|
|
@@ -67,6 +77,7 @@ let {
|
|
|
67
77
|
tenantLabel = '',
|
|
68
78
|
roleLabel = '',
|
|
69
79
|
tenants = [],
|
|
80
|
+
items = [],
|
|
70
81
|
currentTenantId = null,
|
|
71
82
|
placement = 'top-start',
|
|
72
83
|
disabled = false,
|
|
@@ -81,8 +92,17 @@ interface Entry {
|
|
|
81
92
|
label: string;
|
|
82
93
|
disabled?: boolean;
|
|
83
94
|
href?: string;
|
|
95
|
+
badge?: number;
|
|
96
|
+
badgeLabel?: string;
|
|
97
|
+
onselect?: () => void;
|
|
84
98
|
}
|
|
85
99
|
|
|
100
|
+
const badgeCount = (value: number | null | undefined): number =>
|
|
101
|
+
typeof value === 'number' && Number.isFinite(value) && value > 0
|
|
102
|
+
? Math.floor(value)
|
|
103
|
+
: 0;
|
|
104
|
+
const badgeText = (count: number): string => (count > 99 ? '99+' : `${count}`);
|
|
105
|
+
|
|
86
106
|
const { t } = useI18n();
|
|
87
107
|
const instanceId = $props.id();
|
|
88
108
|
const menuId = `smrt-account-menu-${instanceId}`;
|
|
@@ -98,6 +118,14 @@ const accountContext = $derived(
|
|
|
98
118
|
const summaryTitle = $derived(
|
|
99
119
|
[identityLabel, activeTenantLabel, roleLabel].filter(Boolean).join(' · '),
|
|
100
120
|
);
|
|
121
|
+
const pendingTotal = $derived(
|
|
122
|
+
items.reduce((sum, item) => sum + badgeCount(item.badge), 0),
|
|
123
|
+
);
|
|
124
|
+
const triggerLabel = $derived(
|
|
125
|
+
pendingTotal > 0
|
|
126
|
+
? `${summaryTitle} (${t(M['ui.workspace_account_menu.pending'], { count: pendingTotal })})`
|
|
127
|
+
: summaryTitle,
|
|
128
|
+
);
|
|
101
129
|
const showEmail = $derived(Boolean(email) && email !== identityLabel);
|
|
102
130
|
const entries = $derived.by(() => {
|
|
103
131
|
const out: Entry[] = [];
|
|
@@ -118,6 +146,18 @@ const entries = $derived.by(() => {
|
|
|
118
146
|
}
|
|
119
147
|
}
|
|
120
148
|
|
|
149
|
+
for (const item of items) {
|
|
150
|
+
const badge = badgeCount(item.badge);
|
|
151
|
+
out.push({
|
|
152
|
+
id: `${ITEM_PREFIX}${item.id}`,
|
|
153
|
+
label: item.label,
|
|
154
|
+
href: item.href,
|
|
155
|
+
badge: badge || undefined,
|
|
156
|
+
badgeLabel: item.badgeLabel,
|
|
157
|
+
onselect: item.onselect,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
121
161
|
if (settingsHref) {
|
|
122
162
|
out.push({
|
|
123
163
|
id: SETTINGS_ID,
|
|
@@ -189,6 +229,7 @@ async function runSignOut() {
|
|
|
189
229
|
|
|
190
230
|
function select(entry: Entry) {
|
|
191
231
|
if (entry.disabled) return;
|
|
232
|
+
entry.onselect?.();
|
|
192
233
|
if (entry.id === SIGN_OUT_ID && onSignOut) {
|
|
193
234
|
// The callback owns the menu: it closes on success only.
|
|
194
235
|
void runSignOut();
|
|
@@ -268,7 +309,7 @@ $effect(() => {
|
|
|
268
309
|
{density}
|
|
269
310
|
class="smrt-workspace-account-menu__trigger"
|
|
270
311
|
data-smrt-part="trigger"
|
|
271
|
-
aria-label={compact ? `${t(M['ui.workspace_account_menu.open'])} ${
|
|
312
|
+
aria-label={compact ? `${t(M['ui.workspace_account_menu.open'])} ${triggerLabel}` : undefined}
|
|
272
313
|
aria-haspopup="menu"
|
|
273
314
|
aria-expanded={open}
|
|
274
315
|
aria-controls={open ? menuId : undefined}
|
|
@@ -279,9 +320,17 @@ $effect(() => {
|
|
|
279
320
|
<span class="smrt-workspace-account-menu__open" data-smrt-part="icon">
|
|
280
321
|
{t(M['ui.workspace_account_menu.open'])}
|
|
281
322
|
</span>
|
|
282
|
-
<
|
|
323
|
+
<span class="smrt-workspace-account-menu__avatar">
|
|
324
|
+
<Avatar src={avatarUrl} name={userName} size="sm" aria-hidden="true" />
|
|
325
|
+
{#if pendingTotal > 0}
|
|
326
|
+
<span class="smrt-workspace-account-menu__badge" data-smrt-part="trigger-badge" aria-hidden="true">{badgeText(pendingTotal)}</span>
|
|
327
|
+
{/if}
|
|
328
|
+
</span>
|
|
283
329
|
<span class="smrt-workspace-account-menu__identity" data-smrt-part="body">
|
|
284
330
|
<span class="smrt-workspace-account-menu__summary" data-smrt-part="label">{identityLabel}</span>
|
|
331
|
+
{#if pendingTotal > 0}
|
|
332
|
+
<span class="smrt-workspace-account-menu__open">{t(M['ui.workspace_account_menu.pending'], { count: pendingTotal })}</span>
|
|
333
|
+
{/if}
|
|
285
334
|
{#if accountContext}
|
|
286
335
|
<span class="smrt-workspace-account-menu__context" data-smrt-part="description">{accountContext}</span>
|
|
287
336
|
{/if}
|
|
@@ -308,7 +357,7 @@ $effect(() => {
|
|
|
308
357
|
href={entry.href}
|
|
309
358
|
tabindex="-1"
|
|
310
359
|
onclick={() => select(entry)} data-smrt-part="item"
|
|
311
|
-
>{entry.label}</a>
|
|
360
|
+
>{entry.label}{#if entry.badge}<span class="smrt-workspace-account-menu__badge smrt-workspace-account-menu__badge--item" data-smrt-part="item-badge" aria-label={entry.badgeLabel ?? t(M['ui.workspace_account_menu.pending'], { count: entry.badge })}>{badgeText(entry.badge)}</span>{/if}</a>
|
|
312
361
|
{:else}
|
|
313
362
|
<!-- raw-primitive-allow: role="menuitem" with roving tabindex inside a role="menu"; not a content button -->
|
|
314
363
|
<button
|
|
@@ -320,7 +369,7 @@ $effect(() => {
|
|
|
320
369
|
aria-busy={entry.id === SIGN_OUT_ID && signingOut ? 'true' : undefined}
|
|
321
370
|
tabindex="-1"
|
|
322
371
|
onclick={() => select(entry)} data-smrt-part="item"
|
|
323
|
-
>{entry.label}</button>
|
|
372
|
+
>{entry.label}{#if entry.badge}<span class="smrt-workspace-account-menu__badge smrt-workspace-account-menu__badge--item" data-smrt-part="item-badge" aria-label={entry.badgeLabel ?? t(M['ui.workspace_account_menu.pending'], { count: entry.badge })}>{badgeText(entry.badge)}</span>{/if}</button>
|
|
324
373
|
{/if}
|
|
325
374
|
{/each}
|
|
326
375
|
{#if signOutFailed}
|
|
@@ -563,4 +612,39 @@ $effect(() => {
|
|
|
563
612
|
}
|
|
564
613
|
}
|
|
565
614
|
}
|
|
615
|
+
|
|
616
|
+
@layer smrt.structure {
|
|
617
|
+
.smrt-workspace-account-menu__item {
|
|
618
|
+
gap: var(--smrt-spacing-2);
|
|
619
|
+
}
|
|
620
|
+
.smrt-workspace-account-menu__avatar {
|
|
621
|
+
position: relative;
|
|
622
|
+
display: inline-flex;
|
|
623
|
+
}
|
|
624
|
+
.smrt-workspace-account-menu__badge {
|
|
625
|
+
position: absolute;
|
|
626
|
+
inset-block-start: calc(-1 * var(--smrt-spacing-1));
|
|
627
|
+
inset-inline-end: calc(-1 * var(--smrt-spacing-1));
|
|
628
|
+
box-sizing: border-box;
|
|
629
|
+
min-inline-size: 1rem;
|
|
630
|
+
block-size: 1rem;
|
|
631
|
+
padding-inline: var(--smrt-spacing-1);
|
|
632
|
+
}
|
|
633
|
+
.smrt-workspace-account-menu__badge--item {
|
|
634
|
+
position: static;
|
|
635
|
+
margin-inline-start: auto;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
@layer smrt.theme {
|
|
640
|
+
.smrt-workspace-account-menu__badge {
|
|
641
|
+
border-radius: var(--smrt-radius-full);
|
|
642
|
+
background: var(--smrt-color-primary);
|
|
643
|
+
color: var(--smrt-color-on-primary);
|
|
644
|
+
font-size: var(--smrt-typography-label-small-size);
|
|
645
|
+
font-weight: var(--smrt-typography-weight-medium);
|
|
646
|
+
line-height: 1rem;
|
|
647
|
+
text-align: center;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
566
650
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DropdownPlacement } from '@happyvertical/smrt-ui';
|
|
2
|
-
import type { WorkspaceAccountTenant } from './types.js';
|
|
2
|
+
import type { WorkspaceAccountMenuItem, WorkspaceAccountTenant } from './types.js';
|
|
3
3
|
export interface Props {
|
|
4
4
|
/** Username or identifier displayed in the account menu. */
|
|
5
5
|
userName: string;
|
|
@@ -28,6 +28,12 @@ export interface Props {
|
|
|
28
28
|
placement?: DropdownPlacement | 'inline-end';
|
|
29
29
|
/** Disables the account menu button. */
|
|
30
30
|
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Host destinations and actions (caller-owned, e.g. Approvals, History),
|
|
33
|
+
* listed after tenants and before Settings. Their badges also show on the
|
|
34
|
+
* closed trigger (the total), so a pending count is visible without opening.
|
|
35
|
+
*/
|
|
36
|
+
items?: WorkspaceAccountMenuItem[];
|
|
31
37
|
/** Adds a Settings link to the menu. */
|
|
32
38
|
settingsHref?: string;
|
|
33
39
|
/**
|