@happyvertical/smrt-svelte 0.60.18 → 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.
Files changed (211) hide show
  1. package/AGENTS.md +6 -0
  2. package/agents/components.md +15 -0
  3. package/agents/connect-ai.md +180 -0
  4. package/agents/cookbook-shell.md +173 -6
  5. package/agents/import-export.md +10 -0
  6. package/agents/screens.md +233 -12
  7. package/agents/settings.md +84 -0
  8. package/agents/testing.md +6 -0
  9. package/agents/workspace.md +64 -1
  10. package/dist/components/app/AppShell.svelte +220 -7
  11. package/dist/components/app/AppShell.svelte.d.ts +49 -3
  12. package/dist/components/app/AppShell.svelte.d.ts.map +1 -1
  13. package/dist/components/app/OwnerSetupForm.svelte +5 -3
  14. package/dist/components/app/OwnerSetupForm.svelte.d.ts.map +1 -1
  15. package/dist/components/app/PhoneTabBar.svelte +28 -1
  16. package/dist/components/app/PhoneTabBar.svelte.d.ts +10 -0
  17. package/dist/components/app/PhoneTabBar.svelte.d.ts.map +1 -1
  18. package/dist/components/app/ShellAccountMenu.svelte +46 -0
  19. package/dist/components/app/ShellAccountMenu.svelte.d.ts +13 -0
  20. package/dist/components/app/ShellAccountMenu.svelte.d.ts.map +1 -0
  21. package/dist/components/app/ShellSettingsPage.svelte +119 -4
  22. package/dist/components/app/ShellSettingsPage.svelte.d.ts +18 -0
  23. package/dist/components/app/ShellSettingsPage.svelte.d.ts.map +1 -1
  24. package/dist/components/app/index.d.ts +3 -2
  25. package/dist/components/app/index.d.ts.map +1 -1
  26. package/dist/components/app/index.js +1 -1
  27. package/dist/components/app/owner-setup-types.d.ts +1 -0
  28. package/dist/components/app/owner-setup-types.d.ts.map +1 -1
  29. package/dist/components/app/settings-menu-item.d.ts +8 -0
  30. package/dist/components/app/settings-menu-item.d.ts.map +1 -0
  31. package/dist/components/app/settings-menu-item.js +1 -0
  32. package/dist/components/app/slot-item.d.ts +53 -0
  33. package/dist/components/app/slot-item.d.ts.map +1 -1
  34. package/dist/components/audit/RecordHistory.svelte +30 -22
  35. package/dist/components/audit/RecordHistory.svelte.d.ts +31 -10
  36. package/dist/components/audit/RecordHistory.svelte.d.ts.map +1 -1
  37. package/dist/components/audit/index.d.ts +1 -1
  38. package/dist/components/audit/index.d.ts.map +1 -1
  39. package/dist/components/audit/types.d.ts +12 -6
  40. package/dist/components/audit/types.d.ts.map +1 -1
  41. package/dist/components/connect-ai/ConnectAi.svelte +584 -0
  42. package/dist/components/connect-ai/ConnectAi.svelte.d.ts +23 -0
  43. package/dist/components/connect-ai/ConnectAi.svelte.d.ts.map +1 -0
  44. package/dist/components/connect-ai/client.d.ts +68 -0
  45. package/dist/components/connect-ai/client.d.ts.map +1 -0
  46. package/dist/components/connect-ai/client.js +121 -0
  47. package/dist/components/connect-ai/index.d.ts +4 -0
  48. package/dist/components/connect-ai/index.d.ts.map +1 -0
  49. package/dist/components/connect-ai/index.js +2 -0
  50. package/dist/components/connect-ai/server.d.ts +33 -0
  51. package/dist/components/connect-ai/server.d.ts.map +1 -0
  52. package/dist/components/connect-ai/server.js +190 -0
  53. package/dist/components/connect-ai/types.d.ts +48 -0
  54. package/dist/components/connect-ai/types.d.ts.map +1 -0
  55. package/dist/components/connect-ai/types.js +1 -0
  56. package/dist/components/cookbook/CookbookApp.svelte +84 -5
  57. package/dist/components/cookbook/CookbookApp.svelte.d.ts +1 -1
  58. package/dist/components/cookbook/CookbookApp.svelte.d.ts.map +1 -1
  59. package/dist/components/cookbook/app-props.d.ts +65 -0
  60. package/dist/components/cookbook/app-props.d.ts.map +1 -0
  61. package/dist/components/cookbook/app-props.js +1 -0
  62. package/dist/components/cookbook/build.d.ts +3 -0
  63. package/dist/components/cookbook/build.d.ts.map +1 -1
  64. package/dist/components/cookbook/build.js +92 -8
  65. package/dist/components/cookbook/catalog.d.ts +2 -1
  66. package/dist/components/cookbook/catalog.d.ts.map +1 -1
  67. package/dist/components/cookbook/catalog.js +5 -2
  68. package/dist/components/cookbook/context.d.ts +6 -0
  69. package/dist/components/cookbook/context.d.ts.map +1 -1
  70. package/dist/components/cookbook/index.d.ts +2 -1
  71. package/dist/components/cookbook/index.d.ts.map +1 -1
  72. package/dist/components/cookbook/index.js +1 -1
  73. package/dist/components/cookbook/registry.d.ts +3 -0
  74. package/dist/components/cookbook/registry.d.ts.map +1 -1
  75. package/dist/components/cookbook/registry.js +5 -0
  76. package/dist/components/cookbook/server.d.ts +1 -0
  77. package/dist/components/cookbook/server.d.ts.map +1 -1
  78. package/dist/components/cookbook/surfaces.d.ts +14 -0
  79. package/dist/components/cookbook/surfaces.d.ts.map +1 -0
  80. package/dist/components/cookbook/surfaces.js +6 -0
  81. package/dist/components/cookbook/types.d.ts +0 -28
  82. package/dist/components/cookbook/types.d.ts.map +1 -1
  83. package/dist/components/import-export/ImportExport.svelte +21 -2
  84. package/dist/components/import-export/ImportExport.svelte.d.ts.map +1 -1
  85. package/dist/components/import-export/fields.d.ts +1 -0
  86. package/dist/components/import-export/fields.d.ts.map +1 -1
  87. package/dist/components/import-export/fields.js +8 -3
  88. package/dist/components/import-export/props.d.ts +5 -1
  89. package/dist/components/import-export/props.d.ts.map +1 -1
  90. package/dist/components/onboarding/FirstRunOnboarding.svelte +249 -0
  91. package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts +21 -0
  92. package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts.map +1 -0
  93. package/dist/components/onboarding/OnboardingAssistant.svelte +82 -0
  94. package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts +19 -0
  95. package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts.map +1 -0
  96. package/dist/components/onboarding/client.d.ts +7 -0
  97. package/dist/components/onboarding/client.d.ts.map +1 -0
  98. package/dist/components/onboarding/client.js +26 -0
  99. package/dist/components/onboarding/index.d.ts +5 -0
  100. package/dist/components/onboarding/index.d.ts.map +1 -0
  101. package/dist/components/onboarding/index.js +3 -0
  102. package/dist/components/onboarding/types.d.ts +38 -0
  103. package/dist/components/onboarding/types.d.ts.map +1 -0
  104. package/dist/components/onboarding/types.js +1 -0
  105. package/dist/components/overview/recipe-widgets.d.ts +2 -18
  106. package/dist/components/overview/recipe-widgets.d.ts.map +1 -1
  107. package/dist/components/overview/recipe-widgets.js +14 -14
  108. package/dist/components/screens/DetailScreen.svelte +40 -16
  109. package/dist/components/screens/DetailScreen.svelte.d.ts.map +1 -1
  110. package/dist/components/screens/EditForm.svelte +83 -18
  111. package/dist/components/screens/EditForm.svelte.d.ts.map +1 -1
  112. package/dist/components/screens/ListScreen.svelte +35 -9
  113. package/dist/components/screens/ListScreen.svelte.d.ts.map +1 -1
  114. package/dist/components/screens/RecipeScreens.svelte +78 -6
  115. package/dist/components/screens/RecipeScreens.svelte.d.ts +2 -1
  116. package/dist/components/screens/RecipeScreens.svelte.d.ts.map +1 -1
  117. package/dist/components/screens/RecordHeader.svelte +18 -4
  118. package/dist/components/screens/RecordHeader.svelte.d.ts +2 -1
  119. package/dist/components/screens/RecordHeader.svelte.d.ts.map +1 -1
  120. package/dist/components/screens/RecordScreen.svelte +22 -3
  121. package/dist/components/screens/RecordScreen.svelte.d.ts.map +1 -1
  122. package/dist/components/screens/ReferencePicker.svelte +103 -0
  123. package/dist/components/screens/ReferencePicker.svelte.d.ts +12 -0
  124. package/dist/components/screens/ReferencePicker.svelte.d.ts.map +1 -0
  125. package/dist/components/screens/fields.d.ts +6 -14
  126. package/dist/components/screens/fields.d.ts.map +1 -1
  127. package/dist/components/screens/fields.js +67 -10
  128. package/dist/components/screens/index.d.ts +3 -1
  129. package/dist/components/screens/index.d.ts.map +1 -1
  130. package/dist/components/screens/index.js +2 -0
  131. package/dist/components/screens/reference-labels.svelte.d.ts +11 -0
  132. package/dist/components/screens/reference-labels.svelte.d.ts.map +1 -0
  133. package/dist/components/screens/reference-labels.svelte.js +50 -0
  134. package/dist/components/screens/references.d.ts +6 -0
  135. package/dist/components/screens/references.d.ts.map +1 -0
  136. package/dist/components/screens/references.js +26 -0
  137. package/dist/components/screens/relations.d.ts +3 -1
  138. package/dist/components/screens/relations.d.ts.map +1 -1
  139. package/dist/components/screens/relations.js +4 -3
  140. package/dist/components/screens/roles.d.ts.map +1 -1
  141. package/dist/components/screens/roles.js +3 -2
  142. package/dist/components/screens/source.d.ts +37 -0
  143. package/dist/components/screens/source.d.ts.map +1 -0
  144. package/dist/components/screens/source.js +96 -0
  145. package/dist/components/screens/types.d.ts +63 -2
  146. package/dist/components/screens/types.d.ts.map +1 -1
  147. package/dist/components/screens/values.d.ts.map +1 -1
  148. package/dist/components/screens/values.js +5 -0
  149. package/dist/components/settings/OwnerApprovalsSettings.svelte +169 -0
  150. package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts +13 -0
  151. package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts.map +1 -0
  152. package/dist/components/settings/PrebuiltComponentsSettings.svelte +83 -0
  153. package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts +14 -0
  154. package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts.map +1 -0
  155. package/dist/components/settings/WorkProfileSettings.svelte +250 -0
  156. package/dist/components/settings/WorkProfileSettings.svelte.d.ts +22 -0
  157. package/dist/components/settings/WorkProfileSettings.svelte.d.ts.map +1 -0
  158. package/dist/components/settings/index.d.ts +3 -0
  159. package/dist/components/settings/index.d.ts.map +1 -1
  160. package/dist/components/settings/index.js +3 -0
  161. package/dist/components/workspace/admin-shell/AdminShell.svelte +186 -18
  162. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts +26 -1
  163. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts.map +1 -1
  164. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte +18 -3
  165. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts +6 -0
  166. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts.map +1 -1
  167. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte +89 -5
  168. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts +7 -1
  169. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts.map +1 -1
  170. package/dist/components/workspace/admin-shell/layout.d.ts +4 -0
  171. package/dist/components/workspace/admin-shell/layout.d.ts.map +1 -1
  172. package/dist/components/workspace/admin-shell/layout.js +17 -4
  173. package/dist/components/workspace/admin-shell/settings-delta.d.ts.map +1 -1
  174. package/dist/components/workspace/admin-shell/settings-delta.js +4 -3
  175. package/dist/components/workspace/admin-shell/settings-sections.d.ts +10 -0
  176. package/dist/components/workspace/admin-shell/settings-sections.d.ts.map +1 -0
  177. package/dist/components/workspace/admin-shell/settings-sections.js +16 -0
  178. package/dist/components/workspace/admin-shell/settings.d.ts +7 -0
  179. package/dist/components/workspace/admin-shell/settings.d.ts.map +1 -1
  180. package/dist/components/workspace/admin-shell/settings.js +26 -0
  181. package/dist/components/workspace/admin-shell/shell-icons.d.ts +4 -0
  182. package/dist/components/workspace/admin-shell/shell-icons.d.ts.map +1 -1
  183. package/dist/components/workspace/admin-shell/shell-icons.js +4 -0
  184. package/dist/components/workspace/admin-shell/state.svelte.d.ts +13 -5
  185. package/dist/components/workspace/admin-shell/state.svelte.d.ts.map +1 -1
  186. package/dist/components/workspace/admin-shell/state.svelte.js +37 -2
  187. package/dist/components/workspace/admin-shell/types.d.ts +32 -1
  188. package/dist/components/workspace/admin-shell/types.d.ts.map +1 -1
  189. package/dist/components/workspace/index.d.ts +3 -2
  190. package/dist/components/workspace/index.d.ts.map +1 -1
  191. package/dist/components/workspace/index.js +2 -1
  192. package/dist/i18n/server.d.ts +2 -0
  193. package/dist/i18n/server.d.ts.map +1 -1
  194. package/dist/i18n/server.js +2 -0
  195. package/dist/i18n/strings.connect-ai.d.ts +57 -0
  196. package/dist/i18n/strings.connect-ai.d.ts.map +1 -0
  197. package/dist/i18n/strings.connect-ai.js +57 -0
  198. package/dist/i18n/strings.onboarding.d.ts +51 -0
  199. package/dist/i18n/strings.onboarding.d.ts.map +1 -0
  200. package/dist/i18n/strings.onboarding.js +51 -0
  201. package/dist/i18n/strings.screens.d.ts +12 -0
  202. package/dist/i18n/strings.screens.d.ts.map +1 -1
  203. package/dist/i18n/strings.screens.js +13 -1
  204. package/dist/i18n/strings.settings.d.ts +2 -0
  205. package/dist/i18n/strings.settings.d.ts.map +1 -1
  206. package/dist/i18n/strings.settings.js +2 -0
  207. package/dist/i18n/strings.workspace.d.ts +14 -0
  208. package/dist/i18n/strings.workspace.d.ts.map +1 -1
  209. package/dist/i18n/strings.workspace.js +15 -1
  210. package/dist/smrt-knowledge.okf.md +21 -10
  211. package/package.json +46 -17
