@nocturnium/svelte-ide 1.0.0-rc.1

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +251 -0
  3. package/dist/components/agents/AgentActivityPanel.svelte +565 -0
  4. package/dist/components/agents/AgentActivityPanel.svelte.d.ts +24 -0
  5. package/dist/components/agents/AgentAvatar.svelte +417 -0
  6. package/dist/components/agents/AgentAvatar.svelte.d.ts +23 -0
  7. package/dist/components/agents/AgentCursor.svelte +224 -0
  8. package/dist/components/agents/AgentCursor.svelte.d.ts +35 -0
  9. package/dist/components/agents/AgentPresenceBar.svelte +261 -0
  10. package/dist/components/agents/AgentPresenceBar.svelte.d.ts +20 -0
  11. package/dist/components/agents/index.d.ts +4 -0
  12. package/dist/components/agents/index.js +5 -0
  13. package/dist/components/ai/AIConversationList.svelte +524 -0
  14. package/dist/components/ai/AIConversationList.svelte.d.ts +17 -0
  15. package/dist/components/ai/AIEditPreview.svelte +132 -0
  16. package/dist/components/ai/AIEditPreview.svelte.d.ts +8 -0
  17. package/dist/components/ai/AIInlineEdit.svelte +155 -0
  18. package/dist/components/ai/AIInlineEdit.svelte.d.ts +10 -0
  19. package/dist/components/ai/AIMessage.svelte +239 -0
  20. package/dist/components/ai/AIMessage.svelte.d.ts +13 -0
  21. package/dist/components/ai/AIMessageActions.svelte +176 -0
  22. package/dist/components/ai/AIMessageActions.svelte.d.ts +12 -0
  23. package/dist/components/ai/AIMessageContent.svelte +355 -0
  24. package/dist/components/ai/AIMessageContent.svelte.d.ts +7 -0
  25. package/dist/components/ai/AIPanel.svelte +561 -0
  26. package/dist/components/ai/AIPanel.svelte.d.ts +7 -0
  27. package/dist/components/ai/AISuggestionWidget.svelte +132 -0
  28. package/dist/components/ai/AISuggestionWidget.svelte.d.ts +10 -0
  29. package/dist/components/ai/AIToolCallDisplay.svelte +317 -0
  30. package/dist/components/ai/AIToolCallDisplay.svelte.d.ts +12 -0
  31. package/dist/components/ai/index.d.ts +9 -0
  32. package/dist/components/ai/index.js +10 -0
  33. package/dist/components/core/Avatar.svelte +110 -0
  34. package/dist/components/core/Avatar.svelte.d.ts +12 -0
  35. package/dist/components/core/Badge.svelte +98 -0
  36. package/dist/components/core/Badge.svelte.d.ts +11 -0
  37. package/dist/components/core/Button.svelte +175 -0
  38. package/dist/components/core/Button.svelte.d.ts +18 -0
  39. package/dist/components/core/ConnectionStatus.svelte +294 -0
  40. package/dist/components/core/ConnectionStatus.svelte.d.ts +20 -0
  41. package/dist/components/core/ContextMenu.svelte +176 -0
  42. package/dist/components/core/ContextMenu.svelte.d.ts +19 -0
  43. package/dist/components/core/ErrorBoundary.svelte +277 -0
  44. package/dist/components/core/ErrorBoundary.svelte.d.ts +23 -0
  45. package/dist/components/core/Icon.svelte +107 -0
  46. package/dist/components/core/Icon.svelte.d.ts +8 -0
  47. package/dist/components/core/Input.svelte +138 -0
  48. package/dist/components/core/Input.svelte.d.ts +20 -0
  49. package/dist/components/core/Kbd.svelte +34 -0
  50. package/dist/components/core/Kbd.svelte.d.ts +7 -0
  51. package/dist/components/core/ResizeHandle.svelte +200 -0
  52. package/dist/components/core/ResizeHandle.svelte.d.ts +23 -0
  53. package/dist/components/core/Spinner.svelte +35 -0
  54. package/dist/components/core/Spinner.svelte.d.ts +7 -0
  55. package/dist/components/core/Textarea.svelte +112 -0
  56. package/dist/components/core/Textarea.svelte.d.ts +18 -0
  57. package/dist/components/core/Tooltip.svelte +103 -0
  58. package/dist/components/core/Tooltip.svelte.d.ts +11 -0
  59. package/dist/components/core/index.d.ts +13 -0
  60. package/dist/components/core/index.js +14 -0
  61. package/dist/components/editor/AIFocusLayer.svelte +430 -0
  62. package/dist/components/editor/AIFocusLayer.svelte.d.ts +32 -0
  63. package/dist/components/editor/Breadcrumbs.svelte +435 -0
  64. package/dist/components/editor/Breadcrumbs.svelte.d.ts +33 -0
  65. package/dist/components/editor/BreakpointLayer.svelte +642 -0
  66. package/dist/components/editor/BreakpointLayer.svelte.d.ts +20 -0
  67. package/dist/components/editor/CognitiveLoadMeter.svelte +324 -0
  68. package/dist/components/editor/CognitiveLoadMeter.svelte.d.ts +18 -0
  69. package/dist/components/editor/CollaborativeEditor.svelte +218 -0
  70. package/dist/components/editor/CollaborativeEditor.svelte.d.ts +32 -0
  71. package/dist/components/editor/CommandPalette.svelte +434 -0
  72. package/dist/components/editor/CommandPalette.svelte.d.ts +11 -0
  73. package/dist/components/editor/ComplexityLayer.svelte +293 -0
  74. package/dist/components/editor/ComplexityLayer.svelte.d.ts +23 -0
  75. package/dist/components/editor/ConflictZoneLayer.svelte +441 -0
  76. package/dist/components/editor/ConflictZoneLayer.svelte.d.ts +25 -0
  77. package/dist/components/editor/ContextLens.svelte +262 -0
  78. package/dist/components/editor/ContextLens.svelte.d.ts +27 -0
  79. package/dist/components/editor/CustomEditor.svelte +1242 -0
  80. package/dist/components/editor/CustomEditor.svelte.d.ts +37 -0
  81. package/dist/components/editor/DebugConsole.svelte +646 -0
  82. package/dist/components/editor/DebugConsole.svelte.d.ts +41 -0
  83. package/dist/components/editor/EchoCursorLayer.svelte +363 -0
  84. package/dist/components/editor/EchoCursorLayer.svelte.d.ts +24 -0
  85. package/dist/components/editor/Editor.svelte +61 -0
  86. package/dist/components/editor/Editor.svelte.d.ts +22 -0
  87. package/dist/components/editor/EditorGutter.svelte +119 -0
  88. package/dist/components/editor/EditorGutter.svelte.d.ts +19 -0
  89. package/dist/components/editor/EditorLines.svelte +182 -0
  90. package/dist/components/editor/EditorLines.svelte.d.ts +43 -0
  91. package/dist/components/editor/EditorPane.svelte +134 -0
  92. package/dist/components/editor/EditorPane.svelte.d.ts +9 -0
  93. package/dist/components/editor/EditorSelections.svelte +186 -0
  94. package/dist/components/editor/EditorSelections.svelte.d.ts +25 -0
  95. package/dist/components/editor/EditorTabs.svelte +170 -0
  96. package/dist/components/editor/EditorTabs.svelte.d.ts +12 -0
  97. package/dist/components/editor/FileExplorer.svelte +811 -0
  98. package/dist/components/editor/FileExplorer.svelte.d.ts +67 -0
  99. package/dist/components/editor/FileIcon.svelte +110 -0
  100. package/dist/components/editor/FileIcon.svelte.d.ts +10 -0
  101. package/dist/components/editor/FindReplace.svelte +448 -0
  102. package/dist/components/editor/FindReplace.svelte.d.ts +40 -0
  103. package/dist/components/editor/GhostBracketLayer.svelte +391 -0
  104. package/dist/components/editor/GhostBracketLayer.svelte.d.ts +24 -0
  105. package/dist/components/editor/GitBlameLayer.svelte +436 -0
  106. package/dist/components/editor/GitBlameLayer.svelte.d.ts +18 -0
  107. package/dist/components/editor/InlineDiagnosticsLayer.svelte +540 -0
  108. package/dist/components/editor/InlineDiagnosticsLayer.svelte.d.ts +35 -0
  109. package/dist/components/editor/InlineDiffLayer.svelte +337 -0
  110. package/dist/components/editor/InlineDiffLayer.svelte.d.ts +31 -0
  111. package/dist/components/editor/MinimalEditor.svelte +75 -0
  112. package/dist/components/editor/MinimalEditor.svelte.d.ts +6 -0
  113. package/dist/components/editor/MinimalEditor2.svelte +84 -0
  114. package/dist/components/editor/MinimalEditor2.svelte.d.ts +6 -0
  115. package/dist/components/editor/Minimap.svelte +327 -0
  116. package/dist/components/editor/Minimap.svelte.d.ts +34 -0
  117. package/dist/components/editor/PluginPreviewSandbox.svelte +793 -0
  118. package/dist/components/editor/PluginPreviewSandbox.svelte.d.ts +49 -0
  119. package/dist/components/editor/ProblemsPanel.svelte +628 -0
  120. package/dist/components/editor/ProblemsPanel.svelte.d.ts +25 -0
  121. package/dist/components/editor/QuickActionsMenu.svelte +403 -0
  122. package/dist/components/editor/QuickActionsMenu.svelte.d.ts +18 -0
  123. package/dist/components/editor/SnippetPalette.svelte +530 -0
  124. package/dist/components/editor/SnippetPalette.svelte.d.ts +16 -0
  125. package/dist/components/editor/StructureMap.svelte +431 -0
  126. package/dist/components/editor/StructureMap.svelte.d.ts +37 -0
  127. package/dist/components/editor/SymbolOutline.svelte +722 -0
  128. package/dist/components/editor/SymbolOutline.svelte.d.ts +44 -0
  129. package/dist/components/editor/TimelineScrubber.svelte +470 -0
  130. package/dist/components/editor/TimelineScrubber.svelte.d.ts +40 -0
  131. package/dist/components/editor/TokenRenderer.svelte +69 -0
  132. package/dist/components/editor/TokenRenderer.svelte.d.ts +15 -0
  133. package/dist/components/editor/constants.d.ts +32 -0
  134. package/dist/components/editor/constants.js +36 -0
  135. package/dist/components/editor/core/ai-awareness.d.ts +176 -0
  136. package/dist/components/editor/core/ai-awareness.js +210 -0
  137. package/dist/components/editor/core/bracket-healer.d.ts +189 -0
  138. package/dist/components/editor/core/bracket-healer.js +406 -0
  139. package/dist/components/editor/core/breakpoints.d.ts +203 -0
  140. package/dist/components/editor/core/breakpoints.js +414 -0
  141. package/dist/components/editor/core/commands.d.ts +108 -0
  142. package/dist/components/editor/core/commands.js +246 -0
  143. package/dist/components/editor/core/complexity-analyzer.d.ts +123 -0
  144. package/dist/components/editor/core/complexity-analyzer.js +376 -0
  145. package/dist/components/editor/core/conflict-predictor.d.ts +135 -0
  146. package/dist/components/editor/core/conflict-predictor.js +316 -0
  147. package/dist/components/editor/core/crdt-binding.d.ts +118 -0
  148. package/dist/components/editor/core/crdt-binding.js +286 -0
  149. package/dist/components/editor/core/diagnostics.d.ts +210 -0
  150. package/dist/components/editor/core/diagnostics.js +335 -0
  151. package/dist/components/editor/core/echo-cursor.d.ts +201 -0
  152. package/dist/components/editor/core/echo-cursor.js +267 -0
  153. package/dist/components/editor/core/folding.d.ts +124 -0
  154. package/dist/components/editor/core/folding.js +672 -0
  155. package/dist/components/editor/core/ghost-pair.d.ts +122 -0
  156. package/dist/components/editor/core/ghost-pair.js +221 -0
  157. package/dist/components/editor/core/git-blame.d.ts +170 -0
  158. package/dist/components/editor/core/git-blame.js +324 -0
  159. package/dist/components/editor/core/index.d.ts +26 -0
  160. package/dist/components/editor/core/index.js +24 -0
  161. package/dist/components/editor/core/keybindings.d.ts +79 -0
  162. package/dist/components/editor/core/keybindings.js +357 -0
  163. package/dist/components/editor/core/multi-cursor.d.ts +196 -0
  164. package/dist/components/editor/core/multi-cursor.js +521 -0
  165. package/dist/components/editor/core/navigation.d.ts +107 -0
  166. package/dist/components/editor/core/navigation.js +408 -0
  167. package/dist/components/editor/core/quick-actions.d.ts +189 -0
  168. package/dist/components/editor/core/quick-actions.js +427 -0
  169. package/dist/components/editor/core/search.d.ts +88 -0
  170. package/dist/components/editor/core/search.js +192 -0
  171. package/dist/components/editor/core/semantic-analyzer.d.ts +77 -0
  172. package/dist/components/editor/core/semantic-analyzer.js +424 -0
  173. package/dist/components/editor/core/snippet-manager.d.ts +202 -0
  174. package/dist/components/editor/core/snippet-manager.js +565 -0
  175. package/dist/components/editor/core/state.d.ts +367 -0
  176. package/dist/components/editor/core/state.js +900 -0
  177. package/dist/components/editor/core/timeline.d.ts +204 -0
  178. package/dist/components/editor/core/timeline.js +349 -0
  179. package/dist/components/editor/editor-find.d.ts +56 -0
  180. package/dist/components/editor/editor-find.js +148 -0
  181. package/dist/components/editor/editor-input.d.ts +77 -0
  182. package/dist/components/editor/editor-input.js +445 -0
  183. package/dist/components/editor/editor-multicursor.d.ts +21 -0
  184. package/dist/components/editor/editor-multicursor.js +196 -0
  185. package/dist/components/editor/editor-scroll.d.ts +14 -0
  186. package/dist/components/editor/editor-scroll.js +34 -0
  187. package/dist/components/editor/index.d.ts +15 -0
  188. package/dist/components/editor/index.js +21 -0
  189. package/dist/components/editor/languages.d.ts +62 -0
  190. package/dist/components/editor/languages.js +285 -0
  191. package/dist/components/editor/theme.d.ts +88 -0
  192. package/dist/components/editor/theme.js +139 -0
  193. package/dist/components/editor/tokenizer/base.d.ts +40 -0
  194. package/dist/components/editor/tokenizer/base.js +203 -0
  195. package/dist/components/editor/tokenizer/index.d.ts +56 -0
  196. package/dist/components/editor/tokenizer/index.js +215 -0
  197. package/dist/components/editor/tokenizer/languages/css.d.ts +17 -0
  198. package/dist/components/editor/tokenizer/languages/css.js +194 -0
  199. package/dist/components/editor/tokenizer/languages/go.d.ts +17 -0
  200. package/dist/components/editor/tokenizer/languages/go.js +220 -0
  201. package/dist/components/editor/tokenizer/languages/html.d.ts +24 -0
  202. package/dist/components/editor/tokenizer/languages/html.js +145 -0
  203. package/dist/components/editor/tokenizer/languages/javascript.d.ts +56 -0
  204. package/dist/components/editor/tokenizer/languages/javascript.js +452 -0
  205. package/dist/components/editor/tokenizer/languages/json.d.ts +12 -0
  206. package/dist/components/editor/tokenizer/languages/json.js +91 -0
  207. package/dist/components/editor/tokenizer/languages/markdown.d.ts +16 -0
  208. package/dist/components/editor/tokenizer/languages/markdown.js +156 -0
  209. package/dist/components/editor/tokenizer/languages/python.d.ts +20 -0
  210. package/dist/components/editor/tokenizer/languages/python.js +227 -0
  211. package/dist/components/editor/tokenizer/languages/svelte.d.ts +40 -0
  212. package/dist/components/editor/tokenizer/languages/svelte.js +326 -0
  213. package/dist/components/editor/tokenizer/types.d.ts +86 -0
  214. package/dist/components/editor/tokenizer/types.js +4 -0
  215. package/dist/components/layout/IDELayout.svelte +274 -0
  216. package/dist/components/layout/IDELayout.svelte.d.ts +29 -0
  217. package/dist/components/layout/StatusBar.svelte +511 -0
  218. package/dist/components/layout/StatusBar.svelte.d.ts +47 -0
  219. package/dist/components/layout/index.d.ts +2 -0
  220. package/dist/components/layout/index.js +3 -0
  221. package/dist/components/lsp/AutocompleteWidget.svelte +364 -0
  222. package/dist/components/lsp/AutocompleteWidget.svelte.d.ts +33 -0
  223. package/dist/components/lsp/DiagnosticMarker.svelte +166 -0
  224. package/dist/components/lsp/DiagnosticMarker.svelte.d.ts +19 -0
  225. package/dist/components/lsp/DiagnosticsPanel.svelte +388 -0
  226. package/dist/components/lsp/DiagnosticsPanel.svelte.d.ts +21 -0
  227. package/dist/components/lsp/HoverTooltip.svelte +274 -0
  228. package/dist/components/lsp/HoverTooltip.svelte.d.ts +24 -0
  229. package/dist/components/lsp/LSPEditor.svelte +486 -0
  230. package/dist/components/lsp/LSPEditor.svelte.d.ts +39 -0
  231. package/dist/components/lsp/SignatureHelpWidget.svelte +216 -0
  232. package/dist/components/lsp/SignatureHelpWidget.svelte.d.ts +22 -0
  233. package/dist/components/lsp/index.d.ts +6 -0
  234. package/dist/components/lsp/index.js +7 -0
  235. package/dist/components/plugins/PluginCard.svelte +153 -0
  236. package/dist/components/plugins/PluginCard.svelte.d.ts +19 -0
  237. package/dist/components/plugins/PluginPanel.svelte +280 -0
  238. package/dist/components/plugins/PluginPanel.svelte.d.ts +8 -0
  239. package/dist/components/plugins/PluginProposalForm.svelte +250 -0
  240. package/dist/components/plugins/PluginProposalForm.svelte.d.ts +6 -0
  241. package/dist/components/plugins/PluginStatusBadge.svelte +14 -0
  242. package/dist/components/plugins/PluginStatusBadge.svelte.d.ts +8 -0
  243. package/dist/components/plugins/index.d.ts +4 -0
  244. package/dist/components/plugins/index.js +5 -0
  245. package/dist/components/vfs/LockConflictDialog.svelte +705 -0
  246. package/dist/components/vfs/LockConflictDialog.svelte.d.ts +21 -0
  247. package/dist/components/vfs/LockIndicator.svelte +194 -0
  248. package/dist/components/vfs/LockIndicator.svelte.d.ts +29 -0
  249. package/dist/components/vfs/LockOverlay.svelte +344 -0
  250. package/dist/components/vfs/LockOverlay.svelte.d.ts +17 -0
  251. package/dist/components/vfs/VersionConflictDialog.svelte +549 -0
  252. package/dist/components/vfs/VersionConflictDialog.svelte.d.ts +24 -0
  253. package/dist/components/vfs/index.d.ts +4 -0
  254. package/dist/components/vfs/index.js +5 -0
  255. package/dist/crdt/awareness.d.ts +42 -0
  256. package/dist/crdt/awareness.js +109 -0
  257. package/dist/crdt/document.d.ts +101 -0
  258. package/dist/crdt/document.js +187 -0
  259. package/dist/crdt/index.d.ts +9 -0
  260. package/dist/crdt/index.js +8 -0
  261. package/dist/crdt/provider.d.ts +85 -0
  262. package/dist/crdt/provider.js +150 -0
  263. package/dist/crdt/types.d.ts +61 -0
  264. package/dist/crdt/types.js +4 -0
  265. package/dist/crdt/undo.d.ts +34 -0
  266. package/dist/crdt/undo.js +70 -0
  267. package/dist/index.d.ts +277 -0
  268. package/dist/index.js +280 -0
  269. package/dist/plugins/index.d.ts +103 -0
  270. package/dist/plugins/index.js +153 -0
  271. package/dist/services/error-handling.d.ts +95 -0
  272. package/dist/services/error-handling.js +413 -0
  273. package/dist/services/ide-integration.d.ts +83 -0
  274. package/dist/services/ide-integration.js +367 -0
  275. package/dist/services/lsp-client.d.ts +69 -0
  276. package/dist/services/lsp-client.js +667 -0
  277. package/dist/services/mock-ai.d.ts +37 -0
  278. package/dist/services/mock-ai.js +318 -0
  279. package/dist/services/optimistic.d.ts +141 -0
  280. package/dist/services/optimistic.js +367 -0
  281. package/dist/services/vfs-client.d.ts +81 -0
  282. package/dist/services/vfs-client.js +348 -0
  283. package/dist/stores/agents.svelte.d.ts +85 -0
  284. package/dist/stores/agents.svelte.js +459 -0
  285. package/dist/stores/ai-persistence.svelte.d.ts +76 -0
  286. package/dist/stores/ai-persistence.svelte.js +334 -0
  287. package/dist/stores/ai.svelte.d.ts +140 -0
  288. package/dist/stores/ai.svelte.js +383 -0
  289. package/dist/stores/collaboration.svelte.d.ts +164 -0
  290. package/dist/stores/collaboration.svelte.js +334 -0
  291. package/dist/stores/editor.svelte.d.ts +131 -0
  292. package/dist/stores/editor.svelte.js +250 -0
  293. package/dist/stores/index.d.ts +10 -0
  294. package/dist/stores/index.js +29 -0
  295. package/dist/stores/layout.svelte.d.ts +171 -0
  296. package/dist/stores/layout.svelte.js +351 -0
  297. package/dist/stores/plugin.svelte.d.ts +121 -0
  298. package/dist/stores/plugin.svelte.js +410 -0
  299. package/dist/stores/vfs.svelte.d.ts +123 -0
  300. package/dist/stores/vfs.svelte.js +680 -0
  301. package/dist/styles/theme.css +623 -0
  302. package/dist/types/agents.d.ts +127 -0
  303. package/dist/types/agents.js +5 -0
  304. package/dist/types/ai.d.ts +137 -0
  305. package/dist/types/ai.js +4 -0
  306. package/dist/types/crdt.d.ts +222 -0
  307. package/dist/types/crdt.js +5 -0
  308. package/dist/types/editor.d.ts +52 -0
  309. package/dist/types/editor.js +18 -0
  310. package/dist/types/events.d.ts +133 -0
  311. package/dist/types/events.js +4 -0
  312. package/dist/types/filesystem.d.ts +77 -0
  313. package/dist/types/filesystem.js +4 -0
  314. package/dist/types/index.d.ts +9 -0
  315. package/dist/types/index.js +12 -0
  316. package/dist/types/lsp.d.ts +691 -0
  317. package/dist/types/lsp.js +108 -0
  318. package/dist/types/plugin.d.ts +239 -0
  319. package/dist/types/plugin.js +5 -0
  320. package/dist/types/vfs.d.ts +191 -0
  321. package/dist/types/vfs.js +18 -0
  322. package/dist/utils/format.d.ts +55 -0
  323. package/dist/utils/format.js +152 -0
  324. package/dist/utils/index.d.ts +3 -0
  325. package/dist/utils/index.js +4 -0
  326. package/dist/utils/keybindings.d.ts +33 -0
  327. package/dist/utils/keybindings.js +171 -0
  328. package/dist/utils/language.d.ts +27 -0
  329. package/dist/utils/language.js +222 -0
  330. package/package.json +178 -0
