@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.
Files changed (82) hide show
  1. package/README.md +49 -43
  2. package/dist/components/Workflows.svelte +13 -15
  3. package/dist/components/WorkflowsEmptyState.svelte +14 -12
  4. package/dist/components/WorkflowsHeader.svelte +9 -5
  5. package/dist/components/WorkflowsHeader.svelte.d.ts +4 -16
  6. package/dist/components/WorkflowsWorkspace.svelte +3 -2
  7. package/dist/components/canvas/AddBlockMenu.svelte +11 -2
  8. package/dist/components/canvas/CanvasToolbar.svelte +42 -31
  9. package/dist/components/canvas/CanvasToolbar.svelte.d.ts +2 -0
  10. package/dist/components/canvas/CompositionNodeView.svelte +58 -36
  11. package/dist/components/canvas/ConditionNodeView.svelte +31 -18
  12. package/dist/components/canvas/HandlePoint.svelte +10 -3
  13. package/dist/components/canvas/HandlePoint.svelte.d.ts +1 -1
  14. package/dist/components/canvas/TriggerNodeView.svelte +39 -13
  15. package/dist/components/canvas/WorkflowCanvas.svelte +22 -7
  16. package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +2 -0
  17. package/dist/components/canvas/WorkflowEdgeView.svelte +5 -6
  18. package/dist/components/editor/ConflictBanner.svelte +1 -1
  19. package/dist/components/editor/EditorBanners.svelte +11 -4
  20. package/dist/components/editor/EditorCanvasArea.svelte +17 -10
  21. package/dist/components/editor/EditorTabs.svelte +10 -44
  22. package/dist/components/editor/EditorTopBar.svelte +166 -54
  23. package/dist/components/editor/PresenceBanner.svelte +106 -85
  24. package/dist/components/editor/RunsFlow.svelte +100 -17
  25. package/dist/components/editor/RunsTab.svelte +52 -46
  26. package/dist/components/editor/SettingsRow.svelte +35 -0
  27. package/dist/components/editor/SettingsRow.svelte.d.ts +14 -0
  28. package/dist/components/editor/SettingsTab.svelte +66 -50
  29. package/dist/components/editor/WorkflowEditor.svelte +4 -5
  30. package/dist/components/list/CreateWorkflowDialog.svelte +123 -73
  31. package/dist/components/list/WorkflowList.svelte +227 -100
  32. package/dist/components/list/WorkflowRow.svelte +84 -42
  33. package/dist/components/panel/BlockProblems.svelte +9 -8
  34. package/dist/components/panel/CompositionForm.svelte +52 -34
  35. package/dist/components/panel/CompositionPicker.svelte +43 -21
  36. package/dist/components/panel/CompositionPicker.svelte.d.ts +5 -0
  37. package/dist/components/panel/CompositionSelect.svelte +105 -0
  38. package/dist/components/panel/CompositionSelect.svelte.d.ts +23 -0
  39. package/dist/components/panel/ConditionForm.svelte +50 -17
  40. package/dist/components/panel/EventValueRow.svelte +5 -4
  41. package/dist/components/panel/ProblemsList.svelte +17 -19
  42. package/dist/components/panel/RuleCard.svelte +127 -89
  43. package/dist/components/panel/RuleCard.svelte.d.ts +2 -0
  44. package/dist/components/panel/SidePanel.svelte +101 -50
  45. package/dist/components/panel/TestResultLine.svelte +35 -0
  46. package/dist/components/panel/TestResultLine.svelte.d.ts +9 -0
  47. package/dist/components/panel/TestRow.svelte +21 -18
  48. package/dist/components/panel/TestRunPanel.svelte +61 -39
  49. package/dist/components/panel/TestTriggerCard.svelte +66 -6
  50. package/dist/components/panel/TestTriggerCard.svelte.d.ts +10 -0
  51. package/dist/components/panel/TriggerForm.svelte +24 -25
  52. package/dist/components/panel/VersionHistory.svelte +31 -43
  53. package/dist/components/ui/ActionButton.svelte +44 -12
  54. package/dist/components/ui/ActionButton.svelte.d.ts +2 -1
  55. package/dist/components/ui/Badge.svelte +39 -0
  56. package/dist/components/ui/Badge.svelte.d.ts +12 -0
  57. package/dist/components/ui/ConfirmDialog.svelte +4 -3
  58. package/dist/components/ui/Menu.svelte +28 -14
  59. package/dist/components/ui/Menu.svelte.d.ts +3 -1
  60. package/dist/components/ui/Modal.svelte +15 -8
  61. package/dist/components/ui/Notice.svelte +35 -11
  62. package/dist/components/ui/Notice.svelte.d.ts +4 -1
  63. package/dist/components/ui/SelectField.svelte +48 -20
  64. package/dist/components/ui/SelectField.svelte.d.ts +2 -0
  65. package/dist/components/ui/StatusBadge.svelte +13 -24
  66. package/dist/components/ui/StatusBadge.svelte.d.ts +0 -2
  67. package/dist/components/ui/Tabs.svelte +79 -0
  68. package/dist/components/ui/Tabs.svelte.d.ts +21 -0
  69. package/dist/components/ui/TextField.svelte +47 -27
  70. package/dist/components/ui/TextField.svelte.d.ts +5 -0
  71. package/dist/components/ui/icons.d.ts +43 -29
  72. package/dist/components/ui/icons.js +101 -40
  73. package/dist/editor/editorState.svelte.d.ts +23 -2
  74. package/dist/editor/editorState.svelte.js +36 -0
  75. package/dist/editor/listState.svelte.d.ts +32 -2
  76. package/dist/editor/listState.svelte.js +41 -0
  77. package/dist/i18n/language.d.ts +3 -3
  78. package/dist/i18n/messages.d.ts +22 -13
  79. package/dist/i18n/messages.js +23 -14
  80. package/dist/i18n/statusWords.d.ts +12 -0
  81. package/dist/i18n/statusWords.js +12 -0
  82. package/package.json +3 -3
