@nice2dev/ui-designers 1.0.22 → 1.0.24

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.
Files changed (4) hide show
  1. package/dist/index.cjs +168 -189
  2. package/dist/index.d.ts +16 -653
  3. package/dist/index.mjs +27263 -27881
  4. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,276 +1,19 @@
1
- import { default as default_2 } from 'react';
2
- import { NiceComponentTutorial } from '@nice2dev/ui';
3
- import { NiceStandardProps } from '@nice2dev/ui';
1
+ import { NiceBPMNDesigner } from '@nice2dev/ui';
4
2
  import { NiceThemeBuilder } from '@nice2dev/ui';
5
3
  import { NiceThemeBuilderProps } from '@nice2dev/ui';
6
4
  import { NiceThemeBuilderSection } from '@nice2dev/ui';
7
5
  import { NiceThemeDesigner } from '@nice2dev/ui';
8
6
  import { NiceThemeDesignerProps } from '@nice2dev/ui';
9
7
  import { NiceThemeDesignerSection } from '@nice2dev/ui';
10
- import { NiceViewDefinitionV2 } from '@nice2dev/ui';
8
+ import { NiceWorkflowCondition } from '@nice2dev/ui';
9
+ import { NiceWorkflowDefinition } from '@nice2dev/ui';
10
+ import { NiceWorkflowDesigner } from '@nice2dev/ui';
11
+ import { NiceWorkflowDesignerProps } from '@nice2dev/ui';
12
+ import { NiceWorkflowState } from '@nice2dev/ui';
13
+ import { NiceWorkflowTransition } from '@nice2dev/ui';
14
+ import { NiceWorkflowTrigger } from '@nice2dev/ui';
11
15
 
