@widgetic/workflows 0.2.14 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -3
- package/dist/api/types.d.ts +17 -0
- package/dist/api/workflowsApi.d.ts +12 -1
- package/dist/api/workflowsApi.js +37 -0
- package/dist/assistant/assistantEvents.d.ts +44 -2
- package/dist/assistant/assistantEvents.js +58 -2
- package/dist/assistant/assistantReferences.d.ts +66 -0
- package/dist/assistant/assistantReferences.js +109 -0
- package/dist/assistant/assistantSaveMode.d.ts +15 -3
- package/dist/assistant/assistantSaveMode.js +16 -2
- package/dist/assistant/assistantSeed.d.ts +55 -0
- package/dist/assistant/assistantSeed.js +90 -0
- package/dist/assistant/assistantStream.js +81 -3
- package/dist/assistant/assistantSuggest.d.ts +18 -0
- package/dist/assistant/assistantSuggest.js +21 -0
- package/dist/assistant/assistantTurns.d.ts +75 -0
- package/dist/assistant/assistantTurns.js +56 -0
- package/dist/assistant/attachmentUploads.d.ts +42 -0
- package/dist/assistant/attachmentUploads.js +69 -0
- package/dist/assistant/canvasLink.d.ts +30 -0
- package/dist/assistant/canvasLink.js +51 -0
- package/dist/assistant/compositionMention.d.ts +18 -0
- package/dist/assistant/compositionMention.js +47 -0
- package/dist/assistant/liveData.d.ts +150 -0
- package/dist/assistant/liveData.js +286 -0
- package/dist/assistant/mcpMention.d.ts +20 -0
- package/dist/assistant/mcpMention.js +30 -0
- package/dist/assistant/mentionEntries.d.ts +39 -0
- package/dist/assistant/mentionEntries.js +69 -0
- package/dist/assistant/planFlow.d.ts +26 -0
- package/dist/assistant/planFlow.js +57 -0
- package/dist/assistant/templateDestinations.d.ts +37 -0
- package/dist/assistant/templateDestinations.js +64 -0
- package/dist/assistant/types.d.ts +99 -2
- package/dist/assistant/workflowPlanViewModel.d.ts +13 -2
- package/dist/assistant/workflowPlanViewModel.js +9 -1
- package/dist/components/Workflows.svelte +7 -1
- package/dist/components/WorkflowsWorkspace.svelte +29 -1
- package/dist/components/WorkflowsWorkspace.svelte.d.ts +3 -0
- package/dist/components/assistant/AssistantPlanStepRow.svelte +56 -0
- package/dist/components/assistant/AssistantPlanStepRow.svelte.d.ts +9 -0
- package/dist/components/assistant/CompositionMentionMenu.svelte +135 -0
- package/dist/components/assistant/CompositionMentionMenu.svelte.d.ts +9 -0
- package/dist/components/assistant/DataPreviewCard.svelte +108 -0
- package/dist/components/assistant/DataPreviewCard.svelte.d.ts +7 -0
- package/dist/components/assistant/PlanBindingsBlock.svelte +200 -0
- package/dist/components/assistant/PlanBindingsBlock.svelte.d.ts +14 -0
- package/dist/components/assistant/TemplateProjectCard.svelte +81 -0
- package/dist/components/assistant/TemplateProjectCard.svelte.d.ts +14 -0
- package/dist/components/assistant/WorkflowAssistantPanel.svelte +1045 -147
- package/dist/components/assistant/WorkflowAssistantPanel.svelte.d.ts +5 -0
- package/dist/components/canvas/CanvasContextMenu.svelte +199 -0
- package/dist/components/canvas/CanvasContextMenu.svelte.d.ts +16 -0
- package/dist/components/canvas/CompositionNodeView.svelte +7 -2
- package/dist/components/canvas/ConditionNodeView.svelte +5 -1
- package/dist/components/canvas/HandlePoint.svelte +25 -3
- package/dist/components/canvas/WorkflowCanvas.svelte +351 -12
- package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +12 -1
- package/dist/components/canvas/altDragDuplicateController.d.ts +29 -0
- package/dist/components/canvas/altDragDuplicateController.js +92 -0
- package/dist/components/canvas/connectionSnapController.d.ts +29 -0
- package/dist/components/canvas/connectionSnapController.js +182 -0
- package/dist/components/canvas/spacePanController.d.ts +16 -0
- package/dist/components/canvas/spacePanController.js +103 -0
- package/dist/components/editor/EditorCanvasArea.svelte +98 -4
- package/dist/components/editor/EditorCanvasArea.svelte.d.ts +5 -0
- package/dist/components/editor/EditorLoadFailure.svelte +53 -0
- package/dist/components/editor/EditorLoadFailure.svelte.d.ts +7 -0
- package/dist/components/editor/EditorTopBar.svelte +53 -42
- package/dist/components/editor/WorkflowEditor.svelte +74 -50
- package/dist/components/editor/WorkflowEditor.svelte.d.ts +5 -0
- package/dist/components/editor/WorkflowNameControl.svelte +9 -8
- package/dist/components/editor/WorkflowNameControl.svelte.d.ts +3 -1
- package/dist/components/list/WorkflowList.svelte +43 -41
- package/dist/components/list/WorkflowList.svelte.d.ts +5 -0
- package/dist/components/panel/CompositionForm.svelte +3 -2
- package/dist/components/panel/CompositionPicker.svelte +25 -23
- package/dist/components/panel/CompositionPicker.svelte.d.ts +2 -2
- package/dist/components/panel/CompositionSelect.svelte +4 -4
- package/dist/components/panel/CompositionSelect.svelte.d.ts +2 -2
- package/dist/components/ui/ErrorState.svelte +43 -0
- package/dist/components/ui/ErrorState.svelte.d.ts +13 -0
- package/dist/components/ui/icons.d.ts +8 -0
- package/dist/components/ui/icons.js +24 -1
- package/dist/editor/apiErrorText.d.ts +2 -0
- package/dist/editor/apiErrorText.js +15 -0
- package/dist/editor/autoLayout.d.ts +38 -0
- package/dist/editor/autoLayout.js +403 -0
- package/dist/editor/blockClipboard.svelte.d.ts +9 -0
- package/dist/editor/blockClipboard.svelte.js +24 -0
- package/dist/editor/blockCopy.d.ts +39 -0
- package/dist/editor/blockCopy.js +137 -0
- package/dist/editor/canvasMenu.d.ts +45 -0
- package/dist/editor/canvasMenu.js +68 -0
- package/dist/editor/connectionSnap.d.ts +90 -0
- package/dist/editor/connectionSnap.js +98 -0
- package/dist/editor/editorState.svelte.d.ts +122 -13
- package/dist/editor/editorState.svelte.js +262 -22
- package/dist/editor/graphIssues.d.ts +5 -0
- package/dist/editor/graphIssues.js +18 -0
- package/dist/editor/graphModel.d.ts +6 -1
- package/dist/editor/graphModel.js +8 -1
- package/dist/editor/keyHints.d.ts +21 -0
- package/dist/editor/keyHints.js +30 -0
- package/dist/editor/listState.svelte.d.ts +4 -4
- package/dist/editor/listState.svelte.js +3 -1
- package/dist/editor/staleGuard.d.ts +111 -0
- package/dist/editor/staleGuard.js +279 -0
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +85 -1
- package/dist/i18n/messages.js +99 -4
- package/dist/index.d.ts +1 -0
- package/dist/types/index.d.ts +19 -2
- package/package.json +10 -10
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
const editor = useEditorState();
|
|
43
43
|
const { t } = useWorkflowsLanguage();
|
|
44
44
|
|
|
45
|
+
let isRenamingTitle = $state(false);
|
|
46
|
+
|
|
45
47
|
const SAVE_STATE_KEYS = {
|
|
46
48
|
saved: 'workflows.save.saved',
|
|
47
49
|
pending: 'workflows.save.pending',
|
|
@@ -84,6 +86,15 @@
|
|
|
84
86
|
|
|
85
87
|
const moreMenuGroups = $derived.by((): readonly MenuGroup[] => {
|
|
86
88
|
const items: MenuItem[] = [];
|
|
89
|
+
if (assistantEnabled && onToggleAssistant) {
|
|
90
|
+
items.push({
|
|
91
|
+
key: 'assistant',
|
|
92
|
+
label: $t('workflows.assistant.toolbarButton'),
|
|
93
|
+
icon: 'chat',
|
|
94
|
+
disabled: editor.tab !== 'editor',
|
|
95
|
+
onSelect: onToggleAssistant
|
|
96
|
+
});
|
|
97
|
+
}
|
|
87
98
|
items.push({
|
|
88
99
|
key: 'test',
|
|
89
100
|
label: $t('workflows.top.testRun'),
|
|
@@ -122,9 +133,8 @@
|
|
|
122
133
|
data-workflows-editor-top-bar
|
|
123
134
|
>
|
|
124
135
|
<div class="flex w-full min-w-0 flex-wrap items-center gap-3 @3xl:flex-nowrap @3xl:gap-4">
|
|
125
|
-
<!-- Narrow: back, name (flex-1), status, more menu -->
|
|
126
136
|
<div
|
|
127
|
-
class="flex min-w-0 w-full flex-1 items-center gap-3 @3xl:w-auto @3xl:max-w-none @3xl:flex-
|
|
137
|
+
class="flex min-w-0 w-full flex-1 items-center gap-3 @3xl:w-auto @3xl:max-w-none @3xl:flex-1"
|
|
128
138
|
>
|
|
129
139
|
<IconButton
|
|
130
140
|
variant={dsIconButtonVariant('ghost')}
|
|
@@ -135,17 +145,34 @@
|
|
|
135
145
|
>
|
|
136
146
|
<Icon name="back" class="size-4 rtl:rotate-180" />
|
|
137
147
|
</IconButton>
|
|
138
|
-
<div class="min-w-0
|
|
148
|
+
<div class="flex min-w-0 flex-1 items-center gap-1.5" data-workflows-editor-title-group>
|
|
139
149
|
<WorkflowNameControl
|
|
140
150
|
name={editor.name}
|
|
141
151
|
label={$t('workflows.top.renameLabel')}
|
|
142
152
|
readonly={editor.isReadOnly}
|
|
143
153
|
maxlength={MAX_WORKFLOW_NAME_LENGTH}
|
|
154
|
+
bind:isEditing={isRenamingTitle}
|
|
144
155
|
oncommit={(name) => editor.setName(name)}
|
|
145
156
|
/>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
<div class="flex shrink-0 items-center gap-1.5" data-workflows-editor-status>
|
|
158
|
+
<StatusBadge status={editor.status} />
|
|
159
|
+
</div>
|
|
160
|
+
<div
|
|
161
|
+
class="hidden min-w-0 shrink-0 items-center gap-1.5 @3xl:flex"
|
|
162
|
+
data-workflows-editor-save
|
|
163
|
+
>
|
|
164
|
+
<Icon
|
|
165
|
+
name={saveIcon}
|
|
166
|
+
class="size-4 shrink-0 {saveIcon === 'loader'
|
|
167
|
+
? 'motion-safe:animate-spin'
|
|
168
|
+
: ''} {saveCaptionClass}"
|
|
169
|
+
/>
|
|
170
|
+
<span
|
|
171
|
+
class="text-caption whitespace-nowrap {saveCaptionClass}"
|
|
172
|
+
role="status"
|
|
173
|
+
aria-live="polite">{$t(SAVE_STATE_KEYS[editor.saveState])}</span
|
|
174
|
+
>
|
|
175
|
+
</div>
|
|
149
176
|
</div>
|
|
150
177
|
<div class="ms-auto flex items-center @3xl:hidden">
|
|
151
178
|
<Menu
|
|
@@ -160,44 +187,9 @@
|
|
|
160
187
|
</div>
|
|
161
188
|
</div>
|
|
162
189
|
|
|
163
|
-
<!-- Desktop: status column -->
|
|
164
|
-
<div
|
|
165
|
-
class="hidden min-w-0 flex-col gap-1 @3xl:flex @3xl:w-auto @3xl:shrink-0"
|
|
166
|
-
data-workflows-editor-status-desktop
|
|
167
|
-
>
|
|
168
|
-
<StatusBadge status={editor.status} />
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div
|
|
172
|
-
class="hidden w-full min-w-0 items-center gap-1.5 @3xl:flex @3xl:w-auto @3xl:shrink-0"
|
|
173
|
-
data-workflows-editor-save
|
|
174
|
-
>
|
|
175
|
-
<Icon
|
|
176
|
-
name={saveIcon}
|
|
177
|
-
class="size-4 shrink-0 {saveIcon === 'loader'
|
|
178
|
-
? 'motion-safe:animate-spin'
|
|
179
|
-
: ''} {saveCaptionClass}"
|
|
180
|
-
/>
|
|
181
|
-
<span class="text-caption {saveCaptionClass}" role="status" aria-live="polite"
|
|
182
|
-
>{$t(SAVE_STATE_KEYS[editor.saveState])}</span
|
|
183
|
-
>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
190
|
<div class="hidden min-w-0 flex-1 @3xl:block"></div>
|
|
187
191
|
|
|
188
192
|
<div class="hidden w-full flex-wrap items-center justify-end gap-2 @3xl:flex @3xl:w-auto">
|
|
189
|
-
{#if assistantEnabled && onToggleAssistant}
|
|
190
|
-
<Button
|
|
191
|
-
variant="outline"
|
|
192
|
-
size={dsButtonSize('small')}
|
|
193
|
-
aria-pressed={assistantOpen}
|
|
194
|
-
class={assistantOpen ? 'bg-accent' : ''}
|
|
195
|
-
disabled={editor.tab !== 'editor'}
|
|
196
|
-
onclick={onToggleAssistant}
|
|
197
|
-
>
|
|
198
|
-
{$t('workflows.assistant.toolbarButton')}
|
|
199
|
-
</Button>
|
|
200
|
-
{/if}
|
|
201
193
|
<Button
|
|
202
194
|
variant="outline"
|
|
203
195
|
size={dsButtonSize('small')}
|
|
@@ -221,6 +213,21 @@
|
|
|
221
213
|
>
|
|
222
214
|
<Icon name="history" />
|
|
223
215
|
</IconButton>
|
|
216
|
+
{#if assistantEnabled && onToggleAssistant}
|
|
217
|
+
<IconButton
|
|
218
|
+
variant={dsIconButtonVariant('ghost')}
|
|
219
|
+
size={dsButtonSize('small')}
|
|
220
|
+
aria-pressed={assistantOpen}
|
|
221
|
+
class={assistantOpen ? 'bg-accent' : ''}
|
|
222
|
+
disabled={editor.tab !== 'editor'}
|
|
223
|
+
label={$t('workflows.assistant.toolbarButton')}
|
|
224
|
+
title={$t('workflows.assistant.toolbarButton')}
|
|
225
|
+
data-workflows-assistant-toggle
|
|
226
|
+
onclick={onToggleAssistant}
|
|
227
|
+
>
|
|
228
|
+
<Icon name="chat" />
|
|
229
|
+
</IconButton>
|
|
230
|
+
{/if}
|
|
224
231
|
{#if onshowembedcode && editor.workflow?.everPublished}
|
|
225
232
|
<IconButton
|
|
226
233
|
variant={dsIconButtonVariant('ghost')}
|
|
@@ -232,7 +239,11 @@
|
|
|
232
239
|
<Icon name="code" />
|
|
233
240
|
</IconButton>
|
|
234
241
|
{/if}
|
|
235
|
-
<Button
|
|
242
|
+
<Button
|
|
243
|
+
variant={dsButtonVariant('primary')}
|
|
244
|
+
disabled={!editor.canTryPublish}
|
|
245
|
+
onclick={onpublish}
|
|
246
|
+
>
|
|
236
247
|
{$t(publishLabelKey)}
|
|
237
248
|
</Button>
|
|
238
249
|
</div>
|
|
@@ -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,14 +17,14 @@
|
|
|
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';
|
|
20
|
-
import {
|
|
21
|
-
import { dsButtonVariant } from '../ui/dsButtonProps.js';
|
|
23
|
+
import { ContentRefreshOverlay } from '@widgetic/design-system/components';
|
|
22
24
|
import ConfirmDialog from '../ui/ConfirmDialog.svelte';
|
|
23
|
-
import Notice from '../ui/Notice.svelte';
|
|
24
25
|
import EditorBanners from './EditorBanners.svelte';
|
|
25
26
|
import EditorCanvasArea from './EditorCanvasArea.svelte';
|
|
27
|
+
import EditorLoadFailure from './EditorLoadFailure.svelte';
|
|
26
28
|
import EditorTabs from './EditorTabs.svelte';
|
|
27
29
|
import EditorTopBar from './EditorTopBar.svelte';
|
|
28
30
|
import RunsTab from './RunsTab.svelte';
|
|
@@ -43,6 +45,10 @@
|
|
|
43
45
|
/** Called when unsaved edits were restored from the draft journal after load. */
|
|
44
46
|
onDraftRestored?: (info: DraftRestoredInfo) => void;
|
|
45
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;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
let {
|
|
@@ -53,7 +59,9 @@
|
|
|
53
59
|
onshowembedcode,
|
|
54
60
|
presence = false,
|
|
55
61
|
onDraftRestored,
|
|
56
|
-
assistant = null
|
|
62
|
+
assistant = null,
|
|
63
|
+
assistantSeed = null,
|
|
64
|
+
onassistantseedapplied
|
|
57
65
|
}: Props = $props();
|
|
58
66
|
|
|
59
67
|
const api = useWorkflowsApi();
|
|
@@ -76,10 +84,21 @@
|
|
|
76
84
|
|
|
77
85
|
let isAskingToPublish = $state(false);
|
|
78
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.
|
|
79
88
|
let assistantPanelOpen = $state(true);
|
|
80
89
|
|
|
81
90
|
const assistantEnabled = $derived(Boolean(assistant?.enabled));
|
|
82
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
|
+
|
|
83
102
|
function toggleAssistantPanel(): void {
|
|
84
103
|
assistantPanelOpen = !assistantPanelOpen;
|
|
85
104
|
}
|
|
@@ -120,6 +139,8 @@
|
|
|
120
139
|
void editor.load();
|
|
121
140
|
// Who else is editing is asked alongside the load (it needs only the workflow's id); nothing happens without `presence`.
|
|
122
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();
|
|
123
144
|
|
|
124
145
|
// A finger cannot draw a line between two small points: on a touch screen the canvas only shows (the panel edits).
|
|
125
146
|
const touchQuery = window.matchMedia('(pointer: coarse)');
|
|
@@ -147,52 +168,55 @@
|
|
|
147
168
|
</script>
|
|
148
169
|
|
|
149
170
|
<div class="@container flex h-full min-h-0 w-full flex-col" data-workflows-editor>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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}
|
|
161
217
|
</div>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<EditorTopBar
|
|
165
|
-
onback={() => void goBack()}
|
|
166
|
-
onpublish={requestPublish}
|
|
167
|
-
onshowembedcode={showEmbedCode}
|
|
168
|
-
assistantEnabled={assistantEnabled}
|
|
169
|
-
assistantOpen={assistantPanelOpen}
|
|
170
|
-
onToggleAssistant={toggleAssistantPanel}
|
|
171
|
-
/>
|
|
172
|
-
<EditorTabs {panelId} />
|
|
173
|
-
<EditorBanners />
|
|
174
|
-
<div
|
|
175
|
-
id={panelId}
|
|
176
|
-
role="tabpanel"
|
|
177
|
-
aria-labelledby="{panelId}-tab-{editor.tab}"
|
|
178
|
-
class="flex min-h-0 flex-1 min-w-0 flex-col"
|
|
179
|
-
>
|
|
180
|
-
{#if editor.tab === 'editor'}
|
|
181
|
-
<EditorCanvasArea
|
|
182
|
-
{assistant}
|
|
183
|
-
assistantOpen={assistantPanelOpen}
|
|
184
|
-
onOpenAssistant={openAssistantPanel}
|
|
185
|
-
workflowId={workflowId}
|
|
186
|
-
/>
|
|
187
|
-
{:else if editor.tab === 'runs'}
|
|
188
|
-
<RunsTab />
|
|
189
|
-
{:else}
|
|
190
|
-
<div class="min-h-0 flex-1 overflow-auto">
|
|
191
|
-
<SettingsTab onshowembedcode={showEmbedCode} />
|
|
192
|
-
</div>
|
|
193
|
-
{/if}
|
|
194
|
-
</div>
|
|
195
|
-
{/if}
|
|
218
|
+
{/if}
|
|
219
|
+
</ContentRefreshOverlay>
|
|
196
220
|
</div>
|
|
197
221
|
|
|
198
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
|
|
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-
|
|
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
|
|
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;
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
import WorkflowsHeader from '../WorkflowsHeader.svelte';
|
|
31
31
|
import { Button, IconButton } from '@widgetic/design-system/components';
|
|
32
32
|
import { dsButtonSize, dsButtonVariant, dsIconButtonVariant } from '../ui/dsButtonProps.js';
|
|
33
|
+
import ErrorState from '../ui/ErrorState.svelte';
|
|
33
34
|
import Icon from '../ui/Icon.svelte';
|
|
34
35
|
import Notice from '../ui/Notice.svelte';
|
|
35
36
|
import SelectField from '../ui/SelectField.svelte';
|
|
36
37
|
import Tabs from '../ui/Tabs.svelte';
|
|
37
|
-
import
|
|
38
|
+
import { SearchInput } from '@widgetic/design-system/components';
|
|
38
39
|
import type { SelectChoice } from '../ui/types.js';
|
|
39
40
|
import WorkflowRow from './WorkflowRow.svelte';
|
|
40
41
|
|
|
@@ -54,6 +55,11 @@
|
|
|
54
55
|
presence?: boolean;
|
|
55
56
|
/** From Dexie via the host layout load — default list paints before `load()` runs. */
|
|
56
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;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
let {
|
|
@@ -62,7 +68,8 @@
|
|
|
62
68
|
onerror,
|
|
63
69
|
onshowembedcode,
|
|
64
70
|
presence = false,
|
|
65
|
-
initialListPage = null
|
|
71
|
+
initialListPage = null,
|
|
72
|
+
recentSearchesKey = ''
|
|
66
73
|
}: Props = $props();
|
|
67
74
|
|
|
68
75
|
const api = useWorkflowsApi();
|
|
@@ -165,16 +172,20 @@
|
|
|
165
172
|
<WorkflowsHeader class="min-w-0 shrink" />
|
|
166
173
|
{#if !isLibraryEmpty}
|
|
167
174
|
<div class="flex min-w-0 shrink-0 items-center gap-2">
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
type="search"
|
|
171
|
-
variant="soft"
|
|
172
|
-
icon="search"
|
|
173
|
-
label={$t('workflows.list.searchLabel')}
|
|
174
|
-
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
175
|
-
hideLabel
|
|
175
|
+
<SearchInput
|
|
176
|
+
containerClass="w-60 shrink-0"
|
|
176
177
|
bind:value={searchDraft}
|
|
177
|
-
|
|
178
|
+
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
179
|
+
clearLabel={$t('workflows.list.clearSearch')}
|
|
180
|
+
inputAttributes={{ 'aria-label': $t('workflows.list.searchLabel') }}
|
|
181
|
+
{recentSearchesKey}
|
|
182
|
+
recentSearchesLabel={$t('workflows.list.recentSearches')}
|
|
183
|
+
clearRecentSearchesLabel={$t('workflows.list.clearRecentSearches')}
|
|
184
|
+
onInput={() => list.setSearch(searchDraft)}
|
|
185
|
+
onClear={() => {
|
|
186
|
+
searchDraft = '';
|
|
187
|
+
list.setSearch('');
|
|
188
|
+
}}
|
|
178
189
|
/>
|
|
179
190
|
<!-- The design draws this button outlined while the list could not be read (the error state has the main action). -->
|
|
180
191
|
<Button
|
|
@@ -216,16 +227,20 @@
|
|
|
216
227
|
{/if}
|
|
217
228
|
</div>
|
|
218
229
|
{#if !isLibraryEmpty}
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
type="search"
|
|
222
|
-
variant="soft"
|
|
223
|
-
icon="search"
|
|
224
|
-
label={$t('workflows.list.searchLabel')}
|
|
225
|
-
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
226
|
-
hideLabel
|
|
230
|
+
<SearchInput
|
|
231
|
+
containerClass="w-full min-w-0"
|
|
227
232
|
bind:value={searchDraft}
|
|
228
|
-
|
|
233
|
+
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
234
|
+
clearLabel={$t('workflows.list.clearSearch')}
|
|
235
|
+
inputAttributes={{ 'aria-label': $t('workflows.list.searchLabel') }}
|
|
236
|
+
{recentSearchesKey}
|
|
237
|
+
recentSearchesLabel={$t('workflows.list.recentSearches')}
|
|
238
|
+
clearRecentSearchesLabel={$t('workflows.list.clearRecentSearches')}
|
|
239
|
+
onInput={() => list.setSearch(searchDraft)}
|
|
240
|
+
onClear={() => {
|
|
241
|
+
searchDraft = '';
|
|
242
|
+
list.setSearch('');
|
|
243
|
+
}}
|
|
229
244
|
/>
|
|
230
245
|
{/if}
|
|
231
246
|
</div>
|
|
@@ -346,30 +361,17 @@
|
|
|
346
361
|
<p class="sr-only">{$t('workflows.common.loading')}</p>
|
|
347
362
|
{:else if list.loadState === 'failed'}
|
|
348
363
|
<!-- Figma "Error": a centred state with the alert tile, what happened, and the one way on. -->
|
|
349
|
-
<
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
<
|
|
355
|
-
<Icon name="warning" class="size-4 text-destructive" />
|
|
356
|
-
</div>
|
|
357
|
-
<div class="flex w-full flex-col gap-1">
|
|
358
|
-
<h2 class="text-heading-section text-foreground">{$t('workflows.error.title')}</h2>
|
|
359
|
-
<p class="text-body text-muted-foreground">
|
|
360
|
-
{$t(list.failure ?? 'workflows.error.generic')}
|
|
361
|
-
</p>
|
|
362
|
-
</div>
|
|
363
|
-
<Button
|
|
364
|
-
class="mt-3"
|
|
365
|
-
variant={dsButtonVariant('primary')}
|
|
366
|
-
onclick={() => void list.load()}
|
|
367
|
-
>
|
|
364
|
+
<ErrorState
|
|
365
|
+
title={$t('workflows.error.title')}
|
|
366
|
+
description={$t(list.failure ?? 'workflows.error.generic')}
|
|
367
|
+
>
|
|
368
|
+
{#snippet actions()}
|
|
369
|
+
<Button variant={dsButtonVariant('primary')} onclick={() => void list.load()}>
|
|
368
370
|
<Icon name="refresh" class="size-4" />
|
|
369
371
|
{$t('workflows.error.retry')}
|
|
370
372
|
</Button>
|
|
371
|
-
|
|
372
|
-
</
|
|
373
|
+
{/snippet}
|
|
374
|
+
</ErrorState>
|
|
373
375
|
{:else if list.items.length === 0}
|
|
374
376
|
{#if list.isNarrowed}
|
|
375
377
|
<!-- Figma "No matches": the same centred state as an empty list, with a search tile and the one line. -->
|
|
@@ -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
|
-
|
|
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
|
-
|
|
77
|
+
usedIds={otherCompositionIds}
|
|
77
78
|
onpick={chooseComposition}
|
|
78
79
|
onread={(options) => editor.rememberCompositions(options)}
|
|
79
80
|
/>
|