@flowuent-org/diagramming-core 1.0.8 → 1.1.1

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 (40) hide show
  1. package/apps/diagramming/src/AutomationDiagramData.ts +22 -0
  2. package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
  3. package/apps/diagramming/src/main.tsx +463 -463
  4. package/apps/diagramming/src/node-data.ts +664 -664
  5. package/apps/diagramming/src/stencil-items.ts +31 -31
  6. package/apps/diagramming/src/vite-env.d.ts +1 -1
  7. package/package.json +1 -1
  8. package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
  9. package/packages/diagrams/README.md +7 -463
  10. package/packages/diagrams/UNDO_REDO_API.md +306 -306
  11. package/packages/diagrams/package.json +27 -27
  12. package/packages/diagrams/project.json +42 -42
  13. package/packages/diagrams/rollup.config.js +26 -26
  14. package/packages/diagrams/src/DiagramFlow.tsx +7 -7
  15. package/packages/diagrams/src/index.ts +116 -116
  16. package/packages/diagrams/src/index.ts.bak +99 -99
  17. package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
  18. package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
  19. package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
  20. package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -0
  21. package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +227 -0
  22. package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +178 -115
  23. package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +133 -27
  24. package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +134 -28
  25. package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +132 -27
  26. package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +124 -17
  27. package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +122 -15
  28. package/packages/diagrams/src/lib/components/automation/index.ts +3 -0
  29. package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
  30. package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
  31. package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
  32. package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
  33. package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
  34. package/packages/diagrams/src/lib/types/card-node.ts +68 -68
  35. package/packages/diagrams/src/lib/types/node-types.ts +29 -29
  36. package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1179 -1179
  37. package/packages/diagrams/tsconfig.lib.json +25 -25
  38. package/tsconfig.base.json +29 -30
  39. package/TRANSLATION_FIX_SUMMARY.md +0 -118
  40. package/packages/diagrams/I18N_SETUP.md +0 -126
@@ -119,6 +119,22 @@ export const automationDefaultNodes = [
119
119
  iconColor: '#10b981',
120
120
  },
121
121
  ],
122
+ // AI Suggestions count and data
123
+ aiSuggestionsCount: 2,
124
+ aiSuggestions: [
125
+ {
126
+ id: '1',
127
+ title: 'Add Citation Extraction',
128
+ description: 'Automatically extract and format citations from article content.',
129
+ tags: ['classification', 'enhancement'],
130
+ },
131
+ {
132
+ id: '2',
133
+ title: 'Generate Bullet Summary',
134
+ description: 'Create a concise bullet-point summary of the article\'s main points.',
135
+ tags: ['classification', 'enhancement'],
136
+ },
137
+ ],
122
138
  isPinned: false,
123
139
  isBlock: false,
124
140
  blocks: [],
@@ -214,6 +230,8 @@ export const automationDefaultNodes = [
214
230
  iconColor: '#10b981',
215
231
  },
216
232
  ],
233
+ // AI Suggestions count
234
+ aiSuggestionsCount: 2,
217
235
  isPinned: false,
218
236
  isBlock: false,
219
237
  blocks: [],
@@ -320,6 +338,8 @@ export const automationDefaultNodes = [
320
338
  maxRetries: 3,
321
339
  fallbackAction: 'log',
322
340
  },
341
+ // AI Suggestions count
342
+ aiSuggestionsCount: 2,
323
343
  isPinned: false,
324
344
  isBlock: false,
325
345
  blocks: [],
@@ -444,6 +464,8 @@ export const automationDefaultNodes = [
444
464
  ],
445
465
  payloadTemplate: '{{analyzedArticle}}',
446
466
  },
467
+ // AI Suggestions count
468
+ aiSuggestionsCount: 2,
447
469
  isPinned: false,
448
470
  isBlock: false,
449
471
  blocks: [],
