@widgetic/workflows 0.2.15 → 0.2.17

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 (108) hide show
  1. package/README.md +117 -3
  2. package/dist/api/types.d.ts +17 -0
  3. package/dist/api/workflowsApi.d.ts +12 -1
  4. package/dist/api/workflowsApi.js +37 -0
  5. package/dist/assistant/assistantEvents.d.ts +44 -2
  6. package/dist/assistant/assistantEvents.js +58 -2
  7. package/dist/assistant/assistantReferences.d.ts +66 -0
  8. package/dist/assistant/assistantReferences.js +109 -0
  9. package/dist/assistant/assistantSaveMode.d.ts +15 -3
  10. package/dist/assistant/assistantSaveMode.js +16 -2
  11. package/dist/assistant/assistantSeed.d.ts +55 -0
  12. package/dist/assistant/assistantSeed.js +90 -0
  13. package/dist/assistant/assistantStream.js +81 -3
  14. package/dist/assistant/assistantSuggest.d.ts +18 -0
  15. package/dist/assistant/assistantSuggest.js +21 -0
  16. package/dist/assistant/assistantTurns.d.ts +75 -0
  17. package/dist/assistant/assistantTurns.js +56 -0
  18. package/dist/assistant/attachmentUploads.d.ts +42 -0
  19. package/dist/assistant/attachmentUploads.js +69 -0
  20. package/dist/assistant/canvasLink.d.ts +30 -0
  21. package/dist/assistant/canvasLink.js +51 -0
  22. package/dist/assistant/compositionMention.d.ts +18 -0
  23. package/dist/assistant/compositionMention.js +47 -0
  24. package/dist/assistant/liveData.d.ts +150 -0
  25. package/dist/assistant/liveData.js +286 -0
  26. package/dist/assistant/mcpMention.d.ts +20 -0
  27. package/dist/assistant/mcpMention.js +30 -0
  28. package/dist/assistant/mentionEntries.d.ts +39 -0
  29. package/dist/assistant/mentionEntries.js +69 -0
  30. package/dist/assistant/planFlow.d.ts +26 -0
  31. package/dist/assistant/planFlow.js +57 -0
  32. package/dist/assistant/templateDestinations.d.ts +37 -0
  33. package/dist/assistant/templateDestinations.js +64 -0
  34. package/dist/assistant/types.d.ts +99 -2
  35. package/dist/assistant/workflowPlanViewModel.d.ts +13 -2
  36. package/dist/assistant/workflowPlanViewModel.js +9 -1
  37. package/dist/components/Workflows.svelte +7 -1
  38. package/dist/components/WorkflowsEmptyState.svelte +8 -3
  39. package/dist/components/WorkflowsWorkspace.svelte +29 -1
  40. package/dist/components/WorkflowsWorkspace.svelte.d.ts +3 -0
  41. package/dist/components/assistant/AssistantPlanStepRow.svelte +56 -0
  42. package/dist/components/assistant/AssistantPlanStepRow.svelte.d.ts +9 -0
  43. package/dist/components/assistant/CompositionMentionMenu.svelte +135 -0
  44. package/dist/components/assistant/CompositionMentionMenu.svelte.d.ts +9 -0
  45. package/dist/components/assistant/DataPreviewCard.svelte +108 -0
  46. package/dist/components/assistant/DataPreviewCard.svelte.d.ts +7 -0
  47. package/dist/components/assistant/PlanBindingsBlock.svelte +200 -0
  48. package/dist/components/assistant/PlanBindingsBlock.svelte.d.ts +14 -0
  49. package/dist/components/assistant/TemplateProjectCard.svelte +81 -0
  50. package/dist/components/assistant/TemplateProjectCard.svelte.d.ts +14 -0
  51. package/dist/components/assistant/WorkflowAssistantPanel.svelte +1045 -147
  52. package/dist/components/assistant/WorkflowAssistantPanel.svelte.d.ts +5 -0
  53. package/dist/components/canvas/CanvasContextMenu.svelte +199 -0
  54. package/dist/components/canvas/CanvasContextMenu.svelte.d.ts +16 -0
  55. package/dist/components/canvas/CompositionNodeView.svelte +7 -2
  56. package/dist/components/canvas/ConditionNodeView.svelte +5 -1
  57. package/dist/components/canvas/HandlePoint.svelte +25 -3
  58. package/dist/components/canvas/WorkflowCanvas.svelte +351 -12
  59. package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +12 -1
  60. package/dist/components/canvas/altDragDuplicateController.d.ts +29 -0
  61. package/dist/components/canvas/altDragDuplicateController.js +92 -0
  62. package/dist/components/canvas/connectionSnapController.d.ts +29 -0
  63. package/dist/components/canvas/connectionSnapController.js +182 -0
  64. package/dist/components/canvas/spacePanController.d.ts +16 -0
  65. package/dist/components/canvas/spacePanController.js +103 -0
  66. package/dist/components/editor/EditorCanvasArea.svelte +98 -4
  67. package/dist/components/editor/EditorCanvasArea.svelte.d.ts +5 -0
  68. package/dist/components/editor/EditorTopBar.svelte +53 -42
  69. package/dist/components/editor/WorkflowEditor.svelte +74 -41
  70. package/dist/components/editor/WorkflowEditor.svelte.d.ts +5 -0
  71. package/dist/components/editor/WorkflowNameControl.svelte +9 -8
  72. package/dist/components/editor/WorkflowNameControl.svelte.d.ts +3 -1
  73. package/dist/components/list/WorkflowList.svelte +50 -26
  74. package/dist/components/list/WorkflowList.svelte.d.ts +5 -0
  75. package/dist/components/panel/CompositionForm.svelte +3 -2
  76. package/dist/components/panel/CompositionPicker.svelte +15 -20
  77. package/dist/components/panel/CompositionPicker.svelte.d.ts +2 -2
  78. package/dist/components/panel/CompositionSelect.svelte +4 -4
  79. package/dist/components/panel/CompositionSelect.svelte.d.ts +2 -2
  80. package/dist/components/ui/icons.d.ts +8 -0
  81. package/dist/components/ui/icons.js +24 -1
  82. package/dist/editor/autoLayout.d.ts +38 -0
  83. package/dist/editor/autoLayout.js +403 -0
  84. package/dist/editor/blockClipboard.svelte.d.ts +9 -0
  85. package/dist/editor/blockClipboard.svelte.js +24 -0
  86. package/dist/editor/blockCopy.d.ts +39 -0
  87. package/dist/editor/blockCopy.js +137 -0
  88. package/dist/editor/canvasMenu.d.ts +45 -0
  89. package/dist/editor/canvasMenu.js +68 -0
  90. package/dist/editor/connectionSnap.d.ts +90 -0
  91. package/dist/editor/connectionSnap.js +98 -0
  92. package/dist/editor/editorState.svelte.d.ts +122 -13
  93. package/dist/editor/editorState.svelte.js +262 -22
  94. package/dist/editor/graphIssues.d.ts +5 -0
  95. package/dist/editor/graphIssues.js +18 -0
  96. package/dist/editor/graphModel.d.ts +6 -1
  97. package/dist/editor/graphModel.js +8 -1
  98. package/dist/editor/keyHints.d.ts +21 -0
  99. package/dist/editor/keyHints.js +30 -0
  100. package/dist/editor/listState.svelte.d.ts +4 -4
  101. package/dist/editor/staleGuard.d.ts +111 -0
  102. package/dist/editor/staleGuard.js +279 -0
  103. package/dist/i18n/language.d.ts +3 -3
  104. package/dist/i18n/messages.d.ts +84 -1
  105. package/dist/i18n/messages.js +97 -4
  106. package/dist/index.d.ts +1 -0
  107. package/dist/types/index.d.ts +19 -2
  108. package/package.json +10 -10