@@ -1,7 +1,15 @@
1
1
  <script lang="ts">
2
2
  import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
+ import type { Snippet } from 'svelte';
3
4
  import { M } from '../../i18n/strings.workspace.js';
5
+ import { useAdminShell } from '../workspace/admin-shell/context.js';
4
6
  import ShellSettingsPanel from '../workspace/admin-shell/ShellSettingsPanel.svelte';
7
+ import {
8
+ isShellSettingsSection,
9
+ SHELL_SETTINGS_SECTIONS,
10
+ type ShellSettingsSection,
11
+ } from '../workspace/admin-shell/settings-sections.js';
12
+ import type { ShellSettingsMenuItem } from './settings-menu-item.js';
5
13
 
6
14
  interface Props {
7
15
  /**
@@ -12,18 +20,97 @@ interface Props {
12
20
  signOutHref?: string;
13
21
  /** Called by the sign-out control instead of following `signOutHref`; may be async (busy while pending, inline error on rejection). */
14
22
  onSignOut?: () => unknown;
23
+ /**
24
+ * Turns on the section menu: the settings route (e.g. `/settings`). Without
25
+ * a `section` the page lists the sections, each linking to
26
+ * `${basePath}/${id}`; with one it renders only that section and links back.
27
+ * Omit for the one-page mode that shows every section.
28
+ */
29
+ basePath?: string;
30
+ /** Built-in section to render on its own page (needs `basePath` for the back link). */
31
+ section?: ShellSettingsSection;
32
+ /** Host sections listed after the built-in ones in the menu. */
33
+ extraSections?: ShellSettingsMenuItem[];
34
+ /** Heading of a host section page (`children` without a built-in `section`). */
35
+ title?: string;
36
+ /** Host section content, rendered instead of the built-in panel. */
37
+ children?: Snippet;
15
38
  }
