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.
Files changed (226) hide show
  1. package/package.json +3 -2
  2. package/src/analysis/analysis-cache.ctx +9 -0
  3. package/src/analysis/analysis-cache.js +1 -1
  4. package/src/analysis/complexity.ctx +6 -0
  5. package/src/analysis/complexity.js +1 -1
  6. package/src/analysis/custom-rules.ctx +14 -0
  7. package/src/analysis/custom-rules.js +1 -1
  8. package/src/analysis/db-analysis.ctx +7 -0
  9. package/src/analysis/db-analysis.js +1 -1
  10. package/src/analysis/dead-code.ctx +6 -0
  11. package/src/analysis/dead-code.js +1 -1
  12. package/src/analysis/full-analysis.ctx +9 -0
  13. package/src/analysis/full-analysis.js +1 -1
  14. package/src/analysis/jsdoc-checker.ctx +10 -0
  15. package/src/analysis/jsdoc-checker.js +1 -1
  16. package/src/analysis/jsdoc-generator.ctx +9 -0
  17. package/src/analysis/jsdoc-generator.js +1 -1
  18. package/src/analysis/large-files.ctx +6 -0
  19. package/src/analysis/large-files.js +1 -1
  20. package/src/analysis/outdated-patterns.ctx +7 -0
  21. package/src/analysis/outdated-patterns.js +1 -1
  22. package/src/analysis/similar-functions.ctx +6 -0
  23. package/src/analysis/similar-functions.js +1 -1
  24. package/src/analysis/test-annotations.ctx +11 -0
  25. package/src/analysis/test-annotations.js +1 -1
  26. package/src/analysis/type-checker.ctx +6 -0
  27. package/src/analysis/type-checker.js +1 -1
  28. package/src/analysis/undocumented.ctx +8 -0
  29. package/src/analysis/undocumented.js +1 -1
  30. package/src/cli/cli-handlers.ctx +7 -0
  31. package/src/cli/cli-handlers.js +1 -1
  32. package/src/cli/cli.ctx +6 -0
  33. package/src/cli/cli.js +1 -1
  34. package/src/compact/ai-context.ctx +6 -0
  35. package/src/compact/ai-context.js +1 -1
  36. package/src/compact/compact-migrate.ctx +8 -0
  37. package/src/compact/compact-migrate.js +1 -1
  38. package/src/compact/compact.ctx +11 -0
  39. package/src/compact/compact.js +1 -1
  40. package/src/compact/compress.ctx +7 -0
  41. package/src/compact/compress.js +1 -1
  42. package/src/compact/ctx-resolver.ctx +2 -0
  43. package/src/compact/ctx-resolver.js +1 -1
  44. package/src/compact/ctx-to-jsdoc.ctx +11 -0
  45. package/src/compact/ctx-to-jsdoc.js +1 -1
  46. package/src/compact/doc-dialect.ctx +11 -0
  47. package/src/compact/doc-dialect.js +2 -2
  48. package/src/compact/expand.ctx +14 -0
  49. package/src/compact/expand.js +1 -1
  50. package/src/compact/framework-references.ctx +7 -0
  51. package/src/compact/framework-references.js +1 -1
  52. package/src/compact/instructions.ctx +6 -0
  53. package/src/compact/instructions.js +1 -1
  54. package/src/compact/jsdoc-builder.ctx +4 -0
  55. package/src/compact/jsdoc-builder.js +1 -1
  56. package/src/compact/mode-config.ctx +8 -0
  57. package/src/compact/mode-config.js +1 -1
  58. package/src/compact/split-declarations.ctx +6 -0
  59. package/src/compact/split-declarations.js +1 -1
  60. package/src/compact/validate-pipeline.ctx +12 -0
  61. package/src/compact/validate-pipeline.js +1 -1
  62. package/src/core/event-bus.ctx +9 -0
  63. package/src/core/event-bus.js +1 -1
  64. package/src/core/file-walker.ctx +1 -0
  65. package/src/core/file-walker.js +1 -1
  66. package/src/core/filters.ctx +12 -0
  67. package/src/core/filters.js +1 -1
  68. package/src/core/graph-builder.ctx +7 -0
  69. package/src/core/graph-builder.js +1 -1
  70. package/src/core/parser.ctx +12 -0
  71. package/src/core/parser.js +1 -1
  72. package/src/core/utils.ctx +1 -0
  73. package/src/core/utils.js +1 -1
  74. package/src/core/workspace.ctx +7 -0
  75. package/src/core/workspace.js +1 -1
  76. package/src/lang/lang-go.ctx +8 -0
  77. package/src/lang/lang-go.js +1 -1
  78. package/src/lang/lang-python.ctx +5 -0
  79. package/src/lang/lang-python.js +1 -1
  80. package/src/lang/lang-sql.ctx +10 -0
  81. package/src/lang/lang-sql.js +1 -1
  82. package/src/lang/lang-typescript.ctx +6 -0
  83. package/src/lang/lang-typescript.js +1 -1
  84. package/src/lang/lang-utils.ctx +5 -0
  85. package/src/lang/lang-utils.js +1 -1
  86. package/src/mcp/mcp-server.ctx +6 -0
  87. package/src/mcp/mcp-server.js +1 -1
  88. package/src/mcp/tool-defs.ctx +2 -0
  89. package/src/mcp/tool-defs.js +1 -1
  90. package/src/mcp/tools.ctx +13 -0
  91. package/src/mcp/tools.js +1 -1
  92. package/src/network/backend-lifecycle.ctx +10 -0
  93. package/src/network/backend-lifecycle.js +1 -1
  94. package/src/network/backend.ctx +5 -0
  95. package/src/network/backend.js +1 -1
  96. package/src/network/local-gateway.ctx +9 -0
  97. package/src/network/local-gateway.js +1 -1
  98. package/src/network/mdns.ctx +6 -0
  99. package/src/network/mdns.js +1 -1
  100. package/src/network/server.ctx +2 -0
  101. package/src/network/server.js +2 -2
  102. package/src/network/web-server.ctx +17 -0
  103. package/src/network/web-server.js +2 -2
  104. package/web/follow-controller.js +94 -25
  105. package/web/panels/dep-graph.js +207 -21
  106. package/project-graph-mcp-2.3.0.tgz +0 -0
  107. package/vendor/symbiote-node/CHANGELOG.md +0 -31
  108. package/vendor/symbiote-node/LICENSE +0 -21
  109. package/vendor/symbiote-node/README.md +0 -206
  110. package/vendor/symbiote-node/canvas/AutoLayout.js +0 -725
  111. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.css.js +0 -73
  112. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.js +0 -93
  113. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.tpl.js +0 -9
  114. package/vendor/symbiote-node/canvas/CanvasConnectionRenderer.js +0 -962
  115. package/vendor/symbiote-node/canvas/ConnectionRenderer.js +0 -1468
  116. package/vendor/symbiote-node/canvas/FlowSimulator.js +0 -323
  117. package/vendor/symbiote-node/canvas/ForceLayout.js +0 -189
  118. package/vendor/symbiote-node/canvas/ForceWorker.js +0 -1325
  119. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.css.js +0 -97
  120. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.js +0 -176
  121. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.tpl.js +0 -12
  122. package/vendor/symbiote-node/canvas/LODManager.js +0 -88
  123. package/vendor/symbiote-node/canvas/Minimap/Minimap.css.js +0 -71
  124. package/vendor/symbiote-node/canvas/Minimap/Minimap.js +0 -207
  125. package/vendor/symbiote-node/canvas/Minimap/Minimap.tpl.js +0 -9
  126. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.css.js +0 -261
  127. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.js +0 -1840
  128. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.tpl.js +0 -22
  129. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.css.js +0 -97
  130. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.js +0 -132
  131. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.tpl.js +0 -21
  132. package/vendor/symbiote-node/canvas/NodeViewManager.js +0 -584
  133. package/vendor/symbiote-node/canvas/PinExpansion.js +0 -131
  134. package/vendor/symbiote-node/canvas/PseudoConnection.js +0 -80
  135. package/vendor/symbiote-node/canvas/SubgraphManager.js +0 -201
  136. package/vendor/symbiote-node/canvas/SubgraphRouter.js +0 -443
  137. package/vendor/symbiote-node/canvas/ViewportActions.js +0 -446
  138. package/vendor/symbiote-node/core/Connection.js +0 -45
  139. package/vendor/symbiote-node/core/Editor.js +0 -451
  140. package/vendor/symbiote-node/core/Frame.js +0 -31
  141. package/vendor/symbiote-node/core/GraphMermaid.js +0 -348
  142. package/vendor/symbiote-node/core/GraphText.js +0 -210
  143. package/vendor/symbiote-node/core/Node.js +0 -143
  144. package/vendor/symbiote-node/core/Portal.js +0 -104
  145. package/vendor/symbiote-node/core/Socket.js +0 -185
  146. package/vendor/symbiote-node/core/SubgraphNode.js +0 -125
  147. package/vendor/symbiote-node/index.js +0 -103
  148. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.css.js +0 -361
  149. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.js +0 -332
  150. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.tpl.js +0 -96
  151. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.css.js +0 -104
  152. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.js +0 -133
  153. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.tpl.js +0 -33
  154. package/vendor/symbiote-node/interactions/ConnectFlow.js +0 -307
  155. package/vendor/symbiote-node/interactions/Drag.js +0 -102
  156. package/vendor/symbiote-node/interactions/Selector.js +0 -132
  157. package/vendor/symbiote-node/interactions/SnapGrid.js +0 -65
  158. package/vendor/symbiote-node/interactions/Zoom.js +0 -140
  159. package/vendor/symbiote-node/layout/ActionZone/ActionZone.css.js +0 -88
  160. package/vendor/symbiote-node/layout/ActionZone/ActionZone.js +0 -254
  161. package/vendor/symbiote-node/layout/ActionZone/ActionZone.tpl.js +0 -11
  162. package/vendor/symbiote-node/layout/Layout/Layout.css.js +0 -88
  163. package/vendor/symbiote-node/layout/Layout/Layout.js +0 -622
  164. package/vendor/symbiote-node/layout/Layout/Layout.tpl.js +0 -25
  165. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.css.js +0 -293
  166. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.js +0 -467
  167. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.tpl.js +0 -33
  168. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.css.js +0 -46
  169. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.js +0 -102
  170. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.tpl.js +0 -6
  171. package/vendor/symbiote-node/layout/LayoutRouter/LayoutRouter.js +0 -156
  172. package/vendor/symbiote-node/layout/LayoutRouter/routerSync.js +0 -250
  173. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.css.js +0 -379
  174. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.js +0 -263
  175. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.tpl.js +0 -20
  176. package/vendor/symbiote-node/layout/LayoutSidebar/SidebarSection.js +0 -183
  177. package/vendor/symbiote-node/layout/LayoutTree.js +0 -246
  178. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.css.js +0 -43
  179. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.js +0 -89
  180. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.tpl.js +0 -14
  181. package/vendor/symbiote-node/layout/index.js +0 -16
  182. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.css.js +0 -61
  183. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.js +0 -79
  184. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.tpl.js +0 -19
  185. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.css.js +0 -41
  186. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.js +0 -24
  187. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.tpl.js +0 -16
  188. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.css.js +0 -65
  189. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.js +0 -29
  190. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.tpl.js +0 -13
  191. package/vendor/symbiote-node/node/GraphNode/GraphNode.css.js +0 -683
  192. package/vendor/symbiote-node/node/GraphNode/GraphNode.js +0 -92
  193. package/vendor/symbiote-node/node/GraphNode/GraphNode.tpl.js +0 -17
  194. package/vendor/symbiote-node/node/NodeSocket/NodeSocket.js +0 -25
  195. package/vendor/symbiote-node/node/NodeSocket/NodeSocket.tpl.js +0 -7
  196. package/vendor/symbiote-node/node/PortItem/PortItem.css.js +0 -90
  197. package/vendor/symbiote-node/node/PortItem/PortItem.js +0 -87
  198. package/vendor/symbiote-node/node/PortItem/PortItem.tpl.js +0 -10
  199. package/vendor/symbiote-node/package.json +0 -59
  200. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.css.js +0 -143
  201. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.js +0 -131
  202. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.tpl.js +0 -16
  203. package/vendor/symbiote-node/plugins/History.js +0 -384
  204. package/vendor/symbiote-node/plugins/Readonly.js +0 -59
  205. package/vendor/symbiote-node/shapes/CircleShape.js +0 -80
  206. package/vendor/symbiote-node/shapes/CommentShape.js +0 -35
  207. package/vendor/symbiote-node/shapes/DiamondShape.js +0 -115
  208. package/vendor/symbiote-node/shapes/NodeShape.js +0 -80
  209. package/vendor/symbiote-node/shapes/PillShape.js +0 -91
  210. package/vendor/symbiote-node/shapes/RectShape.js +0 -72
  211. package/vendor/symbiote-node/shapes/SVGShape.js +0 -494
  212. package/vendor/symbiote-node/shapes/index.js +0 -53
  213. package/vendor/symbiote-node/themes/Palette.js +0 -32
  214. package/vendor/symbiote-node/themes/Skin.js +0 -113
  215. package/vendor/symbiote-node/themes/Theme.js +0 -84
  216. package/vendor/symbiote-node/themes/carbon.js +0 -137
  217. package/vendor/symbiote-node/themes/dark.js +0 -137
  218. package/vendor/symbiote-node/themes/ebook.js +0 -138
  219. package/vendor/symbiote-node/themes/grey.js +0 -137
  220. package/vendor/symbiote-node/themes/light.js +0 -137
  221. package/vendor/symbiote-node/themes/neon.js +0 -138
  222. package/vendor/symbiote-node/themes/pcb.js +0 -273
  223. package/vendor/symbiote-node/themes/synthwave.js +0 -137
  224. package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.css.js +0 -86
  225. package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.js +0 -128
  226. 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
- `;