@widgetic/workflows 0.2.6 → 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 +51 -44
- package/dist/api/types.d.ts +17 -0
- package/dist/api/types.js +7 -0
- package/dist/api/workflowsApi.js +23 -2
- 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 +136 -42
- 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/editor/runsFlow.d.ts +28 -3
- package/dist/editor/runsFlow.js +27 -2
- package/dist/editor/runsFlowLayout.d.ts +6 -2
- package/dist/editor/runsFlowLayout.js +7 -2
- package/dist/editor/statsRange.d.ts +7 -1
- package/dist/editor/statsRange.js +14 -0
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +32 -13
- package/dist/i18n/messages.js +33 -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
|
@@ -44,7 +44,8 @@ Workflows are for **Teams and partner accounts** only. On Widgetic the page is
|
|
|
44
44
|
went that way. Several bands that leave one bar are the alternatives of the workflow (each rule of a condition and its
|
|
45
45
|
Default path is a band), a band that skips a step runs in a lane between the bars, the hollow part of a bar is the
|
|
46
46
|
visitors who reached it and did not go on, and a red part under a bar is the times that composition could not be shown
|
|
47
|
-
(a failing step says where
|
|
47
|
+
(a failing step says where, and under its number the words say why when the embeds told: took too long, had a widget
|
|
48
|
+
error, could not be built on the page, or another reason). Counts only: what a visitor typed is never stored. It is drawn from the
|
|
48
49
|
three parts in `src/lib/editor/runs*.ts` (the model, the layout in pixels, the words) and
|
|
49
50
|
`src/lib/components/editor/RunsFlow.svelte`, so the Widgetic site, the Shopify app and a partner's page all show the
|
|
50
51
|
same chart.
|
|
@@ -54,7 +55,8 @@ Workflows are for **Teams and partner accounts** only. On Widgetic the page is
|
|
|
54
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
|
|
55
56
|
the bar above the canvas.
|
|
56
57
|
- Speaks the page's language (`locale`, `messages`) and turns around for right to left (`dir`).
|
|
57
|
-
-
|
|
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.
|
|
58
60
|
- Reports what goes wrong to the page (`onError`) and shows the visitor a "Try again" in place of a part that failed.
|
|
59
61
|
|
|
60
62
|
## Where it is loaded
|
|
@@ -77,7 +79,10 @@ npm install @widgetic/workflows @widgetic/design-system svelte
|
|
|
77
79
|
page. The package needs Svelte 5.
|
|
78
80
|
|
|
79
81
|
**Styles.** The components are styled with Tailwind classes and ship no stylesheet of their own, so the host's Tailwind
|
|
80
|
-
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:
|
|
81
86
|
|
|
82
87
|
```css
|
|
83
88
|
@import '@widgetic/design-system/styles';
|
|
@@ -165,33 +170,36 @@ not ask, ends the looking and the list goes on without badges. A badge never shu
|
|
|
165
170
|
|
|
166
171
|
## Look and feel
|
|
167
172
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
| `--
|
|
176
|
-
| `--
|
|
177
|
-
| `--
|
|
178
|
-
| `--primary-
|
|
179
|
-
| `--
|
|
180
|
-
| `--
|
|
181
|
-
| `--
|
|
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. |
|
|
182
190
|
|
|
183
191
|
```css
|
|
184
192
|
.my-workflows-host {
|
|
185
|
-
--primary
|
|
186
|
-
--
|
|
187
|
-
--
|
|
188
|
-
--
|
|
189
|
-
--
|
|
190
|
-
--
|
|
193
|
+
--primary: #5b21b6;
|
|
194
|
+
--primary-foreground: #ffffff;
|
|
195
|
+
--foreground: #1e1b2e;
|
|
196
|
+
--muted-foreground: #5f5a73;
|
|
197
|
+
--border: #d9d4ea;
|
|
198
|
+
--radius-xl: 2px;
|
|
191
199
|
}
|
|
192
200
|
```
|
|
193
201
|
|
|
194
|
-
The surface is
|
|
202
|
+
The surface is the design system's `bg-background`. Inside a ui-sdk module it follows the theme's `background`.
|
|
195
203
|
|
|
196
204
|
**For partners** the module takes a `theme` (a preset or `{ colors, radius, font }`), and the module spreads it over
|
|
197
205
|
these properties, so a partner never writes one by hand.
|
|
@@ -199,11 +207,9 @@ these properties, so a partner never writes one by hand.
|
|
|
199
207
|
**For the people who write this package:** a colour, a font or a corner in a component is a token, never a literal.
|
|
200
208
|
`tests/workflows-theming.test.mjs` fails on a hex colour, a colour function, a colour of Tailwind's own palette, an
|
|
201
209
|
arbitrary value or a `style` attribute, and says what to write instead. Placement uses the start and the end of a line
|
|
202
|
-
(`ms-`, `me-`, `text-start`), never a physical side; `tests/workflows-direction.test.mjs` fails on
|
|
203
|
-
the like unless the line says why with the note `rtl-ok`.
|
|
204
|
-
|
|
205
|
-
The shadcn names (`--background`, `--foreground`, `--muted`) are **not** what this package reads. The Widgetic site does
|
|
206
|
-
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"`.
|
|
207
213
|
|
|
208
214
|
## Languages
|
|
209
215
|
|
|
@@ -287,21 +293,22 @@ The why and the silent-degrade failure mode live in [the dev-tools README](../de
|
|
|
287
293
|
|
|
288
294
|
`npm test` runs the guards in Node, with no browser. Each one protects a promise the package makes to its hosts:
|
|
289
295
|
|
|
290
|
-
| File
|
|
291
|
-
|
|
|
292
|
-
| `tests/workflows-words.test.mjs`
|
|
293
|
-
| `tests/workflows-words-audit.test.mjs`
|
|
294
|
-
| `tests/workflows-direction.test.mjs`
|
|
295
|
-
| `tests/workflows-theming.test.mjs`
|
|
296
|
-
| `tests/workflows-logger.test.mjs`
|
|
297
|
-
| `tests/no-service-key.test.mjs`
|
|
298
|
-
| `tests/package-shape.test.mjs`
|
|
299
|
-
| `tests/workflows-api.test.mjs`
|
|
300
|
-
| `tests/workflows-editor-model.test.mjs`
|
|
301
|
-
| `tests/workflows-graph-diff.test.mjs`
|
|
302
|
-
| `tests/workflows-autosave.test.mjs`
|
|
303
|
-
| `tests/workflows-layout.test.mjs`
|
|
304
|
-
| `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. |
|
|
305
312
|
|
|
306
313
|
Before a change is done: `npm run check` (0 errors, 0 warnings), `npm test`, `npm run lint` and `npm run package`.
|
|
307
314
|
|
package/dist/api/types.d.ts
CHANGED
|
@@ -12,6 +12,14 @@ export type WorkflowStatus = 'draft' | 'live' | 'paused' | 'archived';
|
|
|
12
12
|
export declare const WORKFLOW_STATUSES: readonly WorkflowStatus[];
|
|
13
13
|
/** The longest name a workflow can have: the gateway's own limit, so a name typed here is never refused for its length. */
|
|
14
14
|
export declare const MAX_WORKFLOW_NAME_LENGTH = 120;
|
|
15
|
+
/**
|
|
16
|
+
* Why a composition could not be shown to a visitor, in the four words the gateway counts: `timeout` (it did not say it was up
|
|
17
|
+
* in time), `widget_error` (the widget reported that it could not start), `build` (the embed could not build the step) and
|
|
18
|
+
* `other`. A closed list: the counts never carry a message, a code or anything a visitor wrote.
|
|
19
|
+
*/
|
|
20
|
+
export type WorkflowFailureReason = 'timeout' | 'widget_error' | 'build' | 'other';
|
|
21
|
+
/** The reasons in the order the Runs tab lists them. */
|
|
22
|
+
export declare const WORKFLOW_FAILURE_REASONS: readonly WorkflowFailureReason[];
|
|
15
23
|
/** What the list can be ordered by (the four columns it shows). */
|
|
16
24
|
export type WorkflowSortField = 'createdAt' | 'lastPublishedAt' | 'runsCount' | 'name';
|
|
17
25
|
export type SortDirection = 'asc' | 'desc';
|
|
@@ -94,6 +102,15 @@ export interface WorkflowStats {
|
|
|
94
102
|
id: string;
|
|
95
103
|
total: number;
|
|
96
104
|
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Why they could not be shown, for the tries whose embed said why: a count for each composition and reason (never more in
|
|
107
|
+
* all, for a composition, than its `failed`). Empty from a gateway that does not tell, and for tries of an older embed.
|
|
108
|
+
*/
|
|
109
|
+
failedReasons: Array<{
|
|
110
|
+
id: string;
|
|
111
|
+
reason: WorkflowFailureReason;
|
|
112
|
+
total: number;
|
|
113
|
+
}>;
|
|
97
114
|
}
|
|
98
115
|
/** Why a trigger is not available on a composition. */
|
|
99
116
|
export type CapabilityReason = 'widget_keeps_no_data' | 'widget_reports_no_actions' | 'widget_not_published';
|
package/dist/api/types.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export const WORKFLOW_STATUSES = ['draft', 'live', 'paused', 'archived'];
|
|
2
2
|
/** The longest name a workflow can have: the gateway's own limit, so a name typed here is never refused for its length. */
|
|
3
3
|
export const MAX_WORKFLOW_NAME_LENGTH = 120;
|
|
4
|
+
/** The reasons in the order the Runs tab lists them. */
|
|
5
|
+
export const WORKFLOW_FAILURE_REASONS = [
|
|
6
|
+
'timeout',
|
|
7
|
+
'widget_error',
|
|
8
|
+
'build',
|
|
9
|
+
'other'
|
|
10
|
+
];
|
package/dist/api/workflowsApi.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { parseGraph } from '@widgetic/workflows-engine';
|
|
36
36
|
import { workflowsWarn } from '../utils/logger.js';
|
|
37
|
-
import { WORKFLOW_STATUSES } from './types.js';
|
|
37
|
+
import { WORKFLOW_FAILURE_REASONS, WORKFLOW_STATUSES } from './types.js';
|
|
38
38
|
/** How long a request may take before it is given up: the reads, and the writes (a publish reads every composition). */
|
|
39
39
|
export const READ_TIMEOUT_MS = 15_000;
|
|
40
40
|
export const WRITE_TIMEOUT_MS = 30_000;
|
|
@@ -280,6 +280,26 @@ function readCounts(value, what) {
|
|
|
280
280
|
}
|
|
281
281
|
return counts;
|
|
282
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* The reasons a composition could not be shown, as the gateway counts them. The list is optional (an older gateway does not
|
|
285
|
+
* send it) and read entry by entry: an entry that cannot be read is left out, and a reason this screen does not know (a newer
|
|
286
|
+
* gateway may name more) is counted as `other`, which is what it is to this screen. Never a reason to refuse the counts.
|
|
287
|
+
*/
|
|
288
|
+
function readFailureReasons(value) {
|
|
289
|
+
if (!Array.isArray(value))
|
|
290
|
+
return [];
|
|
291
|
+
const reasons = [];
|
|
292
|
+
for (const entry of value) {
|
|
293
|
+
if (!isRecord(entry) ||
|
|
294
|
+
typeof entry.id !== 'string' ||
|
|
295
|
+
typeof entry.total !== 'number' ||
|
|
296
|
+
!Number.isFinite(entry.total))
|
|
297
|
+
continue;
|
|
298
|
+
const known = WORKFLOW_FAILURE_REASONS.find((reason) => reason === entry.reason);
|
|
299
|
+
reasons.push({ id: entry.id, reason: known ?? 'other', total: entry.total });
|
|
300
|
+
}
|
|
301
|
+
return reasons;
|
|
302
|
+
}
|
|
283
303
|
function readStats(data) {
|
|
284
304
|
if (!isRecord(data))
|
|
285
305
|
throw invalidResponse('the counts');
|
|
@@ -292,7 +312,8 @@ function readStats(data) {
|
|
|
292
312
|
started: typeof started === 'number' && Number.isFinite(started) ? started : null,
|
|
293
313
|
nodes: readCounts(data.nodes, 'the counts (nodes)'),
|
|
294
314
|
edges: readCounts(data.edges, 'the counts (edges)'),
|
|
295
|
-
failed: readCounts(data.failed, 'the counts (failed)')
|
|
315
|
+
failed: readCounts(data.failed, 'the counts (failed)'),
|
|
316
|
+
failedReasons: readFailureReasons(data.failedReasons)
|
|
296
317
|
};
|
|
297
318
|
}
|
|
298
319
|
const FIELD_TYPES = ['text', 'number', 'boolean'];
|
|
@@ -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;
|