@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,176 @@
|
|
|
1
|
+
import type { NodeSpecJSON } from '@kiberon-labs/behave-graph';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { useEdges, type NodeProps } from 'reactflow';
|
|
4
|
+
import { useStore } from 'zustand';
|
|
5
|
+
import { useChangeNodeData } from '../../../hooks/useChangeNodeData.js';
|
|
6
|
+
import { isHandleConnected } from '../../../util/isHandleConnected.js';
|
|
7
|
+
import InputSocket from '../../sockets/input/index.js';
|
|
8
|
+
import NodeContainer from './NodeContainer.js';
|
|
9
|
+
import OutputSocket from '../../sockets/output/index.js';
|
|
10
|
+
import { configureSockets } from '@/util/sockets.js';
|
|
11
|
+
import { BaseNodeWrapper } from '../wrapper/index.js';
|
|
12
|
+
import { useSystem } from '@/system/provider.js';
|
|
13
|
+
import type { SpecificNode } from '@/store/specific';
|
|
14
|
+
import type { SocketGeneratorNode } from '@/store/socketGenerator';
|
|
15
|
+
import styles from './Node.module.css';
|
|
16
|
+
import type { IBehaveNode } from '@/types/nodes.js';
|
|
17
|
+
|
|
18
|
+
export type BehaveNodeProps = NodeProps<IBehaveNode['data']> & {
|
|
19
|
+
spec: NodeSpecJSON;
|
|
20
|
+
allSpecs: NodeSpecJSON[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Node = ({
|
|
24
|
+
id,
|
|
25
|
+
data,
|
|
26
|
+
spec,
|
|
27
|
+
selected,
|
|
28
|
+
allSpecs
|
|
29
|
+
}: BehaveNodeProps) => {
|
|
30
|
+
const system = useSystem();
|
|
31
|
+
const edges = useEdges();
|
|
32
|
+
const handleChange = useChangeNodeData(id);
|
|
33
|
+
const [socketsVisible, _setSocketsVisible] = useState(true);
|
|
34
|
+
const specifics = useStore(system.specificStore, (s) => s.specifics);
|
|
35
|
+
const titleBarActions = useStore(
|
|
36
|
+
system.specificStore,
|
|
37
|
+
(s) => s.titleBarActions
|
|
38
|
+
);
|
|
39
|
+
const generators = useStore(system.socketGeneratorStore, (s) => s.generators);
|
|
40
|
+
const generatorLocation = useStore(
|
|
41
|
+
system.systemSettings,
|
|
42
|
+
(s) => s.generatorLocation
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Early return if spec is not available yet
|
|
46
|
+
if (!spec) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { pairs, valueInputs } = useMemo(
|
|
51
|
+
() => configureSockets(data.configuration, spec, data.dynamicPorts),
|
|
52
|
+
[data.configuration, spec, data.dynamicPorts]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const matchingSpecifics = useMemo(() => {
|
|
56
|
+
if (!spec) return [];
|
|
57
|
+
return specifics.filter((x) => x.check(spec));
|
|
58
|
+
}, [spec, specifics]);
|
|
59
|
+
|
|
60
|
+
const matchingGenerators = useMemo(() => {
|
|
61
|
+
if (!spec || generatorLocation !== 'inline') return [];
|
|
62
|
+
return generators.filter((x) => x.check(spec));
|
|
63
|
+
}, [spec, generators, generatorLocation]);
|
|
64
|
+
|
|
65
|
+
const specificNode: SpecificNode = useMemo(
|
|
66
|
+
() => ({
|
|
67
|
+
id,
|
|
68
|
+
data,
|
|
69
|
+
spec,
|
|
70
|
+
selected: !!selected
|
|
71
|
+
}),
|
|
72
|
+
[data, id, selected, spec]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const generatorNode: SocketGeneratorNode = useMemo(
|
|
76
|
+
() => ({
|
|
77
|
+
id,
|
|
78
|
+
data,
|
|
79
|
+
spec,
|
|
80
|
+
selected: !!selected
|
|
81
|
+
}),
|
|
82
|
+
[data, id, selected, spec]
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const hiddenInputs = useMemo(() => {
|
|
86
|
+
return data.annotations?.hiddenInputs ?? {};
|
|
87
|
+
}, [data.annotations]);
|
|
88
|
+
|
|
89
|
+
const hiddenOutputs = useMemo(() => {
|
|
90
|
+
return data.annotations?.hiddenOutputs ?? {};
|
|
91
|
+
}, [data.annotations]);
|
|
92
|
+
|
|
93
|
+
const shouldShowInput = (inputName: string) => {
|
|
94
|
+
const isConnected = isHandleConnected(edges, id, inputName, 'target');
|
|
95
|
+
const isHidden = hiddenInputs[inputName] ?? false;
|
|
96
|
+
return !isHidden || isConnected;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const shouldShowOutput = (outputName: string) => {
|
|
100
|
+
const isConnected = isHandleConnected(edges, id, outputName, 'source');
|
|
101
|
+
const isHidden = hiddenOutputs[outputName] ?? false;
|
|
102
|
+
return !isHidden || isConnected;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<BaseNodeWrapper metadata={data.annotations}>
|
|
107
|
+
<NodeContainer
|
|
108
|
+
title={spec.label}
|
|
109
|
+
category={spec.category}
|
|
110
|
+
selected={selected}
|
|
111
|
+
titleBarActions={titleBarActions[spec.type]}
|
|
112
|
+
>
|
|
113
|
+
{pairs.map(([input, output], ix) => {
|
|
114
|
+
const showInput = !input || shouldShowInput(input.name);
|
|
115
|
+
const showOutput = !output || shouldShowOutput(output.name);
|
|
116
|
+
if (!showInput && !showOutput) return null;
|
|
117
|
+
return (
|
|
118
|
+
<div key={ix} className={styles.pairRow}>
|
|
119
|
+
{input && (
|
|
120
|
+
<InputSocket
|
|
121
|
+
{...input}
|
|
122
|
+
hide={!showInput}
|
|
123
|
+
specJSON={allSpecs}
|
|
124
|
+
value={input.defaultValue}
|
|
125
|
+
onChange={handleChange}
|
|
126
|
+
connected={isHandleConnected(edges, id, input.name, 'target')}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
{output && (
|
|
130
|
+
<OutputSocket
|
|
131
|
+
{...output}
|
|
132
|
+
hide={!showOutput}
|
|
133
|
+
specJSON={allSpecs}
|
|
134
|
+
connected={isHandleConnected(
|
|
135
|
+
edges,
|
|
136
|
+
id,
|
|
137
|
+
output.name,
|
|
138
|
+
'source'
|
|
139
|
+
)}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
})}
|
|
145
|
+
{valueInputs.map((input, ix) => {
|
|
146
|
+
if (!shouldShowInput(input.name)) return null;
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div key={`valueInput-${ix}`} className={styles.valueInputRow}>
|
|
150
|
+
<InputSocket
|
|
151
|
+
{...input}
|
|
152
|
+
specJSON={allSpecs}
|
|
153
|
+
hide={!socketsVisible}
|
|
154
|
+
value={input.defaultValue}
|
|
155
|
+
onChange={handleChange}
|
|
156
|
+
connected={isHandleConnected(edges, id, input.name, 'target')}
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
})}
|
|
161
|
+
|
|
162
|
+
{matchingGenerators.map((generator) => {
|
|
163
|
+
const GeneratorRenderer = generator.render;
|
|
164
|
+
return (
|
|
165
|
+
<GeneratorRenderer key={generator.name} node={generatorNode} />
|
|
166
|
+
);
|
|
167
|
+
})}
|
|
168
|
+
|
|
169
|
+
{matchingSpecifics.map((specific) => {
|
|
170
|
+
const SpecificRenderer = specific.render;
|
|
171
|
+
return <SpecificRenderer key={specific.name} node={specificNode} />;
|
|
172
|
+
})}
|
|
173
|
+
</NodeContainer>
|
|
174
|
+
</BaseNodeWrapper>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
min-width: 120px;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
|
|
5
|
+
color: var(--vscode-editorWidget-foreground, var(--vscode-foreground));
|
|
6
|
+
font-size: 0.8125rem;
|
|
7
|
+
background-color: #2b2b2b;
|
|
8
|
+
|
|
9
|
+
border: 1px solid var(--vscode-editorWidget-border, var(--vscode-input-border, rgba(128, 128, 128, 0.35)));
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
|
|
12
|
+
--node-accent: var(--vscode-focusBorder, #0078d4);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.selected {
|
|
16
|
+
box-shadow: 0 0 0 1px var(--vscode-focusBorder, #0078d4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.header {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
min-height: 24px;
|
|
23
|
+
|
|
24
|
+
padding: 4px 8px;
|
|
25
|
+
|
|
26
|
+
background-color: var(--vscode-sideBarSectionHeader-background, var(--vscode-editorWidget-background, var(--vscode-editor-background)));
|
|
27
|
+
border-bottom: 1px solid var(--vscode-editorWidget-border, var(--vscode-input-border, rgba(128, 128, 128, 0.35)));
|
|
28
|
+
|
|
29
|
+
border-top-left-radius: 4px;
|
|
30
|
+
border-top-right-radius: 4px;
|
|
31
|
+
|
|
32
|
+
border-left: 5px solid var(--node-accent);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.title {
|
|
36
|
+
flex: 1 1 auto;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
letter-spacing: 0.01em;
|
|
40
|
+
color: var(--vscode-foreground);
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.actions {
|
|
47
|
+
flex: 0 0 auto;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 4px;
|
|
51
|
+
margin-left: 5em;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.content {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
padding-top: 6px;
|
|
58
|
+
padding-bottom: 6px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.red {
|
|
62
|
+
--node-accent: #d16969;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.green {
|
|
66
|
+
--node-accent: #89d185;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.lime {
|
|
70
|
+
--node-accent: #b5cea8;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.purple {
|
|
74
|
+
--node-accent: #c586c0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.blue {
|
|
78
|
+
--node-accent: #4fc1ff;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.gray {
|
|
82
|
+
--node-accent: var(--vscode-descriptionForeground, #cccccc);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.white {
|
|
86
|
+
--node-accent: var(--vscode-foreground, #cccccc);
|
|
87
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NodeCategory, type NodeSpecJSON } from '@kiberon-labs/behave-graph';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import React, { type PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
import { categoryColorMap } from '../../../util/colors.js';
|
|
6
|
+
|
|
7
|
+
import styles from './NodeContainer.module.css';
|
|
8
|
+
|
|
9
|
+
type NodeProps = {
|
|
10
|
+
title: string;
|
|
11
|
+
category?: NodeSpecJSON['category'];
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
titleBarActions?: React.ReactElement;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const NodeContainer: React.FC<PropsWithChildren<NodeProps>> = ({
|
|
17
|
+
title,
|
|
18
|
+
category = NodeCategory.None,
|
|
19
|
+
selected,
|
|
20
|
+
titleBarActions,
|
|
21
|
+
children
|
|
22
|
+
}) => {
|
|
23
|
+
let colorName = categoryColorMap[category];
|
|
24
|
+
if (colorName === undefined) {
|
|
25
|
+
colorName = 'red';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const colorClass = styles[colorName];
|
|
29
|
+
const hasActions = Boolean(titleBarActions);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
className={cx(styles.container, colorClass, selected && styles.selected)}
|
|
34
|
+
>
|
|
35
|
+
<div className={styles.header}>
|
|
36
|
+
<div className={styles.title}>{title}</div>
|
|
37
|
+
{hasActions && (
|
|
38
|
+
<div className={cx(styles.actions, 'nodrag')}>{titleBarActions}</div>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
<div className={styles.content}>{children}</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default NodeContainer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NodeProps } from 'reactflow';
|
|
2
|
+
import { Node } from './Node';
|
|
3
|
+
import { useSystem } from '@/system/provider.js';
|
|
4
|
+
import { useStore } from 'zustand';
|
|
5
|
+
import type { IBehaveNode } from '@/types/nodes.js';
|
|
6
|
+
|
|
7
|
+
export const BehaveNode = (props: NodeProps<IBehaveNode['data']>) => {
|
|
8
|
+
const sys = useSystem();
|
|
9
|
+
const allSpecs = useStore(sys.specStore, (s) => s.specs);
|
|
10
|
+
const specDict = useStore(sys.specStore, (s) => s.specDict);
|
|
11
|
+
return (
|
|
12
|
+
<Node spec={specDict[props.data.type]!} allSpecs={allSpecs} {...props} />
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import styles from './styles.module.css';
|
|
2
|
+
import type { Editor } from '@tiptap/react';
|
|
3
|
+
import { Code, List, NumberedListLeft, Quote } from 'iconoir-react';
|
|
4
|
+
|
|
5
|
+
interface FormatToolbarProps {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const FormatToolbar = ({ editor }: FormatToolbarProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className={styles.bubbleMenu}>
|
|
12
|
+
<div className={styles.menuBar}>
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
onClick={() => editor.chain().focus().toggleBold().run()}
|
|
16
|
+
className={editor.isActive('bold') ? styles.isActive : ''}
|
|
17
|
+
title="Bold"
|
|
18
|
+
>
|
|
19
|
+
<strong>B</strong>
|
|
20
|
+
</button>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
onClick={() => editor.chain().focus().toggleItalic().run()}
|
|
24
|
+
className={editor.isActive('italic') ? styles.isActive : ''}
|
|
25
|
+
title="Italic"
|
|
26
|
+
>
|
|
27
|
+
<em>I</em>
|
|
28
|
+
</button>
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
onClick={() => editor.chain().focus().toggleStrike().run()}
|
|
32
|
+
className={editor.isActive('strike') ? styles.isActive : ''}
|
|
33
|
+
title="Strikethrough"
|
|
34
|
+
>
|
|
35
|
+
<s>S</s>
|
|
36
|
+
</button>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
onClick={() => editor.chain().focus().toggleCode().run()}
|
|
40
|
+
className={editor.isActive('code') ? styles.isActive : ''}
|
|
41
|
+
title="Code"
|
|
42
|
+
>
|
|
43
|
+
<Code />
|
|
44
|
+
</button>
|
|
45
|
+
<div className={styles.separator} />
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
onClick={() =>
|
|
49
|
+
editor.chain().focus().toggleHeading({ level: 1 }).run()
|
|
50
|
+
}
|
|
51
|
+
className={
|
|
52
|
+
editor.isActive('heading', { level: 1 }) ? styles.isActive : ''
|
|
53
|
+
}
|
|
54
|
+
title="Heading 1"
|
|
55
|
+
>
|
|
56
|
+
H1
|
|
57
|
+
</button>
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
onClick={() =>
|
|
61
|
+
editor.chain().focus().toggleHeading({ level: 2 }).run()
|
|
62
|
+
}
|
|
63
|
+
className={
|
|
64
|
+
editor.isActive('heading', { level: 2 }) ? styles.isActive : ''
|
|
65
|
+
}
|
|
66
|
+
title="Heading 2"
|
|
67
|
+
>
|
|
68
|
+
H2
|
|
69
|
+
</button>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={() =>
|
|
73
|
+
editor.chain().focus().toggleHeading({ level: 3 }).run()
|
|
74
|
+
}
|
|
75
|
+
className={
|
|
76
|
+
editor.isActive('heading', { level: 3 }) ? styles.isActive : ''
|
|
77
|
+
}
|
|
78
|
+
title="Heading 3"
|
|
79
|
+
>
|
|
80
|
+
H3
|
|
81
|
+
</button>
|
|
82
|
+
<div className={styles.separator} />
|
|
83
|
+
<button
|
|
84
|
+
type="button"
|
|
85
|
+
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
|
86
|
+
className={editor.isActive('bulletList') ? styles.isActive : ''}
|
|
87
|
+
title="Bullet List"
|
|
88
|
+
>
|
|
89
|
+
<List />
|
|
90
|
+
</button>
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
|
94
|
+
className={editor.isActive('orderedList') ? styles.isActive : ''}
|
|
95
|
+
title="Numbered List"
|
|
96
|
+
>
|
|
97
|
+
<NumberedListLeft />
|
|
98
|
+
</button>
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
|
102
|
+
className={editor.isActive('codeBlock') ? styles.isActive : ''}
|
|
103
|
+
title="Code Block"
|
|
104
|
+
>
|
|
105
|
+
<Code />
|
|
106
|
+
</button>
|
|
107
|
+
<button
|
|
108
|
+
type="button"
|
|
109
|
+
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
|
110
|
+
className={editor.isActive('blockquote') ? styles.isActive : ''}
|
|
111
|
+
title="Quote"
|
|
112
|
+
>
|
|
113
|
+
<Quote />
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import styles from './styles.module.css';
|
|
2
|
+
import { memo, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { NodeResizer, type OnResize } from 'reactflow';
|
|
4
|
+
import { useEditor, EditorContent } from '@tiptap/react';
|
|
5
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
6
|
+
import { useChangeNodeData } from '@/hooks/useChangeNodeData';
|
|
7
|
+
import { BaseNodeWrapper } from '../wrapper';
|
|
8
|
+
import { Markdown } from 'tiptap-markdown';
|
|
9
|
+
import type { ICommentNode } from '@/types/nodes';
|
|
10
|
+
import { FormatToolbar } from './FormatToolbar';
|
|
11
|
+
import type { NodeProps } from 'reactflow';
|
|
12
|
+
|
|
13
|
+
const CommentNodeRaw = ({
|
|
14
|
+
data,
|
|
15
|
+
selected,
|
|
16
|
+
id
|
|
17
|
+
}: NodeProps<ICommentNode['data']>) => {
|
|
18
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
19
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
+
const handleNodeChange = useChangeNodeData(id);
|
|
21
|
+
|
|
22
|
+
const editor = useEditor({
|
|
23
|
+
extensions: [StarterKit, Markdown],
|
|
24
|
+
content: data.text || '> Comment',
|
|
25
|
+
editable: isEditing,
|
|
26
|
+
editorProps: {
|
|
27
|
+
attributes: {
|
|
28
|
+
class: 'prose prose-sm focus:outline-none w-full h-full nodrag',
|
|
29
|
+
style: `font-size: ${data.fontSize || 'medium'}; padding: 0.5rem;`
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onUpdate: ({ editor }) => {
|
|
33
|
+
const markdown = (
|
|
34
|
+
editor.storage as { markdown?: { getMarkdown(): string } }
|
|
35
|
+
).markdown;
|
|
36
|
+
if (markdown) {
|
|
37
|
+
handleNodeChange('text', markdown.getMarkdown());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (editor) {
|
|
44
|
+
editor.setEditable(isEditing);
|
|
45
|
+
}
|
|
46
|
+
}, [isEditing, editor]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (editor && data.fontSize) {
|
|
50
|
+
const editorElement = editor.view.dom as HTMLElement;
|
|
51
|
+
editorElement.style.fontSize = data.fontSize;
|
|
52
|
+
}
|
|
53
|
+
}, [data.fontSize, editor]);
|
|
54
|
+
|
|
55
|
+
const onResize: OnResize = (event, params) => {
|
|
56
|
+
if (!containerRef.current) return;
|
|
57
|
+
containerRef.current.style.height = `${params.height}px`;
|
|
58
|
+
containerRef.current.style.width = `${params.width}px`;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleDoubleClick = () => {
|
|
62
|
+
setIsEditing(true);
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
editor?.commands.focus();
|
|
65
|
+
}, 0);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleBlur = (e: React.FocusEvent) => {
|
|
69
|
+
// Check if the new focus target is within the editor
|
|
70
|
+
const relatedTarget = e.relatedTarget as Node;
|
|
71
|
+
if (containerRef.current?.contains(relatedTarget)) {
|
|
72
|
+
return; // Don't close if focus is moving within the editor
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
setIsEditing(false);
|
|
77
|
+
}, 200);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<BaseNodeWrapper metadata={data.annotations}>
|
|
82
|
+
<div className={styles.commentNode}>
|
|
83
|
+
<NodeResizer
|
|
84
|
+
onResize={onResize}
|
|
85
|
+
color="#ff0071"
|
|
86
|
+
isVisible={selected || false}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<div
|
|
90
|
+
ref={containerRef}
|
|
91
|
+
className={styles.editorContainer}
|
|
92
|
+
onDoubleClick={handleDoubleClick}
|
|
93
|
+
onBlur={handleBlur}
|
|
94
|
+
>
|
|
95
|
+
{editor && isEditing && <FormatToolbar editor={editor} />}
|
|
96
|
+
<EditorContent editor={editor} className={styles.editorContent} />
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</BaseNodeWrapper>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const CommentNode = memo(CommentNodeRaw);
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
.commentNode {
|
|
2
|
+
background: var(--colors-bgSurface);
|
|
3
|
+
color: white;
|
|
4
|
+
border-radius: 2px;
|
|
5
|
+
border: 1px solid var(--vscode-textBlockQuote-border);
|
|
6
|
+
position: relative;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.editorContainer {
|
|
12
|
+
background: var(--vscode-editor-background);
|
|
13
|
+
padding: 10px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.editorContent {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
min-height: 100px;
|
|
23
|
+
cursor: text;
|
|
24
|
+
overflow: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.editorContent :global(.ProseMirror) {
|
|
28
|
+
outline: none;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
color: var(--vscode-editor-foreground);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.editorContent :global(.ProseMirror p) {
|
|
35
|
+
margin: 0.5em 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.editorContent :global(.ProseMirror h1) {
|
|
39
|
+
font-size: 2em;
|
|
40
|
+
font-weight: bold;
|
|
41
|
+
margin: 0.67em 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.editorContent :global(.ProseMirror h2) {
|
|
45
|
+
font-size: 1.5em;
|
|
46
|
+
font-weight: bold;
|
|
47
|
+
margin: 0.75em 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.editorContent :global(.ProseMirror h3) {
|
|
51
|
+
font-size: 1.17em;
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
margin: 0.83em 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.editorContent :global(.ProseMirror ul),
|
|
57
|
+
.editorContent :global(.ProseMirror ol) {
|
|
58
|
+
padding-left: 1.5em;
|
|
59
|
+
margin: 0.5em 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.editorContent :global(.ProseMirror code) {
|
|
63
|
+
background: var(--vscode-textCodeBlock-background);
|
|
64
|
+
padding: 0.125em 0.25em;
|
|
65
|
+
border-radius: 3px;
|
|
66
|
+
font-family: var(--vscode-editor-font-family);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.editorContent :global(.ProseMirror pre) {
|
|
70
|
+
background: var(--vscode-textCodeBlock-background);
|
|
71
|
+
padding: 0.75em;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
overflow-x: auto;
|
|
74
|
+
margin: 0.5em 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.editorContent :global(.ProseMirror pre code) {
|
|
78
|
+
background: none;
|
|
79
|
+
padding: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.editorContent :global(.ProseMirror blockquote) {
|
|
83
|
+
border-left: 3px solid var(--vscode-textBlockQuote-border);
|
|
84
|
+
padding-left: 1em;
|
|
85
|
+
margin: 0.5em 0;
|
|
86
|
+
font-style: italic;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.bubbleMenu {
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: -45px;
|
|
92
|
+
left: 50%;
|
|
93
|
+
transform: translateX(-50%);
|
|
94
|
+
background: var(--vscode-editorWidget-background);
|
|
95
|
+
border: 1px solid var(--vscode-editorWidget-border);
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
98
|
+
padding: 4px;
|
|
99
|
+
z-index: 1000;
|
|
100
|
+
animation: fadeIn 0.15s ease;
|
|
101
|
+
pointer-events: auto;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes fadeIn {
|
|
105
|
+
from {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transform: translateX(-50%) translateY(-5px);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
to {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
transform: translateX(-50%) translateY(0);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.menuBar {
|
|
117
|
+
display: flex;
|
|
118
|
+
gap: 2px;
|
|
119
|
+
align-items: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.menuBar button {
|
|
123
|
+
background: transparent;
|
|
124
|
+
border: none;
|
|
125
|
+
color: var(--vscode-foreground);
|
|
126
|
+
padding: 4px 8px;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
border-radius: 3px;
|
|
129
|
+
font-size: 13px;
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
transition: background-color 0.15s;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.menuBar button:hover {
|
|
137
|
+
background: var(--vscode-list-hoverBackground);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.menuBar button.isActive {
|
|
141
|
+
background: var(--vscode-list-activeSelectionBackground);
|
|
142
|
+
color: var(--vscode-list-activeSelectionForeground);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.separator {
|
|
146
|
+
width: 1px;
|
|
147
|
+
height: 20px;
|
|
148
|
+
background: var(--vscode-editorWidget-border);
|
|
149
|
+
margin: 0 4px;
|
|
150
|
+
}
|