project-graph-mcp 2.3.1 → 2.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.
- package/package.json +3 -2
- package/src/analysis/analysis-cache.ctx +9 -0
- package/src/analysis/analysis-cache.js +1 -1
- package/src/analysis/complexity.ctx +6 -0
- package/src/analysis/complexity.js +1 -1
- package/src/analysis/custom-rules.ctx +14 -0
- package/src/analysis/custom-rules.js +1 -1
- package/src/analysis/db-analysis.ctx +7 -0
- package/src/analysis/db-analysis.js +1 -1
- package/src/analysis/dead-code.ctx +6 -0
- package/src/analysis/dead-code.js +1 -1
- package/src/analysis/full-analysis.ctx +9 -0
- package/src/analysis/full-analysis.js +1 -1
- package/src/analysis/jsdoc-checker.ctx +10 -0
- package/src/analysis/jsdoc-checker.js +1 -1
- package/src/analysis/jsdoc-generator.ctx +9 -0
- package/src/analysis/jsdoc-generator.js +1 -1
- package/src/analysis/large-files.ctx +6 -0
- package/src/analysis/large-files.js +1 -1
- package/src/analysis/outdated-patterns.ctx +7 -0
- package/src/analysis/outdated-patterns.js +1 -1
- package/src/analysis/similar-functions.ctx +6 -0
- package/src/analysis/similar-functions.js +1 -1
- package/src/analysis/test-annotations.ctx +11 -0
- package/src/analysis/test-annotations.js +1 -1
- package/src/analysis/type-checker.ctx +6 -0
- package/src/analysis/type-checker.js +1 -1
- package/src/analysis/undocumented.ctx +8 -0
- package/src/analysis/undocumented.js +1 -1
- package/src/cli/cli-handlers.ctx +7 -0
- package/src/cli/cli-handlers.js +1 -1
- package/src/cli/cli.ctx +6 -0
- package/src/cli/cli.js +1 -1
- package/src/compact/ai-context.ctx +6 -0
- package/src/compact/ai-context.js +1 -1
- package/src/compact/compact-migrate.ctx +8 -0
- package/src/compact/compact-migrate.js +1 -1
- package/src/compact/compact.ctx +11 -0
- package/src/compact/compact.js +1 -1
- package/src/compact/compress.ctx +7 -0
- package/src/compact/compress.js +1 -1
- package/src/compact/ctx-resolver.ctx +2 -0
- package/src/compact/ctx-resolver.js +1 -1
- package/src/compact/ctx-to-jsdoc.ctx +11 -0
- package/src/compact/ctx-to-jsdoc.js +1 -1
- package/src/compact/doc-dialect.ctx +11 -0
- package/src/compact/doc-dialect.js +2 -2
- package/src/compact/expand.ctx +14 -0
- package/src/compact/expand.js +1 -1
- package/src/compact/framework-references.ctx +7 -0
- package/src/compact/framework-references.js +1 -1
- package/src/compact/instructions.ctx +6 -0
- package/src/compact/instructions.js +1 -1
- package/src/compact/jsdoc-builder.ctx +4 -0
- package/src/compact/jsdoc-builder.js +1 -1
- package/src/compact/mode-config.ctx +8 -0
- package/src/compact/mode-config.js +1 -1
- package/src/compact/split-declarations.ctx +6 -0
- package/src/compact/split-declarations.js +1 -1
- package/src/compact/validate-pipeline.ctx +12 -0
- package/src/compact/validate-pipeline.js +1 -1
- package/src/core/event-bus.ctx +9 -0
- package/src/core/event-bus.js +1 -1
- package/src/core/file-walker.ctx +1 -0
- package/src/core/file-walker.js +1 -1
- package/src/core/filters.ctx +12 -0
- package/src/core/filters.js +1 -1
- package/src/core/graph-builder.ctx +7 -0
- package/src/core/graph-builder.js +1 -1
- package/src/core/parser.ctx +12 -0
- package/src/core/parser.js +1 -1
- package/src/core/utils.ctx +1 -0
- package/src/core/utils.js +1 -1
- package/src/core/workspace.ctx +7 -0
- package/src/core/workspace.js +1 -1
- package/src/lang/lang-go.ctx +8 -0
- package/src/lang/lang-go.js +1 -1
- package/src/lang/lang-python.ctx +5 -0
- package/src/lang/lang-python.js +1 -1
- package/src/lang/lang-sql.ctx +10 -0
- package/src/lang/lang-sql.js +1 -1
- package/src/lang/lang-typescript.ctx +6 -0
- package/src/lang/lang-typescript.js +1 -1
- package/src/lang/lang-utils.ctx +5 -0
- package/src/lang/lang-utils.js +1 -1
- package/src/mcp/mcp-server.ctx +6 -0
- package/src/mcp/mcp-server.js +1 -1
- package/src/mcp/tool-defs.ctx +2 -0
- package/src/mcp/tool-defs.js +1 -1
- package/src/mcp/tools.ctx +13 -0
- package/src/mcp/tools.js +1 -1
- package/src/network/backend-lifecycle.ctx +10 -0
- package/src/network/backend-lifecycle.js +1 -1
- package/src/network/backend.ctx +5 -0
- package/src/network/backend.js +1 -1
- package/src/network/local-gateway.ctx +9 -0
- package/src/network/local-gateway.js +1 -1
- package/src/network/mdns.ctx +6 -0
- package/src/network/mdns.js +1 -1
- package/src/network/server.ctx +2 -0
- package/src/network/server.js +2 -2
- package/src/network/web-server.ctx +17 -0
- package/src/network/web-server.js +2 -2
- package/web/follow-controller.js +94 -25
- package/web/panels/dep-graph.js +207 -21
- package/project-graph-mcp-2.3.0.tgz +0 -0
- package/vendor/symbiote-node/CHANGELOG.md +0 -31
- package/vendor/symbiote-node/LICENSE +0 -21
- package/vendor/symbiote-node/README.md +0 -206
- package/vendor/symbiote-node/canvas/AutoLayout.js +0 -725
- package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.css.js +0 -73
- package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.js +0 -93
- package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.tpl.js +0 -9
- package/vendor/symbiote-node/canvas/CanvasConnectionRenderer.js +0 -962
- package/vendor/symbiote-node/canvas/ConnectionRenderer.js +0 -1468
- package/vendor/symbiote-node/canvas/FlowSimulator.js +0 -323
- package/vendor/symbiote-node/canvas/ForceLayout.js +0 -189
- package/vendor/symbiote-node/canvas/ForceWorker.js +0 -1325
- package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.css.js +0 -97
- package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.js +0 -176
- package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.tpl.js +0 -12
- package/vendor/symbiote-node/canvas/LODManager.js +0 -88
- package/vendor/symbiote-node/canvas/Minimap/Minimap.css.js +0 -71
- package/vendor/symbiote-node/canvas/Minimap/Minimap.js +0 -207
- package/vendor/symbiote-node/canvas/Minimap/Minimap.tpl.js +0 -9
- package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.css.js +0 -261
- package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.js +0 -1840
- package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.tpl.js +0 -22
- package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.css.js +0 -97
- package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.js +0 -132
- package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.tpl.js +0 -21
- package/vendor/symbiote-node/canvas/NodeViewManager.js +0 -584
- package/vendor/symbiote-node/canvas/PinExpansion.js +0 -131
- package/vendor/symbiote-node/canvas/PseudoConnection.js +0 -80
- package/vendor/symbiote-node/canvas/SubgraphManager.js +0 -201
- package/vendor/symbiote-node/canvas/SubgraphRouter.js +0 -443
- package/vendor/symbiote-node/canvas/ViewportActions.js +0 -446
- package/vendor/symbiote-node/core/Connection.js +0 -45
- package/vendor/symbiote-node/core/Editor.js +0 -451
- package/vendor/symbiote-node/core/Frame.js +0 -31
- package/vendor/symbiote-node/core/GraphMermaid.js +0 -348
- package/vendor/symbiote-node/core/GraphText.js +0 -210
- package/vendor/symbiote-node/core/Node.js +0 -143
- package/vendor/symbiote-node/core/Portal.js +0 -104
- package/vendor/symbiote-node/core/Socket.js +0 -185
- package/vendor/symbiote-node/core/SubgraphNode.js +0 -125
- package/vendor/symbiote-node/index.js +0 -103
- package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.css.js +0 -361
- package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.js +0 -332
- package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.tpl.js +0 -96
- package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.css.js +0 -104
- package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.js +0 -133
- package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.tpl.js +0 -33
- package/vendor/symbiote-node/interactions/ConnectFlow.js +0 -307
- package/vendor/symbiote-node/interactions/Drag.js +0 -102
- package/vendor/symbiote-node/interactions/Selector.js +0 -132
- package/vendor/symbiote-node/interactions/SnapGrid.js +0 -65
- package/vendor/symbiote-node/interactions/Zoom.js +0 -140
- package/vendor/symbiote-node/layout/ActionZone/ActionZone.css.js +0 -88
- package/vendor/symbiote-node/layout/ActionZone/ActionZone.js +0 -254
- package/vendor/symbiote-node/layout/ActionZone/ActionZone.tpl.js +0 -11
- package/vendor/symbiote-node/layout/Layout/Layout.css.js +0 -88
- package/vendor/symbiote-node/layout/Layout/Layout.js +0 -622
- package/vendor/symbiote-node/layout/Layout/Layout.tpl.js +0 -25
- package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.css.js +0 -293
- package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.js +0 -467
- package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.tpl.js +0 -33
- package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.css.js +0 -46
- package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.js +0 -102
- package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.tpl.js +0 -6
- package/vendor/symbiote-node/layout/LayoutRouter/LayoutRouter.js +0 -156
- package/vendor/symbiote-node/layout/LayoutRouter/routerSync.js +0 -250
- package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.css.js +0 -379
- package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.js +0 -263
- package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.tpl.js +0 -20
- package/vendor/symbiote-node/layout/LayoutSidebar/SidebarSection.js +0 -183
- package/vendor/symbiote-node/layout/LayoutTree.js +0 -246
- package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.css.js +0 -43
- package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.js +0 -89
- package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.tpl.js +0 -14
- package/vendor/symbiote-node/layout/index.js +0 -16
- package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.css.js +0 -61
- package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.js +0 -79
- package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.tpl.js +0 -19
- package/vendor/symbiote-node/node/CtrlItem/CtrlItem.css.js +0 -41
- package/vendor/symbiote-node/node/CtrlItem/CtrlItem.js +0 -24
- package/vendor/symbiote-node/node/CtrlItem/CtrlItem.tpl.js +0 -16
- package/vendor/symbiote-node/node/GraphFrame/GraphFrame.css.js +0 -65
- package/vendor/symbiote-node/node/GraphFrame/GraphFrame.js +0 -29
- package/vendor/symbiote-node/node/GraphFrame/GraphFrame.tpl.js +0 -13
- package/vendor/symbiote-node/node/GraphNode/GraphNode.css.js +0 -683
- package/vendor/symbiote-node/node/GraphNode/GraphNode.js +0 -92
- package/vendor/symbiote-node/node/GraphNode/GraphNode.tpl.js +0 -17
- package/vendor/symbiote-node/node/NodeSocket/NodeSocket.js +0 -25
- package/vendor/symbiote-node/node/NodeSocket/NodeSocket.tpl.js +0 -7
- package/vendor/symbiote-node/node/PortItem/PortItem.css.js +0 -90
- package/vendor/symbiote-node/node/PortItem/PortItem.js +0 -87
- package/vendor/symbiote-node/node/PortItem/PortItem.tpl.js +0 -10
- package/vendor/symbiote-node/package.json +0 -59
- package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.css.js +0 -143
- package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.js +0 -131
- package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.tpl.js +0 -16
- package/vendor/symbiote-node/plugins/History.js +0 -384
- package/vendor/symbiote-node/plugins/Readonly.js +0 -59
- package/vendor/symbiote-node/shapes/CircleShape.js +0 -80
- package/vendor/symbiote-node/shapes/CommentShape.js +0 -35
- package/vendor/symbiote-node/shapes/DiamondShape.js +0 -115
- package/vendor/symbiote-node/shapes/NodeShape.js +0 -80
- package/vendor/symbiote-node/shapes/PillShape.js +0 -91
- package/vendor/symbiote-node/shapes/RectShape.js +0 -72
- package/vendor/symbiote-node/shapes/SVGShape.js +0 -494
- package/vendor/symbiote-node/shapes/index.js +0 -53
- package/vendor/symbiote-node/themes/Palette.js +0 -32
- package/vendor/symbiote-node/themes/Skin.js +0 -113
- package/vendor/symbiote-node/themes/Theme.js +0 -84
- package/vendor/symbiote-node/themes/carbon.js +0 -137
- package/vendor/symbiote-node/themes/dark.js +0 -137
- package/vendor/symbiote-node/themes/ebook.js +0 -138
- package/vendor/symbiote-node/themes/grey.js +0 -137
- package/vendor/symbiote-node/themes/light.js +0 -137
- package/vendor/symbiote-node/themes/neon.js +0 -138
- package/vendor/symbiote-node/themes/pcb.js +0 -273
- package/vendor/symbiote-node/themes/synthwave.js +0 -137
- package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.css.js +0 -86
- package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.js +0 -128
- package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.tpl.js +0 -29
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* InspectorPanel template
|
|
3
|
-
* @module symbiote-node/inspector/InspectorPanel.tpl
|
|
4
|
-
*/
|
|
5
|
-
import { html } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
export const template = html`
|
|
8
|
-
<div class="insp-resize-handle"></div>
|
|
9
|
-
|
|
10
|
-
<div class="insp-body">
|
|
11
|
-
<div class="insp-empty">
|
|
12
|
-
<span class="material-symbols-outlined">touch_app</span>
|
|
13
|
-
<span>Select a node</span>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="insp-content" hidden>
|
|
17
|
-
<div class="insp-field">
|
|
18
|
-
<label>Label</label>
|
|
19
|
-
<div class="insp-value">{{nodeLabel}}</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="insp-field">
|
|
22
|
-
<label>Type</label>
|
|
23
|
-
<div class="insp-value insp-tag">{{nodeType}}</div>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="insp-field">
|
|
26
|
-
<label>Category</label>
|
|
27
|
-
<div class="insp-value insp-tag">{{nodeCategory}}</div>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="insp-field">
|
|
30
|
-
<label>ID</label>
|
|
31
|
-
<div class="insp-value insp-mono">{{nodeId}}</div>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div class="insp-section">
|
|
35
|
-
<div class="insp-section-title">
|
|
36
|
-
<span class="material-symbols-outlined">input</span> Inputs
|
|
37
|
-
</div>
|
|
38
|
-
<div ${{ itemize: 'inputsList', 'item-tag': 'insp-port-item' }}></div>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="insp-section">
|
|
42
|
-
<div class="insp-section-title">
|
|
43
|
-
<span class="material-symbols-outlined">output</span> Outputs
|
|
44
|
-
</div>
|
|
45
|
-
<div ${{ itemize: 'outputsList', 'item-tag': 'insp-port-item' }}></div>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div class="insp-section">
|
|
49
|
-
<div class="insp-section-title">
|
|
50
|
-
<span class="material-symbols-outlined">tune</span> Controls
|
|
51
|
-
</div>
|
|
52
|
-
<div ${{ itemize: 'controlsList', 'item-tag': 'insp-ctrl-item' }}></div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class="insp-template-preview" ${{ '@hidden': '!isTemplateBuilder' }}>
|
|
56
|
-
<template-preview></template-preview>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div class="insp-fire" ${{ '@hidden': '!isFireable' }}>
|
|
60
|
-
<button class="insp-fire-btn" ${{ onclick: 'onFire' }}>
|
|
61
|
-
<span class="material-symbols-outlined">play_arrow</span>
|
|
62
|
-
Fire
|
|
63
|
-
</button>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<div class="insp-subgraph" hidden>
|
|
67
|
-
<div class="insp-section-title">
|
|
68
|
-
<span class="material-symbols-outlined">account_tree</span> Subgraph
|
|
69
|
-
</div>
|
|
70
|
-
<div class="insp-field">
|
|
71
|
-
<label>Inner Nodes</label>
|
|
72
|
-
<div class="insp-value">{{innerNodeCount}}</div>
|
|
73
|
-
</div>
|
|
74
|
-
<button class="insp-enter-btn" ${{ onclick: 'onEnterSubgraph' }}>
|
|
75
|
-
<span class="material-symbols-outlined">login</span>
|
|
76
|
-
Enter Subgraph
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
export const inspPortItemTemplate = html`
|
|
84
|
-
<div class="insp-port">
|
|
85
|
-
<span class="insp-port-dot"></span>
|
|
86
|
-
<span class="insp-port-label">{{label}}</span>
|
|
87
|
-
<span class="insp-port-type">{{socketType}}</span>
|
|
88
|
-
</div>
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
export const inspCtrlItemTemplate = html`
|
|
92
|
-
<div class="insp-ctrl">
|
|
93
|
-
<label class="insp-ctrl-label">{{label}}</label>
|
|
94
|
-
<div class="insp-ctrl-input"></div>
|
|
95
|
-
</div>
|
|
96
|
-
`;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TemplatePreview styles
|
|
3
|
-
* @module symbiote-node/inspector/TemplatePreview.css
|
|
4
|
-
*/
|
|
5
|
-
import { css } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
export const styles = css`
|
|
8
|
-
template-preview {
|
|
9
|
-
display: block;
|
|
10
|
-
padding-top: 8px;
|
|
11
|
-
|
|
12
|
-
& .tpl-preview-section {
|
|
13
|
-
margin-bottom: 10px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
& .tpl-chips-label,
|
|
17
|
-
& .tpl-preview-label {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: 4px;
|
|
21
|
-
font-size: 10px;
|
|
22
|
-
font-weight: 600;
|
|
23
|
-
text-transform: uppercase;
|
|
24
|
-
color: var(--sn-text-dim, #888);
|
|
25
|
-
margin-bottom: 4px;
|
|
26
|
-
letter-spacing: 0.5px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
& .tpl-chips-label .material-symbols-outlined,
|
|
30
|
-
& .tpl-preview-label .material-symbols-outlined {
|
|
31
|
-
font-size: 14px;
|
|
32
|
-
opacity: 0.6;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
& .tpl-chips {
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-wrap: wrap;
|
|
38
|
-
gap: 4px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
& .tpl-chips-empty {
|
|
42
|
-
font-size: 11px;
|
|
43
|
-
color: var(--sn-text-dim, #666);
|
|
44
|
-
font-style: italic;
|
|
45
|
-
padding: 4px 0;
|
|
46
|
-
|
|
47
|
-
&[hidden] {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
& .tpl-test-data {
|
|
53
|
-
width: 100%;
|
|
54
|
-
padding: 6px 8px;
|
|
55
|
-
font-size: 11px;
|
|
56
|
-
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
57
|
-
color: var(--sn-text, #d4d4d4);
|
|
58
|
-
background: color-mix(in srgb, currentColor 6%, transparent);
|
|
59
|
-
border: 1px solid rgba(255,255,255,0.06);
|
|
60
|
-
border-radius: 4px;
|
|
61
|
-
outline: none;
|
|
62
|
-
resize: vertical;
|
|
63
|
-
min-height: 50px;
|
|
64
|
-
box-sizing: border-box;
|
|
65
|
-
line-height: 1.4;
|
|
66
|
-
transition: border-color 0.15s;
|
|
67
|
-
|
|
68
|
-
&:focus {
|
|
69
|
-
border-color: var(--sn-node-selected, #4a9eff);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
& .tpl-preview-result {
|
|
74
|
-
font-size: 12px;
|
|
75
|
-
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
76
|
-
color: var(--sn-text, #d4d4d4);
|
|
77
|
-
background: color-mix(in srgb, currentColor 4%, transparent);
|
|
78
|
-
border: 1px solid rgba(255,255,255,0.04);
|
|
79
|
-
border-radius: 4px;
|
|
80
|
-
padding: 8px;
|
|
81
|
-
white-space: pre-wrap;
|
|
82
|
-
word-break: break-word;
|
|
83
|
-
min-height: 30px;
|
|
84
|
-
line-height: 1.4;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.tpl-chip {
|
|
89
|
-
display: inline-block;
|
|
90
|
-
padding: 2px 8px;
|
|
91
|
-
font-size: 11px;
|
|
92
|
-
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
93
|
-
border-radius: 10px;
|
|
94
|
-
background: color-mix(in srgb, #4caf50 20%, transparent);
|
|
95
|
-
color: #81c784;
|
|
96
|
-
border: 1px solid rgba(76, 175, 80, 0.3);
|
|
97
|
-
|
|
98
|
-
&[data-missing] {
|
|
99
|
-
background: color-mix(in srgb, #f44336 20%, transparent);
|
|
100
|
-
color: #ef9a9a;
|
|
101
|
-
border-color: rgba(244, 67, 54, 0.3);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TemplatePreview — live preview for template-builder node
|
|
3
|
-
*
|
|
4
|
-
* Shows placeholder chips (resolved/missing), test data input,
|
|
5
|
-
* and interpolated preview text. Updates reactively.
|
|
6
|
-
*
|
|
7
|
-
* @module symbiote-node/inspector/TemplatePreview
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import Symbiote from '@symbiotejs/symbiote';
|
|
11
|
-
import { template } from './TemplatePreview.tpl.js';
|
|
12
|
-
import { styles } from './TemplatePreview.css.js';
|
|
13
|
-
import { extractPlaceholders } from '../../engine/packs/transform/template-builder.handler.js';
|
|
14
|
-
|
|
15
|
-
const DEFAULT_TEST_DATA = JSON.stringify({
|
|
16
|
-
status: 'created',
|
|
17
|
-
region: 'RU',
|
|
18
|
-
jobUid: '00c3b879-example',
|
|
19
|
-
details: 'Test delivery',
|
|
20
|
-
timestamp: new Date().toISOString(),
|
|
21
|
-
}, null, 2);
|
|
22
|
-
|
|
23
|
-
export class TemplatePreview extends Symbiote {
|
|
24
|
-
init$ = {
|
|
25
|
-
template: '',
|
|
26
|
-
testData: DEFAULT_TEST_DATA,
|
|
27
|
-
placeholderChips: [],
|
|
28
|
-
previewText: '',
|
|
29
|
-
noPlaceholders: true,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
renderCallback() {
|
|
33
|
-
// Bind textarea to testData
|
|
34
|
-
/** @type {HTMLTextAreaElement|null} */
|
|
35
|
-
const textarea = this.querySelector('.tpl-test-data');
|
|
36
|
-
if (textarea) {
|
|
37
|
-
textarea.value = this.$.testData;
|
|
38
|
-
textarea.addEventListener('input', () => {
|
|
39
|
-
this.$.testData = textarea.value;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// React to template changes
|
|
44
|
-
this.sub('template', () => this._updatePreview());
|
|
45
|
-
this.sub('testData', () => this._updatePreview());
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Extract placeholders, interpolate template, update chips + preview.
|
|
50
|
-
*/
|
|
51
|
-
_updatePreview() {
|
|
52
|
-
const tpl = this.$.template;
|
|
53
|
-
const placeholders = extractPlaceholders(tpl);
|
|
54
|
-
|
|
55
|
-
this.$.noPlaceholders = placeholders.length === 0;
|
|
56
|
-
|
|
57
|
-
// Parse test data
|
|
58
|
-
let data = {};
|
|
59
|
-
try {
|
|
60
|
-
data = JSON.parse(this.$.testData);
|
|
61
|
-
} catch {
|
|
62
|
-
this.$.previewText = '⚠️ Invalid JSON in test data';
|
|
63
|
-
this.$.placeholderChips = placeholders.map((name) => ({ name }));
|
|
64
|
-
this._applyChipColors([]);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Build chips with resolved status
|
|
69
|
-
const resolved = [];
|
|
70
|
-
const chips = placeholders.map((name) => {
|
|
71
|
-
const val = this._resolvePath(data, name);
|
|
72
|
-
const isResolved = val !== undefined;
|
|
73
|
-
if (isResolved) resolved.push(name);
|
|
74
|
-
return { name };
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
this.$.placeholderChips = chips;
|
|
78
|
-
|
|
79
|
-
// Apply chip colors after itemize renders
|
|
80
|
-
requestAnimationFrame(() => this._applyChipColors(resolved));
|
|
81
|
-
|
|
82
|
-
// Interpolate
|
|
83
|
-
if (!tpl) {
|
|
84
|
-
this.$.previewText = '';
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const text = tpl.replace(/\{\{?([^{}]+)\}?\}/g, (match, key) => {
|
|
89
|
-
const trimmed = key.trim();
|
|
90
|
-
const value = this._resolvePath(data, trimmed);
|
|
91
|
-
if (value === undefined) return match;
|
|
92
|
-
if (typeof value === 'object') return JSON.stringify(value);
|
|
93
|
-
return String(value);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
this.$.previewText = text;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Apply data-missing attribute to chip elements based on resolved status.
|
|
101
|
-
*
|
|
102
|
-
* @param {string[]} resolved - Names of resolved placeholders
|
|
103
|
-
*/
|
|
104
|
-
_applyChipColors(resolved) {
|
|
105
|
-
const chipEls = this.querySelectorAll('.tpl-chip');
|
|
106
|
-
chipEls.forEach((el) => {
|
|
107
|
-
const name = el.textContent?.trim();
|
|
108
|
-
if (name && !resolved.includes(name)) {
|
|
109
|
-
el.setAttribute('data-missing', '');
|
|
110
|
-
} else {
|
|
111
|
-
el.removeAttribute('data-missing');
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Resolve a dot-notation path in an object.
|
|
118
|
-
*
|
|
119
|
-
* @param {Object} obj - Data object
|
|
120
|
-
* @param {string} path - Dot-separated path
|
|
121
|
-
* @returns {*} Resolved value or undefined
|
|
122
|
-
*/
|
|
123
|
-
_resolvePath(obj, path) {
|
|
124
|
-
return path.split('.').reduce((o, k) => {
|
|
125
|
-
if (o === null || o === undefined) return undefined;
|
|
126
|
-
return o[k];
|
|
127
|
-
}, obj);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
TemplatePreview.template = template;
|
|
132
|
-
TemplatePreview.rootStyles = styles;
|
|
133
|
-
TemplatePreview.reg('template-preview');
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TemplatePreview template
|
|
3
|
-
* @module symbiote-node/inspector/TemplatePreview.tpl
|
|
4
|
-
*/
|
|
5
|
-
import { html } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
export const template = html`
|
|
8
|
-
<div class="tpl-preview-section">
|
|
9
|
-
<div class="tpl-chips-label">
|
|
10
|
-
<span class="material-symbols-outlined">sell</span> Placeholders
|
|
11
|
-
</div>
|
|
12
|
-
<div class="tpl-chips" itemize="placeholderChips">
|
|
13
|
-
<template>
|
|
14
|
-
<span class="tpl-chip">{{name}}</span>
|
|
15
|
-
</template>
|
|
16
|
-
</div>
|
|
17
|
-
<div class="tpl-chips-empty" ${{ '@hidden': '!noPlaceholders' }}>
|
|
18
|
-
Type {field} in template to add placeholders
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="tpl-preview-section">
|
|
22
|
-
<div class="tpl-preview-label">
|
|
23
|
-
<span class="material-symbols-outlined">data_object</span> Test Data (JSON)
|
|
24
|
-
</div>
|
|
25
|
-
<textarea class="tpl-test-data" rows="3" spellcheck="false"></textarea>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="tpl-preview-section">
|
|
28
|
-
<div class="tpl-preview-label">
|
|
29
|
-
<span class="material-symbols-outlined">visibility</span> Preview
|
|
30
|
-
</div>
|
|
31
|
-
<div class="tpl-preview-result" ${{ textContent: 'previewText' }}></div>
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConnectFlow — interactive socket-to-socket connection creation
|
|
3
|
-
*
|
|
4
|
-
* Simplified version of Rete.js ClassicFlow.
|
|
5
|
-
* Handles: pointerdown on socket → drag pseudo-line → pointerup on target socket → create connection.
|
|
6
|
-
*
|
|
7
|
-
* @module symbiote-node/interactions/ConnectFlow
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Connection } from '../core/Connection.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {object} SocketData
|
|
14
|
-
* @property {string} nodeId - Node ID
|
|
15
|
-
* @property {string} key - Port key
|
|
16
|
-
* @property {'input'|'output'} side - Port side
|
|
17
|
-
* @property {HTMLElement} element - Socket DOM element
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export class ConnectFlow {
|
|
21
|
-
|
|
22
|
-
/** @type {SocketData|null} */
|
|
23
|
-
#picked = null;
|
|
24
|
-
|
|
25
|
-
/** @type {import('../core/Editor.js').NodeEditor} */
|
|
26
|
-
#editor;
|
|
27
|
-
|
|
28
|
-
/** @type {function} */
|
|
29
|
-
#getNodePosition;
|
|
30
|
-
|
|
31
|
-
/** @type {function} */
|
|
32
|
-
#getNodeSize;
|
|
33
|
-
|
|
34
|
-
/** @type {function} */
|
|
35
|
-
#getTransform;
|
|
36
|
-
|
|
37
|
-
/** @type {function|null} */
|
|
38
|
-
#onPseudoStart = null;
|
|
39
|
-
|
|
40
|
-
/** @type {function|null} */
|
|
41
|
-
#onPseudoMove = null;
|
|
42
|
-
|
|
43
|
-
/** @type {function|null} */
|
|
44
|
-
#onPseudoEnd = null;
|
|
45
|
-
|
|
46
|
-
/** @type {function|null} */
|
|
47
|
-
#onDropEmpty = null;
|
|
48
|
-
|
|
49
|
-
/** @type {function|null} - called during drag with world XY + picked socket */
|
|
50
|
-
#onCompatibleMove = null;
|
|
51
|
-
|
|
52
|
-
/** @type {function|null} - find nearest SVG dot as drop target */
|
|
53
|
-
#findNearestDot = null;
|
|
54
|
-
|
|
55
|
-
/** @type {number} - last time compatible move was emitted (ms) */
|
|
56
|
-
#lastMoveTime = 0;
|
|
57
|
-
|
|
58
|
-
/** @type {{ x: number, y: number }|null} - cached start position from pick */
|
|
59
|
-
#pickedStartPos = null;
|
|
60
|
-
|
|
61
|
-
/** @type {Set<SocketData>} */
|
|
62
|
-
#sockets = new Set();
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @param {import('../core/Editor.js').NodeEditor} editor
|
|
66
|
-
* @param {object} callbacks
|
|
67
|
-
* @param {function} callbacks.getNodePosition
|
|
68
|
-
* @param {function} callbacks.getNodeSize
|
|
69
|
-
* @param {function} callbacks.getTransform - Returns { x, y, k, rect }
|
|
70
|
-
* @param {function} callbacks.onPseudoStart
|
|
71
|
-
* @param {function} callbacks.onPseudoMove
|
|
72
|
-
* @param {function} callbacks.onPseudoEnd
|
|
73
|
-
* @param {function} [callbacks.onDropEmpty] - Called when connection dropped in empty space
|
|
74
|
-
*/
|
|
75
|
-
constructor(editor, callbacks) {
|
|
76
|
-
this.#editor = editor;
|
|
77
|
-
this.#getNodePosition = callbacks.getNodePosition;
|
|
78
|
-
this.#getNodeSize = callbacks.getNodeSize;
|
|
79
|
-
this.#getTransform = callbacks.getTransform;
|
|
80
|
-
this.#onPseudoStart = callbacks.onPseudoStart;
|
|
81
|
-
this.#onPseudoMove = callbacks.onPseudoMove;
|
|
82
|
-
this.#onPseudoEnd = callbacks.onPseudoEnd;
|
|
83
|
-
this.#onDropEmpty = callbacks.onDropEmpty || null;
|
|
84
|
-
this.#onCompatibleMove = callbacks.onCompatibleMove || null;
|
|
85
|
-
this.#findNearestDot = callbacks.findNearestDot || null;
|
|
86
|
-
|
|
87
|
-
window.addEventListener('pointermove', this.#onMove);
|
|
88
|
-
window.addEventListener('pointerup', this.#onUp);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Register a socket element for connection interaction
|
|
93
|
-
* @param {HTMLElement} socketEl
|
|
94
|
-
* @param {SocketData} data
|
|
95
|
-
*/
|
|
96
|
-
registerSocket(socketEl, data) {
|
|
97
|
-
this.#sockets.add(data);
|
|
98
|
-
socketEl.addEventListener('pointerdown', (e) => {
|
|
99
|
-
e.stopPropagation();
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
this.#pick(data);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Whether a connection drag is in progress
|
|
107
|
-
* @returns {boolean}
|
|
108
|
-
*/
|
|
109
|
-
isPicking() {
|
|
110
|
-
return this.#picked !== null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get the currently picked socket data (during drag)
|
|
115
|
-
* @returns {SocketData|null}
|
|
116
|
-
*/
|
|
117
|
-
getPickedSocket() {
|
|
118
|
-
return this.#picked;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Externally initiate a connection drag from socket data
|
|
123
|
-
* @param {SocketData} data
|
|
124
|
-
*/
|
|
125
|
-
pickSocket(data) {
|
|
126
|
-
// Ensure this socket is in the registry for snap targeting
|
|
127
|
-
if (!this.#sockets.has(data)) {
|
|
128
|
-
this.#sockets.add(data);
|
|
129
|
-
}
|
|
130
|
-
this.#pick(data);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
#pick(data) {
|
|
134
|
-
this.#picked = data;
|
|
135
|
-
const pos = this.#getSocketWorldPosition(data);
|
|
136
|
-
if (this.#onPseudoStart) this.#onPseudoStart(pos.x, pos.y, data);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
#onMove = (e) => {
|
|
140
|
-
if (!this.#picked) return;
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
|
|
143
|
-
const startPos = this.#getSocketWorldPosition(this.#picked);
|
|
144
|
-
const t = this.#getTransform();
|
|
145
|
-
// Use clientX/Y minus container rect for accurate positioning
|
|
146
|
-
const endX = (e.clientX - t.rect.left - t.x) / t.k;
|
|
147
|
-
const endY = (e.clientY - t.rect.top - t.y) / t.k;
|
|
148
|
-
|
|
149
|
-
if (this.#onPseudoMove) this.#onPseudoMove(startPos.x, startPos.y, endX, endY);
|
|
150
|
-
|
|
151
|
-
// Throttle to ~60fps
|
|
152
|
-
const now = performance.now();
|
|
153
|
-
if (this.#onCompatibleMove && now - this.#lastMoveTime > 16) {
|
|
154
|
-
this.#lastMoveTime = now;
|
|
155
|
-
this.#onCompatibleMove(endX, endY, this.#picked);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
#onUp = (e) => {
|
|
160
|
-
if (!this.#picked) return;
|
|
161
|
-
|
|
162
|
-
// Find nearest compatible socket within snap distance
|
|
163
|
-
const t = this.#getTransform();
|
|
164
|
-
const pointerX = (e.clientX - t.rect.left - t.x) / t.k;
|
|
165
|
-
const pointerY = (e.clientY - t.rect.top - t.y) / t.k;
|
|
166
|
-
const target = this.#findNearestSocket(pointerX, pointerY);
|
|
167
|
-
|
|
168
|
-
if (target && this.#canConnect(this.#picked, target)) {
|
|
169
|
-
this.#makeConnection(this.#picked, target);
|
|
170
|
-
} else if (this.#findNearestDot) {
|
|
171
|
-
// Fallback: check SVG dots as drop target
|
|
172
|
-
const dotTarget = this.#findNearestDot(pointerX, pointerY);
|
|
173
|
-
if (dotTarget) {
|
|
174
|
-
const dotSocket = { nodeId: dotTarget.nodeId, key: dotTarget.key, side: dotTarget.side };
|
|
175
|
-
if (this.#canConnect(this.#picked, dotSocket)) {
|
|
176
|
-
this.#makeConnection(this.#picked, dotSocket);
|
|
177
|
-
} else if (this.#onDropEmpty) {
|
|
178
|
-
this.#onDropEmpty(pointerX, pointerY, this.#picked);
|
|
179
|
-
}
|
|
180
|
-
} else if (this.#onDropEmpty) {
|
|
181
|
-
this.#onDropEmpty(pointerX, pointerY, this.#picked);
|
|
182
|
-
}
|
|
183
|
-
} else if (this.#onDropEmpty) {
|
|
184
|
-
// No target found — emit drop-in-empty event
|
|
185
|
-
this.#onDropEmpty(pointerX, pointerY, this.#picked);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
this.#picked = null;
|
|
189
|
-
if (this.#onPseudoEnd) this.#onPseudoEnd();
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* Get socket position in graph coordinate space
|
|
193
|
-
* Uses getBoundingClientRect with zoom compensation
|
|
194
|
-
* @param {SocketData} data
|
|
195
|
-
* @returns {{ x: number, y: number }}
|
|
196
|
-
*/
|
|
197
|
-
#getSocketWorldPosition(data) {
|
|
198
|
-
// Direct world coordinates (from overlay dot drag)
|
|
199
|
-
if (data.worldX !== undefined && data.worldY !== undefined) {
|
|
200
|
-
return { x: data.worldX, y: data.worldY };
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const pos = this.#getNodePosition(data.nodeId);
|
|
204
|
-
if (!pos) return { x: 0, y: 0 };
|
|
205
|
-
|
|
206
|
-
if (data.element) {
|
|
207
|
-
const graphNode = data.element.closest('graph-node');
|
|
208
|
-
if (graphNode) {
|
|
209
|
-
const t = this.#getTransform();
|
|
210
|
-
const nodeRect = graphNode.getBoundingClientRect();
|
|
211
|
-
const socketRect = data.element.getBoundingClientRect();
|
|
212
|
-
// Divide by zoom to get unscaled offset within the node
|
|
213
|
-
const offsetX = (socketRect.left - nodeRect.left + socketRect.width / 2) / t.k;
|
|
214
|
-
const offsetY = (socketRect.top - nodeRect.top + socketRect.height / 2) / t.k;
|
|
215
|
-
return { x: pos.x + offsetX, y: pos.y + offsetY };
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Fallback: edge center
|
|
220
|
-
const size = this.#getNodeSize(data.nodeId);
|
|
221
|
-
if (!size) return { x: 0, y: 0 };
|
|
222
|
-
return {
|
|
223
|
-
x: data.side === 'output' ? pos.x + size.width : pos.x,
|
|
224
|
-
y: pos.y + size.height / 2,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Find nearest registered socket within snap distance
|
|
230
|
-
* Uses registered socket collection instead of DOM hit-testing
|
|
231
|
-
* @param {number} worldX - Pointer X in graph coordinates
|
|
232
|
-
* @param {number} worldY - Pointer Y in graph coordinates
|
|
233
|
-
* @returns {SocketData|null}
|
|
234
|
-
*/
|
|
235
|
-
#findNearestSocket(worldX, worldY) {
|
|
236
|
-
const SNAP_DISTANCE = 30; // pixels in graph space
|
|
237
|
-
let nearest = null;
|
|
238
|
-
let nearestDist = SNAP_DISTANCE;
|
|
239
|
-
|
|
240
|
-
for (const socket of this.#sockets) {
|
|
241
|
-
// Skip same socket as picked
|
|
242
|
-
if (socket === this.#picked) continue;
|
|
243
|
-
|
|
244
|
-
const pos = this.#getSocketWorldPosition(socket);
|
|
245
|
-
const dx = worldX - pos.x;
|
|
246
|
-
const dy = worldY - pos.y;
|
|
247
|
-
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
248
|
-
|
|
249
|
-
if (dist < nearestDist) {
|
|
250
|
-
nearestDist = dist;
|
|
251
|
-
nearest = socket;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return nearest;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Check if two sockets can be connected
|
|
260
|
-
* @param {SocketData} from
|
|
261
|
-
* @param {SocketData} to
|
|
262
|
-
* @returns {boolean}
|
|
263
|
-
*/
|
|
264
|
-
#canConnect(from, to) {
|
|
265
|
-
if (from.side === to.side) return false;
|
|
266
|
-
if (from.nodeId === to.nodeId) return false;
|
|
267
|
-
|
|
268
|
-
const fromNode = this.#editor.getNode(from.nodeId);
|
|
269
|
-
const toNode = this.#editor.getNode(to.nodeId);
|
|
270
|
-
if (!fromNode || !toNode) return false;
|
|
271
|
-
|
|
272
|
-
const isFromOutput = from.side === 'output';
|
|
273
|
-
const output = isFromOutput
|
|
274
|
-
? fromNode.outputs[from.key]
|
|
275
|
-
: toNode.outputs[to.key];
|
|
276
|
-
const input = isFromOutput
|
|
277
|
-
? toNode.inputs[to.key]
|
|
278
|
-
: fromNode.inputs[from.key];
|
|
279
|
-
|
|
280
|
-
if (!output || !input) return false;
|
|
281
|
-
|
|
282
|
-
return output.socket.isCompatibleWith(input.socket);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Create the connection
|
|
287
|
-
* @param {SocketData} from
|
|
288
|
-
* @param {SocketData} to
|
|
289
|
-
*/
|
|
290
|
-
#makeConnection(from, to) {
|
|
291
|
-
let sourceData = from.side === 'output' ? from : to;
|
|
292
|
-
let targetData = from.side === 'input' ? from : to;
|
|
293
|
-
|
|
294
|
-
const sourceNode = this.#editor.getNode(sourceData.nodeId);
|
|
295
|
-
const targetNode = this.#editor.getNode(targetData.nodeId);
|
|
296
|
-
if (!sourceNode || !targetNode) return;
|
|
297
|
-
|
|
298
|
-
const conn = new Connection(sourceNode, sourceData.key, targetNode, targetData.key);
|
|
299
|
-
this.#editor.addConnection(conn);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/** Cleanup */
|
|
303
|
-
destroy() {
|
|
304
|
-
window.removeEventListener('pointermove', this.#onMove);
|
|
305
|
-
window.removeEventListener('pointerup', this.#onUp);
|
|
306
|
-
}
|
|
307
|
-
}
|