@cyoda/workflow-react 0.1.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,8 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { WorkflowEditorDocument, SaveStatus, WorkflowApi, ConcurrencyToken, ImportMode } from '@cyoda/workflow-core';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { WorkflowEditorDocument, WorkflowUiMeta, EntityFieldHintProvider, SaveStatus, WorkflowApi, ConcurrencyToken, ImportMode } from '@cyoda/workflow-core';
5
+ export { EntityFieldHintProvider, FieldHint } from '@cyoda/workflow-core';
3
6
  import { LayoutOptions } from '@cyoda/workflow-layout';
4
7
  export { LayoutOptions, LayoutPreset, PinnedNode } from '@cyoda/workflow-layout';
5
- import * as react from 'react';
8
+ import { LiftResult, MonacoLike, TextModelLike, EditorLike } from '@cyoda/workflow-monaco';
6
9
 
7
10
  declare const defaultMessages: {
8
11
  toolbar: {
@@ -14,6 +17,25 @@ declare const defaultMessages: {
14
17
  infos: string;
15
18
  save: string;
16
19
  addWorkflow: string;
20
+ autoLayout: string;
21
+ resetLayout: string;
22
+ addState: string;
23
+ addNote: string;
24
+ addStateButton: string;
25
+ };
26
+ issues: {
27
+ title: string;
28
+ none: string;
29
+ errors: string;
30
+ warnings: string;
31
+ infos: string;
32
+ jumpTo: string;
33
+ relatedState: string;
34
+ relatedTransition: string;
35
+ close: string;
36
+ openErrors: string;
37
+ openWarnings: string;
38
+ openInfos: string;
17
39
  };
18
40
  inspector: {
19
41
  empty: string;
@@ -24,23 +46,36 @@ declare const defaultMessages: {
24
46
  version: string;
25
47
  active: string;
26
48
  initialState: string;
49
+ transitionType: string;
50
+ automated: string;
27
51
  manual: string;
28
52
  disabled: string;
29
53
  processors: string;
54
+ processes: string;
30
55
  criterion: string;
56
+ criteria: string;
31
57
  executionMode: string;
32
58
  addProcessor: string;
33
59
  removeProcessor: string;
34
60
  moveUp: string;
35
61
  moveDown: string;
62
+ transitionOrderHelp: string;
36
63
  issues: string;
37
64
  sourceAnchor: string;
38
65
  targetAnchor: string;
39
66
  anchorDefault: string;
67
+ anchorTopLeft: string;
40
68
  anchorTop: string;
69
+ anchorTopRight: string;
70
+ anchorRightTop: string;
41
71
  anchorRight: string;
72
+ anchorRightBottom: string;
73
+ anchorBottomLeft: string;
42
74
  anchorBottom: string;
75
+ anchorBottomRight: string;
76
+ anchorLeftTop: string;
43
77
  anchorLeft: string;
78
+ anchorLeftBottom: string;
44
79
  };
45
80
  confirmDelete: {
46
81
  title: string;
@@ -61,6 +96,14 @@ declare const defaultMessages: {
61
96
  closeTab: string;
62
97
  untitled: string;
63
98
  };
99
+ editorView: {
100
+ graph: string;
101
+ json: string;
102
+ unavailable: string;
103
+ invalidJson: string;
104
+ invalidSchema: string;
105
+ semanticErrors: string;
106
+ };
64
107
  saveConfirm: {
65
108
  title: string;
66
109
  modeLabel: string;
@@ -75,6 +118,104 @@ declare const defaultMessages: {
75
118
  reload: string;
76
119
  forceOverwrite: string;
77
120
  };
121
+ criterion: {
122
+ heading: string;
123
+ addTitle: string;
124
+ editTitle: string;
125
+ add: string;
126
+ edit: string;
127
+ remove: string;
128
+ noneManual: string;
129
+ noneAutomated: string;
130
+ noneAutomatedWarning: string;
131
+ type: string;
132
+ jsonPath: string;
133
+ operation: string;
134
+ value: string;
135
+ low: string;
136
+ high: string;
137
+ apply: string;
138
+ applyModal: string;
139
+ cancel: string;
140
+ advanced: string;
141
+ editJson: string;
142
+ backToForm: string;
143
+ preview: string;
144
+ changeType: string;
145
+ chooseConditionType: string;
146
+ types: {
147
+ simple: string;
148
+ lifecycle: string;
149
+ function: string;
150
+ array: string;
151
+ group: string;
152
+ };
153
+ invalidJson: string;
154
+ valueIgnored: string;
155
+ legacySuffix: string;
156
+ legacyOperatorBanner: string;
157
+ legacyNotBanner: string;
158
+ likeHelp: string;
159
+ matchesPatternHelpAlways: string;
160
+ jsonPathError: {
161
+ empty: string;
162
+ "missing-root": string;
163
+ "recursive-descent": string;
164
+ "filter-expression": string;
165
+ malformed: string;
166
+ };
167
+ betweenShape: string;
168
+ likeWildcardHelp: string;
169
+ matchesPatternHelp: string;
170
+ wrapInGroup: string;
171
+ group: {
172
+ heading: string;
173
+ operator: string;
174
+ allConditions: string;
175
+ anyCondition: string;
176
+ addCondition: string;
177
+ addGroup: string;
178
+ edit: string;
179
+ editing: string;
180
+ complete: string;
181
+ duplicate: string;
182
+ moveUp: string;
183
+ moveDown: string;
184
+ remove: string;
185
+ valid: string;
186
+ invalid: string;
187
+ empty: string;
188
+ condition: string;
189
+ depthWarning: string;
190
+ legacyNotSuffix: string;
191
+ };
192
+ function: {
193
+ name: string;
194
+ nameEmpty: string;
195
+ nameInvalid: string;
196
+ config: string;
197
+ configInvalid: string;
198
+ precheck: string;
199
+ precheckAdd: string;
200
+ precheckRemove: string;
201
+ };
202
+ lifecycle: {
203
+ field: string;
204
+ };
205
+ array: {
206
+ values: string;
207
+ addValue: string;
208
+ addValuePlaceholder: string;
209
+ };
210
+ hints: {
211
+ loading: string;
212
+ error: string;
213
+ noEntity: string;
214
+ noMatches: string;
215
+ typeLabel: string;
216
+ retry: string;
217
+ };
218
+ };
78
219
  };
79
220
  type Messages = typeof defaultMessages;
80
221
 
@@ -88,6 +229,25 @@ declare const I18nContext: react.Context<{
88
229
  infos: string;
89
230
  save: string;
90
231
  addWorkflow: string;
232
+ autoLayout: string;
233
+ resetLayout: string;
234
+ addState: string;
235
+ addNote: string;
236
+ addStateButton: string;
237
+ };
238
+ issues: {
239
+ title: string;
240
+ none: string;
241
+ errors: string;
242
+ warnings: string;
243
+ infos: string;
244
+ jumpTo: string;
245
+ relatedState: string;
246
+ relatedTransition: string;
247
+ close: string;
248
+ openErrors: string;
249
+ openWarnings: string;
250
+ openInfos: string;
91
251
  };
92
252
  inspector: {
93
253
  empty: string;
@@ -98,23 +258,36 @@ declare const I18nContext: react.Context<{
98
258
  version: string;
99
259
  active: string;
100
260
  initialState: string;
261
+ transitionType: string;
262
+ automated: string;
101
263
  manual: string;
102
264
  disabled: string;
103
265
  processors: string;
266
+ processes: string;
104
267
  criterion: string;
268
+ criteria: string;
105
269
  executionMode: string;
106
270
  addProcessor: string;
107
271
  removeProcessor: string;
108
272
  moveUp: string;
109
273
  moveDown: string;
274
+ transitionOrderHelp: string;
110
275
  issues: string;
111
276
  sourceAnchor: string;
112
277
  targetAnchor: string;
113
278
  anchorDefault: string;
279
+ anchorTopLeft: string;
114
280
  anchorTop: string;
281
+ anchorTopRight: string;
282
+ anchorRightTop: string;
115
283
  anchorRight: string;
284
+ anchorRightBottom: string;
285
+ anchorBottomLeft: string;
116
286
  anchorBottom: string;
287
+ anchorBottomRight: string;
288
+ anchorLeftTop: string;
117
289
  anchorLeft: string;
290
+ anchorLeftBottom: string;
118
291
  };
119
292
  confirmDelete: {
120
293
  title: string;
@@ -135,6 +308,14 @@ declare const I18nContext: react.Context<{
135
308
  closeTab: string;
136
309
  untitled: string;
137
310
  };
311
+ editorView: {
312
+ graph: string;
313
+ json: string;
314
+ unavailable: string;
315
+ invalidJson: string;
316
+ invalidSchema: string;
317
+ semanticErrors: string;
318
+ };
138
319
  saveConfirm: {
139
320
  title: string;
140
321
  modeLabel: string;
@@ -149,6 +330,104 @@ declare const I18nContext: react.Context<{
149
330
  reload: string;
150
331
  forceOverwrite: string;
151
332
  };
333
+ criterion: {
334
+ heading: string;
335
+ addTitle: string;
336
+ editTitle: string;
337
+ add: string;
338
+ edit: string;
339
+ remove: string;
340
+ noneManual: string;
341
+ noneAutomated: string;
342
+ noneAutomatedWarning: string;
343
+ type: string;
344
+ jsonPath: string;
345
+ operation: string;
346
+ value: string;
347
+ low: string;
348
+ high: string;
349
+ apply: string;
350
+ applyModal: string;
351
+ cancel: string;
352
+ advanced: string;
353
+ editJson: string;
354
+ backToForm: string;
355
+ preview: string;
356
+ changeType: string;
357
+ chooseConditionType: string;
358
+ types: {
359
+ simple: string;
360
+ lifecycle: string;
361
+ function: string;
362
+ array: string;
363
+ group: string;
364
+ };
365
+ invalidJson: string;
366
+ valueIgnored: string;
367
+ legacySuffix: string;
368
+ legacyOperatorBanner: string;
369
+ legacyNotBanner: string;
370
+ likeHelp: string;
371
+ matchesPatternHelpAlways: string;
372
+ jsonPathError: {
373
+ empty: string;
374
+ "missing-root": string;
375
+ "recursive-descent": string;
376
+ "filter-expression": string;
377
+ malformed: string;
378
+ };
379
+ betweenShape: string;
380
+ likeWildcardHelp: string;
381
+ matchesPatternHelp: string;
382
+ wrapInGroup: string;
383
+ group: {
384
+ heading: string;
385
+ operator: string;
386
+ allConditions: string;
387
+ anyCondition: string;
388
+ addCondition: string;
389
+ addGroup: string;
390
+ edit: string;
391
+ editing: string;
392
+ complete: string;
393
+ duplicate: string;
394
+ moveUp: string;
395
+ moveDown: string;
396
+ remove: string;
397
+ valid: string;
398
+ invalid: string;
399
+ empty: string;
400
+ condition: string;
401
+ depthWarning: string;
402
+ legacyNotSuffix: string;
403
+ };
404
+ function: {
405
+ name: string;
406
+ nameEmpty: string;
407
+ nameInvalid: string;
408
+ config: string;
409
+ configInvalid: string;
410
+ precheck: string;
411
+ precheckAdd: string;
412
+ precheckRemove: string;
413
+ };
414
+ lifecycle: {
415
+ field: string;
416
+ };
417
+ array: {
418
+ values: string;
419
+ addValue: string;
420
+ addValuePlaceholder: string;
421
+ };
422
+ hints: {
423
+ loading: string;
424
+ error: string;
425
+ noEntity: string;
426
+ noMatches: string;
427
+ typeLabel: string;
428
+ retry: string;
429
+ };
430
+ };
152
431
  }>;
153
432
  declare function useMessages(): Messages;
154
433
  type PartialMessages = {
@@ -179,16 +458,101 @@ type Selection = null | {
179
458
  path: string[];
180
459
  };
181
460
 
461
+ type JsonEditStatus = LiftResult | {
462
+ status: "idle";
463
+ };
464
+ interface MonacoUriLike {
465
+ toString(): string;
466
+ }
467
+ interface WorkflowJsonModelLike extends TextModelLike {
468
+ dispose(): void;
469
+ }
470
+ interface WorkflowJsonEditorInstance extends EditorLike {
471
+ dispose(): void;
472
+ layout?: () => void;
473
+ updateOptions?: (options: Record<string, unknown>) => void;
474
+ }
475
+ interface WorkflowJsonMonacoRuntime extends MonacoLike {
476
+ Uri: {
477
+ parse(value: string): MonacoUriLike;
478
+ };
479
+ editor: MonacoLike["editor"] & {
480
+ createModel(value: string, language?: string, uri?: MonacoUriLike): WorkflowJsonModelLike;
481
+ create(element: HTMLElement, options: Record<string, unknown>): WorkflowJsonEditorInstance;
482
+ };
483
+ }
484
+ interface WorkflowJsonEditorConfig {
485
+ monaco: WorkflowJsonMonacoRuntime;
486
+ modelUri?: string;
487
+ editorOptions?: Record<string, unknown>;
488
+ debounceMs?: number;
489
+ }
490
+
491
+ /** Controls which chrome elements the editor shell renders. All fields default to `true`. */
492
+ interface ChromeOptions {
493
+ /** Top toolbar (undo/redo/validation pills/save). Default: true. */
494
+ toolbar?: boolean;
495
+ /** Workflow tabs bar. Default: true (also gated by existing single-workflow-viewer rule). */
496
+ tabs?: boolean;
497
+ /** Right-side inspector panel. Default: true. */
498
+ inspector?: boolean;
499
+ /** Canvas minimap. Default: true. */
500
+ minimap?: boolean;
501
+ /** Canvas zoom/pan controls. Default: true. */
502
+ controls?: boolean;
503
+ }
182
504
  interface WorkflowEditorProps {
183
505
  document: WorkflowEditorDocument;
184
506
  mode?: EditorMode;
507
+ surface?: WorkflowEditorSurface;
508
+ layout?: WorkflowEditorLayout;
185
509
  messages?: PartialMessages;
186
510
  layoutOptions?: LayoutOptions;
511
+ /** Selectively suppress editor chrome for compact embed scenarios. */
512
+ chrome?: ChromeOptions;
187
513
  onChange?: (doc: WorkflowEditorDocument) => void;
188
514
  onSave?: (doc: WorkflowEditorDocument) => void;
515
+ showSaveButton?: boolean;
516
+ toolbarStart?: ReactNode;
517
+ toolbarCenter?: ReactNode;
518
+ toolbarEnd?: ReactNode;
519
+ /**
520
+ * Host-controlled layout/UI metadata. When provided it takes precedence over
521
+ * the editor's internal localStorage persistence.
522
+ */
523
+ layoutMetadata?: WorkflowUiMeta;
524
+ /** Called whenever layout positions or other editor-only metadata change. */
525
+ onLayoutMetadataChange?: (meta: WorkflowUiMeta) => void;
526
+ /**
527
+ * localStorage key prefix for layout persistence. Defaults to
528
+ * "cyoda-editor-layout". Pass `null` to disable localStorage persistence.
529
+ */
530
+ localStorageKey?: string | null;
531
+ /** Enables the canonical JSON editing surface inside the editor shell. */
532
+ enableJsonEditor?: boolean;
533
+ /** Controls whether JSON appears as a tab or alongside the graph. */
534
+ jsonEditorPlacement?: "tab" | "split";
535
+ /** Optional host-supplied Monaco runtime/configuration. */
536
+ jsonEditor?: WorkflowJsonEditorConfig | null;
537
+ /** Reports JSON parse/schema/apply status for host UX. */
538
+ onJsonStatusChange?: (status: JsonEditStatus) => void;
539
+ /**
540
+ * Optional model-schema autocomplete source for criterion jsonPath inputs.
541
+ * When omitted, jsonPath inputs render as plain free-text fields.
542
+ */
543
+ hintProvider?: EntityFieldHintProvider;
544
+ /**
545
+ * Show developer-oriented affordances (raw JSON tab in the inspector and
546
+ * other diagnostics). Defaults to `false` so SMEs/BAs see a clean view.
547
+ * Existing demo and admin surfaces that previously relied on the JSON tab
548
+ * should opt in explicitly with `developerMode={true}`.
549
+ */
550
+ developerMode?: boolean;
189
551
  }
552
+ type WorkflowEditorSurface = "dev-console";
553
+ type WorkflowEditorLayout = "embedded" | "fullWidth";
190
554
  /** 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;
555
+ declare function WorkflowEditor({ document: initialDocument, mode, surface, layout, messages, layoutOptions, chrome, onChange, onSave, showSaveButton, toolbarStart, toolbarCenter, toolbarEnd, layoutMetadata: externalLayoutMeta, onLayoutMetadataChange, localStorageKey, enableJsonEditor, jsonEditorPlacement, jsonEditor, onJsonStatusChange, hintProvider, developerMode, }: WorkflowEditorProps): react_jsx_runtime.JSX.Element;
192
556
 
193
557
  interface UseSaveFlowArgs {
194
558
  api: WorkflowApi;
@@ -268,4 +632,4 @@ declare function ConflictBanner({ onReload, onForceOverwrite }: ConflictBannerPr
268
632
  */
269
633
  declare function diffSummary(server: WorkflowEditorDocument | null, local: WorkflowEditorDocument): string | null;
270
634
 
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 };
635
+ 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, type WorkflowJsonEditorInstance, type WorkflowJsonModelLike, type WorkflowJsonMonacoRuntime, defaultMessages, diffSummary, mergeMessages, useMessages, useSaveFlow };