@lapismd/design-core 0.1.0 → 0.1.2

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 (67) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/package.json +12 -8
  4. package/spec/src/styling-and-themes.md +9 -9
  5. package/src/shared/ai/chat.css +2 -1
  6. package/src/shared/ai/composer-input/ComposerInput.svelte +3 -2
  7. package/src/shared/ai/experimental/reaction-bar/ReactionBar.svelte +1 -1
  8. package/src/shared/ai/tool-calls/ToolCalls.svelte +1 -1
  9. package/src/shared/ai/trigger-menu.ts +2 -3
  10. package/src/shared/diff/file-diff/FileDiff.svelte +5 -8
  11. package/src/shared/diff/file-listing/FileListingViewModeToggle.css +42 -5
  12. package/src/shared/diff/merge-editor/MergeEditor.svelte +2 -7
  13. package/src/shared/filter/filter-query/filters.ts +2 -2
  14. package/src/shared/filter/filter-query/parser.ts +9 -8
  15. package/src/shared/filter/power-search/PowerSearch.svelte +1 -1
  16. package/src/shared/filter/search-filter-bar/SearchFilterBar.svelte +2 -2
  17. package/src/shared/filter/search-filter-bar/SearchFilterInput.svelte +1 -1
  18. package/src/shared/filter/search-filter-bar/SearchFilterPredicateEditor.svelte +1 -1
  19. package/src/shared/filter/search-filter-bar/search-filter-syntax.ts +1 -1
  20. package/src/shared/forms/autocomplete-input/AutocompleteInput.svelte +19 -7
  21. package/src/shared/shadcn/command/command-dialog.svelte +1 -1
  22. package/src/shared/shadcn/command/command-group.svelte +3 -1
  23. package/src/shared/shadcn/command-view/command-view.svelte +1 -6
  24. package/src/shared/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte +0 -691
  25. package/src/shared/shadcn/dropdown-menu/dropdown-menu-content.svelte +691 -0
  26. package/src/shared/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +1 -1
  27. package/src/shared/shadcn/scroll-area/scroll-area.svelte +2 -0
  28. package/src/shared/shadcn/spinner/spinner.svelte +3 -3
  29. package/src/shared/shell/app-shell/AppShell.demo.css +37 -0
  30. package/src/shared/shell/app-shell/AppShellBodyContent.svelte +5 -1
  31. package/src/shared/shell/app-shell/AppShellBodySidebar.svelte +5 -1
  32. package/src/shared/shell/app-shell/AppShellMobilePanelSelector.svelte +1 -1
  33. package/src/shared/shell/app-shell/app-shell-controller.svelte.ts +23 -9
  34. package/src/shared/shell/app-shell/examples/AppShellBodyDemo.svelte +4 -0
  35. package/src/shared/shell/app-shell/examples/AppShellCompleteDemo.svelte +1 -0
  36. package/src/shared/shell/app-shell/examples/AppShellConversationDemo.svelte +1 -0
  37. package/src/shared/shell/app-shell/examples/AppShellExamples.css +521 -0
  38. package/src/shared/shell/app-shell/examples/AppShellFilesSidebarDemo.svelte +1 -0
  39. package/src/shared/shell/app-shell/examples/AppShellMarkdownDocumentDemo.svelte +6 -1
  40. package/src/shared/shell/app-shell/examples/AppShellMarkdownFilesDemo.svelte +1 -0
  41. package/src/shared/shell/app-shell/examples/AppShellModeSwitchDemo.svelte +1 -0
  42. package/src/shared/shell/app-shell/examples/AppShellProjectSidebarDemo.svelte +1 -0
  43. package/src/shared/shell/app-shell/examples/AppShellSidebarDemo.svelte +1 -0
  44. package/src/shared/shell/app-shell/examples/AppShellToolbarDemo.svelte +1 -0
  45. package/src/shared/workspace/menu/WorkspaceContextMenuItems.svelte +2 -1
  46. package/src/shared/workspace/menu/WorkspaceMenuItems.svelte +2 -1
  47. package/src/shared/workspace/problems/ProblemsQuickFix.svelte +1 -4
  48. package/src/shared/workspace/settings/AppSettingsContent.svelte +6 -0
  49. package/src/shared/workspace/settings/AppSettingsNavigation.svelte +7 -0
  50. package/src/shared/workspace/settings/CopyableValue.svelte +81 -0
  51. package/src/shared/workspace/settings/DeclarativeSettingsSection.svelte +20 -0
  52. package/src/shared/workspace/settings/WorkspaceSettingField.svelte +110 -41
  53. package/src/shared/workspace/settings/WorkspaceSettingMultiSelect.svelte +7 -6
  54. package/src/shared/workspace/settings/WorkspaceSettingObjectTable.svelte +187 -23
  55. package/src/shared/workspace/settings/WorkspaceSettingSelect.svelte +29 -29
  56. package/src/shared/workspace/settings/WorkspaceSettings.css +190 -4
  57. package/src/shared/workspace/settings/WorkspaceSettingsStoryCustomField.svelte +2 -2
  58. package/src/shared/workspace/settings/WorkspaceSettingsStoryCustomPage.svelte +13 -0
  59. package/src/shared/workspace/settings/WorkspaceSettingsSurface.svelte +50 -0
  60. package/src/shared/workspace/settings/configuration.ts +5 -0
  61. package/src/shared/workspace/settings/copyable-value.ts +10 -0
  62. package/src/shared/workspace/settings/index.ts +5 -0
  63. package/src/shared/workspace/settings/settings-controller.svelte.ts +349 -15
  64. package/src/shared/workspace/settings/types.ts +90 -8
  65. package/src/storybook/app-shell-reference/AppShellTwoExpandedSidebarsReference.css +25 -0
  66. package/src/storybook/app-shell-reference/AppShellTwoExpandedSidebarsReference.svelte +48 -0
  67. package/src/storybook/app-shell-reference/index.ts +1 -0
