@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
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import type { WorkflowsMessageKey } from '../../i18n/messages.js';
|
|
15
15
|
import ActionButton from '../ui/ActionButton.svelte';
|
|
16
16
|
import Icon from '../ui/Icon.svelte';
|
|
17
|
+
import Menu from '../ui/Menu.svelte';
|
|
18
|
+
import type { MenuGroup, MenuItem } from '../ui/types.js';
|
|
17
19
|
import StatusBadge from '../ui/StatusBadge.svelte';
|
|
18
20
|
import TextField from '../ui/TextField.svelte';
|
|
19
21
|
|
|
@@ -66,67 +68,177 @@
|
|
|
66
68
|
if (editor.panel === 'history') editor.closeHistory();
|
|
67
69
|
else editor.openHistory();
|
|
68
70
|
}
|
|
69
|
-
</script>
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<TextField
|
|
79
|
-
label={$t('workflows.top.nameLabel')}
|
|
80
|
-
hideLabel
|
|
81
|
-
maxlength={MAX_WORKFLOW_NAME_LENGTH}
|
|
82
|
-
disabled={editor.isReadOnly}
|
|
83
|
-
bind:value={nameDraft}
|
|
84
|
-
onchange={commitName}
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
72
|
+
const saveIcon = $derived.by((): 'check' | 'loader' | 'circle' | 'warning' => {
|
|
73
|
+
const s = editor.saveState;
|
|
74
|
+
if (s === 'saved') return 'check';
|
|
75
|
+
if (s === 'saving') return 'loader';
|
|
76
|
+
if (s === 'pending') return 'circle';
|
|
77
|
+
return 'warning';
|
|
78
|
+
});
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
const saveCaptionClass = $derived(
|
|
81
|
+
editor.saveState === 'failed' || editor.saveState === 'conflict'
|
|
82
|
+
? 'text-destructive'
|
|
83
|
+
: 'text-muted-foreground'
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const moreMenuGroups = $derived.by((): readonly MenuGroup[] => {
|
|
87
|
+
const items: MenuItem[] = [];
|
|
88
|
+
items.push({
|
|
89
|
+
key: 'test',
|
|
90
|
+
label: $t('workflows.top.testRun'),
|
|
91
|
+
icon: 'play',
|
|
92
|
+
disabled: editor.isReadOnly || editor.tab !== 'editor',
|
|
93
|
+
onSelect: toggleTestRun
|
|
94
|
+
});
|
|
95
|
+
items.push({
|
|
96
|
+
key: 'history',
|
|
97
|
+
label: $t('workflows.top.history'),
|
|
98
|
+
icon: 'history',
|
|
99
|
+
disabled: editor.tab !== 'editor',
|
|
100
|
+
onSelect: toggleHistory
|
|
101
|
+
});
|
|
102
|
+
if (onshowembedcode && editor.workflow?.everPublished) {
|
|
103
|
+
items.push({
|
|
104
|
+
key: 'embed',
|
|
105
|
+
label: $t('workflows.top.embedCode'),
|
|
106
|
+
icon: 'code',
|
|
107
|
+
disabled: false,
|
|
108
|
+
onSelect: onshowembedcode
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
items.push({
|
|
112
|
+
key: 'publish',
|
|
113
|
+
label: $t(publishLabelKey),
|
|
114
|
+
disabled: !editor.canTryPublish,
|
|
115
|
+
onSelect: onpublish
|
|
116
|
+
});
|
|
117
|
+
return [{ key: 'more', items }];
|
|
118
|
+
});
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<div
|
|
122
|
+
class="flex flex-col gap-3 border-b border-border px-4 py-4 @3xl:gap-4 @3xl:px-6"
|
|
123
|
+
data-workflows-editor-top-bar
|
|
124
|
+
>
|
|
125
|
+
<div class="flex w-full min-w-0 flex-wrap items-center gap-3 @3xl:flex-nowrap @3xl:gap-4">
|
|
126
|
+
<!-- Narrow: back, name (flex-1), status, more menu -->
|
|
127
|
+
<div
|
|
128
|
+
class="flex min-w-0 w-full flex-1 items-center gap-3 @3xl:w-auto @3xl:max-w-none @3xl:flex-none"
|
|
95
129
|
>
|
|
96
|
-
|
|
130
|
+
<ActionButton
|
|
131
|
+
variant="ghost"
|
|
132
|
+
size="small"
|
|
133
|
+
iconOnly
|
|
134
|
+
ariaLabel={$t('workflows.top.back')}
|
|
135
|
+
title={$t('workflows.top.back')}
|
|
136
|
+
onclick={onback}
|
|
137
|
+
>
|
|
138
|
+
<Icon name="back" class="size-4 rtl:rotate-180" />
|
|
139
|
+
</ActionButton>
|
|
140
|
+
<div class="min-w-0 max-w-full flex-1 @3xl:w-60 @3xl:flex-none">
|
|
141
|
+
<TextField
|
|
142
|
+
label={$t('workflows.top.nameLabel')}
|
|
143
|
+
hideLabel
|
|
144
|
+
variant="soft"
|
|
145
|
+
maxlength={MAX_WORKFLOW_NAME_LENGTH}
|
|
146
|
+
disabled={editor.isReadOnly}
|
|
147
|
+
bind:value={nameDraft}
|
|
148
|
+
onchange={commitName}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="flex min-w-0 shrink-0 flex-col gap-1 @3xl:hidden" data-workflows-editor-status>
|
|
152
|
+
<StatusBadge status={editor.status} />
|
|
153
|
+
</div>
|
|
154
|
+
<div class="ms-auto flex items-center @3xl:hidden">
|
|
155
|
+
<Menu
|
|
156
|
+
label={$t('workflows.top.moreActions')}
|
|
157
|
+
icon="more"
|
|
158
|
+
iconOnly
|
|
159
|
+
variant="ghost"
|
|
160
|
+
size="small"
|
|
161
|
+
align="end"
|
|
162
|
+
groups={moreMenuGroups}
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
97
166
|
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
disabled={editor.isReadOnly || editor.tab !== 'editor'}
|
|
103
|
-
onclick={toggleTestRun}
|
|
167
|
+
<!-- Desktop: status column -->
|
|
168
|
+
<div
|
|
169
|
+
class="hidden min-w-0 flex-col gap-1 @3xl:flex @3xl:w-auto @3xl:shrink-0"
|
|
170
|
+
data-workflows-editor-status-desktop
|
|
104
171
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
disabled={editor.tab !== 'editor'}
|
|
112
|
-
onclick={toggleHistory}
|
|
172
|
+
<StatusBadge status={editor.status} />
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div
|
|
176
|
+
class="hidden w-full min-w-0 items-center gap-1.5 @3xl:flex @3xl:w-auto @3xl:shrink-0"
|
|
177
|
+
data-workflows-editor-save
|
|
113
178
|
>
|
|
114
|
-
<Icon
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
179
|
+
<Icon
|
|
180
|
+
name={saveIcon}
|
|
181
|
+
class="size-4 shrink-0 {saveIcon === 'loader'
|
|
182
|
+
? 'motion-safe:animate-spin'
|
|
183
|
+
: ''} {saveCaptionClass}"
|
|
184
|
+
/>
|
|
185
|
+
<span class="text-caption {saveCaptionClass}" role="status" aria-live="polite"
|
|
186
|
+
>{$t(SAVE_STATE_KEYS[editor.saveState])}</span
|
|
187
|
+
>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div class="hidden min-w-0 flex-1 @3xl:block"></div>
|
|
191
|
+
|
|
192
|
+
<div class="hidden w-full flex-wrap items-center justify-end gap-2 @3xl:flex @3xl:w-auto">
|
|
193
|
+
<ActionButton
|
|
194
|
+
size="small"
|
|
195
|
+
pressed={editor.panel === 'test'}
|
|
196
|
+
disabled={editor.isReadOnly || editor.tab !== 'editor'}
|
|
197
|
+
onclick={toggleTestRun}
|
|
198
|
+
>
|
|
199
|
+
<Icon name="play" />
|
|
200
|
+
{$t('workflows.top.testRun')}
|
|
201
|
+
</ActionButton>
|
|
202
|
+
<ActionButton
|
|
203
|
+
variant="ghost"
|
|
204
|
+
size="small"
|
|
205
|
+
iconOnly
|
|
206
|
+
pressed={editor.panel === 'history'}
|
|
207
|
+
disabled={editor.tab !== 'editor'}
|
|
208
|
+
ariaLabel={$t('workflows.top.history')}
|
|
209
|
+
title={$t('workflows.top.history')}
|
|
210
|
+
onclick={toggleHistory}
|
|
211
|
+
>
|
|
212
|
+
<Icon name="history" />
|
|
121
213
|
</ActionButton>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
214
|
+
{#if onshowembedcode && editor.workflow?.everPublished}
|
|
215
|
+
<ActionButton
|
|
216
|
+
variant="ghost"
|
|
217
|
+
size="small"
|
|
218
|
+
iconOnly
|
|
219
|
+
onclick={onshowembedcode}
|
|
220
|
+
ariaLabel={$t('workflows.top.embedCode')}
|
|
221
|
+
title={$t('workflows.top.embedCode')}
|
|
222
|
+
>
|
|
223
|
+
<Icon name="code" />
|
|
224
|
+
</ActionButton>
|
|
225
|
+
{/if}
|
|
226
|
+
<ActionButton variant="primary" disabled={!editor.canTryPublish} onclick={onpublish}>
|
|
227
|
+
{$t(publishLabelKey)}
|
|
228
|
+
</ActionButton>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<!-- Narrow: save state under the condensed row -->
|
|
233
|
+
<div class="flex w-full items-center gap-1.5 @3xl:hidden" data-workflows-editor-save-narrow>
|
|
234
|
+
<Icon
|
|
235
|
+
name={saveIcon}
|
|
236
|
+
class="size-4 shrink-0 {saveIcon === 'loader'
|
|
237
|
+
? 'motion-safe:animate-spin'
|
|
238
|
+
: ''} {saveCaptionClass}"
|
|
239
|
+
/>
|
|
240
|
+
<span class="text-caption {saveCaptionClass}" role="status" aria-live="polite"
|
|
241
|
+
>{$t(SAVE_STATE_KEYS[editor.saveState])}</span
|
|
128
242
|
>
|
|
129
|
-
{$t(publishLabelKey)}
|
|
130
|
-
</ActionButton>
|
|
131
243
|
</div>
|
|
132
244
|
</div>
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import { useEditorState } from '../../editor/editorState.svelte.js';
|
|
15
15
|
import { useWorkflowsLanguage } from '../../i18n/language.js';
|
|
16
16
|
import ActionButton from '../ui/ActionButton.svelte';
|
|
17
|
+
import Modal from '../ui/Modal.svelte';
|
|
18
|
+
import Notice from '../ui/Notice.svelte';
|
|
17
19
|
|
|
18
20
|
const editor = useEditorState();
|
|
19
21
|
const { t } = useWorkflowsLanguage();
|
|
@@ -23,104 +25,123 @@
|
|
|
23
25
|
// Who holds the editing, as the person is to read it: their own other window ("you"), a named teammate, or nobody named.
|
|
24
26
|
const holderIsYou = $derived(presence.holder?.isYou === true);
|
|
25
27
|
const holderName = $derived(presence.holder?.name ?? null);
|
|
28
|
+
|
|
29
|
+
function modalTitle(): string {
|
|
30
|
+
if (presence.lostIt) {
|
|
31
|
+
if (holderIsYou) return $t('workflows.presence.lostTitleYou');
|
|
32
|
+
if (holderName) return $t('workflows.presence.lostTitleNamed', { name: holderName });
|
|
33
|
+
return $t('workflows.presence.lostTitle');
|
|
34
|
+
}
|
|
35
|
+
if (holderIsYou) return $t('workflows.presence.blockedTitleYou');
|
|
36
|
+
if (holderName) return $t('workflows.presence.blockedTitleNamed', { name: holderName });
|
|
37
|
+
return $t('workflows.presence.blockedTitle');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function modalDescription(): string {
|
|
41
|
+
return presence.lostIt
|
|
42
|
+
? $t('workflows.presence.lostBody')
|
|
43
|
+
: $t('workflows.presence.blockedBody');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function closeModalAsLookOnly(): void {
|
|
47
|
+
if (presence.working) return;
|
|
48
|
+
editor.lookOnly();
|
|
49
|
+
}
|
|
26
50
|
</script>
|
|
27
51
|
|
|
28
52
|
{#if presence.phase === 'blocked'}
|
|
29
|
-
<!--
|
|
30
|
-
<div
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{:else if holderName}
|
|
42
|
-
{$t('workflows.presence.lostTitleNamed', { name: holderName })}
|
|
43
|
-
{:else}
|
|
44
|
-
{$t('workflows.presence.lostTitle')}
|
|
45
|
-
{/if}
|
|
46
|
-
{:else if holderIsYou}
|
|
47
|
-
{$t('workflows.presence.blockedTitleYou')}
|
|
48
|
-
{:else if holderName}
|
|
49
|
-
{$t('workflows.presence.blockedTitleNamed', { name: holderName })}
|
|
50
|
-
{:else}
|
|
51
|
-
{$t('workflows.presence.blockedTitle')}
|
|
53
|
+
<!-- Choice as dialog: urgent announcement is tied to the open dialog. -->
|
|
54
|
+
<div role="alert" data-workflows-presence="blocked">
|
|
55
|
+
<Modal
|
|
56
|
+
title={modalTitle()}
|
|
57
|
+
size="medium"
|
|
58
|
+
busy={presence.working}
|
|
59
|
+
onclose={closeModalAsLookOnly}
|
|
60
|
+
>
|
|
61
|
+
<div class="flex flex-col gap-4">
|
|
62
|
+
<p class="text-body text-muted-foreground">{modalDescription()}</p>
|
|
63
|
+
{#if presence.actionFailed}
|
|
64
|
+
<p class="text-caption text-destructive">{$t('workflows.presence.actionFailed')}</p>
|
|
52
65
|
{/if}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
{#if presence.working}
|
|
67
|
+
<p class="text-caption text-muted-foreground" role="status">
|
|
68
|
+
{$t('workflows.presence.working')}
|
|
69
|
+
</p>
|
|
70
|
+
{/if}
|
|
71
|
+
<!-- The two answers, each told in a line (Figma: a small label and the words under it, with no box around). -->
|
|
72
|
+
<div class="flex flex-col gap-4">
|
|
73
|
+
<div class="flex flex-col gap-0.5">
|
|
74
|
+
<p class="text-caption-medium text-muted-foreground">
|
|
75
|
+
{$t('workflows.presence.takeOver')}
|
|
76
|
+
</p>
|
|
77
|
+
<p class="text-body">{$t('workflows.presence.takeOverHint')}</p>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="flex flex-col gap-0.5">
|
|
80
|
+
<p class="text-caption-medium text-muted-foreground">
|
|
81
|
+
{$t('workflows.presence.lookOnly')}
|
|
82
|
+
</p>
|
|
83
|
+
<p class="text-body">{$t('workflows.presence.lookOnlyHint')}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
{#snippet footer()}
|
|
88
|
+
<ActionButton
|
|
89
|
+
variant="outline"
|
|
90
|
+
disabled={presence.working}
|
|
91
|
+
onclick={() => editor.lookOnly()}
|
|
92
|
+
>
|
|
93
|
+
{$t('workflows.presence.lookOnly')}
|
|
94
|
+
</ActionButton>
|
|
66
95
|
<ActionButton
|
|
67
96
|
variant="primary"
|
|
68
|
-
size="small"
|
|
69
97
|
disabled={presence.working}
|
|
70
98
|
onclick={() => editor.takeOverEditing()}
|
|
71
99
|
>
|
|
72
100
|
{$t('workflows.presence.takeOver')}
|
|
73
101
|
</ActionButton>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<div class="flex max-w-48 flex-col items-start gap-1">
|
|
77
|
-
<ActionButton size="small" disabled={presence.working} onclick={() => editor.lookOnly()}>
|
|
78
|
-
{$t('workflows.presence.lookOnly')}
|
|
79
|
-
</ActionButton>
|
|
80
|
-
<span class="text-xs text-ink-muted">{$t('workflows.presence.lookOnlyHint')}</span>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
102
|
+
{/snippet}
|
|
103
|
+
</Modal>
|
|
83
104
|
</div>
|
|
84
105
|
{:else if presence.phase === 'readOnly'}
|
|
85
|
-
<div
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
<div role="status" data-workflows-presence="readOnly">
|
|
107
|
+
<Notice>
|
|
108
|
+
<span class="min-w-0 flex-1 basis-60 break-words">
|
|
109
|
+
{#if presence.nobodyIsEditing}
|
|
110
|
+
{$t('workflows.presence.readOnlyFree')}
|
|
111
|
+
{:else if holderIsYou}
|
|
112
|
+
{$t('workflows.presence.readOnlyYou')}
|
|
113
|
+
{:else if holderName}
|
|
114
|
+
{$t('workflows.presence.readOnlyNamed', { name: holderName })}
|
|
115
|
+
{:else}
|
|
116
|
+
{$t('workflows.presence.readOnly')}
|
|
117
|
+
{/if}
|
|
118
|
+
</span>
|
|
119
|
+
{#if presence.actionFailed}
|
|
120
|
+
<span class="text-caption text-destructive">{$t('workflows.presence.actionFailed')}</span>
|
|
99
121
|
{/if}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
{/if}
|
|
122
|
+
{#if presence.working}
|
|
123
|
+
<span class="text-caption text-muted-foreground">{$t('workflows.presence.working')}</span>
|
|
124
|
+
{/if}
|
|
125
|
+
{#snippet action()}
|
|
126
|
+
{#if presence.nobodyIsEditing}
|
|
127
|
+
<ActionButton
|
|
128
|
+
variant="primary"
|
|
129
|
+
size="small"
|
|
130
|
+
disabled={presence.working}
|
|
131
|
+
onclick={() => editor.startEditing()}
|
|
132
|
+
>
|
|
133
|
+
{$t('workflows.presence.startEditing')}
|
|
134
|
+
</ActionButton>
|
|
135
|
+
{:else}
|
|
136
|
+
<ActionButton
|
|
137
|
+
size="small"
|
|
138
|
+
disabled={presence.working}
|
|
139
|
+
onclick={() => editor.takeOverEditing()}
|
|
140
|
+
>
|
|
141
|
+
{$t('workflows.presence.takeOver')}
|
|
142
|
+
</ActionButton>
|
|
143
|
+
{/if}
|
|
144
|
+
{/snippet}
|
|
145
|
+
</Notice>
|
|
125
146
|
</div>
|
|
126
147
|
{/if}
|
|
@@ -44,16 +44,20 @@
|
|
|
44
44
|
const WIDTH_BEFORE_MEASURING = 720;
|
|
45
45
|
/** The width of the place a band can be pointed at, however thin the band is. */
|
|
46
46
|
const LEAST_POINTING_WIDTH = 14;
|
|
47
|
+
/** The distance between the pointer and the tooltip of a band, and the room the tooltip needs (its widest and a tall one). */
|
|
48
|
+
const TOOLTIP_GAP = 14;
|
|
49
|
+
const TOOLTIP_WIDTH = 240;
|
|
50
|
+
const TOOLTIP_HEIGHT = 96;
|
|
47
51
|
|
|
48
52
|
// A band has one colour for each of its states; each is written whole so that the stylesheet of the page finds it.
|
|
49
53
|
const BAND_STATE_CLASSES = {
|
|
50
|
-
resting: 'stroke-primary
|
|
51
|
-
lit: 'stroke-primary
|
|
52
|
-
dimmed: 'stroke-primary
|
|
54
|
+
resting: 'stroke-primary/30',
|
|
55
|
+
lit: 'stroke-primary/60',
|
|
56
|
+
dimmed: 'stroke-primary/10',
|
|
53
57
|
// A way nobody took, in a chart that has visitors: a dashed hair.
|
|
54
|
-
nobody: 'stroke-
|
|
58
|
+
nobody: 'stroke-border',
|
|
55
59
|
// A chart nobody has been counted in: every band pale and whole, the shape of the workflow and no one in it.
|
|
56
|
-
empty: 'stroke-
|
|
60
|
+
empty: 'stroke-border'
|
|
57
61
|
} as const;
|
|
58
62
|
|
|
59
63
|
/** The words of each line of numbers under a composition's name (the lines themselves are the model's: `listNumberLines`). */
|
|
@@ -78,6 +82,10 @@
|
|
|
78
82
|
let measuredWidth = $state(0);
|
|
79
83
|
/** What a pointer is over: a bar or a band. Its bands (or itself) are lit and the others fade. */
|
|
80
84
|
let pointedAt = $state.raw<{ kind: 'step' | 'link'; id: string } | null>(null);
|
|
85
|
+
/** What a mouse over a band is told (the band's words) and where, in pixels inside the frame; `null` when none is pointed at. */
|
|
86
|
+
let bandTooltip = $state.raw<{ bandId: string; text: string; left: number; top: number } | null>(
|
|
87
|
+
null
|
|
88
|
+
);
|
|
81
89
|
|
|
82
90
|
const emptyFlow: RunsFlow = { steps: [], links: [], columnCount: 0, hasVisitors: false };
|
|
83
91
|
|
|
@@ -149,6 +157,58 @@
|
|
|
149
157
|
...words.describeRoute(band)
|
|
150
158
|
].join(' · ');
|
|
151
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Tells a mouse (or a pen) what the band under it is: next to the pointer, kept inside the frame (at the right edge it moves
|
|
163
|
+
* to the pointer's left, at the bottom above it). A finger gets no tooltip: it has no pointer to rest on a band, and the list
|
|
164
|
+
* for a screen reader says the same numbers.
|
|
165
|
+
*/
|
|
166
|
+
function showBandTooltip(event: PointerEvent, band: PlacedLink, text: string): void {
|
|
167
|
+
if (event.pointerType === 'touch') return;
|
|
168
|
+
try {
|
|
169
|
+
// The scrolling frame of the chart: the tooltip is drawn inside it, so it moves and is cut with the drawing.
|
|
170
|
+
const chartFrame =
|
|
171
|
+
event.currentTarget instanceof Element
|
|
172
|
+
? event.currentTarget.closest<HTMLElement>('[data-runs-frame]')
|
|
173
|
+
: null;
|
|
174
|
+
if (!chartFrame) return;
|
|
175
|
+
const frame = chartFrame.getBoundingClientRect();
|
|
176
|
+
const pointerLeft = event.clientX - frame.left + chartFrame.scrollLeft;
|
|
177
|
+
const pointerTop = event.clientY - frame.top + chartFrame.scrollTop;
|
|
178
|
+
const rightEdge = chartFrame.scrollLeft + chartFrame.clientWidth;
|
|
179
|
+
const bottomEdge = chartFrame.scrollTop + chartFrame.clientHeight;
|
|
180
|
+
bandTooltip = {
|
|
181
|
+
bandId: band.id,
|
|
182
|
+
text,
|
|
183
|
+
left:
|
|
184
|
+
pointerLeft + TOOLTIP_GAP + TOOLTIP_WIDTH > rightEdge
|
|
185
|
+
? Math.max(chartFrame.scrollLeft, pointerLeft - TOOLTIP_GAP - TOOLTIP_WIDTH)
|
|
186
|
+
: pointerLeft + TOOLTIP_GAP,
|
|
187
|
+
top:
|
|
188
|
+
pointerTop + TOOLTIP_GAP + TOOLTIP_HEIGHT > bottomEdge
|
|
189
|
+
? Math.max(chartFrame.scrollTop, pointerTop - TOOLTIP_GAP - TOOLTIP_HEIGHT)
|
|
190
|
+
: pointerTop + TOOLTIP_GAP
|
|
191
|
+
};
|
|
192
|
+
} catch (error) {
|
|
193
|
+
workflowsError('Placing the tooltip of a band failed.', error);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** The tooltip that is on the screen: gone when the band it spoke of is no longer drawn (the counts were read again). */
|
|
198
|
+
const shownBandTooltip = $derived(
|
|
199
|
+
bandTooltip && placed.links.some((band) => band.id === bandTooltip?.bandId) ? bandTooltip : null
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Where the tooltip stands, as the two lengths its style takes: from the start of the frame and from its top. The frame is
|
|
204
|
+
* drawn left to right in every language, so its start is its left edge, which is where the pointer was measured from.
|
|
205
|
+
* They are written here, in the script, so that the markup holds no unit text.
|
|
206
|
+
*/
|
|
207
|
+
const bandTooltipPlace = $derived(
|
|
208
|
+
shownBandTooltip
|
|
209
|
+
? { start: `${shownBandTooltip.left}px`, top: `${shownBandTooltip.top}px` }
|
|
210
|
+
: null
|
|
211
|
+
);
|
|
152
212
|
</script>
|
|
153
213
|
|
|
154
214
|
{#if placed.steps.length > 0}
|
|
@@ -159,8 +219,9 @@
|
|
|
159
219
|
>
|
|
160
220
|
<!-- rtl-ok: the chart is a left to right island in every language, like the canvas: the columns are the steps a visitor takes. -->
|
|
161
221
|
<div
|
|
162
|
-
class="min-h-72 flex-1 overflow-auto rounded-
|
|
222
|
+
class="relative max-w-content min-h-72 w-full flex-1 overflow-auto rounded-xl border border-border bg-background"
|
|
163
223
|
dir="ltr"
|
|
224
|
+
data-runs-frame
|
|
164
225
|
bind:clientWidth={measuredWidth}
|
|
165
226
|
>
|
|
166
227
|
<!-- The drawing is for the eyes; the list below says the same numbers to a screen reader. -->
|
|
@@ -173,12 +234,20 @@
|
|
|
173
234
|
focusable="false"
|
|
174
235
|
>
|
|
175
236
|
{#each placed.links as band (band.id)}
|
|
237
|
+
{@const bandWords = describeBand(band)}
|
|
176
238
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
177
239
|
<g
|
|
178
|
-
|
|
179
|
-
|
|
240
|
+
data-tooltip={bandWords}
|
|
241
|
+
onpointerenter={(event) => {
|
|
242
|
+
pointedAt = { kind: 'link', id: band.id };
|
|
243
|
+
showBandTooltip(event, band, bandWords);
|
|
244
|
+
}}
|
|
245
|
+
onpointermove={(event) => showBandTooltip(event, band, bandWords)}
|
|
246
|
+
onpointerleave={() => {
|
|
247
|
+
pointedAt = null;
|
|
248
|
+
bandTooltip = null;
|
|
249
|
+
}}
|
|
180
250
|
>
|
|
181
|
-
<title>{describeBand(band)}</title>
|
|
182
251
|
<path
|
|
183
252
|
d={band.path}
|
|
184
253
|
fill="none"
|
|
@@ -209,7 +278,7 @@
|
|
|
209
278
|
y={step.barY}
|
|
210
279
|
width={RUNS_FLOW_METRICS.barWidth}
|
|
211
280
|
height={step.barHeight}
|
|
212
|
-
class="fill-primary
|
|
281
|
+
class="fill-primary"
|
|
213
282
|
/>
|
|
214
283
|
{#if step.stayedHeight > 0}
|
|
215
284
|
<!-- The visitors who reached the composition and did not go on: hollow, at the bottom of the bar. -->
|
|
@@ -218,7 +287,8 @@
|
|
|
218
287
|
y={step.stayedY}
|
|
219
288
|
width={RUNS_FLOW_METRICS.barWidth - 1}
|
|
220
289
|
height={Math.max(0, step.stayedHeight - 0.5)}
|
|
221
|
-
class="fill-
|
|
290
|
+
class="fill-muted stroke-border-strong/30"
|
|
291
|
+
stroke-width="1"
|
|
222
292
|
/>
|
|
223
293
|
{/if}
|
|
224
294
|
{:else}
|
|
@@ -229,7 +299,8 @@
|
|
|
229
299
|
width={RUNS_FLOW_METRICS.barWidth - 1}
|
|
230
300
|
height={step.barHeight}
|
|
231
301
|
stroke-dasharray="3 3"
|
|
232
|
-
class="fill-none stroke-
|
|
302
|
+
class="fill-none stroke-border-strong/30"
|
|
303
|
+
stroke-width="1"
|
|
233
304
|
/>
|
|
234
305
|
{/if}
|
|
235
306
|
{#if step.failedHeight > 0}
|
|
@@ -239,7 +310,7 @@
|
|
|
239
310
|
y={step.failedY}
|
|
240
311
|
width={RUNS_FLOW_METRICS.barWidth}
|
|
241
312
|
height={step.failedHeight}
|
|
242
|
-
class="fill-
|
|
313
|
+
class="fill-destructive"
|
|
243
314
|
/>
|
|
244
315
|
{/if}
|
|
245
316
|
<!-- The words are HTML in the drawing, so that a long name is cut with an ellipsis and a language that reads right to left is set properly. -->
|
|
@@ -252,7 +323,7 @@
|
|
|
252
323
|
>
|
|
253
324
|
<div class="w-fit max-w-full" dir={$textDirection}>
|
|
254
325
|
<p
|
|
255
|
-
class="truncate text-
|
|
326
|
+
class="truncate text-body-medium text-foreground"
|
|
256
327
|
dir="auto"
|
|
257
328
|
title={words.nameStep(step.nodeId)}
|
|
258
329
|
>
|
|
@@ -260,9 +331,9 @@
|
|
|
260
331
|
</p>
|
|
261
332
|
{#each readNumbersOf(step) as line (line.kind)}
|
|
262
333
|
<p
|
|
263
|
-
class="truncate text-
|
|
264
|
-
? 'text-
|
|
265
|
-
: 'text-
|
|
334
|
+
class="truncate text-caption {line.kind === 'failed'
|
|
335
|
+
? 'text-destructive'
|
|
336
|
+
: 'text-muted-foreground'} {isReasonLine(line.kind) ? 'ps-3' : ''}"
|
|
266
337
|
data-line={line.kind}
|
|
267
338
|
>
|
|
268
339
|
{line.text}
|
|
@@ -273,6 +344,18 @@
|
|
|
273
344
|
</g>
|
|
274
345
|
{/each}
|
|
275
346
|
</svg>
|
|
347
|
+
|
|
348
|
+
{#if shownBandTooltip}
|
|
349
|
+
<!-- The tooltip of the band under the mouse (the words are also in the list below, for a screen reader). -->
|
|
350
|
+
<div
|
|
351
|
+
class="pointer-events-none absolute z-10 w-max max-w-60 rounded-lg bg-primary px-3 py-2 text-caption text-primary-foreground"
|
|
352
|
+
style:inset-inline-start={bandTooltipPlace?.start}
|
|
353
|
+
style:top={bandTooltipPlace?.top}
|
|
354
|
+
aria-hidden="true"
|
|
355
|
+
>
|
|
356
|
+
{shownBandTooltip.text}
|
|
357
|
+
</div>
|
|
358
|
+
{/if}
|
|
276
359
|
</div>
|
|
277
360
|
|
|
278
361
|
<ul class="sr-only">
|