@@ -0,0 +1,722 @@
1
+ <script module lang="ts">
2
+ export type SymbolKind =
3
+ | 'file'
4
+ | 'module'
5
+ | 'namespace'
6
+ | 'class'
7
+ | 'interface'
8
+ | 'type'
9
+ | 'enum'
10
+ | 'function'
11
+ | 'method'
12
+ | 'property'
13
+ | 'variable'
14
+ | 'constant'
15
+ | 'parameter'
16
+ | 'import'
17
+ | 'export';
18
+
19
+ export interface DocumentSymbol {
20
+ /** Unique identifier */
21
+ id: string;
22
+ /** Symbol name */
23
+ name: string;
24
+ /** Symbol kind */
25
+ kind: SymbolKind;
26
+ /** Detail text (e.g., type annotation, parameters) */
27
+ detail?: string;
28
+ /** Line number (0-based) */
29
+ line: number;
30
+ /** End line */
31
+ endLine?: number;
32
+ /** Column */
33
+ column?: number;
34
+ /** Children symbols */
35
+ children?: DocumentSymbol[];
36
+ /** Whether symbol is deprecated */
37
+ deprecated?: boolean;
38
+ /** Visibility modifier */
39
+ visibility?: 'public' | 'private' | 'protected';
40
+ }
41
+ </script>
42
+
43
+ <script lang="ts">
44
+ /**
45
+ * Symbol Outline Panel
46
+ *
47
+ * Shows document structure as a navigable tree:
48
+ * - Classes, interfaces, types
49
+ * - Functions and methods
50
+ * - Variables and constants
51
+ * - Imports and exports
52
+ */
53
+
54
+ import { onMount } from 'svelte';
55
+
56
+ interface Props {
57
+ /** Symbols to display */
58
+ symbols: DocumentSymbol[];
59
+ /** Currently active symbol (at cursor) */
60
+ activeSymbolId?: string | null;
61
+ /** Whether outline is enabled */
62
+ enabled?: boolean;
63
+ /** Filter text */
64
+ filter?: string;
65
+ /** Sort order */
66
+ sortBy?: 'position' | 'name' | 'kind';
67
+ /** Whether to show collapsed by default */
68
+ defaultCollapsed?: boolean;
69
+ /** Callback when symbol is clicked */
70
+ onNavigate?: (symbol: DocumentSymbol) => void;
71
+ /** Panel width */
72
+ width?: number;
73
+ }
74
+
75
+ let {
76
+ symbols = [],
77
+ activeSymbolId = null,
78
+ enabled = true,
79
+ filter = '',
80
+ sortBy = 'position',
81
+ defaultCollapsed = false,
82
+ onNavigate,
83
+ width = 250
84
+ }: Props = $props();
85
+
86
+ let searchQuery = $state('');
87
+ let collapsedIds = $state<Set<string>>(new Set());
88
+ let hoveredSymbol = $state<DocumentSymbol | null>(null);
89
+
90
+ // Symbol icons and colors
91
+ const symbolConfig: Record<SymbolKind, { icon: string; color: string }> = {
92
+ file: { icon: '📄', color: '#e8e8f0' },
93
+ module: { icon: '📦', color: '#4ec9b0' },
94
+ namespace: { icon: '◈', color: '#4ec9b0' },
95
+ class: { icon: '◆', color: '#4ec9b0' },
96
+ interface: { icon: '◇', color: '#4ec9b0' },
97
+ type: { icon: '▣', color: '#4ec9b0' },
98
+ enum: { icon: '▤', color: '#4ec9b0' },
99
+ function: { icon: 'ƒ', color: '#dcdcaa' },
100
+ method: { icon: '⚙', color: '#dcdcaa' },
101
+ property: { icon: '●', color: '#9cdcfe' },
102
+ variable: { icon: '○', color: '#9cdcfe' },
103
+ constant: { icon: '◉', color: '#4fc1ff' },
104
+ parameter: { icon: '◌', color: '#9cdcfe' },
105
+ import: { icon: '↓', color: '#c586c0' },
106
+ export: { icon: '↑', color: '#c586c0' }
107
+ };
108
+
109
+ // Filter symbols recursively
110
+ function filterSymbols(symbols: DocumentSymbol[], query: string): DocumentSymbol[] {
111
+ if (!query) return symbols;
112
+
113
+ const lowerQuery = query.toLowerCase();
114
+ const result: DocumentSymbol[] = [];
115
+
116
+ for (const symbol of symbols) {
117
+ const matches = symbol.name.toLowerCase().includes(lowerQuery);
118
+ const filteredChildren = symbol.children ? filterSymbols(symbol.children, query) : [];
119
+
120
+ if (matches || filteredChildren.length > 0) {
121
+ result.push({
122
+ ...symbol,
123
+ children: filteredChildren.length > 0 ? filteredChildren : symbol.children
124
+ });
125
+ }
126
+ }
127
+
128
+ return result;
129
+ }
130
+
131
+ // Sort symbols
132
+ function sortSymbols(symbols: DocumentSymbol[]): DocumentSymbol[] {
133
+ const sorted = [...symbols];
134
+
135
+ switch (sortBy) {
136
+ case 'name':
137
+ sorted.sort((a, b) => a.name.localeCompare(b.name));
138
+ break;
139
+ case 'kind':
140
+ const kindOrder: SymbolKind[] = [
141
+ 'import',
142
+ 'export',
143
+ 'class',
144
+ 'interface',
145
+ 'type',
146
+ 'enum',
147
+ 'function',
148
+ 'method',
149
+ 'property',
150
+ 'variable',
151
+ 'constant'
152
+ ];
153
+ sorted.sort((a, b) => kindOrder.indexOf(a.kind) - kindOrder.indexOf(b.kind));
154
+ break;
155
+ case 'position':
156
+ default:
157
+ sorted.sort((a, b) => a.line - b.line);
158
+ }
159
+
160
+ // Recursively sort children
161
+ return sorted.map((s) => ({
162
+ ...s,
163
+ children: s.children ? sortSymbols(s.children) : undefined
164
+ }));
165
+ }
166
+
167
+ // Computed filtered and sorted symbols
168
+ const effectiveFilter = $derived(filter || searchQuery);
169
+ const filteredSymbols = $derived(filterSymbols(symbols, effectiveFilter));
170
+ const sortedSymbols = $derived(sortSymbols(filteredSymbols));
171
+
172
+ // Expand all when filtering
173
+ $effect(() => {
174
+ if (effectiveFilter) {
175
+ collapsedIds = new Set();
176
+ }
177
+ });
178
+
179
+ /**
180
+ * Toggle symbol collapse state
181
+ */
182
+ function toggleCollapse(symbol: DocumentSymbol) {
183
+ const newCollapsed = new Set(collapsedIds);
184
+ if (newCollapsed.has(symbol.id)) {
185
+ newCollapsed.delete(symbol.id);
186
+ } else {
187
+ newCollapsed.add(symbol.id);
188
+ }
189
+ collapsedIds = newCollapsed;
190
+ }
191
+
192
+ /**
193
+ * Check if symbol is collapsed
194
+ */
195
+ function isCollapsed(symbol: DocumentSymbol): boolean {
196
+ if (effectiveFilter) return false;
197
+ if (defaultCollapsed && !collapsedIds.has(`expanded-${symbol.id}`)) {
198
+ return !collapsedIds.has(symbol.id) ? true : false;
199
+ }
200
+ return collapsedIds.has(symbol.id);
201
+ }
202
+
203
+ /**
204
+ * Handle symbol click
205
+ */
206
+ function handleSymbolClick(symbol: DocumentSymbol, event: MouseEvent) {
207
+ // If clicking on expand chevron, toggle collapse
208
+ if ((event.target as HTMLElement).closest('.symbol-chevron')) {
209
+ toggleCollapse(symbol);
210
+ return;
211
+ }
212
+
213
+ onNavigate?.(symbol);
214
+ }
215
+
216
+ /**
217
+ * Expand all symbols
218
+ */
219
+ function expandAll() {
220
+ collapsedIds = new Set();
221
+ }
222
+
223
+ /**
224
+ * Collapse all symbols
225
+ */
226
+ function collapseAll() {
227
+ const allIds = new Set<string>();
228
+ function collectIds(symbols: DocumentSymbol[]) {
229
+ for (const s of symbols) {
230
+ if (s.children && s.children.length > 0) {
231
+ allIds.add(s.id);
232
+ collectIds(s.children);
233
+ }
234
+ }
235
+ }
236
+ collectIds(symbols);
237
+ collapsedIds = allIds;
238
+ }
239
+
240
+ /**
241
+ * Get visibility icon
242
+ */
243
+ function getVisibilityIcon(visibility?: 'public' | 'private' | 'protected'): string {
244
+ switch (visibility) {
245
+ case 'private':
246
+ return '🔒';
247
+ case 'protected':
248
+ return '🔐';
249
+ default:
250
+ return '';
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Count total symbols
256
+ */
257
+ function countSymbols(symbols: DocumentSymbol[]): number {
258
+ let count = symbols.length;
259
+ for (const s of symbols) {
260
+ if (s.children) {
261
+ count += countSymbols(s.children);
262
+ }
263
+ }
264
+ return count;
265
+ }
266
+
267
+ const totalCount = $derived(countSymbols(symbols));
268
+ const filteredCount = $derived(countSymbols(filteredSymbols));
269
+ </script>
270
+
271
+ {#if enabled}
272
+ <div class="symbol-outline" style="width: {width}px;">
273
+ <!-- Header -->
274
+ <div class="outline-header">
275
+ <h3 class="outline-title">Outline</h3>
276
+ <div class="outline-actions">
277
+ <button class="action-btn" onclick={expandAll} title="Expand all">
278
+
279
+ </button>
280
+ <button class="action-btn" onclick={collapseAll} title="Collapse all">
281
+
282
+ </button>
283
+ </div>
284
+ </div>
285
+
286
+ <!-- Search -->
287
+ <div class="outline-search">
288
+ <input
289
+ type="text"
290
+ class="search-input"
291
+ placeholder="Filter symbols..."
292
+ bind:value={searchQuery}
293
+ />
294
+ {#if searchQuery}
295
+ <button class="search-clear" onclick={() => (searchQuery = '')}>
296
+ ×
297
+ </button>
298
+ {/if}
299
+ </div>
300
+
301
+ <!-- Symbol count -->
302
+ <div class="outline-info">
303
+ {#if effectiveFilter}
304
+ {filteredCount} of {totalCount} symbols
305
+ {:else}
306
+ {totalCount} symbols
307
+ {/if}
308
+ </div>
309
+
310
+ <!-- Symbol tree -->
311
+ <div class="outline-tree">
312
+ {#if sortedSymbols.length === 0}
313
+ <div class="outline-empty">
314
+ {#if effectiveFilter}
315
+ No symbols matching "{effectiveFilter}"
316
+ {:else}
317
+ No symbols found
318
+ {/if}
319
+ </div>
320
+ {:else}
321
+ {#each sortedSymbols as symbol (symbol.id)}
322
+ {@const config = symbolConfig[symbol.kind]}
323
+ {@const hasChildren = symbol.children && symbol.children.length > 0}
324
+ {@const collapsed = hasChildren && isCollapsed(symbol)}
325
+
326
+ <div class="symbol-group">
327
+ <button
328
+ class="symbol-item"
329
+ class:symbol-item--active={activeSymbolId === symbol.id}
330
+ class:symbol-item--deprecated={symbol.deprecated}
331
+ class:symbol-item--has-children={hasChildren}
332
+ onclick={(e) => handleSymbolClick(symbol, e)}
333
+ onmouseenter={() => (hoveredSymbol = symbol)}
334
+ onmouseleave={() => (hoveredSymbol = null)}
335
+ title="{symbol.kind}: {symbol.name}{symbol.detail ? ` - ${symbol.detail}` : ''}"
336
+ >
337
+ {#if hasChildren}
338
+ <span
339
+ class="symbol-chevron"
340
+ class:symbol-chevron--collapsed={collapsed}
341
+ >
342
+
343
+ </span>
344
+ {:else}
345
+ <span class="symbol-spacer"></span>
346
+ {/if}
347
+
348
+ <span class="symbol-icon" style="color: {config.color};">
349
+ {config.icon}
350
+ </span>
351
+
352
+ {#if symbol.visibility}
353
+ <span class="symbol-visibility">
354
+ {getVisibilityIcon(symbol.visibility)}
355
+ </span>
356
+ {/if}
357
+
358
+ <span class="symbol-name" class:deprecated={symbol.deprecated}>
359
+ {symbol.name}
360
+ </span>
361
+
362
+ {#if symbol.detail}
363
+ <span class="symbol-detail">{symbol.detail}</span>
364
+ {/if}
365
+
366
+ <span class="symbol-line">:{symbol.line + 1}</span>
367
+ </button>
368
+
369
+ <!-- Children -->
370
+ {#if hasChildren && !collapsed}
371
+ <div class="symbol-children">
372
+ {#each symbol.children as child (child.id)}
373
+ {@const childConfig = symbolConfig[child.kind]}
374
+ {@const childHasChildren = child.children && child.children.length > 0}
375
+ {@const childCollapsed = childHasChildren && isCollapsed(child)}
376
+
377
+ <div class="symbol-group symbol-group--nested">
378
+ <button
379
+ class="symbol-item symbol-item--nested"
380
+ class:symbol-item--active={activeSymbolId === child.id}
381
+ class:symbol-item--deprecated={child.deprecated}
382
+ onclick={(e) => handleSymbolClick(child, e)}
383
+ onmouseenter={() => (hoveredSymbol = child)}
384
+ onmouseleave={() => (hoveredSymbol = null)}
385
+ >
386
+ {#if childHasChildren}
387
+ <span
388
+ class="symbol-chevron"
389
+ class:symbol-chevron--collapsed={childCollapsed}
390
+ onclick={(e) => { e.stopPropagation(); toggleCollapse(child); }}
391
+ onkeydown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); toggleCollapse(child); } }}
392
+ role="button"
393
+ tabindex={-1}
394
+ >
395
+
396
+ </span>
397
+ {:else}
398
+ <span class="symbol-spacer"></span>
399
+ {/if}
400
+
401
+ <span class="symbol-icon" style="color: {childConfig.color};">
402
+ {childConfig.icon}
403
+ </span>
404
+
405
+ {#if child.visibility}
406
+ <span class="symbol-visibility">
407
+ {getVisibilityIcon(child.visibility)}
408
+ </span>
409
+ {/if}
410
+
411
+ <span class="symbol-name" class:deprecated={child.deprecated}>
412
+ {child.name}
413
+ </span>
414
+
415
+ {#if child.detail}
416
+ <span class="symbol-detail">{child.detail}</span>
417
+ {/if}
418
+
419
+ <span class="symbol-line">:{child.line + 1}</span>
420
+ </button>
421
+
422
+ <!-- Third level children -->
423
+ {#if childHasChildren && !childCollapsed}
424
+ <div class="symbol-children">
425
+ {#each child.children as grandchild (grandchild.id)}
426
+ {@const gcConfig = symbolConfig[grandchild.kind]}
427
+ <button
428
+ class="symbol-item symbol-item--nested symbol-item--level-2"
429
+ class:symbol-item--active={activeSymbolId === grandchild.id}
430
+ class:symbol-item--deprecated={grandchild.deprecated}
431
+ onclick={() => onNavigate?.(grandchild)}
432
+ >
433
+ <span class="symbol-spacer"></span>
434
+ <span class="symbol-icon" style="color: {gcConfig.color};">
435
+ {gcConfig.icon}
436
+ </span>
437
+ <span class="symbol-name">{grandchild.name}</span>
438
+ <span class="symbol-line">:{grandchild.line + 1}</span>
439
+ </button>
440
+ {/each}
441
+ </div>
442
+ {/if}
443
+ </div>
444
+ {/each}
445
+ </div>
446
+ {/if}
447
+ </div>
448
+ {/each}
449
+ {/if}
450
+ </div>
451
+
452
+ <!-- Hover preview -->
453
+ {#if hoveredSymbol}
454
+ <div class="outline-preview">
455
+ <div class="preview-kind">{hoveredSymbol.kind}</div>
456
+ <div class="preview-name">{hoveredSymbol.name}</div>
457
+ {#if hoveredSymbol.detail}
458
+ <div class="preview-detail">{hoveredSymbol.detail}</div>
459
+ {/if}
460
+ <div class="preview-location">
461
+ Line {hoveredSymbol.line + 1}
462
+ {#if hoveredSymbol.endLine}
463
+ - {hoveredSymbol.endLine + 1}
464
+ {/if}
465
+ </div>
466
+ </div>
467
+ {/if}
468
+ </div>
469
+ {/if}
470
+
471
+ <style>
472
+ .symbol-outline {
473
+ display: flex;
474
+ flex-direction: column;
475
+ height: 100%;
476
+ background: var(--ide-bg-secondary, #1e1e2e);
477
+ border-left: 1px solid var(--ide-border, #333);
478
+ overflow: hidden;
479
+ }
480
+
481
+ .outline-header {
482
+ display: flex;
483
+ align-items: center;
484
+ justify-content: space-between;
485
+ padding: 8px 12px;
486
+ border-bottom: 1px solid var(--ide-border, #333);
487
+ }
488
+
489
+ .outline-title {
490
+ margin: 0;
491
+ font-size: 12px;
492
+ font-weight: 600;
493
+ color: var(--ide-text-primary, #e8e8f0);
494
+ text-transform: uppercase;
495
+ letter-spacing: 0.5px;
496
+ }
497
+
498
+ .outline-actions {
499
+ display: flex;
500
+ gap: 4px;
501
+ }
502
+
503
+ .action-btn {
504
+ width: 22px;
505
+ height: 22px;
506
+ padding: 0;
507
+ background: transparent;
508
+ border: none;
509
+ border-radius: 4px;
510
+ color: var(--ide-text-muted, #666);
511
+ font-size: 12px;
512
+ cursor: pointer;
513
+ transition: all 0.1s ease;
514
+ }
515
+
516
+ .action-btn:hover {
517
+ background: rgba(255, 255, 255, 0.1);
518
+ color: var(--ide-text-primary, #e8e8f0);
519
+ }
520
+
521
+ .outline-search {
522
+ position: relative;
523
+ padding: 8px 12px;
524
+ border-bottom: 1px solid var(--ide-border, #333);
525
+ }
526
+
527
+ .search-input {
528
+ width: 100%;
529
+ padding: 6px 28px 6px 10px;
530
+ background: rgba(0, 0, 0, 0.2);
531
+ border: 1px solid var(--ide-border, #333);
532
+ border-radius: 4px;
533
+ color: var(--ide-text-primary, #e8e8f0);
534
+ font-size: 12px;
535
+ outline: none;
536
+ }
537
+
538
+ .search-input:focus {
539
+ border-color: var(--ide-interactive, #4f8cc9);
540
+ }
541
+
542
+ .search-input::placeholder {
543
+ color: var(--ide-text-muted, #666);
544
+ }
545
+
546
+ .search-clear {
547
+ position: absolute;
548
+ right: 18px;
549
+ top: 50%;
550
+ transform: translateY(-50%);
551
+ width: 18px;
552
+ height: 18px;
553
+ padding: 0;
554
+ background: transparent;
555
+ border: none;
556
+ color: var(--ide-text-muted, #666);
557
+ font-size: 14px;
558
+ cursor: pointer;
559
+ }
560
+
561
+ .search-clear:hover {
562
+ color: var(--ide-text-primary, #e8e8f0);
563
+ }
564
+
565
+ .outline-info {
566
+ padding: 4px 12px;
567
+ font-size: 10px;
568
+ color: var(--ide-text-muted, #666);
569
+ border-bottom: 1px solid var(--ide-border, #333);
570
+ }
571
+
572
+ .outline-tree {
573
+ flex: 1;
574
+ overflow-y: auto;
575
+ padding: 4px 0;
576
+ }
577
+
578
+ .outline-empty {
579
+ padding: 24px 12px;
580
+ text-align: center;
581
+ color: var(--ide-text-muted, #666);
582
+ font-size: 12px;
583
+ }
584
+
585
+ .symbol-group {
586
+ /* Container for symbol + children */
587
+ }
588
+
589
+ .symbol-group--nested {
590
+ /* Nested group styling */
591
+ }
592
+
593
+ .symbol-item {
594
+ display: flex;
595
+ align-items: center;
596
+ width: 100%;
597
+ padding: 4px 12px;
598
+ background: transparent;
599
+ border: none;
600
+ color: var(--ide-text-secondary, #aaa);
601
+ font-size: 12px;
602
+ text-align: left;
603
+ cursor: pointer;
604
+ transition: background 0.1s ease;
605
+ gap: 4px;
606
+ }
607
+
608
+ .symbol-item:hover {
609
+ background: rgba(255, 255, 255, 0.05);
610
+ color: var(--ide-text-primary, #e8e8f0);
611
+ }
612
+
613
+ .symbol-item--active {
614
+ background: rgba(168, 85, 247, 0.15);
615
+ color: var(--ide-text-primary, #e8e8f0);
616
+ }
617
+
618
+ .symbol-item--nested {
619
+ padding-left: 24px;
620
+ }
621
+
622
+ .symbol-item--level-2 {
623
+ padding-left: 44px;
624
+ }
625
+
626
+ .symbol-item--deprecated {
627
+ opacity: 0.6;
628
+ }
629
+
630
+ .symbol-chevron {
631
+ width: 12px;
632
+ font-size: 10px;
633
+ color: var(--ide-text-muted, #666);
634
+ transition: transform 0.15s ease;
635
+ cursor: pointer;
636
+ }
637
+
638
+ .symbol-chevron--collapsed {
639
+ transform: rotate(-90deg);
640
+ }
641
+
642
+ .symbol-spacer {
643
+ width: 12px;
644
+ }
645
+
646
+ .symbol-icon {
647
+ flex-shrink: 0;
648
+ width: 16px;
649
+ font-family: monospace;
650
+ font-size: 11px;
651
+ font-weight: 600;
652
+ text-align: center;
653
+ }
654
+
655
+ .symbol-visibility {
656
+ font-size: 10px;
657
+ margin-right: 2px;
658
+ }
659
+
660
+ .symbol-name {
661
+ flex: 1;
662
+ overflow: hidden;
663
+ text-overflow: ellipsis;
664
+ white-space: nowrap;
665
+ }
666
+
667
+ .symbol-name.deprecated {
668
+ text-decoration: line-through;
669
+ }
670
+
671
+ .symbol-detail {
672
+ font-size: 10px;
673
+ color: var(--ide-text-muted, #666);
674
+ overflow: hidden;
675
+ text-overflow: ellipsis;
676
+ max-width: 80px;
677
+ }
678
+
679
+ .symbol-line {
680
+ font-family: monospace;
681
+ font-size: 10px;
682
+ color: var(--ide-text-muted, #666);
683
+ margin-left: auto;
684
+ }
685
+
686
+ .symbol-children {
687
+ /* Children container */
688
+ }
689
+
690
+ /* Hover preview */
691
+ .outline-preview {
692
+ padding: 8px 12px;
693
+ border-top: 1px solid var(--ide-border, #333);
694
+ background: rgba(0, 0, 0, 0.2);
695
+ }
696
+
697
+ .preview-kind {
698
+ font-size: 10px;
699
+ text-transform: uppercase;
700
+ color: var(--ide-text-muted, #666);
701
+ margin-bottom: 4px;
702
+ }
703
+
704
+ .preview-name {
705
+ font-size: 13px;
706
+ font-weight: 500;
707
+ color: var(--ide-text-primary, #e8e8f0);
708
+ }
709
+
710
+ .preview-detail {
711
+ font-size: 11px;
712
+ color: var(--ide-text-secondary, #aaa);
713
+ margin-top: 2px;
714
+ }
715
+
716
+ .preview-location {
717
+ font-size: 10px;
718
+ color: var(--ide-text-muted, #666);
719
+ font-family: monospace;
720
+ margin-top: 4px;
721
+ }
722
+ </style>