project-graph-mcp 2.3.2 → 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/engine/AgentUICommands.js +0 -100
- package/vendor/symbiote-node/engine/Executor.js +0 -371
- package/vendor/symbiote-node/engine/Graph.js +0 -314
- package/vendor/symbiote-node/engine/GraphServer.js +0 -353
- package/vendor/symbiote-node/engine/HandlerLoader.js +0 -145
- package/vendor/symbiote-node/engine/History.js +0 -83
- package/vendor/symbiote-node/engine/Lifecycle.js +0 -118
- package/vendor/symbiote-node/engine/Persistence.js +0 -84
- package/vendor/symbiote-node/engine/Registry.js +0 -264
- package/vendor/symbiote-node/engine/SocketTypes.js +0 -79
- package/vendor/symbiote-node/engine/cli.js +0 -404
- package/vendor/symbiote-node/engine/index.js +0 -56
- package/vendor/symbiote-node/engine/nanoid.js +0 -28
- package/vendor/symbiote-node/engine/package.json +0 -26
- package/vendor/symbiote-node/engine/packs/ai/beat-detect.handler.js +0 -215
- package/vendor/symbiote-node/engine/packs/ai/content-adapt.handler.js +0 -238
- package/vendor/symbiote-node/engine/packs/ai/face-detect.handler.js +0 -287
- package/vendor/symbiote-node/engine/packs/ai/grok-generate.handler.js +0 -565
- package/vendor/symbiote-node/engine/packs/ai/kling-lipsync.handler.js +0 -414
- package/vendor/symbiote-node/engine/packs/ai/lesson-generate.handler.js +0 -343
- package/vendor/symbiote-node/engine/packs/ai/opencode.handler.js +0 -164
- package/vendor/symbiote-node/engine/packs/ai/replicate-lipsync.handler.js +0 -341
- package/vendor/symbiote-node/engine/packs/ai/tts.handler.js +0 -241
- package/vendor/symbiote-node/engine/packs/ai/whisper.handler.js +0 -191
- package/vendor/symbiote-node/engine/packs/data/db-query.handler.js +0 -67
- package/vendor/symbiote-node/engine/packs/data/news-accumulate.handler.js +0 -281
- package/vendor/symbiote-node/engine/packs/data/personas.handler.js +0 -160
- package/vendor/symbiote-node/engine/packs/data/prompt-loader.handler.js +0 -193
- package/vendor/symbiote-node/engine/packs/data/roles.handler.js +0 -216
- package/vendor/symbiote-node/engine/packs/data/rss-feed.handler.js +0 -244
- package/vendor/symbiote-node/engine/packs/debug/inject.handler.js +0 -52
- package/vendor/symbiote-node/engine/packs/flow/agent.handler.js +0 -73
- package/vendor/symbiote-node/engine/packs/flow/if.handler.js +0 -107
- package/vendor/symbiote-node/engine/packs/flow/loop.handler.js +0 -58
- package/vendor/symbiote-node/engine/packs/flow/merge.handler.js +0 -60
- package/vendor/symbiote-node/engine/packs/flow/retry.handler.js +0 -65
- package/vendor/symbiote-node/engine/packs/flow/switch.handler.js +0 -64
- package/vendor/symbiote-node/engine/packs/flow/wait-all.handler.js +0 -39
- package/vendor/symbiote-node/engine/packs/io/http-request.handler.js +0 -82
- package/vendor/symbiote-node/engine/packs/io/read-file.handler.js +0 -60
- package/vendor/symbiote-node/engine/packs/io/write-file.handler.js +0 -63
- package/vendor/symbiote-node/engine/packs/transform/anchor-match.handler.js +0 -494
- package/vendor/symbiote-node/engine/packs/transform/effects-skeleton.handler.js +0 -417
- package/vendor/symbiote-node/engine/packs/transform/json-parse.handler.js +0 -43
- package/vendor/symbiote-node/engine/packs/transform/lipsync-select.handler.js +0 -339
- package/vendor/symbiote-node/engine/packs/transform/riopla-adapt.handler.js +0 -432
- package/vendor/symbiote-node/engine/packs/transform/set.handler.js +0 -57
- package/vendor/symbiote-node/engine/packs/transform/template-builder.handler.js +0 -134
- package/vendor/symbiote-node/engine/packs/transform/template.handler.js +0 -79
- package/vendor/symbiote-node/engine/packs/transform/timeline-build.handler.js +0 -399
- package/vendor/symbiote-node/engine/packs/util/delay.handler.js +0 -39
- package/vendor/symbiote-node/engine/packs/util/log.handler.js +0 -44
- package/vendor/symbiote-node/engine/packs/video-pack.js +0 -323
- 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,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drag handler — pointer-based drag with zoom compensation
|
|
3
|
-
*
|
|
4
|
-
* Adapted from Rete.js area-plugin/drag.ts (86 LOC).
|
|
5
|
-
* Handles both canvas panning and node dragging.
|
|
6
|
-
*
|
|
7
|
-
* @module symbiote-node/interactions/Drag
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export class Drag {
|
|
11
|
-
/** @type {{ x: number, y: number }|null} */
|
|
12
|
-
#pointerStart = null;
|
|
13
|
-
|
|
14
|
-
/** @type {{ x: number, y: number }|null} */
|
|
15
|
-
#startPosition = null;
|
|
16
|
-
|
|
17
|
-
/** @type {function|null} */
|
|
18
|
-
#onTranslate = null;
|
|
19
|
-
|
|
20
|
-
/** @type {function|null} */
|
|
21
|
-
#onStart = null;
|
|
22
|
-
|
|
23
|
-
/** @type {function|null} */
|
|
24
|
-
#onDrop = null;
|
|
25
|
-
|
|
26
|
-
/** @type {function} */
|
|
27
|
-
#getZoom = () => 1;
|
|
28
|
-
|
|
29
|
-
/** @type {function} */
|
|
30
|
-
#getPosition = () => ({ x: 0, y: 0 });
|
|
31
|
-
|
|
32
|
-
/** @type {HTMLElement|null} */
|
|
33
|
-
#element = null;
|
|
34
|
-
|
|
35
|
-
/** @type {function|null} - optional hit-test before starting drag */
|
|
36
|
-
#shouldStart = null;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Initialize drag handler on element
|
|
40
|
-
* @param {HTMLElement} element - Element to attach drag to
|
|
41
|
-
* @param {object} config
|
|
42
|
-
* @param {function} config.getPosition - Returns current {x, y}
|
|
43
|
-
* @param {function} config.getZoom - Returns current zoom level
|
|
44
|
-
* @param {object} callbacks
|
|
45
|
-
* @param {function} callbacks.onStart - Called on drag start
|
|
46
|
-
* @param {function} callbacks.onTranslate - Called with (x, y) during drag
|
|
47
|
-
* @param {function} callbacks.onDrop - Called on drag end
|
|
48
|
-
*/
|
|
49
|
-
initialize(element, config, callbacks) {
|
|
50
|
-
this.#element = element;
|
|
51
|
-
this.#getPosition = config.getPosition;
|
|
52
|
-
this.#getZoom = config.getZoom;
|
|
53
|
-
this.#onStart = callbacks.onStart || null;
|
|
54
|
-
this.#onTranslate = callbacks.onTranslate;
|
|
55
|
-
this.#onDrop = callbacks.onDrop || null;
|
|
56
|
-
this.#shouldStart = callbacks.shouldStart || null;
|
|
57
|
-
|
|
58
|
-
element.style.touchAction = 'none';
|
|
59
|
-
element.addEventListener('pointerdown', this.#down);
|
|
60
|
-
window.addEventListener('pointermove', this.#move);
|
|
61
|
-
window.addEventListener('pointerup', this.#up);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#down = (e) => {
|
|
65
|
-
if (e.pointerType === 'mouse' && e.button !== 0) return;
|
|
66
|
-
// Skip if event originates from a socket (ConnectFlow handles those)
|
|
67
|
-
if (e.target.closest && e.target.closest('.sn-socket')) return;
|
|
68
|
-
// Optional hit-test: allow caller to reject drag (e.g. SVG perimeter check)
|
|
69
|
-
if (this.#shouldStart && !this.#shouldStart(e)) return;
|
|
70
|
-
e.stopPropagation();
|
|
71
|
-
this.#pointerStart = { x: e.pageX, y: e.pageY };
|
|
72
|
-
this.#startPosition = { ...this.#getPosition() };
|
|
73
|
-
if (this.#onStart) this.#onStart(e);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
#move = (e) => {
|
|
77
|
-
if (!this.#pointerStart || !this.#startPosition) return;
|
|
78
|
-
e.preventDefault();
|
|
79
|
-
const dx = e.pageX - this.#pointerStart.x;
|
|
80
|
-
const dy = e.pageY - this.#pointerStart.y;
|
|
81
|
-
const zoom = this.#getZoom();
|
|
82
|
-
const x = this.#startPosition.x + dx / zoom;
|
|
83
|
-
const y = this.#startPosition.y + dy / zoom;
|
|
84
|
-
if (this.#onTranslate) this.#onTranslate(x, y, e);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
#up = (e) => {
|
|
88
|
-
if (!this.#pointerStart) return;
|
|
89
|
-
this.#pointerStart = null;
|
|
90
|
-
this.#startPosition = null;
|
|
91
|
-
if (this.#onDrop) this.#onDrop(e);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/** Cleanup event listeners */
|
|
95
|
-
destroy() {
|
|
96
|
-
if (this.#element) {
|
|
97
|
-
this.#element.removeEventListener('pointerdown', this.#down);
|
|
98
|
-
}
|
|
99
|
-
window.removeEventListener('pointermove', this.#move);
|
|
100
|
-
window.removeEventListener('pointerup', this.#up);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Selector — multi-select manager for nodes and connections
|
|
3
|
-
*
|
|
4
|
-
* Handles single select, Ctrl/Meta+click accumulation,
|
|
5
|
-
* canvas deselect, and group translate of selected nodes.
|
|
6
|
-
*
|
|
7
|
-
* Adapted from Rete.js selectable extension (208 LOC).
|
|
8
|
-
* @module symbiote-node/interactions/Selector
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** @type {number} Minimum pointer movement to consider a drag (pixels) */
|
|
12
|
-
const TWITCH_THRESHOLD = 4;
|
|
13
|
-
|
|
14
|
-
export class Selector {
|
|
15
|
-
|
|
16
|
-
/** @type {Set<string>} */
|
|
17
|
-
#selectedNodes = new Set();
|
|
18
|
-
|
|
19
|
-
/** @type {Set<string>} */
|
|
20
|
-
#selectedConnections = new Set();
|
|
21
|
-
|
|
22
|
-
/** @type {function|null} */
|
|
23
|
-
#onChange = null;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {object} config
|
|
27
|
-
* @param {function} config.onChange - Called when selection changes: (nodes: Set, connections: Set)
|
|
28
|
-
*/
|
|
29
|
-
constructor(config = {}) {
|
|
30
|
-
this.#onChange = config.onChange || null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Select a node (single or accumulate with Ctrl/Meta)
|
|
35
|
-
* @param {string} nodeId
|
|
36
|
-
* @param {boolean} accumulate - Ctrl/Meta held
|
|
37
|
-
*/
|
|
38
|
-
selectNode(nodeId, accumulate = false) {
|
|
39
|
-
if (!accumulate) {
|
|
40
|
-
this.#selectedNodes.clear();
|
|
41
|
-
this.#selectedConnections.clear();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (this.#selectedNodes.has(nodeId) && accumulate) {
|
|
45
|
-
this.#selectedNodes.delete(nodeId);
|
|
46
|
-
} else {
|
|
47
|
-
this.#selectedNodes.add(nodeId);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
this.#notify();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Select a connection
|
|
55
|
-
* @param {string} connId
|
|
56
|
-
* @param {boolean} accumulate
|
|
57
|
-
*/
|
|
58
|
-
selectConnection(connId, accumulate = false) {
|
|
59
|
-
if (!accumulate) {
|
|
60
|
-
this.#selectedNodes.clear();
|
|
61
|
-
this.#selectedConnections.clear();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (this.#selectedConnections.has(connId) && accumulate) {
|
|
65
|
-
this.#selectedConnections.delete(connId);
|
|
66
|
-
} else {
|
|
67
|
-
this.#selectedConnections.add(connId);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this.#notify();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Deselect everything
|
|
75
|
-
*/
|
|
76
|
-
unselectAll() {
|
|
77
|
-
if (this.#selectedNodes.size === 0 && this.#selectedConnections.size === 0) return;
|
|
78
|
-
this.#selectedNodes.clear();
|
|
79
|
-
this.#selectedConnections.clear();
|
|
80
|
-
this.#notify();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @param {string} nodeId
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
*/
|
|
87
|
-
isNodeSelected(nodeId) {
|
|
88
|
-
return this.#selectedNodes.has(nodeId);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @param {string} connId
|
|
93
|
-
* @returns {boolean}
|
|
94
|
-
*/
|
|
95
|
-
isConnectionSelected(connId) {
|
|
96
|
-
return this.#selectedConnections.has(connId);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get all selected node IDs
|
|
101
|
-
* @returns {Set<string>}
|
|
102
|
-
*/
|
|
103
|
-
getSelectedNodes() {
|
|
104
|
-
return this.#selectedNodes;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Get all selected connection IDs
|
|
109
|
-
* @returns {Set<string>}
|
|
110
|
-
*/
|
|
111
|
-
getSelectedConnections() {
|
|
112
|
-
return this.#selectedConnections;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Check if pointer was a twitch (< 4px movement)
|
|
117
|
-
* @param {{ x: number, y: number }} start
|
|
118
|
-
* @param {{ x: number, y: number }} end
|
|
119
|
-
* @returns {boolean}
|
|
120
|
-
*/
|
|
121
|
-
static isTwitch(start, end) {
|
|
122
|
-
const dx = Math.abs(end.x - start.x);
|
|
123
|
-
const dy = Math.abs(end.y - start.y);
|
|
124
|
-
return dx < TWITCH_THRESHOLD && dy < TWITCH_THRESHOLD;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#notify() {
|
|
128
|
-
if (this.#onChange) {
|
|
129
|
-
this.#onChange(this.#selectedNodes, this.#selectedConnections);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SnapGrid — grid snapping for node positions
|
|
3
|
-
*
|
|
4
|
-
* Rounds coordinates to nearest grid cell.
|
|
5
|
-
* Supports dynamic (during drag) and static (on drop) modes.
|
|
6
|
-
*
|
|
7
|
-
* Adapted from Rete.js snap grid (62 LOC).
|
|
8
|
-
* @module symbiote-node/interactions/SnapGrid
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export class SnapGrid {
|
|
12
|
-
|
|
13
|
-
/** @type {number} */
|
|
14
|
-
#size;
|
|
15
|
-
|
|
16
|
-
/** @type {boolean} */
|
|
17
|
-
#dynamic;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {object} config
|
|
21
|
-
* @param {number} [config.size=16] - Grid cell size in pixels
|
|
22
|
-
* @param {boolean} [config.dynamic=true] - Snap during drag (true) or only on drop (false)
|
|
23
|
-
*/
|
|
24
|
-
constructor(config = {}) {
|
|
25
|
-
this.#size = config.size || 16;
|
|
26
|
-
this.#dynamic = config.dynamic !== false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Snap coordinates to nearest grid cell
|
|
31
|
-
* @param {number} x
|
|
32
|
-
* @param {number} y
|
|
33
|
-
* @returns {{ x: number, y: number }}
|
|
34
|
-
*/
|
|
35
|
-
snap(x, y) {
|
|
36
|
-
return {
|
|
37
|
-
x: Math.round(x / this.#size) * this.#size,
|
|
38
|
-
y: Math.round(y / this.#size) * this.#size,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Whether to snap during drag or only on drop
|
|
44
|
-
* @returns {boolean}
|
|
45
|
-
*/
|
|
46
|
-
get isDynamic() {
|
|
47
|
-
return this.#dynamic;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get grid size
|
|
52
|
-
* @returns {number}
|
|
53
|
-
*/
|
|
54
|
-
get size() {
|
|
55
|
-
return this.#size;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Update grid size
|
|
60
|
-
* @param {number} size
|
|
61
|
-
*/
|
|
62
|
-
setSize(size) {
|
|
63
|
-
this.#size = size;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zoom handler — wheel, touch pinch, and double-click zoom
|
|
3
|
-
*
|
|
4
|
-
* Adapted from Rete.js area-plugin/zoom.ts (123 LOC).
|
|
5
|
-
* Handles zoom relative to cursor/pinch center.
|
|
6
|
-
*
|
|
7
|
-
* @module symbiote-node/interactions/Zoom
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export class Zoom {
|
|
11
|
-
/** @type {PointerEvent[]} */
|
|
12
|
-
#pointers = [];
|
|
13
|
-
|
|
14
|
-
/** @type {{ cx: number, cy: number, distance: number }|null} */
|
|
15
|
-
#previous = null;
|
|
16
|
-
|
|
17
|
-
/** @type {HTMLElement|null} */
|
|
18
|
-
#container = null;
|
|
19
|
-
|
|
20
|
-
/** @type {HTMLElement|null} */
|
|
21
|
-
#content = null;
|
|
22
|
-
|
|
23
|
-
/** @type {function|null} */
|
|
24
|
-
#onZoom = null;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @param {number} [intensity=0.1] - Zoom sensitivity
|
|
28
|
-
*/
|
|
29
|
-
constructor(intensity = 0.1) {
|
|
30
|
-
/** @type {number} */
|
|
31
|
-
this.intensity = intensity;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Initialize zoom handler
|
|
36
|
-
* @param {HTMLElement} container - Outer container
|
|
37
|
-
* @param {HTMLElement} content - Inner content element (for getBoundingClientRect)
|
|
38
|
-
* @param {function} onZoom - Callback: (delta, ox, oy, source)
|
|
39
|
-
* @param {function} [getTransform] - Optional callback returning {x, y} to avoid getBoundingClientRect layout thrashing
|
|
40
|
-
*/
|
|
41
|
-
initialize(container, content, onZoom, getTransform = null) {
|
|
42
|
-
this.#container = container;
|
|
43
|
-
this.#content = content;
|
|
44
|
-
this.#onZoom = onZoom;
|
|
45
|
-
this.getTransform = getTransform;
|
|
46
|
-
|
|
47
|
-
container.addEventListener('wheel', this.#wheel, { passive: false });
|
|
48
|
-
container.addEventListener('pointerdown', this.#down);
|
|
49
|
-
container.addEventListener('dblclick', this.#dblclick);
|
|
50
|
-
window.addEventListener('pointermove', this.#move);
|
|
51
|
-
window.addEventListener('pointerup', this.#up);
|
|
52
|
-
window.addEventListener('pointercancel', this.#up);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
#getRect() {
|
|
56
|
-
if (this.getTransform) {
|
|
57
|
-
const c = this.#container.getBoundingClientRect();
|
|
58
|
-
const t = this.getTransform();
|
|
59
|
-
return { left: c.left + t.x, top: c.top + t.y };
|
|
60
|
-
}
|
|
61
|
-
return this.#content.getBoundingClientRect();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#wheel = (e) => {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
const rect = this.#getRect();
|
|
67
|
-
// Normalize delta: trackpads send small frequent deltas, mice send large ones
|
|
68
|
-
const absDelta = Math.min(Math.abs(e.deltaY), 10) / 10;
|
|
69
|
-
const sign = e.deltaY < 0 ? 1 : -1;
|
|
70
|
-
const delta = sign * this.intensity * absDelta;
|
|
71
|
-
const ox = (rect.left - e.clientX) * delta;
|
|
72
|
-
const oy = (rect.top - e.clientY) * delta;
|
|
73
|
-
this.#onZoom(delta, ox, oy, 'wheel');
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
#dblclick = (e) => {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
const rect = this.#getRect();
|
|
79
|
-
const delta = 4 * this.intensity;
|
|
80
|
-
const ox = (rect.left - e.clientX) * delta;
|
|
81
|
-
const oy = (rect.top - e.clientY) * delta;
|
|
82
|
-
this.#onZoom(delta, ox, oy, 'dblclick');
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
#down = (e) => {
|
|
86
|
-
this.#pointers.push(e);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
#move = (e) => {
|
|
90
|
-
this.#pointers = this.#pointers.map(p =>
|
|
91
|
-
p.pointerId === e.pointerId ? e : p
|
|
92
|
-
);
|
|
93
|
-
if (this.#pointers.length < 2) return;
|
|
94
|
-
|
|
95
|
-
const [p1, p2] = this.#pointers;
|
|
96
|
-
const distance = Math.sqrt(
|
|
97
|
-
(p1.clientX - p2.clientX) ** 2 + (p1.clientY - p2.clientY) ** 2
|
|
98
|
-
);
|
|
99
|
-
const cx = (p1.clientX + p2.clientX) / 2;
|
|
100
|
-
const cy = (p1.clientY + p2.clientY) / 2;
|
|
101
|
-
|
|
102
|
-
if (this.#previous && this.#previous.distance > 0) {
|
|
103
|
-
const rect = this.#getRect();
|
|
104
|
-
const delta = distance / this.#previous.distance - 1;
|
|
105
|
-
const ox = (rect.left - cx) * delta;
|
|
106
|
-
const oy = (rect.top - cy) * delta;
|
|
107
|
-
this.#onZoom(
|
|
108
|
-
delta,
|
|
109
|
-
ox - (this.#previous.cx - cx),
|
|
110
|
-
oy - (this.#previous.cy - cy),
|
|
111
|
-
'touch'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
this.#previous = { cx, cy, distance };
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
#up = (e) => {
|
|
118
|
-
this.#previous = null;
|
|
119
|
-
this.#pointers = this.#pointers.filter(p => p.pointerId !== e.pointerId);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Whether a multi-touch zoom is in progress
|
|
124
|
-
* @returns {boolean}
|
|
125
|
-
*/
|
|
126
|
-
isTranslating() {
|
|
127
|
-
return this.#pointers.length >= 2;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Cleanup event listeners */
|
|
131
|
-
destroy() {
|
|
132
|
-
if (!this.#container) return;
|
|
133
|
-
this.#container.removeEventListener('wheel', this.#wheel);
|
|
134
|
-
this.#container.removeEventListener('pointerdown', this.#down);
|
|
135
|
-
this.#container.removeEventListener('dblclick', this.#dblclick);
|
|
136
|
-
window.removeEventListener('pointermove', this.#move);
|
|
137
|
-
window.removeEventListener('pointerup', this.#up);
|
|
138
|
-
window.removeEventListener('pointercancel', this.#up);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview ActionZone styles
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { css } from '@symbiotejs/symbiote';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Size of the triangular zone (px)
|
|
9
|
-
*/
|
|
10
|
-
export const ZONE_SIZE = 16;
|
|
11
|
-
|
|
12
|
-
export const styles = css`
|
|
13
|
-
action-zone {
|
|
14
|
-
position: absolute;
|
|
15
|
-
width: ${ZONE_SIZE}px;
|
|
16
|
-
height: ${ZONE_SIZE}px;
|
|
17
|
-
z-index: 100;
|
|
18
|
-
cursor: crosshair;
|
|
19
|
-
opacity: 0;
|
|
20
|
-
transition: opacity 0.15s ease;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
|
|
25
|
-
&:hover {
|
|
26
|
-
opacity: 1 !important;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&[dragging] {
|
|
30
|
-
opacity: 1 !important;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* Corner positioning */
|
|
34
|
-
&[corner="tl"] {
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&[corner="tr"] {
|
|
40
|
-
top: 0;
|
|
41
|
-
right: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&[corner="bl"] {
|
|
45
|
-
bottom: 0;
|
|
46
|
-
left: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&[corner="br"] {
|
|
50
|
-
bottom: 0;
|
|
51
|
-
right: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.zone-icon {
|
|
55
|
-
width: 100%;
|
|
56
|
-
height: 100%;
|
|
57
|
-
color: var(--layout-highlight, #888);
|
|
58
|
-
opacity: 0.6;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* Rotate triangle based on corner */
|
|
62
|
-
&[corner="tl"] .zone-icon {
|
|
63
|
-
transform: rotate(0deg);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&[corner="tr"] .zone-icon {
|
|
67
|
-
transform: rotate(90deg);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&[corner="br"] .zone-icon {
|
|
71
|
-
transform: rotate(180deg);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&[corner="bl"] .zone-icon {
|
|
75
|
-
transform: rotate(270deg);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&[dragging] .zone-icon {
|
|
79
|
-
color: var(--layout-highlight, #aaa);
|
|
80
|
-
opacity: 1;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* Parent hover rule */
|
|
85
|
-
layout-node[node-type="panel"]:hover action-zone {
|
|
86
|
-
opacity: 0.5;
|
|
87
|
-
}
|
|
88
|
-
`;
|