12
- /**
13
- * Action node
14
- */
15
- export declare interface ActionNode extends WorkflowNodeBase {
16
- category: 'action';
17
- actionType: ActionType;
18
- config: {
19
- url?: string;
20
- method?: string;
21
- headers?: Record<string, string>;
22
- body?: any;
23
- language?: 'javascript' | 'python' | 'sql';
24
- code?: string;
25
- to?: string;
26
- subject?: string;
27
- template?: string;
28
- [key: string]: any;
29
- };
30
- }
31
-
32
- /**
33
- * Action types
34
- */
35
- export declare type ActionType = 'http-request' | 'script' | 'transform' | 'email' | 'notification' | 'delay' | 'log' | 'set-variable' | 'database-query' | 'file-operation';
36
-
37
- /**
38
- * Condition node
39
- */
40
- export declare interface ConditionNode extends WorkflowNodeBase {
41
- category: 'condition';
42
- conditionType: ConditionType;
43
- config: {
44
- expression?: string;
45
- cases?: {
46
- label: string;
47
- condition: string;
48
- portId: string;
49
- }[];
50
- defaultCase?: string;
51
- };
52
- }
53
-
54
- /**
55
- * Condition types
56
- */
57
- export declare type ConditionType = 'if' | 'switch' | 'filter' | 'router';
58
-
59
- /**
60
- * Node configuration schema (for dynamic forms)
61
- */
62
- export declare interface ConfigField {
63
- name: string;
64
- label: string;
65
- type: 'text' | 'number' | 'boolean' | 'select' | 'json' | 'code' | 'expression' | 'keyvalue';
66
- required?: boolean;
67
- defaultValue?: any;
68
- options?: {
69
- label: string;
70
- value: any;
71
- }[];
72
- placeholder?: string;
73
- description?: string;
74
- validation?: {
75
- pattern?: string;
76
- min?: number;
77
- max?: number;
78
- minLength?: number;
79
- maxLength?: number;
80
- };
81
- }
82
-
83
- /**
84
- * Control node
85
- */
86
- export declare interface ControlNode extends WorkflowNodeBase {
87
- category: 'control';
88
- controlType: ControlType;
89
- config: {
90
- maxRetries?: number;
91
- retryDelay?: number;
92
- errorHandling?: 'continue' | 'stop' | 'retry';
93
- };
94
- }
95
-
96
- /**
97
- * Control types
98
- */
99
- export declare type ControlType = 'start' | 'end' | 'error-handler' | 'retry' | 'merge' | 'split';
100
-
101
- export declare function createDefaultWorkflow(): WorkflowSchema;
102
-
103
- /**
104
- * Complete dashboard schema
105
- */
106
- export declare interface DashboardSchema {
107
- /** Schema version */
108
- version: string;
109
- /** Dashboard ID */
110
- id: string;
111
- /** Dashboard title */
112
- title: string;
113
- /** Description */
114
- description?: string;
115
- /** Grid columns */
116
- columns: number;
117
- /** Row height (px) */
118
- rowHeight: number;
119
- /** Gap between widgets (px) */
120
- gap: number;
121
- /** Widgets */
122
- widgets: WidgetDefinition[];
123
- /** Theme */
124
- theme?: DashboardTheme;
125
- /** Responsive layouts */
126
- responsiveLayouts?: ResponsiveLayouts;
127
- /** Auto-refresh interval (ms) */
128
- refreshInterval?: number;
129
- /** Meta information */
130
- meta?: {
131
- createdAt?: string;
132
- updatedAt?: string;
133
- author?: string;
134
- };
135
- }
136
-
137
- /**
138
- * Dashboard theme
139
- */
140
- export declare interface DashboardTheme {
141
- /** Background color */
142
- background?: string;
143
- /** Widget background */
144
- widgetBackground?: string;
145
- /** Widget border */
146
- widgetBorder?: string;
147
- /** Widget shadow */
148
- widgetShadow?: string;
149
- /** Widget border radius */
150
- widgetRadius?: string;
151
- /** Header background */
152
- headerBackground?: string;
153
- /** Text color */
154
- textColor?: string;
155
- /** Accent color */
156
- accentColor?: string;
157
- }
158
-
159
- export declare function deserializeView(json: string): NiceViewDefinition;
160
-
161
- export declare function generateCellId(): string;
162
-
163
- /**
164
- * Generate dashboard HTML for embedding
165
- */
166
- export declare function generateDashboardHTML(schema: DashboardSchema): string;
167
-
168
- export declare function generateRowId(): string;
169
-
170
- /**
171
- * Loop node
172
- */
173
- export declare interface LoopNode extends WorkflowNodeBase {
174
- category: 'loop';
175
- loopType: LoopType;
176
- config: {
177
- collection?: string;
178
- condition?: string;
179
- maxIterations?: number;
180
- parallelCount?: number;
181
- };
182
- }
183
-
184
- /**
185
- * Loop types
186
- */
187
- export declare type LoopType = 'foreach' | 'while' | 'repeat' | 'parallel';
188
-
189
- export declare const NiceControlConfigurator: default_2.ForwardRefExoticComponent<NiceControlConfiguratorProps & default_2.RefAttributes<HTMLDivElement>>;
190
-
191
- /** Props for the {@link NiceControlConfigurator} component — a live property editor with a control preview panel. */
192
- export declare interface NiceControlConfiguratorProps extends NiceStandardProps {
193
- /** Registry key identifying the control type (e.g. "NiceButton", "NiceTextInput") */
194
- controlType: string;
195
- /** Descriptors for all configurable props */
196
- propDescriptors: NicePropDescriptor[];
197
- /** Current prop values */
198
- value: Record<string, unknown>;
199
- /** Called when any prop value changes */
200
- onChange: (props: Record<string, unknown>) => void;
201
- /** Render function that creates the control preview from current props */
202
- renderPreview: (props: Record<string, unknown>) => default_2.ReactNode;
203
- /** Layout: side-by-side or stacked */
204
- layout?: 'horizontal' | 'vertical';
205
- }
206
-
207
- /** An entry in the control palette for the {@link NiceViewBuilder}. */
208
- declare interface NiceControlRegistryEntry {
209
- type: string;
210
- label: string;
211
- /** Optional palette grouping. */
212
- category?: string;
213
- icon?: string;
214
- /** Optional list of editable prop descriptors. */
215
- propDescriptors?: NicePropDescriptor[];
216
- defaultProps: Record<string, unknown>;
217
- }
218
-
219
- export declare function NiceDashboardDesigner({ initialSchema, widgets, onChange, onExport, onPreview, tutorial, className, style, }: NiceDashboardDesignerProps): JSX.Element;
220
-
221
- export declare interface NiceDashboardDesignerProps {
222
- /** Initial dashboard schema */
223
- initialSchema?: DashboardSchema;
224
- /** Convenience flat list of widgets — wrapped into a default schema if `initialSchema` is omitted. Accepts `x`/`y`/`w`/`h` shortcuts that get folded into the widget layout. */
225
- widgets?: Array<Partial<WidgetDefinition> & {
226
- id: string;
227
- type: string;
228
- x?: number;
229
- y?: number;
230
- w?: number;
231
- h?: number;
232
- }>;
233
- /** Called when schema changes */
234
- onChange?: (schema: DashboardSchema) => void;
235
- /** Called when export is requested */
236
- onExport?: (schema: DashboardSchema) => void;
237
- /** Called when preview is requested */
238
- onPreview?: (schema: DashboardSchema) => void;
239
- /** Custom class */
240
- className?: string;
241
- /** Style */
242
- style?: default_2.CSSProperties;
243
- /** Optional "?" guided tour. Off by default; `true` uses the built-in tour. */
244
- tutorial?: NiceComponentTutorial;
245
- }
246
-
247
- /** Describes one configurable property in the {@link NiceControlConfigurator}. */
248
- export declare interface NicePropDescriptor {
249
- /** Property name (matches the component prop key). */
250
- name: string;
251
- /** Display label. Falls back to `name` when omitted. */
252
- label?: string;
253
- /** Editor type. */
254
- type: NicePropType;
255
- /** Default value. */
256
- defaultValue?: unknown;
257
- /** Select / enum options. Plain strings are treated as `{ value: s, label: s }`. */
258
- options?: Array<{
259
- value: string;
260
- label: string;
261
- } | string>;
262
- /** Minimum for number editor. */
263
- min?: number;
264
- /** Maximum for number editor. */
265
- max?: number;
266
- /** Step for number editor. */
267
- step?: number;
268
- /** Grouping section name. */
269
- group?: string;
270
- }
271
-
272
- /** Supported property editor types for the {@link NiceControlConfigurator}. */
273
- declare type NicePropType = 'string' | 'number' | 'boolean' | 'select' | 'color' | 'size' | 'variant' | 'json';
16
+ export { NiceBPMNDesigner }
274
17
 
