@happyvertical/smrt-svelte 0.73.0 → 0.74.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 +1 -1
- package/README.md +2 -2
- package/agents/overview-surfaces.md +2 -1
- package/dist/components/activity/ActivityList.svelte +311 -28
- package/dist/components/activity/ActivityList.svelte.d.ts +2 -4
- package/dist/components/activity/ActivityList.svelte.d.ts.map +1 -1
- package/dist/components/activity/index.d.ts +3 -1
- package/dist/components/activity/index.d.ts.map +1 -1
- package/dist/components/activity/index.js +2 -0
- package/dist/components/activity/safe-href.d.ts +1 -1
- package/dist/components/activity/safe-href.d.ts.map +1 -1
- package/dist/components/activity/safe-href.js +19 -4
- package/dist/components/activity/time.d.ts +27 -0
- package/dist/components/activity/time.d.ts.map +1 -0
- package/dist/components/activity/time.js +171 -0
- package/dist/components/activity/types.d.ts +56 -1
- package/dist/components/activity/types.d.ts.map +1 -1
- package/dist/components/overview/OverviewGrid.svelte +6 -0
- package/dist/components/overview/OverviewGrid.svelte.d.ts.map +1 -1
- package/dist/components/overview/controller.svelte.d.ts +4 -0
- package/dist/components/overview/controller.svelte.d.ts.map +1 -1
- package/dist/components/overview/controller.svelte.js +25 -2
- package/dist/components/overview/index.d.ts +4 -2
- package/dist/components/overview/index.d.ts.map +1 -1
- package/dist/components/overview/index.js +2 -1
- package/dist/components/overview/load.d.ts +4 -0
- package/dist/components/overview/load.d.ts.map +1 -1
- package/dist/components/overview/load.js +17 -1
- package/dist/components/overview/server.d.ts +4 -0
- package/dist/components/overview/server.d.ts.map +1 -1
- package/dist/components/overview/server.js +2 -0
- package/dist/components/overview/types.d.ts +12 -0
- package/dist/components/overview/types.d.ts.map +1 -1
- package/dist/components/overview/widgets/ActivityWidget.svelte +238 -0
- package/dist/components/overview/widgets/ActivityWidget.svelte.d.ts +6 -0
- package/dist/components/overview/widgets/ActivityWidget.svelte.d.ts.map +1 -0
- package/dist/components/overview/widgets/core.d.ts +11 -2
- package/dist/components/overview/widgets/core.d.ts.map +1 -1
- package/dist/components/overview/widgets/core.js +33 -1
- package/dist/components/overview/widgets/data.d.ts +5 -0
- package/dist/components/overview/widgets/data.d.ts.map +1 -1
- package/dist/components/workspace/admin-shell/ActivityItem.svelte +322 -33
- package/dist/components/workspace/admin-shell/ActivityItem.svelte.d.ts +16 -3
- package/dist/components/workspace/admin-shell/ActivityItem.svelte.d.ts.map +1 -1
- package/dist/i18n/strings.overview.d.ts +2 -0
- package/dist/i18n/strings.overview.d.ts.map +1 -1
- package/dist/i18n/strings.overview.js +2 -0
- package/dist/i18n/strings.workspace.d.ts +13 -0
- package/dist/i18n/strings.workspace.d.ts.map +1 -1
- package/dist/i18n/strings.workspace.js +13 -0
- package/dist/smrt-knowledge.okf.md +2 -2
- package/package.json +16 -16
package/AGENTS.md
CHANGED
|
@@ -21,7 +21,7 @@ subpath you are editing. This file keeps what holds in every module.
|
|
|
21
21
|
| `src/components/workspace/` (`./workspace` + `./web`) | the AdminShell family and its principles, the legacy ToolsDock surface, the `./web` activity-feed and `updateAvailable` adapters, and server-side dock gates | [agents/workspace.md](agents/workspace.md) |
|
|
22
22
|
| `src/components/command-palette/` (`./command-palette`) | `CommandPalette` trigger + dialog, `PaletteProvider` contract, nav and manifest providers (#3713) | [agents/command-palette.md](agents/command-palette.md) |
|
|
23
23
|
| `src/components/cookbook/` (`./cookbook` + `./cookbook/server`) | cookbook-driven app shell: pure `buildCookbookShell` (cookbook + recipe catalog to `AppShell` sections, entries, layout, theme, section overviews, recipe surfaces), `CookbookApp` / `CookbookSectionPage`, and the server `loadCookbookApp` (file + installed manifests + validation); ported from smrt-planner (#3749) | [agents/cookbook-shell.md](agents/cookbook-shell.md) |
|
|
24
|
-
| `src/components/overview/` (`./overview` + `./overview/server`) | customizable overview surfaces: `OverviewGrid` flow grid (span 1-4, keyboard reorder/resize) joined to the shell's layout edit mode, host-owned `createOverview` controller, widget registry with versioned option schemas validated on save and load, the server `load(options, ctx)` contract (`loadOverview`), the metric/chart/records/shortcuts/note core widgets (records as a role-column table with a `DataTable` summaries footer), the record-page `related` (tabbed) and `line-items` (totals block) widgets, and `registerRecipeWidgets` (recipe `widget` surfaces to registry registrations, injected module resolver) (#3727); production persistence is `@happyvertical/smrt-preferences` (kind `overview`) | [agents/overview-surfaces.md](agents/overview-surfaces.md) |
|
|
24
|
+
| `src/components/overview/` (`./overview` + `./overview/server`) | customizable overview surfaces: `OverviewGrid` flow grid (span 1-4, keyboard reorder/resize) joined to the shell's layout edit mode, host-owned `createOverview` controller, widget registry with versioned option schemas validated on save and load, the server `load(options, ctx)` contract (`loadOverview`), the metric/chart/records/shortcuts/activity/note core widgets (records as a role-column table with a `DataTable` summaries footer), the record-page `related` (tabbed) and `line-items` (totals block) widgets, and `registerRecipeWidgets` (recipe `widget` surfaces to registry registrations, injected module resolver) (#3727); production persistence is `@happyvertical/smrt-preferences` (kind `overview`) | [agents/overview-surfaces.md](agents/overview-surfaces.md) |
|
|
25
25
|
| `src/web/remote-query.svelte.ts` | Svelte 5 binding for query-shaped remote pages: rows, page, totals, loading/refreshing/stale/error, retry, last-updated, and query-scoped live subscriptions (#2445) | — |
|
|
26
26
|
| `src/web/list-data-surface.svelte.ts` (`mountListDataSurface`) | Registers an existing non-`DataTable` list (mirroring a `DataTableController`) as a mounted `DataSurfaceDescriptor`; a same-behavior port of `registerContentListDataSurface`, not yet unified behind smrt-ui (#2917). The module doc comment is the authoritative list of divergences (#2906) | — |
|
|
27
27
|
| `src/web/webmcp-provider.ts` | Provider config for generated data/model WebMCP tools: definitions, effect policy, namespace, budget, legacy/canonical filters, and fetcher seams (#2520) | — |
|
package/README.md
CHANGED
|
@@ -711,7 +711,7 @@ importable, even if it appears in `dist/`.
|
|
|
711
711
|
|
|
712
712
|
| Import Path | Contents |
|
|
713
713
|
|-------------|----------|
|
|
714
|
-
| `@happyvertical/smrt-svelte` | `Provider`, hooks (`useAppState`, `useAuth`, `useLLM`, `useSocket`, `useSTT`, `useTheme`, `useTTS`), app state/context, `ModulePanel`, and the form components below |
|
|
714
|
+
| `@happyvertical/smrt-svelte` | `Provider`, hooks (`useAppState`, `useAuth`, `useLLM`, `useSocket`, `useSTT`, `useTheme`, `useTTS`), app state/context, `ActivityList`, `ModulePanel`, and the form components below |
|
|
715
715
|
| `@happyvertical/smrt-svelte/forms` | Form inputs (TextInput, Select, MoneyInput, DateTimeInput, Toggle, etc.) |
|
|
716
716
|
| `@happyvertical/smrt-svelte/import-export` | `ImportExport` (CSV/TSV import with column mapping, validation preview and error report; export with column selection), `createCollectionImportExport`, `fieldsFromCollectionDefinition`, and the pure CSV layer |
|
|
717
717
|
| `@happyvertical/smrt-svelte/settings` | Server-paged settings search, selection, and list/detail layout (`SettingsCatalog`, `paginateSettingsCatalog`) |
|
|
@@ -720,7 +720,7 @@ importable, even if it appears in `dist/`.
|
|
|
720
720
|
| `@happyvertical/smrt-svelte/app` | `AppShell` (Provider + themes + AdminShell + nav/dock slots, `dockToggles` buttons and host `slots` for the header/footer/sidebar regions), `OwnerSetupForm` (first-run owner setup), `ShellSettingsPage`, `RuntimeDiagnosticsWebMcp` |
|
|
721
721
|
| `@happyvertical/smrt-svelte/app/runtime-diagnostics` | Svelte-free diagnostics WebMCP registration and its tool name/endpoint constants, importable from server routes |
|
|
722
722
|
| `@happyvertical/smrt-svelte/command-palette` | Global search and command palette: `CommandPalette` (shell-slot trigger plus dialog), `createCommandPalette`, the provider contract, and the navigation and manifest-driven model providers |
|
|
723
|
-
| `@happyvertical/smrt-svelte/overview` | Customizable overview surfaces: `OverviewGrid` (flow grid with keyboard reorder and resize), `createOverview` (host-owned controller), the widget registry (`registerWidget`), `registerCoreWidgets` (metric, chart, record list, shortcuts, note) and `shortcutsFromNav` |
|
|
723
|
+
| `@happyvertical/smrt-svelte/overview` | Customizable overview surfaces: `OverviewGrid` (flow grid with keyboard reorder and resize), `createOverview` (host-owned controller), the widget registry (`registerWidget`), `registerCoreWidgets` (metric, chart, record list, shortcuts, activity, note) and `shortcutsFromNav` |
|
|
724
724
|
| `@happyvertical/smrt-svelte/overview/server` | Svelte-free half of the overview surface: the data model (`resolveOverview`, `checkOverviewOverride`), option-schema validation, `WidgetRegistry`, and `loadOverview` for a page's server load; `recordOverview` / `recordOverviewId` (the record view's default overview, per model kind) |
|
|
725
725
|
| `@happyvertical/smrt-svelte/workspace/legacy` | Opt-in ToolsDock compatibility surface for applications migrating to AdminShell |
|
|
726
726
|
| `@happyvertical/smrt-svelte/workspace/server` | Server-side workspace helpers (Node only) |
|
|
@@ -228,6 +228,7 @@ shape. Data shapes are in `widgets/data.ts`.
|
|
|
228
228
|
| `chart` | `title`, `model`*, `groupBy`, `measure`, `field`, `period`, `style` (bar/line/table/pie/stat), `filter` | `{ points: [{ label, value }], format?, currency?, href?, delta? }`, one measure of a runtime report |
|
|
229
229
|
| `records` | `title`, `model`*, `sort`, `field`, `direction`, `limit`, `filter`, `columns`, `summaries` | `{ rows: [{ id, title, subtitle?, meta?, href?, cells? }], total?, href?, columns?, currency?, timeZone?, summaries? }`; the loader chooses the title field and the visible records; `field` is the FK for `filter: 'parent'`; with columns (the option, else `data.columns`) the rows are a table — see "Records tables" |
|
|
230
230
|
| `shortcuts` | `title`, `section` | `{ items: [{ id, label, href, icon?, description?, count? }] }` (`count` draws as "N records"; widgets also receive the grid's `presentation` and the shortcuts widget drops its entry frame under `plain`); `shortcutsFromNav(sections, sectionId)` maps `resolveShellNavModel` / `useShellLayout().sections` (visible entries, user renames) |
|
|
231
|
+
| `activity` | `title`, `limit` | `ActivityWidgetData`: `{ entries: ActivityListEntry[], emptyLabel?, caughtUpLabel?, sourceFilter?, onDismiss?, onDismissMany?, onRestore?, canUndo?, onUndo?, dismissedCount?, showDismissed?, onToggleShowDismissed?, now?, timeZone?, locale? }`, rendered via `ActivityList` (`defaultSpan: 4`; pass `activity: loader` or `activity: true` for client-seeded overviews; `loadOverview` stamps a shared `loadedAt` reference clock and default `'UTC'` `timeZone` so SSR and hydration agree) |
|
|
231
232
|
| `note` | `title`, `body` (Markdown) | none |
|
|
232
233
|
|
|
233
234
|
`note` renders `parseMarkdown` output as elements (headings, paragraphs, lists,
|
|
@@ -472,7 +473,7 @@ and the person can undo the change.
|
|
|
472
473
|
- **Phase 4, assistant (#3727, done).** See "Assistant operations" above;
|
|
473
474
|
`createOverviewAssistantSurface` is wired to the stored user tier through
|
|
474
475
|
`createOverviewStore(...).save` as shown there.
|
|
475
|
-
- **Not built:**
|
|
476
|
+
- **Not built:** agenda.
|
|
476
477
|
|
|
477
478
|
## Record overviews (`record.ts`)
|
|
478
479
|
|
|
@@ -1,35 +1,318 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
3
|
+
import { Button, Chip } from '@happyvertical/smrt-ui/ui';
|
|
4
|
+
import { M } from '../../i18n/strings.workspace.js';
|
|
5
|
+
import ActivityItem from '../workspace/admin-shell/ActivityItem.svelte';
|
|
6
|
+
import type { ActivityListControls, ActivityListEntry } from './types.js';
|
|
6
7
|
|
|
7
|
-
interface Props {
|
|
8
|
+
export interface Props extends ActivityListControls {
|
|
8
9
|
/** Already-authorized activity rows to display. */
|
|
9
10
|
entries: ActivityListEntry[];
|
|
10
|
-
/** Message displayed by the shell list when no activities match. */
|
|
11
|
-
emptyLabel?: string;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
entries,
|
|
15
|
+
emptyLabel,
|
|
16
|
+
caughtUpLabel,
|
|
17
|
+
sourceFilter,
|
|
18
|
+
onDismiss,
|
|
19
|
+
onDismissMany,
|
|
20
|
+
onRestore,
|
|
21
|
+
canUndo = false,
|
|
22
|
+
onUndo,
|
|
23
|
+
dismissedCount,
|
|
24
|
+
showDismissed,
|
|
25
|
+
onToggleShowDismissed,
|
|
26
|
+
now,
|
|
27
|
+
timeZone,
|
|
28
|
+
locale,
|
|
29
|
+
}: Props = $props();
|
|
30
|
+
|
|
31
|
+
const { t } = useI18n();
|
|
32
|
+
|
|
33
|
+
let selectedSource = $state<string | null>(null);
|
|
34
|
+
let localShowDismissed = $state(false);
|
|
35
|
+
|
|
36
|
+
const uniqueEntries = $derived.by((): ActivityListEntry[] => {
|
|
37
|
+
const seen = new Set<string>();
|
|
38
|
+
const out: ActivityListEntry[] = [];
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (seen.has(entry.id)) continue;
|
|
41
|
+
seen.add(entry.id);
|
|
42
|
+
out.push(entry);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
interface SourceOption {
|
|
48
|
+
key: string;
|
|
49
|
+
label: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function sourceKeyOf(entry: ActivityListEntry): string {
|
|
53
|
+
return entry.source?.trim() || entry.sourceLabel?.trim() || '';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function sourceLabelOf(entry: ActivityListEntry): string {
|
|
57
|
+
return entry.sourceLabel?.trim() || entry.source?.trim() || '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const sources = $derived.by((): SourceOption[] => {
|
|
61
|
+
const seen = new Map<string, string>();
|
|
62
|
+
for (const entry of uniqueEntries) {
|
|
63
|
+
const key = sourceKeyOf(entry);
|
|
64
|
+
if (!key || seen.has(key)) continue;
|
|
65
|
+
seen.set(key, sourceLabelOf(entry));
|
|
66
|
+
}
|
|
67
|
+
return Array.from(seen, ([key, label]) => ({ key, label }));
|
|
33
68
|
});
|
|
69
|
+
|
|
70
|
+
const showSources = $derived(
|
|
71
|
+
sourceFilter === true
|
|
72
|
+
? sources.length >= 1
|
|
73
|
+
: sourceFilter === false
|
|
74
|
+
? false
|
|
75
|
+
: sources.length >= 2,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const activeSource = $derived(
|
|
79
|
+
selectedSource && sources.some((source) => source.key === selectedSource)
|
|
80
|
+
? selectedSource
|
|
81
|
+
: null,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const effectiveShowDismissed = $derived(showDismissed ?? localShowDismissed);
|
|
85
|
+
|
|
86
|
+
const inListDismissedCount = $derived(
|
|
87
|
+
uniqueEntries.filter((entry) => entry.dismissed).length,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const effectiveDismissedCount = $derived(
|
|
91
|
+
dismissedCount ?? inListDismissedCount,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const canToggleDismissed = $derived(
|
|
95
|
+
Boolean(onToggleShowDismissed || inListDismissedCount > 0) &&
|
|
96
|
+
(effectiveDismissedCount > 0 || effectiveShowDismissed),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const visibleEntries = $derived(
|
|
100
|
+
uniqueEntries.filter(
|
|
101
|
+
(entry) =>
|
|
102
|
+
(effectiveShowDismissed || !entry.dismissed) &&
|
|
103
|
+
(activeSource === null || sourceKeyOf(entry) === activeSource),
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const visibleUnreadIds = $derived(
|
|
108
|
+
visibleEntries.filter((entry) => !entry.dismissed).map((entry) => entry.id),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const showDismissVisible = $derived(
|
|
112
|
+
Boolean(onDismissMany && visibleUnreadIds.length > 0),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const showUndo = $derived(Boolean(canUndo && onUndo));
|
|
116
|
+
|
|
117
|
+
const showToolbar = $derived(
|
|
118
|
+
showSources || showDismissVisible || showUndo || canToggleDismissed,
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const isCaughtUp = $derived(
|
|
122
|
+
visibleEntries.length === 0 &&
|
|
123
|
+
(effectiveDismissedCount > 0 ||
|
|
124
|
+
inListDismissedCount > 0 ||
|
|
125
|
+
Boolean(canUndo && onUndo)),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const isFilteredEmpty = $derived(
|
|
129
|
+
visibleEntries.length === 0 && !isCaughtUp && activeSource !== null,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
function handleToggleDismissed(): void {
|
|
133
|
+
if (showDismissed === undefined) {
|
|
134
|
+
localShowDismissed = !localShowDismissed;
|
|
135
|
+
}
|
|
136
|
+
onToggleShowDismissed?.();
|
|
137
|
+
}
|
|
34
138
|
</script>
|
|
35
|
-
|
|
139
|
+
|
|
140
|
+
<div class="smrt-activity-feed__root" data-smrt-component="ActivityList">
|
|
141
|
+
{#if showToolbar}
|
|
142
|
+
<div class="smrt-activity-feed__toolbar" data-smrt-part="toolbar">
|
|
143
|
+
{#if showSources}
|
|
144
|
+
<div
|
|
145
|
+
class="smrt-activity-feed__sources"
|
|
146
|
+
role="group"
|
|
147
|
+
aria-label={t(M['ui.activity_list.filter_by_source'])}
|
|
148
|
+
data-smrt-part="sources"
|
|
149
|
+
>
|
|
150
|
+
<Chip
|
|
151
|
+
size="sm"
|
|
152
|
+
selectable
|
|
153
|
+
selected={activeSource === null}
|
|
154
|
+
onselect={() => (selectedSource = null)}
|
|
155
|
+
label={t(M['ui.activity_list.filter_all'])}
|
|
156
|
+
/>
|
|
157
|
+
{#each sources as source (source.key)}
|
|
158
|
+
<Chip
|
|
159
|
+
size="sm"
|
|
160
|
+
selectable
|
|
161
|
+
selected={activeSource === source.key}
|
|
162
|
+
onselect={() => (selectedSource = source.key)}
|
|
163
|
+
label={source.label}
|
|
164
|
+
/>
|
|
165
|
+
{/each}
|
|
166
|
+
</div>
|
|
167
|
+
{/if}
|
|
168
|
+
|
|
169
|
+
{#if showDismissVisible || showUndo || canToggleDismissed}
|
|
170
|
+
<div class="smrt-activity-feed__controls" data-smrt-part="controls">
|
|
171
|
+
{#if showUndo}
|
|
172
|
+
<Button
|
|
173
|
+
variant="ghost"
|
|
174
|
+
size="sm"
|
|
175
|
+
labelWhitespace="trim"
|
|
176
|
+
onclick={() => void onUndo?.()}
|
|
177
|
+
>
|
|
178
|
+
{t(M['ui.activity_list.undo'])}
|
|
179
|
+
</Button>
|
|
180
|
+
{/if}
|
|
181
|
+
{#if showDismissVisible}
|
|
182
|
+
<Button
|
|
183
|
+
variant="ghost"
|
|
184
|
+
size="sm"
|
|
185
|
+
labelWhitespace="trim"
|
|
186
|
+
onclick={() => void onDismissMany?.(visibleUnreadIds)}
|
|
187
|
+
>
|
|
188
|
+
{t(M['ui.activity_list.dismiss_visible'])}
|
|
189
|
+
</Button>
|
|
190
|
+
{/if}
|
|
191
|
+
{#if canToggleDismissed}
|
|
192
|
+
<Button
|
|
193
|
+
variant="ghost"
|
|
194
|
+
size="sm"
|
|
195
|
+
labelWhitespace="trim"
|
|
196
|
+
aria-pressed={effectiveShowDismissed}
|
|
197
|
+
onclick={handleToggleDismissed}
|
|
198
|
+
>
|
|
199
|
+
{t(
|
|
200
|
+
effectiveShowDismissed
|
|
201
|
+
? M['ui.activity_list.hide_dismissed']
|
|
202
|
+
: M['ui.activity_list.show_dismissed'],
|
|
203
|
+
{ count: effectiveDismissedCount },
|
|
204
|
+
)}
|
|
205
|
+
</Button>
|
|
206
|
+
{/if}
|
|
207
|
+
</div>
|
|
208
|
+
{/if}
|
|
209
|
+
</div>
|
|
210
|
+
{/if}
|
|
211
|
+
|
|
212
|
+
{#if visibleEntries.length > 0}
|
|
213
|
+
<div class="smrt-activity-feed__list" data-smrt-part="list">
|
|
214
|
+
{#each visibleEntries as entry (entry.id)}
|
|
215
|
+
<ActivityItem {entry} {onDismiss} {onRestore} {now} {timeZone} {locale} />
|
|
216
|
+
{/each}
|
|
217
|
+
</div>
|
|
218
|
+
{:else if isCaughtUp}
|
|
219
|
+
<div
|
|
220
|
+
class="smrt-activity-feed__caught-up"
|
|
221
|
+
role="status"
|
|
222
|
+
data-smrt-part="caught-up"
|
|
223
|
+
>
|
|
224
|
+
<span class="smrt-activity-feed__caught-up-icon" aria-hidden="true">✓</span>
|
|
225
|
+
<p class="smrt-activity-feed__caught-up-text">
|
|
226
|
+
{caughtUpLabel ?? t(M['ui.activity_list.caught_up'])}
|
|
227
|
+
</p>
|
|
228
|
+
</div>
|
|
229
|
+
{:else if isFilteredEmpty}
|
|
230
|
+
<p class="smrt-activity-feed__empty" data-smrt-part="empty">
|
|
231
|
+
{t(M['ui.activity_list.no_matching_activity'])}
|
|
232
|
+
</p>
|
|
233
|
+
{:else}
|
|
234
|
+
<p class="smrt-activity-feed__empty" data-smrt-part="empty">
|
|
235
|
+
{emptyLabel ?? t(M['ui.activity_list.no_activity'])}
|
|
236
|
+
</p>
|
|
237
|
+
{/if}
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<style>
|
|
241
|
+
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
242
|
+
|
|
243
|
+
@layer smrt.structure {
|
|
244
|
+
.smrt-activity-feed__root {
|
|
245
|
+
display: grid;
|
|
246
|
+
gap: var(--smrt-spacing-2);
|
|
247
|
+
min-inline-size: 0;
|
|
248
|
+
}
|
|
249
|
+
.smrt-activity-feed__toolbar {
|
|
250
|
+
display: flex;
|
|
251
|
+
flex-wrap: wrap;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: space-between;
|
|
254
|
+
gap: var(--smrt-spacing-2);
|
|
255
|
+
padding-block-end: var(--smrt-spacing-1);
|
|
256
|
+
}
|
|
257
|
+
.smrt-activity-feed__sources {
|
|
258
|
+
display: flex;
|
|
259
|
+
flex-wrap: wrap;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: var(--smrt-spacing-1);
|
|
262
|
+
min-inline-size: 0;
|
|
263
|
+
}
|
|
264
|
+
.smrt-activity-feed__controls {
|
|
265
|
+
display: flex;
|
|
266
|
+
flex-wrap: wrap;
|
|
267
|
+
align-items: center;
|
|
268
|
+
justify-content: flex-end;
|
|
269
|
+
gap: var(--smrt-spacing-1);
|
|
270
|
+
margin-inline-start: auto;
|
|
271
|
+
}
|
|
272
|
+
.smrt-activity-feed__list {
|
|
273
|
+
display: grid;
|
|
274
|
+
min-inline-size: 0;
|
|
275
|
+
}
|
|
276
|
+
.smrt-activity-feed__caught-up {
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
gap: var(--smrt-spacing-2);
|
|
280
|
+
padding: var(--smrt-spacing-3);
|
|
281
|
+
}
|
|
282
|
+
.smrt-activity-feed__caught-up-icon {
|
|
283
|
+
display: inline-flex;
|
|
284
|
+
flex-shrink: 0;
|
|
285
|
+
align-items: center;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
inline-size: 1.5rem;
|
|
288
|
+
block-size: 1.5rem;
|
|
289
|
+
}
|
|
290
|
+
.smrt-activity-feed__caught-up-text,
|
|
291
|
+
.smrt-activity-feed__empty {
|
|
292
|
+
margin: 0;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@layer smrt.theme {
|
|
297
|
+
.smrt-activity-feed__toolbar {
|
|
298
|
+
border-block-end: var(--smrt-hairline);
|
|
299
|
+
}
|
|
300
|
+
.smrt-activity-feed__caught-up {
|
|
301
|
+
background: var(--smrt-color-surface-container-low);
|
|
302
|
+
border: var(--smrt-hairline);
|
|
303
|
+
border-radius: var(--smrt-radius-md);
|
|
304
|
+
}
|
|
305
|
+
.smrt-activity-feed__caught-up-icon {
|
|
306
|
+
background: var(--smrt-color-success-container);
|
|
307
|
+
color: var(--smrt-color-on-success-container);
|
|
308
|
+
border-radius: var(--smrt-radius-full);
|
|
309
|
+
font-size: var(--smrt-typography-label-medium-size);
|
|
310
|
+
font-weight: var(--smrt-typography-weight-bold);
|
|
311
|
+
}
|
|
312
|
+
.smrt-activity-feed__caught-up-text,
|
|
313
|
+
.smrt-activity-feed__empty {
|
|
314
|
+
color: var(--smrt-color-on-surface-variant);
|
|
315
|
+
font-size: var(--smrt-typography-body-medium-size);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
</style>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { ActivityListEntry } from './types.js';
|
|
2
|
-
interface Props {
|
|
1
|
+
import type { ActivityListControls, ActivityListEntry } from './types.js';
|
|
2
|
+
export interface Props extends ActivityListControls {
|
|
3
3
|
/** Already-authorized activity rows to display. */
|
|
4
4
|
entries: ActivityListEntry[];
|
|
5
|
-
/** Message displayed by the shell list when no activities match. */
|
|
6
|
-
emptyLabel?: string;
|
|
7
5
|
}
|
|
8
6
|
declare const ActivityList: import("svelte").Component<Props, {}, "">;
|
|
9
7
|
type ActivityList = ReturnType<typeof ActivityList>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityList.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/activity/ActivityList.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActivityList.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/activity/ActivityList.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG1E,MAAM,WAAW,KAAM,SAAQ,oBAAoB;IACjD,mDAAmD;IACnD,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AA4MD,QAAA,MAAM,YAAY,2CAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as ActivityList } from './ActivityList.svelte';
|
|
2
|
-
export
|
|
2
|
+
export { safeActivityHref } from './safe-href.js';
|
|
3
|
+
export { type FormatActivityTimestampOptions, type FormattedActivityTime, formatActivityTimestamp, } from './time.js';
|
|
4
|
+
export type { ActivityContextBadge, ActivityListControls, ActivityListEntry, ActivityListProps, ActivityStatusBadge, ActivityStatusTone, } from './types.js';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/activity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/activity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,uBAAuB,GACxB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Accept ordinary web links, never executable schemes or protocol-relative URLs. */
|
|
1
|
+
/** Accept ordinary web links, never executable schemes, control characters, or protocol-relative URLs. */
|
|
2
2
|
export declare function safeActivityHref(value: string | null | undefined): string | undefined;
|
|
3
3
|
//# sourceMappingURL=safe-href.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-href.d.ts","sourceRoot":"","sources":["../../../src/components/activity/safe-href.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"safe-href.d.ts","sourceRoot":"","sources":["../../../src/components/activity/safe-href.ts"],"names":[],"mappings":"AAQA,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,MAAM,GAAG,SAAS,CAiBpB"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
function hasControlChar(value) {
|
|
2
|
+
for (const ch of value) {
|
|
3
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
4
|
+
if (code <= 0x1f || code === 0x7f)
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
/** Accept ordinary web links, never executable schemes, control characters, or protocol-relative URLs. */
|
|
2
10
|
export function safeActivityHref(value) {
|
|
3
|
-
if (
|
|
11
|
+
if (typeof value !== 'string')
|
|
4
12
|
return undefined;
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
if (!trimmed ||
|
|
15
|
+
trimmed.startsWith('//') ||
|
|
16
|
+
trimmed.includes('\\') ||
|
|
17
|
+
hasControlChar(trimmed)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
5
20
|
try {
|
|
6
|
-
const url = new URL(
|
|
7
|
-
return ['https:', 'http:'].includes(url.protocol) ?
|
|
21
|
+
const url = new URL(trimmed, 'https://smrt.invalid');
|
|
22
|
+
return ['https:', 'http:'].includes(url.protocol) ? trimmed : undefined;
|
|
8
23
|
}
|
|
9
24
|
catch {
|
|
10
25
|
return undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Formatted timestamp presentation for `<time datetime title>`. */
|
|
2
|
+
export interface FormattedActivityTime {
|
|
3
|
+
/** Valid machine-readable ISO timestamp or YYYY-MM-DD calendar string, when parseable. */
|
|
4
|
+
datetime?: string;
|
|
5
|
+
/** Full human-readable timestamp shown on hover (`title`). */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Concise relative timestamp shown inline. */
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FormatActivityTimestampOptions {
|
|
11
|
+
/** BCP-47 locale tag (default `'en-US'`). */
|
|
12
|
+
locale?: string;
|
|
13
|
+
/** IANA time zone for tooltips and absolute timestamps (default `'UTC'` so SSR and browser agree). */
|
|
14
|
+
timeZone?: string;
|
|
15
|
+
/** Localized label for timestamps within the last 45 seconds (default `'just now'`). */
|
|
16
|
+
justNowLabel?: string;
|
|
17
|
+
/** Shared reference clock epoch in milliseconds; when omitted, renders a deterministic clock-free timestamp. */
|
|
18
|
+
now?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Formats an ISO timestamp or calendar date into a readable relative label (when
|
|
22
|
+
* a shared `now` epoch is supplied) or deterministic localized timestamp (when
|
|
23
|
+
* `now` is omitted), plus full `<time datetime title>` metadata. Never reads the
|
|
24
|
+
* ambient clock or local time zone, and never throws on invalid inputs.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatActivityTimestamp(value: string | null | undefined, options?: FormatActivityTimestampOptions): FormattedActivityTime | null;
|
|
27
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/components/activity/time.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,WAAW,qBAAqB;IACpC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,8BAA8B;IAC7C,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gHAAgH;IAChH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA+GD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,GAAE,8BAAmC,GAC3C,qBAAqB,GAAG,IAAI,CAmG9B"}
|