@tduniec/plugin-template-designer 0.3.7 → 0.4.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +34 -39
  2. package/README.md +8 -130
  3. package/dist/alpha.esm.js +1 -1
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/components/TemplateDesigner/TemplateDesigner.esm.js +14 -12
  6. package/dist/components/TemplateDesigner/TemplateDesigner.esm.js.map +1 -1
  7. package/dist/index.d.ts +10 -4
  8. package/dist/index.esm.js +3 -1
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/package.json.esm.js +53 -92
  11. package/dist/package.json.esm.js.map +1 -1
  12. package/dist/plugin.esm.js +1 -2
  13. package/dist/plugin.esm.js.map +1 -1
  14. package/package.json +46 -77
  15. package/LICENSE +0 -201
  16. package/dist/api/mockScaffolderActions.esm.js +0 -85
  17. package/dist/api/mockScaffolderActions.esm.js.map +0 -1
  18. package/dist/api/scaffolderActions.esm.js +0 -57
  19. package/dist/api/scaffolderActions.esm.js.map +0 -1
  20. package/dist/components/DesignerFlow/DesignerFlow.esm.js +0 -431
  21. package/dist/components/DesignerFlow/DesignerFlow.esm.js.map +0 -1
  22. package/dist/components/DesignerFlow/flowConfig.esm.js +0 -21
  23. package/dist/components/DesignerFlow/flowConfig.esm.js.map +0 -1
  24. package/dist/components/DesignerFlow/handlers.esm.js +0 -322
  25. package/dist/components/DesignerFlow/handlers.esm.js.map +0 -1
  26. package/dist/components/DesignerFlow/model.esm.js +0 -185
  27. package/dist/components/DesignerFlow/model.esm.js.map +0 -1
  28. package/dist/components/DesignerFlow/nodeLayout.esm.js +0 -138
  29. package/dist/components/DesignerFlow/nodeLayout.esm.js.map +0 -1
  30. package/dist/components/DesignerFlow/parameterTransforms.esm.js +0 -184
  31. package/dist/components/DesignerFlow/parameterTransforms.esm.js.map +0 -1
  32. package/dist/components/Nodes/ActionNode.esm.js +0 -602
  33. package/dist/components/Nodes/ActionNode.esm.js.map +0 -1
  34. package/dist/components/Nodes/OutputNode.esm.js +0 -370
  35. package/dist/components/Nodes/OutputNode.esm.js.map +0 -1
  36. package/dist/components/Nodes/ParameterInputNode.esm.js +0 -310
  37. package/dist/components/Nodes/ParameterInputNode.esm.js.map +0 -1
  38. package/dist/components/Nodes/ParameterTitlesNode.esm.js +0 -251
  39. package/dist/components/Nodes/ParameterTitlesNode.esm.js.map +0 -1
  40. package/dist/components/Nodes/ParametersNode.esm.js +0 -144
  41. package/dist/components/Nodes/ParametersNode.esm.js.map +0 -1
  42. package/dist/components/Nodes/action/schema.esm.js +0 -144
  43. package/dist/components/Nodes/action/schema.esm.js.map +0 -1
  44. package/dist/components/Nodes/action/useActionInputs.esm.js +0 -84
  45. package/dist/components/Nodes/action/useActionInputs.esm.js.map +0 -1
  46. package/dist/components/Nodes/common/AutoWidthPopper.esm.js +0 -22
  47. package/dist/components/Nodes/common/AutoWidthPopper.esm.js.map +0 -1
  48. package/dist/components/Nodes/common/nodeInteraction.esm.js +0 -9
  49. package/dist/components/Nodes/common/nodeInteraction.esm.js.map +0 -1
  50. package/dist/components/Nodes/output/useOutputController.esm.js +0 -191
  51. package/dist/components/Nodes/output/useOutputController.esm.js.map +0 -1
  52. package/dist/components/Nodes/parameters/useParameterSections.esm.js +0 -162
  53. package/dist/components/Nodes/parameters/useParameterSections.esm.js.map +0 -1
  54. package/dist/components/Nodes/types.esm.js +0 -8
  55. package/dist/components/Nodes/types.esm.js.map +0 -1
  56. package/dist/components/TemplateDesigner/components/FieldEditorDialog.esm.js +0 -55
  57. package/dist/components/TemplateDesigner/components/FieldEditorDialog.esm.js.map +0 -1
  58. package/dist/components/TemplateDesigner/components/TemplateLanding.esm.js +0 -157
  59. package/dist/components/TemplateDesigner/components/TemplateLanding.esm.js.map +0 -1
  60. package/dist/components/TemplateDesigner/components/TemplateWorkspace.esm.js +0 -302
  61. package/dist/components/TemplateDesigner/components/TemplateWorkspace.esm.js.map +0 -1
  62. package/dist/components/TemplateDesigner/components/codemirrorTheme.esm.js +0 -30
  63. package/dist/components/TemplateDesigner/components/codemirrorTheme.esm.js.map +0 -1
  64. package/dist/components/TemplateDesigner/useFieldEditor.esm.js +0 -95
  65. package/dist/components/TemplateDesigner/useFieldEditor.esm.js.map +0 -1
  66. package/dist/components/TemplateDesigner/useTemplateState.esm.js +0 -627
  67. package/dist/components/TemplateDesigner/useTemplateState.esm.js.map +0 -1
  68. package/dist/components/TemplateDesigner/utils.esm.js +0 -46
  69. package/dist/components/TemplateDesigner/utils.esm.js.map +0 -1
  70. package/dist/components/TemplateDesignerIcon.esm.js +0 -33
  71. package/dist/components/TemplateDesignerIcon.esm.js.map +0 -1
  72. package/dist/utils/createSequentialEdges.esm.js +0 -15
  73. package/dist/utils/createSequentialEdges.esm.js.map +0 -1
  74. package/dist/utils/sampleTemplate.esm.js +0 -40
  75. package/dist/utils/sampleTemplate.esm.js.map +0 -1
  76. package/dist/utils/yamlJsonConversion.esm.js +0 -47
  77. package/dist/utils/yamlJsonConversion.esm.js.map +0 -1