275
18
  export { NiceThemeBuilder }
276
19
 
@@ -284,398 +27,18 @@ export { NiceThemeDesignerProps }
284
27
 
285
28
  export { NiceThemeDesignerSection }
286
29
 
287
- export declare const NiceViewBuilder: default_2.ForwardRefExoticComponent<NiceViewBuilderProps & default_2.RefAttributes<HTMLDivElement>>;
288
-
289
- /** Props for the {@link NiceViewBuilder} component — a drag-and-drop page / view layout designer with palette, canvas, and property panel. */
290
- export declare interface NiceViewBuilderProps extends NiceStandardProps {
291
- /** Available controls that can be placed on the canvas */
292
- controlRegistry: NiceControlRegistryEntry[];
293
- /** Render function to preview a control given its type and props */
294
- renderControl: (controlType: string, props: Record<string, unknown>) => default_2.ReactNode;
295
- /** Initial view definition */
296
- value?: NiceViewDefinition;
297
- /** Called when view changes */
298
- onChange?: (view: NiceViewDefinition) => void;
299
- /** Called when user clicks Save */
300
- onSave?: (view: NiceViewDefinition) => void;
301
- /** Optional "?" guided tour. Off by default; `true` uses the built-in tour. */
302
- tutorial?: NiceComponentTutorial;
303
- }
304
-
305
- /** A single cell (control instance) in a {@link NiceViewRowDefinition}. */
306
- declare interface NiceViewCellDefinition {
307
- id: string;
308
- controlType: string;
309
- props: Record<string, unknown>;
310
- colSpan?: number;
311
- rowSpan?: number;
312
- }
313
-
314
- /** The full serializable definition of a view (page layout). */
315
- declare interface NiceViewDefinition {
316
- id: string;
317
- name: string;
318
- columns?: number;
319
- rows?: NiceViewRowDefinition[];
320
- /** Convenience flat list of controls (alternative to filling `rows` manually). */
321
- controls?: Array<{
322
- id: string;
323
- type: string;
324
- props?: Record<string, unknown>;
325
- x?: number;
326
- y?: number;
327
- w?: number;
328
- h?: number;
329
- }>;
330
- meta?: Record<string, unknown>;
331
- }
332
-
333
- /** A row in a {@link NiceViewDefinition} layout grid. */
334
- declare interface NiceViewRowDefinition {
335
- id: string;
336
- cells: NiceViewCellDefinition[];
337
- height?: string;
338
- }
339
-
340
- export declare function NiceWorkflowDesigner({ initialWorkflow, nodes, edges, onChange, onNodeSelect, tutorial, className, style, readOnly, height, }: NiceWorkflowDesignerProps): JSX.Element;
341
-
342
- export declare interface NiceWorkflowDesignerProps {
343
- /** Initial workflow schema */
344
- initialWorkflow?: WorkflowSchema;
345
- /** Convenience flat list of nodes — wrapped into a default workflow if `initialWorkflow` is omitted. */
346
- nodes?: Array<Partial<WorkflowNode> & {
347
- id: string;
348
- type: string;
349
- }>;
350
- /** Convenience flat list of edges/connections (alias `edges` accepted as well). Accepts `from`/`to` shortcuts. */
351
- edges?: Array<Partial<WorkflowConnection> & {
352
- id?: string;
353
- sourceNodeId?: string;
354
- targetNodeId?: string;
355
- source?: string;
356
- target?: string;
357
- from?: string;
358
- to?: string;
359
- }>;
360
- /** Callback when workflow changes */
361
- onChange?: (workflow: WorkflowSchema) => void;
362
- /** Callback when node is selected */
363
- onNodeSelect?: (node: WorkflowNode | null) => void;
364
- /** Custom class */
365
- className?: string;
366
- /** Style */
367
- style?: default_2.CSSProperties;
368
- /** Read-only mode */
369
- readOnly?: boolean;
370
- /** Height */
371
- height?: string | number;
372
- /** Optional "?" guided tour. Off by default; `true` uses the built-in tour. */
373
- tutorial?: NiceComponentTutorial;
374
- }
375
-
376
- export declare const NODE_TEMPLATES: NodeTemplate[];
377
-
378
- declare interface NodeTemplate {
379
- id: string;
380
- category: WorkflowNodeCategory;
381
- type: string;
382
- label: string;
383
- description: string;
384
- icon: string;
385
- color: string;
386
- defaultPorts: WorkflowPort[];
387
- configSchema: ConfigField[];
388
- defaultConfig: Record<string, any>;
389
- }
390
-
391
- /**
392
- * Dashboard layout for different breakpoints
393
- */
394
- export declare interface ResponsiveLayouts {
395
- lg?: WidgetLayout[];
396
- md?: WidgetLayout[];
397
- sm?: WidgetLayout[];
398
- xs?: WidgetLayout[];
399
- }
400
-
401
- export declare function serializeView(view: NiceViewDefinition): string;
402
-
403
- /**
404
- * Trigger node
405
- */
406
- export declare interface TriggerNode extends WorkflowNodeBase {
407
- category: 'trigger';
408
- triggerType: TriggerType;
409
- config: {
410
- cron?: string;
411
- timezone?: string;
412
- path?: string;
413
- method?: string;
414
- eventName?: string;
415
- filter?: string;
416
- [key: string]: any;
417
- };
418
- }
419
-
420
- /**
421
- * Trigger types
422
- */
423
- export declare type TriggerType = 'manual' | 'schedule' | 'webhook' | 'event' | 'email' | 'file-change' | 'database-change' | 'api-request';
424
-
425
- export declare function useWorkflowDesigner(): WorkflowDesignerContextValue;
426
-
427
- /** Convert a {@link NiceViewDefinitionV2} back to a legacy {@link NiceViewDefinition} (best-effort). */
428
- export declare function v2ToViewDefinition(view: NiceViewDefinitionV2): NiceViewDefinition;
429
-
430
- /**
431
- * Validate dashboard schema
432
- */
433
- export declare function validateDashboardSchema(schema: DashboardSchema): {
434
- valid: boolean;
435
- errors: string[];
436
- };
437
-
438
- export declare function validateWorkflow(workflow: WorkflowSchema): {
439
- valid: boolean;
440
- errors: string[];
441
- };
442
-
443
- /**
444
- * Data types for variables
445
- */
446
- declare type VariableType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'any';
447
-
448
- /** Convert a legacy {@link NiceViewDefinition} to a {@link NiceViewDefinitionV2}. */
449
- export declare function viewDefinitionToV2(def: NiceViewDefinition): NiceViewDefinitionV2;
450
-
451
- /**
452
- * Widget data source configuration
453
- */
454
- export declare interface WidgetDataSource {
455
- /** Data source type */
456
- type: 'static' | 'rest' | 'graphql' | 'websocket' | 'signal';
457
- /** API endpoint or data */
458
- endpoint?: string;
459
- /** Static data */
460
- data?: any;
461
- /** Refresh interval (ms) */
462
- refreshInterval?: number;
463
- /** Transform function name */
464
- transform?: string;
465
- }
466
-
467
- /**
468
- * Widget definition
469
- */
470
- export declare interface WidgetDefinition {
471
- /** Unique ID */
472
- id: string;
473
- /** Widget type */
474
- type: WidgetType;
475
- /** Display title */
476
- title: string;
477
- /** Description */
478
- description?: string;
479
- /** Layout settings */
480
- layout: WidgetLayout;
481
- /** Data source */
482
- dataSource?: WidgetDataSource;
483
- /** Widget-specific configuration */
484
- config: Record<string, any>;
485
- /** Custom CSS class */
486
- className?: string;
487
- /** Custom styles */
488
- style?: default_2.CSSProperties;
489
- }
490
-
491
- /**
492
- * Widget position and size
493
- */
494
- export declare interface WidgetLayout {
495
- /** X position (grid units) */
496
- x: number;
497
- /** Y position (grid units) */
498
- y: number;
499
- /** Width (grid units) */
500
- w: number;
501
- /** Height (grid units) */
502
- h: number;
503
- /** Minimum width */
504
- minW?: number;
505
- /** Minimum height */
506
- minH?: number;
507
- /** Maximum width */
508
- maxW?: number;
509
- /** Maximum height */
510
- maxH?: number;
511
- /** Is static (cannot be moved/resized) */
512
- static?: boolean;
513
- }
514
-
515
- /**
516
- * Widget types
517
- */
518
- export declare type WidgetType = 'chart' | 'chart-line' | 'chart-bar' | 'chart-pie' | 'chart-area' | 'chart-scatter' | 'chart-radar' | 'kpi' | 'kpi-trend' | 'gauge' | 'progress' | 'data-grid' | 'pivot-grid' | 'tree-view' | 'calendar' | 'scheduler' | 'map' | 'heatmap' | 'treemap' | 'timeline' | 'text' | 'image' | 'iframe' | 'clock' | 'weather' | 'list' | 'card' | 'custom';
519
-
520
- /**
521
- * Workflow connection
522
- */
523
- export declare interface WorkflowConnection {
524
- id: string;
525
- sourceNodeId: string;
526
- sourcePortId: string;
527
- targetNodeId: string;
528
- targetPortId: string;
529
- label?: string;
530
- condition?: string;
531
- style?: {
532
- color?: string;
533
- animated?: boolean;
534
- dashed?: boolean;
535
- };
536
- }
537
-
538
- declare interface WorkflowDesignerContextValue {
539
- workflow: WorkflowSchema;
540
- selectedNodeIds: Set<string>;
541
- selectedConnectionIds: Set<string>;
542
- zoom: number;
543
- panX: number;
544
- panY: number;
545
- isDragging: boolean;
546
- isConnecting: boolean;
547
- executionLog: WorkflowLogEntry[];
548
- setWorkflow: (workflow: WorkflowSchema) => void;
549
- addNode: (templateId: string, x: number, y: number) => WorkflowNode;
550
- updateNode: (nodeId: string, updates: Partial<WorkflowNode>) => void;
551
- removeNodes: (nodeIds: string[]) => void;
552
- addConnection: (conn: Omit<WorkflowConnection, 'id'>) => void;
553
- removeConnections: (connIds: string[]) => void;
554
- selectNode: (nodeId: string, addToSelection?: boolean) => void;
555
- selectConnection: (connId: string, addToSelection?: boolean) => void;
556
- clearSelection: () => void;
557
- setZoom: (zoom: number) => void;
558
- setPan: (x: number, y: number) => void;
559
- addVariable: (variable: Omit<WorkflowVariable, 'id'>) => void;
560
- removeVariable: (varId: string) => void;
561
- undo: () => void;
562
- redo: () => void;
563
- validate: () => {
564
- valid: boolean;
565
- errors: string[];
566
- };
567
- exportJSON: () => string;
568
- exportYAML: () => string;
569
- importJSON: (json: string) => void;
570
- }
571
-
572
- /**
573
- * Workflow execution log entry
574
- */
575
- export declare interface WorkflowLogEntry {
576
- id: string;
577
- nodeId: string;
578
- timestamp: string;
579
- status: 'running' | 'success' | 'error' | 'skipped';
580
- input?: any;
581
- output?: any;
582
- error?: string;
583
- duration?: number;
584
- }
30
+ export { NiceWorkflowCondition }
585
31
 
