@widgetic/workflows 0.2.7 → 0.2.8
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 +49 -43
- package/dist/components/Workflows.svelte +13 -15
- package/dist/components/WorkflowsEmptyState.svelte +14 -12
- package/dist/components/WorkflowsHeader.svelte +9 -5
- package/dist/components/WorkflowsHeader.svelte.d.ts +4 -16
- package/dist/components/WorkflowsWorkspace.svelte +3 -2
- package/dist/components/canvas/AddBlockMenu.svelte +11 -2
- package/dist/components/canvas/CanvasToolbar.svelte +42 -31
- package/dist/components/canvas/CanvasToolbar.svelte.d.ts +2 -0
- package/dist/components/canvas/CompositionNodeView.svelte +58 -36
- package/dist/components/canvas/ConditionNodeView.svelte +31 -18
- package/dist/components/canvas/HandlePoint.svelte +10 -3
- package/dist/components/canvas/HandlePoint.svelte.d.ts +1 -1
- package/dist/components/canvas/TriggerNodeView.svelte +39 -13
- package/dist/components/canvas/WorkflowCanvas.svelte +22 -7
- package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +2 -0
- package/dist/components/canvas/WorkflowEdgeView.svelte +5 -6
- package/dist/components/editor/ConflictBanner.svelte +1 -1
- package/dist/components/editor/EditorBanners.svelte +11 -4
- package/dist/components/editor/EditorCanvasArea.svelte +17 -10
- package/dist/components/editor/EditorTabs.svelte +10 -44
- package/dist/components/editor/EditorTopBar.svelte +166 -54
- package/dist/components/editor/PresenceBanner.svelte +106 -85
- package/dist/components/editor/RunsFlow.svelte +100 -17
- package/dist/components/editor/RunsTab.svelte +52 -46
- package/dist/components/editor/SettingsRow.svelte +35 -0
- package/dist/components/editor/SettingsRow.svelte.d.ts +14 -0
- package/dist/components/editor/SettingsTab.svelte +66 -50
- package/dist/components/editor/WorkflowEditor.svelte +4 -5
- package/dist/components/list/CreateWorkflowDialog.svelte +123 -73
- package/dist/components/list/WorkflowList.svelte +227 -100
- package/dist/components/list/WorkflowRow.svelte +84 -42
- package/dist/components/panel/BlockProblems.svelte +9 -8
- package/dist/components/panel/CompositionForm.svelte +52 -34
- package/dist/components/panel/CompositionPicker.svelte +43 -21
- package/dist/components/panel/CompositionPicker.svelte.d.ts +5 -0
- package/dist/components/panel/CompositionSelect.svelte +105 -0
- package/dist/components/panel/CompositionSelect.svelte.d.ts +23 -0
- package/dist/components/panel/ConditionForm.svelte +50 -17
- package/dist/components/panel/EventValueRow.svelte +5 -4
- package/dist/components/panel/ProblemsList.svelte +17 -19
- package/dist/components/panel/RuleCard.svelte +127 -89
- package/dist/components/panel/RuleCard.svelte.d.ts +2 -0
- package/dist/components/panel/SidePanel.svelte +101 -50
- package/dist/components/panel/TestResultLine.svelte +35 -0
- package/dist/components/panel/TestResultLine.svelte.d.ts +9 -0
- package/dist/components/panel/TestRow.svelte +21 -18
- package/dist/components/panel/TestRunPanel.svelte +61 -39
- package/dist/components/panel/TestTriggerCard.svelte +66 -6
- package/dist/components/panel/TestTriggerCard.svelte.d.ts +10 -0
- package/dist/components/panel/TriggerForm.svelte +24 -25
- package/dist/components/panel/VersionHistory.svelte +31 -43
- package/dist/components/ui/ActionButton.svelte +44 -12
- package/dist/components/ui/ActionButton.svelte.d.ts +2 -1
- package/dist/components/ui/Badge.svelte +39 -0
- package/dist/components/ui/Badge.svelte.d.ts +12 -0
- package/dist/components/ui/ConfirmDialog.svelte +4 -3
- package/dist/components/ui/Menu.svelte +28 -14
- package/dist/components/ui/Menu.svelte.d.ts +3 -1
- package/dist/components/ui/Modal.svelte +15 -8
- package/dist/components/ui/Notice.svelte +35 -11
- package/dist/components/ui/Notice.svelte.d.ts +4 -1
- package/dist/components/ui/SelectField.svelte +48 -20
- package/dist/components/ui/SelectField.svelte.d.ts +2 -0
- package/dist/components/ui/StatusBadge.svelte +13 -24
- package/dist/components/ui/StatusBadge.svelte.d.ts +0 -2
- package/dist/components/ui/Tabs.svelte +79 -0
- package/dist/components/ui/Tabs.svelte.d.ts +21 -0
- package/dist/components/ui/TextField.svelte +47 -27
- package/dist/components/ui/TextField.svelte.d.ts +5 -0
- package/dist/components/ui/icons.d.ts +43 -29
- package/dist/components/ui/icons.js +101 -40
- package/dist/editor/editorState.svelte.d.ts +23 -2
- package/dist/editor/editorState.svelte.js +36 -0
- package/dist/editor/listState.svelte.d.ts +32 -2
- package/dist/editor/listState.svelte.js +41 -0
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +22 -13
- package/dist/i18n/messages.js +23 -14
- package/dist/i18n/statusWords.d.ts +12 -0
- package/dist/i18n/statusWords.js +12 -0
- package/package.json +3 -3
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
index: number;
|
|
35
35
|
/** The values the trigger before the condition carries. */
|
|
36
36
|
choices: readonly FieldChoice[];
|
|
37
|
+
expanded: boolean;
|
|
38
|
+
onToggle: () => void;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
let { node, rule, index, choices }: Props = $props();
|
|
41
|
+
let { node, rule, index, choices, expanded, onToggle }: Props = $props();
|
|
40
42
|
|
|
41
43
|
const editor = useEditorState();
|
|
42
44
|
const { t } = useWorkflowsLanguage();
|
|
@@ -92,100 +94,136 @@
|
|
|
92
94
|
</script>
|
|
93
95
|
|
|
94
96
|
<section
|
|
95
|
-
class="flex flex-col
|
|
97
|
+
class="border-border bg-background flex flex-col rounded-xl border"
|
|
96
98
|
aria-labelledby={headingId}
|
|
97
99
|
>
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/>
|
|
109
|
-
<h4 id={headingId} class="sr-only">{ruleName}</h4>
|
|
110
|
-
{#if !editor.isReadOnly}
|
|
111
|
-
<ActionButton
|
|
112
|
-
variant="ghost"
|
|
113
|
-
iconOnly
|
|
114
|
-
disabled={isFirst}
|
|
115
|
-
ariaLabel={$t('workflows.rule.moveUp', { name: ruleName })}
|
|
116
|
-
title={$t('workflows.rule.moveUp', { name: ruleName })}
|
|
117
|
-
onclick={() => editor.replaceBlock(moveRule(node, rule.id, index - 1))}
|
|
118
|
-
>
|
|
119
|
-
<Icon name="up" />
|
|
120
|
-
</ActionButton>
|
|
121
|
-
<ActionButton
|
|
122
|
-
variant="ghost"
|
|
123
|
-
iconOnly
|
|
124
|
-
disabled={isLast}
|
|
125
|
-
ariaLabel={$t('workflows.rule.moveDown', { name: ruleName })}
|
|
126
|
-
title={$t('workflows.rule.moveDown', { name: ruleName })}
|
|
127
|
-
onclick={() => editor.replaceBlock(moveRule(node, rule.id, index + 1))}
|
|
128
|
-
>
|
|
129
|
-
<Icon name="down" />
|
|
130
|
-
</ActionButton>
|
|
131
|
-
<ActionButton
|
|
132
|
-
variant="ghost"
|
|
133
|
-
iconOnly
|
|
134
|
-
ariaLabel={$t('workflows.rule.remove', { name: ruleName })}
|
|
135
|
-
title={$t('workflows.rule.remove', { name: ruleName })}
|
|
136
|
-
onclick={() => editor.replaceBlock(removeRule(node, rule.id))}
|
|
100
|
+
{#if !expanded}
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
class="hover:bg-accent flex min-h-11 w-full items-center gap-2 rounded-xl py-3 ps-3 pe-4 text-start duration-fast"
|
|
104
|
+
aria-expanded="false"
|
|
105
|
+
aria-label={$t('workflows.rule.expand', { name: ruleName })}
|
|
106
|
+
onclick={onToggle}
|
|
107
|
+
>
|
|
108
|
+
<span id={headingId} class="text-body-medium min-w-0 flex-1 truncate text-foreground"
|
|
109
|
+
>{ruleName}</span
|
|
137
110
|
>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{/if}
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
{#if rule.tests.length === 0}
|
|
144
|
-
<p class="text-xs text-ink-muted">{$t('workflows.rule.noTests')}</p>
|
|
111
|
+
<Icon name="down" class="text-muted-foreground size-4 shrink-0 rtl:rotate-180" />
|
|
112
|
+
</button>
|
|
145
113
|
{:else}
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<div class="flex flex-col gap-2">
|
|
157
|
-
{#each rule.tests as test, position (position)}
|
|
158
|
-
<TestRow
|
|
159
|
-
{test}
|
|
160
|
-
index={position}
|
|
161
|
-
{choices}
|
|
114
|
+
<h4 id={headingId} class="sr-only">{ruleName}</h4>
|
|
115
|
+
<div class="flex flex-col gap-3 p-3">
|
|
116
|
+
<div class="flex items-start gap-1">
|
|
117
|
+
<TextField
|
|
118
|
+
class="min-w-0 flex-1"
|
|
119
|
+
variant="soft"
|
|
120
|
+
label={$t('workflows.rule.nameLabel', { name: ruleName })}
|
|
121
|
+
hideLabel
|
|
122
|
+
placeholder={ruleName}
|
|
123
|
+
maxlength={80}
|
|
162
124
|
disabled={editor.isReadOnly}
|
|
163
|
-
|
|
164
|
-
|
|
125
|
+
bind:value={nameDraft}
|
|
126
|
+
onchange={commitName}
|
|
165
127
|
/>
|
|
166
|
-
|
|
128
|
+
{#if !editor.isReadOnly}
|
|
129
|
+
<ActionButton
|
|
130
|
+
variant="ghost"
|
|
131
|
+
iconOnly
|
|
132
|
+
disabled={isFirst}
|
|
133
|
+
ariaLabel={$t('workflows.rule.moveUp', { name: ruleName })}
|
|
134
|
+
title={$t('workflows.rule.moveUp', { name: ruleName })}
|
|
135
|
+
onclick={() => editor.replaceBlock(moveRule(node, rule.id, index - 1))}
|
|
136
|
+
>
|
|
137
|
+
<Icon name="arrowUp" />
|
|
138
|
+
</ActionButton>
|
|
139
|
+
<ActionButton
|
|
140
|
+
variant="ghost"
|
|
141
|
+
iconOnly
|
|
142
|
+
disabled={isLast}
|
|
143
|
+
ariaLabel={$t('workflows.rule.moveDown', { name: ruleName })}
|
|
144
|
+
title={$t('workflows.rule.moveDown', { name: ruleName })}
|
|
145
|
+
onclick={() => editor.replaceBlock(moveRule(node, rule.id, index + 1))}
|
|
146
|
+
>
|
|
147
|
+
<Icon name="arrowDown" />
|
|
148
|
+
</ActionButton>
|
|
149
|
+
<ActionButton
|
|
150
|
+
variant="ghost"
|
|
151
|
+
iconOnly
|
|
152
|
+
ariaLabel={$t('workflows.rule.remove', { name: ruleName })}
|
|
153
|
+
title={$t('workflows.rule.remove', { name: ruleName })}
|
|
154
|
+
onclick={() => editor.replaceBlock(removeRule(node, rule.id))}
|
|
155
|
+
>
|
|
156
|
+
<Icon name="trash" />
|
|
157
|
+
</ActionButton>
|
|
158
|
+
{/if}
|
|
159
|
+
<ActionButton
|
|
160
|
+
variant="ghost"
|
|
161
|
+
iconOnly
|
|
162
|
+
ariaLabel={$t('workflows.rule.collapse', { name: ruleName })}
|
|
163
|
+
title={$t('workflows.rule.collapse', { name: ruleName })}
|
|
164
|
+
expanded={true}
|
|
165
|
+
onclick={onToggle}
|
|
166
|
+
>
|
|
167
|
+
<Icon name="down" class="size-4 rotate-180 rtl:rotate-0" />
|
|
168
|
+
</ActionButton>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
{#if rule.tests.length === 0}
|
|
172
|
+
<p class="text-caption text-muted-foreground">{$t('workflows.rule.noTests')}</p>
|
|
173
|
+
{:else}
|
|
174
|
+
{#if rule.tests.length > 1}
|
|
175
|
+
<div class="flex items-center gap-2">
|
|
176
|
+
<span class="text-body shrink-0 text-muted-foreground"
|
|
177
|
+
>{$t('workflows.rule.matchLabel')}</span
|
|
178
|
+
>
|
|
179
|
+
<SelectField
|
|
180
|
+
class="min-w-0 flex-1"
|
|
181
|
+
label={$t('workflows.rule.matchLabel')}
|
|
182
|
+
hideLabel
|
|
183
|
+
value={rule.match}
|
|
184
|
+
choices={matchChoices}
|
|
185
|
+
disabled={editor.isReadOnly}
|
|
186
|
+
onchange={(match) =>
|
|
187
|
+
replaceRule((current) => ({ ...current, match: match === 'any' ? 'any' : 'all' }))}
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
{/if}
|
|
191
|
+
<div class="flex flex-col gap-3">
|
|
192
|
+
{#each rule.tests as test, position (position)}
|
|
193
|
+
<TestRow
|
|
194
|
+
{test}
|
|
195
|
+
index={position}
|
|
196
|
+
{choices}
|
|
197
|
+
disabled={editor.isReadOnly}
|
|
198
|
+
onchange={(next) => changeTest(position, next)}
|
|
199
|
+
onremove={() => removeTest(position)}
|
|
200
|
+
/>
|
|
201
|
+
{/each}
|
|
202
|
+
</div>
|
|
203
|
+
{/if}
|
|
204
|
+
|
|
205
|
+
{#if !editor.isReadOnly}
|
|
206
|
+
<ActionButton
|
|
207
|
+
variant="ghost"
|
|
208
|
+
size="small"
|
|
209
|
+
class="self-start"
|
|
210
|
+
disabled={choices.length === 0 || !canAddTest(rule)}
|
|
211
|
+
title={canAddTest(rule)
|
|
212
|
+
? undefined
|
|
213
|
+
: $t('workflows.rule.testLimit', { max: MAX_TESTS_PER_CASE })}
|
|
214
|
+
onclick={addTest}
|
|
215
|
+
>
|
|
216
|
+
<Icon name="plus" class="size-4" />
|
|
217
|
+
{$t('workflows.rule.addTest')}
|
|
218
|
+
</ActionButton>
|
|
219
|
+
{/if}
|
|
220
|
+
|
|
221
|
+
<NextStepSelect
|
|
222
|
+
sourceId={node.id}
|
|
223
|
+
sourcePort={rule.id}
|
|
224
|
+
label={$t('workflows.rule.thenGoTo', { name: ruleName })}
|
|
225
|
+
emptyLabel={$t('workflows.trigger.nextNone')}
|
|
226
|
+
/>
|
|
167
227
|
</div>
|
|
168
228
|
{/if}
|
|
169
|
-
|
|
170
|
-
{#if !editor.isReadOnly}
|
|
171
|
-
<ActionButton
|
|
172
|
-
size="small"
|
|
173
|
-
class="self-start"
|
|
174
|
-
disabled={choices.length === 0 || !canAddTest(rule)}
|
|
175
|
-
title={canAddTest(rule)
|
|
176
|
-
? undefined
|
|
177
|
-
: $t('workflows.rule.testLimit', { max: MAX_TESTS_PER_CASE })}
|
|
178
|
-
onclick={addTest}
|
|
179
|
-
>
|
|
180
|
-
<Icon name="plus" />
|
|
181
|
-
{$t('workflows.rule.addTest')}
|
|
182
|
-
</ActionButton>
|
|
183
|
-
{/if}
|
|
184
|
-
|
|
185
|
-
<NextStepSelect
|
|
186
|
-
sourceId={node.id}
|
|
187
|
-
sourcePort={rule.id}
|
|
188
|
-
label={$t('workflows.rule.thenGoTo', { name: ruleName })}
|
|
189
|
-
emptyLabel={$t('workflows.trigger.nextNone')}
|
|
190
|
-
/>
|
|
191
229
|
</section>
|
|
@@ -7,6 +7,8 @@ interface Props {
|
|
|
7
7
|
index: number;
|
|
8
8
|
/** The values the trigger before the condition carries. */
|
|
9
9
|
choices: readonly FieldChoice[];
|
|
10
|
+
expanded: boolean;
|
|
11
|
+
onToggle: () => void;
|
|
10
12
|
}
|
|
11
13
|
declare const RuleCard: import("svelte").Component<Props, {}, "">;
|
|
12
14
|
type RuleCard = ReturnType<typeof RuleCard>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
The panel beside the canvas. It shows one of
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
The panel beside the canvas. It shows one of four things: the form of the selected block, the version history, the test
|
|
3
|
+
run, or, with nothing selected, what is wrong with the draft (the page leaves the panel out when there is nothing to show,
|
|
4
|
+
see `showsSidePanel` of the editor state). Everything a block's form can do is also possible with the keyboard and on a
|
|
5
|
+
touch screen, where the canvas itself cannot be drawn on.
|
|
5
6
|
|
|
6
7
|
A block's form starts again whenever another block is selected, so what was being typed for one block never lands in
|
|
7
8
|
another.
|
|
@@ -24,59 +25,109 @@
|
|
|
24
25
|
const selectedNode = $derived(editor.selectedNode);
|
|
25
26
|
const selectedBlockCount = $derived(editor.selectedNodeIds.length);
|
|
26
27
|
const selectedConnectionCount = $derived(editor.selectedEdgeIds.length);
|
|
28
|
+
|
|
29
|
+
/** The title of the head: the history and the test run name themselves, a block's form names the kind of block. */
|
|
30
|
+
const headingKey = $derived.by(() => {
|
|
31
|
+
if (editor.panel === 'history') return 'workflows.history.heading' as const;
|
|
32
|
+
if (editor.panel === 'test') return 'workflows.test.heading' as const;
|
|
33
|
+
if (selectedNode?.type === 'composition') return 'workflows.composition.heading' as const;
|
|
34
|
+
if (selectedNode?.type === 'trigger') return 'workflows.trigger.heading' as const;
|
|
35
|
+
if (selectedNode?.type === 'condition') return 'workflows.condition.heading' as const;
|
|
36
|
+
if (selectedBlockCount > 1 || selectedConnectionCount > 0)
|
|
37
|
+
return 'workflows.panel.selectionHeading' as const;
|
|
38
|
+
return 'workflows.panel.problemsHeading' as const;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/** What the close button is called for a screen reader: each part of the panel says what it closes. */
|
|
42
|
+
const closeLabelKey = $derived.by(() => {
|
|
43
|
+
if (editor.panel === 'history') return 'workflows.history.close' as const;
|
|
44
|
+
if (editor.panel === 'test') return 'workflows.test.close' as const;
|
|
45
|
+
return 'workflows.panel.close' as const;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The X: the history and the test run close; with a selection it clears the selection; on the Problems panel it closes the
|
|
50
|
+
* panel for the findings it lists.
|
|
51
|
+
*/
|
|
52
|
+
function closePanel(): void {
|
|
53
|
+
if (editor.panel === 'history') {
|
|
54
|
+
editor.closeHistory();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (editor.panel === 'test') {
|
|
58
|
+
editor.closeTestRun();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (selectedNode || selectedBlockCount > 0 || selectedConnectionCount > 0) {
|
|
62
|
+
editor.canvas?.selectNodes([]);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
editor.closeProblemsPanel();
|
|
66
|
+
}
|
|
27
67
|
</script>
|
|
28
68
|
|
|
29
69
|
<aside
|
|
70
|
+
class="mb-2 flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden rounded-xl border border-border bg-background @3xl:mb-0 @3xl:w-90 @3xl:shrink-0"
|
|
30
71
|
aria-label={$t('workflows.panel.label')}
|
|
31
|
-
class="flex min-h-0 min-w-0 flex-col gap-4 overflow-auto bg-white p-4"
|
|
32
72
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<p class="text-sm">
|
|
50
|
-
{#if selectedBlockCount > 1}
|
|
51
|
-
{$t('workflows.panel.manyBlocksSelected', { count: selectedBlockCount })}
|
|
52
|
-
{:else}
|
|
53
|
-
{$t('workflows.panel.connectionSelected')}
|
|
54
|
-
{/if}
|
|
55
|
-
</p>
|
|
56
|
-
{#if !editor.isReadOnly}
|
|
57
|
-
<ActionButton
|
|
58
|
-
variant="danger"
|
|
59
|
-
size="small"
|
|
60
|
-
class="self-start"
|
|
61
|
-
onclick={() => editor.removeSelected()}
|
|
62
|
-
>
|
|
63
|
-
<Icon name="trash" />
|
|
64
|
-
{selectedBlockCount > 1
|
|
65
|
-
? $t('workflows.panel.removeBlocks')
|
|
66
|
-
: $t('workflows.panel.removeConnection')}
|
|
67
|
-
</ActionButton>
|
|
68
|
-
{/if}
|
|
69
|
-
</div>
|
|
70
|
-
{:else}
|
|
73
|
+
<!-- Head (Figma "Panel"): the title and the close button; 48 high, 16 before the title and 12 after the button. -->
|
|
74
|
+
<header class="flex h-12 shrink-0 items-center gap-2 pt-3 pe-3 pb-1 ps-4">
|
|
75
|
+
<h2 class="min-w-0 flex-1 text-start text-heading-section">
|
|
76
|
+
{$t(headingKey)}
|
|
77
|
+
</h2>
|
|
78
|
+
<ActionButton
|
|
79
|
+
variant="ghost"
|
|
80
|
+
iconOnly
|
|
81
|
+
ariaLabel={$t(closeLabelKey)}
|
|
82
|
+
title={$t(closeLabelKey)}
|
|
83
|
+
onclick={closePanel}
|
|
84
|
+
>
|
|
85
|
+
<Icon name="close" />
|
|
86
|
+
</ActionButton>
|
|
87
|
+
</header>
|
|
88
|
+
<div class="min-h-0 flex-1 overflow-y-auto pt-1 pe-4 pb-4 ps-4">
|
|
71
89
|
<div class="flex flex-col gap-4">
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
{#if editor.panel === 'history'}
|
|
91
|
+
<VersionHistory />
|
|
92
|
+
{:else if editor.panel === 'test'}
|
|
93
|
+
<TestRunPanel />
|
|
94
|
+
{:else if selectedNode}
|
|
95
|
+
{#key selectedNode.id}
|
|
96
|
+
{#if selectedNode.type === 'composition'}
|
|
97
|
+
<CompositionForm node={selectedNode} />
|
|
98
|
+
{:else if selectedNode.type === 'trigger'}
|
|
99
|
+
<TriggerForm node={selectedNode} />
|
|
100
|
+
{:else}
|
|
101
|
+
<ConditionForm node={selectedNode} />
|
|
102
|
+
{/if}
|
|
103
|
+
{/key}
|
|
104
|
+
{:else if selectedBlockCount > 1 || selectedConnectionCount > 0}
|
|
105
|
+
<div class="flex flex-col gap-3">
|
|
106
|
+
<p class="text-body text-muted-foreground">
|
|
107
|
+
{#if selectedBlockCount > 1}
|
|
108
|
+
{$t('workflows.panel.manyBlocksSelected', { count: selectedBlockCount })}
|
|
109
|
+
{:else}
|
|
110
|
+
{$t('workflows.panel.connectionSelected')}
|
|
111
|
+
{/if}
|
|
112
|
+
</p>
|
|
113
|
+
{#if !editor.isReadOnly}
|
|
114
|
+
<ActionButton
|
|
115
|
+
variant="danger"
|
|
116
|
+
size="small"
|
|
117
|
+
class="self-start"
|
|
118
|
+
onclick={() => editor.removeSelected()}
|
|
119
|
+
>
|
|
120
|
+
<Icon name="trash" />
|
|
121
|
+
{selectedBlockCount > 1
|
|
122
|
+
? $t('workflows.panel.removeBlocks')
|
|
123
|
+
: $t('workflows.panel.removeConnection')}
|
|
124
|
+
</ActionButton>
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
{:else}
|
|
128
|
+
<!-- Nothing selected: what is wrong with the draft (the panel is not drawn when there is nothing to say). -->
|
|
78
129
|
<ProblemsList />
|
|
79
|
-
|
|
130
|
+
{/if}
|
|
80
131
|
</div>
|
|
81
|
-
|
|
132
|
+
</div>
|
|
82
133
|
</aside>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
One sentence for what the last trigger of the test run did: the visitor moved on (a check mark, in the brand colour), or
|
|
3
|
+
stayed where they were, or the trigger did not apply to the composition they are on (an "i", quiet).
|
|
4
|
+
|
|
5
|
+
It sits under the trigger that was fired. Once the visitor has moved on, that trigger is no longer among the ones of the
|
|
6
|
+
composition they are on, so the panel puts the same sentence under the line that says where the visitor is.
|
|
7
|
+
-->
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import type { TestRunResult } from '../../editor/testRun.js';
|
|
10
|
+
import Icon from '../ui/Icon.svelte';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
/** The sentence, already in the page's language. */
|
|
14
|
+
text: string;
|
|
15
|
+
outcome: TestRunResult['outcome'];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { text, outcome }: Props = $props();
|
|
19
|
+
|
|
20
|
+
const isMoved = $derived(outcome === 'moved');
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class="flex items-start gap-2" role="status">
|
|
24
|
+
<Icon
|
|
25
|
+
name={isMoved ? 'circleCheck' : 'info'}
|
|
26
|
+
class="size-4 shrink-0 {isMoved ? 'text-brand' : 'text-muted-foreground'}"
|
|
27
|
+
/>
|
|
28
|
+
<p
|
|
29
|
+
class="min-w-0 flex-1 text-caption whitespace-pre-wrap {isMoved
|
|
30
|
+
? 'text-brand'
|
|
31
|
+
: 'text-muted-foreground'}"
|
|
32
|
+
>
|
|
33
|
+
{text}
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TestRunResult } from '../../editor/testRun.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** The sentence, already in the page's language. */
|
|
4
|
+
text: string;
|
|
5
|
+
outcome: TestRunResult['outcome'];
|
|
6
|
+
}
|
|
7
|
+
declare const TestResultLine: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type TestResultLine = ReturnType<typeof TestResultLine>;
|
|
9
|
+
export default TestResultLine;
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
}
|
|
89
89
|
</script>
|
|
90
90
|
|
|
91
|
-
<div class="flex flex-col gap-
|
|
92
|
-
<div class="flex items-start gap-
|
|
91
|
+
<div class="flex flex-col gap-3">
|
|
92
|
+
<div class="flex items-start gap-1.5">
|
|
93
93
|
<SelectField
|
|
94
|
-
class="flex-1"
|
|
94
|
+
class="min-w-0 flex-1"
|
|
95
95
|
label={$t('workflows.test.field', { number })}
|
|
96
96
|
hideLabel
|
|
97
97
|
value={fieldKey}
|
|
@@ -99,20 +99,8 @@
|
|
|
99
99
|
{disabled}
|
|
100
100
|
onchange={chooseField}
|
|
101
101
|
/>
|
|
102
|
-
<ActionButton
|
|
103
|
-
variant="ghost"
|
|
104
|
-
iconOnly
|
|
105
|
-
{disabled}
|
|
106
|
-
ariaLabel={$t('workflows.test.remove', { number })}
|
|
107
|
-
title={$t('workflows.test.remove', { number })}
|
|
108
|
-
onclick={onremove}
|
|
109
|
-
>
|
|
110
|
-
<Icon name="trash" />
|
|
111
|
-
</ActionButton>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="flex items-start gap-2">
|
|
114
102
|
<SelectField
|
|
115
|
-
class="flex-1"
|
|
103
|
+
class="min-w-0 flex-1"
|
|
116
104
|
label={$t('workflows.test.operator', { number })}
|
|
117
105
|
hideLabel
|
|
118
106
|
value={test.operator}
|
|
@@ -120,10 +108,12 @@
|
|
|
120
108
|
{disabled}
|
|
121
109
|
onchange={(operator) => onchange(changeTestOperator(test, operator as Operator))}
|
|
122
110
|
/>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="flex items-start gap-1.5">
|
|
123
113
|
{#if takesValue}
|
|
124
114
|
{#if test.field.type === 'boolean'}
|
|
125
115
|
<SelectField
|
|
126
|
-
class="flex-1"
|
|
116
|
+
class="min-w-0 flex-1"
|
|
127
117
|
label={$t('workflows.test.value', { number })}
|
|
128
118
|
hideLabel
|
|
129
119
|
value={String(test.value ?? true)}
|
|
@@ -133,7 +123,7 @@
|
|
|
133
123
|
/>
|
|
134
124
|
{:else}
|
|
135
125
|
<TextField
|
|
136
|
-
class="flex-1"
|
|
126
|
+
class="min-w-0 flex-1"
|
|
137
127
|
type={test.field.type === 'number' ? 'number' : 'text'}
|
|
138
128
|
inputmode={test.field.type === 'number' ? 'decimal' : 'text'}
|
|
139
129
|
label={$t('workflows.test.value', { number })}
|
|
@@ -145,6 +135,19 @@
|
|
|
145
135
|
onchange={commitValue}
|
|
146
136
|
/>
|
|
147
137
|
{/if}
|
|
138
|
+
{:else}
|
|
139
|
+
<div class="min-w-0 flex-1"></div>
|
|
148
140
|
{/if}
|
|
141
|
+
<ActionButton
|
|
142
|
+
variant="ghost"
|
|
143
|
+
iconOnly
|
|
144
|
+
class="shrink-0"
|
|
145
|
+
{disabled}
|
|
146
|
+
ariaLabel={$t('workflows.test.remove', { number })}
|
|
147
|
+
title={$t('workflows.test.remove', { number })}
|
|
148
|
+
onclick={onremove}
|
|
149
|
+
>
|
|
150
|
+
<Icon name="close" />
|
|
151
|
+
</ActionButton>
|
|
149
152
|
</div>
|
|
150
153
|
</div>
|