@cyoda/workflow-react 0.1.0 → 0.3.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/README.md +165 -14
- package/dist/index.cjs +6712 -1132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +245 -7
- package/dist/index.d.ts +245 -7
- package/dist/index.js +6729 -1127
- package/dist/index.js.map +1 -1
- package/package.json +19 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { WorkflowEditorDocument, WorkflowUiMeta, SaveStatus, WorkflowApi, ConcurrencyToken, ImportMode } from '@cyoda/workflow-core';
|
|
3
4
|
import { LayoutOptions } from '@cyoda/workflow-layout';
|
|
4
5
|
export { LayoutOptions, LayoutPreset, PinnedNode } from '@cyoda/workflow-layout';
|
|
5
|
-
import
|
|
6
|
+
import { LiftResult, WorkflowJsonMonacoRuntime } from '@cyoda/workflow-monaco';
|
|
7
|
+
export { WorkflowJsonEditorInstance, WorkflowJsonModelLike, WorkflowJsonMonacoRuntime } from '@cyoda/workflow-monaco';
|
|
6
8
|
|
|
7
9
|
declare const defaultMessages: {
|
|
8
10
|
toolbar: {
|
|
@@ -14,6 +16,59 @@ declare const defaultMessages: {
|
|
|
14
16
|
infos: string;
|
|
15
17
|
save: string;
|
|
16
18
|
addWorkflow: string;
|
|
19
|
+
autoLayout: string;
|
|
20
|
+
resetLayout: string;
|
|
21
|
+
addState: string;
|
|
22
|
+
addNote: string;
|
|
23
|
+
addStateButton: string;
|
|
24
|
+
help: string;
|
|
25
|
+
};
|
|
26
|
+
help: {
|
|
27
|
+
title: string;
|
|
28
|
+
statesTitle: string;
|
|
29
|
+
stateInitial: string;
|
|
30
|
+
stateDefault: string;
|
|
31
|
+
stateProcessing: string;
|
|
32
|
+
stateManualReview: string;
|
|
33
|
+
stateTerminal: string;
|
|
34
|
+
stateError: string;
|
|
35
|
+
stateWarning: string;
|
|
36
|
+
transitionsTitle: string;
|
|
37
|
+
transitionAutomated: string;
|
|
38
|
+
transitionManual: string;
|
|
39
|
+
transitionConditional: string;
|
|
40
|
+
transitionProcessing: string;
|
|
41
|
+
transitionTerminal: string;
|
|
42
|
+
transitionLoop: string;
|
|
43
|
+
transitionDisabled: string;
|
|
44
|
+
controlsTitle: string;
|
|
45
|
+
shortcutAddState: string;
|
|
46
|
+
shortcutAutoLayout: string;
|
|
47
|
+
shortcutUndo: string;
|
|
48
|
+
shortcutRedo: string;
|
|
49
|
+
shortcutSave: string;
|
|
50
|
+
shortcutDelete: string;
|
|
51
|
+
shortcutEscape: string;
|
|
52
|
+
tipsTitle: string;
|
|
53
|
+
tipDoubleClick: string;
|
|
54
|
+
tipConnect: string;
|
|
55
|
+
tipSelect: string;
|
|
56
|
+
tipMove: string;
|
|
57
|
+
close: string;
|
|
58
|
+
};
|
|
59
|
+
issues: {
|
|
60
|
+
title: string;
|
|
61
|
+
none: string;
|
|
62
|
+
errors: string;
|
|
63
|
+
warnings: string;
|
|
64
|
+
infos: string;
|
|
65
|
+
jumpTo: string;
|
|
66
|
+
relatedState: string;
|
|
67
|
+
relatedTransition: string;
|
|
68
|
+
close: string;
|
|
69
|
+
openErrors: string;
|
|
70
|
+
openWarnings: string;
|
|
71
|
+
openInfos: string;
|
|
17
72
|
};
|
|
18
73
|
inspector: {
|
|
19
74
|
empty: string;
|
|
@@ -24,23 +79,36 @@ declare const defaultMessages: {
|
|
|
24
79
|
version: string;
|
|
25
80
|
active: string;
|
|
26
81
|
initialState: string;
|
|
82
|
+
transitionType: string;
|
|
83
|
+
automated: string;
|
|
27
84
|
manual: string;
|
|
28
85
|
disabled: string;
|
|
29
86
|
processors: string;
|
|
87
|
+
processes: string;
|
|
30
88
|
criterion: string;
|
|
89
|
+
criteria: string;
|
|
31
90
|
executionMode: string;
|
|
32
91
|
addProcessor: string;
|
|
33
92
|
removeProcessor: string;
|
|
34
93
|
moveUp: string;
|
|
35
94
|
moveDown: string;
|
|
95
|
+
transitionOrderHelp: string;
|
|
36
96
|
issues: string;
|
|
37
97
|
sourceAnchor: string;
|
|
38
98
|
targetAnchor: string;
|
|
39
99
|
anchorDefault: string;
|
|
100
|
+
anchorTopLeft: string;
|
|
40
101
|
anchorTop: string;
|
|
102
|
+
anchorTopRight: string;
|
|
103
|
+
anchorRightTop: string;
|
|
41
104
|
anchorRight: string;
|
|
105
|
+
anchorRightBottom: string;
|
|
106
|
+
anchorBottomLeft: string;
|
|
42
107
|
anchorBottom: string;
|
|
108
|
+
anchorBottomRight: string;
|
|
109
|
+
anchorLeftTop: string;
|
|
43
110
|
anchorLeft: string;
|
|
111
|
+
anchorLeftBottom: string;
|
|
44
112
|
};
|
|
45
113
|
confirmDelete: {
|
|
46
114
|
title: string;
|
|
@@ -61,6 +129,14 @@ declare const defaultMessages: {
|
|
|
61
129
|
closeTab: string;
|
|
62
130
|
untitled: string;
|
|
63
131
|
};
|
|
132
|
+
editorView: {
|
|
133
|
+
graph: string;
|
|
134
|
+
json: string;
|
|
135
|
+
unavailable: string;
|
|
136
|
+
invalidJson: string;
|
|
137
|
+
invalidSchema: string;
|
|
138
|
+
semanticErrors: string;
|
|
139
|
+
};
|
|
64
140
|
saveConfirm: {
|
|
65
141
|
title: string;
|
|
66
142
|
modeLabel: string;
|
|
@@ -75,6 +151,19 @@ declare const defaultMessages: {
|
|
|
75
151
|
reload: string;
|
|
76
152
|
forceOverwrite: string;
|
|
77
153
|
};
|
|
154
|
+
criterion: {
|
|
155
|
+
heading: string;
|
|
156
|
+
addTitle: string;
|
|
157
|
+
editTitle: string;
|
|
158
|
+
add: string;
|
|
159
|
+
edit: string;
|
|
160
|
+
remove: string;
|
|
161
|
+
noneManual: string;
|
|
162
|
+
noneAutomated: string;
|
|
163
|
+
noneAutomatedWarning: string;
|
|
164
|
+
cancel: string;
|
|
165
|
+
applyModal: string;
|
|
166
|
+
};
|
|
78
167
|
};
|
|
79
168
|
type Messages = typeof defaultMessages;
|
|
80
169
|
|
|
@@ -88,6 +177,59 @@ declare const I18nContext: react.Context<{
|
|
|
88
177
|
infos: string;
|
|
89
178
|
save: string;
|
|
90
179
|
addWorkflow: string;
|
|
180
|
+
autoLayout: string;
|
|
181
|
+
resetLayout: string;
|
|
182
|
+
addState: string;
|
|
183
|
+
addNote: string;
|
|
184
|
+
addStateButton: string;
|
|
185
|
+
help: string;
|
|
186
|
+
};
|
|
187
|
+
help: {
|
|
188
|
+
title: string;
|
|
189
|
+
statesTitle: string;
|
|
190
|
+
stateInitial: string;
|
|
191
|
+
stateDefault: string;
|
|
192
|
+
stateProcessing: string;
|
|
193
|
+
stateManualReview: string;
|
|
194
|
+
stateTerminal: string;
|
|
195
|
+
stateError: string;
|
|
196
|
+
stateWarning: string;
|
|
197
|
+
transitionsTitle: string;
|
|
198
|
+
transitionAutomated: string;
|
|
199
|
+
transitionManual: string;
|
|
200
|
+
transitionConditional: string;
|
|
201
|
+
transitionProcessing: string;
|
|
202
|
+
transitionTerminal: string;
|
|
203
|
+
transitionLoop: string;
|
|
204
|
+
transitionDisabled: string;
|
|
205
|
+
controlsTitle: string;
|
|
206
|
+
shortcutAddState: string;
|
|
207
|
+
shortcutAutoLayout: string;
|
|
208
|
+
shortcutUndo: string;
|
|
209
|
+
shortcutRedo: string;
|
|
210
|
+
shortcutSave: string;
|
|
211
|
+
shortcutDelete: string;
|
|
212
|
+
shortcutEscape: string;
|
|
213
|
+
tipsTitle: string;
|
|
214
|
+
tipDoubleClick: string;
|
|
215
|
+
tipConnect: string;
|
|
216
|
+
tipSelect: string;
|
|
217
|
+
tipMove: string;
|
|
218
|
+
close: string;
|
|
219
|
+
};
|
|
220
|
+
issues: {
|
|
221
|
+
title: string;
|
|
222
|
+
none: string;
|
|
223
|
+
errors: string;
|
|
224
|
+
warnings: string;
|
|
225
|
+
infos: string;
|
|
226
|
+
jumpTo: string;
|
|
227
|
+
relatedState: string;
|
|
228
|
+
relatedTransition: string;
|
|
229
|
+
close: string;
|
|
230
|
+
openErrors: string;
|
|
231
|
+
openWarnings: string;
|
|
232
|
+
openInfos: string;
|
|
91
233
|
};
|
|
92
234
|
inspector: {
|
|
93
235
|
empty: string;
|
|
@@ -98,23 +240,36 @@ declare const I18nContext: react.Context<{
|
|
|
98
240
|
version: string;
|
|
99
241
|
active: string;
|
|
100
242
|
initialState: string;
|
|
243
|
+
transitionType: string;
|
|
244
|
+
automated: string;
|
|
101
245
|
manual: string;
|
|
102
246
|
disabled: string;
|
|
103
247
|
processors: string;
|
|
248
|
+
processes: string;
|
|
104
249
|
criterion: string;
|
|
250
|
+
criteria: string;
|
|
105
251
|
executionMode: string;
|
|
106
252
|
addProcessor: string;
|
|
107
253
|
removeProcessor: string;
|
|
108
254
|
moveUp: string;
|
|
109
255
|
moveDown: string;
|
|
256
|
+
transitionOrderHelp: string;
|
|
110
257
|
issues: string;
|
|
111
258
|
sourceAnchor: string;
|
|
112
259
|
targetAnchor: string;
|
|
113
260
|
anchorDefault: string;
|
|
261
|
+
anchorTopLeft: string;
|
|
114
262
|
anchorTop: string;
|
|
263
|
+
anchorTopRight: string;
|
|
264
|
+
anchorRightTop: string;
|
|
115
265
|
anchorRight: string;
|
|
266
|
+
anchorRightBottom: string;
|
|
267
|
+
anchorBottomLeft: string;
|
|
116
268
|
anchorBottom: string;
|
|
269
|
+
anchorBottomRight: string;
|
|
270
|
+
anchorLeftTop: string;
|
|
117
271
|
anchorLeft: string;
|
|
272
|
+
anchorLeftBottom: string;
|
|
118
273
|
};
|
|
119
274
|
confirmDelete: {
|
|
120
275
|
title: string;
|
|
@@ -135,6 +290,14 @@ declare const I18nContext: react.Context<{
|
|
|
135
290
|
closeTab: string;
|
|
136
291
|
untitled: string;
|
|
137
292
|
};
|
|
293
|
+
editorView: {
|
|
294
|
+
graph: string;
|
|
295
|
+
json: string;
|
|
296
|
+
unavailable: string;
|
|
297
|
+
invalidJson: string;
|
|
298
|
+
invalidSchema: string;
|
|
299
|
+
semanticErrors: string;
|
|
300
|
+
};
|
|
138
301
|
saveConfirm: {
|
|
139
302
|
title: string;
|
|
140
303
|
modeLabel: string;
|
|
@@ -149,6 +312,19 @@ declare const I18nContext: react.Context<{
|
|
|
149
312
|
reload: string;
|
|
150
313
|
forceOverwrite: string;
|
|
151
314
|
};
|
|
315
|
+
criterion: {
|
|
316
|
+
heading: string;
|
|
317
|
+
addTitle: string;
|
|
318
|
+
editTitle: string;
|
|
319
|
+
add: string;
|
|
320
|
+
edit: string;
|
|
321
|
+
remove: string;
|
|
322
|
+
noneManual: string;
|
|
323
|
+
noneAutomated: string;
|
|
324
|
+
noneAutomatedWarning: string;
|
|
325
|
+
cancel: string;
|
|
326
|
+
applyModal: string;
|
|
327
|
+
};
|
|
152
328
|
}>;
|
|
153
329
|
declare function useMessages(): Messages;
|
|
154
330
|
type PartialMessages = {
|
|
@@ -179,16 +355,78 @@ type Selection = null | {
|
|
|
179
355
|
path: string[];
|
|
180
356
|
};
|
|
181
357
|
|
|
358
|
+
type JsonEditStatus = LiftResult | {
|
|
359
|
+
status: "idle";
|
|
360
|
+
};
|
|
361
|
+
interface WorkflowJsonEditorConfig {
|
|
362
|
+
monaco: WorkflowJsonMonacoRuntime;
|
|
363
|
+
modelUri?: string;
|
|
364
|
+
editorOptions?: Record<string, unknown>;
|
|
365
|
+
debounceMs?: number;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** Controls which chrome elements the editor shell renders. All fields default to `true`. */
|
|
369
|
+
interface ChromeOptions {
|
|
370
|
+
/** Top toolbar (undo/redo/validation pills/save). Default: true. */
|
|
371
|
+
toolbar?: boolean;
|
|
372
|
+
/** Workflow tabs bar. Default: true (also gated by existing single-workflow-viewer rule). */
|
|
373
|
+
tabs?: boolean;
|
|
374
|
+
/** Right-side inspector panel. Default: true. */
|
|
375
|
+
inspector?: boolean;
|
|
376
|
+
/** Canvas minimap. Default: true. */
|
|
377
|
+
minimap?: boolean;
|
|
378
|
+
/** Canvas zoom/pan controls. Default: true. */
|
|
379
|
+
controls?: boolean;
|
|
380
|
+
}
|
|
182
381
|
interface WorkflowEditorProps {
|
|
183
382
|
document: WorkflowEditorDocument;
|
|
184
383
|
mode?: EditorMode;
|
|
384
|
+
surface?: WorkflowEditorSurface;
|
|
385
|
+
layout?: WorkflowEditorLayout;
|
|
185
386
|
messages?: PartialMessages;
|
|
186
387
|
layoutOptions?: LayoutOptions;
|
|
388
|
+
/** Selectively suppress editor chrome for compact embed scenarios. */
|
|
389
|
+
chrome?: ChromeOptions;
|
|
187
390
|
onChange?: (doc: WorkflowEditorDocument) => void;
|
|
188
391
|
onSave?: (doc: WorkflowEditorDocument) => void;
|
|
392
|
+
showSaveButton?: boolean;
|
|
393
|
+
toolbarStart?: ReactNode;
|
|
394
|
+
toolbarCenter?: ReactNode;
|
|
395
|
+
toolbarEnd?: ReactNode;
|
|
396
|
+
/**
|
|
397
|
+
* Host-controlled layout/UI metadata. When provided it takes precedence over
|
|
398
|
+
* the editor's internal localStorage persistence.
|
|
399
|
+
*/
|
|
400
|
+
layoutMetadata?: WorkflowUiMeta;
|
|
401
|
+
/** Called whenever layout positions or other editor-only metadata change. */
|
|
402
|
+
onLayoutMetadataChange?: (meta: WorkflowUiMeta) => void;
|
|
403
|
+
/** Called with the full per-workflow UI map whenever any layout changes — use this for file-based persistence. */
|
|
404
|
+
onWorkflowUiChange?: (workflowUi: Record<string, WorkflowUiMeta>) => void;
|
|
405
|
+
/**
|
|
406
|
+
* localStorage key prefix for layout persistence. Defaults to
|
|
407
|
+
* "cyoda-editor-layout". Pass `null` to disable localStorage persistence.
|
|
408
|
+
*/
|
|
409
|
+
localStorageKey?: string | null;
|
|
410
|
+
/** Enables the canonical JSON editing surface inside the editor shell. */
|
|
411
|
+
enableJsonEditor?: boolean;
|
|
412
|
+
/** Controls whether JSON appears as a tab or alongside the graph. */
|
|
413
|
+
jsonEditorPlacement?: "tab" | "split";
|
|
414
|
+
/** Optional host-supplied Monaco runtime/configuration. */
|
|
415
|
+
jsonEditor?: WorkflowJsonEditorConfig | null;
|
|
416
|
+
/** Reports JSON parse/schema/apply status for host UX. */
|
|
417
|
+
onJsonStatusChange?: (status: JsonEditStatus) => void;
|
|
418
|
+
/**
|
|
419
|
+
* Show developer-oriented affordances (raw JSON tab in the inspector and
|
|
420
|
+
* other diagnostics). Defaults to `false` so SMEs/BAs see a clean view.
|
|
421
|
+
* Existing demo and admin surfaces that previously relied on the JSON tab
|
|
422
|
+
* should opt in explicitly with `developerMode={true}`.
|
|
423
|
+
*/
|
|
424
|
+
developerMode?: boolean;
|
|
189
425
|
}
|
|
426
|
+
type WorkflowEditorSurface = "dev-console";
|
|
427
|
+
type WorkflowEditorLayout = "embedded" | "fullWidth";
|
|
190
428
|
/** Top-level editor shell — spec §14. Provides viewer/playground/editor modes. */
|
|
191
|
-
declare function WorkflowEditor({ document: initialDocument, mode, messages, layoutOptions, onChange, onSave, }: WorkflowEditorProps):
|
|
429
|
+
declare function WorkflowEditor({ document: initialDocument, mode, surface, layout, messages, layoutOptions, chrome, onChange, onSave, showSaveButton, toolbarStart, toolbarCenter, toolbarEnd, layoutMetadata: externalLayoutMeta, onLayoutMetadataChange, onWorkflowUiChange, localStorageKey, enableJsonEditor, jsonEditorPlacement, jsonEditor, onJsonStatusChange, developerMode, }: WorkflowEditorProps): react.JSX.Element;
|
|
192
430
|
|
|
193
431
|
interface UseSaveFlowArgs {
|
|
194
432
|
api: WorkflowApi;
|
|
@@ -245,7 +483,7 @@ interface SaveConfirmModalProps {
|
|
|
245
483
|
* the warning count.
|
|
246
484
|
* - The diff summary (if provided) is shown above the tick-boxes.
|
|
247
485
|
*/
|
|
248
|
-
declare function SaveConfirmModal({ mode, requiresExplicitConfirm, warningCount, diffSummary, onConfirm, onCancel, }: SaveConfirmModalProps):
|
|
486
|
+
declare function SaveConfirmModal({ mode, requiresExplicitConfirm, warningCount, diffSummary, onConfirm, onCancel, }: SaveConfirmModalProps): react.JSX.Element;
|
|
249
487
|
|
|
250
488
|
interface ConflictBannerProps {
|
|
251
489
|
onReload: () => void;
|
|
@@ -255,7 +493,7 @@ interface ConflictBannerProps {
|
|
|
255
493
|
* 409-conflict banner per spec §17.4. Non-dismissable; the user must pick
|
|
256
494
|
* Reload (discard local) or Force overwrite (resend without the token).
|
|
257
495
|
*/
|
|
258
|
-
declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerProps):
|
|
496
|
+
declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerProps): react.JSX.Element;
|
|
259
497
|
|
|
260
498
|
/**
|
|
261
499
|
* Produce a short human-readable diff summary between the last-known server
|
|
@@ -268,4 +506,4 @@ declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerPr
|
|
|
268
506
|
*/
|
|
269
507
|
declare function diffSummary(server: WorkflowEditorDocument | null, local: WorkflowEditorDocument): string | null;
|
|
270
508
|
|
|
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 };
|
|
509
|
+
export { type ChromeOptions, ConflictBanner, type ConflictBannerProps, type EditorMode, I18nContext, type JsonEditStatus, type Messages, type PartialMessages, SaveConfirmModal, type SaveConfirmModalProps, type SaveFlow, type Selection, type UseSaveFlowArgs, WorkflowEditor, type WorkflowEditorLayout, type WorkflowEditorProps, type WorkflowEditorSurface, type WorkflowJsonEditorConfig, defaultMessages, diffSummary, mergeMessages, useMessages, useSaveFlow };
|