@nice2dev/ui-designers 1.0.10

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