@@ -7,7 +7,9 @@
7
7
  the person is asked before it is thrown away.
8
8
 
9
9
  What it listens to outside itself it takes back when it goes: the media query for a screen touched by a finger, and the
10
- page being put away (which sends what is waiting, as far as the browser lets it).
10
+ page being put away (which sends what is waiting, as far as the browser lets it). The editor's stale-tab guard listens
11
+ to the tab coming back; while it takes a newer draft (saved by the assistant, an MCP client, another tab) the whole
12
+ editor sits under a dark overlay that fades in and out, so nothing is changed on a draft that is out of date.
11
13
  -->
12
14
  <script lang="ts">
13
15
  import { onDestroy, onMount, untrack } from 'svelte';
@@ -15,8 +17,10 @@
15
17
  import { WorkflowEditorState, provideEditorState } from '../../editor/editorState.svelte.js';
16
18
  import { useWorkflowsLanguage } from '../../i18n/language.js';
17
19
  import type { DraftRestoredInfo } from '../../drafts/workflowDraft.js';
20
+ import type { ReadyAssistantSeed } from '../../assistant/assistantSeed.js';
18
21
  import type { WorkflowAssistantConfig } from '../../assistant/types.js';
19
22
  import type { WorkflowsError } from '../../types/index.js';
23
+ import { ContentRefreshOverlay } from '@widgetic/design-system/components';
20
24
  import ConfirmDialog from '../ui/ConfirmDialog.svelte';
21
25
  import EditorBanners from './EditorBanners.svelte';
22
26
  import EditorCanvasArea from './EditorCanvasArea.svelte';
@@ -41,6 +45,10 @@
41
45
  /** Called when unsaved edits were restored from the draft journal after load. */
42
46
  onDraftRestored?: (info: DraftRestoredInfo) => void;
43
47
  assistant?: WorkflowAssistantConfig | null;
48
+ /** The first message the page left waiting for the assistant of this workflow (already checked to be for it). */
49
+ assistantSeed?: ReadyAssistantSeed | null;
50
+ /** The assistant took the seed in, or left it alone because the person had begun: the page may stop holding it. */
51
+ onassistantseedapplied?: (workflowId: string) => void;
44
52
  }