@@ -1,252 +1,252 @@
1
- import React, { useState, useMemo } from 'react';
2
- import { Box, Button, Grid, Modal, Paper, Typography, TextField, InputAdornment } from '@mui/material';
3
- import {
4
- RiArrowRightLine,
5
- RiCodeSSlashLine,
6
- RiFunctionLine,
7
- RiGitBranchLine,
8
- RiNodeTree,
9
- RiPhoneLine,
10
- RiRepeatLine,
11
- RiShuffleLine,
12
- RiSearchLine,
13
- RiCloseLine,
14
- RiGlobalLine
15
- } from 'react-icons/ri';
16
- import { RenderAddNodeViewType } from '@flowuent-labs/diagrams';
17
-
18
- export interface NodeAction {
19
- label: string;
20
- type: string;
21
- icon: React.ReactNode;
22
- }
23
-
24
- const nodeActions: NodeAction[] = [
25
- { label: 'Parallel', type: 'parallel', icon: <RiNodeTree /> },
26
- { label: 'Function Call', type: 'call', icon: <RiPhoneLine /> },
27
- { label: 'Function', type: 'function', icon: <RiFunctionLine /> },
28
- { label: 'Let', type: 'let', icon: <RiCodeSSlashLine /> },
29
- { label: 'Set', type: 'set', icon: <RiCodeSSlashLine /> },
30
- { label: 'Branch', type: 'branch', icon: <RiGitBranchLine /> },
31
- { label: 'Return', type: 'return', icon: <RiArrowRightLine /> },
32
- { label: 'Loop', type: 'loop', icon: <RiRepeatLine /> },
33
- { label: 'Repeat', type: 'loop', icon: <RiRepeatLine /> },
34
- { label: 'Switch', type: 'switch', icon: <RiShuffleLine /> },
35
- { label: 'Try/Catch', type: 'tryCatch', icon: <RiShuffleLine /> },
36
- { label: 'For Loop', type: 'forLoop', icon: <RiShuffleLine /> },
37
- { label: 'API Call', type: 'api', icon: <RiGlobalLine /> },
38
- { label: 'GraphQL Query', type: 'graphql', icon: <RiGlobalLine /> },
39
- ];
40
-
41
- export const AddNodeView: React.FC<{
42
- addNode: (type: string) => void;
43
- open: boolean;
44
- setOpen: (open: boolean) => void;
45
- }> = React.memo(
46
- ({ addNode, open, setOpen }) => {
47
- const [searchQuery, setSearchQuery] = useState('');
48
-
49
- const filteredNodeActions = useMemo(() => {
50
- if (!searchQuery.trim()) return nodeActions;
51
- return nodeActions.filter(item =>
52
- item.label.toLowerCase().includes(searchQuery.toLowerCase())
53
- );
54
- }, [searchQuery]);
55
-
56
- return (
57
- <Modal
58
- open={open}
59
- onClose={() => setOpen(false)}
60
- aria-labelledby="modal-modal-title"
61
- aria-describedby="modal-modal-description"
62
- >
63
- <Box
64
- sx={{
65
- display: 'flex',
66
- justifyContent: 'center',
67
- alignItems: 'center',
68
- height: '100vh',
69
- backdropFilter: 'blur(10px) saturate(180%)',
70
- backgroundColor: 'rgba(0, 0, 0, 0.3)',
71
- }}
72
- >
73
- <Paper
74
- elevation={24}
75
- sx={{
76
- width: 600,
77
- maxHeight: '80vh',
78
- padding: 4,
79
- borderRadius: 3,
80
- background: 'linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(45, 45, 45, 0.95))',
81
- boxShadow: '0 8px 32px rgba(0, 0, 0, 0.4)',
82
- backdropFilter: 'blur(20px)',
83
- border: '1px solid rgba(255, 255, 255, 0.1)',
84
- position: 'relative',
85
- overflow: 'hidden',
86
- '&::before': {
87
- content: '""',
88
- position: 'absolute',
89
- top: 0,
90
- left: 0,
91
- right: 0,
92
- bottom: 0,
93
- background: 'radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%)',
94
- pointerEvents: 'none',
95
- }
96
- }}
97
- >
98
- {/* Close button */}
99
- <Box
100
- sx={{
101
- position: 'absolute',
102
- top: 16,
103
- right: 16,
104
- cursor: 'pointer',
105
- color: 'rgba(255, 255, 255, 0.7)',
106
- '&:hover': {
107
- color: 'rgba(255, 255, 255, 1)',
108
- }
109
- }}
110
- onClick={() => setOpen(false)}
111
- >
112
- <RiCloseLine size={24} />
113
- </Box>
114
-
115
- {/* Header */}
116
- <Typography
117
- variant="h5"
118
- component="h3"
119
- gutterBottom
120
- sx={{
121
- color: 'rgba(255, 255, 255, 0.95)',
122
- fontWeight: 600,
123
- mb: 1,
124
- textAlign: 'center'
125
- }}
126
- >
127
- Add a new node
128
- </Typography>
129
-
130
- <Typography
131
- variant="body1"
132
- component="p"
133
- gutterBottom
134
- sx={{
135
- color: 'rgba(255, 255, 255, 0.7)',
136
- textAlign: 'center',
137
- mb: 3
138
- }}
139
- >
140
- Select your data flow type for your new nodes
141
- </Typography>
142
-
143
- {/* Search bar */}
144
- <TextField
145
- fullWidth
146
- placeholder="Search Nodes..."
147
- value={searchQuery}
148
- onChange={(e) => setSearchQuery(e.target.value)}
149
- sx={{
150
- mb: 3,
151
- '& .MuiOutlinedInput-root': {
152
- backgroundColor: 'rgba(255, 255, 255, 0.1)',
153
- borderRadius: 2,
154
- '& fieldset': {
155
- borderColor: 'rgba(255, 255, 255, 0.2)',
156
- },
157
- '&:hover fieldset': {
158
- borderColor: 'rgba(255, 255, 255, 0.3)',
159
- },
160
- '&.Mui-focused fieldset': {
161
- borderColor: 'rgba(120, 119, 198, 0.8)',
162
- },
163
- '& input': {
164
- color: 'rgba(255, 255, 255, 0.9)',
165
- '&::placeholder': {
166
- color: 'rgba(255, 255, 255, 0.5)',
167
- opacity: 1,
168
- },
169
- },
170
- },
171
- }}
172
- InputProps={{
173
- startAdornment: (
174
- <InputAdornment position="start">
175
- <RiSearchLine style={{ color: 'rgba(255, 255, 255, 0.5)' }} />
176
- </InputAdornment>
177
- ),
178
- }}
179
- />
180
-
181
- {/* Node grid */}
182
- <Box
183
- sx={{
184
- maxHeight: '400px',
185
- overflowY: 'auto',
186
- pr: 1,
187
- '&::-webkit-scrollbar': {
188
- width: '8px',
189
- },
190
- '&::-webkit-scrollbar-track': {
191
- background: 'rgba(255, 255, 255, 0.1)',
192
- borderRadius: '4px',
193
- },
194
- '&::-webkit-scrollbar-thumb': {
195
- background: 'rgba(255, 255, 255, 0.3)',
196
- borderRadius: '4px',
197
- '&:hover': {
198
- background: 'rgba(255, 255, 255, 0.5)',
199
- },
200
- },
201
- }}
202
- >
203
- <Grid container spacing={2}>
204
- {filteredNodeActions.map((item) => (
205
- <Grid item xs={6} key={item.label}>
206
- <Button
207
- sx={{
208
- textTransform: 'none',
209
- justifyContent: 'flex-start',
210
- padding: 2,
211
- height: 'auto',
212
- minHeight: '60px',
213
- backgroundColor: 'rgba(255, 255, 255, 0.05)',
214
- border: '1px solid rgba(255, 255, 255, 0.1)',
215
- borderRadius: 2,
216
- color: 'rgba(255, 255, 255, 0.9)',
217
- transition: 'all 0.2s ease-in-out',
218
- '&:hover': {
219
- backgroundColor: 'rgba(120, 119, 198, 0.2)',
220
- borderColor: 'rgba(120, 119, 198, 0.5)',
221
- transform: 'translateY(-2px)',
222
- boxShadow: '0 4px 12px rgba(120, 119, 198, 0.3)',
223
- },
224
- '& .MuiButton-startIcon': {
225
- marginRight: 1,
226
- color: 'rgba(255, 255, 255, 0.7)',
227
- },
228
- }}
229
- startIcon={item.icon}
230
- fullWidth
231
- variant="text"
232
- onClick={(e) => {
233
- e.stopPropagation();
234
- addNode(item.type);
235
- }}
236
- >
237
- <Box sx={{ textAlign: 'left' }}>
238
- <Typography variant="body2" sx={{ fontWeight: 500 }}>
239
- {item.label}
240
- </Typography>
241
- </Box>
242
- </Button>
243
- </Grid>
244
- ))}
245
- </Grid>
246
- </Box>
247
- </Paper>
248
- </Box>
249
- </Modal>
250
- );
251
- },
252
- );
1
+ import React, { useState, useMemo } from 'react';
2
+ import { Box, Button, Grid, Modal, Paper, Typography, TextField, InputAdornment } from '@mui/material';
3
+ import {
4
+ RiArrowRightLine,
5
+ RiCodeSSlashLine,
6
+ RiFunctionLine,
7
+ RiGitBranchLine,
8
+ RiNodeTree,
9
+ RiPhoneLine,
10
+ RiRepeatLine,
11
+ RiShuffleLine,
12
+ RiSearchLine,
13
+ RiCloseLine,
14
+ RiGlobalLine
15
+ } from 'react-icons/ri';
16
+ import { RenderAddNodeViewType } from '@flowuent-labs/diagrams';
17
+
18
+ export interface NodeAction {
19
+ label: string;
20
+ type: string;
21
+ icon: React.ReactNode;
22
+ }
23
+
24
+ const nodeActions: NodeAction[] = [
25
+ { label: 'Parallel', type: 'parallel', icon: <RiNodeTree /> },
26
+ { label: 'Function Call', type: 'call', icon: <RiPhoneLine /> },
27
+ { label: 'Function', type: 'function', icon: <RiFunctionLine /> },
28
+ { label: 'Let', type: 'let', icon: <RiCodeSSlashLine /> },
29
+ { label: 'Set', type: 'set', icon: <RiCodeSSlashLine /> },
30
+ { label: 'Branch', type: 'branch', icon: <RiGitBranchLine /> },
31
+ { label: 'Return', type: 'return', icon: <RiArrowRightLine /> },
32
+ { label: 'Loop', type: 'loop', icon: <RiRepeatLine /> },
33
+ { label: 'Repeat', type: 'loop', icon: <RiRepeatLine /> },
34
+ { label: 'Switch', type: 'switch', icon: <RiShuffleLine /> },
35
+ { label: 'Try/Catch', type: 'tryCatch', icon: <RiShuffleLine /> },
36
+ { label: 'For Loop', type: 'forLoop', icon: <RiShuffleLine /> },
37
+ { label: 'API Call', type: 'api', icon: <RiGlobalLine /> },
38
+ { label: 'GraphQL Query', type: 'graphql', icon: <RiGlobalLine /> },
39
+ ];
40
+
41
+ export const AddNodeView: React.FC<{
42
+ addNode: (type: string) => void;
43
+ open: boolean;
44
+ setOpen: (open: boolean) => void;
45
+ }> = React.memo(
46
+ ({ addNode, open, setOpen }) => {
47
+ const [searchQuery, setSearchQuery] = useState('');
48
+
49
+ const filteredNodeActions = useMemo(() => {
50
+ if (!searchQuery.trim()) return nodeActions;
51
+ return nodeActions.filter(item =>
52
+ item.label.toLowerCase().includes(searchQuery.toLowerCase())
53
+ );
54
+ }, [searchQuery]);
55
+
56
+ return (
57
+ <Modal
58
+ open={open}
59
+ onClose={() => setOpen(false)}
60
+ aria-labelledby="modal-modal-title"
61
+ aria-describedby="modal-modal-description"
62
+ >
63
+ <Box
64
+ sx={{
65
+ display: 'flex',
66
+ justifyContent: 'center',
67
+ alignItems: 'center',
68
+ height: '100vh',
69
+ backdropFilter: 'blur(10px) saturate(180%)',
70
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
71
+ }}
72
+ >
73
+ <Paper
74
+ elevation={24}
75
+ sx={{
76
+ width: 600,
77
+ maxHeight: '80vh',
78
+ padding: 4,
79
+ borderRadius: 3,
80
+ background: 'linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(45, 45, 45, 0.95))',
81
+ boxShadow: '0 8px 32px rgba(0, 0, 0, 0.4)',
82
+ backdropFilter: 'blur(20px)',
83
+ border: '1px solid rgba(255, 255, 255, 0.1)',
84
+ position: 'relative',
85
+ overflow: 'hidden',
86
+ '&::before': {
87
+ content: '""',
88
+ position: 'absolute',
89
+ top: 0,
90
+ left: 0,
91
+ right: 0,
92
+ bottom: 0,
93
+ background: 'radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%)',
94
+ pointerEvents: 'none',
95
+ }
96
+ }}
97
+ >
98
+ {/* Close button */}
99
+ <Box
100
+ sx={{
101
+ position: 'absolute',
102
+ top: 16,
103
+ right: 16,
104
+ cursor: 'pointer',
105
+ color: 'rgba(255, 255, 255, 0.7)',
106
+ '&:hover': {
107
+ color: 'rgba(255, 255, 255, 1)',
108
+ }
109
+ }}
110
+ onClick={() => setOpen(false)}
111
+ >
112
+ <RiCloseLine size={24} />
113
+ </Box>
114
+
115
+ {/* Header */}
116
+ <Typography
117
+ variant="h5"
118
+ component="h3"
119
+ gutterBottom
120
+ sx={{
121
+ color: 'rgba(255, 255, 255, 0.95)',
122
+ fontWeight: 600,
123
+ mb: 1,
124
+ textAlign: 'center'
125
+ }}
126
+ >
127
+ Add a new node
128
+ </Typography>
129
+
130
+ <Typography
131
+ variant="body1"
132
+ component="p"
133
+ gutterBottom
134
+ sx={{
135
+ color: 'rgba(255, 255, 255, 0.7)',
136
+ textAlign: 'center',
137
+ mb: 3
138
+ }}
139
+ >
140
+ Select your data flow type for your new nodes
141
+ </Typography>
142
+
143
+ {/* Search bar */}
144
+ <TextField
145
+ fullWidth
146
+ placeholder="Search Nodes..."
147
+ value={searchQuery}
148
+ onChange={(e) => setSearchQuery(e.target.value)}
149
+ sx={{
150
+ mb: 3,
151
+ '& .MuiOutlinedInput-root': {
152
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
153
+ borderRadius: 2,
154
+ '& fieldset': {
155
+ borderColor: 'rgba(255, 255, 255, 0.2)',
156
+ },
157
+ '&:hover fieldset': {
158
+ borderColor: 'rgba(255, 255, 255, 0.3)',
159
+ },
160
+ '&.Mui-focused fieldset': {
161
+ borderColor: 'rgba(120, 119, 198, 0.8)',
162
+ },
163
+ '& input': {
164
+ color: 'rgba(255, 255, 255, 0.9)',
165
+ '&::placeholder': {
166
+ color: 'rgba(255, 255, 255, 0.5)',
167
+ opacity: 1,
168
+ },
169
+ },
170
+ },
171
+ }}
172
+ InputProps={{
173
+ startAdornment: (
174
+ <InputAdornment position="start">
175
+ <RiSearchLine style={{ color: 'rgba(255, 255, 255, 0.5)' }} />
176
+ </InputAdornment>
177
+ ),
178
+ }}
179
+ />
180
+
181
+ {/* Node grid */}
182
+ <Box
183
+ sx={{
184
+ maxHeight: '400px',
185
+ overflowY: 'auto',
186
+ pr: 1,
187
+ '&::-webkit-scrollbar': {
188
+ width: '8px',
189
+ },
190
+ '&::-webkit-scrollbar-track': {
191
+ background: 'rgba(255, 255, 255, 0.1)',
192
+ borderRadius: '4px',
193
+ },
194
+ '&::-webkit-scrollbar-thumb': {
195
+ background: 'rgba(255, 255, 255, 0.3)',
196
+ borderRadius: '4px',
197
+ '&:hover': {
198
+ background: 'rgba(255, 255, 255, 0.5)',
199
+ },
200
+ },
201
+ }}
202
+ >
203
+ <Grid container spacing={2}>
204
+ {filteredNodeActions.map((item) => (
205
+ <Grid item xs={6} key={item.label}>
206
+ <Button
207
+ sx={{
208
+ textTransform: 'none',
209
+ justifyContent: 'flex-start',
210
+ padding: 2,
211
+ height: 'auto',
212
+ minHeight: '60px',
213
+ backgroundColor: 'rgba(255, 255, 255, 0.05)',
214
+ border: '1px solid rgba(255, 255, 255, 0.1)',
215
+ borderRadius: 2,
216
+ color: 'rgba(255, 255, 255, 0.9)',
217
+ transition: 'all 0.2s ease-in-out',
218
+ '&:hover': {
219
+ backgroundColor: 'rgba(120, 119, 198, 0.2)',
220
+ borderColor: 'rgba(120, 119, 198, 0.5)',
221
+ transform: 'translateY(-2px)',
222
+ boxShadow: '0 4px 12px rgba(120, 119, 198, 0.3)',
223
+ },
224
+ '& .MuiButton-startIcon': {
225
+ marginRight: 1,
226
+ color: 'rgba(255, 255, 255, 0.7)',
227
+ },
228
+ }}
229
+ startIcon={item.icon}
230
+ fullWidth
231
+ variant="text"
232
+ onClick={(e) => {
233
+ e.stopPropagation();
234
+ addNode(item.type);
235
+ }}
236
+ >
237
+ <Box sx={{ textAlign: 'left' }}>
238
+ <Typography variant="body2" sx={{ fontWeight: 500 }}>
239
+ {item.label}
240
+ </Typography>
241
+ </Box>
242
+ </Button>
243
+ </Grid>
244
+ ))}
245
+ </Grid>
246
+ </Box>
247
+ </Paper>
248
+ </Box>
249
+ </Modal>
250
+ );
251
+ },
252
+ );