@happyvertical/smrt-svelte 0.37.8 → 0.37.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/AGENTS.md +22 -86
  2. package/README.md +14 -10
  3. package/dist/components/workspace/MIGRATION.md +55 -0
  4. package/dist/components/workspace/README.md +22 -25
  5. package/dist/components/workspace/__tests__/AdminShell.test.js +55 -0
  6. package/dist/components/workspace/__tests__/admin-shell-hotkeys.test.js +34 -0
  7. package/dist/components/workspace/__tests__/admin-shell-settings.test.js +25 -0
  8. package/dist/components/workspace/__tests__/admin-shell-state.test.js +110 -0
  9. package/dist/components/workspace/__tests__/index.test.js +15 -24
  10. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts +2 -1
  11. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts.map +1 -1
  12. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.js +1 -1
  13. package/dist/components/workspace/admin-shell/ActivityBadge.svelte +25 -0
  14. package/dist/components/workspace/admin-shell/ActivityBadge.svelte.d.ts +9 -0
  15. package/dist/components/workspace/admin-shell/ActivityBadge.svelte.d.ts.map +1 -0
  16. package/dist/components/workspace/admin-shell/ActivityItem.svelte +85 -0
  17. package/dist/components/workspace/admin-shell/ActivityItem.svelte.d.ts +8 -0
  18. package/dist/components/workspace/admin-shell/ActivityItem.svelte.d.ts.map +1 -0
  19. package/dist/components/workspace/admin-shell/ActivityList.svelte +41 -0
  20. package/dist/components/workspace/admin-shell/ActivityList.svelte.d.ts +10 -0
  21. package/dist/components/workspace/admin-shell/ActivityList.svelte.d.ts.map +1 -0
  22. package/dist/components/workspace/admin-shell/ActivityToasts.svelte +140 -0
  23. package/dist/components/workspace/admin-shell/ActivityToasts.svelte.d.ts +16 -0
  24. package/dist/components/workspace/admin-shell/ActivityToasts.svelte.d.ts.map +1 -0
  25. package/dist/components/workspace/admin-shell/AdminShell.svelte +691 -0
  26. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts +24 -0
  27. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts.map +1 -0
  28. package/dist/components/workspace/admin-shell/AppScopePanel.svelte +94 -0
  29. package/dist/components/workspace/admin-shell/AppScopePanel.svelte.d.ts +14 -0
  30. package/dist/components/workspace/admin-shell/AppScopePanel.svelte.d.ts.map +1 -0
  31. package/dist/components/workspace/admin-shell/HotkeyInput.svelte +74 -0
  32. package/dist/components/workspace/admin-shell/HotkeyInput.svelte.d.ts +11 -0
  33. package/dist/components/workspace/admin-shell/HotkeyInput.svelte.d.ts.map +1 -0
  34. package/dist/components/workspace/admin-shell/ShellCorner.svelte +25 -0
  35. package/dist/components/workspace/admin-shell/ShellCorner.svelte.d.ts +9 -0
  36. package/dist/components/workspace/admin-shell/ShellCorner.svelte.d.ts.map +1 -0
  37. package/dist/components/workspace/admin-shell/ShellDockTool.svelte +19 -0
  38. package/dist/components/workspace/admin-shell/ShellDockTool.svelte.d.ts +7 -0
  39. package/dist/components/workspace/admin-shell/ShellDockTool.svelte.d.ts.map +1 -0
  40. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte +146 -0
  41. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts +4 -0
  42. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts.map +1 -0
  43. package/dist/components/workspace/admin-shell/ShortcutsOverlay.svelte +81 -0
  44. package/dist/components/workspace/admin-shell/ShortcutsOverlay.svelte.d.ts +7 -0
  45. package/dist/components/workspace/admin-shell/ShortcutsOverlay.svelte.d.ts.map +1 -0
  46. package/dist/components/workspace/admin-shell/SystemScopePanel.svelte +118 -0
  47. package/dist/components/workspace/admin-shell/SystemScopePanel.svelte.d.ts +9 -0
  48. package/dist/components/workspace/admin-shell/SystemScopePanel.svelte.d.ts.map +1 -0
  49. package/dist/components/workspace/admin-shell/SystemStatusChips.svelte +71 -0
  50. package/dist/components/workspace/admin-shell/SystemStatusChips.svelte.d.ts +8 -0
  51. package/dist/components/workspace/admin-shell/SystemStatusChips.svelte.d.ts.map +1 -0
  52. package/dist/components/workspace/admin-shell/TenantNav.svelte +101 -0
  53. package/dist/components/workspace/admin-shell/TenantNav.svelte.d.ts +10 -0
  54. package/dist/components/workspace/admin-shell/TenantNav.svelte.d.ts.map +1 -0
  55. package/dist/components/workspace/admin-shell/context.d.ts +6 -0
  56. package/dist/components/workspace/admin-shell/context.d.ts.map +1 -0
  57. package/dist/components/workspace/admin-shell/context.js +16 -0
  58. package/dist/components/workspace/admin-shell/hotkeys.d.ts +14 -0
  59. package/dist/components/workspace/admin-shell/hotkeys.d.ts.map +1 -0
  60. package/dist/components/workspace/admin-shell/hotkeys.js +62 -0
  61. package/dist/components/workspace/admin-shell/settings.d.ts +14 -0
  62. package/dist/components/workspace/admin-shell/settings.d.ts.map +1 -0
  63. package/dist/components/workspace/admin-shell/settings.js +139 -0
  64. package/dist/components/workspace/admin-shell/state.svelte.d.ts +47 -0
  65. package/dist/components/workspace/admin-shell/state.svelte.d.ts.map +1 -0
  66. package/dist/components/workspace/admin-shell/state.svelte.js +252 -0
  67. package/dist/components/workspace/admin-shell/types.d.ts +137 -0
  68. package/dist/components/workspace/admin-shell/types.d.ts.map +1 -0
  69. package/dist/components/workspace/admin-shell/types.js +13 -0
  70. package/dist/components/workspace/index.d.ts +25 -11
  71. package/dist/components/workspace/index.d.ts.map +1 -1
  72. package/dist/components/workspace/index.js +24 -10
  73. package/dist/i18n/strings.workspace.d.ts +30 -0
  74. package/dist/i18n/strings.workspace.d.ts.map +1 -1
  75. package/dist/i18n/strings.workspace.js +31 -0
  76. package/dist/internal/logger.d.ts +13 -6
  77. package/dist/internal/logger.d.ts.map +1 -1
  78. package/dist/internal/logger.js +33 -8
  79. package/dist/internal/logger.test.js +54 -0
  80. package/dist/web/__tests__/harness.svelte +25 -0
  81. package/dist/web/__tests__/harness.svelte.d.ts +15 -0
  82. package/dist/web/__tests__/harness.svelte.d.ts.map +1 -0
  83. package/dist/web/__tests__/live-collection.svelte.test.js +184 -0
  84. package/dist/web/index.d.ts +13 -0
  85. package/dist/web/index.d.ts.map +1 -0
  86. package/dist/web/index.js +12 -0
  87. package/dist/web/live-collection.svelte.d.ts +132 -0
  88. package/dist/web/live-collection.svelte.d.ts.map +1 -0
  89. package/dist/web/live-collection.svelte.js +173 -0
  90. package/package.json +13 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityBadge.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ActivityBadge.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,UAAU,KAAK;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