@@ -145,53 +145,59 @@
145
145
  });
146
146
  </script>
147
147
 
148
- <div class="flex min-h-0 flex-1 flex-col gap-3 p-4">
149
- {#if !hasBeenPublished}
150
- <p class="py-10 text-center text-sm text-ink-muted">{$t('workflows.runs.neverPublished')}</p>
151
- {:else}
152
- <div class="flex flex-wrap items-end gap-3">
153
- <SelectField
154
- class="w-48"
155
- label={$t('workflows.runs.rangeLabel')}
156
- bind:value={rangeDays}
157
- choices={rangeChoices}
158
- onchange={(chosenDays) => reload(Number(chosenDays), versionId)}
159
- />
160
- <SelectField
161
- class="w-56"
162
- label={$t('workflows.runs.versionLabel')}
163
- bind:value={versionId}
164
- choices={versionChoices}
165
- onchange={(chosenVersionId) => reload(Number(rangeDays), chosenVersionId)}
166
- />
167
- {#if startedText}
168
- <p class="pb-2 text-sm" aria-live="polite">{startedText}</p>
148
+ <div class="flex min-h-0 flex-1 flex-col overflow-auto px-4 pb-8 pt-2 @3xl:px-0">
149
+ <div class="mx-auto flex w-full max-w-content flex-col gap-4">
150
+ {#if !hasBeenPublished}
151
+ <!-- The design puts this one line 64px below the tabs: 16 of gap and 48 of room, both steps of the scale. -->
152
+ <p class="my-4 py-12 text-center text-body text-muted-foreground">
153
+ {$t('workflows.runs.neverPublished')}
154
+ </p>
155
+ {:else}
156
+ <!-- The two choices, each with its label above (Figma "filters"), and how many visitors started beside them. -->
157
+ <div class="flex flex-col gap-3 @3xl:flex-row @3xl:items-end">
158
+ <SelectField
159
+ class="w-full min-w-0 @3xl:w-48"
160
+ label={$t('workflows.runs.rangeLabel')}
161
+ bind:value={rangeDays}
162
+ choices={rangeChoices}
163
+ onchange={(chosenDays) => reload(Number(chosenDays), versionId)}
164
+ />
165
+ <SelectField
166
+ class="w-full min-w-0 @3xl:w-56"
167
+ label={$t('workflows.runs.versionLabel')}
168
+ bind:value={versionId}
169
+ choices={versionChoices}
170
+ onchange={(chosenVersionId) => reload(Number(rangeDays), chosenVersionId)}
171
+ />
172
+ {#if startedText}
173
+ <p class="text-body text-foreground @3xl:pb-2" aria-live="polite">{startedText}</p>
174
+ {/if}
175
+ </div>
176
+ <p class="text-caption text-muted-foreground">{$t('workflows.runs.help')}</p>
177
+ <!-- Nobody came in the period: the chart below still shows the place of every bar, empty. -->
178
+ {#if shown && shown.counts.busiest === 0 && loadState === 'ready'}
179
+ <p class="text-caption text-muted-foreground" role="status">{$t('workflows.runs.none')}</p>
180
+ {/if}
181
+ {#if loadState === 'failed'}
182
+ <Notice tone="problem">
183
+ {failureKey ? $t(failureKey) : ''}
184
+ {#snippet action()}
185
+ <ActionButton size="small" onclick={() => void load(Number(rangeDays), versionId)}
186
+ >{$t('workflows.error.retry')}</ActionButton
187
+ >
188
+ {/snippet}
189
+ </Notice>
169
190
  {/if}
170
- </div>
171
- <p class="text-xs text-ink-muted">{$t('workflows.runs.help')}</p>
172
- {#if shown && shown.counts.busiest === 0 && loadState === 'ready'}
173
- <p class="text-xs text-ink-muted" role="status">{$t('workflows.runs.none')}</p>
174
- {/if}
175
191
 
176
- {#if loadState === 'failed'}
177
- <Notice tone="problem">
178
- {failureKey ? $t(failureKey) : ''}
179
- {#snippet action()}
180
- <ActionButton size="small" onclick={() => void load(Number(rangeDays), versionId)}
181
- >{$t('workflows.error.retry')}</ActionButton
182
- >
183
- {/snippet}
184
- </Notice>
192
+ <div class="flex min-h-80 min-w-0 flex-1 flex-col" aria-busy={loadState === 'loading'}>
193
+ {#if shown && flowWords}
194
+ <RunsFlow graph={shown.graph} counts={shown.counts} words={flowWords} />
195
+ {:else if loadState === 'loading'}
196
+ <p class="py-8 text-center text-body text-muted-foreground" role="status">
197
+ {$t('workflows.common.loading')}
198
+ </p>
199
+ {/if}
200
+ </div>
185
201
  {/if}
186
-
187
- <div class="flex min-h-80 flex-1 flex-col" aria-busy={loadState === 'loading'}>
188
- {#if shown && flowWords}
189
- <RunsFlow graph={shown.graph} counts={shown.counts} words={flowWords} />
190
- {:else if loadState === 'loading'}
191
- <p class="py-10 text-center text-sm text-ink-muted" role="status">
192
- {$t('workflows.common.loading')}
193
- </p>
194
- {/if}
195
- </div>
196
- {/if}
202
+ </div>
197
203
  </div>
@@ -0,0 +1,35 @@
1
+ <!--
2
+ One row of the Settings tab (Figma "action / …"): what can be done, said with a title and a line under it, and the button
3
+ that does it at the end of the row. The rows of a section are told apart by a line under each; on a narrow screen the
4
+ button goes under the words and takes the whole width, so a thumb can reach it.
5
+
6
+ The title is red when what the button does cannot be undone (deleting).
7
+ -->
8
+ <script lang="ts">
9
+ import type { Snippet } from 'svelte';
10
+
11
+ interface Props {
12
+ /** What the row is about ("Pause"). */
13
+ title: string;
14
+ /** One sentence that says what the button does. */
15
+ description: string;
16
+ /** `danger` colours the title red; the button the row is given carries its own look. */
17
+ tone?: 'normal' | 'danger';
18
+ /** The button at the end of the row. */
19
+ children: Snippet;
20
+ }
21
+
22
+ let { title, description, tone = 'normal', children }: Props = $props();
23
+ </script>
24
+
25
+ <div
26
+ class="flex flex-col gap-3 border-b border-border py-4 @3xl:flex-row @3xl:items-center @3xl:gap-4"
27
+ >
28
+ <div class="flex min-w-0 flex-1 flex-col gap-0.5">
29
+ <p class="text-body-medium {tone === 'danger' ? 'text-destructive' : 'text-foreground'}">
30
+ {title}
31
+ </p>
32
+ <p class="text-body text-muted-foreground">{description}</p>
33
+ </div>
34
+ {@render children()}
35
+ </div>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** What the row is about ("Pause"). */
4
+ title: string;
5
+ /** One sentence that says what the button does. */
6
+ description: string;
7
+ /** `danger` colours the title red; the button the row is given carries its own look. */
8
+ tone?: 'normal' | 'danger';
9
+ /** The button at the end of the row. */
10
+ children: Snippet;
11
+ }
12
+ declare const SettingsRow: import("svelte").Component<Props, {}, "">;
13
+ type SettingsRow = ReturnType<typeof SettingsRow>;
14
+ export default SettingsRow;
@@ -14,9 +14,9 @@
14
14
  import { useWorkflowsLanguage } from '../../i18n/language.js';
15
15
  import ActionButton from '../ui/ActionButton.svelte';
16
16
  import ConfirmDialog from '../ui/ConfirmDialog.svelte';
17
- import Icon from '../ui/Icon.svelte';
18
17
  import SelectField from '../ui/SelectField.svelte';
19
18
  import type { SelectChoice } from '../ui/types.js';
19
+ import SettingsRow from './SettingsRow.svelte';
20
20
 
21
21
  interface Props {
22
22
  /** Opens the embed code of this workflow; absent when the page that hosts the screen has no such dialog. */
@@ -60,44 +60,55 @@
60
60
  }
61
61
  </script>
62
62
 
63
- <div class="mx-auto flex w-full max-w-2xl flex-col gap-8 overflow-auto p-4 pb-10">
64
- <section class="flex flex-col gap-2" aria-labelledby="{sectionId}-zone">
65
- <h3 id="{sectionId}-zone" class="text-sm font-semibold">
66
- {$t('workflows.settings.zoneHeading')}
67
- </h3>
68
- <SelectField
69
- label={$t('workflows.settings.zoneLabel')}
70
- value={editor.timezone}
71
- choices={zoneChoices}
72
- disabled={editor.isReadOnly}
73
- help={$t('workflows.settings.zoneHelp')}
74
- onchange={(zone) => editor.setTimezone(zone)}
75
- />
76
- </section>
63
+ <div class="mx-auto flex w-full max-w-content flex-col gap-8 px-4 pb-8 pt-2 @3xl:px-0">
64
+ <!-- The time zone: the field is its own section, its label is what names it. -->
65
+ <SelectField
66
+ label={$t('workflows.settings.zoneLabel')}
67
+ value={editor.timezone}
68
+ choices={zoneChoices}
69
+ disabled={editor.isReadOnly}
70
+ help={$t('workflows.settings.zoneHelp')}
71
+ onchange={(zone) => editor.setTimezone(zone)}
72
+ />
77
73
 
78
74
  {#if onshowembedcode && editor.workflow?.everPublished}
79
75
  <section class="flex flex-col gap-2" aria-labelledby="{sectionId}-embed">
80
- <h3 id="{sectionId}-embed" class="text-sm font-semibold">
76
+ <h3 id="{sectionId}-embed" class="text-body-medium text-foreground">
81
77
  {$t('workflows.settings.embedHeading')}
82
78
  </h3>
83
- <p class="text-xs text-ink-muted">{$t('workflows.settings.embedHelp')}</p>
84
- <ActionButton size="small" class="self-start" onclick={onshowembedcode}>
85
- <Icon name="code" />
86
- {$t('workflows.top.embedCode')}
87
- </ActionButton>
79
+ <SettingsRow
80
+ title={$t('workflows.top.embedCode')}
81
+ description={$t('workflows.settings.embedHelp')}
82
+ >
83
+ <ActionButton
84
+ class="w-full shrink-0 @3xl:w-auto"
85
+ size="small"
86
+ disabled={editor.isReadOnly}
87
+ onclick={onshowembedcode}
88
+ >
89
+ {$t('workflows.top.embedCode')}
90
+ </ActionButton>
91
+ </SettingsRow>
88
92
  </section>
89
93
  {/if}
90
94
 
91
- <section class="flex flex-col gap-3" aria-labelledby="{sectionId}-state">
92
- <h3 id="{sectionId}-state" class="text-sm font-semibold">
95
+ <section class="flex flex-col gap-2" aria-labelledby="{sectionId}-state">
96
+ <h3 id="{sectionId}-state" class="text-body-medium text-foreground">
93
97
  {$t('workflows.settings.stateHeading')}
94
98
  </h3>
95
99
 
96
100
  {#if isLiveOrPaused}
97
- <div class="flex flex-col gap-1">
101
+ <SettingsRow
102
+ title={editor.status === 'paused'
103
+ ? $t('workflows.settings.resume')
104
+ : $t('workflows.settings.pause')}
105
+ description={editor.status === 'paused'
106
+ ? $t('workflows.settings.resumeHelp')
107
+ : $t('workflows.settings.pauseHelp')}
108
+ >
98
109
  <ActionButton
110
+ class="w-full shrink-0 @3xl:w-auto"
99
111
  size="small"
100
- class="self-start"
101
112
  disabled={!editor.canChangeWorkflow}
102
113
  onclick={() => void editor.changeState(editor.status === 'paused' ? 'resume' : 'pause')}
103
114
  >
@@ -105,64 +116,68 @@
105
116
  ? $t('workflows.settings.resume')
106
117
  : $t('workflows.settings.pause')}
107
118
  </ActionButton>
108
- <p class="text-xs text-ink-muted">
109
- {editor.status === 'paused'
110
- ? $t('workflows.settings.resumeHelp')
111
- : $t('workflows.settings.pauseHelp')}
112
- </p>
113
- </div>
119
+ </SettingsRow>
114
120
  {/if}
115
121
 
116
- <div class="flex flex-col gap-1">
117
- {#if editor.status === 'archived'}
122
+ {#if editor.status === 'archived'}
123
+ <SettingsRow
124
+ title={$t('workflows.settings.unarchive')}
125
+ description={$t('workflows.settings.unarchiveHelp')}
126
+ >
118
127
  <ActionButton
128
+ class="w-full shrink-0 @3xl:w-auto"
119
129
  size="small"
120
- class="self-start"
121
130
  disabled={!editor.canChangeWorkflow}
122
131
  onclick={() => void editor.changeState('unarchive')}
123
132
  >
124
133
  {$t('workflows.settings.unarchive')}
125
134
  </ActionButton>
126
- <p class="text-xs text-ink-muted">{$t('workflows.settings.unarchiveHelp')}</p>
127
- {:else if editor.workflow?.everPublished}
135
+ </SettingsRow>
136
+ {:else if editor.workflow?.everPublished}
137
+ <SettingsRow
138
+ title={$t('workflows.settings.archive')}
139
+ description={$t('workflows.settings.archiveHelp')}
140
+ >
128
141
  <ActionButton
142
+ class="w-full shrink-0 @3xl:w-auto"
129
143
  size="small"
130
- class="self-start"
131
144
  disabled={!editor.canChangeWorkflow}
132
145
  onclick={() => (asking = 'archive')}
133
146
  >
134
147
  {$t('workflows.settings.archive')}
135
148
  </ActionButton>
136
- <p class="text-xs text-ink-muted">{$t('workflows.settings.archiveHelp')}</p>
137
- {/if}
138
- </div>
149
+ </SettingsRow>
150
+ {/if}
139
151
 
140
- <div class="flex flex-col gap-1">
152
+ <SettingsRow
153
+ title={$t('workflows.settings.duplicate')}
154
+ description={$t('workflows.settings.duplicateHelp')}
155
+ >
141
156
  <ActionButton
157
+ class="w-full shrink-0 @3xl:w-auto"
142
158
  size="small"
143
- class="self-start"
144
159
  disabled={editor.busy !== null}
145
160
  onclick={() => void editor.duplicate()}
146
161
  >
147
- <Icon name="copy" />
148
162
  {$t('workflows.settings.duplicate')}
149
163
  </ActionButton>
150
- <p class="text-xs text-ink-muted">{$t('workflows.settings.duplicateHelp')}</p>
151
- </div>
164
+ </SettingsRow>
152
165
 
153
- <div class="flex flex-col gap-1">
166
+ <SettingsRow
167
+ tone="danger"
168
+ title={$t('workflows.settings.delete')}
169
+ description={$t('workflows.settings.deleteHelp')}
170
+ >
154
171
  <ActionButton
172
+ class="w-full shrink-0 @3xl:w-auto"
155
173
  variant="danger"
156
174
  size="small"
157
- class="self-start"
158
175
  disabled={!editor.canChangeWorkflow}
159
176
  onclick={() => (asking = 'delete')}
160
177
  >
161
- <Icon name="trash" />
162
178
  {$t('workflows.settings.delete')}
163
179
  </ActionButton>
164
- <p class="text-xs text-ink-muted">{$t('workflows.settings.deleteHelp')}</p>
165
- </div>
180
+ </SettingsRow>
166
181
  </section>
167
182
  </div>
168
183
 
@@ -171,6 +186,7 @@
171
186
  title={$t('workflows.settings.archiveTitle')}
172
187
  message={$t('workflows.settings.archiveMessage')}
173
188
  confirmLabel={$t('workflows.settings.archive')}
189
+ tone="normal"
174
190
  busy={editor.busy === 'changingState'}
175
191
  onconfirm={() => void confirmArchive()}
176
192
  oncancel={() => (asking = null)}
@@ -127,7 +127,7 @@
127
127
 
128
128
  <div class="@container flex h-full min-h-0 w-full flex-col" data-workflows-editor>
129
129
  {#if editor.loadState === 'loading'}
130
- <p class="m-auto py-10 text-sm text-ink-muted" role="status">
130
+ <p class="m-auto py-8 text-body text-muted-foreground" role="status">
131
131
  {$t('workflows.common.loading')}
132
132
  </p>
133
133
  {:else if editor.loadState === 'failed'}
@@ -147,14 +147,12 @@
147
147
  onshowembedcode={showEmbedCode}
148
148
  />
149
149
  <EditorTabs {panelId} />
150
- <div class="hidden flex-col gap-2 px-4 pt-3 has-[>*]:flex">
151
- <EditorBanners onpublish={requestPublish} />
152
- </div>
150
+ <EditorBanners onpublish={requestPublish} />
153
151
  <div
154
152
  id={panelId}
155
153
  role="tabpanel"
156
154
  aria-labelledby="{panelId}-tab-{editor.tab}"
157
- class="flex min-h-0 flex-1 flex-col"
155
+ class="flex min-h-0 flex-1 min-w-0 flex-col"
158
156
  >
159
157
  {#if editor.tab === 'editor'}
160
158
  <EditorCanvasArea />
@@ -180,6 +178,7 @@
180
178
  confirmLabel={editor.status === 'draft'
181
179
  ? $t('workflows.top.publish')
182
180
  : $t('workflows.top.publishChanges')}
181
+ tone="normal"
183
182
  busy={editor.busy === 'publishing'}
184
183
  onconfirm={() => void confirmPublish()}
185
184
  oncancel={() => (isAskingToPublish = false)}