@omega-flow/editor 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 +21 -0
- package/dist/index.cjs +3133 -0
- package/dist/index.d.cts +875 -0
- package/dist/index.d.mts +552 -0
- package/dist/index.d.ts +875 -0
- package/dist/index.js +3061 -0
- package/dist/index.mjs +1919 -0
- package/dist/styles.css +147 -0
- package/dist/themes/dark.css +69 -0
- package/dist/themes/light.css +50 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,875 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1, { ReactNode, ComponentType } from 'react';
|
|
3
|
+
import * as _omega_flow_types from '@omega-flow/types';
|
|
4
|
+
import { Node, Workflow, WorkflowOptions, Edge, Conditions } from '@omega-flow/types';
|
|
5
|
+
import * as _xyflow_react from '@xyflow/react';
|
|
6
|
+
import { NodeProps, NodeTypes } from '@xyflow/react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Translation function signature.
|
|
10
|
+
*
|
|
11
|
+
* Accepts a dot-separated key and optional interpolation parameters.
|
|
12
|
+
* Returns the translated string, or the key itself as fallback.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const t: TranslationFunction = (key, params) => {
|
|
17
|
+
* const template = translations[key] ?? key;
|
|
18
|
+
* if (!params) return template;
|
|
19
|
+
* return template.replace(/\{\{(\w+)\}\}/g, (_, k) => String(params[k] ?? `{{${k}}}`));
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* t("nodes.trigger.label"); // "Trigger"
|
|
23
|
+
* t("nodes.condition.ruleCount", { count: "3" }); // "3 rules"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
type TranslationFunction = (key: string, params?: Record<string, string>) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Flat dictionary mapping dot-separated keys to translation strings.
|
|
29
|
+
*
|
|
30
|
+
* Supports `{{param}}` interpolation placeholders.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const translations: TranslationDictionary = {
|
|
35
|
+
* "panels.control.title": "Workflow",
|
|
36
|
+
* "nodes.condition.ruleCount": "{{count}} rules",
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
type TranslationDictionary = Record<string, string>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Definition for a handle (connection point) on a node
|
|
44
|
+
*/
|
|
45
|
+
interface HandleDefinition {
|
|
46
|
+
id: string;
|
|
47
|
+
label?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props passed to node view components (rendered on canvas)
|
|
51
|
+
* This extends ReactFlow's NodeProps for full compatibility
|
|
52
|
+
*/
|
|
53
|
+
type NodeViewProps = NodeProps;
|
|
54
|
+
/**
|
|
55
|
+
* Props passed to node detail components (rendered in detail panel)
|
|
56
|
+
*/
|
|
57
|
+
interface NodeDetailProps {
|
|
58
|
+
node: Node;
|
|
59
|
+
onChange: (data: Record<string, unknown>) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Complete definition of a node type including visual components
|
|
63
|
+
*/
|
|
64
|
+
interface NodeTypeDefinition {
|
|
65
|
+
/** Node type identifier (e.g., "Trigger", "Action") */
|
|
66
|
+
type: string;
|
|
67
|
+
/** Display name shown in UI */
|
|
68
|
+
label: string;
|
|
69
|
+
/** Description/tooltip text */
|
|
70
|
+
description?: string;
|
|
71
|
+
/** Icon component to display in NodesPanel */
|
|
72
|
+
Icon?: ComponentType<{
|
|
73
|
+
size?: number;
|
|
74
|
+
}>;
|
|
75
|
+
/** Initial data when node is created */
|
|
76
|
+
defaultData: Record<string, unknown>;
|
|
77
|
+
/** Component to render on the canvas */
|
|
78
|
+
ViewComponent: ComponentType<NodeViewProps>;
|
|
79
|
+
/** Component to render in the detail panel */
|
|
80
|
+
DetailComponent: ComponentType<NodeDetailProps>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* State managed by the workflow editor context
|
|
84
|
+
*/
|
|
85
|
+
interface WorkflowEditorState {
|
|
86
|
+
/** The original workflow being edited (null if creating new) */
|
|
87
|
+
workflow: Workflow | null;
|
|
88
|
+
/** Current nodes in the flow */
|
|
89
|
+
nodes: Node[];
|
|
90
|
+
/** Current edges in the flow */
|
|
91
|
+
edges: Edge[];
|
|
92
|
+
/** Workflow options (frequency, etc.) */
|
|
93
|
+
options: WorkflowOptions;
|
|
94
|
+
/** Workflow name */
|
|
95
|
+
name: string;
|
|
96
|
+
/** Currently selected node ID */
|
|
97
|
+
selectedNodeId: string | null;
|
|
98
|
+
/** Whether there are unsaved changes */
|
|
99
|
+
isDirty: boolean;
|
|
100
|
+
/** Registered node types */
|
|
101
|
+
nodeTypes: Map<string, NodeTypeDefinition>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Actions available in the workflow editor context
|
|
105
|
+
*/
|
|
106
|
+
interface WorkflowEditorActions {
|
|
107
|
+
/** Load a workflow into the editor */
|
|
108
|
+
loadWorkflow: (workflow: Workflow) => void;
|
|
109
|
+
/** Reset to initial state */
|
|
110
|
+
resetWorkflow: () => void;
|
|
111
|
+
/** Add a new node at position */
|
|
112
|
+
addNode: (type: string, position: {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
}) => void;
|
|
116
|
+
/** Update a node's data */
|
|
117
|
+
updateNode: (nodeId: string, data: Record<string, unknown>) => void;
|
|
118
|
+
/** Update a node's position */
|
|
119
|
+
updateNodePosition: (nodeId: string, position: {
|
|
120
|
+
x: number;
|
|
121
|
+
y: number;
|
|
122
|
+
}) => void;
|
|
123
|
+
/** Remove a node */
|
|
124
|
+
removeNode: (nodeId: string) => void;
|
|
125
|
+
/** Select a node (or null to deselect) */
|
|
126
|
+
selectNode: (nodeId: string | null) => void;
|
|
127
|
+
/** Add a new edge */
|
|
128
|
+
addEdge: (connection: {
|
|
129
|
+
source: string;
|
|
130
|
+
target: string;
|
|
131
|
+
sourceHandle?: string;
|
|
132
|
+
targetHandle?: string;
|
|
133
|
+
}) => void;
|
|
134
|
+
/** Remove an edge */
|
|
135
|
+
removeEdge: (edgeId: string) => void;
|
|
136
|
+
/** Set workflow name */
|
|
137
|
+
setName: (name: string) => void;
|
|
138
|
+
/** Set workflow options */
|
|
139
|
+
setOptions: (options: WorkflowOptions) => void;
|
|
140
|
+
/** Register a custom node type */
|
|
141
|
+
registerNodeType: (definition: NodeTypeDefinition) => void;
|
|
142
|
+
/** Get the current workflow state */
|
|
143
|
+
getWorkflow: () => Workflow;
|
|
144
|
+
/** Mark the workflow as clean (saved) */
|
|
145
|
+
markClean: () => void;
|
|
146
|
+
/** Handle ReactFlow node changes */
|
|
147
|
+
onNodesChange: (changes: unknown[]) => void;
|
|
148
|
+
/** Handle ReactFlow edge changes */
|
|
149
|
+
onEdgesChange: (changes: unknown[]) => void;
|
|
150
|
+
/** Handle ReactFlow connections */
|
|
151
|
+
onConnect: (connection: unknown) => void;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Complete context value combining state and actions
|
|
155
|
+
*/
|
|
156
|
+
interface WorkflowEditorContextValue extends WorkflowEditorState, WorkflowEditorActions {
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Props for the WorkflowEditor component
|
|
160
|
+
*/
|
|
161
|
+
interface WorkflowEditorProps {
|
|
162
|
+
children: ReactNode;
|
|
163
|
+
/** Initial workflow to load */
|
|
164
|
+
workflow?: Workflow;
|
|
165
|
+
/** Custom node types to register */
|
|
166
|
+
nodeTypes?: NodeTypeDefinition[];
|
|
167
|
+
/** Callback when workflow changes */
|
|
168
|
+
onWorkflowChange?: (workflow: Workflow) => void;
|
|
169
|
+
/** Callback when dirty state changes */
|
|
170
|
+
onDirtyChange?: (isDirty: boolean) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Custom translation function that fully replaces the built-in resolver.
|
|
173
|
+
* Use this to plug in any i18n library (i18next, react-intl, etc.).
|
|
174
|
+
*
|
|
175
|
+
* ```tsx
|
|
176
|
+
* <WorkflowEditor translationFn={(key, params) => i18n.t(key, params)}>
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* Takes precedence over `translations` if both are provided.
|
|
180
|
+
*/
|
|
181
|
+
translationFn?: TranslationFunction;
|
|
182
|
+
/**
|
|
183
|
+
* Flat dictionary merged on top of default English strings.
|
|
184
|
+
* Use this for simple overrides or full translations without an external i18n library.
|
|
185
|
+
*
|
|
186
|
+
* ```tsx
|
|
187
|
+
* <WorkflowEditor translations={{ "panels.control.title": "Flujo" }}>
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* Ignored when `translationFn` is provided.
|
|
191
|
+
*/
|
|
192
|
+
translations?: TranslationDictionary;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Props for NodesPanel component
|
|
196
|
+
*/
|
|
197
|
+
interface NodesPanelProps {
|
|
198
|
+
className?: string;
|
|
199
|
+
/** Whether to show descriptions */
|
|
200
|
+
showDescriptions?: boolean;
|
|
201
|
+
/** Filter which node types to show */
|
|
202
|
+
filter?: (nodeType: NodeTypeDefinition) => boolean;
|
|
203
|
+
/** Custom render function for items */
|
|
204
|
+
renderItem?: (nodeType: NodeTypeDefinition) => ReactNode;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Props for DetailPanel component
|
|
208
|
+
*/
|
|
209
|
+
interface DetailPanelProps {
|
|
210
|
+
className?: string;
|
|
211
|
+
/** Message when no node is selected */
|
|
212
|
+
emptyMessage?: ReactNode;
|
|
213
|
+
/** Whether to show node type label */
|
|
214
|
+
showNodeType?: boolean;
|
|
215
|
+
/** Whether to show node ID */
|
|
216
|
+
showNodeId?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Props for OptionsPanel component
|
|
220
|
+
*/
|
|
221
|
+
interface OptionsPanelProps {
|
|
222
|
+
className?: string;
|
|
223
|
+
/** Whether to show frequency options */
|
|
224
|
+
showFrequency?: boolean;
|
|
225
|
+
/** Custom options to render */
|
|
226
|
+
customOptions?: ReactNode;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Props for ControlPanel component
|
|
230
|
+
*/
|
|
231
|
+
interface ControlPanelProps {
|
|
232
|
+
className?: string;
|
|
233
|
+
/** Whether to show name input */
|
|
234
|
+
showName?: boolean;
|
|
235
|
+
/** Whether to show save button */
|
|
236
|
+
showSaveButton?: boolean;
|
|
237
|
+
/** Label for save button */
|
|
238
|
+
saveButtonLabel?: string;
|
|
239
|
+
/** Save callback */
|
|
240
|
+
onSave?: () => Promise<void>;
|
|
241
|
+
/** Custom actions to render */
|
|
242
|
+
renderActions?: (context: {
|
|
243
|
+
isDirty: boolean;
|
|
244
|
+
workflow: Workflow;
|
|
245
|
+
}) => ReactNode;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Main wrapper component for the workflow editor.
|
|
250
|
+
* Provides context, state management, and translation for all child components.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* <WorkflowEditor workflow={workflow} onWorkflowChange={handleChange}>
|
|
255
|
+
* <ReactFlow nodes={nodes} edges={edges} ...>
|
|
256
|
+
* <Panel position="top-left"><NodesPanel /></Panel>
|
|
257
|
+
* </ReactFlow>
|
|
258
|
+
* </WorkflowEditor>
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function WorkflowEditor({ children, workflow, nodeTypes, onWorkflowChange, onDirtyChange, translationFn, translations, }: WorkflowEditorProps): react_jsx_runtime.JSX.Element;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Panel showing available node types that can be dragged onto the canvas.
|
|
265
|
+
*/
|
|
266
|
+
declare function NodesPanel({ className, showDescriptions, filter, renderItem, }: NodesPanelProps): react_jsx_runtime.JSX.Element;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Panel for editing the properties of the selected node.
|
|
270
|
+
* Renders the appropriate DetailComponent based on node type.
|
|
271
|
+
*/
|
|
272
|
+
declare function DetailPanel({ className, emptyMessage, showNodeType, showNodeId, }: DetailPanelProps): react_jsx_runtime.JSX.Element;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Panel for editing workflow options like frequency.
|
|
276
|
+
*/
|
|
277
|
+
declare function OptionsPanel({ className, showFrequency, customOptions, }: OptionsPanelProps): react_jsx_runtime.JSX.Element;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Panel for editing workflow name and saving.
|
|
281
|
+
*/
|
|
282
|
+
declare function ControlPanel({ className, showName, showSaveButton, saveButtonLabel, onSave, renderActions, }: ControlPanelProps): react_jsx_runtime.JSX.Element;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Provider component for workflow editor context
|
|
286
|
+
*/
|
|
287
|
+
declare function WorkflowEditorProvider({ children, workflow, nodeTypes, onWorkflowChange, onDirtyChange, }: WorkflowEditorProps): react_jsx_runtime.JSX.Element;
|
|
288
|
+
/**
|
|
289
|
+
* Hook to access the workflow editor context
|
|
290
|
+
* @throws Error if used outside of WorkflowEditorProvider
|
|
291
|
+
*/
|
|
292
|
+
declare function useWorkflowEditorContext(): WorkflowEditorContextValue;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Main hook for accessing workflow editor state and actions.
|
|
296
|
+
* Provides a convenient interface to the most commonly used functionality.
|
|
297
|
+
*/
|
|
298
|
+
declare function useWorkflowEditor(): {
|
|
299
|
+
workflow: _omega_flow_types.Workflow;
|
|
300
|
+
nodes: _xyflow_react.Node[];
|
|
301
|
+
edges: _xyflow_react.Edge[];
|
|
302
|
+
options: _omega_flow_types.WorkflowOptions;
|
|
303
|
+
name: string;
|
|
304
|
+
isDirty: boolean;
|
|
305
|
+
selectedNode: _xyflow_react.Node | null;
|
|
306
|
+
selectedNodeId: string | null;
|
|
307
|
+
loadWorkflow: (workflow: _omega_flow_types.Workflow) => void;
|
|
308
|
+
resetWorkflow: () => void;
|
|
309
|
+
addNode: (type: string, position: {
|
|
310
|
+
x: number;
|
|
311
|
+
y: number;
|
|
312
|
+
}) => void;
|
|
313
|
+
updateNode: (nodeId: string, data: Record<string, unknown>) => void;
|
|
314
|
+
removeNode: (nodeId: string) => void;
|
|
315
|
+
selectNode: (nodeId: string | null) => void;
|
|
316
|
+
addEdge: (connection: {
|
|
317
|
+
source: string;
|
|
318
|
+
target: string;
|
|
319
|
+
sourceHandle?: string;
|
|
320
|
+
targetHandle?: string;
|
|
321
|
+
}) => void;
|
|
322
|
+
removeEdge: (edgeId: string) => void;
|
|
323
|
+
setName: (name: string) => void;
|
|
324
|
+
setOptions: (options: _omega_flow_types.WorkflowOptions) => void;
|
|
325
|
+
getWorkflow: () => _omega_flow_types.Workflow;
|
|
326
|
+
markClean: () => void;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Hook for working with nodes in the workflow.
|
|
331
|
+
* Returns nodes and handlers compatible with ReactFlow.
|
|
332
|
+
*/
|
|
333
|
+
declare function useNodes(): {
|
|
334
|
+
nodes: _xyflow_react.Node[];
|
|
335
|
+
onNodesChange: (changes: unknown[]) => void;
|
|
336
|
+
addNode: (type: string, position: {
|
|
337
|
+
x: number;
|
|
338
|
+
y: number;
|
|
339
|
+
}) => void;
|
|
340
|
+
updateNode: (nodeId: string, data: Record<string, unknown>) => void;
|
|
341
|
+
removeNode: (nodeId: string) => void;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Hook for working with edges in the workflow.
|
|
346
|
+
* Returns edges and handlers compatible with ReactFlow.
|
|
347
|
+
*/
|
|
348
|
+
declare function useEdges(): {
|
|
349
|
+
edges: _xyflow_react.Edge[];
|
|
350
|
+
onEdgesChange: (changes: unknown[]) => void;
|
|
351
|
+
onConnect: (connection: unknown) => void;
|
|
352
|
+
addEdge: (connection: {
|
|
353
|
+
source: string;
|
|
354
|
+
target: string;
|
|
355
|
+
sourceHandle?: string;
|
|
356
|
+
targetHandle?: string;
|
|
357
|
+
}) => void;
|
|
358
|
+
removeEdge: (edgeId: string) => void;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Hook for accessing the node type registry.
|
|
363
|
+
* Returns node types and ReactFlow-compatible nodeTypes object.
|
|
364
|
+
*/
|
|
365
|
+
declare function useNodeRegistry(): {
|
|
366
|
+
/** Map of node type definitions */
|
|
367
|
+
nodeTypes: Map<string, NodeTypeDefinition>;
|
|
368
|
+
/** Array of node type definitions */
|
|
369
|
+
nodeTypesList: NodeTypeDefinition[];
|
|
370
|
+
/** ReactFlow-compatible nodeTypes object */
|
|
371
|
+
reactFlowNodeTypes: NodeTypes;
|
|
372
|
+
/** Register a new node type */
|
|
373
|
+
registerNodeType: (definition: NodeTypeDefinition) => void;
|
|
374
|
+
/** Get a specific node type definition */
|
|
375
|
+
getNodeType: (type: string) => NodeTypeDefinition | undefined;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Hook for handling drag-and-drop from the nodes panel to the canvas.
|
|
380
|
+
* Provides event handlers for drag start, drag over, and drop events.
|
|
381
|
+
*/
|
|
382
|
+
declare function useDragAndDrop(): {
|
|
383
|
+
onDragStart: (event: React.DragEvent, nodeType: string) => void;
|
|
384
|
+
onDragOver: (event: React.DragEvent) => void;
|
|
385
|
+
onDrop: (event: React.DragEvent) => void;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Hook for working with the currently selected node.
|
|
390
|
+
*/
|
|
391
|
+
declare function useSelectedNode(): {
|
|
392
|
+
/** The currently selected node, or null if none */
|
|
393
|
+
selectedNode: _xyflow_react.Node | null;
|
|
394
|
+
/** The ID of the selected node */
|
|
395
|
+
selectedNodeId: string | null;
|
|
396
|
+
/** The node type definition for the selected node */
|
|
397
|
+
nodeType: NodeTypeDefinition | undefined;
|
|
398
|
+
/** Select a node by ID */
|
|
399
|
+
selectNode: (nodeId: string | null) => void;
|
|
400
|
+
/** Update the selected node's data */
|
|
401
|
+
updateSelectedNode: (data: Record<string, unknown>) => void;
|
|
402
|
+
/** Remove the selected node */
|
|
403
|
+
removeSelectedNode: () => void;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
interface BaseNodeViewProps {
|
|
407
|
+
id: string;
|
|
408
|
+
data: Record<string, unknown>;
|
|
409
|
+
selected?: boolean;
|
|
410
|
+
label: string;
|
|
411
|
+
color?: string;
|
|
412
|
+
icon?: React$1.ReactNode;
|
|
413
|
+
sourceHandles?: HandleDefinition[];
|
|
414
|
+
targetHandles?: HandleDefinition[];
|
|
415
|
+
children?: React$1.ReactNode;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Base component for rendering nodes on the canvas.
|
|
419
|
+
* Provides consistent styling and handle rendering.
|
|
420
|
+
*/
|
|
421
|
+
declare function BaseNodeView({ label, color, icon, sourceHandles, targetHandles, selected, children, }: BaseNodeViewProps): react_jsx_runtime.JSX.Element;
|
|
422
|
+
|
|
423
|
+
declare function TriggerNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
424
|
+
|
|
425
|
+
declare function ActionNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
426
|
+
|
|
427
|
+
declare function ConditionNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
428
|
+
|
|
429
|
+
declare function ExitNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
430
|
+
|
|
431
|
+
declare function WaitNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
432
|
+
|
|
433
|
+
declare function TriggerOrTimeoutNodeView({ id, data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Detail editor for Trigger nodes.
|
|
437
|
+
* Allows setting the event type that triggers this node.
|
|
438
|
+
*/
|
|
439
|
+
declare function TriggerNodeDetail({ node, onChange }: NodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Detail editor for Action nodes.
|
|
443
|
+
* Allows setting the action name and parameters.
|
|
444
|
+
*/
|
|
445
|
+
declare function ActionNodeDetail({ node, onChange }: NodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* UI-only types for the visual condition builder.
|
|
449
|
+
*
|
|
450
|
+
* The data shape (`Conditions`, `ConditionGroup`, `ConditionRule`) lives in
|
|
451
|
+
* `@omega-flow/types` and is shared with the engine — the editor and the
|
|
452
|
+
* engine speak the same format directly, with no conversion in between.
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
/** A single condition property that users can select */
|
|
456
|
+
interface ConditionProperty {
|
|
457
|
+
label: string;
|
|
458
|
+
value: string;
|
|
459
|
+
type?: "string" | "number" | "boolean";
|
|
460
|
+
}
|
|
461
|
+
/** A group of condition properties (rendered as optgroup in selects) */
|
|
462
|
+
interface ConditionPropertyGroup {
|
|
463
|
+
label: string;
|
|
464
|
+
children: ConditionProperty[];
|
|
465
|
+
}
|
|
466
|
+
/** List of available properties — flat, grouped, or mixed */
|
|
467
|
+
type ConditionProperties = Array<ConditionProperty | ConditionPropertyGroup>;
|
|
468
|
+
/** Operator definition for the operator select */
|
|
469
|
+
interface OperatorOption {
|
|
470
|
+
value: string;
|
|
471
|
+
label: string;
|
|
472
|
+
}
|
|
473
|
+
/** Props for the ConditionBuilder component */
|
|
474
|
+
interface ConditionBuilderProps {
|
|
475
|
+
/** Current conditions in the unified format */
|
|
476
|
+
value: Conditions;
|
|
477
|
+
/** Called when conditions change */
|
|
478
|
+
onChange: (value: Conditions) => void;
|
|
479
|
+
/** Available properties for condition facts */
|
|
480
|
+
properties?: ConditionProperties;
|
|
481
|
+
/** Available operators (defaults to the built-in set) */
|
|
482
|
+
operators?: OperatorOption[];
|
|
483
|
+
}
|
|
484
|
+
/** Props for the ConditionBuilderDialog component */
|
|
485
|
+
interface ConditionBuilderDialogProps extends ConditionBuilderProps {
|
|
486
|
+
/** Whether the dialog is open */
|
|
487
|
+
open: boolean;
|
|
488
|
+
/** Called to close the dialog */
|
|
489
|
+
onClose: () => void;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Visual condition builder for the unified Conditions format.
|
|
494
|
+
*
|
|
495
|
+
* Top level is always OR (between groups), each group inside can be AND or OR.
|
|
496
|
+
*/
|
|
497
|
+
declare function ConditionBuilder({ value, onChange, properties, operators, }: ConditionBuilderProps): react_jsx_runtime.JSX.Element;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Dialog wrapper for the ConditionBuilder.
|
|
501
|
+
* Opens as a modal overlay using React portal.
|
|
502
|
+
*/
|
|
503
|
+
declare function ConditionBuilderDialog({ open, onClose, value, onChange, properties, operators, }: ConditionBuilderDialogProps): React$1.ReactPortal | null;
|
|
504
|
+
|
|
505
|
+
/** Default operators supported by the engine's built-in condition evaluator */
|
|
506
|
+
declare const defaultOperators: OperatorOption[];
|
|
507
|
+
|
|
508
|
+
interface ConditionNodeDetailProps extends NodeDetailProps {
|
|
509
|
+
/** Available properties for the condition builder fact selector */
|
|
510
|
+
conditionProperties?: ConditionProperties;
|
|
511
|
+
/** Custom operators for the condition builder (defaults to the built-in set) */
|
|
512
|
+
conditionOperators?: OperatorOption[];
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Detail editor for Condition nodes.
|
|
516
|
+
* Opens a visual condition builder dialog.
|
|
517
|
+
*/
|
|
518
|
+
declare function ConditionNodeDetail({ node, onChange, conditionProperties, conditionOperators, }: ConditionNodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Detail editor for Exit nodes.
|
|
522
|
+
* Exit nodes have no configurable properties.
|
|
523
|
+
*/
|
|
524
|
+
declare function ExitNodeDetail(_props: NodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Detail editor for Wait nodes.
|
|
528
|
+
* Allows setting the wait duration.
|
|
529
|
+
*/
|
|
530
|
+
declare function WaitNodeDetail({ node, onChange }: NodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Detail editor for TriggerOrTimeout nodes.
|
|
534
|
+
* Allows setting both the event type and timeout duration.
|
|
535
|
+
*/
|
|
536
|
+
declare function TriggerOrTimeoutNodeDetail({ node, onChange }: NodeDetailProps): react_jsx_runtime.JSX.Element;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Default node type definitions for the workflow editor.
|
|
540
|
+
* These correspond to the node models in @omega-flow/engine.
|
|
541
|
+
*/
|
|
542
|
+
declare const defaultNodeTypes: NodeTypeDefinition[];
|
|
543
|
+
/**
|
|
544
|
+
* Merges custom node type definitions into a base list, replacing any
|
|
545
|
+
* built-in entry that shares the same `type` key.
|
|
546
|
+
*
|
|
547
|
+
* Useful for combining {@link defaultNodeTypes} with custom nodes, or for
|
|
548
|
+
* overriding a built-in node's view/detail components without filtering
|
|
549
|
+
* the array yourself.
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```ts
|
|
553
|
+
* import { defaultNodeTypes, mergeNodeTypes } from "@omega-flow/editor";
|
|
554
|
+
*
|
|
555
|
+
* const nodeTypes = mergeNodeTypes(defaultNodeTypes, [
|
|
556
|
+
* storeTriggerNodeType,
|
|
557
|
+
* { ...customTriggerNodeType, type: "Trigger" }, // overrides default
|
|
558
|
+
* ]);
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
declare function mergeNodeTypes(base: NodeTypeDefinition[], overrides: NodeTypeDefinition[]): NodeTypeDefinition[];
|
|
562
|
+
|
|
563
|
+
interface FieldProps {
|
|
564
|
+
label: string;
|
|
565
|
+
children: React$1.ReactNode;
|
|
566
|
+
error?: string;
|
|
567
|
+
hint?: string;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Base field wrapper component that provides label, error, and hint display.
|
|
571
|
+
* Use this to wrap custom inputs.
|
|
572
|
+
*/
|
|
573
|
+
declare function Field({ label, children, error, hint }: FieldProps): react_jsx_runtime.JSX.Element;
|
|
574
|
+
|
|
575
|
+
interface TextFieldProps {
|
|
576
|
+
label: string;
|
|
577
|
+
value: string;
|
|
578
|
+
onChange: (value: string) => void;
|
|
579
|
+
placeholder?: string;
|
|
580
|
+
disabled?: boolean;
|
|
581
|
+
error?: string;
|
|
582
|
+
hint?: string;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Text input field with label.
|
|
586
|
+
*/
|
|
587
|
+
declare function TextField({ label, value, onChange, placeholder, disabled, error, hint, }: TextFieldProps): react_jsx_runtime.JSX.Element;
|
|
588
|
+
|
|
589
|
+
interface NumberFieldProps {
|
|
590
|
+
label: string;
|
|
591
|
+
value: number;
|
|
592
|
+
onChange: (value: number) => void;
|
|
593
|
+
min?: number;
|
|
594
|
+
max?: number;
|
|
595
|
+
step?: number;
|
|
596
|
+
disabled?: boolean;
|
|
597
|
+
error?: string;
|
|
598
|
+
hint?: string;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Number input field with label.
|
|
602
|
+
*/
|
|
603
|
+
declare function NumberField({ label, value, onChange, min, max, step, disabled, error, hint, }: NumberFieldProps): react_jsx_runtime.JSX.Element;
|
|
604
|
+
|
|
605
|
+
interface SelectOption {
|
|
606
|
+
value: string;
|
|
607
|
+
label: string;
|
|
608
|
+
}
|
|
609
|
+
interface SelectFieldProps {
|
|
610
|
+
label: string;
|
|
611
|
+
value: string;
|
|
612
|
+
options: SelectOption[];
|
|
613
|
+
onChange: (value: string) => void;
|
|
614
|
+
placeholder?: string;
|
|
615
|
+
disabled?: boolean;
|
|
616
|
+
error?: string;
|
|
617
|
+
hint?: string;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Select dropdown field with label.
|
|
621
|
+
*/
|
|
622
|
+
declare function SelectField({ label, value, options, onChange, placeholder, disabled, error, hint, }: SelectFieldProps): react_jsx_runtime.JSX.Element;
|
|
623
|
+
|
|
624
|
+
interface CheckboxFieldProps {
|
|
625
|
+
label: string;
|
|
626
|
+
checked: boolean;
|
|
627
|
+
onChange: (checked: boolean) => void;
|
|
628
|
+
disabled?: boolean;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Checkbox field with label.
|
|
632
|
+
*/
|
|
633
|
+
declare function CheckboxField({ label, checked, onChange, disabled, }: CheckboxFieldProps): react_jsx_runtime.JSX.Element;
|
|
634
|
+
|
|
635
|
+
interface TextAreaFieldProps {
|
|
636
|
+
label: string;
|
|
637
|
+
value: string;
|
|
638
|
+
onChange: (value: string) => void;
|
|
639
|
+
rows?: number;
|
|
640
|
+
placeholder?: string;
|
|
641
|
+
disabled?: boolean;
|
|
642
|
+
error?: string;
|
|
643
|
+
hint?: string;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Multi-line text input field with label.
|
|
647
|
+
*/
|
|
648
|
+
declare function TextAreaField({ label, value, onChange, rows, placeholder, disabled, error, hint, }: TextAreaFieldProps): react_jsx_runtime.JSX.Element;
|
|
649
|
+
|
|
650
|
+
interface DurationFieldProps {
|
|
651
|
+
label: string;
|
|
652
|
+
/** Value in milliseconds */
|
|
653
|
+
value: number;
|
|
654
|
+
onChange: (value: number) => void;
|
|
655
|
+
disabled?: boolean;
|
|
656
|
+
error?: string;
|
|
657
|
+
hint?: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Duration input field with separate inputs for days, hours, and minutes.
|
|
661
|
+
* Value is stored in milliseconds but displayed as composite parts.
|
|
662
|
+
*/
|
|
663
|
+
declare function DurationField({ label, value, onChange, disabled, error, hint, }: DurationFieldProps): react_jsx_runtime.JSX.Element;
|
|
664
|
+
|
|
665
|
+
interface JsonFieldProps {
|
|
666
|
+
label: string;
|
|
667
|
+
value: unknown;
|
|
668
|
+
onChange: (value: unknown) => void;
|
|
669
|
+
rows?: number;
|
|
670
|
+
disabled?: boolean;
|
|
671
|
+
error?: string;
|
|
672
|
+
hint?: string;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* JSON input field with validation.
|
|
676
|
+
* Displays JSON in a formatted textarea and validates on change.
|
|
677
|
+
*/
|
|
678
|
+
declare function JsonField({ label, value, onChange, rows, disabled, error: externalError, hint, }: JsonFieldProps): react_jsx_runtime.JSX.Element;
|
|
679
|
+
|
|
680
|
+
interface FieldGroupProps {
|
|
681
|
+
label?: string;
|
|
682
|
+
children: React$1.ReactNode;
|
|
683
|
+
collapsible?: boolean;
|
|
684
|
+
defaultCollapsed?: boolean;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Groups related fields together with an optional label.
|
|
688
|
+
* Can be made collapsible for better organization.
|
|
689
|
+
*/
|
|
690
|
+
declare function FieldGroup({ label, children, collapsible, defaultCollapsed, }: FieldGroupProps): react_jsx_runtime.JSX.Element;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* CSS Variable utilities for Omega Flow Editor theming
|
|
694
|
+
*/
|
|
695
|
+
/**
|
|
696
|
+
* Creates a CSS variable reference with optional fallback
|
|
697
|
+
*/
|
|
698
|
+
declare function cssVar(name: string, fallback?: string): string;
|
|
699
|
+
/**
|
|
700
|
+
* Common style variable references with fallbacks
|
|
701
|
+
* Use these in component styles for consistent theming
|
|
702
|
+
*/
|
|
703
|
+
declare const themeVars: {
|
|
704
|
+
readonly color: {
|
|
705
|
+
readonly bgPrimary: "var(--of-color-bg-primary, #fff)";
|
|
706
|
+
readonly bgSecondary: "var(--of-color-bg-secondary, #F9FAFB)";
|
|
707
|
+
readonly bgTertiary: "var(--of-color-bg-tertiary, #F3F4F6)";
|
|
708
|
+
readonly bgDisabled: "var(--of-color-bg-disabled, #F3F4F6)";
|
|
709
|
+
readonly textPrimary: "var(--of-color-text-primary, #111827)";
|
|
710
|
+
readonly textSecondary: "var(--of-color-text-secondary, #374151)";
|
|
711
|
+
readonly textTertiary: "var(--of-color-text-tertiary, #6B7280)";
|
|
712
|
+
readonly textMuted: "var(--of-color-text-muted, #9CA3AF)";
|
|
713
|
+
readonly textInverse: "var(--of-color-text-inverse, #fff)";
|
|
714
|
+
readonly borderPrimary: "var(--of-color-border-primary, #D1D5DB)";
|
|
715
|
+
readonly borderSecondary: "var(--of-color-border-secondary, #E5E7EB)";
|
|
716
|
+
readonly borderFocus: "var(--of-color-border-focus, #3B82F6)";
|
|
717
|
+
readonly interactivePrimary: "var(--of-color-interactive-primary, #3B82F6)";
|
|
718
|
+
readonly interactivePrimaryHover: "var(--of-color-interactive-primary-hover, #2563EB)";
|
|
719
|
+
readonly interactivePrimaryDisabled: "var(--of-color-interactive-primary-disabled, #93C5FD)";
|
|
720
|
+
readonly statusSuccess: "var(--of-color-status-success, #059669)";
|
|
721
|
+
readonly statusError: "var(--of-color-status-error, #DC2626)";
|
|
722
|
+
readonly statusErrorBg: "var(--of-color-status-error-bg, #FEE2E2)";
|
|
723
|
+
readonly statusWarning: "var(--of-color-status-warning, #FF9800)";
|
|
724
|
+
};
|
|
725
|
+
readonly node: {
|
|
726
|
+
readonly trigger: "var(--of-node-trigger-color, #4CAF50)";
|
|
727
|
+
readonly action: "var(--of-node-action-color, #2196F3)";
|
|
728
|
+
readonly condition: "var(--of-node-condition-color, #FF9800)";
|
|
729
|
+
readonly exit: "var(--of-node-exit-color, #F44336)";
|
|
730
|
+
readonly wait: "var(--of-node-wait-color, #9C27B0)";
|
|
731
|
+
readonly triggerTimeout: "var(--of-node-trigger-timeout-color, #607D8B)";
|
|
732
|
+
readonly bg: "var(--of-node-bg, #fff)";
|
|
733
|
+
readonly contentColor: "var(--of-node-content-color, #666)";
|
|
734
|
+
readonly shadow: "var(--of-node-shadow, 0 2px 4px rgba(0, 0, 0, 0.1))";
|
|
735
|
+
};
|
|
736
|
+
readonly spacing: {
|
|
737
|
+
readonly 1: "var(--of-spacing-1, 4px)";
|
|
738
|
+
readonly 2: "var(--of-spacing-2, 6px)";
|
|
739
|
+
readonly 3: "var(--of-spacing-3, 8px)";
|
|
740
|
+
readonly 4: "var(--of-spacing-4, 10px)";
|
|
741
|
+
readonly 5: "var(--of-spacing-5, 12px)";
|
|
742
|
+
readonly 6: "var(--of-spacing-6, 16px)";
|
|
743
|
+
readonly 7: "var(--of-spacing-7, 20px)";
|
|
744
|
+
};
|
|
745
|
+
readonly font: {
|
|
746
|
+
readonly sizeXs: "var(--of-font-size-xs, 11px)";
|
|
747
|
+
readonly sizeSm: "var(--of-font-size-sm, 12px)";
|
|
748
|
+
readonly sizeMd: "var(--of-font-size-md, 13px)";
|
|
749
|
+
readonly sizeLg: "var(--of-font-size-lg, 14px)";
|
|
750
|
+
readonly weightNormal: "var(--of-font-weight-normal, 400)";
|
|
751
|
+
readonly weightMedium: "var(--of-font-weight-medium, 500)";
|
|
752
|
+
readonly weightSemibold: "var(--of-font-weight-semibold, 600)";
|
|
753
|
+
readonly familyBase: "var(--of-font-family-base, system-ui, sans-serif)";
|
|
754
|
+
readonly familyMono: "var(--of-font-family-mono, monospace)";
|
|
755
|
+
};
|
|
756
|
+
readonly radius: {
|
|
757
|
+
readonly sm: "var(--of-radius-sm, 4px)";
|
|
758
|
+
readonly md: "var(--of-radius-md, 6px)";
|
|
759
|
+
readonly lg: "var(--of-radius-lg, 8px)";
|
|
760
|
+
};
|
|
761
|
+
readonly shadow: {
|
|
762
|
+
readonly panel: "var(--of-shadow-panel, 0 2px 8px rgba(0, 0, 0, 0.1))";
|
|
763
|
+
readonly node: "var(--of-shadow-node, 0 2px 4px rgba(0, 0, 0, 0.1))";
|
|
764
|
+
};
|
|
765
|
+
readonly transition: {
|
|
766
|
+
readonly fast: "var(--of-transition-fast, 0.15s)";
|
|
767
|
+
readonly normal: "var(--of-transition-normal, 0.2s)";
|
|
768
|
+
};
|
|
769
|
+
readonly panel: {
|
|
770
|
+
readonly bg: "var(--of-panel-bg, #fff)";
|
|
771
|
+
readonly shadow: "var(--of-panel-shadow, 0 2px 8px rgba(0, 0, 0, 0.1))";
|
|
772
|
+
readonly radius: "var(--of-panel-radius, 8px)";
|
|
773
|
+
readonly padding: "var(--of-panel-padding, 12px)";
|
|
774
|
+
readonly titleColor: "var(--of-panel-title-color, #374151)";
|
|
775
|
+
readonly titleSize: "var(--of-panel-title-size, 12px)";
|
|
776
|
+
};
|
|
777
|
+
readonly field: {
|
|
778
|
+
readonly bg: "var(--of-field-bg, #fff)";
|
|
779
|
+
readonly border: "var(--of-field-border, #D1D5DB)";
|
|
780
|
+
readonly borderFocus: "var(--of-field-border-focus, #3B82F6)";
|
|
781
|
+
readonly borderError: "var(--of-field-border-error, #DC2626)";
|
|
782
|
+
readonly radius: "var(--of-field-radius, 6px)";
|
|
783
|
+
readonly padding: "var(--of-field-padding, 8px 10px)";
|
|
784
|
+
readonly fontSize: "var(--of-field-font-size, 13px)";
|
|
785
|
+
readonly labelColor: "var(--of-field-label-color, #374151)";
|
|
786
|
+
readonly labelSize: "var(--of-field-label-size, 12px)";
|
|
787
|
+
readonly hintColor: "var(--of-field-hint-color, #6B7280)";
|
|
788
|
+
readonly errorColor: "var(--of-field-error-color, #DC2626)";
|
|
789
|
+
};
|
|
790
|
+
readonly button: {
|
|
791
|
+
readonly primaryBg: "var(--of-button-primary-bg, #3B82F6)";
|
|
792
|
+
readonly primaryColor: "var(--of-button-primary-color, #fff)";
|
|
793
|
+
readonly primaryBgHover: "var(--of-button-primary-bg-hover, #2563EB)";
|
|
794
|
+
readonly primaryBgDisabled: "var(--of-button-primary-bg-disabled, #93C5FD)";
|
|
795
|
+
readonly dangerBg: "var(--of-button-danger-bg, #FEE2E2)";
|
|
796
|
+
readonly dangerColor: "var(--of-button-danger-color, #DC2626)";
|
|
797
|
+
readonly radius: "var(--of-button-radius, 6px)";
|
|
798
|
+
readonly padding: "var(--of-button-padding, 8px 16px)";
|
|
799
|
+
};
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Creates a TranslationFunction from a flat dictionary.
|
|
804
|
+
*
|
|
805
|
+
* Supports `{{param}}` interpolation. Falls back to the key
|
|
806
|
+
* itself when no translation is found.
|
|
807
|
+
*/
|
|
808
|
+
declare function createTranslationFunction(dictionary: TranslationDictionary): TranslationFunction;
|
|
809
|
+
interface TranslationProviderProps {
|
|
810
|
+
children: React$1.ReactNode;
|
|
811
|
+
/**
|
|
812
|
+
* Custom translation function. When provided, it fully replaces
|
|
813
|
+
* the built-in resolver — giving you total control.
|
|
814
|
+
*
|
|
815
|
+
* Use this to plug in any i18n library (i18next, react-intl, etc.):
|
|
816
|
+
*
|
|
817
|
+
* ```tsx
|
|
818
|
+
* <TranslationProvider translationFn={(key, params) => intl.formatMessage({ id: key }, params)}>
|
|
819
|
+
* ```
|
|
820
|
+
*/
|
|
821
|
+
translationFn?: TranslationFunction;
|
|
822
|
+
/**
|
|
823
|
+
* Flat dictionary that is merged on top of the default English strings.
|
|
824
|
+
*
|
|
825
|
+
* Use this for simple overrides or full translations without bringing
|
|
826
|
+
* in an external i18n library:
|
|
827
|
+
*
|
|
828
|
+
* ```tsx
|
|
829
|
+
* <TranslationProvider translations={{ "panels.control.title": "Flujo" }}>
|
|
830
|
+
* ```
|
|
831
|
+
*
|
|
832
|
+
* Ignored when `translationFn` is provided.
|
|
833
|
+
*/
|
|
834
|
+
translations?: TranslationDictionary;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Provides a translation function to all editor components and custom nodes.
|
|
838
|
+
*
|
|
839
|
+
* Three usage modes:
|
|
840
|
+
* 1. **No props** — uses built-in English strings.
|
|
841
|
+
* 2. **`translations` prop** — merges your dictionary on top of defaults.
|
|
842
|
+
* 3. **`translationFn` prop** — you supply the function entirely
|
|
843
|
+
* (adapter for i18next, react-intl, or any other system).
|
|
844
|
+
*/
|
|
845
|
+
declare function TranslationProvider({ children, translationFn, translations, }: TranslationProviderProps): react_jsx_runtime.JSX.Element;
|
|
846
|
+
/**
|
|
847
|
+
* Hook to access the translation function.
|
|
848
|
+
*
|
|
849
|
+
* Works inside any component rendered within `<WorkflowEditor>`.
|
|
850
|
+
* Custom node developers use this to translate their own strings.
|
|
851
|
+
*
|
|
852
|
+
* @example
|
|
853
|
+
* ```tsx
|
|
854
|
+
* import { useTranslation } from "@omega-flow/editor";
|
|
855
|
+
*
|
|
856
|
+
* function MyCustomNodeDetail({ node, onChange }: NodeDetailProps) {
|
|
857
|
+
* const t = useTranslation();
|
|
858
|
+
* return <TextField label={t("myCustomNode.emailLabel")} ... />;
|
|
859
|
+
* }
|
|
860
|
+
* ```
|
|
861
|
+
*/
|
|
862
|
+
declare function useTranslation(): TranslationFunction;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Default English translations for all editor UI strings.
|
|
866
|
+
*
|
|
867
|
+
* Keys use a dot-separated hierarchy:
|
|
868
|
+
* - `panels.*` — Panel titles and UI
|
|
869
|
+
* - `nodes.*` — Node views (canvas labels, empty states)
|
|
870
|
+
* - `nodeDetails.*` — Node detail editors (field labels, hints)
|
|
871
|
+
* - `fields.*` — Shared field/primitive strings
|
|
872
|
+
*/
|
|
873
|
+
declare const defaultTranslations: TranslationDictionary;
|
|
874
|
+
|
|
875
|
+
export { ActionNodeDetail, ActionNodeView, BaseNodeView, type BaseNodeViewProps, CheckboxField, type CheckboxFieldProps, ConditionBuilder, ConditionBuilderDialog, type ConditionBuilderDialogProps, type ConditionBuilderProps, ConditionNodeDetail, ConditionNodeView, type ConditionProperties, type ConditionProperty, type ConditionPropertyGroup, ControlPanel, type ControlPanelProps, DetailPanel, type DetailPanelProps, DurationField, type DurationFieldProps, ExitNodeDetail, ExitNodeView, Field, FieldGroup, type FieldGroupProps, type FieldProps, type HandleDefinition, JsonField, type JsonFieldProps, type NodeDetailProps, type NodeTypeDefinition, type NodeViewProps, NodesPanel, type NodesPanelProps, NumberField, type NumberFieldProps, type OperatorOption, OptionsPanel, type OptionsPanelProps, SelectField, type SelectFieldProps, type SelectOption, TextAreaField, type TextAreaFieldProps, TextField, type TextFieldProps, type TranslationDictionary, type TranslationFunction, TranslationProvider, type TranslationProviderProps, TriggerNodeDetail, TriggerNodeView, TriggerOrTimeoutNodeDetail, TriggerOrTimeoutNodeView, WaitNodeDetail, WaitNodeView, WorkflowEditor, type WorkflowEditorActions, type WorkflowEditorContextValue, type WorkflowEditorProps, WorkflowEditorProvider, type WorkflowEditorState, createTranslationFunction, cssVar, defaultNodeTypes, defaultOperators, defaultTranslations, mergeNodeTypes, themeVars, useDragAndDrop, useEdges, useNodeRegistry, useNodes, useSelectedNode, useTranslation, useWorkflowEditor, useWorkflowEditorContext };
|