586
- /**
587
- * Union type for all workflow nodes
588
- */
589
- export declare type WorkflowNode = TriggerNode | ActionNode | ConditionNode | LoopNode | ControlNode | WorkflowNodeBase;
32
+ export { NiceWorkflowDefinition }
590
33
 
591
- /**
592
- * Base workflow node
593
- */
594
- declare interface WorkflowNodeBase {
595
- id: string;
596
- category: WorkflowNodeCategory;
597
- x: number;
598
- y: number;
599
- width: number;
600
- height: number;
601
- label: string;
602
- description?: string;
603
- ports: WorkflowPort[];
604
- config: Record<string, any>;
605
- disabled?: boolean;
606
- breakpoint?: boolean;
607
- notes?: string;
608
- style?: {
609
- color?: string;
610
- backgroundColor?: string;
611
- borderColor?: string;
612
- icon?: string;
613
- };
614
- }
34
+ export { NiceWorkflowDesigner }
615
35
 
616
- /**
617
- * Workflow node categories
618
- */
619
- export declare type WorkflowNodeCategory = 'trigger' | 'action' | 'condition' | 'loop' | 'control' | 'integration' | 'data' | 'custom';
36
+ export { NiceWorkflowDesignerProps }
620
37
 
621
- /**
622
- * Port type for workflow nodes
623
- */
624
- export declare interface WorkflowPort {
625
- id: string;
626
- type: 'input' | 'output' | 'error';
627
- label?: string;
628
- position: 'top' | 'right' | 'bottom' | 'left';
629
- dataType?: VariableType;
630
- required?: boolean;
631
- multiple?: boolean;
632
- }
38
+ export { NiceWorkflowState }
633
39
 
