@widgetic/workflows 0.2.10 → 0.2.12

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 (75) hide show
  1. package/README.md +11 -13
  2. package/dist/api/workflowsApi.d.ts +9 -1
  3. package/dist/api/workflowsApi.js +2 -1
  4. package/dist/assistant/assistantEvents.d.ts +42 -0
  5. package/dist/assistant/assistantEvents.js +61 -0
  6. package/dist/assistant/assistantRemoteChange.d.ts +4 -0
  7. package/dist/assistant/assistantRemoteChange.js +8 -0
  8. package/dist/assistant/assistantSaveMode.d.ts +5 -0
  9. package/dist/assistant/assistantSaveMode.js +8 -0
  10. package/dist/assistant/assistantStream.d.ts +8 -0
  11. package/dist/assistant/assistantStream.js +140 -0
  12. package/dist/assistant/assistantTranscript.d.ts +11 -0
  13. package/dist/assistant/assistantTranscript.js +18 -0
  14. package/dist/assistant/types.d.ts +81 -0
  15. package/dist/assistant/types.js +1 -0
  16. package/dist/assistant/workflowPlanViewModel.d.ts +48 -0
  17. package/dist/assistant/workflowPlanViewModel.js +17 -0
  18. package/dist/components/Workflows.svelte +3 -1
  19. package/dist/components/WorkflowsEmptyState.svelte +15 -3
  20. package/dist/components/WorkflowsEmptyState.svelte.d.ts +2 -0
  21. package/dist/components/WorkflowsWorkspace.svelte +4 -0
  22. package/dist/components/WorkflowsWorkspace.svelte.d.ts +1 -0
  23. package/dist/components/assistant/WorkflowAssistantPanel.svelte +384 -0
  24. package/dist/components/assistant/WorkflowAssistantPanel.svelte.d.ts +8 -0
  25. package/dist/components/canvas/CompositionNodeView.svelte +5 -5
  26. package/dist/components/canvas/ConditionNodeView.svelte +4 -4
  27. package/dist/components/canvas/HandlePoint.svelte +1 -1
  28. package/dist/components/canvas/TriggerNodeView.svelte +5 -4
  29. package/dist/components/canvas/WorkflowCanvas.svelte +16 -6
  30. package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +2 -2
  31. package/dist/components/editor/EditorCanvasArea.svelte +57 -2
  32. package/dist/components/editor/EditorCanvasArea.svelte.d.ts +8 -1
  33. package/dist/components/editor/EditorTabs.svelte +1 -2
  34. package/dist/components/editor/EditorTopBar.svelte +29 -21
  35. package/dist/components/editor/EditorTopBar.svelte.d.ts +3 -0
  36. package/dist/components/editor/RunsFlow.svelte +73 -23
  37. package/dist/components/editor/WorkflowEditor.svelte +31 -3
  38. package/dist/components/editor/WorkflowEditor.svelte.d.ts +5 -0
  39. package/dist/components/editor/WorkflowNameControl.svelte +136 -0
  40. package/dist/components/editor/WorkflowNameControl.svelte.d.ts +13 -0
  41. package/dist/components/list/WorkflowList.svelte +112 -60
  42. package/dist/components/list/WorkflowList.svelte.d.ts +2 -0
  43. package/dist/components/list/WorkflowRow.svelte +2 -0
  44. package/dist/components/panel/ConditionForm.svelte +7 -7
  45. package/dist/components/ui/Menu.svelte +31 -7
  46. package/dist/components/ui/Menu.svelte.d.ts +4 -0
  47. package/dist/components/ui/icons.d.ts +2 -0
  48. package/dist/components/ui/icons.js +3 -1
  49. package/dist/drafts/draftJournal.d.ts +59 -0
  50. package/dist/drafts/draftJournal.js +261 -0
  51. package/dist/drafts/workflowDraft.d.ts +72 -0
  52. package/dist/drafts/workflowDraft.js +151 -0
  53. package/dist/drafts/workflowListViewState.d.ts +30 -0
  54. package/dist/drafts/workflowListViewState.js +92 -0
  55. package/dist/editor/createBlankWorkflow.d.ts +30 -0
  56. package/dist/editor/createBlankWorkflow.js +37 -0
  57. package/dist/editor/editorState.svelte.d.ts +68 -2
  58. package/dist/editor/editorState.svelte.js +273 -0
  59. package/dist/editor/listState.svelte.d.ts +73 -36
  60. package/dist/editor/listState.svelte.js +260 -46
  61. package/dist/editor/presetChoice.d.ts +4 -4
  62. package/dist/editor/presetChoice.js +4 -4
  63. package/dist/editor/runsFlowBandLabel.d.ts +16 -0
  64. package/dist/editor/runsFlowBandLabel.js +34 -0
  65. package/dist/editor/runsFlowLayout.d.ts +24 -9
  66. package/dist/editor/runsFlowLayout.js +73 -28
  67. package/dist/editor/workflowNameCommit.d.ts +12 -0
  68. package/dist/editor/workflowNameCommit.js +11 -0
  69. package/dist/i18n/language.d.ts +3 -3
  70. package/dist/i18n/messages.d.ts +40 -26
  71. package/dist/i18n/messages.js +43 -30
  72. package/dist/types/index.d.ts +4 -0
  73. package/package.json +8 -1
  74. package/dist/components/list/CreateWorkflowDialog.svelte +0 -262
  75. package/dist/components/list/CreateWorkflowDialog.svelte.d.ts +0 -9