@@ -15,6 +15,7 @@ export interface WorkspaceSettingBase<Id extends string = string> {
15
15
  description?: string;
16
16
  order?: number;
17
17
  disabled?: boolean;
18
+ readOnly?: boolean;
18
19
  deprecated?: string;
19
20
  }
20
21
 
@@ -89,7 +90,24 @@ export interface WorkspaceActionSetting extends WorkspaceSettingBase {
89
90
  label: string;
90
91
  icon?: WorkspaceIconName;
91
92
  variant?: "default" | "outline" | "destructive" | "ghost";
92
- run(): void | Promise<void>;
93
+ isDisabled?(): boolean;
94
+ isBusy?(): boolean;
95
+ confirm?(): boolean | Promise<boolean>;
96
+ run(): void | WorkspaceActionResult | Promise<void | WorkspaceActionResult>;
97
+ }
98
+
99
+ export interface WorkspaceActionResult {
100
+ tone: "success" | "warning" | "error";
101
+ message: string;
102
+ }
103
+
104
+ export interface WorkspaceOutputSetting extends WorkspaceSettingBase {
105
+ type: "output";
106
+ presentation?: "text" | "code" | "status" | "copyable";
107
+ emptyLabel?: string;
108
+ copyLabel?: string;
109
+ leadingCharacters?: number;
110
+ trailingCharacters?: number;
93
111
  }
94
112
 
