@kiberon-labs/behave-graph-flow 1.0.0 → 2.0.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/.fallowrc.json +16 -0
- package/.storybook/main.ts +32 -0
- package/.storybook/preview.ts +16 -0
- package/.storybook/styles.css +10 -0
- package/.storybook/vscode.css +814 -0
- package/.turbo/turbo-build.log +7 -0
- package/LICENSE +6 -0
- package/README.md +2 -2
- package/data/Polynomial.json +510 -0
- package/data/sequence.json +337 -0
- package/data/trigger-event.json +241 -0
- package/data/variable-change.json +210 -0
- package/dist/entry.css +4 -0
- package/dist/index.css +39 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +2282 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14873 -0
- package/dist/index.js.map +1 -0
- package/docs/notifications.md +246 -0
- package/docs/protocol.md +679 -0
- package/docs/specifics.md +191 -0
- package/package.json +85 -21
- package/postcss.config.ts +3 -4
- package/src/annotations/index.ts +32 -0
- package/src/components/FloatingToolbar/index.module.css +45 -0
- package/src/components/FloatingToolbar/index.tsx +256 -0
- package/src/components/Flow.tsx +276 -75
- package/src/components/contextMenus/NodePicker.module.css +274 -0
- package/src/components/contextMenus/NodePicker.tsx +481 -0
- package/src/components/contextMenus/edge.tsx +108 -0
- package/src/components/contextMenus/node.tsx +155 -0
- package/src/components/contextMenus/selection.tsx +77 -0
- package/src/components/controls/any/index.tsx +8 -0
- package/src/components/controls/boolean/index.tsx +13 -0
- package/src/components/controls/colorPicker/InputPopover.module.css +100 -0
- package/src/components/controls/colorPicker/InputPopover.tsx +31 -0
- package/src/components/controls/colorPicker/index.module.css +18 -0
- package/src/components/controls/colorPicker/index.tsx +61 -0
- package/src/components/controls/number/index.tsx +35 -0
- package/src/components/controls/string/index.tsx +16 -0
- package/src/components/edges/index.tsx +469 -0
- package/src/components/edges/offsetBezier.ts +134 -0
- package/src/components/hotKeys.tsx +20 -0
- package/src/components/layoutController/index.module.css +10 -0
- package/src/components/layoutController/index.tsx +117 -0
- package/src/components/layoutController/utils.ts +205 -0
- package/src/components/menubar/defaults.tsx +480 -0
- package/src/components/menubar/index.tsx +49 -0
- package/src/components/menubar/menuItem.module.css +16 -0
- package/src/components/menubar/menuItem.tsx +32 -0
- package/src/components/nodes/behave/Node.module.css +23 -0
- package/src/components/nodes/behave/Node.tsx +176 -0
- package/src/components/nodes/behave/NodeContainer.module.css +87 -0
- package/src/components/nodes/behave/NodeContainer.tsx +46 -0
- package/src/components/nodes/behave/index.tsx +14 -0
- package/src/components/nodes/comment/FormatToolbar.tsx +118 -0
- package/src/components/nodes/comment/comment.tsx +103 -0
- package/src/components/nodes/comment/styles.module.css +150 -0
- package/src/components/nodes/group/index.tsx +109 -0
- package/src/components/nodes/wrapper/index.tsx +73 -0
- package/src/components/nodes/wrapper/styles.module.css +113 -0
- package/src/components/notifications/NotificationProvider.tsx +81 -0
- package/src/components/notifications/index.ts +2 -0
- package/src/components/notifications/utils.ts +71 -0
- package/src/components/panels/alignment/index.module.css +20 -0
- package/src/components/panels/alignment/index.tsx +244 -0
- package/src/components/panels/base/index.tsx +5 -0
- package/src/components/panels/base/styles.module.css +12 -0
- package/src/components/panels/conversation/index.module.css +151 -0
- package/src/components/panels/conversation/index.tsx +162 -0
- package/src/components/panels/events/CustomEventsEditor.tsx +384 -0
- package/src/components/panels/events/EditEventPanel.tsx +315 -0
- package/src/components/panels/events/ManageEventsPanel.tsx +98 -0
- package/src/components/panels/events/index.tsx +23 -0
- package/src/components/panels/events/styles.module.css +236 -0
- package/src/components/panels/history/index.tsx +92 -0
- package/src/components/panels/history/styles.module.css +106 -0
- package/src/components/panels/keymaps/index.module.css +78 -0
- package/src/components/panels/keymaps/index.tsx +167 -0
- package/src/components/panels/layers/index.tsx +240 -0
- package/src/components/panels/layers/styles.module.css +110 -0
- package/src/components/panels/legend/index.module.css +6 -0
- package/src/components/panels/legend/index.tsx +76 -0
- package/src/components/panels/logs/index.module.css +212 -0
- package/src/components/panels/logs/index.tsx +288 -0
- package/src/components/panels/nodeInputs/InputControl.tsx +63 -0
- package/src/components/panels/nodeInputs/InputsGroup.tsx +64 -0
- package/src/components/panels/nodeInputs/MultipleNodesView.tsx +37 -0
- package/src/components/panels/nodeInputs/NodeSettings.tsx +92 -0
- package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +125 -0
- package/src/components/panels/nodeInputs/OutputsGroup.tsx +65 -0
- package/src/components/panels/nodeInputs/SocketGenerators.tsx +32 -0
- package/src/components/panels/nodeInputs/index.module.css +284 -0
- package/src/components/panels/nodeInputs/index.tsx +339 -0
- package/src/components/panels/nodeInputs/useNodeHandlers.ts +76 -0
- package/src/components/panels/nodeInputs/useNodeInputsData.ts +173 -0
- package/src/components/panels/nodePicker/index.tsx +115 -0
- package/src/components/panels/panel/index.module.css +66 -0
- package/src/components/panels/panel/index.tsx +88 -0
- package/src/components/panels/search/index.module.css +66 -0
- package/src/components/panels/search/index.tsx +215 -0
- package/src/components/panels/systemSettings/index.tsx +206 -0
- package/src/components/panels/systemSettings/styles.module.css +11 -0
- package/src/components/panels/traces/GridLines.tsx +38 -0
- package/src/components/panels/traces/TimeGrid.tsx +48 -0
- package/src/components/panels/traces/TraceLane.tsx +62 -0
- package/src/components/panels/traces/TraceTooltip.tsx +22 -0
- package/src/components/panels/traces/TracesHeader.tsx +56 -0
- package/src/components/panels/traces/index.module.css +166 -0
- package/src/components/panels/traces/index.tsx +294 -0
- package/src/components/panels/traces/types.ts +48 -0
- package/src/components/panels/traces/useDerivedSpans.ts +212 -0
- package/src/components/panels/traces/utils.ts +25 -0
- package/src/components/panels/variables/CreateVariableScreen.tsx +162 -0
- package/src/components/panels/variables/ManageVariablesScreen.tsx +144 -0
- package/src/components/panels/variables/index.tsx +125 -0
- package/src/components/panels/variables/styles.module.css +236 -0
- package/src/components/primitives/icon.module.css +45 -0
- package/src/components/primitives/icon.tsx +38 -0
- package/src/components/sockets/input/index.tsx +76 -0
- package/src/components/sockets/input/styles.module.css +27 -0
- package/src/components/sockets/output/index.tsx +61 -0
- package/src/components/sockets/output/styles.module.css +27 -0
- package/src/css/prosemirror.css +57 -0
- package/src/css/rc-dock.css +112 -0
- package/src/css/rc-menu.css +100 -0
- package/src/css/vars.css +14 -0
- package/src/css/vscode.css +13 -0
- package/src/entry.css +4 -0
- package/src/generators/CustomEventOnTriggeredGenerator.tsx +85 -0
- package/src/generators/SequenceGenerator.tsx +104 -0
- package/src/generators/SwitchOnIntegerGenerator.tsx +256 -0
- package/src/generators/SwitchOnStringGenerator.tsx +263 -0
- package/src/generators/registerDefaultGenerators.ts +34 -0
- package/src/hooks/useBehaveGraphFlow.ts +17 -16
- package/src/hooks/useDetachNodes.ts +39 -0
- package/src/hooks/useFlowHandlers.ts +115 -29
- package/src/hooks/useWasdPan.ts +188 -0
- package/src/index.css +146 -0
- package/src/index.ts +36 -18
- package/src/layout/dagre.tsx +119 -0
- package/src/layout/elk.ts +200 -0
- package/src/plugin/alignment/index.ts +81 -0
- package/src/plugin/docs/index.tsx +299 -0
- package/src/plugin/docs/panel/index.tsx +200 -0
- package/src/plugin/docs/panel/styles.module.css +174 -0
- package/src/plugin/graphrunner/actions.ts +253 -0
- package/src/plugin/graphrunner/buttons.tsx +87 -0
- package/src/plugin/graphrunner/client.ts +704 -0
- package/src/plugin/graphrunner/index.tsx +255 -0
- package/src/plugin/graphrunner/panel.tsx +386 -0
- package/src/plugin/graphrunner/runner.ts +358 -0
- package/src/plugin/graphrunner/session.ts +243 -0
- package/src/plugin/graphrunner/store.ts +206 -0
- package/src/plugin/graphrunner/styles.module.css +211 -0
- package/src/plugin/graphrunner/transport.ts +224 -0
- package/src/plugin/graphrunner/types.ts +672 -0
- package/src/plugin/graphrunner-local/execution-utils.ts +457 -0
- package/src/plugin/graphrunner-local/index.tsx +166 -0
- package/src/plugin/graphrunner-local/panel.tsx +231 -0
- package/src/plugin/graphrunner-local/store.ts +41 -0
- package/src/plugin/graphrunner-local/styles.module.css +101 -0
- package/src/plugin/graphrunner-local/transport.ts +1372 -0
- package/src/plugin/graphrunner-local/types.ts +10 -0
- package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +633 -0
- package/src/plugin/graphrunner-webworker/index.tsx +146 -0
- package/src/plugin/graphrunner-webworker/panel.tsx +173 -0
- package/src/plugin/graphrunner-webworker/store.ts +89 -0
- package/src/plugin/graphrunner-webworker/types.ts +17 -0
- package/src/plugin/graphrunner-webworker/worker-transport.ts +123 -0
- package/src/plugin/realtime/realtimeRunner.ts +570 -0
- package/src/specifics/CustomEventOnTriggeredSpecific.tsx +92 -0
- package/src/specifics/CustomEventTriggerSpecific.tsx +141 -0
- package/src/specifics/VariableGetSpecific.tsx +110 -0
- package/src/specifics/VariableSetSpecific.tsx +110 -0
- package/src/specifics/registerDefaultSpecifics.ts +5 -0
- package/src/store/actions.tsx +698 -0
- package/src/store/chat.ts +73 -0
- package/src/store/controls.tsx +62 -0
- package/src/store/documentation.tsx +69 -0
- package/src/store/events.tsx +116 -0
- package/src/store/flow.tsx +245 -0
- package/src/store/graphRunnerClient.ts +110 -0
- package/src/store/hotKeys.tsx +323 -0
- package/src/store/layers.ts +259 -0
- package/src/store/legend.tsx +76 -0
- package/src/store/logs.ts +28 -0
- package/src/store/menubar.ts +41 -0
- package/src/store/refs.ts +84 -0
- package/src/store/registry.ts +43 -0
- package/src/store/selection.ts +22 -0
- package/src/store/settings.ts +99 -0
- package/src/store/socketGenerator.tsx +54 -0
- package/src/store/specific.tsx +75 -0
- package/src/store/specs.tsx +35 -0
- package/src/store/tabs.ts +278 -0
- package/src/store/toolbar.tsx +45 -0
- package/src/store/traces.ts +240 -0
- package/src/store/variables.ts +37 -0
- package/src/system/graph.ts +134 -0
- package/src/system/index.ts +3 -0
- package/src/system/notifications.ts +98 -0
- package/src/system/plugin.ts +27 -0
- package/src/system/provider.tsx +22 -0
- package/src/system/pubsub.ts +323 -0
- package/src/system/system.ts +223 -0
- package/src/system/tabLoader.tsx +265 -0
- package/src/system/undoRedo.ts +103 -0
- package/src/transformers/Uigraph.ts +60 -0
- package/src/transformers/behaveToFlow.ts +16 -4
- package/src/transformers/flowToBehave.ts +32 -12
- package/src/types/NodeMetadata.ts +27 -0
- package/src/types/graph.ts +49 -0
- package/src/types/nodes.ts +45 -0
- package/src/types.ts +16 -0
- package/src/util/colors.ts +1 -29
- package/src/util/downloadJson.ts +18 -0
- package/src/util/extractNodeMetadata.ts +16 -0
- package/src/util/getPickerFilters.ts +1 -1
- package/src/util/isBehaveNode.ts +6 -0
- package/src/util/isValidConnection.ts +28 -15
- package/src/util/mergeSockets.ts +29 -0
- package/src/util/serializeVariables.ts +66 -0
- package/src/util/sockets.ts +43 -0
- package/stories/apex/layoutController/example-graph.worker.ts +39 -0
- package/stories/apex/layoutController/index.stories.tsx +48 -0
- package/stories/apex/layoutController/webworker.stories.tsx +103 -0
- package/stories/apex/menubar/menubar.stories.tsx +19 -0
- package/stories/components/colorpicker/index.stories.tsx +20 -0
- package/stories/components/contextMenus/edge.stories.tsx +32 -0
- package/stories/components/contextMenus/node.stories.tsx +26 -0
- package/stories/components/contextMenus/nodePicker.stories.tsx +115 -0
- package/stories/components/controls/any/index.stories.tsx +19 -0
- package/stories/components/controls/boolean/index.stories.tsx +19 -0
- package/stories/components/controls/colorPicker/index.stories.tsx +49 -0
- package/stories/components/controls/number/index.stories.tsx +19 -0
- package/stories/components/controls/string/index.stories.tsx +19 -0
- package/stories/components/nodes/behaveNode.stories.tsx +108 -0
- package/stories/components/nodes/comment.stories.tsx +106 -0
- package/stories/components/panels/alignment.stories.tsx +24 -0
- package/stories/components/panels/events.stories.tsx +38 -0
- package/stories/components/panels/graphRunner.stories.tsx +317 -0
- package/stories/components/panels/history.stories.tsx +37 -0
- package/stories/components/panels/keymaps.stories.tsx +21 -0
- package/stories/components/panels/legend.stories.tsx +37 -0
- package/stories/components/panels/logs.stories.tsx +24 -0
- package/stories/components/panels/nodeInputs.stories.tsx +21 -0
- package/stories/components/panels/nodePicker.stories.tsx +37 -0
- package/stories/components/panels/panel.stories.tsx +39 -0
- package/stories/components/panels/search.stories.tsx +24 -0
- package/stories/components/panels/systemSettings.stories.tsx +26 -0
- package/stories/components/panels/traces.stories.tsx +225 -0
- package/stories/components/panels/variables.stories.tsx +24 -0
- package/stories/defaults/defaultStoryProvider.tsx +167 -0
- package/stories/defaults/systemGenerator.ts +38 -0
- package/tests/components/edges/offsetBezier.test.ts +51 -0
- package/tests/components/layoutController/utils.test.ts +68 -0
- package/tests/components/panels/traces/utils.test.ts +52 -0
- package/tests/flowToBehave.test.ts +26 -4
- package/tests/notifications.test.ts +87 -0
- package/tests/saveLoad.test.ts +372 -0
- package/tests/util/calculateNewEdge.test.ts +98 -0
- package/tests/util/getSocketsByNodeTypeAndHandleType.test.ts +31 -0
- package/tests/util/hasPositionMetaData.test.ts +33 -0
- package/tests/util/isBehaveNode.test.ts +22 -0
- package/tests/util/isHandleConnected.test.ts +37 -0
- package/tests/util/mergeSockets.test.ts +43 -0
- package/tests/visual/README.md +64 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-alignment-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-conversation-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-events-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-history-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-keymaps-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-layers-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-legend-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-logs-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodeInputs-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodePicker-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-panel-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-search-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-systemSettings-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-traces-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-variables-chromium-win32.png +0 -0
- package/tests/visual/panels.visual.test.tsx +76 -0
- package/tsconfig.base.json +39 -0
- package/tsconfig.json +18 -59
- package/tsconfig.prod.json +23 -0
- package/tsdown.config.ts +15 -3
- package/typedoc.json +7 -7
- package/vite.config.js +7 -0
- package/vitest.config.ts +5 -2
- package/vitest.visual.config.ts +48 -0
- package/src/components/AutoSizeInput.tsx +0 -65
- package/src/components/Controls.tsx +0 -87
- package/src/components/InputSocket.tsx +0 -142
- package/src/components/Node.tsx +0 -68
- package/src/components/NodeContainer.tsx +0 -46
- package/src/components/NodePicker.tsx +0 -77
- package/src/components/OutputSocket.tsx +0 -58
- package/src/components/modals/ClearModal.tsx +0 -40
- package/src/components/modals/HelpModal.tsx +0 -36
- package/src/components/modals/LoadModal.tsx +0 -96
- package/src/components/modals/Modal.tsx +0 -64
- package/src/components/modals/SaveModal.tsx +0 -60
- package/src/hooks/useCustomNodeTypes.tsx +0 -31
- package/src/hooks/useGraphRunner.ts +0 -104
- package/src/hooks/useMergeMap.ts +0 -14
- package/src/hooks/useNodeSpecJson.ts +0 -20
- package/src/hooks/useQueriableDefinitions.ts +0 -22
- package/src/styles.css +0 -8
- package/tailwind.config.ts +0 -19
- package/tests/tsconfig.json +0 -10
- /package/src/{types.d.ts → types-declarations.d.ts} +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { VscodeDivider, VscodeTextarea } from '@vscode-elements/react-elements';
|
|
3
|
+
import { description } from '@/annotations';
|
|
4
|
+
import type { IBehaveNode } from '@/types/nodes.js';
|
|
5
|
+
import styles from './index.module.css';
|
|
6
|
+
|
|
7
|
+
interface NodeSettingsProps {
|
|
8
|
+
selectedNode: IBehaveNode;
|
|
9
|
+
onSave: (annotationKey: string, value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const NodeSettings: React.FC<NodeSettingsProps> = ({
|
|
13
|
+
selectedNode,
|
|
14
|
+
onSave
|
|
15
|
+
}) => {
|
|
16
|
+
const annotations = selectedNode.data?.annotations;
|
|
17
|
+
const currentDescription = annotations?.[description] ?? '';
|
|
18
|
+
const [descriptionDraft, setDescriptionDraft] = useState(currentDescription);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setDescriptionDraft(currentDescription);
|
|
22
|
+
}, [currentDescription]);
|
|
23
|
+
|
|
24
|
+
const handleSaveDescription = (rawDescription: string) => {
|
|
25
|
+
onSave(description, rawDescription);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={styles.stackGap2}>
|
|
30
|
+
<div className={styles.stackGap2Padded}>
|
|
31
|
+
<div className={styles.settingsRow}>
|
|
32
|
+
<div>Type</div>
|
|
33
|
+
<div>{selectedNode.data.type}</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div className={styles.settingsRow}>
|
|
36
|
+
<div>ID</div>
|
|
37
|
+
<div>{selectedNode.id}</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<VscodeDivider />
|
|
41
|
+
|
|
42
|
+
<div className={styles.descriptionSection}>
|
|
43
|
+
<div className={styles.descriptionTitle}>Description</div>
|
|
44
|
+
<VscodeTextarea
|
|
45
|
+
placeholder="No description provided."
|
|
46
|
+
className={styles.descriptionTextarea}
|
|
47
|
+
value={descriptionDraft}
|
|
48
|
+
onInput={(e: any) => setDescriptionDraft(e?.target?.value ?? '')}
|
|
49
|
+
onBlur={() => {
|
|
50
|
+
handleSaveDescription(descriptionDraft);
|
|
51
|
+
}}
|
|
52
|
+
onKeyDown={(e: any) => {
|
|
53
|
+
if (e?.key === 'Escape') {
|
|
54
|
+
e?.preventDefault?.();
|
|
55
|
+
setDescriptionDraft('');
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
58
|
+
rows={4}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<VscodeDivider />
|
|
63
|
+
|
|
64
|
+
<div className={styles.annotationsSection}>
|
|
65
|
+
<div className={styles.annotationsTitle}>Annotations</div>
|
|
66
|
+
{annotations == null ? (
|
|
67
|
+
<div className={styles.annotationsEmpty}>No annotations.</div>
|
|
68
|
+
) : typeof annotations === 'string' ||
|
|
69
|
+
typeof annotations === 'number' ||
|
|
70
|
+
typeof annotations === 'boolean' ? (
|
|
71
|
+
<div className={styles.annotationsValue}>{String(annotations)}</div>
|
|
72
|
+
) : Array.isArray(annotations) &&
|
|
73
|
+
annotations.every(
|
|
74
|
+
(x) => typeof x === 'string' || typeof x === 'number'
|
|
75
|
+
) ? (
|
|
76
|
+
<ul className={styles.annotationsList}>
|
|
77
|
+
{annotations.map((x, i) => (
|
|
78
|
+
<li key={i} className={styles.annotationsListItem}>
|
|
79
|
+
{String(x)}
|
|
80
|
+
</li>
|
|
81
|
+
))}
|
|
82
|
+
</ul>
|
|
83
|
+
) : (
|
|
84
|
+
<pre className={styles.annotationsPre}>
|
|
85
|
+
{JSON.stringify(annotations, null, 2)}
|
|
86
|
+
</pre>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { VscodeTextfield } from '@vscode-elements/react-elements';
|
|
3
|
+
import { InfoCircle } from 'iconoir-react';
|
|
4
|
+
import { annotatedTitle } from '@/annotations';
|
|
5
|
+
import type { IBehaveNode } from '@/types/nodes.js';
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
interface NodeTitleEditorProps {
|
|
9
|
+
selectedNode: IBehaveNode;
|
|
10
|
+
nodeLabel: string;
|
|
11
|
+
onSave: (annotationKey: string, value: string) => void;
|
|
12
|
+
nodeType?: string;
|
|
13
|
+
nodeIcon?: React.ReactNode;
|
|
14
|
+
hasDocumentation?: boolean;
|
|
15
|
+
onShowDocumentation?: (nodeType: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const NodeTitleEditor: React.FC<NodeTitleEditorProps> = ({
|
|
19
|
+
selectedNode,
|
|
20
|
+
nodeLabel,
|
|
21
|
+
onSave,
|
|
22
|
+
nodeType,
|
|
23
|
+
nodeIcon,
|
|
24
|
+
hasDocumentation,
|
|
25
|
+
onShowDocumentation
|
|
26
|
+
}) => {
|
|
27
|
+
const [isEditingTitle, setIsEditingTitle] = useState(false);
|
|
28
|
+
const [titleDraft, setTitleDraft] = useState('');
|
|
29
|
+
|
|
30
|
+
const annotations = (selectedNode as any)?.data?.annotations;
|
|
31
|
+
|
|
32
|
+
const annotationTitle = React.useMemo(() => {
|
|
33
|
+
if (
|
|
34
|
+
!annotations ||
|
|
35
|
+
typeof annotations !== 'object' ||
|
|
36
|
+
Array.isArray(annotations)
|
|
37
|
+
)
|
|
38
|
+
return undefined;
|
|
39
|
+
const title = annotations?.[annotatedTitle];
|
|
40
|
+
return typeof title === 'string' ? title : undefined;
|
|
41
|
+
}, [annotations]);
|
|
42
|
+
|
|
43
|
+
const displayedTitle = React.useMemo(() => {
|
|
44
|
+
const trimmed = annotationTitle?.trim();
|
|
45
|
+
return trimmed ? trimmed : nodeLabel;
|
|
46
|
+
}, [annotationTitle, nodeLabel]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setIsEditingTitle(false);
|
|
50
|
+
setTitleDraft('');
|
|
51
|
+
}, [selectedNode.id]);
|
|
52
|
+
|
|
53
|
+
const handleSaveTitle = (rawTitle: string) => {
|
|
54
|
+
onSave(annotatedTitle, rawTitle);
|
|
55
|
+
setIsEditingTitle(false);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleShowDocs = useCallback(
|
|
59
|
+
(e: React.MouseEvent) => {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
if (onShowDocumentation && nodeType) {
|
|
62
|
+
onShowDocumentation(nodeType);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[onShowDocumentation, nodeType]
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (!isEditingTitle) {
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<div className={styles.panelTitleContainer}>
|
|
72
|
+
{nodeIcon && <div className={styles.nodeTitleIcon}>{nodeIcon}</div>}
|
|
73
|
+
<div
|
|
74
|
+
className={styles.panelTitle}
|
|
75
|
+
onDoubleClick={() => {
|
|
76
|
+
setTitleDraft(displayedTitle);
|
|
77
|
+
setIsEditingTitle(true);
|
|
78
|
+
}}
|
|
79
|
+
title="Double-click to rename"
|
|
80
|
+
>
|
|
81
|
+
{displayedTitle}
|
|
82
|
+
</div>
|
|
83
|
+
{hasDocumentation && onShowDocumentation && (
|
|
84
|
+
<button
|
|
85
|
+
className={styles.infoButton}
|
|
86
|
+
onClick={handleShowDocs}
|
|
87
|
+
title="Show documentation"
|
|
88
|
+
>
|
|
89
|
+
<InfoCircle />
|
|
90
|
+
</button>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
<div className={styles.panelId}>{selectedNode.id}</div>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
<div className={styles.panelTitleEdit}>
|
|
101
|
+
<VscodeTextfield
|
|
102
|
+
className={styles.panelTitleTextfield}
|
|
103
|
+
value={titleDraft}
|
|
104
|
+
onInput={(e: any) => setTitleDraft(e?.target?.value ?? '')}
|
|
105
|
+
onBlur={() => {
|
|
106
|
+
handleSaveTitle(titleDraft);
|
|
107
|
+
}}
|
|
108
|
+
onKeyDown={(e: any) => {
|
|
109
|
+
if (e?.key === 'Enter') {
|
|
110
|
+
e?.preventDefault?.();
|
|
111
|
+
handleSaveTitle(titleDraft);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (e?.key === 'Escape') {
|
|
115
|
+
e?.preventDefault?.();
|
|
116
|
+
setIsEditingTitle(false);
|
|
117
|
+
setTitleDraft('');
|
|
118
|
+
}
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
<div className={styles.panelId}>{selectedNode.id}</div>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './index.module.css';
|
|
3
|
+
import { EyeClosed, EyeSolid } from 'iconoir-react';
|
|
4
|
+
import { Icon } from '@/components/primitives/icon';
|
|
5
|
+
|
|
6
|
+
export interface OutputItem {
|
|
7
|
+
name: string;
|
|
8
|
+
valueType: string;
|
|
9
|
+
connected: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface OutputsGroupProps {
|
|
13
|
+
outputs: OutputItem[];
|
|
14
|
+
hiddenOutputs?: Record<string, boolean>;
|
|
15
|
+
onToggleOutput?: (outputName: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const OutputsGroup: React.FC<OutputsGroupProps> = ({
|
|
19
|
+
outputs,
|
|
20
|
+
hiddenOutputs = {},
|
|
21
|
+
onToggleOutput
|
|
22
|
+
}) => {
|
|
23
|
+
if (outputs.length === 0) return null;
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.stackColPadded}>
|
|
26
|
+
{outputs.map((output) => {
|
|
27
|
+
const isHidden = hiddenOutputs[output.name] ?? false;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div key={output.name} className={styles.inputWithToggle}>
|
|
31
|
+
{onToggleOutput && (
|
|
32
|
+
<Icon
|
|
33
|
+
onClick={() => onToggleOutput(output.name)}
|
|
34
|
+
title={isHidden ? 'Show output on node' : 'Hide output on node'}
|
|
35
|
+
>
|
|
36
|
+
{isHidden ? <EyeClosed /> : <EyeSolid />}
|
|
37
|
+
</Icon>
|
|
38
|
+
)}
|
|
39
|
+
<div className={styles.inputControlWrapper}>
|
|
40
|
+
<div className={styles.inputRow}>
|
|
41
|
+
<div className={styles.inputMeta}>
|
|
42
|
+
<div className={styles.inputName} title={output.valueType}>
|
|
43
|
+
{output.name}
|
|
44
|
+
</div>
|
|
45
|
+
<div className={styles.inputSubtext}>
|
|
46
|
+
{output.connected ? 'Connected' : output.valueType}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
{output.connected ? (
|
|
51
|
+
<div className={styles.connectedMessage}>
|
|
52
|
+
Socket is connected
|
|
53
|
+
</div>
|
|
54
|
+
) : (
|
|
55
|
+
<div className={styles.connectedMessage}>Not connected</div>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
})}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VscodeCollapsible } from '@vscode-elements/react-elements';
|
|
3
|
+
import type {
|
|
4
|
+
SocketGenerator,
|
|
5
|
+
SocketGeneratorNode
|
|
6
|
+
} from '@/store/socketGenerator';
|
|
7
|
+
import styles from './index.module.css';
|
|
8
|
+
|
|
9
|
+
interface SocketGeneratorsProps {
|
|
10
|
+
generators: SocketGenerator[];
|
|
11
|
+
generatorNode: SocketGeneratorNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SocketGenerators: React.FC<SocketGeneratorsProps> = ({
|
|
15
|
+
generators,
|
|
16
|
+
generatorNode
|
|
17
|
+
}) => {
|
|
18
|
+
if (generators.length === 0) return null;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<VscodeCollapsible title="Socket Generator" open>
|
|
22
|
+
<div className={styles.stackColPadded}>
|
|
23
|
+
{generators.map((generator) => {
|
|
24
|
+
const GeneratorRenderer = generator.render;
|
|
25
|
+
return (
|
|
26
|
+
<GeneratorRenderer key={generator.name} node={generatorNode} />
|
|
27
|
+
);
|
|
28
|
+
})}
|
|
29
|
+
</div>
|
|
30
|
+
</VscodeCollapsible>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
.panel {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1 1 0%;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 0.5rem;
|
|
6
|
+
height: 100%;
|
|
7
|
+
padding: 0.5rem;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.panelScrollable {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex: 1 1 0%;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 0.5rem;
|
|
15
|
+
height: 100%;
|
|
16
|
+
margin-bottom: 0.25rem;
|
|
17
|
+
overflow: auto;
|
|
18
|
+
padding: 0.5rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.listGap1 {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 0.25rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.stackGap2 {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: 0.5rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.stackCol {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cardPadding {
|
|
39
|
+
padding: 0.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sectionTitle {
|
|
43
|
+
font-size: 1.05em;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nodeCard {
|
|
48
|
+
padding: 0.5rem;
|
|
49
|
+
border: 1px solid var(--color-neutral-stroke-subtle);
|
|
50
|
+
border-radius: var(--component-spacing-xs);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nodeCardTitle {
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
font-size: 0.9em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nodeCardMeta {
|
|
59
|
+
font-size: 0.8em;
|
|
60
|
+
opacity: 0.7;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.emptyState {
|
|
64
|
+
font-size: 0.9em;
|
|
65
|
+
font-style: italic;
|
|
66
|
+
opacity: 0.7;
|
|
67
|
+
text-align: center;
|
|
68
|
+
padding: 2rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.panelTitle {
|
|
72
|
+
font-size: 1.05em;
|
|
73
|
+
text-align: center;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
cursor: text;
|
|
76
|
+
flex: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.panelTitleContainer {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
gap: 0.5rem;
|
|
84
|
+
position: relative;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nodeTitleIcon {
|
|
88
|
+
width: 20px;
|
|
89
|
+
height: 20px;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
opacity: 0.8;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.nodeTitleIcon svg,
|
|
98
|
+
.nodeTitleIcon img {
|
|
99
|
+
width: 18px;
|
|
100
|
+
height: 18px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.infoButton {
|
|
104
|
+
opacity: 0.5;
|
|
105
|
+
transition: opacity 0.2s;
|
|
106
|
+
padding: 0.25rem;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
border-radius: 0.25rem;
|
|
112
|
+
background: transparent;
|
|
113
|
+
border: none;
|
|
114
|
+
color: var(--colors-fg);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.infoButton:hover {
|
|
118
|
+
background: var(--vscode-button-secondaryBackground, #313131);
|
|
119
|
+
opacity: 1 !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.infoButton svg {
|
|
123
|
+
width: 16px;
|
|
124
|
+
height: 16px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.panelTitleEdit {
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.panelTitleTextfield {
|
|
133
|
+
width: 100%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.tabs {
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.panelId {
|
|
141
|
+
font-size: 0.6em;
|
|
142
|
+
opacity: 0.5;
|
|
143
|
+
text-align: center;
|
|
144
|
+
font-weight: 400;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.toolbar {
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.noInputs {
|
|
152
|
+
font-size: 0.9em;
|
|
153
|
+
font-style: italic;
|
|
154
|
+
opacity: 0.7;
|
|
155
|
+
padding: 0.75rem;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.stackColPadded {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
padding: 0.2em;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.inputRow {
|
|
165
|
+
display: grid;
|
|
166
|
+
grid-template-columns: minmax(120px, 1fr) minmax(160px, 1fr);
|
|
167
|
+
align-items: center;
|
|
168
|
+
gap: 0.4em;
|
|
169
|
+
padding: 0.2em;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.inputMeta {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
gap: 2px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.inputName {
|
|
179
|
+
font-size: 0.9em;
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
text-transform: capitalize;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.inputSubtext {
|
|
185
|
+
font-size: 0.75em;
|
|
186
|
+
opacity: 0.7;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.connectedMessage {
|
|
190
|
+
font-size: 0.85em;
|
|
191
|
+
font-style: italic;
|
|
192
|
+
opacity: 0.7;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.stackGap2Padded {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
gap: 0.5rem;
|
|
199
|
+
padding: 0.2em;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.settingsRow {
|
|
203
|
+
display: flex;
|
|
204
|
+
justify-content: space-between;
|
|
205
|
+
gap: 0.4em;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.annotationsSection {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
gap: 0.2em;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.annotationsTitle {
|
|
215
|
+
font-size: 0.95em;
|
|
216
|
+
font-weight: 600;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.annotationsEmpty {
|
|
220
|
+
font-size: 0.85em;
|
|
221
|
+
font-style: italic;
|
|
222
|
+
opacity: 0.7;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.annotationsValue {
|
|
226
|
+
font-size: 0.85em;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.annotationsList {
|
|
230
|
+
margin: 0;
|
|
231
|
+
padding-left: 1.25rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.annotationsListItem {
|
|
235
|
+
font-size: 0.85em;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.annotationsPre {
|
|
239
|
+
margin: 0;
|
|
240
|
+
padding: 0.2em;
|
|
241
|
+
border: 1px solid var(--color-neutral-stroke-subtle);
|
|
242
|
+
border-radius: 0.2em;
|
|
243
|
+
background: var(--color-neutral-background-strong);
|
|
244
|
+
font-size: 0.8em;
|
|
245
|
+
overflow: auto;
|
|
246
|
+
white-space: pre-wrap;
|
|
247
|
+
word-break: break-word;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.panelHeader {
|
|
251
|
+
display: flex;
|
|
252
|
+
justify-content: flex-end;
|
|
253
|
+
padding: 0.25rem 0.5rem;
|
|
254
|
+
border-bottom: 1px solid var(--color-neutral-stroke-subtle);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
.inputWithToggle {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: flex-start;
|
|
262
|
+
gap: 0.25rem;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.visibilityToggle {
|
|
266
|
+
background: transparent;
|
|
267
|
+
border: none;
|
|
268
|
+
cursor: pointer;
|
|
269
|
+
padding: 0.25rem;
|
|
270
|
+
font-size: 0.85em;
|
|
271
|
+
opacity: 0.5;
|
|
272
|
+
transition: opacity 0.2s;
|
|
273
|
+
flex-shrink: 0;
|
|
274
|
+
margin-top: 0.2em;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.visibilityToggle:hover {
|
|
278
|
+
opacity: 1;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.inputControlWrapper {
|
|
282
|
+
flex: 1;
|
|
283
|
+
min-width: 0;
|
|
284
|
+
}
|