45
53
 
46
54
  let {
@@ -51,7 +59,9 @@
51
59
  onshowembedcode,
52
60
  presence = false,
53
61
  onDraftRestored,
54
- assistant = null
62
+ assistant = null,
63
+ assistantSeed = null,
64
+ onassistantseedapplied
55
65
  }: Props = $props();
56
66
 
57
67
  const api = useWorkflowsApi();
@@ -74,10 +84,21 @@
74
84
 
75
85
  let isAskingToPublish = $state(false);
76
86
  let isAskingToLeave = $state(false);
87
+ // Open when the workflow is opened, so the message the page left for the assistant is in front of the person at once.
77
88
  let assistantPanelOpen = $state(true);
78
89
 
79
90
  const assistantEnabled = $derived(Boolean(assistant?.enabled));
80
91
 
92
+ // Read once, like the workflow: a seed belongs to this opening of it, so one that arrives later is not used. The assistant's panel
93
+ // is drawn again each time the person comes back to the Editor tab, and the page's message is written to its composer only the
94
+ // first time: once the panel has taken the seed in, nothing is handed over again.
95
+ let seedWaiting = $state.raw<ReadyAssistantSeed | null>(untrack(() => assistantSeed));
96
+
97
+ function noteSeedUsed(): void {
98
+ seedWaiting = null;
99
+ onassistantseedapplied?.(workflowId);
100
+ }
101
+
81
102
  function toggleAssistantPanel(): void {
82
103
  assistantPanelOpen = !assistantPanelOpen;
83
104
  }
@@ -118,6 +139,8 @@
118
139
  void editor.load();
119
140
  // Who else is editing is asked alongside the load (it needs only the workflow's id); nothing happens without `presence`.
120
141
  editor.startPresence();
142
+ // A tab that comes back after the draft was saved somewhere else (assistant, MCP, another tab) takes it behind the overlay.
143
+ editor.startStaleGuard();
121
144
 
122
145
  // A finger cannot draw a line between two small points: on a touch screen the canvas only shows (the panel edits).
123
146
  const touchQuery = window.matchMedia('(pointer: coarse)');
@@ -145,45 +168,55 @@
145
168
  </script>
146
169
 
147
170
  <div class="@container flex h-full min-h-0 w-full flex-col" data-workflows-editor>