95
113
  export interface WorkspaceSectionSettingGroup extends WorkspaceSettingBase {
@@ -115,6 +133,23 @@ export interface WorkspaceObjectProperty {
115
133
  type: "string" | "number" | "integer" | "boolean";
116
134
  default?: string | number | boolean;
117
135
  required?: boolean;
136
+ presentation?: "text" | "url" | "code" | "copyable" | "status" | "hidden";
137
+ readOnly?: boolean;
138
+ }
139
+
140
+ export interface WorkspaceObjectRowAction {
141
+ id: string;
142
+ label: string;
143
+ icon?: WorkspaceIconName;
144
+ variant?: "default" | "outline" | "destructive" | "ghost";
145
+ disabled?: boolean | ((row: Record<string, unknown>) => boolean);
146
+ hidden?: boolean | ((row: Record<string, unknown>) => boolean);
147
+ busy?: (row: Record<string, unknown>) => boolean;
148
+ confirm?: (row: Record<string, unknown>) => boolean | Promise<boolean>;
149
+ run(
150
+ row: Record<string, unknown>,
151
+ index: number,
152
+ ): void | WorkspaceActionResult | Promise<void | WorkspaceActionResult>;
118
153
  }
119
154
 
120
155
  export interface WorkspaceObjectCollectionSetting extends WorkspaceSettingBase {
@@ -123,6 +158,12 @@ export interface WorkspaceObjectCollectionSetting extends WorkspaceSettingBase {
123
158
  properties: WorkspaceObjectProperty[];
124
159
  minimumItems?: number;
125
160
  maximumItems?: number;
161
+ rowKey?: string;
162
+ reorderable?: boolean;
163
+ allowAdd?: boolean;
164
+ allowRemove?: boolean;
165
+ addLabel?: string;
166
+ rowActions?: WorkspaceObjectRowAction[];
126
167
  }
127
168
 
128
169
  export interface WorkspaceObjectMapSetting extends WorkspaceSettingBase {
@@ -144,17 +185,32 @@ export interface WorkspaceKeyValueSetting extends WorkspaceSettingBase {
144
185
  allowUnknownValues?: boolean;
145
186
  }
146
187
 
147
- export interface WorkspaceCustomSettingProps {
188
+ export interface WorkspaceCustomSettingProps<T = unknown> {
148
189
  id: string;
149
- value: unknown;
190
+ field: WorkspaceCustomSetting<T>;
191
+ value: T;
150
192
  disabled?: boolean;
151
- update(value: unknown): boolean;
193
+ readOnly?: boolean;
194
+ busy?: boolean;
195
+ error?: string;
196
+ setValue(value: T): Promise<boolean>;
197
+ /** @deprecated Use setValue for controlled custom fields. */
198
+ update(value: T): boolean;
152
199
  }
153
200
 
154
- export interface WorkspaceCustomSetting extends WorkspaceSettingBase {
201
+ export interface WorkspaceCustomFieldAdapter<T = unknown> {
202
+ id: string;
203
+ component: Component<WorkspaceCustomSettingProps<T>>;
204
+ }
205
+
206
+ export interface WorkspaceCustomSetting<T = unknown>
207
+ extends WorkspaceSettingBase {
155
208
  type: "custom";
156
- default: unknown;
157
- component: Component<WorkspaceCustomSettingProps>;
209
+ default?: T;
210
+ adapter?: string;
211
+ component?: Component<WorkspaceCustomSettingProps<T>>;
212
+ presentation?: "row" | "full-width";
213
+ validate?(value: T): string | null;
158
214
  }
159
215
 
160
216
  export interface WorkspaceUnsupportedSetting extends WorkspaceSettingBase {
@@ -171,6 +227,7 @@ export type WorkspaceSettingField =
171
227
  | WorkspaceMultiEnumSetting
172
228
  | WorkspaceListSetting
173
229
  | WorkspaceActionSetting
230
+ | WorkspaceOutputSetting
174
231
  | WorkspaceSettingGroup
175
232
  | WorkspaceObjectCollectionSetting
176
233
  | WorkspaceObjectMapSetting
@@ -184,6 +241,14 @@ export interface WorkspaceSettingsPageProps {
184
241
  section: WorkspaceSettingsSection;
185
242
  }
186
243
 
244
+ export interface WorkspaceSettingsSearchEntry {
245
+ id: string;
246
+ title: string;
247
+ description?: string;
248
+ keywords?: readonly string[];
249
+ path?: readonly string[];
250
+ }
251
+
187
252
  export interface WorkspaceSettingsSection {
188
253
  id: string;
189
254
  title: string;
@@ -194,9 +259,25 @@ export interface WorkspaceSettingsSection {
194
259
  sourcePluginId?: string;
195
260
  surface?: "schema" | "hotkeys" | "core-plugins";
196
261
  page?: Component<WorkspaceSettingsPageProps>;
262
+ searchEntries?:
263
+ | readonly WorkspaceSettingsSearchEntry[]
264
+ | (() => readonly WorkspaceSettingsSearchEntry[]);
265
+ revealSearchEntry?(entryId: string): void | Promise<void>;
197
266
  fields?: WorkspaceSettingField[];
198
267
  }
199
268
 
269
+ export interface WorkspaceSettingsSource {
270
+ get(fieldId: string): unknown;
271
+ set(fieldId: string, value: unknown): Promise<unknown | void>;
272
+ subscribe(listener: (fieldId?: string) => void): () => void;
273
+ }
274
+
275
+ export interface WorkspaceSettingsDefinition {
276
+ section: WorkspaceSettingsSection;
277
+ source: WorkspaceSettingsSource;
278
+ adapters?: readonly WorkspaceCustomFieldAdapter<any>[];
279
+ }
280
+
200
281
  export interface WorkspaceSettingsNavigationGroup {
201
282
  id: string;
202
283
  title: string;
@@ -209,7 +290,7 @@ export interface WorkspaceSettingsSnapshotV1 {
209
290
  }
210
291
 
211
292
  export interface WorkspaceSettingsChangeEvent {
212
- source: "update" | "restore-default" | "replace" | "load";
293
+ source: "update" | "source" | "restore-default" | "replace" | "load";
213
294
  id?: string;
214
295
  }
215
296
 
@@ -242,6 +323,7 @@ export interface WorkspaceSettingsEventMap {
242
323
  "validation-error": [event: WorkspaceSettingsValidationError];
243
324
  "persistence-error": [event: { operation: "load" | "save"; error: unknown }];
244
325
  "persistence-success": [event: { operation: "load" | "save" }];
326
+ "source-error": [event: { id: string; error: unknown }];
245
327
  }
246
328
 
247
329
  export interface WorkspaceSettingsSearchResult {
@@ -0,0 +1,25 @@
1
+ #storybook-root:has(.ui-shell-story-frame) {
2
+ height: 100vh;
3
+ }
4
+
5
+ .ui-shell-story-frame {
6
+ box-sizing: border-box;
7
+ height: 100%;
8
+ min-width: 48rem;
9
+ padding: 1.5rem;
10
+ background: var(--muted);
11
+ }
12
+
13
+ /* Detached interaction-test renderers do not provide the Storybook root height. */
14
+ .ui-shell-story-frame:not(:where(#storybook-root *)) {
15
+ height: 40rem;
16
+ }
17
+
18
+ .ui-shell-story-surface {
19
+ --ui-shell-height: 100%;
20
+
21
+ border: 1px solid var(--border);
22
+ border-radius: var(--radius);
23
+ box-shadow: 0 1rem 2.5rem
24
+ color-mix(in srgb, var(--foreground) 10%, transparent);
25
+ }
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import { AppShell } from "../../shared/shell/app-shell/index.js";
4
+ import { AppShellController } from "../../shared/shell/app-shell/app-shell-controller.svelte.js";
5
+ import AppShellBodyDemo from "../../shared/shell/app-shell/examples/AppShellBodyDemo.svelte";
6
+ import AppShellConversationDemo from "../../shared/shell/app-shell/examples/AppShellConversationDemo.svelte";
7
+ import AppShellSidebarDemo from "../../shared/shell/app-shell/examples/AppShellSidebarDemo.svelte";
8
+ import AppShellToolbarDemo from "../../shared/shell/app-shell/examples/AppShellToolbarDemo.svelte";
9
+ import "./AppShellTwoExpandedSidebarsReference.css";
10
+
11
+ let {
12
+ controller = new AppShellController(),
13
+ leftSidebar,
14
+ showRightToggle = true,
15
+ }: {
16
+ controller?: AppShellController;
17
+ leftSidebar?: Snippet<[AppShellController]>;
18
+ showRightToggle?: boolean;
19
+ } = $props();
20
+ </script>
21
+
22
+ <div class="ui-shell-story-frame">
23
+ <AppShell.Root
24
+ {controller}
25
+ displayMode="desktop"
26
+ desktopMinMainWidth={0}
27
+ class="ui-shell-story-surface"
28
+ >
29
+ <AppShell.Sidebar side="left">
30
+ {#if leftSidebar}
31
+ {@render leftSidebar(controller)}
32
+ {:else}
33
+ <AppShellSidebarDemo {controller} side="left" />
34
+ {/if}
35
+ </AppShell.Sidebar>
36
+ <AppShell.Main>
37
+ <AppShell.Toolbar>
38
+ <AppShellToolbarDemo {showRightToggle} />
39
+ </AppShell.Toolbar>
40
+ <AppShell.Body label="Workspace content">
41
+ <AppShellBodyDemo />
42
+ </AppShell.Body>
43
+ </AppShell.Main>
44
+ <AppShell.Sidebar side="right" closeable>
45
+ <AppShellConversationDemo {controller} />
46
+ </AppShell.Sidebar>
47
+ </AppShell.Root>
48
+ </div>
@@ -0,0 +1 @@
1
+ export { default as AppShellTwoExpandedSidebarsReference } from "./AppShellTwoExpandedSidebarsReference.svelte";