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,22 +0,0 @@
|
|
|
1
|
-
import { html } from '@symbiotejs/symbiote';
|
|
2
|
-
|
|
3
|
-
export const template = html`
|
|
4
|
-
<div ref="canvasContainer" class="canvas-container" tabindex="0">
|
|
5
|
-
<canvas ref="connCanvas" class="sn-conn-canvas"></canvas>
|
|
6
|
-
<div ref="content" class="content">
|
|
7
|
-
<svg ref="connections" class="sn-connections"></svg>
|
|
8
|
-
<div ref="framesLayer" class="sn-frames"></div>
|
|
9
|
-
<div ref="nodesLayer" class="sn-nodes"></div>
|
|
10
|
-
<svg ref="pseudoSvg" class="pseudo-svg"></svg>
|
|
11
|
-
<quick-toolbar ref="quickToolbar" hidden></quick-toolbar>
|
|
12
|
-
</div>
|
|
13
|
-
<context-menu ref="contextMenu" hidden></context-menu>
|
|
14
|
-
<node-minimap ref="minimap" hidden></node-minimap>
|
|
15
|
-
<button ref="minimapToggle" class="sn-minimap-toggle" title="Toggle minimap">
|
|
16
|
-
<span class="material-symbols-outlined">map</span>
|
|
17
|
-
</button>
|
|
18
|
-
<node-search ref="nodeSearch" hidden></node-search>
|
|
19
|
-
<graph-breadcrumb ref="breadcrumb" hidden></graph-breadcrumb>
|
|
20
|
-
</div>
|
|
21
|
-
<inspector-panel ref="inspector" hidden></inspector-panel>
|
|
22
|
-
`;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeSearch styles
|
|
3
|
-
* @module symbiote-node/canvas/NodeSearch.css
|
|
4
|
-
*/
|
|
5
|
-
import { css } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
export const styles = css`
|
|
8
|
-
node-search {
|
|
9
|
-
position: absolute;
|
|
10
|
-
top: 16px;
|
|
11
|
-
left: 50%;
|
|
12
|
-
transform: translateX(-50%);
|
|
13
|
-
width: 360px;
|
|
14
|
-
z-index: 200;
|
|
15
|
-
font-family: var(--sn-font, 'Inter', sans-serif);
|
|
16
|
-
|
|
17
|
-
&[hidden] {
|
|
18
|
-
display: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
& .search-bar {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
gap: 8px;
|
|
25
|
-
padding: 8px 14px;
|
|
26
|
-
background: var(--sn-node-bg, #2a2a3e);
|
|
27
|
-
border: 1px solid var(--sn-node-border, rgba(255,255,255,0.12));
|
|
28
|
-
border-radius: 10px;
|
|
29
|
-
box-shadow: 0 8px 32px var(--sn-shadow-color, rgba(0,0,0,0.4));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
& .search-icon {
|
|
33
|
-
font-size: 18px;
|
|
34
|
-
color: var(--sn-text-dim, #888);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
& .search-input {
|
|
38
|
-
flex: 1;
|
|
39
|
-
background: none;
|
|
40
|
-
border: none;
|
|
41
|
-
outline: none;
|
|
42
|
-
color: var(--sn-text, #d4d4d4);
|
|
43
|
-
font-size: 14px;
|
|
44
|
-
font-family: inherit;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
& .search-input::placeholder {
|
|
48
|
-
color: var(--sn-text-dim, #666);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
& .search-hint {
|
|
52
|
-
font-size: 11px;
|
|
53
|
-
color: var(--sn-text-dim, #555);
|
|
54
|
-
padding: 2px 6px;
|
|
55
|
-
border: 1px solid var(--sn-node-border, rgba(255,255,255,0.08));
|
|
56
|
-
border-radius: 4px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
& .search-results {
|
|
60
|
-
margin-top: 4px;
|
|
61
|
-
background: var(--sn-node-bg, #2a2a3e);
|
|
62
|
-
border-radius: 8px;
|
|
63
|
-
border: 1px solid var(--sn-node-border, rgba(255,255,255,0.08));
|
|
64
|
-
box-shadow: 0 4px 16px var(--sn-shadow-color, rgba(0,0,0,0.3));
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
max-height: 300px;
|
|
67
|
-
overflow-y: auto;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
& .search-results:empty {
|
|
71
|
-
display: none;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.search-result {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
justify-content: space-between;
|
|
79
|
-
padding: 8px 14px;
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
color: var(--sn-text, #d4d4d4);
|
|
82
|
-
font-size: 13px;
|
|
83
|
-
transition: background 0.1s;
|
|
84
|
-
|
|
85
|
-
&:hover {
|
|
86
|
-
background: color-mix(in srgb, currentColor 6%, transparent);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.search-result-type {
|
|
91
|
-
font-size: 11px;
|
|
92
|
-
color: var(--sn-text-dim, #888);
|
|
93
|
-
padding: 1px 6px;
|
|
94
|
-
border-radius: 4px;
|
|
95
|
-
background: color-mix(in srgb, currentColor 5%, transparent);
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeSearch — omnibox for searching and focusing nodes
|
|
3
|
-
*
|
|
4
|
-
* Ctrl+F or / to open. Type to filter by label, type, category.
|
|
5
|
-
* Click result to select and center viewport on that node.
|
|
6
|
-
* Escape to close.
|
|
7
|
-
*
|
|
8
|
-
* @module symbiote-node/canvas/NodeSearch
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import Symbiote from '@symbiotejs/symbiote';
|
|
12
|
-
import { template, searchResultTemplate } from './NodeSearch.tpl.js';
|
|
13
|
-
import { styles } from './NodeSearch.css.js';
|
|
14
|
-
|
|
15
|
-
export class NodeSearch extends Symbiote {
|
|
16
|
-
|
|
17
|
-
init$ = {
|
|
18
|
-
query: '',
|
|
19
|
-
results: [],
|
|
20
|
-
isOpen: false,
|
|
21
|
-
onResultClick: (e) => {
|
|
22
|
-
const item = e.target.closest('.search-result');
|
|
23
|
-
if (item?.dataset?.nodeId) {
|
|
24
|
-
this.#handleResultClick(item.dataset.nodeId);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** @type {function|null} */
|
|
30
|
-
#getNodes = null;
|
|
31
|
-
|
|
32
|
-
/** @type {function|null} */
|
|
33
|
-
#onSelect = null;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Configure search
|
|
37
|
-
* @param {object} options
|
|
38
|
-
* @param {function} options.getNodes - returns array of { id, label, type, category }
|
|
39
|
-
* @param {function} options.onSelect - called with nodeId when a result is clicked
|
|
40
|
-
*/
|
|
41
|
-
configure(options) {
|
|
42
|
-
this.#getNodes = options.getNodes;
|
|
43
|
-
this.#onSelect = options.onSelect;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Open search panel */
|
|
47
|
-
open() {
|
|
48
|
-
this.$.isOpen = true;
|
|
49
|
-
requestAnimationFrame(() => {
|
|
50
|
-
const input = this.querySelector('.search-input');
|
|
51
|
-
if (input) input.focus();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
close() {
|
|
56
|
-
this.$.isOpen = false;
|
|
57
|
-
this.$.query = '';
|
|
58
|
-
this.$.results = [];
|
|
59
|
-
const input = this.querySelector('.search-input');
|
|
60
|
-
if (input) input.value = '';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Toggle open/close */
|
|
64
|
-
toggle() {
|
|
65
|
-
if (this.$.isOpen) this.close();
|
|
66
|
-
else this.open();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
#search(query) {
|
|
70
|
-
if (!this.#getNodes) return;
|
|
71
|
-
const nodes = this.#getNodes();
|
|
72
|
-
const q = query.toLowerCase();
|
|
73
|
-
const results = nodes.filter(n =>
|
|
74
|
-
n.label.toLowerCase().includes(q) ||
|
|
75
|
-
(n.type && n.type.toLowerCase().includes(q)) ||
|
|
76
|
-
(n.category && n.category.toLowerCase().includes(q))
|
|
77
|
-
).slice(0, 10).map(n => ({
|
|
78
|
-
id: n.id,
|
|
79
|
-
label: n.label,
|
|
80
|
-
type: n.type || 'default',
|
|
81
|
-
category: n.category || 'default',
|
|
82
|
-
}));
|
|
83
|
-
this.$.results = results;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
#handleResultClick(nodeId) {
|
|
87
|
-
if (this.#onSelect) this.#onSelect(nodeId);
|
|
88
|
-
this.close();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
renderCallback() {
|
|
92
|
-
this.sub('isOpen', (val) => {
|
|
93
|
-
this.toggleAttribute('hidden', !val);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
this.sub('query', (q) => {
|
|
97
|
-
if (!q || q.length < 1) {
|
|
98
|
-
this.$.results = [];
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.#search(q);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
onSearchInput(e) {
|
|
106
|
-
this.$.query = e.target.value;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
onSearchKeydown(e) {
|
|
110
|
-
if (e.key === 'Escape') {
|
|
111
|
-
e.stopPropagation();
|
|
112
|
-
this.close();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Result item for itemize
|
|
120
|
-
class SearchResultItem extends Symbiote {
|
|
121
|
-
id = '';
|
|
122
|
-
label = '';
|
|
123
|
-
type = '';
|
|
124
|
-
category = '';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
SearchResultItem.template = searchResultTemplate;
|
|
128
|
-
SearchResultItem.reg('search-result-item');
|
|
129
|
-
|
|
130
|
-
NodeSearch.template = template;
|
|
131
|
-
NodeSearch.rootStyles = styles;
|
|
132
|
-
NodeSearch.reg('node-search');
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeSearch template
|
|
3
|
-
* @module symbiote-node/canvas/NodeSearch.tpl
|
|
4
|
-
*/
|
|
5
|
-
import { html } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
export const template = html`
|
|
8
|
-
<div class="search-bar" ${{ onkeydown: 'onSearchKeydown' }}>
|
|
9
|
-
<span class="material-symbols-outlined search-icon">search</span>
|
|
10
|
-
<input class="search-input" type="text" placeholder="Search nodes..." ${{ oninput: 'onSearchInput' }} />
|
|
11
|
-
<span class="search-hint">Esc</span>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="search-results" ${{ itemize: 'results', 'item-tag': 'search-result-item' }}></div>
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
export const searchResultTemplate = html`
|
|
17
|
-
<div class="search-result" data-node-id="{{id}}" ${{ onclick: '^onResultClick' }}>
|
|
18
|
-
<span class="search-result-label">{{label}}</span>
|
|
19
|
-
<span class="search-result-type">{{type}}</span>
|
|
20
|
-
</div>
|
|
21
|
-
`;
|