148
- {#if editor.loadState === 'loading'}
149
- <p class="m-auto py-8 text-body text-muted-foreground" role="status">
150
- {$t('workflows.common.loading')}
151
- </p>
152
- {:else if editor.loadState === 'failed'}
153
- <EditorLoadFailure {onback} />
154
- {:else}
155
- <EditorTopBar
156
- onback={() => void goBack()}
157
- onpublish={requestPublish}
158
- onshowembedcode={showEmbedCode}
159
- assistantEnabled={assistantEnabled}
160
- assistantOpen={assistantPanelOpen}
161
- onToggleAssistant={toggleAssistantPanel}
162
- />
163
- <EditorTabs {panelId} />
164
- <EditorBanners />
165
- <div
166
- id={panelId}
167
- role="tabpanel"
168
- aria-labelledby="{panelId}-tab-{editor.tab}"
169
- class="flex min-h-0 flex-1 min-w-0 flex-col"
170
- >
171
- {#if editor.tab === 'editor'}
172
- <EditorCanvasArea
173
- {assistant}
174
- assistantOpen={assistantPanelOpen}
175
- onOpenAssistant={openAssistantPanel}
176
- workflowId={workflowId}
177
- />
178
- {:else if editor.tab === 'runs'}
179
- <RunsTab />
180
- {:else}
181
- <div class="min-h-0 flex-1 overflow-auto">
182
- <SettingsTab onshowembedcode={showEmbedCode} />
183
- </div>
184
- {/if}
185
- </div>
186
- {/if}
171
+ <!-- Dark overlay while a newer draft is taken (the stale-tab guard): the editor under it cannot be touched. -->
172
+ <ContentRefreshOverlay
173
+ active={editor.staleGuardPhase === 'updating'}
174
+ message={$t('workflows.stale.updating')}
175
+ description={$t('workflows.stale.updatingDescription')}
176
+ class="flex h-full min-h-0 w-full flex-col"
177
+ >
178
+ {#if editor.loadState === 'loading'}
179
+ <p class="m-auto py-8 text-body text-muted-foreground" role="status">
180
+ {$t('workflows.common.loading')}
181
+ </p>
182
+ {:else if editor.loadState === 'failed'}
183
+ <EditorLoadFailure {onback} />
184
+ {:else}
185
+ <EditorTopBar
186
+ onback={() => void goBack()}
187
+ onpublish={requestPublish}
188
+ onshowembedcode={showEmbedCode}
189
+ assistantEnabled={assistantEnabled}
190
+ assistantOpen={assistantPanelOpen}
191
+ onToggleAssistant={toggleAssistantPanel}
192
+ />
193
+ <EditorTabs {panelId} />
194
+ <EditorBanners />
195
+ <div
196
+ id={panelId}
197
+ role="tabpanel"
198
+ aria-labelledby="{panelId}-tab-{editor.tab}"
199
+ class="flex min-h-0 flex-1 min-w-0 flex-col"
200
+ >
201
+ {#if editor.tab === 'editor'}
202
+ <EditorCanvasArea
203
+ {assistant}
204
+ assistantSeed={seedWaiting}
205
+ onAssistantSeedApplied={noteSeedUsed}
206
+ assistantOpen={assistantPanelOpen}
207
+ onOpenAssistant={openAssistantPanel}
208
+ workflowId={workflowId}
209
+ />
210
+ {:else if editor.tab === 'runs'}
211
+ <RunsTab />
212
+ {:else}
213
+ <div class="min-h-0 flex-1 overflow-auto">
214
+ <SettingsTab onshowembedcode={showEmbedCode} />
215
+ </div>
216
+ {/if}
217
+ </div>
218
+ {/if}
219
+ </ContentRefreshOverlay>
187
220
  </div>
188
221
 
189
222
  {#if isAskingToPublish}
@@ -1,4 +1,5 @@
1
1
  import type { DraftRestoredInfo } from '../../drafts/workflowDraft.js';
2
+ import type { ReadyAssistantSeed } from '../../assistant/assistantSeed.js';
2
3
  import type { WorkflowAssistantConfig } from '../../assistant/types.js';
3
4
  import type { WorkflowsError } from '../../types/index.js';
4
5
  interface Props {
@@ -16,6 +17,10 @@ interface Props {
16
17
  /** Called when unsaved edits were restored from the draft journal after load. */
17
18
  onDraftRestored?: (info: DraftRestoredInfo) => void;
18
19
  assistant?: WorkflowAssistantConfig | null;
20
+ /** The first message the page left waiting for the assistant of this workflow (already checked to be for it). */
21
+ assistantSeed?: ReadyAssistantSeed | null;
22
+ /** The assistant took the seed in, or left it alone because the person had begun: the page may stop holding it. */
23
+ onassistantseedapplied?: (workflowId: string) => void;
19
24
  }
20
25
  declare const WorkflowEditor: import("svelte").Component<Props, {}, "">;
21
26
  type WorkflowEditor = ReturnType<typeof WorkflowEditor>;
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  The workflow name in the editor header: plain text until the person hovers and chooses to edit it, then a field that
3
- commits on Enter or blur and cancels on Escape.
3
+ commits on Enter or blur and cancels on Escape. In edit mode the field uses a soft accent fill and grows wider than the title.
4
4
  -->
5
5
  <script lang="ts">
6
6
  import { tick } from 'svelte';
@@ -17,6 +17,8 @@
17
17
  readonly?: boolean;
18
18
  maxlength?: number;
19
19
  class?: string;
20
+ /** Whether the person is renaming (for siblings that sit beside the field). */
21
+ isEditing?: boolean;
20
22
  oncommit: (name: string) => void;
21
23
  }
22
24
 
@@ -28,10 +30,10 @@
28
30
  readonly = false,
29
31
  maxlength = MAX_WORKFLOW_NAME_LENGTH,
30
32
  class: className = '',
33
+ isEditing = $bindable(false),
31
34
  oncommit
32
35
  }: Props = $props();
33
36
 
34
- let isEditing = $state(false);
35
37
  let draft = $state('');
36
38
  let inputElement = $state<HTMLInputElement | null>(null);
37
39
  let nameButton = $state<HTMLButtonElement | null>(null);
@@ -66,7 +68,6 @@
66
68
  }
67
69
  isEditing = false;
68
70
  editor.setPendingWorkflowName(null);
69
- // The name button is not in the page until the update that follows `isEditing = false`, so it takes the focus after it.
70
71
  if (restoreFocus) void tick().then(() => nameButton?.focus());
71
72
  }
72
73
 
@@ -94,13 +95,13 @@
94
95
  }
95
96
  </script>
96
97
 
97
- <div class="min-w-0 {className}">
98
+ <div class="min-w-0 shrink {className}">
98
99
  {#if isEditing}
99
100
  <input
100
101
  bind:this={inputElement}
101
102
  id={fieldId}
102
103
  type="text"
103
- class="workflow-name-control-input w-full min-w-0 rounded-md border border-input bg-background px-2 py-1.5 text-body-medium text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"
104
+ class="workflow-name-control-input h-9 min-w-[8rem] max-w-[min(100%,32rem)] shrink-0 rounded-lg border border-transparent bg-accent px-2 py-1.5 text-body-medium text-foreground outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring"
104
105
  bind:value={draft}
105
106
  oninput={handleDraftInput}
106
107
  {maxlength}
@@ -111,7 +112,7 @@
111
112
  {:else if readonly}
112
113
  <p
113
114
  id={fieldId}
114
- class="workflow-name-control-view min-w-0 truncate px-2 py-1.5 text-body-medium text-foreground"
115
+ class="workflow-name-control-view min-w-0 max-w-full truncate px-2 py-1.5 text-body-medium text-foreground"
115
116
  dir="auto"
116
117
  >
117
118
  {name}
@@ -121,12 +122,12 @@
121
122
  bind:this={nameButton}
122
123
  id={fieldId}
123
124
  type="button"
124
- class="workflow-name-control-view group flex w-full min-w-0 items-center gap-1.5 rounded-md border border-transparent px-2 py-1.5 text-start text-body-medium text-foreground transition-colors hover:cursor-text hover:border-input hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
125
+ class="workflow-name-control-view group flex max-w-full min-w-0 shrink items-center gap-1.5 rounded-lg border border-transparent px-2 py-1.5 text-start text-body-medium text-foreground transition-colors hover:cursor-text hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
125
126
  aria-label={label}
126
127
  onclick={beginEditing}
127
128
  onkeydown={handleViewKeydown}
128
129
  >
129
- <span class="min-w-0 flex-1 truncate" dir="auto">{name}</span>
130
+ <span class="min-w-0 truncate" dir="auto">{name}</span>
130
131
  <Icon
131
132
  name="pencil"
132
133
  class="size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
@@ -6,8 +6,10 @@ interface Props {
6
6
  readonly?: boolean;
7
7
  maxlength?: number;
8
8
  class?: string;
9
+ /** Whether the person is renaming (for siblings that sit beside the field). */
10
+ isEditing?: boolean;
9
11
  oncommit: (name: string) => void;
10
12
  }
11
- declare const WorkflowNameControl: import("svelte").Component<Props, {}, "">;
13
+ declare const WorkflowNameControl: import("svelte").Component<Props, {}, "isEditing">;
12
14
  type WorkflowNameControl = ReturnType<typeof WorkflowNameControl>;
13
15
  export default WorkflowNameControl;
@@ -35,7 +35,7 @@
35
35
  import Notice from '../ui/Notice.svelte';
36
36
  import SelectField from '../ui/SelectField.svelte';
37
37
  import Tabs from '../ui/Tabs.svelte';
38
- import TextField from '../ui/TextField.svelte';
38
+ import { SearchInput } from '@widgetic/design-system/components';
39
39
  import type { SelectChoice } from '../ui/types.js';
40
40
  import WorkflowRow from './WorkflowRow.svelte';
41
41
 
@@ -55,6 +55,11 @@
55
55
  presence?: boolean;
56
56
  /** From Dexie via the host layout load — default list paints before `load()` runs. */
57
57
  initialListPage?: { items: readonly import('../../api/types.js').WorkflowListItem[]; total: number } | null;
58
+ /**
59
+ * Host-built localStorage key for recent workflow searches (per person, workspace, page). Empty string leaves the
60
+ * field without a recents panel.
61
+ */
62
+ recentSearchesKey?: string;
58
63
  }
59
64
 
60
65
  let {
@@ -63,7 +68,8 @@
63
68
  onerror,
64
69
  onshowembedcode,
65
70
  presence = false,
66
- initialListPage = null
71
+ initialListPage = null,
72
+ recentSearchesKey = ''
67
73
  }: Props = $props();
68
74
 
69
75
  const api = useWorkflowsApi();
@@ -166,17 +172,30 @@
166
172
  <WorkflowsHeader class="min-w-0 shrink" />
167
173
  {#if !isLibraryEmpty}
168
174
  <div class="flex min-w-0 shrink-0 items-center gap-2">
169
- <TextField
170
- class="w-60 shrink-0"
171
- type="search"
172
- variant="soft"
173
- icon="search"
174
- label={$t('workflows.list.searchLabel')}
175
- placeholder={$t('workflows.list.searchPlaceholder')}
176
- hideLabel
177
- bind:value={searchDraft}
178
- oninput={() => list.setSearch(searchDraft)}
179
- />
175
+ <!--
176
+ The design draws the search 240px wide (Figma list-list: `search` 240 x 36, then the 144px button). The
177
+ width belongs to this wrapper and not to the field: the field's own root is `w-full`, and a `w-60` handed
178
+ to it through `containerClass` loses to that (`w-full` comes later in the generated CSS). The field then
179
+ filled whatever this group measured, 366px, and pushed "New workflow" out of the window: the page scrolled
180
+ sideways (owner, 19 Nov 2026).
181
+ -->
182
+ <div class="w-60 shrink-0" data-workflows-search-slot>
183
+ <SearchInput
184
+ containerClass="min-w-0"
185
+ bind:value={searchDraft}
186
+ placeholder={$t('workflows.list.searchPlaceholder')}
187
+ clearLabel={$t('workflows.list.clearSearch')}
188
+ inputAttributes={{ 'aria-label': $t('workflows.list.searchLabel') }}
189
+ {recentSearchesKey}
190
+ recentSearchesLabel={$t('workflows.list.recentSearches')}
191
+ clearRecentSearchesLabel={$t('workflows.list.clearRecentSearches')}
192
+ onInput={() => list.setSearch(searchDraft)}
193
+ onClear={() => {
194
+ searchDraft = '';
195
+ list.setSearch('');
196
+ }}
197
+ />
198
+ </div>
180
199
  <!-- The design draws this button outlined while the list could not be read (the error state has the main action). -->
181
200
  <Button
182
201
  variant={dsButtonVariant(list.loadState === 'failed' ? 'outline' : 'primary')}
@@ -217,16 +236,20 @@
217
236
  {/if}
218
237
  </div>
219
238
  {#if !isLibraryEmpty}
220
- <TextField
221
- class="w-full min-w-0"
222
- type="search"
223
- variant="soft"
224
- icon="search"
225
- label={$t('workflows.list.searchLabel')}
226
- placeholder={$t('workflows.list.searchPlaceholder')}
227
- hideLabel
239
+ <SearchInput
240
+ containerClass="w-full min-w-0"
228
241
  bind:value={searchDraft}
229
- oninput={() => list.setSearch(searchDraft)}
242
+ placeholder={$t('workflows.list.searchPlaceholder')}
243
+ clearLabel={$t('workflows.list.clearSearch')}
244
+ inputAttributes={{ 'aria-label': $t('workflows.list.searchLabel') }}
245
+ {recentSearchesKey}
246
+ recentSearchesLabel={$t('workflows.list.recentSearches')}
247
+ clearRecentSearchesLabel={$t('workflows.list.clearRecentSearches')}
248
+ onInput={() => list.setSearch(searchDraft)}
249
+ onClear={() => {
250
+ searchDraft = '';
251
+ list.setSearch('');
252
+ }}
230
253
  />
231
254
  {/if}
232
255
  </div>
@@ -360,13 +383,14 @@
360
383
  </ErrorState>
361
384
  {:else if list.items.length === 0}
362
385
  {#if list.isNarrowed}
363
- <!-- Figma "No matches": the same centred state as an empty list, with a search tile and the one line. -->
386
+ <!-- Figma "No matches": the same centred state as an empty list, with a search tile and the one line (a grey tile
387
+ and a muted Body/Medium line, like every empty placeholder of the site). -->
364
388
  <div class="flex flex-1 flex-col items-center justify-center px-4 py-12" role="status">
365
389
  <div class="flex w-120 max-w-full flex-col items-center gap-3 px-12 text-center">
366
- <div class="flex size-12 items-center justify-center rounded-xl bg-brand-subtle">
367
- <Icon name="search" class="size-4 text-brand-foreground" />
390
+ <div class="flex size-12 items-center justify-center rounded-xl bg-muted">
391
+ <Icon name="search" class="size-4 text-foreground" />
368
392
  </div>
369
- <h2 class="text-heading-section text-foreground">{$t('workflows.list.noMatches')}</h2>
393
+ <h2 class="text-body-medium text-muted-foreground">{$t('workflows.list.noMatches')}</h2>
370
394
  </div>
371
395
  </div>
372
396
  {:else}
@@ -18,6 +18,11 @@ interface Props {
18
18
  items: readonly import('../../api/types.js').WorkflowListItem[];
19
19
  total: number;
20
20
  } | null;
21
+ /**
22
+ * Host-built localStorage key for recent workflow searches (per person, workspace, page). Empty string leaves the
23
+ * field without a recents panel.
24
+ */
25
+ recentSearchesKey?: string;
21
26
  }
22
27
  declare const WorkflowList: import("svelte").Component<Props, {}, "">;
23
28
  type WorkflowList = ReturnType<typeof WorkflowList>;
@@ -33,6 +33,7 @@
33
33
 
34
34
  /** What the API says about the composition of this block; `undefined` before it answers, `null` when it is not there. */
35
35
  const option = $derived(node.compositionId ? editor.options[node.compositionId] : undefined);
36
+ /** The compositions the other blocks show: the list marks them "Already in this workflow", and they stay free to choose. */
36
37
  const otherCompositionIds = $derived(
37
38
  editor.compositionIds.filter((compositionId) => compositionId !== node.compositionId)
38
39
  );
@@ -63,7 +64,7 @@
63
64
  valueLabel={chosenName}
64
65
  placeholder={$t('workflows.create.compositionPlaceholder')}
65
66
  selectedId={node.compositionId}
66
- takenIds={otherCompositionIds}
67
+ usedIds={otherCompositionIds}
67
68
  disabled={editor.isReadOnly}
68
69
  onpick={chooseComposition}
69
70
  onread={(options) => editor.rememberCompositions(options)}
@@ -73,7 +74,7 @@
73
74
  <CompositionPicker
74
75
  selectedId={null}
75
76
  bordered={false}
76
- takenIds={otherCompositionIds}
77
+ usedIds={otherCompositionIds}
77
78
  onpick={chooseComposition}
78
79
  onread={(options) => editor.rememberCompositions(options)}
79
80
  />
@@ -1,7 +1,8 @@
1
1
  <!--
2
2
  A list of the compositions a person may use in a workflow, with a search above it. Used where a composition is chosen: when a
3
3
  workflow is made, and on a composition block. Each line has the composition's picture and name; one that is already in the
4
- workflow is shown but cannot be chosen again (a composition has one block), and one whose widget was never published says so.
4
+ workflow says so and can still be chosen (the same composition may sit on several blocks), and one whose widget was never
5
+ published says so too.
5
6
 
6
7
  It asks the API for twenty at a time (`composition-options`), and for the next twenty when asked. Every search replaces the
7
8
  one before it: an answer to an older search that arrives late is dropped.
@@ -23,8 +24,8 @@
23
24
  interface Props {
24
25
  /** The composition that is chosen now, if any. */
25
26
  selectedId?: string | null;
26
- /** Compositions already in the workflow: shown, but cannot be chosen. */
27
- takenIds?: readonly string[];
27
+ /** Compositions already on a block of the workflow: marked as such, and still free to choose again. */
28
+ usedIds?: readonly string[];
28
29
  /** Called with every composition the person picks, so the owner can remember its name and picture. */
29
30
  onpick: (option: CompositionOption) => void;
30
31
  /** Called with each page of compositions that was read, so the owner can remember them. */
@@ -36,7 +37,7 @@
36
37
  bordered?: boolean;
37
38
  }
38
39
 
39
- let { selectedId = null, takenIds = [], onpick, onread, bordered = true }: Props = $props();
40
+ let { selectedId = null, usedIds = [], onpick, onread, bordered = true }: Props = $props();
40
41
 
41
42
  const PAGE_SIZE = 20;
42
43
  const SEARCH_DELAY_MILLISECONDS = 300;
@@ -54,7 +55,7 @@
54
55
  let controller: AbortController | null = null;
55
56
  let searchTimer: ReturnType<typeof setTimeout> | null = null;
56
57
 
57
- const taken = $derived(new Set(takenIds));
58
+ const used = $derived(new Set(usedIds));
58
59
  const hasMore = $derived(items.length < total);
59
60
 
60
61
  /** Reads the first page for what is in the search box now (or the next page, when `append`). */
@@ -152,15 +153,14 @@
152
153
  >
153
154
  {#each items as option (option.id)}
154
155
  {@const isSelected = option.id === selectedId}
155
- {@const isTaken = taken.has(option.id) && !isSelected}
156
+ {@const isUsed = used.has(option.id) && !isSelected}
156
157
  <li role="none">
157
158
  <button
158
159
  type="button"
159
- disabled={isTaken}
160
160
  role="option"
161
161
  aria-selected={isSelected}
162
162
  aria-current={isSelected ? 'true' : undefined}
163
- class="focus-visible:ring-ring flex w-full items-center gap-3 rounded-lg px-2 py-2 text-start text-body text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background {isSelected
163
+ class="focus-visible:ring-ring flex w-full items-center gap-3 rounded-lg px-2 py-2 text-start text-body text-foreground hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background {isSelected
164
164
  ? 'bg-brand-subtle text-brand-foreground'
165
165
  : ''}"
166
166
  onclick={() => onpick(option)}
@@ -182,18 +182,13 @@
182
182
  {/if}
183
183
  <span class="flex min-w-0 flex-1 flex-col gap-0.5 text-start">
184
184
  <span class="text-body-medium truncate" dir="auto">{option.name}</span>
185
- {#if isTaken}
186
- <span class="text-caption text-muted-foreground"
187
- >{$t('workflows.composition.alreadyUsed')}</span
188
- >
189
- {:else}
190
- <!-- Whether the widget is published, as the design's rows say it. -->
191
- <span class="text-caption text-muted-foreground">
192
- {option.published
193
- ? $t('workflows.block.publishedMeta')
194
- : $t('workflows.block.notPublished')}
195
- </span>
196
- {/if}
185
+ <!-- Whether the widget is published, as the design's rows say it, and that it is already in the workflow. -->
186
+ <span class="text-caption text-muted-foreground">
187
+ {option.published
188
+ ? $t('workflows.block.publishedMeta')
189
+ : $t('workflows.block.notPublished')}{#if isUsed}
190
+ · {$t('workflows.composition.alreadyUsed')}{/if}
191
+ </span>
197
192
  </span>
198
193
  {#if isSelected}<Icon name="check" class="text-brand-foreground size-4 shrink-0" />{/if}
199
194
  </button>
@@ -2,8 +2,8 @@ import type { CompositionOption } from '../../api/types.js';
2
2
  interface Props {
3
3
  /** The composition that is chosen now, if any. */
4
4
  selectedId?: string | null;
5
- /** Compositions already in the workflow: shown, but cannot be chosen. */
6
- takenIds?: readonly string[];
5
+ /** Compositions already on a block of the workflow: marked as such, and still free to choose again. */
6
+ usedIds?: readonly string[];
7
7
  /** Called with every composition the person picks, so the owner can remember its name and picture. */
8
8
  onpick: (option: CompositionOption) => void;
9
9
  /** Called with each page of compositions that was read, so the owner can remember them. */
@@ -25,8 +25,8 @@
25
25
  help?: string | null;
26
26
  /** The composition that is chosen now, so the list marks it. */
27
27
  selectedId: string | null;
28
- /** Compositions that are already in the workflow: the list shows them but they cannot be chosen again. */
29
- takenIds?: readonly string[];
28
+ /** Compositions that are already on a block of the workflow: the list says so, and they can still be chosen again. */
29
+ usedIds?: readonly string[];
30
30
  /** The person picked a line (the line that is already chosen too: the owner decides what that means). */
31
31
  onpick: (option: CompositionOption) => void;
32
32
  /** Each page of compositions the list read, so the owner can remember their names and pictures. */
@@ -40,7 +40,7 @@
40
40
  placeholder,
41
41
  help = null,
42
42
  selectedId,
43
- takenIds = [],
43
+ usedIds = [],
44
44
  onpick,
45
45
  onread,
46
46
  disabled = false
@@ -103,7 +103,7 @@
103
103
  {/if}
104
104
  {#if isOpen}
105
105
  <div id="{fieldId}-list" class="flex min-h-0 flex-col">
106
- <CompositionPicker {selectedId} {takenIds} onpick={pick} {onread} />
106
+ <CompositionPicker {selectedId} {usedIds} onpick={pick} {onread} />
107
107
  </div>
108
108
  {/if}
109
109
  </div>
@@ -10,8 +10,8 @@ interface Props {
10
10
  help?: string | null;
11
11
  /** The composition that is chosen now, so the list marks it. */
12
12
  selectedId: string | null;
13
- /** Compositions that are already in the workflow: the list shows them but they cannot be chosen again. */
14
- takenIds?: readonly string[];
13
+ /** Compositions that are already on a block of the workflow: the list says so, and they can still be chosen again. */
14
+ usedIds?: readonly string[];
15
15
  /** The person picked a line (the line that is already chosen too: the owner decides what that means). */
16
16
  onpick: (option: CompositionOption) => void;
17
17
  /** Each page of compositions the list read, so the owner can remember their names and pictures. */
@@ -46,5 +46,13 @@ export declare const ICON_PATHS: {
46
46
  readonly condition: readonly ["M12 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", "M7 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", "M17 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", "M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2", "M12 12l0 4"];
47
47
  /** Small pencil shown on hover beside an editable title. */
48
48
  readonly pencil: readonly ["M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4", "M13.5 6.5l4 4"];
49
+ /** Arrow to the right, Tabler arrow-right: between the widgets of the flow in a plan. */
50
+ readonly arrowRight: readonly ["M5 12l14 0", "M13 18l6 -6", "M13 6l6 6"];
51
+ /** Chat / assistant, Tabler message-circle (the `Icon/message-circle` of the design's icon page). */
52
+ readonly chat: readonly ["M3 20l1.3 -3.9a9 8 0 1 1 3.4 2.9l-4.7 1"];
53
+ /** A document, Tabler file (the `Icon/file` of the design's icon page): the leading icon of an attached file's chip. */
54
+ readonly file: readonly ["M14 3v4a1 1 0 0 0 1 1h4", "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"];
55
+ readonly plugConnected: readonly ["M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5", "M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5", "M3 21l2.5 -2.5", "M18.5 5.5l2.5 -2.5", "M10 11l-2 2", "M13 14l-2 2"];
56
+ readonly table: readonly ["M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14", "M3 10h18", "M10 3v18"];
49
57
  };
50
58
  export type IconName = keyof typeof ICON_PATHS;
@@ -112,6 +112,29 @@ export const ICON_PATHS = {
112
112
  'M12 12l0 4'
113
113
  ],
114
114
  /** Small pencil shown on hover beside an editable title. */
115
- pencil: ['M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4', 'M13.5 6.5l4 4']
115
+ pencil: ['M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4', 'M13.5 6.5l4 4'],
116
+ /** Arrow to the right, Tabler arrow-right: between the widgets of the flow in a plan. */
117
+ arrowRight: ['M5 12l14 0', 'M13 18l6 -6', 'M13 6l6 6'],
118
+ /** Chat / assistant, Tabler message-circle (the `Icon/message-circle` of the design's icon page). */
119
+ chat: ['M3 20l1.3 -3.9a9 8 0 1 1 3.4 2.9l-4.7 1'],
120
+ /** A document, Tabler file (the `Icon/file` of the design's icon page): the leading icon of an attached file's chip. */
121
+ file: [
122
+ 'M14 3v4a1 1 0 0 0 1 1h4',
123
+ 'M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z'
124
+ ],
125
+ // An Open MCP of the person (a server they connected), and a table of values (what a call would show).
126
+ plugConnected: [
127
+ 'M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5',
128
+ 'M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5',
129
+ 'M3 21l2.5 -2.5',
130
+ 'M18.5 5.5l2.5 -2.5',
131
+ 'M10 11l-2 2',
132
+ 'M13 14l-2 2'
133
+ ],
134
+ table: [
135
+ 'M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14',
136
+ 'M3 10h18',
137
+ 'M10 3v18'
138
+ ]
116
139
  // [extra icons]
117
140
  };