@cyoda/workflow-react 0.1.0
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/LICENSE +201 -0
- package/README.md +32 -0
- package/dist/index.cjs +2922 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +271 -0
- package/dist/index.d.ts +271 -0
- package/dist/index.js +2918 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { WorkflowEditorDocument, SaveStatus, WorkflowApi, ConcurrencyToken, ImportMode } from '@cyoda/workflow-core';
|
|
3
|
+
import { LayoutOptions } from '@cyoda/workflow-layout';
|
|
4
|
+
export { LayoutOptions, LayoutPreset, PinnedNode } from '@cyoda/workflow-layout';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
|
|
7
|
+
declare const defaultMessages: {
|
|
8
|
+
toolbar: {
|
|
9
|
+
undo: string;
|
|
10
|
+
redo: string;
|
|
11
|
+
validate: string;
|
|
12
|
+
errors: string;
|
|
13
|
+
warnings: string;
|
|
14
|
+
infos: string;
|
|
15
|
+
save: string;
|
|
16
|
+
addWorkflow: string;
|
|
17
|
+
};
|
|
18
|
+
inspector: {
|
|
19
|
+
empty: string;
|
|
20
|
+
properties: string;
|
|
21
|
+
json: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
version: string;
|
|
25
|
+
active: string;
|
|
26
|
+
initialState: string;
|
|
27
|
+
manual: string;
|
|
28
|
+
disabled: string;
|
|
29
|
+
processors: string;
|
|
30
|
+
criterion: string;
|
|
31
|
+
executionMode: string;
|
|
32
|
+
addProcessor: string;
|
|
33
|
+
removeProcessor: string;
|
|
34
|
+
moveUp: string;
|
|
35
|
+
moveDown: string;
|
|
36
|
+
issues: string;
|
|
37
|
+
sourceAnchor: string;
|
|
38
|
+
targetAnchor: string;
|
|
39
|
+
anchorDefault: string;
|
|
40
|
+
anchorTop: string;
|
|
41
|
+
anchorRight: string;
|
|
42
|
+
anchorBottom: string;
|
|
43
|
+
anchorLeft: string;
|
|
44
|
+
};
|
|
45
|
+
confirmDelete: {
|
|
46
|
+
title: string;
|
|
47
|
+
message: string;
|
|
48
|
+
transitionsAffected: string;
|
|
49
|
+
confirm: string;
|
|
50
|
+
cancel: string;
|
|
51
|
+
};
|
|
52
|
+
dragConnect: {
|
|
53
|
+
title: string;
|
|
54
|
+
transitionName: string;
|
|
55
|
+
create: string;
|
|
56
|
+
cancel: string;
|
|
57
|
+
invalidName: string;
|
|
58
|
+
duplicateName: string;
|
|
59
|
+
};
|
|
60
|
+
tabs: {
|
|
61
|
+
closeTab: string;
|
|
62
|
+
untitled: string;
|
|
63
|
+
};
|
|
64
|
+
saveConfirm: {
|
|
65
|
+
title: string;
|
|
66
|
+
modeLabel: string;
|
|
67
|
+
ackReplace: string;
|
|
68
|
+
ackActivate: string;
|
|
69
|
+
ackWarnings: string;
|
|
70
|
+
confirm: string;
|
|
71
|
+
cancel: string;
|
|
72
|
+
};
|
|
73
|
+
conflict: {
|
|
74
|
+
message: string;
|
|
75
|
+
reload: string;
|
|
76
|
+
forceOverwrite: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type Messages = typeof defaultMessages;
|
|
80
|
+
|
|
81
|
+
declare const I18nContext: react.Context<{
|
|
82
|
+
toolbar: {
|
|
83
|
+
undo: string;
|
|
84
|
+
redo: string;
|
|
85
|
+
validate: string;
|
|
86
|
+
errors: string;
|
|
87
|
+
warnings: string;
|
|
88
|
+
infos: string;
|
|
89
|
+
save: string;
|
|
90
|
+
addWorkflow: string;
|
|
91
|
+
};
|
|
92
|
+
inspector: {
|
|
93
|
+
empty: string;
|
|
94
|
+
properties: string;
|
|
95
|
+
json: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
version: string;
|
|
99
|
+
active: string;
|
|
100
|
+
initialState: string;
|
|
101
|
+
manual: string;
|
|
102
|
+
disabled: string;
|
|
103
|
+
processors: string;
|
|
104
|
+
criterion: string;
|
|
105
|
+
executionMode: string;
|
|
106
|
+
addProcessor: string;
|
|
107
|
+
removeProcessor: string;
|
|
108
|
+
moveUp: string;
|
|
109
|
+
moveDown: string;
|
|
110
|
+
issues: string;
|
|
111
|
+
sourceAnchor: string;
|
|
112
|
+
targetAnchor: string;
|
|
113
|
+
anchorDefault: string;
|
|
114
|
+
anchorTop: string;
|
|
115
|
+
anchorRight: string;
|
|
116
|
+
anchorBottom: string;
|
|
117
|
+
anchorLeft: string;
|
|
118
|
+
};
|
|
119
|
+
confirmDelete: {
|
|
120
|
+
title: string;
|
|
121
|
+
message: string;
|
|
122
|
+
transitionsAffected: string;
|
|
123
|
+
confirm: string;
|
|
124
|
+
cancel: string;
|
|
125
|
+
};
|
|
126
|
+
dragConnect: {
|
|
127
|
+
title: string;
|
|
128
|
+
transitionName: string;
|
|
129
|
+
create: string;
|
|
130
|
+
cancel: string;
|
|
131
|
+
invalidName: string;
|
|
132
|
+
duplicateName: string;
|
|
133
|
+
};
|
|
134
|
+
tabs: {
|
|
135
|
+
closeTab: string;
|
|
136
|
+
untitled: string;
|
|
137
|
+
};
|
|
138
|
+
saveConfirm: {
|
|
139
|
+
title: string;
|
|
140
|
+
modeLabel: string;
|
|
141
|
+
ackReplace: string;
|
|
142
|
+
ackActivate: string;
|
|
143
|
+
ackWarnings: string;
|
|
144
|
+
confirm: string;
|
|
145
|
+
cancel: string;
|
|
146
|
+
};
|
|
147
|
+
conflict: {
|
|
148
|
+
message: string;
|
|
149
|
+
reload: string;
|
|
150
|
+
forceOverwrite: string;
|
|
151
|
+
};
|
|
152
|
+
}>;
|
|
153
|
+
declare function useMessages(): Messages;
|
|
154
|
+
type PartialMessages = {
|
|
155
|
+
[K in keyof Messages]?: Partial<Messages[K]>;
|
|
156
|
+
};
|
|
157
|
+
declare function mergeMessages(overrides?: PartialMessages): Messages;
|
|
158
|
+
|
|
159
|
+
type EditorMode = "viewer" | "playground" | "editor";
|
|
160
|
+
/** What the user currently has selected on the canvas or inspector. */
|
|
161
|
+
type Selection = null | {
|
|
162
|
+
kind: "workflow";
|
|
163
|
+
workflow: string;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "state";
|
|
166
|
+
workflow: string;
|
|
167
|
+
stateCode: string;
|
|
168
|
+
nodeId: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "transition";
|
|
171
|
+
transitionUuid: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "processor";
|
|
174
|
+
processorUuid: string;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "criterion";
|
|
177
|
+
hostKind: "workflow" | "transition";
|
|
178
|
+
hostId: string;
|
|
179
|
+
path: string[];
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
interface WorkflowEditorProps {
|
|
183
|
+
document: WorkflowEditorDocument;
|
|
184
|
+
mode?: EditorMode;
|
|
185
|
+
messages?: PartialMessages;
|
|
186
|
+
layoutOptions?: LayoutOptions;
|
|
187
|
+
onChange?: (doc: WorkflowEditorDocument) => void;
|
|
188
|
+
onSave?: (doc: WorkflowEditorDocument) => void;
|
|
189
|
+
}
|
|
190
|
+
/** Top-level editor shell — spec §14. Provides viewer/playground/editor modes. */
|
|
191
|
+
declare function WorkflowEditor({ document: initialDocument, mode, messages, layoutOptions, onChange, onSave, }: WorkflowEditorProps): react_jsx_runtime.JSX.Element;
|
|
192
|
+
|
|
193
|
+
interface UseSaveFlowArgs {
|
|
194
|
+
api: WorkflowApi;
|
|
195
|
+
document: WorkflowEditorDocument;
|
|
196
|
+
/**
|
|
197
|
+
* Concurrency token from the last successful `exportWorkflows` / `importWorkflows`.
|
|
198
|
+
* `null` means we have no server context (first-save scenario).
|
|
199
|
+
*/
|
|
200
|
+
concurrencyToken: ConcurrencyToken | null;
|
|
201
|
+
/** Called after a successful save to refresh the session and token. */
|
|
202
|
+
onSaved: (nextToken: ConcurrencyToken | null) => void;
|
|
203
|
+
/** Called when the user chooses "Reload" from the conflict banner. */
|
|
204
|
+
onReload?: () => void;
|
|
205
|
+
}
|
|
206
|
+
interface SaveFlow {
|
|
207
|
+
status: SaveStatus;
|
|
208
|
+
/** Show the confirmation modal — REPLACE / ACTIVATE require explicit confirm (§17.3). */
|
|
209
|
+
requestSave: () => void;
|
|
210
|
+
/** Called from the modal after the user confirms. */
|
|
211
|
+
confirmSave: () => Promise<void>;
|
|
212
|
+
/** Dismiss the confirmation modal without dispatching. */
|
|
213
|
+
cancel: () => void;
|
|
214
|
+
/** Force-overwrite branch of the 409 banner (§17.4). */
|
|
215
|
+
forceOverwrite: () => Promise<void>;
|
|
216
|
+
/** Reload branch of the 409 banner — delegates to `onReload`. */
|
|
217
|
+
reload: () => void;
|
|
218
|
+
/** Reset status back to idle after viewing a success/error toast. */
|
|
219
|
+
clear: () => void;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Save-flow hook per spec §17.3. Owns the modal/banner state machine so
|
|
223
|
+
* the shell only needs to render the current `status` and call `requestSave`
|
|
224
|
+
* from the toolbar's Save button.
|
|
225
|
+
*/
|
|
226
|
+
declare function useSaveFlow(args: UseSaveFlowArgs): SaveFlow;
|
|
227
|
+
|
|
228
|
+
interface SaveConfirmModalProps {
|
|
229
|
+
mode: ImportMode;
|
|
230
|
+
requiresExplicitConfirm: boolean;
|
|
231
|
+
warningCount: number;
|
|
232
|
+
document: WorkflowEditorDocument;
|
|
233
|
+
/** Summary of changes vs. server state — rendered verbatim above the
|
|
234
|
+
* confirm button. Callers who have not fetched server state pass null. */
|
|
235
|
+
diffSummary?: string | null;
|
|
236
|
+
onConfirm: () => void;
|
|
237
|
+
onCancel: () => void;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Save confirmation modal per spec §17.3 + §18.5.
|
|
241
|
+
*
|
|
242
|
+
* - REPLACE / ACTIVATE require a tick on "I understand this replaces /
|
|
243
|
+
* activates server state" before the confirm button enables.
|
|
244
|
+
* - When warnings are present, a separate tick is required acknowledging
|
|
245
|
+
* the warning count.
|
|
246
|
+
* - The diff summary (if provided) is shown above the tick-boxes.
|
|
247
|
+
*/
|
|
248
|
+
declare function SaveConfirmModal({ mode, requiresExplicitConfirm, warningCount, diffSummary, onConfirm, onCancel, }: SaveConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
249
|
+
|
|
250
|
+
interface ConflictBannerProps {
|
|
251
|
+
onReload: () => void;
|
|
252
|
+
onForceOverwrite: () => void;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 409-conflict banner per spec §17.4. Non-dismissable; the user must pick
|
|
256
|
+
* Reload (discard local) or Force overwrite (resend without the token).
|
|
257
|
+
*/
|
|
258
|
+
declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Produce a short human-readable diff summary between the last-known server
|
|
262
|
+
* document and the current editor document (spec §17.3). Counts workflows /
|
|
263
|
+
* states / transitions added, removed, or changed; returns null when no
|
|
264
|
+
* server document is available (first-save scenario).
|
|
265
|
+
*
|
|
266
|
+
* The summary is intentionally coarse — detailed diffs belong in a dedicated
|
|
267
|
+
* compare view, not a modal.
|
|
268
|
+
*/
|
|
269
|
+
declare function diffSummary(server: WorkflowEditorDocument | null, local: WorkflowEditorDocument): string | null;
|
|
270
|
+
|
|
271
|
+
export { ConflictBanner, type ConflictBannerProps, type EditorMode, I18nContext, type Messages, type PartialMessages, SaveConfirmModal, type SaveConfirmModalProps, type SaveFlow, type Selection, type UseSaveFlowArgs, WorkflowEditor, type WorkflowEditorProps, defaultMessages, diffSummary, mergeMessages, useMessages, useSaveFlow };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { WorkflowEditorDocument, SaveStatus, WorkflowApi, ConcurrencyToken, ImportMode } from '@cyoda/workflow-core';
|
|
3
|
+
import { LayoutOptions } from '@cyoda/workflow-layout';
|
|
4
|
+
export { LayoutOptions, LayoutPreset, PinnedNode } from '@cyoda/workflow-layout';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
|
|
7
|
+
declare const defaultMessages: {
|
|
8
|
+
toolbar: {
|
|
9
|
+
undo: string;
|
|
10
|
+
redo: string;
|
|
11
|
+
validate: string;
|
|
12
|
+
errors: string;
|
|
13
|
+
warnings: string;
|
|
14
|
+
infos: string;
|
|
15
|
+
save: string;
|
|
16
|
+
addWorkflow: string;
|
|
17
|
+
};
|
|
18
|
+
inspector: {
|
|
19
|
+
empty: string;
|
|
20
|
+
properties: string;
|
|
21
|
+
json: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
version: string;
|
|
25
|
+
active: string;
|
|
26
|
+
initialState: string;
|
|
27
|
+
manual: string;
|
|
28
|
+
disabled: string;
|
|
29
|
+
processors: string;
|
|
30
|
+
criterion: string;
|
|
31
|
+
executionMode: string;
|
|
32
|
+
addProcessor: string;
|
|
33
|
+
removeProcessor: string;
|
|
34
|
+
moveUp: string;
|
|
35
|
+
moveDown: string;
|
|
36
|
+
issues: string;
|
|
37
|
+
sourceAnchor: string;
|
|
38
|
+
targetAnchor: string;
|
|
39
|
+
anchorDefault: string;
|
|
40
|
+
anchorTop: string;
|
|
41
|
+
anchorRight: string;
|
|
42
|
+
anchorBottom: string;
|
|
43
|
+
anchorLeft: string;
|
|
44
|
+
};
|
|
45
|
+
confirmDelete: {
|
|
46
|
+
title: string;
|
|
47
|
+
message: string;
|
|
48
|
+
transitionsAffected: string;
|
|
49
|
+
confirm: string;
|
|
50
|
+
cancel: string;
|
|
51
|
+
};
|
|
52
|
+
dragConnect: {
|
|
53
|
+
title: string;
|
|
54
|
+
transitionName: string;
|
|
55
|
+
create: string;
|
|
56
|
+
cancel: string;
|
|
57
|
+
invalidName: string;
|
|
58
|
+
duplicateName: string;
|
|
59
|
+
};
|
|
60
|
+
tabs: {
|
|
61
|
+
closeTab: string;
|
|
62
|
+
untitled: string;
|
|
63
|
+
};
|
|
64
|
+
saveConfirm: {
|
|
65
|
+
title: string;
|
|
66
|
+
modeLabel: string;
|
|
67
|
+
ackReplace: string;
|
|
68
|
+
ackActivate: string;
|
|
69
|
+
ackWarnings: string;
|
|
70
|
+
confirm: string;
|
|
71
|
+
cancel: string;
|
|
72
|
+
};
|
|
73
|
+
conflict: {
|
|
74
|
+
message: string;
|
|
75
|
+
reload: string;
|
|
76
|
+
forceOverwrite: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type Messages = typeof defaultMessages;
|
|
80
|
+
|
|
81
|
+
declare const I18nContext: react.Context<{
|
|
82
|
+
toolbar: {
|
|
83
|
+
undo: string;
|
|
84
|
+
redo: string;
|
|
85
|
+
validate: string;
|
|
86
|
+
errors: string;
|
|
87
|
+
warnings: string;
|
|
88
|
+
infos: string;
|
|
89
|
+
save: string;
|
|
90
|
+
addWorkflow: string;
|
|
91
|
+
};
|
|
92
|
+
inspector: {
|
|
93
|
+
empty: string;
|
|
94
|
+
properties: string;
|
|
95
|
+
json: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
version: string;
|
|
99
|
+
active: string;
|
|
100
|
+
initialState: string;
|
|
101
|
+
manual: string;
|
|
102
|
+
disabled: string;
|
|
103
|
+
processors: string;
|
|
104
|
+
criterion: string;
|
|
105
|
+
executionMode: string;
|
|
106
|
+
addProcessor: string;
|
|
107
|
+
removeProcessor: string;
|
|
108
|
+
moveUp: string;
|
|
109
|
+
moveDown: string;
|
|
110
|
+
issues: string;
|
|
111
|
+
sourceAnchor: string;
|
|
112
|
+
targetAnchor: string;
|
|
113
|
+
anchorDefault: string;
|
|
114
|
+
anchorTop: string;
|
|
115
|
+
anchorRight: string;
|
|
116
|
+
anchorBottom: string;
|
|
117
|
+
anchorLeft: string;
|
|
118
|
+
};
|
|
119
|
+
confirmDelete: {
|
|
120
|
+
title: string;
|
|
121
|
+
message: string;
|
|
122
|
+
transitionsAffected: string;
|
|
123
|
+
confirm: string;
|
|
124
|
+
cancel: string;
|
|
125
|
+
};
|
|
126
|
+
dragConnect: {
|
|
127
|
+
title: string;
|
|
128
|
+
transitionName: string;
|
|
129
|
+
create: string;
|
|
130
|
+
cancel: string;
|
|
131
|
+
invalidName: string;
|
|
132
|
+
duplicateName: string;
|
|
133
|
+
};
|
|
134
|
+
tabs: {
|
|
135
|
+
closeTab: string;
|
|
136
|
+
untitled: string;
|
|
137
|
+
};
|
|
138
|
+
saveConfirm: {
|
|
139
|
+
title: string;
|
|
140
|
+
modeLabel: string;
|
|
141
|
+
ackReplace: string;
|
|
142
|
+
ackActivate: string;
|
|
143
|
+
ackWarnings: string;
|
|
144
|
+
confirm: string;
|
|
145
|
+
cancel: string;
|
|
146
|
+
};
|
|
147
|
+
conflict: {
|
|
148
|
+
message: string;
|
|
149
|
+
reload: string;
|
|
150
|
+
forceOverwrite: string;
|
|
151
|
+
};
|
|
152
|
+
}>;
|
|
153
|
+
declare function useMessages(): Messages;
|
|
154
|
+
type PartialMessages = {
|
|
155
|
+
[K in keyof Messages]?: Partial<Messages[K]>;
|
|
156
|
+
};
|
|
157
|
+
declare function mergeMessages(overrides?: PartialMessages): Messages;
|
|
158
|
+
|
|
159
|
+
type EditorMode = "viewer" | "playground" | "editor";
|
|
160
|
+
/** What the user currently has selected on the canvas or inspector. */
|
|
161
|
+
type Selection = null | {
|
|
162
|
+
kind: "workflow";
|
|
163
|
+
workflow: string;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "state";
|
|
166
|
+
workflow: string;
|
|
167
|
+
stateCode: string;
|
|
168
|
+
nodeId: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "transition";
|
|
171
|
+
transitionUuid: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "processor";
|
|
174
|
+
processorUuid: string;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "criterion";
|
|
177
|
+
hostKind: "workflow" | "transition";
|
|
178
|
+
hostId: string;
|
|
179
|
+
path: string[];
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
interface WorkflowEditorProps {
|
|
183
|
+
document: WorkflowEditorDocument;
|
|
184
|
+
mode?: EditorMode;
|
|
185
|
+
messages?: PartialMessages;
|
|
186
|
+
layoutOptions?: LayoutOptions;
|
|
187
|
+
onChange?: (doc: WorkflowEditorDocument) => void;
|
|
188
|
+
onSave?: (doc: WorkflowEditorDocument) => void;
|
|
189
|
+
}
|
|
190
|
+
/** Top-level editor shell — spec §14. Provides viewer/playground/editor modes. */
|
|
191
|
+
declare function WorkflowEditor({ document: initialDocument, mode, messages, layoutOptions, onChange, onSave, }: WorkflowEditorProps): react_jsx_runtime.JSX.Element;
|
|
192
|
+
|
|
193
|
+
interface UseSaveFlowArgs {
|
|
194
|
+
api: WorkflowApi;
|
|
195
|
+
document: WorkflowEditorDocument;
|
|
196
|
+
/**
|
|
197
|
+
* Concurrency token from the last successful `exportWorkflows` / `importWorkflows`.
|
|
198
|
+
* `null` means we have no server context (first-save scenario).
|
|
199
|
+
*/
|
|
200
|
+
concurrencyToken: ConcurrencyToken | null;
|
|
201
|
+
/** Called after a successful save to refresh the session and token. */
|
|
202
|
+
onSaved: (nextToken: ConcurrencyToken | null) => void;
|
|
203
|
+
/** Called when the user chooses "Reload" from the conflict banner. */
|
|
204
|
+
onReload?: () => void;
|
|
205
|
+
}
|
|
206
|
+
interface SaveFlow {
|
|
207
|
+
status: SaveStatus;
|
|
208
|
+
/** Show the confirmation modal — REPLACE / ACTIVATE require explicit confirm (§17.3). */
|
|
209
|
+
requestSave: () => void;
|
|
210
|
+
/** Called from the modal after the user confirms. */
|
|
211
|
+
confirmSave: () => Promise<void>;
|
|
212
|
+
/** Dismiss the confirmation modal without dispatching. */
|
|
213
|
+
cancel: () => void;
|
|
214
|
+
/** Force-overwrite branch of the 409 banner (§17.4). */
|
|
215
|
+
forceOverwrite: () => Promise<void>;
|
|
216
|
+
/** Reload branch of the 409 banner — delegates to `onReload`. */
|
|
217
|
+
reload: () => void;
|
|
218
|
+
/** Reset status back to idle after viewing a success/error toast. */
|
|
219
|
+
clear: () => void;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Save-flow hook per spec §17.3. Owns the modal/banner state machine so
|
|
223
|
+
* the shell only needs to render the current `status` and call `requestSave`
|
|
224
|
+
* from the toolbar's Save button.
|
|
225
|
+
*/
|
|
226
|
+
declare function useSaveFlow(args: UseSaveFlowArgs): SaveFlow;
|
|
227
|
+
|
|
228
|
+
interface SaveConfirmModalProps {
|
|
229
|
+
mode: ImportMode;
|
|
230
|
+
requiresExplicitConfirm: boolean;
|
|
231
|
+
warningCount: number;
|
|
232
|
+
document: WorkflowEditorDocument;
|
|
233
|
+
/** Summary of changes vs. server state — rendered verbatim above the
|
|
234
|
+
* confirm button. Callers who have not fetched server state pass null. */
|
|
235
|
+
diffSummary?: string | null;
|
|
236
|
+
onConfirm: () => void;
|
|
237
|
+
onCancel: () => void;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Save confirmation modal per spec §17.3 + §18.5.
|
|
241
|
+
*
|
|
242
|
+
* - REPLACE / ACTIVATE require a tick on "I understand this replaces /
|
|
243
|
+
* activates server state" before the confirm button enables.
|
|
244
|
+
* - When warnings are present, a separate tick is required acknowledging
|
|
245
|
+
* the warning count.
|
|
246
|
+
* - The diff summary (if provided) is shown above the tick-boxes.
|
|
247
|
+
*/
|
|
248
|
+
declare function SaveConfirmModal({ mode, requiresExplicitConfirm, warningCount, diffSummary, onConfirm, onCancel, }: SaveConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
249
|
+
|
|
250
|
+
interface ConflictBannerProps {
|
|
251
|
+
onReload: () => void;
|
|
252
|
+
onForceOverwrite: () => void;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 409-conflict banner per spec §17.4. Non-dismissable; the user must pick
|
|
256
|
+
* Reload (discard local) or Force overwrite (resend without the token).
|
|
257
|
+
*/
|
|
258
|
+
declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Produce a short human-readable diff summary between the last-known server
|
|
262
|
+
* document and the current editor document (spec §17.3). Counts workflows /
|
|
263
|
+
* states / transitions added, removed, or changed; returns null when no
|
|
264
|
+
* server document is available (first-save scenario).
|
|
265
|
+
*
|
|
266
|
+
* The summary is intentionally coarse — detailed diffs belong in a dedicated
|
|
267
|
+
* compare view, not a modal.
|
|
268
|
+
*/
|
|
269
|
+
declare function diffSummary(server: WorkflowEditorDocument | null, local: WorkflowEditorDocument): string | null;
|
|
270
|
+
|
|
271
|
+
export { ConflictBanner, type ConflictBannerProps, type EditorMode, I18nContext, type Messages, type PartialMessages, SaveConfirmModal, type SaveConfirmModalProps, type SaveFlow, type Selection, type UseSaveFlowArgs, WorkflowEditor, type WorkflowEditorProps, defaultMessages, diffSummary, mergeMessages, useMessages, useSaveFlow };
|