+ import { Button } from '@happyvertical/smrt-ui/ui';
4
+ import { M } from '../../../i18n/strings.workspace.js';
5
+ import type { ShellActivity } from './types.js';
6
+
7
+ interface Props {
8
+ activity: ShellActivity;
9
+ }
10
+
11
+ let { activity }: Props = $props();
12
+ const { t } = useI18n();
13
+ </script>
14
+
15
+ <article class="smrt-activity-item" data-status={activity.status}>
16
+ <div class="smrt-activity-item__main">
17
+ <strong>{activity.label}</strong>
18
+ <span>{activity.status}</span>
19
+ {#if activity.message}
20
+ <p>{activity.message}</p>
21
+ {/if}
22
+ {#if typeof activity.progress === 'number'}
23
+ <progress max="100" value={activity.progress}>
24
+ {Math.round(activity.progress)}%
25
+ </progress>
26
+ {/if}
27
+ </div>
28
+ <div class="smrt-activity-item__actions">
29
+ {#if activity.detailHref}
30
+ <Button variant="ghost" size="sm" href={activity.detailHref}>
31
+ {t(M['ui.activity_item.view'])}
32
+ </Button>
33
+ {/if}
34
+ {#if activity.cancel && (activity.status === 'queued' || activity.status === 'running')}
35
+ <Button variant="ghost" size="sm" onclick={() => activity.cancel?.()}>
36
+ {t(M['ui.activity_item.cancel'])}
37
+ </Button>
38
+ {/if}
39
+ </div>
40
+ </article>
41
+
42
+ <style>
43
+ .smrt-activity-item {
44
+ display: flex;
45
+ align-items: flex-start;
46
+ justify-content: space-between;
47
+ gap: var(--smrt-spacing-3);
48
+ padding: var(--smrt-spacing-3) 0;
49
+ border-block-end: 1px solid var(--smrt-color-outline-variant);
50
+ }
51
+
52
+ .smrt-activity-item__main {
53
+ display: grid;
54
+ gap: var(--smrt-spacing-1);
55
+ min-width: 0;
56
+ }
57
+
58
+ .smrt-activity-item strong,
59
+ .smrt-activity-item span,
60
+ .smrt-activity-item p {
61
+ overflow-wrap: anywhere;
62
+ }
63
+
64
+ .smrt-activity-item span {
65
+ color: var(--smrt-color-on-surface-variant);
66
+ font-size: var(--smrt-typography-body-small-size);
67
+ text-transform: uppercase;
68
+ }
69
+
70
+ .smrt-activity-item p {
71
+ margin: 0;
72
+ color: var(--smrt-color-on-surface-variant);
73
+ }
74
+
75
+ .smrt-activity-item progress {
76
+ width: min(16rem, 100%);
77
+ }
78
+
79
+ .smrt-activity-item__actions {
80
+ display: flex;
81
+ flex-wrap: wrap;
82
+ gap: var(--smrt-spacing-2);
83
+ justify-content: flex-end;
84
+ }
85
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { ShellActivity } from './types.js';
2
+ interface Props {
3
+ activity: ShellActivity;
4
+ }
5
+ declare const ActivityItem: import("svelte").Component<Props, {}, "">;
6
+ type ActivityItem = ReturnType<typeof ActivityItem>;
7
+ export default ActivityItem;
8
+ //# sourceMappingURL=ActivityItem.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityItem.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ActivityItem.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,UAAU,KAAK;IACb,QAAQ,EAAE,aAAa,CAAC;CACzB;AA2CD,QAAA,MAAM,YAAY,2CAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
+ import { M } from '../../../i18n/strings.workspace.js';
4
+ import ActivityItem from './ActivityItem.svelte';
5
+ import { useAdminShell } from './context.js';
6
+ import type { ShellActivityFilter } from './types.js';
7
+
8
+ interface Props {
9
+ filter?: ShellActivityFilter;
10
+ hideWhenEmpty?: boolean;
11
+ emptyLabel?: string;
12
+ }
13
+
14
+ let { filter = {}, hideWhenEmpty = false, emptyLabel }: Props = $props();
15
+ const { t } = useI18n();
16
+ const shell = useAdminShell();
17
+ const activities = $derived(shell.listActivities(filter));
18
+ </script>
19
+
20
+ {#if activities.length > 0}
21
+ <div class="smrt-activity-list">
22
+ {#each activities as activity (activity.id)}
23
+ <ActivityItem {activity} />
24
+ {/each}
25
+ </div>
26
+ {:else if !hideWhenEmpty}
27
+ <p class="smrt-activity-list__empty">
28
+ {emptyLabel ?? t(M['ui.activity_list.empty'])}
29
+ </p>
30
+ {/if}
31
+
32
+ <style>
33
+ .smrt-activity-list {
34
+ display: grid;
35
+ }
36
+
37
+ .smrt-activity-list__empty {
38
+ margin: 0;
39
+ color: var(--smrt-color-on-surface-variant);
40
+ }
41
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { ShellActivityFilter } from './types.js';
2
+ interface Props {
3
+ filter?: ShellActivityFilter;
4
+ hideWhenEmpty?: boolean;
5
+ emptyLabel?: string;
6
+ }
7
+ declare const ActivityList: import("svelte").Component<Props, {}, "">;
8
+ type ActivityList = ReturnType<typeof ActivityList>;
9
+ export default ActivityList;
10
+ //# sourceMappingURL=ActivityList.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityList.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ActivityList.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD,UAAU,KAAK;IACb,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+BD,QAAA,MAAM,YAAY,2CAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,140 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
+ import { Button } from '@happyvertical/smrt-ui/ui';
4
+ import { onDestroy, onMount } from 'svelte';
5
+ import { M } from '../../../i18n/strings.workspace.js';
6
+ import { useAdminShell } from './context.js';
7
+ import type { ShellActivity, ShellActivityEvent } from './types.js';
8
+
9
+ interface Toast {
10
+ id: string;
11
+ activity: ShellActivity;
12
+ event: ShellActivityEvent['type'];
13
+ }
14
+
15
+ interface Props {
16
+ max?: number;
17
+ /**
18
+ * Which lifecycle events raise a toast. Defaults to lifecycle-only:
19
+ * a newly-created activity ("started") or a status transition
20
+ * (completed / failed / canceled). Progress-only updates keep the same
21
+ * status and carry a `previous` snapshot, so they never toast — otherwise
22
+ * a running job spawns one toast per progress tick.
23
+ */
24
+ notify?: (event: ShellActivityEvent) => boolean;
25
+ }
26
+
27
+ let { max = 4, notify = defaultShouldNotify }: Props = $props();
28
+ const { t } = useI18n();
29
+ const shell = useAdminShell();
30
+ let toasts = $state<Toast[]>([]);
31
+ let unwatch: (() => void) | null = null;
32
+
33
+ function defaultShouldNotify(event: ShellActivityEvent): boolean {
34
+ if (event.type === 'transition') return true;
35
+ return event.type === 'upsert' && !event.previous;
36
+ }
37
+
38
+ function pushToast(event: ShellActivityEvent): void {
39
+ if (event.type === 'remove' || !notify(event)) return;
40
+ const toast = {
41
+ id: `${event.activity.id}:${event.activity.updatedAt ?? Date.now()}`,
42
+ activity: event.activity,
43
+ event: event.type,
44
+ };
45
+ toasts = [toast, ...toasts].slice(0, max);
46
+ }
47
+
48
+ function dismiss(id: string): void {
49
+ toasts = toasts.filter((toast) => toast.id !== id);
50
+ }
51
+
52
+ onMount(() => {
53
+ unwatch = shell.watchActivities(pushToast);
54
+ });
55
+
56
+ onDestroy(() => {
57
+ unwatch?.();
58
+ });
59
+ </script>
60
+
61
+ {#if toasts.length > 0}
62
+ <div class="smrt-activity-toasts" aria-live="polite">
63
+ {#each toasts as toast (toast.id)}
64
+ <article class="smrt-activity-toast" data-status={toast.activity.status}>
65
+ <div>
66
+ <strong>{toast.activity.label}</strong>
67
+ <span>{toast.activity.status}</span>
68
+ </div>
69
+ <Button
70
+ variant="ghost"
71
+ size="sm"
72
+ aria-label={t(M['ui.activity_toasts.dismiss'])}
73
+ onclick={() => dismiss(toast.id)}
74
+ >
75
+ {t(M['ui.activity_toasts.dismiss_action'])}
76
+ </Button>
77
+ </article>
78
+ {/each}
79
+ </div>
80
+ {/if}
81
+
82
+ <style>
83
+ .smrt-activity-toasts {
84
+ position: fixed;
85
+ inset-block-start: var(--smrt-spacing-4);
86
+ inset-inline-end: var(--smrt-spacing-4);
87
+ z-index: var(--smrt-z-index-toast, 1500);
88
+ display: grid;
89
+ gap: var(--smrt-spacing-3);
90
+ inline-size: min(24rem, calc(100vw - var(--smrt-spacing-8)));
91
+ }
92
+
93
+ .smrt-activity-toast {
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: space-between;
97
+ gap: var(--smrt-spacing-3);
98
+ border: 1px solid var(--smrt-color-outline-variant);
99
+ border-radius: var(--smrt-radius-medium);
100
+ background: var(--smrt-color-surface-container);
101
+ color: var(--smrt-color-on-surface);
102
+ padding: var(--smrt-spacing-3);
103
+ box-shadow: var(--smrt-elevation-2);
104
+ }
105
+
106
+ .smrt-activity-toast div {
107
+ display: grid;
108
+ gap: var(--smrt-spacing-1);
109
+ min-width: 0;
110
+ }
111
+
112
+ .smrt-activity-toast strong,
113
+ .smrt-activity-toast span {
114
+ overflow-wrap: anywhere;
115
+ }
116
+
117
+ .smrt-activity-toast span {
118
+ color: var(--smrt-color-on-surface-variant);
119
+ font-size: var(--smrt-typography-body-small-size);
120
+ text-transform: uppercase;
121
+ }
122
+
123
+ @media (prefers-reduced-motion: no-preference) {
124
+ .smrt-activity-toast {
125
+ animation: smrt-activity-toast-in var(--smrt-duration-short3)
126
+ var(--smrt-easing-emphasized-decelerate);
127
+ }
128
+ }
129
+
130
+ @keyframes smrt-activity-toast-in {
131
+ from {
132
+ opacity: 0;
133
+ transform: translateY(calc(-1 * var(--smrt-spacing-3)));
134
+ }
135
+ to {
136
+ opacity: 1;
137
+ transform: translateY(0);
138
+ }
139
+ }
140
+ </style>
@@ -0,0 +1,16 @@
1
+ import type { ShellActivityEvent } from './types.js';
2
+ interface Props {
3
+ max?: number;
4
+ /**
5
+ * Which lifecycle events raise a toast. Defaults to lifecycle-only:
6
+ * a newly-created activity ("started") or a status transition
7
+ * (completed / failed / canceled). Progress-only updates keep the same
8
+ * status and carry a `previous` snapshot, so they never toast — otherwise
9
+ * a running job spawns one toast per progress tick.
10
+ */
11
+ notify?: (event: ShellActivityEvent) => boolean;
12
+ }
13
+ declare const ActivityToasts: import("svelte").Component<Props, {}, "">;
14
+ type ActivityToasts = ReturnType<typeof ActivityToasts>;
15
+ export default ActivityToasts;
16
+ //# sourceMappingURL=ActivityToasts.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityToasts.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/admin-shell/ActivityToasts.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AASpE,UAAU,KAAK;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC;CACjD;AAiED,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}