16
39
 
17
- const { signOutHref, onSignOut }: Props = $props();
40
+ const {
41
+ signOutHref,
42
+ onSignOut,
43
+ basePath,
44
+ section,
45
+ extraSections = [],
46
+ title,
47
+ children,
48
+ }: Props = $props();
18
49
  const { t } = useI18n();
50
+ const shell = useAdminShell();
51
+
52
+ const labels: Record<ShellSettingsSection, string> = $derived({
53
+ appearance: t(M['ui.shell_settings.appearance']),
54
+ account: t(M['ui.shell_settings.account']),
55
+ layout: t(M['ui.shell_settings.layout']),
56
+ shortcuts: t(M['ui.shell_settings.shortcuts']),
57
+ });
58
+ const descriptions: Record<ShellSettingsSection, string> = $derived({
59
+ appearance: t(M['ui.shell_settings_page.appearance_description']),
60
+ account: t(M['ui.shell_settings_page.account_description']),
61
+ layout: t(M['ui.shell_settings_page.layout_description']),
62
+ shortcuts: t(M['ui.shell_settings_page.shortcuts_description']),
63
+ });
64
+ const menu: ShellSettingsMenuItem[] = $derived([
65
+ ...SHELL_SETTINGS_SECTIONS.filter(
66
+ (id) => id !== 'shortcuts' || shell.hotkeysAvailable,
67
+ ).map((id) => ({
68
+ id: id as string,
69
+ label: labels[id],
70
+ description: descriptions[id],
71
+ })),
72
+ ...extraSections,
73
+ ]);
74
+ const builtIn = $derived(isShellSettingsSection(section) ? section : undefined);
75
+ const sectioned = $derived(Boolean(basePath));
76
+ const showMenu = $derived(sectioned && !builtIn && !children);
77
+ const heading = $derived(
78
+ builtIn ? labels[builtIn] : (title ?? t(M['ui.shell_settings_page.heading'])),
79
+ );
19
80
  </script>