634
- /**
635
- * Complete workflow schema
636
- */
637
- export declare interface WorkflowSchema {
638
- version: string;
639
- id: string;
640
- name: string;
641
- description?: string;
642
- nodes: WorkflowNode[];
643
- connections: WorkflowConnection[];
644
- variables: WorkflowVariable[];
645
- settings: {
646
- timeout?: number;
647
- errorHandling?: 'stop' | 'continue';
648
- logging?: 'all' | 'errors' | 'none';
649
- concurrency?: number;
650
- };
651
- canvas: {
652
- width: number;
653
- height: number;
654
- zoom: number;
655
- panX: number;
656
- panY: number;
657
- gridSize?: number;
658
- showGrid?: boolean;
659
- };
660
- meta?: {
661
- createdAt?: string;
662
- updatedAt?: string;
663
- author?: string;
664
- version?: string;
665
- tags?: string[];
666
- };
667
- }
40
+ export { NiceWorkflowTransition }
668
41
 
669
- /**
670
- * Variable definition
671
- */
672
- export declare interface WorkflowVariable {
673
- id: string;
674
- name: string;
675
- type: VariableType;
676
- defaultValue?: any;
677
- description?: string;
678
- scope: 'global' | 'local';
679
- }
42
+ export { NiceWorkflowTrigger }
680
43
 
681
44
  export { }