@@ -1,602 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { memo, useState, useRef, useEffect } from 'react';
3
- import { NodeToolbar, Position, Handle } from '@xyflow/react';
4
- import { useTheme, styled } from '@material-ui/core/styles';
5
- import { Box, Typography, IconButton, TextField, Button, Divider, Chip } from '@material-ui/core';
6
- import DeleteOutlineIcon from '@material-ui/icons/DeleteOutline';
7
- import AddIcon from '@material-ui/icons/Add';
8
- import Autocomplete from '@material-ui/lab/Autocomplete';
9
- import { normalizeSchemaType, buildTypeLabel, extractEnumOptions, stringifyValueForDisplay, coerceValueForType } from './action/schema.esm.js';
10
- import { useActionInputs } from './action/useActionInputs.esm.js';
11
- import { createStopNodeInteraction } from './common/nodeInteraction.esm.js';
12
- import { AutoWidthPopper } from './common/AutoWidthPopper.esm.js';
13
-
14
- const Card = styled(Box)(({ theme }) => ({
15
- background: theme.palette.background.paper,
16
- border: `1px solid ${theme.palette.divider}`,
17
- borderRadius: 12,
18
- width: 760,
19
- // card width
20
- padding: theme.spacing(1.5),
21
- boxShadow: theme.shadows[2],
22
- color: theme.palette.text.primary
23
- }));
24
- const Header = styled(Box)(({ theme }) => ({
25
- display: "grid",
26
- gridTemplateColumns: "1fr",
27
- gap: theme.spacing(1),
28
- marginBottom: theme.spacing(1)
29
- }));
30
- const Grid = styled(Box)(({ theme }) => ({
31
- display: "grid",
32
- gridTemplateColumns: "88px 1fr",
33
- gap: theme.spacing(1),
34
- alignItems: "center"
35
- }));
36
- const KvRow = styled(Box)(({ theme }) => ({
37
- display: "grid",
38
- gridTemplateColumns: "200px 140px 1fr auto",
39
- gap: theme.spacing(1),
40
- alignItems: "center"
41
- }));
42
- const DEFAULT_ACTION_OPTIONS = [
43
- "fetch:template"
44
- // TODO to be fixed later to not uses default actions
45
- ];
46
- const ActionNodeComponent = ({ data }) => {
47
- const { rfId, step } = data;
48
- const [newKey, setNewKey] = useState("");
49
- const [newVal, setNewVal] = useState("");
50
- const stepOutputReferences = data.stepOutputReferences ?? [];
51
- const [isConfirmingDelete, setIsConfirmingDelete] = useState(false);
52
- const deleteConfirmationTimeoutRef = useRef(null);
53
- const theme = useTheme();
54
- const actionOptions = (data.scaffolderActionIds?.length ?? 0) > 0 ? data.scaffolderActionIds ?? [] : DEFAULT_ACTION_OPTIONS;
55
- const handleTop = (field) => (e) => data.onUpdateField?.(rfId, field, e.target.value);
56
- const actionId = typeof step?.action === "string" ? step.action : "";
57
- const [actionInputValue, setActionInputValue] = useState(actionId);
58
- useEffect(() => {
59
- setActionInputValue(actionId);
60
- }, [actionId]);
61
- const {
62
- actionInputSchema,
63
- inputEntries,
64
- usedInputKeys,
65
- missingRequiredInputKeys,
66
- availableInputOptions,
67
- trimmedNewKey,
68
- selectedNewKeyOption,
69
- newKeyNormalizedType,
70
- newKeyTypeLabel,
71
- newKeyEnumOptions
72
- } = useActionInputs({ data, step, actionId, newKey });
73
- const hasMissingRequiredInputs = missingRequiredInputKeys.length > 0;
74
- const isAddDisabled = !trimmedNewKey || usedInputKeys.has(trimmedNewKey);
75
- const newValueOptions = Array.from(
76
- /* @__PURE__ */ new Set([
77
- ...newKeyNormalizedType === "boolean" ? ["true", "false"] : [],
78
- ...newKeyEnumOptions,
79
- ...stepOutputReferences
80
- ])
81
- );
82
- const paletteMode = theme.palette.mode ?? theme.palette.type ?? "light";
83
- const requiredInputsBackground = paletteMode === "dark" ? "rgba(244, 67, 54, 0.2)" : "rgba(244, 67, 54, 0.08)";
84
- const addPair = () => {
85
- const k = trimmedNewKey;
86
- if (!k || usedInputKeys.has(k)) return;
87
- const schema = selectedNewKeyOption?.schema ?? actionInputSchema?.[k];
88
- const normalizedType = normalizeSchemaType(schema);
89
- const parsedValue = coerceValueForType(newVal, normalizedType);
90
- data.onUpdateInput?.(rfId, k, parsedValue);
91
- setNewKey("");
92
- setNewVal("");
93
- };
94
- const stopAll = createStopNodeInteraction();
95
- useEffect(() => {
96
- if (!isConfirmingDelete) {
97
- if (deleteConfirmationTimeoutRef.current) {
98
- clearTimeout(deleteConfirmationTimeoutRef.current);
99
- deleteConfirmationTimeoutRef.current = null;
100
- }
101
- return void 0;
102
- }
103
- deleteConfirmationTimeoutRef.current = setTimeout(() => {
104
- setIsConfirmingDelete(false);
105
- deleteConfirmationTimeoutRef.current = null;
106
- }, 3500);
107
- return () => {
108
- if (deleteConfirmationTimeoutRef.current) {
109
- clearTimeout(deleteConfirmationTimeoutRef.current);
110
- deleteConfirmationTimeoutRef.current = null;
111
- }
112
- };
113
- }, [isConfirmingDelete]);
114
- const handleDeleteNode = () => {
115
- if (!data.onRemoveNode) {
116
- return;
117
- }
118
- if (!isConfirmingDelete) {
119
- setIsConfirmingDelete(true);
120
- return;
121
- }
122
- data.onRemoveNode(rfId);
123
- setIsConfirmingDelete(false);
124
- };
125
- return /* @__PURE__ */ jsxs(Card, { children: [
126
- /* @__PURE__ */ jsxs(Header, { title: step?.name || "Unnamed Step", children: [
127
- /* @__PURE__ */ jsxs(
128
- Box,
129
- {
130
- style: {
131
- display: "flex",
132
- alignItems: "center",
133
- justifyContent: "space-between",
134
- gap: theme.spacing(1)
135
- },
136
- children: [
137
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", noWrap: true, children: step?.name || "Unnamed Step" }),
138
- data.onRemoveNode && /* @__PURE__ */ jsxs(
139
- Box,
140
- {
141
- style: {
142
- display: "flex",
143
- alignItems: "center",
144
- gap: theme.spacing(0.5),
145
- color: theme.palette.text.secondary
146
- },
147
- children: [
148
- isConfirmingDelete && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: "Click again to delete" }),
149
- /* @__PURE__ */ jsx(
150
- IconButton,
151
- {
152
- size: "small",
153
- onClick: handleDeleteNode,
154
- onPointerDown: (e) => e.stopPropagation(),
155
- "aria-label": "Remove action",
156
- color: isConfirmingDelete ? "secondary" : "default",
157
- className: "nodrag nowheel",
158
- children: /* @__PURE__ */ jsx(DeleteOutlineIcon, { fontSize: "small" })
159
- }
160
- )
161
- ]
162
- }
163
- )
164
- ]
165
- }
166
- ),
167
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Action" }),
168
- /* @__PURE__ */ jsx(
169
- Autocomplete,
170
- {
171
- size: "small",
172
- options: actionOptions,
173
- PopperComponent: AutoWidthPopper,
174
- freeSolo: true,
175
- autoHighlight: true,
176
- value: actionId,
177
- inputValue: actionInputValue,
178
- filterOptions: (options) => {
179
- const needle = actionInputValue.trim().toLowerCase();
180
- if (!needle) {
181
- return options;
182
- }
183
- return options.filter((opt) => opt.toLowerCase().includes(needle));
184
- },
185
- onChange: (_, newValue) => {
186
- const nextValue = newValue ?? "";
187
- setActionInputValue(nextValue);
188
- data.onUpdateField?.(rfId, "action", nextValue);
189
- },
190
- onInputChange: (_, newInputValue, reason) => {
191
- if (reason === "reset") {
192
- return;
193
- }
194
- const nextValue = newInputValue ?? "";
195
- setActionInputValue(nextValue);
196
- data.onUpdateField?.(rfId, "action", nextValue);
197
- },
198
- onPointerDown: stopAll.onPointerDown,
199
- onKeyDown: stopAll.onKeyDown,
200
- className: stopAll.className,
201
- fullWidth: true,
202
- renderInput: (params) => /* @__PURE__ */ jsx(
203
- TextField,
204
- {
205
- ...params,
206
- size: "small",
207
- placeholder: "e.g. fetch:template",
208
- fullWidth: true,
209
- inputProps: {
210
- ...params.inputProps,
211
- ...stopAll.inputProps
212
- }
213
- }
214
- )
215
- }
216
- )
217
- ] }),
218
- /* @__PURE__ */ jsx(NodeToolbar, { position: Position.Bottom, children: /* @__PURE__ */ jsx(
219
- Button,
220
- {
221
- variant: "outlined",
222
- size: "small",
223
- startIcon: /* @__PURE__ */ jsx(AddIcon, { fontSize: "small" }),
224
- onClick: () => data.onAddNode?.({
225
- afterRfId: rfId,
226
- type: "actionNode"
227
- }),
228
- onPointerDown: (e) => e.stopPropagation(),
229
- className: "nodrag nowheel",
230
- children: "Add Action"
231
- }
232
- ) }),
233
- /* @__PURE__ */ jsx(Divider, {}),
234
- /* @__PURE__ */ jsx(Box, { sx: { mb: 1 }, children: /* @__PURE__ */ jsxs(Grid, { children: [
235
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "ID" }),
236
- /* @__PURE__ */ jsx(
237
- TextField,
238
- {
239
- size: "small",
240
- placeholder: "string id",
241
- value: String(step?.id ?? ""),
242
- onChange: handleTop("id"),
243
- fullWidth: true,
244
- ...stopAll
245
- }
246
- ),
247
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Name" }),
248
- /* @__PURE__ */ jsx(
249
- TextField,
250
- {
251
- size: "small",
252
- placeholder: "Step name",
253
- value: String(step?.name ?? ""),
254
- onChange: handleTop("name"),
255
- fullWidth: true,
256
- ...stopAll
257
- }
258
- )
259
- ] }) }),
260
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Inputs" }),
261
- /* @__PURE__ */ jsxs(Box, { sx: { display: "grid", mt: 0.5 }, children: [
262
- inputEntries.length === 0 && /* @__PURE__ */ jsx(
263
- Box,
264
- {
265
- sx: {
266
- fontSize: 12,
267
- color: theme.palette.text.secondary,
268
- border: `1px dashed ${theme.palette.divider}`,
269
- borderRadius: 1,
270
- p: 1,
271
- textAlign: "center"
272
- },
273
- children: "No inputs yet"
274
- }
275
- ),
276
- /* @__PURE__ */ jsxs(
277
- KvRow,
278
- {
279
- sx: {
280
- mt: inputEntries.length === 0 ? 1.5 : 0.5,
281
- color: theme.palette.text.secondary
282
- },
283
- children: [
284
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Key" }),
285
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Type" }),
286
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: "Value" }),
287
- /* @__PURE__ */ jsx(Box, {})
288
- ]
289
- }
290
- ),
291
- inputEntries.map(([k, v]) => {
292
- const schema = actionInputSchema?.[k];
293
- const normalizedType = normalizeSchemaType(schema, v);
294
- const fallbackTypeLabel = normalizedType === "unknown" ? "Unknown" : normalizedType[0].toUpperCase() + normalizedType.slice(1);
295
- const typeLabel = buildTypeLabel(schema) || fallbackTypeLabel;
296
- const enumOptions = extractEnumOptions(schema);
297
- const baseOptions = normalizedType === "boolean" ? ["true", "false"] : [];
298
- const options = Array.from(
299
- /* @__PURE__ */ new Set([...baseOptions, ...enumOptions, ...stepOutputReferences])
300
- );
301
- const displayValue = stringifyValueForDisplay(v, normalizedType);
302
- const handleStringChange = (nextValue) => {
303
- const parsed = coerceValueForType(nextValue, normalizedType);
304
- data.onUpdateInput?.(rfId, k, parsed);
305
- };
306
- return /* @__PURE__ */ jsxs(KvRow, { children: [
307
- /* @__PURE__ */ jsx(
308
- Typography,
309
- {
310
- variant: "caption",
311
- noWrap: true,
312
- title: k,
313
- color: "textSecondary",
314
- children: k
315
- }
316
- ),
317
- /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(Chip, { size: "small", variant: "outlined", label: typeLabel }) }),
318
- (normalizedType === "array" || normalizedType === "object") && /* @__PURE__ */ jsx(
319
- TextField,
320
- {
321
- size: "small",
322
- value: displayValue,
323
- onChange: (event) => handleStringChange(event.target.value),
324
- placeholder: "JSON value",
325
- fullWidth: true,
326
- multiline: true,
327
- minRows: 2,
328
- inputProps: {
329
- ...stopAll.inputProps
330
- },
331
- onPointerDown: stopAll.onPointerDown,
332
- onKeyDown: stopAll.onKeyDown,
333
- className: stopAll.className
334
- }
335
- ),
336
- (normalizedType === "number" || normalizedType === "integer") && /* @__PURE__ */ jsx(
337
- TextField,
338
- {
339
- size: "small",
340
- value: displayValue,
341
- onChange: (event) => handleStringChange(event.target.value),
342
- placeholder: "Number",
343
- fullWidth: true,
344
- inputProps: {
345
- ...stopAll.inputProps,
346
- inputMode: "decimal"
347
- },
348
- onPointerDown: stopAll.onPointerDown,
349
- onKeyDown: stopAll.onKeyDown,
350
- className: stopAll.className
351
- }
352
- ),
353
- normalizedType !== "array" && normalizedType !== "object" && normalizedType !== "number" && normalizedType !== "integer" && /* @__PURE__ */ jsx(
354
- Autocomplete,
355
- {
356
- size: "small",
357
- freeSolo: true,
358
- options,
359
- PopperComponent: AutoWidthPopper,
360
- value: displayValue,
361
- inputValue: displayValue,
362
- fullWidth: true,
363
- onChange: (_, value) => handleStringChange(value ?? ""),
364
- onInputChange: (_, value, reason) => {
365
- if (reason === "reset") {
366
- return;
367
- }
368
- handleStringChange(value ?? "");
369
- },
370
- onPointerDown: stopAll.onPointerDown,
371
- onKeyDown: stopAll.onKeyDown,
372
- className: stopAll.className,
373
- renderInput: (params) => /* @__PURE__ */ jsx(
374
- TextField,
375
- {
376
- ...params,
377
- size: "small",
378
- placeholder: "value",
379
- inputProps: {
380
- ...params.inputProps,
381
- ...stopAll.inputProps
382
- }
383
- }
384
- )
385
- }
386
- ),
387
- /* @__PURE__ */ jsx(
388
- IconButton,
389
- {
390
- size: "small",
391
- onClick: () => data.onRemoveInputKey?.(rfId, k),
392
- onPointerDown: (e) => e.stopPropagation(),
393
- "aria-label": `Remove ${k}`,
394
- className: "nodrag nowheel",
395
- children: /* @__PURE__ */ jsx(DeleteOutlineIcon, { fontSize: "small" })
396
- }
397
- )
398
- ] }, k);
399
- }),
400
- /* @__PURE__ */ jsxs(KvRow, { children: [
401
- /* @__PURE__ */ jsx(
402
- Autocomplete,
403
- {
404
- size: "small",
405
- freeSolo: true,
406
- options: availableInputOptions,
407
- PopperComponent: AutoWidthPopper,
408
- value: selectedNewKeyOption,
409
- inputValue: newKey,
410
- filterOptions: (options) => {
411
- const needle = newKey.trim().toLowerCase();
412
- if (!needle) {
413
- return options;
414
- }
415
- return options.filter(
416
- (option) => (typeof option === "string" ? option : option.label).toLowerCase().includes(needle)
417
- );
418
- },
419
- onChange: (_, value) => {
420
- if (!value) {
421
- setNewKey("");
422
- return;
423
- }
424
- if (typeof value === "string") {
425
- setNewKey(value);
426
- return;
427
- }
428
- setNewKey(value.key);
429
- },
430
- onInputChange: (_, value, reason) => {
431
- if (reason === "reset") {
432
- return;
433
- }
434
- setNewKey(value ?? "");
435
- },
436
- onPointerDown: stopAll.onPointerDown,
437
- onKeyDown: stopAll.onKeyDown,
438
- className: stopAll.className,
439
- getOptionSelected: (option, value) => option.key === value?.key,
440
- getOptionLabel: (option) => typeof option === "string" ? option : option.label,
441
- renderInput: (params) => /* @__PURE__ */ jsx(
442
- TextField,
443
- {
444
- ...params,
445
- size: "small",
446
- placeholder: "new key",
447
- inputProps: {
448
- ...params.inputProps,
449
- ...stopAll.inputProps
450
- }
451
- }
452
- )
453
- }
454
- ),
455
- /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(Chip, { size: "small", variant: "outlined", label: newKeyTypeLabel }) }),
456
- (newKeyNormalizedType === "array" || newKeyNormalizedType === "object") && /* @__PURE__ */ jsx(
457
- TextField,
458
- {
459
- size: "small",
460
- value: newVal,
461
- onChange: (event) => setNewVal(event.target.value),
462
- placeholder: "JSON value",
463
- fullWidth: true,
464
- multiline: true,
465
- minRows: 2,
466
- inputProps: {
467
- ...stopAll.inputProps
468
- },
469
- onPointerDown: stopAll.onPointerDown,
470
- onKeyDown: stopAll.onKeyDown,
471
- className: stopAll.className
472
- }
473
- ),
474
- (newKeyNormalizedType === "number" || newKeyNormalizedType === "integer") && /* @__PURE__ */ jsx(
475
- TextField,
476
- {
477
- size: "small",
478
- value: newVal,
479
- onChange: (event) => setNewVal(event.target.value),
480
- placeholder: "Number",
481
- fullWidth: true,
482
- inputProps: {
483
- ...stopAll.inputProps,
484
- inputMode: "decimal"
485
- },
486
- onPointerDown: stopAll.onPointerDown,
487
- onKeyDown: stopAll.onKeyDown,
488
- className: stopAll.className
489
- }
490
- ),
491
- newKeyNormalizedType !== "array" && newKeyNormalizedType !== "object" && newKeyNormalizedType !== "number" && newKeyNormalizedType !== "integer" && /* @__PURE__ */ jsx(
492
- Autocomplete,
493
- {
494
- size: "small",
495
- freeSolo: true,
496
- options: newValueOptions,
497
- PopperComponent: AutoWidthPopper,
498
- value: newVal,
499
- inputValue: newVal,
500
- fullWidth: true,
501
- filterOptions: (options) => {
502
- const needle = newVal.trim().toLowerCase();
503
- if (!needle) {
504
- return options;
505
- }
506
- return options.filter((option) => {
507
- const raw = String(option);
508
- const normalized = raw.replace(/^\s*\$\{\{\s*/, "").replace(/\s*\}\}\s*$/, "");
509
- const haystacks = [
510
- raw.toLowerCase(),
511
- normalized.toLowerCase()
512
- ];
513
- return haystacks.some(
514
- (haystack) => haystack.includes(needle)
515
- );
516
- });
517
- },
518
- onChange: (_, value) => setNewVal(value ?? ""),
519
- onInputChange: (_, value, reason) => {
520
- if (reason === "reset") {
521
- return;
522
- }
523
- setNewVal(value ?? "");
524
- },
525
- onPointerDown: stopAll.onPointerDown,
526
- onKeyDown: stopAll.onKeyDown,
527
- className: stopAll.className,
528
- renderInput: (params) => /* @__PURE__ */ jsx(
529
- TextField,
530
- {
531
- ...params,
532
- size: "small",
533
- placeholder: "new value",
534
- inputProps: {
535
- ...params.inputProps,
536
- ...stopAll.inputProps
537
- }
538
- }
539
- )
540
- }
541
- ),
542
- /* @__PURE__ */ jsx(
543
- Button,
544
- {
545
- size: "small",
546
- variant: "contained",
547
- onClick: addPair,
548
- onPointerDown: (e) => e.stopPropagation(),
549
- disabled: isAddDisabled,
550
- className: "nodrag nowheel",
551
- children: "Add"
552
- }
553
- )
554
- ] })
555
- ] }),
556
- hasMissingRequiredInputs && /* @__PURE__ */ jsxs(
557
- Box,
558
- {
559
- sx: {
560
- mt: 1.5,
561
- p: 1,
562
- borderRadius: 1,
563
- border: `1px solid ${theme.palette.error.main}`
564
- },
565
- style: { backgroundColor: requiredInputsBackground },
566
- children: [
567
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: "Missing required inputs" }),
568
- /* @__PURE__ */ jsx(
569
- Box,
570
- {
571
- sx: {
572
- display: "flex",
573
- flexWrap: "wrap",
574
- mt: 0.75
575
- },
576
- style: { gap: theme.spacing(0.5) },
577
- children: missingRequiredInputKeys.map((key) => /* @__PURE__ */ jsx(
578
- Chip,
579
- {
580
- size: "small",
581
- variant: "outlined",
582
- label: key,
583
- style: {
584
- borderColor: theme.palette.error.main,
585
- color: theme.palette.error.main
586
- }
587
- },
588
- key
589
- ))
590
- }
591
- )
592
- ]
593
- }
594
- ),
595
- /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top }),
596
- /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom })
597
- ] });
598
- };
599
- const ActionNode = memo(ActionNodeComponent);
600
-
601
- export { ActionNode };
602
- //# sourceMappingURL=ActionNode.esm.js.map