20
81
 
21
82
  <section class="smrt-shell-settings-page" data-smrt-component="ShellSettingsPage">
22
83
  <header>
23
- <h1>{t(M['ui.shell_settings_page.heading'])}</h1>
24
- <p>{t(M['ui.shell_settings_page.description'])}</p>
84
+ {#if sectioned && !showMenu}
85
+ <a class="smrt-shell-settings-page__back" href={basePath} data-smrt-part="back">
86
+ {t(M['ui.shell_settings_page.back'])}
87
+ </a>
88
+ {/if}
89
+ <h1>{showMenu ? t(M['ui.shell_settings_page.heading']) : heading}</h1>
90
+ {#if showMenu || !sectioned}
91
+ <p>{t(M['ui.shell_settings_page.description'])}</p>
92
+ {/if}
25
93
  </header>
26
- <ShellSettingsPanel appearance account {signOutHref} {onSignOut} />
94
+ {#if showMenu}
95
+ <nav aria-label={t(M['ui.shell_settings_page.menu_label'])} data-smrt-part="menu">
96
+ <ul>
97
+ {#each menu as item (item.id)}
98
+ <li>
99
+ <a href={`${basePath}/${item.id}`} data-section={item.id}>
100
+ <strong>{item.label}</strong>
101
+ {#if item.description}<span>{item.description}</span>{/if}
102
+ </a>
103
+ </li>
104
+ {/each}
105
+ </ul>
106
+ </nav>
107
+ {:else if children}
108
+ {@render children()}
109
+ {:else if builtIn}
110
+ <ShellSettingsPanel section={builtIn} {signOutHref} {onSignOut} />
111
+ {:else}
112
+ <ShellSettingsPanel appearance account {signOutHref} {onSignOut} />
113
+ {/if}
27
114
  </section>
28
115
 
29
116
  <style>
@@ -44,8 +131,36 @@ const { t } = useI18n();
44
131
  p {
45
132
  margin: 0;
46
133
  }
134
+ .smrt-shell-settings-page__back {
135
+ justify-self: start;
136
+ }
137
+ ul {
138
+ display: grid;
139
+ margin: 0;
140
+ padding: 0;
141
+ list-style: none;
142
+ }
143
+ li a {
144
+ display: grid;
145
+ gap: var(--smrt-spacing-1, 0.25rem);
146
+ padding-block: var(--smrt-spacing-3, 0.75rem);
147
+ }
47
148
  }
48
149
 
49
150
  @layer smrt.theme {
151
+ .smrt-shell-settings-page__back {
152
+ color: var(--smrt-color-on-surface-variant);
153
+ }
154
+ li a {
155
+ border-block-start: var(--smrt-hairline);
156
+ color: inherit;
157
+ text-decoration: none;
158
+ }
159
+ li a span {
160
+ color: var(--smrt-color-on-surface-variant);
161
+ }
162
+ li a:hover strong {
163
+ text-decoration: underline;
164
+ }
50
165
  }
51
166
  </style>
@@ -1,3 +1,6 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type ShellSettingsSection } from '../workspace/admin-shell/settings-sections.js';
3
+ import type { ShellSettingsMenuItem } from './settings-menu-item.js';
1
4
  interface Props {
2
5
  /**
3
6
  * Where the Account section's sign-out link goes; shown only when given. A
@@ -7,6 +10,21 @@ interface Props {
7
10
  signOutHref?: string;
8
11
  /** Called by the sign-out control instead of following `signOutHref`; may be async (busy while pending, inline error on rejection). */
9
12
  onSignOut?: () => unknown;
13
+ /**
14
+ * Turns on the section menu: the settings route (e.g. `/settings`). Without
15
+ * a `section` the page lists the sections, each linking to
16
+ * `${basePath}/${id}`; with one it renders only that section and links back.
17
+ * Omit for the one-page mode that shows every section.
18
+ */
19
+ basePath?: string;
20
+ /** Built-in section to render on its own page (needs `basePath` for the back link). */
21
+ section?: ShellSettingsSection;
22
+ /** Host sections listed after the built-in ones in the menu. */
23
+ extraSections?: ShellSettingsMenuItem[];
24
+ /** Heading of a host section page (`children` without a built-in `section`). */
25
+ title?: string;
26
+ /** Host section content, rendered instead of the built-in panel. */
27
+ children?: Snippet;
10
28
  }
11
29
  declare const ShellSettingsPage: import("svelte").Component<Props, {}, "">;
12
30
  type ShellSettingsPage = ReturnType<typeof ShellSettingsPage>;
@@ -1 +1 @@
1
- {"version":3,"file":"ShellSettingsPage.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/app/ShellSettingsPage.svelte.ts"],"names":[],"mappings":"AAQA,UAAU,KAAK;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uIAAuI;IACvI,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CAC3B;AAuBD,QAAA,MAAM,iBAAiB,2CAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"ShellSettingsPage.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/app/ShellSettingsPage.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE,UAAU,KAAK;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uIAAuI;IACvI,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,gEAAgE;IAChE,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2FD,QAAA,MAAM,iBAAiB,2CAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * server or `$app/*` imports. Pair with the server `load`/`actions` from
6
6
  * `@happyvertical/smrt-app-runtime/sveltekit`.
7
7
  */
8
- export { type ShellLayout, ShellLayoutController, ShellLayoutEditor, type ShellSectionActionsContext, tryUseShellLayout, useShellLayout, } from '../workspace/index.js';
8
+ export { isShellSettingsSection, SHELL_SETTINGS_SECTIONS, type ShellLayout, ShellLayoutController, ShellLayoutEditor, type ShellSectionActionsContext, type ShellSettingsSection, tryUseShellLayout, useShellLayout, } from '../workspace/index.js';
9
9
  export { default as AppShell } from './AppShell.svelte';
10
10
  export type { DockToggle } from './dock-toggle.js';
11
11
  export { default as OwnerSetupForm } from './OwnerSetupForm.svelte';
@@ -13,7 +13,8 @@ export type { OwnerSetupData, OwnerSetupFormResult, } from './owner-setup-types.
13
13
  export { default as RuntimeDiagnosticsWebMcp } from './RuntimeDiagnosticsWebMcp.svelte';
14
14
  export { createRuntimeDiagnosticsWebMcpTool, type RegisterRuntimeDiagnosticsWebMcpOptions, RUNTIME_DIAGNOSTICS_ENDPOINT, RUNTIME_DIAGNOSTICS_WEBMCP_TOOL_NAME, type RuntimeDiagnosticsWebMcpOwner, registerRuntimeDiagnosticsWebMcp, } from './runtime-diagnostics-webmcp.js';
15
15
  export { default as ShellSettingsPage } from './ShellSettingsPage.svelte';
16
+ export type { ShellSettingsMenuItem } from './settings-menu-item.js';
16
17
  export type { ShellUser } from './shell-user.js';
17
- export type { AppShellAccountMenu, AppShellCommandPalette, ShellSlotItem, } from './slot-item.js';
18
+ export type { AppShellAccountMenu, AppShellCommandPalette, AppShellPanelToggle, AppShellVoiceToggle, ShellSlotItem, } from './slot-item.js';
18
19
  export { createOnNavigateViewTransition, type RunViewTransitionOptions, runViewTransition, VIEW_TRANSITION_ATTRIBUTE, type ViewTransitionNavigation, } from './view-transition.js';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,iBAAiB,EACjB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,YAAY,EACV,cAAc,EACd,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EACL,kCAAkC,EACl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AAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * server or `$app/*` imports. Pair with the server `load`/`actions` from
6
6
  * `@happyvertical/smrt-app-runtime/sveltekit`.
7
7
  */
8
- export { ShellLayoutController, ShellLayoutEditor, tryUseShellLayout, useShellLayout, } from '../workspace/index.js';
8
+ export { isShellSettingsSection, SHELL_SETTINGS_SECTIONS, ShellLayoutController, ShellLayoutEditor, tryUseShellLayout, useShellLayout, } from '../workspace/index.js';
9
9
  export { default as AppShell } from './AppShell.svelte';
10
10
  export { default as OwnerSetupForm } from './OwnerSetupForm.svelte';
11
11
  export { default as RuntimeDiagnosticsWebMcp } from './RuntimeDiagnosticsWebMcp.svelte';
@@ -1,5 +1,6 @@
1
1
  /** Shape of the setup route's `load` data. */
2
2
  export interface OwnerSetupData {
3
+ launchMode?: 'desktop' | 'cli';
3
4
  /** False (with an empty token) when setup is not offered. */
4
5
  available: boolean;
5
6
  /** Single-use bootstrap token carried from the setup link. */
@@ -1 +1 @@
1
- {"version":3,"file":"owner-setup-types.d.ts","sourceRoot":"","sources":["../../../src/components/app/owner-setup-types.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;CACxD;AAED,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"owner-setup-types.d.ts","sourceRoot":"","sources":["../../../src/components/app/owner-setup-types.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;IAC/B,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;CACxD;AAED,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,8 @@
1
+ /** A section a host adds to the `ShellSettingsPage` menu (it renders its own page for it). */
2
+ export interface ShellSettingsMenuItem {
3
+ /** Route segment under the page's `basePath`. */
4
+ id: string;
5
+ label: string;
6
+ description?: string;
7
+ }
8
+ //# sourceMappingURL=settings-menu-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-menu-item.d.ts","sourceRoot":"","sources":["../../../src/components/app/settings-menu-item.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { PaletteProvider } from '../command-palette/types.js';
3
+ import type { ShellIconName } from '../workspace/admin-shell/shell-icons.js';
3
4
  import type { ShellSlot } from '../workspace/admin-shell/slots.js';
5
+ import type { WorkspaceAccountMenuItem } from '../workspace/admin-shell/types.js';
4
6
  /**
5
7
  * A host item that lives in a shell slot and that users can move to another
6
8
  * slot from the layout editor (`ShellLayout.placements`). Prefer this over the
@@ -18,6 +20,13 @@ export interface ShellSlotItem {
18
20
  slot: ShellSlot;
19
21
  /** The content. */
20
22
  render: Snippet;
23
+ /**
24
+ * Keep the item in the collapsed left rail. Only for `leftSidebar.footer`
25
+ * items that stay usable as a compact icon-only control: the collapsed rail
26
+ * then shows it above the account avatar instead of letting the footer slot
27
+ * fall back to another region. Default false.
28
+ */
29
+ rail?: boolean;
21
30
  }
22
31
  /**
23
32
  * `AppShell` `accountMenu`: `false` opts out of the built-in `item:account`;
@@ -26,7 +35,29 @@ export interface ShellSlotItem {
26
35
  */
27
36
  export type AppShellAccountMenu = boolean | {
28
37
  slot?: ShellSlot;
38
+ /**
39
+ * Host destinations or actions (caller-owned, e.g. Approvals and
40
+ * History) shown before Settings; positive badges also show on the
41
+ * closed trigger.
42
+ */
43
+ items?: WorkspaceAccountMenuItem[];
44
+ /** Add a Theme item that switches light and dark (default false). */
45
+ theme?: boolean;
29
46
  };
47
+ /**
48
+ * `AppShell` `panelToggle`: the built-in `item:panel-toggle`, an icon button
49
+ * (`aria-pressed`) that shows and hides the docked `panel`. Default slot
50
+ * `leftSidebar.footer`; it stays in the collapsed rail and, on phones with the
51
+ * tab bar, becomes a tab.
52
+ */
53
+ export interface AppShellPanelToggle {
54
+ /** Accessible name and tooltip. */
55
+ label: string;
56
+ /** Shell icon (default `chat`). */
57
+ icon?: ShellIconName;
58
+ /** Default slot (default `leftSidebar.footer`). */
59
+ slot?: ShellSlot;
60
+ }
30
61
  /** `AppShell` `commandPalette`: the built-in `item:command-palette`. */
31
62
  export interface AppShellCommandPalette {
32
63
  /** Providers for the palette (navigation, records, commands). */
@@ -34,4 +65,26 @@ export interface AppShellCommandPalette {
34
65
  /** Search box placeholder in the palette dialog. */
35
66
  placeholder?: string;
36
67
  }
68
+ /**
69
+ * `AppShell` `voiceToggle`: the built-in `item:voice`, an icon button for a
70
+ * voice mode (speech in and out) in the footer of the left sidebar, above the
71
+ * panel toggle. The shell only draws the control; the host owns what voice
72
+ * does and passes its state.
73
+ */
74
+ export interface AppShellVoiceToggle {
75
+ /** Accessible name while voice is available (e.g. "Voice mode"). */
76
+ label: string;
77
+ /**
78
+ * `off` and `on` are a toggle (`aria-pressed`, `onpress` flips it).
79
+ * `unavailable` is a dimmed `aria-disabled` control without a pressed state,
80
+ * still focusable so its reason can be read; it never calls `onpress`.
81
+ */
82
+ state: 'off' | 'on' | 'unavailable';
83
+ /** Tooltip and accessible name while `unavailable` (why it cannot be used). */
84
+ unavailableLabel?: string;
85
+ /** Called when a toggle (`off`/`on`) is pressed. */
86
+ onpress?: () => void;
87
+ /** Default slot (default `leftSidebar.footer`). */
88
+ slot?: ShellSlot;
89
+ }
37
90
  //# sourceMappingURL=slot-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot-item.d.ts","sourceRoot":"","sources":["../../../src/components/app/slot-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,SAAS,CAAC;IAChB,mBAAmB;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjE,wEAAwE;AACxE,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"slot-item.d.ts","sourceRoot":"","sources":["../../../src/components/app/slot-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,SAAS,CAAC;IAChB,mBAAmB;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,aAAa,CAAC;IACpC,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB"}
@@ -1,4 +1,4 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="Entry extends RecordHistoryEntry = AuditHistoryEntry">
2
2
  import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
3
  import { M } from '../../i18n/strings.audit.js';
4
4
  import type {
@@ -7,11 +7,12 @@ import type {
7
7
  AuditHistoryEntry,
8
8
  AuditResourceHref,
9
9
  AuditValueFormatter,
10
+ RecordHistoryEntry,
10
11
  } from './types.js';
11
12
 
12
- interface Props {
13
+ export interface Props<Entry extends RecordHistoryEntry = AuditHistoryEntry> {
13
14
  /** Authorized entries. This component never fetches or authorizes records. */
14
- entries: AuditHistoryEntry[];
15
+ entries: Entry[];
15
16
  /** Optional resource identity for a per-record page. Both must be supplied together. */
16
17
  resourceType?: string;
17
18
  /** Limits entries to this record identifier when supplied with resourceType. */
@@ -23,15 +24,15 @@ interface Props {
23
24
  /** Overrides the translated accessible label for the history section. */
24
25
  label?: string;
25
26
  /** Resolves friendly resource text for each authorized entry. */
26
- resourceLabel?: AuditEntryLabel;
27
+ resourceLabel?: AuditEntryLabel<Entry>;
27
28
  /** Resolves an already-authorized local or HTTP(S) destination for each entry. */
28
- resourceHref?: AuditResourceHref;
29
+ resourceHref?: AuditResourceHref<Entry>;
29
30
  /** Resolves friendly action text for each authorized entry. */
30
- actionLabel?: AuditEntryLabel;
31
+ actionLabel?: AuditEntryLabel<Entry>;
31
32
  /** Resolves friendly field text for each authorized entry change. */
32
- fieldLabel?: AuditFieldLabel;
33
+ fieldLabel?: AuditFieldLabel<Entry>;
33
34
  /** Formats before/after values as escaped text. */
34
- formatValue?: AuditValueFormatter;
35
+ formatValue?: AuditValueFormatter<Entry>;
35
36
  }
36
37
  let {
37
38
  entries,
@@ -45,16 +46,24 @@ let {
45
46
  actionLabel,
46
47
  fieldLabel,
47
48
  formatValue,
48
- }: Props = $props();
49
+ }: Props<Entry> = $props();
49
50
  const { locale, t } = useI18n();
50
51
  const visible = $derived(
51
- entries
52
- .filter(
52
+ (() => {
53
+ const authorized = entries.filter(
53
54
  (entry) =>
54
55
  (!resourceType || entry.resourceType === resourceType) &&
55
56
  (!resourceId || entry.resourceId === resourceId),
56
- )
57
- .toSorted((a, b) => Date.parse(b.occurredAt) - Date.parse(a.occurredAt)),
57
+ );
58
+ // Without dates the host is the only chronology authority; keep its order.
59
+ return authorized.every((entry) => typeof entry.occurredAt === 'string')
60
+ ? authorized.toSorted((a, b) =>
61
+ typeof a.occurredAt === 'string' && typeof b.occurredAt === 'string'
62
+ ? Date.parse(b.occurredAt) - Date.parse(a.occurredAt)
63
+ : 0,
64
+ )
65
+ : authorized;
66
+ })(),
58
67
  );
59
68
  function defaultDisplay(value: unknown): string {
60
69
  if (typeof value === 'string') return value;
@@ -69,8 +78,8 @@ function defaultDisplay(value: unknown): string {
69
78
  }
70
79
  }
71
80
  function entryLabel(
72
- resolver: AuditEntryLabel | undefined,
73
- entry: AuditHistoryEntry,
81
+ resolver: AuditEntryLabel<Entry> | undefined,
82
+ entry: Entry,
74
83
  fallback: string,
75
84
  ): string {
76
85
  if (!resolver) return fallback;
@@ -83,7 +92,7 @@ function entryLabel(
83
92
  return fallback;
84
93
  }
85
94
  }
86
- function changedFieldLabel(field: string, entry: AuditHistoryEntry): string {
95
+ function changedFieldLabel(field: string, entry: Entry): string {
87
96
  if (!fieldLabel) return field;
88
97
  try {
89
98
  const resolved = fieldLabel(field, entry);
@@ -94,7 +103,7 @@ function changedFieldLabel(field: string, entry: AuditHistoryEntry): string {
94
103
  }
95
104
  function display(
96
105
  value: unknown,
97
- entry: AuditHistoryEntry,
106
+ entry: Entry,
98
107
  field: string,
99
108
  side: 'before' | 'after',
100
109
  ): string {
@@ -114,7 +123,7 @@ function hasUrlControlCharacter(value: string): boolean {
114
123
  return codePoint <= 0x1f || codePoint === 0x7f;
115
124
  });
116
125
  }
117
- function safeResourceHref(entry: AuditHistoryEntry): string | null {
126
+ function safeResourceHref(entry: Entry): string | null {
118
127
  if (!resourceHref) return null;
119
128
  let resolved: unknown;
120
129
  try {
@@ -156,11 +165,10 @@ function date(value: string): string {
156
165
  {@const resolvedResourceHref = safeResourceHref(entry)}
157
166
  <li>
158
167
  <p>
159
- <strong>{entry.actorLabel ?? entry.profileId}</strong>
160
- · {entryLabel(actionLabel, entry, entry.action)} ·
168
+ {#if entry.actorLabel || entry.profileId}<strong>{entry.actorLabel ?? entry.profileId}</strong> · {' '}{/if}{entryLabel(actionLabel, entry, entry.action)} ·
161
169
  {#if resolvedResourceHref}<a href={resolvedResourceHref}>{resolvedResourceLabel}</a>{:else}{resolvedResourceLabel}{/if}
162
170
  </p>
163
- <time datetime={entry.occurredAt} data-smrt-part="meta">{date(entry.occurredAt)}</time>
171
+ {#if entry.occurredAt}<time datetime={entry.occurredAt} data-smrt-part="meta">{date(entry.occurredAt)}</time>{/if}
164
172
  {#if entry.onBehalfOfId}<p>{t(M['ui.audit.behalf'], { actor: entry.onBehalfOfId })}</p>{/if}
165
173
  {#if entry.reason}<p>{t(M['ui.audit.reason'], { reason: entry.reason })}</p>{/if}
166
174
  {#if entry.changes && Object.keys(entry.changes).length}
@@ -181,6 +189,7 @@ function date(value: string): string {
181
189
 
182
190
  <style>
183
191
  @layer smrt.reset, smrt.structure, smrt.theme;
192
+
184
193
  @layer smrt.structure {
185
194
  .smrt-record-history__root > ol {
186
195
  display: grid;
@@ -245,5 +254,4 @@ function date(value: string): string {
245
254
  background: var(--smrt-color-surface-container-low);
246
255
  }
247
256
  }
248
-
249
257
  </style>
@@ -1,7 +1,7 @@
1
- import type { AuditEntryLabel, AuditFieldLabel, AuditHistoryEntry, AuditResourceHref, AuditValueFormatter } from './types.js';
2
- interface Props {
1
+ import type { AuditEntryLabel, AuditFieldLabel, AuditHistoryEntry, AuditResourceHref, AuditValueFormatter, RecordHistoryEntry } from './types.js';
2
+ export interface Props<Entry extends RecordHistoryEntry = AuditHistoryEntry> {
3
3
  /** Authorized entries. This component never fetches or authorizes records. */
4
- entries: AuditHistoryEntry[];
4
+ entries: Entry[];
5
5
  /** Optional resource identity for a per-record page. Both must be supplied together. */
6
6
  resourceType?: string;
7
7
  /** Limits entries to this record identifier when supplied with resourceType. */
@@ -13,17 +13,38 @@ interface Props {
13
13
  /** Overrides the translated accessible label for the history section. */
14
14
  label?: string;
15
15
  /** Resolves friendly resource text for each authorized entry. */
16
- resourceLabel?: AuditEntryLabel;
16
+ resourceLabel?: AuditEntryLabel<Entry>;
17
17
  /** Resolves an already-authorized local or HTTP(S) destination for each entry. */
18
- resourceHref?: AuditResourceHref;
18
+ resourceHref?: AuditResourceHref<Entry>;
19
19
  /** Resolves friendly action text for each authorized entry. */
20
- actionLabel?: AuditEntryLabel;
20
+ actionLabel?: AuditEntryLabel<Entry>;
21
21
  /** Resolves friendly field text for each authorized entry change. */
22
- fieldLabel?: AuditFieldLabel;
22
+ fieldLabel?: AuditFieldLabel<Entry>;
23
23
  /** Formats before/after values as escaped text. */
24
- formatValue?: AuditValueFormatter;
24
+ formatValue?: AuditValueFormatter<Entry>;
25
25
  }
26
- declare const RecordHistory: import("svelte").Component<Props, {}, "">;
27
- type RecordHistory = ReturnType<typeof RecordHistory>;
26
+ declare function $$render<Entry extends RecordHistoryEntry = AuditHistoryEntry>(): {
27
+ props: Props<Entry>;
28
+ exports: {};
29
+ bindings: "";
30
+ slots: {};
31
+ events: {};
32
+ };
33
+ declare class __sveltets_Render<Entry extends RecordHistoryEntry = AuditHistoryEntry> {
34
+ props(): ReturnType<typeof $$render<Entry>>['props'];
35
+ events(): ReturnType<typeof $$render<Entry>>['events'];
36
+ slots(): ReturnType<typeof $$render<Entry>>['slots'];
37
+ bindings(): "";
38
+ exports(): {};
39
+ }
40
+ interface $$IsomorphicComponent {
41
+ new <Entry extends RecordHistoryEntry = AuditHistoryEntry>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Entry>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Entry>['props']>, ReturnType<__sveltets_Render<Entry>['events']>, ReturnType<__sveltets_Render<Entry>['slots']>> & {
42
+ $$bindings?: ReturnType<__sveltets_Render<Entry>['bindings']>;
43
+ } & ReturnType<__sveltets_Render<Entry>['exports']>;
44
+ <Entry extends RecordHistoryEntry = AuditHistoryEntry>(internal: unknown, props: ReturnType<__sveltets_Render<Entry>['props']> & {}): ReturnType<__sveltets_Render<Entry>['exports']>;
45
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
46
+ }
47
+ declare const RecordHistory: $$IsomorphicComponent;
48
+ type RecordHistory<Entry extends RecordHistoryEntry = AuditHistoryEntry> = InstanceType<typeof RecordHistory<Entry>>;
28
49
  export default RecordHistory;
29
50
  //# sourceMappingURL=RecordHistory.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecordHistory.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/audit/RecordHistory.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,UAAU,KAAK;IACb,8EAA8E;IAC9E,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,kFAAkF;IAClF,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,+DAA+D;IAC/D,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,qEAAqE;IACrE,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,mDAAmD;IACnD,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AA4JD,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"RecordHistory.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/audit/RecordHistory.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,KAAK,CAAC,KAAK,SAAS,kBAAkB,GAAG,iBAAiB;IACzE,8EAA8E;IAC9E,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,aAAa,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IACvC,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AC,CAAC,UAAU,CAAC,CAAC,CAAA;KAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACvc,CAAC,KAAK,SAAS,kBAAkB,GAAG,iBAAiB,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACtL,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,QAAA,MAAM,aAAa,EAAE,qBAAmC,CAAC;AACvC,KAAK,aAAa,CAAC,KAAK,SAAS,kBAAkB,GAAG,iBAAiB,IAAI,YAAY,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AACvH,eAAe,aAAa,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { default as AuditList } from './AuditList.svelte';
2
2
  export { default as RecordHistory } from './RecordHistory.svelte';
3
- export type { AuditEntryLabel, AuditFieldLabel, AuditHistoryEntry, AuditListFilter, AuditResourceHref, AuditValueFormatContext, AuditValueFormatter, } from './types.js';
3
+ export type { AuditEntryLabel, AuditFieldLabel, AuditHistoryEntry, AuditListFilter, AuditResourceHref, AuditValueFormatContext, AuditValueFormatter, RecordHistoryEntry, UndatedHistoryEntry, } from './types.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/audit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/audit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
@@ -14,6 +14,12 @@ export interface AuditHistoryEntry {
14
14
  after: unknown;
15
15
  }>;
16
16
  }
17
+ /** Host-ordered history without timestamp provenance. Never synthesize occurredAt. */
18
+ export interface UndatedHistoryEntry extends Omit<AuditHistoryEntry, 'occurredAt' | 'profileId'> {
19
+ occurredAt?: never;
20
+ profileId?: string;
21
+ }
22
+ export type RecordHistoryEntry = AuditHistoryEntry | UndatedHistoryEntry;
17
23
  export interface AuditListFilter {
18
24
  profileId: string;
19
25
  resourceId: string;
@@ -21,21 +27,21 @@ export interface AuditListFilter {
21
27
  to: string;
22
28
  }
23
29
  /** Resolves presentation text for one already-authorized audit entry. */
24
- export type AuditEntryLabel = (entry: AuditHistoryEntry) => string;
30
+ export type AuditEntryLabel<Entry extends RecordHistoryEntry = AuditHistoryEntry> = (entry: Entry) => string;
25
31
  /**
26
32
  * Resolves an already-authorized destination for an audit entry.
27
33
  *
28
34
  * The component accepts local paths and explicit HTTP(S) URLs only. Consumers
29
35
  * must still authorize the referenced resource before exposing its href.
30
36
  */
31
- export type AuditResourceHref = (entry: AuditHistoryEntry) => string | null | undefined;
37
+ export type AuditResourceHref<Entry extends RecordHistoryEntry = AuditHistoryEntry> = (entry: Entry) => string | null | undefined;
32
38
  /** Resolves a presentation label for one changed field. */
33
- export type AuditFieldLabel = (field: string, entry: AuditHistoryEntry) => string;
34
- export interface AuditValueFormatContext {
35
- entry: AuditHistoryEntry;
39
+ export type AuditFieldLabel<Entry extends RecordHistoryEntry = AuditHistoryEntry> = (field: string, entry: Entry) => string;
40
+ export interface AuditValueFormatContext<Entry extends RecordHistoryEntry = AuditHistoryEntry> {
41
+ entry: Entry;
36
42
  field: string;
37
43
  side: 'before' | 'after';
38
44
  }
39
45
  /** Formats an audit value as text. Formatter output is never rendered as HTML. */
40
- export type AuditValueFormatter = (value: unknown, context: AuditValueFormatContext) => string;
46
+ export type AuditValueFormatter<Entry extends RecordHistoryEntry = AuditHistoryEntry> = (value: unknown, context: AuditValueFormatContext<Entry>) => string;
41
47
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/audit/types.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,yEAAyE;AACzE,MAAM,MAAM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