@@ -58,11 +58,9 @@ export const WORKFLOWS_MESSAGES = {
58
58
  'workflows.list.searchLabel': 'Search workflows',
59
59
  'workflows.list.searchPlaceholder': 'Search by name',
60
60
  'workflows.list.filterLabel': 'Show',
61
- 'workflows.list.filterActive': 'Not archived',
62
- 'workflows.list.filterAll': 'All workflows',
63
- /** The menu next to the tabs that narrows the list to one state; its lines are the states and "Any". */
61
+ 'workflows.list.filterAll': 'All',
62
+ /** On a narrow screen, the select that picks the same status tabs as on a wide screen. */
64
63
  'workflows.list.statusLabel': 'Status',
65
- 'workflows.list.statusAny': 'Any',
66
64
  'workflows.list.sortLabel': 'Sort by',
67
65
  'workflows.list.sortCreated': 'Date created',
68
66
  'workflows.list.sortPublished': 'Last published',
@@ -85,31 +83,8 @@ export const WORKFLOWS_MESSAGES = {
85
83
  'workflows.list.editingNamed': '{name} is editing',
86
84
  /** The same badge when the API gave no name for the teammate. */
87
85
  'workflows.list.editingSomeone': 'Someone is editing',
88
- // ===== Making a workflow =====
89
- 'workflows.create.title': 'New workflow',
90
- 'workflows.create.nameLabel': 'Name',
91
- 'workflows.create.namePlaceholder': 'For example, Welcome offer',
92
- 'workflows.create.compositionLabel': 'First composition',
93
- 'workflows.create.compositionHelp': 'The composition visitors see first. You can also choose or change it in the editor.',
86
+ /** Placeholder while a composition is chosen in the side panel. */
94
87
  'workflows.create.compositionPlaceholder': 'Choose a composition',
95
- 'workflows.create.create': 'Create workflow',
96
- 'workflows.create.creating': 'Creating…',
97
- // ----- Starting from a preset: the choices above the name, when the workspace is offered any -----
98
- /** The name of the group of choices: a blank workflow, or one of the presets. */
99
- 'workflows.create.startLabel': 'Start from',
100
- 'workflows.create.blankTitle': 'Blank workflow',
101
- 'workflows.create.blankHint': 'An empty workflow. You choose the first composition yourself.',
102
- /** Under a preset's title, how big it is and what it shows; `blocks` are its blocks and `widgets` the widgets it uses. */
103
- 'workflows.create.presetSummary': '{blocks, plural, one {# block} other {# blocks}} · {widgets, plural, one {# widget} other {# widgets}}',
104
- /** On the picture strip of a preset that shows more widgets than there is room for; `count` is the ones not drawn. */
105
- 'workflows.create.presetMorePictures': '+{count}',
106
- 'workflows.create.presetsLoading': 'Looking for presets…',
107
- 'workflows.create.presetsFailed': 'The presets could not be loaded. You can still start from a blank workflow.',
108
- /** What a preset gives, said once the person has chosen one. */
109
- 'workflows.create.presetHelp': 'You get your own copy of the widgets in this preset and a draft workflow that connects them. Nothing you change here reaches the preset.',
110
- 'workflows.create.presetNameHelp': 'Leave this empty to name the workflow after the preset.',
111
- /** While a preset is being copied, which takes a few seconds. */
112
- 'workflows.create.settingUp': 'Setting up your copy. This can take a few seconds.',
113
88
  // ===== Where a workflow stands =====
114
89
  'workflows.status.draft': 'Draft',
115
90
  'workflows.status.live': 'Live',
@@ -118,7 +93,8 @@ export const WORKFLOWS_MESSAGES = {
118
93
  'workflows.status.unpublishedChanges': 'Unpublished changes',
119
94
  // ===== The top of the editor =====
120
95
  'workflows.top.back': 'Back to workflows',
121
- 'workflows.top.nameLabel': 'Workflow name',
96
+ /** What a screen reader hears for the name control in the header (click to rename). */
97
+ 'workflows.top.renameLabel': 'Rename workflow',
122
98
  'workflows.top.testRun': 'Test run',
123
99
  'workflows.top.history': 'Version history',
124
100
  'workflows.top.embedCode': 'Embed code',
@@ -439,6 +415,10 @@ export const WORKFLOWS_MESSAGES = {
439
415
  /** Under a composition that visitors reached and did not all go on from: how many stopped there. */
440
416
  'workflows.runs.stayed': '{count} did not go on',
441
417
  'workflows.runs.failed': '{count} could not be shown',
418
+ /** Short words on the chart beside the hollow part of a bar. */
419
+ 'workflows.runs.chartStayed': '{count} stayed',
420
+ /** Short words on the chart beside the red failed part under a bar. */
421
+ 'workflows.runs.chartFailed': '{count} failed',
442
422
  /**
443
423
  * Under "could not be shown", why: one line for each reason the embeds told (only when at least one did). Each reads after a
444
424
  * number, as a short phrase that is right for one and for many, like the lines above it.
@@ -529,5 +509,38 @@ export const WORKFLOWS_MESSAGES = {
529
509
  'workflows.issue.testBadField': 'A test of {block} reads a value its trigger does not carry.',
530
510
  'workflows.issue.testBadOperator': 'A test of {block} uses a comparison that does not fit its value.',
531
511
  'workflows.issue.testMissingValue': 'A test of {block} needs a value to compare with.',
532
- 'workflows.issue.fieldUnknown': 'A test of {block} reads {field}, which the composition no longer has.'
512
+ 'workflows.issue.fieldUnknown': 'A test of {block} reads {field}, which the composition no longer has.',
513
+ // ===== Workflows assistant (editor side panel) =====
514
+ 'workflows.assistant.title': 'Assistant',
515
+ 'workflows.assistant.newChat': 'New chat',
516
+ 'workflows.assistant.open': 'Open',
517
+ 'workflows.assistant.collapse': 'Collapse',
518
+ 'workflows.assistant.welcome': 'I can plan a workflow with you. Tell me what you want to build.',
519
+ 'workflows.assistant.emptyCanvas': 'Describe what you want to build, or ask for ideas.',
520
+ 'workflows.assistant.openAssistant': 'Open assistant',
521
+ 'workflows.assistant.toolbarButton': 'Assistant',
522
+ 'workflows.assistant.planNote': 'If this canvas is empty, we fill this workflow. If it already has blocks, we create a new workflow and leave this one as-is.',
523
+ 'workflows.assistant.chipIdeas': 'Give me ideas',
524
+ 'workflows.assistant.chipLeads': 'Capture leads',
525
+ 'workflows.assistant.submit': 'Submit',
526
+ 'workflows.assistant.estimate': 'About {number} credits',
527
+ 'workflows.assistant.createWorkflow': 'Create workflow',
528
+ 'workflows.assistant.notNow': 'Not now',
529
+ 'workflows.assistant.ready': 'Your workflow is ready.',
530
+ 'workflows.assistant.createdNew': 'I created a new workflow so your current one stays untouched.',
531
+ 'workflows.assistant.openInEditor': 'Open in editor',
532
+ 'workflows.assistant.attachFiles': 'Attach files',
533
+ 'workflows.assistant.libraryHint': 'Attached files are saved to your file library.',
534
+ 'workflows.assistant.composerPlaceholder': 'Describe the workflow you want',
535
+ 'workflows.assistant.send': 'Send',
536
+ 'workflows.assistant.answerSent': 'My answer',
537
+ 'workflows.assistant.stepWaiting': 'Waiting',
538
+ 'workflows.assistant.stepCreating': 'Creating',
539
+ 'workflows.assistant.stepDone': 'Done',
540
+ 'workflows.assistant.stepFailed': 'Failed',
541
+ 'workflows.assistant.retry': 'Retry',
542
+ 'workflows.assistant.retryMessage': 'Some steps did not finish. Please plan this again and reuse what was already built.',
543
+ 'workflows.assistant.buildNote': 'New widgets take a few minutes to build. Keep this panel open until the workflow is ready.',
544
+ 'workflows.assistant.errorRateLimited': 'That was a lot of messages at once. Try again in a minute.',
545
+ 'workflows.assistant.errorNotAvailable': 'The assistant is not available right now.'
533
546
  };
@@ -1,5 +1,7 @@
1
1
  import type { TextDirection } from '@widgetic/design-system/i18n';
2
2
  import type { AccessTokenFunction } from '../api/types.js';
3
+ import type { WorkflowAssistantConfig } from '../assistant/types.js';
4
+ export type { WorkflowAssistantConfig } from '../assistant/types.js';
3
5
  /** Why `onError` was called. */
4
6
  export type WorkflowsErrorCode =
5
7
  /** A part of the screen threw while it was being drawn. The screen shows "Try again" in its place. */
@@ -75,6 +77,8 @@ export interface WorkflowsProps {
75
77
  class?: string;
76
78
  /** Called when something goes wrong, once for each failure. See {@link WorkflowsError}. */
77
79
  onError?: (error: WorkflowsError) => void;
80
+ /** Optional workflows assistant endpoints and upload wiring; omitted disables the panel. */
81
+ assistant?: WorkflowAssistantConfig | null;
78
82
  /** For tests and previews: the `fetch` the screen asks the API with. The page's own `fetch` when left out. */
79
83
  fetchImplementation?: typeof fetch;
80
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/workflows",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Workflows for Widgetic: chain compositions together with filters that decide which composition an embed shows. One Svelte package that the Widgetic site, partners and Shopify all load.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -55,9 +55,15 @@
55
55
  "kaykay": "0.3.0"
56
56
  },
57
57
  "peerDependencies": {
58
+ "@widgetic/chat": ">=0.1.36",
58
59
  "@widgetic/design-system": ">=0.5.23",
59
60
  "svelte": "^5.25.6"
60
61
  },
62
+ "peerDependenciesMeta": {
63
+ "@widgetic/chat": {
64
+ "optional": true
65
+ }
66
+ },
61
67
  "devDependencies": {
62
68
  "@eslint/js": "^9.0.0",
63
69
  "@sveltejs/adapter-auto": "^3.0.0",
@@ -66,6 +72,7 @@
66
72
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
67
73
  "@tailwindcss/postcss": "^4.1.4",
68
74
  "@types/node": "^26.4.1",
75
+ "@widgetic/chat": "^0.1.36",
69
76
  "@widgetic/design-system": "^0.5.23",
70
77
  "@widgetic/dev-tools": "^0.3.7",
71
78
  "eslint": "^9.0.0",
@@ -1,262 +0,0 @@
1
- <!--
2
- "New workflow": a name, and where to start from. Making it opens the editor straight away.
3
-
4
- Where to start from is one of two things:
5
- - a blank workflow: the composition visitors see first is chosen here (optional: it can be chosen in the editor), and it is
6
- put on the canvas as the start;
7
- - a preset: a workflow that Widgetic (or the partner whose customer this is) offers. It gives the person their own copy of
8
- the widgets it chains and a draft workflow wired like it, so the composition is not chosen here and the name may be left
9
- empty (the workflow is named after the preset).
10
-
11
- The presets are asked for when the dialog opens. While they are on the way the blank start is shown with a line that says so;
12
- a workspace that is offered none (most are) then sees the dialog as it always was: the choices stay only when there is a
13
- preset to choose, and when the presets cannot be read the dialog says so and the blank start keeps working. The name is the
14
- only thing a blank start requires, so the dialog never asks for what it could do without.
15
- -->
16
- <script lang="ts">
17
- import { onMount } from 'svelte';
18
- import { MAX_WORKFLOW_NAME_LENGTH } from '../../api/types.js';
19
- import type { CompositionOption, WorkflowDetail } from '../../api/types.js';
20
- import { useListState } from '../../editor/listState.svelte.js';
21
- import { canStartNow, chosenPresetOf, picturesOf } from '../../editor/presetChoice.js';
22
- import { useWorkflowsLanguage } from '../../i18n/language.js';
23
- import CompositionSelect from '../panel/CompositionSelect.svelte';
24
- import { Button, IconButton } from '@widgetic/design-system/components';
25
- import { dsButtonSize, dsButtonVariant, dsIconButtonVariant } from '../ui/dsButtonProps.js';
26
- import Icon from '../ui/Icon.svelte';
27
- import Modal from '../ui/Modal.svelte';
28
- import Notice from '../ui/Notice.svelte';
29
- import TextField from '../ui/TextField.svelte';
30
-
31
- interface Props {
32
- oncancel: () => void;
33
- /** The workflow was made; the screen opens it. */
34
- oncreated: (created: WorkflowDetail) => void;
35
- }
36
-
37
- let { oncancel, oncreated }: Props = $props();
38
-
39
- const list = useListState();
40
- const { t } = useWorkflowsLanguage();
41
- const groupId = $props.id();
42
-
43
- let name = $state('');
44
- let chosen = $state.raw<CompositionOption | null>(null);
45
- let isCreating = $state(false);
46
-
47
- /** The preset that is chosen and still on offer; `null` is a blank start (also when the one chosen went from the list). */
48
- const chosenPreset = $derived(chosenPresetOf(list.presets, list.chosenPresetKey));
49
- const canCreate = $derived(canStartNow({ preset: chosenPreset, name, isBusy: isCreating }));
50
-
51
- async function create(): Promise<void> {
52
- if (!canCreate) return;
53
- isCreating = true;
54
- try {
55
- const created = chosenPreset
56
- ? await list.startFromPreset({ key: chosenPreset.key, name })
57
- : await list.create({ name: name.trim(), composition: chosen });
58
- if (created) oncreated(created);
59
- } finally {
60
- isCreating = false;
61
- }
62
- }
63
-
64
- /** Enter in the name box makes the workflow, as the button does. */
65
- function handleKeydown(event: KeyboardEvent): void {
66
- if (
67
- event.key === 'Enter' &&
68
- event.target instanceof HTMLInputElement &&
69
- event.target.type === 'text'
70
- ) {
71
- event.preventDefault();
72
- void create();
73
- }
74
- }
75
-
76
- onMount(() => {
77
- // Every opening starts blank, whatever the last one chose.
78
- list.chosenPresetKey = null;
79
- void list.loadPresets();
80
- });
81
- </script>
82
-
83
- <Modal title={$t('workflows.create.title')} size="large" busy={isCreating} onclose={oncancel}>
84
- <!-- svelte-ignore a11y_no_static_element_interactions -->
85
- <div class="flex flex-col gap-4" onkeydown={handleKeydown}>
86
- <!-- While the presets are being asked for, the blank start is already there (it works without them) and the line below says what is going on. -->
87
- {#if list.presets.length > 0 || list.presetsState === 'loading'}
88
- <fieldset class="flex min-w-0 flex-col gap-3" disabled={isCreating}>
89
- <legend class="text-body-medium text-foreground">{$t('workflows.create.startLabel')}</legend
90
- >
91
- <div class="flex max-h-72 flex-col gap-2 overflow-auto">
92
- <label class="flex cursor-pointer">
93
- <input
94
- type="radio"
95
- name="{groupId}-start"
96
- class="peer sr-only"
97
- checked={chosenPreset === null}
98
- onchange={() => (list.chosenPresetKey = null)}
99
- />
100
- <span
101
- class="flex w-full items-start gap-3 rounded-lg border bg-background px-3 py-3 text-start transition-colors duration-fast peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background {chosenPreset ===
102
- null
103
- ? 'border-primary ring-1 ring-inset ring-primary'
104
- : 'border-border hover:bg-accent'}"
105
- >
106
- <span
107
- class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border-2 {chosenPreset ===
108
- null
109
- ? 'border-primary bg-primary'
110
- : 'border-muted-foreground'}"
111
- aria-hidden="true"
112
- >
113
- {#if chosenPreset === null}<span class="size-1.5 rounded-full bg-primary-foreground"
114
- ></span>{/if}
115
- </span>
116
- <span class="flex min-w-0 flex-1 flex-col gap-0.5">
117
- <span class="text-body-medium text-foreground"
118
- >{$t('workflows.create.blankTitle')}</span
119
- >
120
- <span class="text-caption text-muted-foreground"
121
- >{$t('workflows.create.blankHint')}</span
122
- >
123
- </span>
124
- </span>
125
- </label>
126
- {#each list.presets as preset (preset.key)}
127
- {@const pictures = picturesOf(preset)}
128
- {@const isChosen = chosenPreset?.key === preset.key}
129
- <label class="flex cursor-pointer">
130
- <input
131
- type="radio"
132
- name="{groupId}-start"
133
- class="peer sr-only"
134
- checked={isChosen}
135
- onchange={() => (list.chosenPresetKey = preset.key)}
136
- />
137
- <span
138
- class="flex w-full items-start gap-3 rounded-lg border bg-background px-3 py-3 text-start transition-colors duration-fast peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background {isChosen
139
- ? 'border-primary ring-1 ring-inset ring-primary'
140
- : 'border-border hover:bg-accent'}"
141
- >
142
- <span
143
- class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border-2 {isChosen
144
- ? 'border-primary bg-primary'
145
- : 'border-muted-foreground'}"
146
- aria-hidden="true"
147
- >
148
- {#if isChosen}<span class="size-1.5 rounded-full bg-primary-foreground"
149
- ></span>{/if}
150
- </span>
151
- <span class="flex min-w-0 flex-1 flex-col gap-2">
152
- {#if pictures.shown.some((widget) => widget.thumbnailUrl)}
153
- <div class="flex shrink-0 flex-wrap items-center gap-1 pt-0.5">
154
- {#each pictures.shown as widget, index (index)}
155
- {#if widget.thumbnailUrl}
156
- <img
157
- src={widget.thumbnailUrl}
158
- alt=""
159
- loading="lazy"
160
- draggable="false"
161
- class="h-8 w-11 rounded-lg border border-border object-cover"
162
- />
163
- {:else}
164
- <span
165
- class="flex h-8 w-11 items-center justify-center rounded-lg border border-border text-muted-foreground"
166
- >
167
- <Icon name="composition" class="size-4" />
168
- </span>
169
- {/if}
170
- {/each}
171
- {#if pictures.hiddenCount > 0}
172
- <span class="text-caption text-muted-foreground"
173
- >{$t('workflows.create.presetMorePictures', {
174
- count: pictures.hiddenCount
175
- })}</span
176
- >
177
- {/if}
178
- </div>
179
- {/if}
180
- <span class="flex min-w-0 flex-col gap-0.5">
181
- <span class="text-body-medium text-foreground" dir="auto">{preset.title}</span>
182
- {#if preset.description}
183
- <span class="line-clamp-2 text-caption text-muted-foreground" dir="auto"
184
- >{preset.description}</span
185
- >
186
- {/if}
187
- <span class="text-caption text-muted-foreground"
188
- >{$t('workflows.create.presetSummary', {
189
- blocks: preset.blockCount,
190
- widgets: preset.widgets.length
191
- })}</span
192
- >
193
- </span>
194
- </span>
195
- </span>
196
- </label>
197
- {/each}
198
- </div>
199
- {#if list.presetsState === 'loading'}
200
- <p class="flex items-center gap-2 px-2 text-body text-muted-foreground" role="status">
201
- <Icon name="loader" class="size-4 shrink-0 motion-safe:animate-spin" />
202
- {$t('workflows.create.presetsLoading')}
203
- </p>
204
- {/if}
205
- </fieldset>
206
- {:else if list.presetsState === 'failed'}
207
- <div class="flex flex-wrap items-center gap-2">
208
- <p class="text-body text-muted-foreground" role="status">
209
- {$t('workflows.create.presetsFailed')}
210
- </p>
211
- <Button size={dsButtonSize("small")} onclick={() => void list.loadPresets()}
212
- >{$t('workflows.error.retry')}</Button>
213
- </div>
214
- {/if}
215
-
216
- <!-- With a preset chosen the note about the copy comes first (or, while it is being made, what is happening), then the name. -->
217
- {#if chosenPreset}
218
- {#if isCreating}
219
- <p class="flex items-center gap-2 text-caption text-muted-foreground" role="status">
220
- <Icon name="loader" class="size-3.5 shrink-0 motion-safe:animate-spin" />
221
- {$t('workflows.create.settingUp')}
222
- </p>
223
- {:else}
224
- <p class="text-caption text-muted-foreground">{$t('workflows.create.presetHelp')}</p>
225
- {/if}
226
- {/if}
227
-
228
- <TextField
229
- label={$t('workflows.create.nameLabel')}
230
- placeholder={chosenPreset ? chosenPreset.title : $t('workflows.create.namePlaceholder')}
231
- help={chosenPreset ? $t('workflows.create.presetNameHelp') : undefined}
232
- maxlength={MAX_WORKFLOW_NAME_LENGTH}
233
- autofocus
234
- disabled={isCreating}
235
- bind:value={name}
236
- />
237
-
238
- {#if !chosenPreset}
239
- <CompositionSelect
240
- label={$t('workflows.create.compositionLabel')}
241
- valueLabel={chosen?.name ?? null}
242
- placeholder={$t('workflows.create.compositionPlaceholder')}
243
- help={$t('workflows.create.compositionHelp')}
244
- selectedId={chosen?.id ?? null}
245
- disabled={isCreating}
246
- onpick={(option) => (chosen = chosen?.id === option.id ? null : option)}
247
- />
248
- {/if}
249
- {#if list.createFailure}
250
- <Notice tone="problem">{$t(list.createFailure)}</Notice>
251
- {/if}
252
- </div>
253
- {#snippet footer()}
254
- <Button variant={dsButtonVariant("outline")} disabled={isCreating} onclick={oncancel}>{$t('workflows.common.cancel')}</Button>
255
- <Button variant={dsButtonVariant("primary")}
256
- disabled={!canCreate || isCreating}
257
- onclick={() => void create()}
258
- >
259
- {isCreating ? $t('workflows.create.creating') : $t('workflows.create.create')}
260
- </Button>
261
- {/snippet}
262
- </Modal>
@@ -1,9 +0,0 @@
1
- import type { WorkflowDetail } from '../../api/types.js';
2
- interface Props {
3
- oncancel: () => void;
4
- /** The workflow was made; the screen opens it. */
5
- oncreated: (created: WorkflowDetail) => void;
6
- }
7
- declare const CreateWorkflowDialog: import("svelte").Component<Props, {}, "">;
8
- type CreateWorkflowDialog = ReturnType<typeof CreateWorkflowDialog>;
9
- export default CreateWorkflowDialog;