@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
package/README.md
CHANGED
|
@@ -55,7 +55,8 @@ Workflows are for **Teams and partner accounts** only. On Widgetic the page is
|
|
|
55
55
|
compositions it uses stay). Archiving is the way to take a workflow out of the list and keep it. The name is edited in
|
|
56
56
|
the bar above the canvas.
|
|
57
57
|
- Speaks the page's language (`locale`, `messages`) and turns around for right to left (`dir`).
|
|
58
|
-
-
|
|
58
|
+
- Is drawn with the Widgetic design system and takes its colours, font and corners from the design system's CSS custom
|
|
59
|
+
properties, so a host or a ui-sdk theme restyles it.
|
|
59
60
|
- Reports what goes wrong to the page (`onError`) and shows the visitor a "Try again" in place of a part that failed.
|
|
60
61
|
|
|
61
62
|
## Where it is loaded
|
|
@@ -78,7 +79,10 @@ npm install @widgetic/workflows @widgetic/design-system svelte
|
|
|
78
79
|
page. The package needs Svelte 5.
|
|
79
80
|
|
|
80
81
|
**Styles.** The components are styled with Tailwind classes and ship no stylesheet of their own, so the host's Tailwind
|
|
81
|
-
has to read the package, or the screen is drawn without its classes.
|
|
82
|
+
has to read the package, or the screen is drawn without its classes. The classes themselves (`bg-background`,
|
|
83
|
+
`text-body`, `rounded-panel`, `w-dialog` ...) are the design system's, so the host loads
|
|
84
|
+
`@widgetic/design-system/styles` and it has to be a version that has them: the one the peer range of this package names.
|
|
85
|
+
In the host's CSS, after the design system:
|
|
82
86
|
|
|
83
87
|
```css
|
|
84
88
|
@import '@widgetic/design-system/styles';
|
|
@@ -166,33 +170,36 @@ not ask, ends the looking and the list goes on without badges. A badge never shu
|
|
|
166
170
|
|
|
167
171
|
## Look and feel
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
| `--
|
|
177
|
-
| `--
|
|
178
|
-
| `--
|
|
179
|
-
| `--primary-
|
|
180
|
-
| `--
|
|
181
|
-
| `--
|
|
182
|
-
| `--
|
|
173
|
+
The screen is drawn with the Widgetic design system, the one in the Figma file "Dashboard": its colours, type, corners and
|
|
174
|
+
spacing are the tokens of `@widgetic/design-system/styles`, and nothing in the screen is a literal colour, font or corner.
|
|
175
|
+
A theme is a handful of those tokens set as CSS custom properties on an element that contains the screen. The Widgetic site,
|
|
176
|
+
a host's stylesheet and a ui-sdk theme restyle the screen the same way.
|
|
177
|
+
|
|
178
|
+
| Property | What it paints |
|
|
179
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
180
|
+
| `--background`, `--foreground` | The surface of the screen and the text on it. |
|
|
181
|
+
| `--muted`, `--muted-foreground` | The quiet fills (the tab bar, the canvas, a block's icon) and the lines under a title, the hints and the labels. |
|
|
182
|
+
| `--accent` | What a row, a menu line or a ghost button turns into under the pointer. |
|
|
183
|
+
| `--primary`, `--primary-foreground` | The main button, the outline of the selected block and the bands of the Runs chart. |
|
|
184
|
+
| `--brand`, `--brand-foreground` | The sage of "Add block" and of the Live state; `--brand-subtle` is the same colour as a quiet fill. |
|
|
185
|
+
| `--border`, `--input` | The lines around the cards, the panel, the fields and the empty state. |
|
|
186
|
+
| `--destructive` | Problems on a block, failed saves, and Delete. |
|
|
187
|
+
| `--warning` | The mark of a warning in the Problems panel. |
|
|
188
|
+
| `--radius-*` | The corners: `rounded-lg` for fields and buttons, `rounded-xl` for cards, `rounded-panel` for dialogs. |
|
|
189
|
+
| `--font-sans` | The typeface of text that names the sans font through Tailwind. The design system's type classes (`text-body` ...) name Inter themselves; the ui-sdk module points them at the theme's font when it is built. |
|
|
183
190
|
|
|
184
191
|
```css
|
|
185
192
|
.my-workflows-host {
|
|
186
|
-
--primary
|
|
187
|
-
--
|
|
188
|
-
--
|
|
189
|
-
--
|
|
190
|
-
--
|
|
191
|
-
--
|
|
193
|
+
--primary: #5b21b6;
|
|
194
|
+
--primary-foreground: #ffffff;
|
|
195
|
+
--foreground: #1e1b2e;
|
|
196
|
+
--muted-foreground: #5f5a73;
|
|
197
|
+
--border: #d9d4ea;
|
|
198
|
+
--radius-xl: 2px;
|
|
192
199
|
}
|
|
193
200
|
```
|
|
194
201
|
|
|
195
|
-
The surface is
|
|
202
|
+
The surface is the design system's `bg-background`. Inside a ui-sdk module it follows the theme's `background`.
|
|
196
203
|
|
|
197
204
|
**For partners** the module takes a `theme` (a preset or `{ colors, radius, font }`), and the module spreads it over
|
|
198
205
|
these properties, so a partner never writes one by hand.
|
|
@@ -200,11 +207,9 @@ these properties, so a partner never writes one by hand.
|
|
|
200
207
|
**For the people who write this package:** a colour, a font or a corner in a component is a token, never a literal.
|
|
201
208
|
`tests/workflows-theming.test.mjs` fails on a hex colour, a colour function, a colour of Tailwind's own palette, an
|
|
202
209
|
arbitrary value or a `style` attribute, and says what to write instead. Placement uses the start and the end of a line
|
|
203
|
-
(`ms-`, `me-`, `text-start`), never a physical side; `tests/workflows-direction.test.mjs` fails on
|
|
204
|
-
the like unless the line says why with the note `rtl-ok`.
|
|
205
|
-
|
|
206
|
-
The shadcn names (`--background`, `--foreground`, `--muted`) are **not** what this package reads. The Widgetic site does
|
|
207
|
-
not define them, so a screen written against them would have no colour there.
|
|
210
|
+
(`ms-`, `me-`, `text-start`, `inset-inline-start`), never a physical side; `tests/workflows-direction.test.mjs` fails on
|
|
211
|
+
`ml-`, `left-` and the like unless the line says why with the note `rtl-ok`. The canvas is the one part that is always
|
|
212
|
+
drawn left to right (a graph is read from the trigger on its left), and it says so with `dir="ltr"`.
|
|
208
213
|
|
|
209
214
|
## Languages
|
|
210
215
|
|
|
@@ -288,21 +293,22 @@ The why and the silent-degrade failure mode live in [the dev-tools README](../de
|
|
|
288
293
|
|
|
289
294
|
`npm test` runs the guards in Node, with no browser. Each one protects a promise the package makes to its hosts:
|
|
290
295
|
|
|
291
|
-
| File
|
|
292
|
-
|
|
|
293
|
-
| `tests/workflows-words.test.mjs`
|
|
294
|
-
| `tests/workflows-words-audit.test.mjs`
|
|
295
|
-
| `tests/workflows-direction.test.mjs`
|
|
296
|
-
| `tests/workflows-theming.test.mjs`
|
|
297
|
-
| `tests/workflows-logger.test.mjs`
|
|
298
|
-
| `tests/no-service-key.test.mjs`
|
|
299
|
-
| `tests/package-shape.test.mjs`
|
|
300
|
-
| `tests/workflows-api.test.mjs`
|
|
301
|
-
| `tests/workflows-editor-model.test.mjs`
|
|
302
|
-
| `tests/workflows-graph-diff.test.mjs`
|
|
303
|
-
| `tests/workflows-autosave.test.mjs`
|
|
304
|
-
| `tests/workflows-layout.test.mjs`
|
|
305
|
-
| `tests/workflows-text.test.mjs`
|
|
296
|
+
| File | What it protects |
|
|
297
|
+
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `tests/workflows-words.test.mjs` | The catalog: keys, English that people read first, templates, what a page's `messages` can do. |
|
|
299
|
+
| `tests/workflows-words-audit.test.mjs` | No sentence is written into a file; every key is used; the language reaches every part. |
|
|
300
|
+
| `tests/workflows-direction.test.mjs` | Nothing is placed on a physical side, so the screen mirrors; the root writes its direction. |
|
|
301
|
+
| `tests/workflows-theming.test.mjs` | No literal colour, font or corner: a theme has something to change. |
|
|
302
|
+
| `tests/workflows-logger.test.mjs` | Each console line is said once. |
|
|
303
|
+
| `tests/no-service-key.test.mjs` | No service key is read or sent from code that runs in a visitor's browser. |
|
|
304
|
+
| `tests/package-shape.test.mjs` | What `package.json` promises exists in `src/lib`; the CI publishes without a token in the repo. |
|
|
305
|
+
| `tests/workflows-api.test.mjs` | The API client: what it asks (address, token, the key that makes a retry safe), what it makes of each answer and how each way of failing is told apart. |
|
|
306
|
+
| `tests/workflows-editor-model.test.mjs` | Making and changing blocks, rules and tests; where a block goes; what a composition can do; the canvas adapter; the test run; time zones. |
|
|
307
|
+
| `tests/workflows-graph-diff.test.mjs` | What changed between two versions of a graph, as the small operations the canvas is told (a block comes, goes or changes; a line comes or goes). |
|
|
308
|
+
| `tests/workflows-autosave.test.mjs` | The draft saver: when a change is sent, that two saves are never on their way at once, that nothing typed during a save is lost, and what each failure leaves behind. |
|
|
309
|
+
| `tests/workflows-layout.test.mjs` | The screen fills the element the page gives it and scrolls inside it (`overflow-auto` on each root), so a short host is never painted over. |
|
|
310
|
+
| `tests/workflows-text.test.mjs` | The words around what a person built: issues, failed requests, block names, rule summaries, counts and days. |
|
|
311
|
+
| `tests/workflows-problems-panel.test.mjs` | The Problems panel: it shows when the draft has findings, it can be closed for the findings it lists, and it comes back when they change or a publish is tried. |
|
|
306
312
|
|
|
307
313
|
Before a change is done: `npm run check` (0 errors, 0 warnings), `npm test`, `npm run lint` and `npm run package`.
|
|
308
314
|
|
|
@@ -8,13 +8,16 @@
|
|
|
8
8
|
show (`apiUrl`, `getAccessToken`, `workspaceId`). Which workflow is open is the page's too (`workflowId`, told about
|
|
9
9
|
changes through `onOpenWorkflow`), so that it can be part of the page's address. See `WorkflowsProps`.
|
|
10
10
|
|
|
11
|
-
Look and feel: nothing in here is a literal colour, font or corner. Everything reads the Widgetic
|
|
12
|
-
(`bg-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Look and feel: nothing in here is a literal colour, font or corner. Everything reads the Widgetic design system's tokens
|
|
12
|
+
(`bg-background`, `text-foreground`, `text-muted-foreground`, `border-border`, `bg-primary`, `text-destructive`), its
|
|
13
|
+
`rounded-*` scale and its type utilities (`text-body`, `text-caption`, `text-heading-page`), and `font-sans`, which the page
|
|
14
|
+
(or a ui-sdk theme) sets through CSS custom properties. Placement is logical (`ms-`, `me-`, `text-start`) so the screen
|
|
15
|
+
turns around for right to left languages.
|
|
15
16
|
|
|
16
17
|
Room: the screen fills the element it is in (`h-full w-full`). The element is the page's, and it may be shorter than
|
|
17
18
|
the screen needs, so the screen scrolls inside it (`overflow-auto`) and never spills over what the page has below.
|
|
19
|
+
The screen also follows the width of that element, not the width of the window: it is a query container (`@container`),
|
|
20
|
+
and the parts below change their layout with `@3xl:` (768 and wider is the desktop layout, narrower is the phone one).
|
|
18
21
|
-->
|
|
19
22
|
<script lang="ts">
|
|
20
23
|
import { untrack } from 'svelte';
|
|
@@ -26,6 +29,7 @@
|
|
|
26
29
|
import { provideWorkflowsLanguage } from '../i18n/language.js';
|
|
27
30
|
import type { WorkflowsProps } from '../types/index.js';
|
|
28
31
|
import { workflowsError } from '../utils/logger.js';
|
|
32
|
+
import ActionButton from './ui/ActionButton.svelte';
|
|
29
33
|
import WorkflowsWorkspace from './WorkflowsWorkspace.svelte';
|
|
30
34
|
|
|
31
35
|
let {
|
|
@@ -87,7 +91,7 @@
|
|
|
87
91
|
|
|
88
92
|
<svelte:boundary onerror={reportRenderFailure}>
|
|
89
93
|
<section
|
|
90
|
-
class="flex h-full min-h-0 w-full flex-col overflow-auto bg-
|
|
94
|
+
class="@container flex h-full min-h-0 w-full flex-col overflow-auto bg-background font-sans text-body text-foreground {className}"
|
|
91
95
|
dir={$textDirection}
|
|
92
96
|
aria-label={$t('workflows.region.label')}
|
|
93
97
|
>
|
|
@@ -115,19 +119,13 @@
|
|
|
115
119
|
<!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
|
|
116
120
|
{#snippet failed(_error, reset)}
|
|
117
121
|
<section
|
|
118
|
-
class="flex h-full min-h-0 w-full flex-col items-center justify-center-safe gap-3 overflow-auto bg-
|
|
122
|
+
class="flex h-full min-h-0 w-full flex-col items-center justify-center-safe gap-3 overflow-auto bg-background p-6 text-center font-sans text-foreground {className}"
|
|
119
123
|
dir={$textDirection}
|
|
120
124
|
role="alert"
|
|
121
125
|
>
|
|
122
|
-
<h2 class="text-
|
|
123
|
-
<p class="max-w-md text-
|
|
124
|
-
<
|
|
125
|
-
type="button"
|
|
126
|
-
class="rounded-medium bg-primary-green px-4 py-2 text-sm font-medium text-white transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-green"
|
|
127
|
-
onclick={reset}
|
|
128
|
-
>
|
|
129
|
-
{$t('workflows.error.retry')}
|
|
130
|
-
</button>
|
|
126
|
+
<h2 class="text-heading-section text-destructive">{$t('workflows.error.title')}</h2>
|
|
127
|
+
<p class="max-w-md text-body text-muted-foreground">{$t('workflows.error.hint')}</p>
|
|
128
|
+
<ActionButton variant="primary" onclick={reset}>{$t('workflows.error.retry')}</ActionButton>
|
|
131
129
|
</section>
|
|
132
130
|
{/snippet}
|
|
133
131
|
</svelte:boundary>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
What the list shows while the workspace has no workflow yet: what a workflow is, and the button that makes the first one.
|
|
3
3
|
A list that is empty because a search or a filter matches nothing does not show this; it says so in a line of its own.
|
|
4
|
-
|
|
5
|
-
No fill: the palette's `ink-muted` reads at 4.6 to 1 on white and at 4.2 to 1 on `grey1`, which is under WCAG's 4.5 for
|
|
6
|
-
text this size, so the hints sit on the screen's own white and the box is drawn with its dashed border alone.
|
|
7
4
|
-->
|
|
8
5
|
<script lang="ts">
|
|
9
6
|
import { useWorkflowsLanguage } from '../i18n/language.js';
|
|
@@ -20,13 +17,18 @@
|
|
|
20
17
|
const { t } = useWorkflowsLanguage();
|
|
21
18
|
</script>
|
|
22
19
|
|
|
23
|
-
<div
|
|
24
|
-
class="flex
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
<div class="flex flex-1 flex-col items-center justify-center px-4 py-12">
|
|
21
|
+
<div class="flex w-120 max-w-full flex-col items-center gap-3 px-12 text-center">
|
|
22
|
+
<div class="flex size-12 items-center justify-center rounded-xl bg-brand-subtle">
|
|
23
|
+
<Icon name="route" class="size-4 text-brand-foreground" />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex w-full flex-col gap-1">
|
|
26
|
+
<h2 class="text-heading-section text-foreground">{$t('workflows.empty.title')}</h2>
|
|
27
|
+
<p class="text-body text-muted-foreground">{$t('workflows.empty.hint')}</p>
|
|
28
|
+
</div>
|
|
29
|
+
<ActionButton class="mt-3" variant="primary" onclick={oncreate}>
|
|
30
|
+
<Icon name="plus" class="size-4" />
|
|
31
|
+
{$t('workflows.list.newWorkflow')}
|
|
32
|
+
</ActionButton>
|
|
33
|
+
</div>
|
|
32
34
|
</div>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
The top of the list of workflows: its title
|
|
3
|
-
sits next to it, in the list.
|
|
2
|
+
The top of the list of workflows: its title only (the design has no subtitle).
|
|
4
3
|
-->
|
|
5
4
|
<script lang="ts">
|
|
6
5
|
import { useWorkflowsLanguage } from '../i18n/language.js';
|
|
7
6
|
|
|
8
7
|
const { t } = useWorkflowsLanguage();
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { class: className = '' }: Props = $props();
|
|
9
14
|
</script>
|
|
10
15
|
|
|
11
|
-
<header class="
|
|
12
|
-
<h1 class="text-
|
|
13
|
-
<p class="text-sm text-ink-muted">{$t('workflows.header.subtitle')}</p>
|
|
16
|
+
<header class="min-w-0 text-start {className}">
|
|
17
|
+
<h1 class="text-heading-page text-foreground">{$t('workflows.header.title')}</h1>
|
|
14
18
|
</header>
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
interface
|
|
2
|
-
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
interface Props {
|
|
2
|
+
class?: string;
|
|
13
3
|
}
|
|
14
|
-
declare const WorkflowsHeader:
|
|
15
|
-
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type WorkflowsHeader = InstanceType<typeof WorkflowsHeader>;
|
|
4
|
+
declare const WorkflowsHeader: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
type WorkflowsHeader = ReturnType<typeof WorkflowsHeader>;
|
|
18
6
|
export default WorkflowsHeader;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
{#if openId}
|
|
73
73
|
<!-- A room tall enough for the canvas even when the page's element is shorter: then the screen scrolls inside it. -->
|
|
74
|
-
<div class="flex min-h-
|
|
74
|
+
<div class="flex min-h-144 flex-1 flex-col">
|
|
75
75
|
{#key openId}
|
|
76
76
|
<WorkflowEditor
|
|
77
77
|
workflowId={openId}
|
|
@@ -84,7 +84,8 @@
|
|
|
84
84
|
{/key}
|
|
85
85
|
</div>
|
|
86
86
|
{:else}
|
|
87
|
-
|
|
87
|
+
<!-- The list keeps its own spacing (the page header, the toolbar and the rows each have theirs), as the design has it. -->
|
|
88
|
+
<div class="flex min-h-0 flex-1 flex-col">
|
|
88
89
|
<WorkflowList
|
|
89
90
|
onopen={(id) => open(id)}
|
|
90
91
|
onerror={onError}
|
|
@@ -76,13 +76,21 @@
|
|
|
76
76
|
heading: $t('workflows.addBlock.triggerHeading'),
|
|
77
77
|
items: TRIGGER_KINDS.map((kind) => {
|
|
78
78
|
const availability = readTriggerAvailability(anchorOption, kind);
|
|
79
|
+
const triggerIcon =
|
|
80
|
+
kind === 'pageEvent'
|
|
81
|
+
? ('bolt' as const)
|
|
82
|
+
: kind === 'action'
|
|
83
|
+
? ('click' as const)
|
|
84
|
+
: kind === 'input'
|
|
85
|
+
? ('forms' as const)
|
|
86
|
+
: ('clock' as const);
|
|
79
87
|
return {
|
|
80
88
|
key: kind,
|
|
81
89
|
label: $t(TRIGGER_KIND_MESSAGE_KEYS[kind]),
|
|
82
90
|
description: availability.enabled
|
|
83
91
|
? $t(TRIGGER_HELP_KEYS[kind])
|
|
84
92
|
: $t(CAPABILITY_REASON_MESSAGE_KEYS[availability.reason]),
|
|
85
|
-
icon:
|
|
93
|
+
icon: triggerIcon,
|
|
86
94
|
disabled: !availability.enabled,
|
|
87
95
|
onSelect: () => add({ kind: 'trigger', triggerKind: kind })
|
|
88
96
|
};
|
|
@@ -96,6 +104,7 @@
|
|
|
96
104
|
{groups}
|
|
97
105
|
label={$t('workflows.toolbar.addBlock')}
|
|
98
106
|
icon="plus"
|
|
99
|
-
variant="
|
|
107
|
+
variant="accent"
|
|
100
108
|
size="small"
|
|
109
|
+
placement="above"
|
|
101
110
|
/>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
The tools laid over the canvas: Add block, zoom out, zoom in, fit to the screen, undo and redo. They sit in the
|
|
3
|
-
of the canvas
|
|
4
|
-
|
|
2
|
+
The tools laid over the canvas: Add block, zoom out, zoom in, fit to the screen, undo and redo. They sit in the bottom
|
|
3
|
+
start corner of the canvas (inset 16). A canvas that cannot be changed (a version, an archived workflow, a workflow a
|
|
4
|
+
teammate is editing) keeps the zoom and fit tools and drops the ones that change the workflow. On a touch screen the
|
|
5
|
+
canvas itself only shows, but the Add block menu stays: a block is added from the menu and changed in the panel.
|
|
5
6
|
-->
|
|
6
7
|
<script lang="ts">
|
|
7
8
|
import { useEditorState } from '../../editor/editorState.svelte.js';
|
|
@@ -13,9 +14,11 @@
|
|
|
13
14
|
interface Props {
|
|
14
15
|
/** Whether the workflow can be changed from the canvas (the Add block menu, undo and redo are shown only then). */
|
|
15
16
|
canEdit: boolean;
|
|
17
|
+
/** Current zoom factor from the canvas viewport (toolbar label reacts via `onViewportZoom`). */
|
|
18
|
+
zoomLevel: number;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
let { canEdit }: Props = $props();
|
|
21
|
+
let { canEdit, zoomLevel }: Props = $props();
|
|
19
22
|
|
|
20
23
|
const editor = useEditorState();
|
|
21
24
|
const { t } = useWorkflowsLanguage();
|
|
@@ -26,16 +29,43 @@
|
|
|
26
29
|
export function openAddBlock(): void {
|
|
27
30
|
addBlockMenu?.open();
|
|
28
31
|
}
|
|
32
|
+
|
|
33
|
+
const zoomLabel = $derived(
|
|
34
|
+
$t('workflows.toolbar.zoomLevel', { number: Math.round(zoomLevel * 100) })
|
|
35
|
+
);
|
|
29
36
|
</script>
|
|
30
37
|
|
|
31
38
|
<div
|
|
32
|
-
class="absolute
|
|
39
|
+
class="absolute bottom-4 start-4 z-20 flex h-10 items-center gap-1 rounded-xl border border-border bg-background p-1 shadow-floating"
|
|
33
40
|
role="toolbar"
|
|
34
41
|
aria-label={$t('workflows.toolbar.label')}
|
|
35
42
|
>
|
|
36
43
|
{#if canEdit}
|
|
37
44
|
<AddBlockMenu bind:this={addBlockMenu} />
|
|
38
|
-
<span class="mx-1 h-5
|
|
45
|
+
<span class="mx-1 h-5 w-px shrink-0 bg-border" aria-hidden="true"></span>
|
|
46
|
+
<ActionButton
|
|
47
|
+
variant="ghost"
|
|
48
|
+
size="small"
|
|
49
|
+
iconOnly
|
|
50
|
+
disabled={!editor.canvas?.canUndo}
|
|
51
|
+
ariaLabel={$t('workflows.toolbar.undo')}
|
|
52
|
+
title={$t('workflows.toolbar.undo')}
|
|
53
|
+
onclick={() => editor.canvas?.undo()}
|
|
54
|
+
>
|
|
55
|
+
<Icon name="undo" />
|
|
56
|
+
</ActionButton>
|
|
57
|
+
<ActionButton
|
|
58
|
+
variant="ghost"
|
|
59
|
+
size="small"
|
|
60
|
+
iconOnly
|
|
61
|
+
disabled={!editor.canvas?.canRedo}
|
|
62
|
+
ariaLabel={$t('workflows.toolbar.redo')}
|
|
63
|
+
title={$t('workflows.toolbar.redo')}
|
|
64
|
+
onclick={() => editor.canvas?.redo()}
|
|
65
|
+
>
|
|
66
|
+
<Icon name="redo" />
|
|
67
|
+
</ActionButton>
|
|
68
|
+
<span class="mx-1 h-5 w-px shrink-0 bg-border" aria-hidden="true"></span>
|
|
39
69
|
{/if}
|
|
40
70
|
<ActionButton
|
|
41
71
|
variant="ghost"
|
|
@@ -47,6 +77,12 @@
|
|
|
47
77
|
>
|
|
48
78
|
<Icon name="zoomOut" />
|
|
49
79
|
</ActionButton>
|
|
80
|
+
<span
|
|
81
|
+
class="flex w-8 shrink-0 justify-center text-caption-medium text-muted-foreground tabular-nums"
|
|
82
|
+
aria-live="polite"
|
|
83
|
+
>
|
|
84
|
+
{zoomLabel}
|
|
85
|
+
</span>
|
|
50
86
|
<ActionButton
|
|
51
87
|
variant="ghost"
|
|
52
88
|
size="small"
|
|
@@ -67,29 +103,4 @@
|
|
|
67
103
|
>
|
|
68
104
|
<Icon name="fit" />
|
|
69
105
|
</ActionButton>
|
|
70
|
-
{#if canEdit}
|
|
71
|
-
<span class="mx-1 h-5 border-s border-grey2" aria-hidden="true"></span>
|
|
72
|
-
<ActionButton
|
|
73
|
-
variant="ghost"
|
|
74
|
-
size="small"
|
|
75
|
-
iconOnly
|
|
76
|
-
disabled={!editor.canvas?.canUndo}
|
|
77
|
-
ariaLabel={$t('workflows.toolbar.undo')}
|
|
78
|
-
title={$t('workflows.toolbar.undo')}
|
|
79
|
-
onclick={() => editor.canvas?.undo()}
|
|
80
|
-
>
|
|
81
|
-
<Icon name="undo" />
|
|
82
|
-
</ActionButton>
|
|
83
|
-
<ActionButton
|
|
84
|
-
variant="ghost"
|
|
85
|
-
size="small"
|
|
86
|
-
iconOnly
|
|
87
|
-
disabled={!editor.canvas?.canRedo}
|
|
88
|
-
ariaLabel={$t('workflows.toolbar.redo')}
|
|
89
|
-
title={$t('workflows.toolbar.redo')}
|
|
90
|
-
onclick={() => editor.canvas?.redo()}
|
|
91
|
-
>
|
|
92
|
-
<Icon name="redo" />
|
|
93
|
-
</ActionButton>
|
|
94
|
-
{/if}
|
|
95
106
|
</div>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
/** Whether the workflow can be changed from the canvas (the Add block menu, undo and redo are shown only then). */
|
|
3
3
|
canEdit: boolean;
|
|
4
|
+
/** Current zoom factor from the canvas viewport (toolbar label reacts via `onViewportZoom`). */
|
|
5
|
+
zoomLevel: number;
|
|
4
6
|
}
|
|
5
7
|
declare const CanvasToolbar: import("svelte").Component<Props, {
|
|
6
8
|
openAddBlock: () => void;
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
} from '../../editor/flowAdapter.js';
|
|
20
20
|
import { useCanvasContext } from '../../editor/canvasContext.js';
|
|
21
21
|
import { useWorkflowsLanguage } from '../../i18n/language.js';
|
|
22
|
+
import Badge from '../ui/Badge.svelte';
|
|
22
23
|
import Icon from '../ui/Icon.svelte';
|
|
23
24
|
import HandlePoint from './HandlePoint.svelte';
|
|
24
25
|
|
|
25
|
-
let { id, data }: NodeProps<WorkflowBlockData> = $props();
|
|
26
|
+
let { id, data, selected, status }: NodeProps<WorkflowBlockData> = $props();
|
|
26
27
|
|
|
27
28
|
const { t } = useWorkflowsLanguage();
|
|
28
29
|
const textDirection = useTextDirection();
|
|
@@ -42,7 +43,16 @@
|
|
|
42
43
|
if (composition === null) return $t('workflows.block.compositionUnavailable');
|
|
43
44
|
return composition?.name?.trim() ? composition.name : $t('workflows.block.compositionLoading');
|
|
44
45
|
});
|
|
45
|
-
const
|
|
46
|
+
const isEmpty = $derived(!node.compositionId);
|
|
47
|
+
const isTitleMuted = $derived(isEmpty || composition === null);
|
|
48
|
+
|
|
49
|
+
const metaLine = $derived.by(() => {
|
|
50
|
+
if (isEmpty) return $t('workflows.block.emptyCompositionHelp');
|
|
51
|
+
if (composition === null || composition === undefined) return '';
|
|
52
|
+
return composition.published
|
|
53
|
+
? $t('workflows.block.publishedMeta')
|
|
54
|
+
: $t('workflows.block.draftMeta');
|
|
55
|
+
});
|
|
46
56
|
|
|
47
57
|
/** A picture that failed to load is left out, and the block looks as it would without one. It is tried again for another address. */
|
|
48
58
|
const thumbnailUrl = $derived(composition?.thumbnailUrl ?? null);
|
|
@@ -50,50 +60,62 @@
|
|
|
50
60
|
const hasThumbnailFailed = $derived(
|
|
51
61
|
failedThumbnailUrl !== null && failedThumbnailUrl === thumbnailUrl
|
|
52
62
|
);
|
|
63
|
+
|
|
64
|
+
const rootBorder = $derived.by(() => {
|
|
65
|
+
if (status === 'error') return 'border-2 border-destructive';
|
|
66
|
+
if (selected) return 'border-2 border-primary';
|
|
67
|
+
if (isEmpty) return 'border border-dashed border-input';
|
|
68
|
+
return 'border border-border';
|
|
69
|
+
});
|
|
53
70
|
</script>
|
|
54
71
|
|
|
55
72
|
<div
|
|
56
|
-
class="relative flex w-
|
|
73
|
+
class="relative flex w-60 flex-col overflow-hidden rounded-xl bg-background text-start text-foreground {rootBorder}"
|
|
57
74
|
dir={$textDirection}
|
|
58
75
|
data-workflow-block="composition"
|
|
59
76
|
>
|
|
60
|
-
<div class="
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
<div class="relative h-28 w-full shrink-0 overflow-hidden rounded-t-xl bg-muted">
|
|
78
|
+
{#if thumbnailUrl && !hasThumbnailFailed}
|
|
79
|
+
<img
|
|
80
|
+
src={thumbnailUrl}
|
|
81
|
+
alt=""
|
|
82
|
+
loading="lazy"
|
|
83
|
+
draggable="false"
|
|
84
|
+
class="h-full w-full object-cover"
|
|
85
|
+
onerror={() => (failedThumbnailUrl = thumbnailUrl)}
|
|
86
|
+
/>
|
|
87
|
+
{:else}
|
|
88
|
+
<div class="flex h-full w-full items-center justify-center">
|
|
89
|
+
<Icon name="composition" class="size-4 text-muted-foreground" />
|
|
90
|
+
</div>
|
|
91
|
+
{/if}
|
|
68
92
|
{#if node.startsHere}
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
>
|
|
72
|
-
{$t('workflows.block.startsHere')}
|
|
73
|
-
</span>
|
|
93
|
+
<div class="absolute top-2 start-2">
|
|
94
|
+
<Badge tone="brand">{$t('workflows.block.startsHere')}</Badge>
|
|
95
|
+
</div>
|
|
74
96
|
{/if}
|
|
75
97
|
</div>
|
|
76
98
|
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
<div class="flex flex-col gap-0.5 p-3">
|
|
100
|
+
<div class="flex items-start gap-2">
|
|
101
|
+
<p
|
|
102
|
+
class="min-w-0 flex-1 truncate text-body-medium {isTitleMuted
|
|
103
|
+
? 'text-muted-foreground'
|
|
104
|
+
: 'text-foreground'}"
|
|
105
|
+
dir={isTitleMuted ? undefined : 'auto'}
|
|
106
|
+
>
|
|
107
|
+
{title}
|
|
108
|
+
</p>
|
|
109
|
+
{#if problemCount > 0}
|
|
110
|
+
<Badge tone="destructive" class="shrink-0">
|
|
111
|
+
{$t('workflows.block.problems', { count: problemCount })}
|
|
112
|
+
</Badge>
|
|
113
|
+
{/if}
|
|
114
|
+
</div>
|
|
115
|
+
{#if metaLine}
|
|
116
|
+
<p class="text-caption text-muted-foreground">{metaLine}</p>
|
|
117
|
+
{/if}
|
|
118
|
+
</div>
|
|
97
119
|
|
|
98
120
|
<HandlePoint
|
|
99
121
|
id={INPUT_HANDLE_ID}
|