@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,705 @@
1
+ <script lang="ts">
2
+ /**
3
+ * LockConflictDialog - Elegant lock conflict resolution
4
+ *
5
+ * Design principles:
6
+ * - Clear action hierarchy: Primary action prominent, dangerous action gated
7
+ * - Reassuring messaging: User should never feel their work is at risk
8
+ * - Responsive: Works on narrow sidebars and mobile
9
+ * - Accessible: Full keyboard navigation, focus management
10
+ */
11
+
12
+ import { Icon, Button, Avatar } from '../core';
13
+ import AgentAvatar from '../agents/AgentAvatar.svelte';
14
+ import type { VFSFileLock, Agent } from '../../types';
15
+
16
+ interface Props {
17
+ open: boolean;
18
+ filePath: string;
19
+ lock?: VFSFileLock;
20
+ lockHolderAgent?: Agent;
21
+ errorMessage?: string;
22
+ canForceUnlock?: boolean;
23
+ /** Pending local changes count */
24
+ pendingChanges?: number;
25
+ /** Last successful sync time */
26
+ lastSyncTime?: string;
27
+ onWait?: () => void;
28
+ onRequestAccess?: () => void;
29
+ onOpenReadOnly?: () => void;
30
+ onForceUnlock?: () => void;
31
+ onClose: () => void;
32
+ }
33
+
34
+ let {
35
+ open,
36
+ filePath,
37
+ lock,
38
+ lockHolderAgent,
39
+ errorMessage,
40
+ canForceUnlock = false,
41
+ pendingChanges = 0,
42
+ lastSyncTime,
43
+ onWait,
44
+ onRequestAccess,
45
+ onOpenReadOnly,
46
+ onForceUnlock,
47
+ onClose
48
+ }: Props = $props();
49
+
50
+ // Force unlock confirmation
51
+ let forceUnlockConfirmed = $state(false);
52
+ let showForceSection = $state(false);
53
+
54
+ // Computed values
55
+ let fileName = $derived(filePath.split('/').pop() ?? filePath);
56
+
57
+ let timeRemaining = $derived.by(() => {
58
+ if (!lock) return '';
59
+ const expiresAt = new Date(lock.expiresAt).getTime();
60
+ const now = Date.now();
61
+ const remaining = Math.max(0, expiresAt - now);
62
+ const minutes = Math.floor(remaining / 60000);
63
+ const seconds = Math.floor((remaining % 60000) / 1000);
64
+ if (minutes > 0) return `${minutes}m ${seconds}s`;
65
+ return `${seconds}s`;
66
+ });
67
+
68
+ let lastSyncDisplay = $derived.by(() => {
69
+ if (!lastSyncTime) return null;
70
+ const date = new Date(lastSyncTime);
71
+ const diff = Date.now() - date.getTime();
72
+ if (diff < 60000) return 'Just now';
73
+ if (diff < 3600000) return `${Math.floor(diff / 60000)} minutes ago`;
74
+ return date.toLocaleTimeString();
75
+ });
76
+
77
+ function handleBackdropClick(e: MouseEvent) {
78
+ if (e.target === e.currentTarget) onClose();
79
+ }
80
+
81
+ function handleKeyDown(e: KeyboardEvent) {
82
+ if (e.key === 'Escape') onClose();
83
+ }
84
+
85
+ function handleForceUnlock() {
86
+ if (forceUnlockConfirmed && onForceUnlock) {
87
+ onForceUnlock();
88
+ }
89
+ }
90
+
91
+ // Reset state when dialog opens/closes
92
+ $effect(() => {
93
+ if (!open) {
94
+ forceUnlockConfirmed = false;
95
+ showForceSection = false;
96
+ }
97
+ });
98
+ </script>
99
+
100
+ {#if open}
101
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
102
+ <div
103
+ class="lock-dialog-backdrop"
104
+ role="dialog"
105
+ aria-modal="true"
106
+ aria-labelledby="lock-dialog-title"
107
+ onclick={handleBackdropClick}
108
+ onkeydown={handleKeyDown}
109
+ >
110
+ <div class="lock-dialog">
111
+ <!-- Header -->
112
+ <header class="lock-dialog__header">
113
+ <div class="lock-dialog__icon">
114
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
115
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
116
+ <path d="M7 11V7a5 5 0 0 1 10 0v4" />
117
+ </svg>
118
+ </div>
119
+ <div class="lock-dialog__title-group">
120
+ <h2 id="lock-dialog-title">File is Locked</h2>
121
+ <p class="lock-dialog__filename">{fileName}</p>
122
+ </div>
123
+ <button
124
+ class="lock-dialog__close"
125
+ onclick={onClose}
126
+ aria-label="Close dialog"
127
+ >
128
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
129
+ <path d="M18 6 6 18M6 6l12 12" />
130
+ </svg>
131
+ </button>
132
+ </header>
133
+
134
+ <!-- Content -->
135
+ <div class="lock-dialog__content">
136
+ <!-- Lock holder info -->
137
+ {#if lock}
138
+ <div class="lock-holder">
139
+ {#if lockHolderAgent}
140
+ <AgentAvatar agent={lockHolderAgent} size="lg" showPhase={true} />
141
+ {:else}
142
+ <Avatar name={lock.holderName ?? lock.holder} size="lg" />
143
+ {/if}
144
+ <div class="lock-holder__info">
145
+ <span class="lock-holder__name">
146
+ {lockHolderAgent?.name ?? lock.holderName ?? lock.holder}
147
+ </span>
148
+ <span class="lock-holder__meta">
149
+ {lock.holderType === 'agent' ? 'AI Agent' : 'User'}
150
+ {#if lock.purpose}
151
+ &middot; {lock.purpose}
152
+ {/if}
153
+ </span>
154
+ {#if lockHolderAgent?.currentTask}
155
+ <span class="lock-holder__task">
156
+ {lockHolderAgent.currentTask.description}
157
+ </span>
158
+ {/if}
159
+ </div>
160
+ <div class="lock-holder__timer">
161
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
162
+ <circle cx="12" cy="12" r="10" />
163
+ <polyline points="12 6 12 12 16 14" />
164
+ </svg>
165
+ <span>{timeRemaining}</span>
166
+ </div>
167
+ </div>
168
+ {/if}
169
+
170
+ <!-- Error message -->
171
+ {#if errorMessage}
172
+ <div class="lock-dialog__error" role="alert">
173
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
174
+ <circle cx="12" cy="12" r="10" />
175
+ <line x1="12" y1="8" x2="12" y2="12" />
176
+ <line x1="12" y1="16" x2="12.01" y2="16" />
177
+ </svg>
178
+ <span>{errorMessage}</span>
179
+ </div>
180
+ {/if}
181
+
182
+ <!-- Reassurance message -->
183
+ <div class="lock-dialog__reassurance">
184
+ {#if pendingChanges > 0}
185
+ <div class="reassurance-item reassurance-item--saved">
186
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
187
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
188
+ <polyline points="22 4 12 14.01 9 11.01" />
189
+ </svg>
190
+ <span>{pendingChanges} local change{pendingChanges !== 1 ? 's' : ''} saved</span>
191
+ </div>
192
+ {/if}
193
+ {#if lastSyncDisplay}
194
+ <div class="reassurance-item">
195
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
196
+ <polyline points="23 4 23 10 17 10" />
197
+ <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10" />
198
+ </svg>
199
+ <span>Last synced {lastSyncDisplay}</span>
200
+ </div>
201
+ {/if}
202
+ </div>
203
+ </div>
204
+
205
+ <!-- Actions with clear hierarchy -->
206
+ <div class="lock-dialog__actions">
207
+ <!-- Safe options row -->
208
+ <div class="action-row action-row--safe">
209
+ {#if onOpenReadOnly}
210
+ <button
211
+ class="action-btn action-btn--safe"
212
+ onclick={onOpenReadOnly}
213
+ >
214
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
215
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
216
+ <circle cx="12" cy="12" r="3" />
217
+ </svg>
218
+ <span>View Read-Only</span>
219
+ </button>
220
+ {/if}
221
+ {#if onWait}
222
+ <button
223
+ class="action-btn action-btn--safe"
224
+ onclick={onWait}
225
+ >
226
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
227
+ <circle cx="12" cy="12" r="10" />
228
+ <polyline points="12 6 12 12 16 14" />
229
+ </svg>
230
+ <span>Wait for Release</span>
231
+ </button>
232
+ {/if}
233
+ </div>
234
+
235
+ <!-- Primary action -->
236
+ {#if onRequestAccess}
237
+ <button
238
+ class="action-btn action-btn--primary"
239
+ onclick={onRequestAccess}
240
+ >
241
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
242
+ <line x1="22" y1="2" x2="11" y2="13" />
243
+ <polygon points="22 2 15 22 11 13 2 9 22 2" />
244
+ </svg>
245
+ <span>Request Access</span>
246
+ <span class="action-hint">Notifies the current editor</span>
247
+ </button>
248
+ {/if}
249
+
250
+ <!-- Dangerous action (gated) -->
251
+ {#if canForceUnlock && onForceUnlock}
252
+ {#if !showForceSection}
253
+ <button
254
+ class="action-toggle"
255
+ onclick={() => showForceSection = true}
256
+ >
257
+ More options...
258
+ </button>
259
+ {:else}
260
+ <div class="force-section">
261
+ <div class="force-warning">
262
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
263
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
264
+ <line x1="12" y1="9" x2="12" y2="13" />
265
+ <line x1="12" y1="17" x2="12.01" y2="17" />
266
+ </svg>
267
+ <span>Force unlock may cause data loss for the current editor</span>
268
+ </div>
269
+ <label class="force-confirm">
270
+ <input
271
+ type="checkbox"
272
+ bind:checked={forceUnlockConfirmed}
273
+ />
274
+ <span>I understand the risks</span>
275
+ </label>
276
+ <button
277
+ class="action-btn action-btn--danger"
278
+ onclick={handleForceUnlock}
279
+ disabled={!forceUnlockConfirmed}
280
+ >
281
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
282
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
283
+ <path d="M7 11V7a5 5 0 0 1 9.9-1" />
284
+ </svg>
285
+ <span>Force Unlock</span>
286
+ </button>
287
+ </div>
288
+ {/if}
289
+ {/if}
290
+ </div>
291
+
292
+ <!-- Footer -->
293
+ <footer class="lock-dialog__footer">
294
+ <button class="cancel-btn" onclick={onClose}>
295
+ Cancel
296
+ </button>
297
+ </footer>
298
+ </div>
299
+ </div>
300
+ {/if}
301
+
302
+ <style>
303
+ .lock-dialog-backdrop {
304
+ position: fixed;
305
+ inset: 0;
306
+ background: rgba(0, 0, 0, 0.7);
307
+ backdrop-filter: blur(2px);
308
+ display: flex;
309
+ align-items: center;
310
+ justify-content: center;
311
+ z-index: var(--ide-z-modal);
312
+ padding: var(--ide-spacing-md);
313
+ animation: fade-in 0.15s ease-out;
314
+ }
315
+
316
+ @keyframes fade-in {
317
+ from { opacity: 0; }
318
+ to { opacity: 1; }
319
+ }
320
+
321
+ .lock-dialog {
322
+ width: 100%;
323
+ max-width: 440px;
324
+ background: var(--ide-bg-secondary);
325
+ border: 1px solid var(--ide-border);
326
+ border-radius: var(--ide-radius-xl);
327
+ box-shadow: var(--ide-shadow-xl), 0 0 60px rgba(0, 0, 0, 0.3);
328
+ animation: slide-up 0.2s ease-out;
329
+ overflow: hidden;
330
+ }
331
+
332
+ @keyframes slide-up {
333
+ from { opacity: 0; transform: translateY(20px) scale(0.98); }
334
+ to { opacity: 1; transform: translateY(0) scale(1); }
335
+ }
336
+
337
+ /* Header */
338
+ .lock-dialog__header {
339
+ display: flex;
340
+ align-items: flex-start;
341
+ gap: var(--ide-spacing-md);
342
+ padding: var(--ide-spacing-lg);
343
+ background: linear-gradient(
344
+ 180deg,
345
+ color-mix(in srgb, var(--ide-lock-other) 8%, transparent) 0%,
346
+ transparent 100%
347
+ );
348
+ }
349
+
350
+ .lock-dialog__icon {
351
+ width: 44px;
352
+ height: 44px;
353
+ display: flex;
354
+ align-items: center;
355
+ justify-content: center;
356
+ background: color-mix(in srgb, var(--ide-lock-other) 15%, transparent);
357
+ border-radius: 50%;
358
+ color: var(--ide-lock-other);
359
+ flex-shrink: 0;
360
+ }
361
+
362
+ .lock-dialog__icon svg {
363
+ width: 22px;
364
+ height: 22px;
365
+ }
366
+
367
+ .lock-dialog__title-group {
368
+ flex: 1;
369
+ min-width: 0;
370
+ }
371
+
372
+ .lock-dialog__title-group h2 {
373
+ margin: 0;
374
+ font-size: 17px;
375
+ font-weight: 600;
376
+ color: var(--ide-text-primary);
377
+ }
378
+
379
+ .lock-dialog__filename {
380
+ margin: 4px 0 0;
381
+ font-size: 13px;
382
+ font-family: var(--ide-font-mono);
383
+ color: var(--ide-text-secondary);
384
+ overflow: hidden;
385
+ text-overflow: ellipsis;
386
+ white-space: nowrap;
387
+ }
388
+
389
+ .lock-dialog__close {
390
+ width: 32px;
391
+ height: 32px;
392
+ min-width: 44px;
393
+ min-height: 44px;
394
+ margin: -8px -8px 0 0;
395
+ display: flex;
396
+ align-items: center;
397
+ justify-content: center;
398
+ background: transparent;
399
+ border: none;
400
+ border-radius: var(--ide-radius-md);
401
+ color: var(--ide-text-muted);
402
+ cursor: pointer;
403
+ transition: all var(--ide-transition-fast);
404
+ }
405
+
406
+ .lock-dialog__close svg {
407
+ width: 18px;
408
+ height: 18px;
409
+ }
410
+
411
+ .lock-dialog__close:hover {
412
+ background: var(--ide-bg-hover);
413
+ color: var(--ide-text-primary);
414
+ }
415
+
416
+ .lock-dialog__close:focus-visible {
417
+ outline: 2px solid var(--ide-interactive-focus);
418
+ outline-offset: 2px;
419
+ }
420
+
421
+ /* Content */
422
+ .lock-dialog__content {
423
+ padding: 0 var(--ide-spacing-lg) var(--ide-spacing-lg);
424
+ }
425
+
426
+ /* Lock holder card */
427
+ .lock-holder {
428
+ display: flex;
429
+ align-items: flex-start;
430
+ gap: var(--ide-spacing-md);
431
+ padding: var(--ide-spacing-md);
432
+ background: var(--ide-bg-primary);
433
+ border-radius: var(--ide-radius-lg);
434
+ margin-bottom: var(--ide-spacing-md);
435
+ }
436
+
437
+ .lock-holder__info {
438
+ flex: 1;
439
+ min-width: 0;
440
+ display: flex;
441
+ flex-direction: column;
442
+ gap: 2px;
443
+ }
444
+
445
+ .lock-holder__name {
446
+ font-weight: 600;
447
+ color: var(--ide-text-primary);
448
+ font-size: 14px;
449
+ }
450
+
451
+ .lock-holder__meta {
452
+ font-size: 12px;
453
+ color: var(--ide-text-muted);
454
+ }
455
+
456
+ .lock-holder__task {
457
+ font-size: 12px;
458
+ color: var(--ide-text-secondary);
459
+ margin-top: 4px;
460
+ }
461
+
462
+ .lock-holder__timer {
463
+ display: flex;
464
+ align-items: center;
465
+ gap: 4px;
466
+ padding: 4px 8px;
467
+ background: color-mix(in srgb, var(--ide-lock-other) 15%, transparent);
468
+ border-radius: var(--ide-radius-full);
469
+ color: var(--ide-lock-other);
470
+ font-size: 12px;
471
+ font-weight: 500;
472
+ font-family: var(--ide-font-mono);
473
+ white-space: nowrap;
474
+ }
475
+
476
+ /* Error */
477
+ .lock-dialog__error {
478
+ display: flex;
479
+ align-items: center;
480
+ gap: var(--ide-spacing-sm);
481
+ padding: var(--ide-spacing-sm) var(--ide-spacing-md);
482
+ background: color-mix(in srgb, var(--ide-error) 10%, transparent);
483
+ border-radius: var(--ide-radius-md);
484
+ color: var(--ide-error);
485
+ font-size: 13px;
486
+ margin-bottom: var(--ide-spacing-md);
487
+ }
488
+
489
+ /* Reassurance */
490
+ .lock-dialog__reassurance {
491
+ display: flex;
492
+ flex-direction: column;
493
+ gap: 6px;
494
+ }
495
+
496
+ .reassurance-item {
497
+ display: flex;
498
+ align-items: center;
499
+ gap: 8px;
500
+ font-size: 12px;
501
+ color: var(--ide-text-muted);
502
+ }
503
+
504
+ .reassurance-item--saved {
505
+ color: var(--ide-success);
506
+ }
507
+
508
+ /* Actions */
509
+ .lock-dialog__actions {
510
+ padding: 0 var(--ide-spacing-lg) var(--ide-spacing-lg);
511
+ display: flex;
512
+ flex-direction: column;
513
+ gap: var(--ide-spacing-sm);
514
+ }
515
+
516
+ .action-row {
517
+ display: flex;
518
+ gap: var(--ide-spacing-sm);
519
+ }
520
+
521
+ .action-row--safe {
522
+ flex-wrap: wrap;
523
+ }
524
+
525
+ .action-btn {
526
+ flex: 1;
527
+ min-height: 44px;
528
+ display: flex;
529
+ align-items: center;
530
+ justify-content: center;
531
+ gap: 8px;
532
+ padding: 10px 16px;
533
+ border: none;
534
+ border-radius: var(--ide-radius-md);
535
+ font-size: 14px;
536
+ font-weight: 500;
537
+ cursor: pointer;
538
+ transition: all var(--ide-transition-fast);
539
+ }
540
+
541
+ .action-btn:focus-visible {
542
+ outline: 2px solid var(--ide-interactive-focus);
543
+ outline-offset: 2px;
544
+ }
545
+
546
+ .action-btn--safe {
547
+ background: var(--ide-bg-primary);
548
+ color: var(--ide-text-primary);
549
+ border: 1px solid var(--ide-border);
550
+ min-width: calc(50% - 4px);
551
+ }
552
+
553
+ .action-btn--safe:hover {
554
+ background: var(--ide-bg-hover);
555
+ border-color: var(--ide-text-muted);
556
+ }
557
+
558
+ .action-btn--primary {
559
+ flex-direction: column;
560
+ gap: 4px;
561
+ background: linear-gradient(135deg, var(--ide-interactive) 0%, var(--ide-interactive-active) 100%);
562
+ color: white;
563
+ padding: 14px 16px;
564
+ }
565
+
566
+ .action-btn--primary:hover {
567
+ filter: brightness(1.1);
568
+ transform: translateY(-1px);
569
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--ide-interactive) 40%, transparent);
570
+ }
571
+
572
+ .action-hint {
573
+ font-size: 11px;
574
+ font-weight: 400;
575
+ opacity: 0.8;
576
+ }
577
+
578
+ .action-btn--danger {
579
+ background: var(--ide-error);
580
+ color: white;
581
+ }
582
+
583
+ .action-btn--danger:hover:not(:disabled) {
584
+ filter: brightness(1.1);
585
+ }
586
+
587
+ .action-btn--danger:disabled {
588
+ opacity: 0.5;
589
+ cursor: not-allowed;
590
+ }
591
+
592
+ .action-toggle {
593
+ background: transparent;
594
+ border: none;
595
+ color: var(--ide-text-muted);
596
+ font-size: 12px;
597
+ cursor: pointer;
598
+ padding: 8px;
599
+ text-decoration: underline;
600
+ text-underline-offset: 2px;
601
+ }
602
+
603
+ .action-toggle:hover {
604
+ color: var(--ide-text-secondary);
605
+ }
606
+
607
+ /* Force unlock section */
608
+ .force-section {
609
+ display: flex;
610
+ flex-direction: column;
611
+ gap: var(--ide-spacing-sm);
612
+ padding: var(--ide-spacing-md);
613
+ background: color-mix(in srgb, var(--ide-error) 5%, transparent);
614
+ border: 1px solid color-mix(in srgb, var(--ide-error) 20%, transparent);
615
+ border-radius: var(--ide-radius-md);
616
+ animation: fade-in 0.15s ease-out;
617
+ }
618
+
619
+ .force-warning {
620
+ display: flex;
621
+ align-items: flex-start;
622
+ gap: 8px;
623
+ font-size: 12px;
624
+ color: var(--ide-error);
625
+ line-height: 1.4;
626
+ }
627
+
628
+ .force-warning svg {
629
+ flex-shrink: 0;
630
+ margin-top: 1px;
631
+ }
632
+
633
+ .force-confirm {
634
+ display: flex;
635
+ align-items: center;
636
+ gap: 8px;
637
+ font-size: 13px;
638
+ color: var(--ide-text-primary);
639
+ cursor: pointer;
640
+ padding: 4px 0;
641
+ }
642
+
643
+ .force-confirm input {
644
+ width: 16px;
645
+ height: 16px;
646
+ accent-color: var(--ide-error);
647
+ }
648
+
649
+ /* Footer */
650
+ .lock-dialog__footer {
651
+ display: flex;
652
+ justify-content: center;
653
+ padding: var(--ide-spacing-md);
654
+ border-top: 1px solid var(--ide-border);
655
+ background: var(--ide-bg-primary);
656
+ }
657
+
658
+ .cancel-btn {
659
+ background: transparent;
660
+ border: none;
661
+ color: var(--ide-text-muted);
662
+ font-size: 13px;
663
+ cursor: pointer;
664
+ padding: 8px 16px;
665
+ min-height: 44px;
666
+ border-radius: var(--ide-radius-md);
667
+ transition: all var(--ide-transition-fast);
668
+ }
669
+
670
+ .cancel-btn:hover {
671
+ background: var(--ide-bg-hover);
672
+ color: var(--ide-text-primary);
673
+ }
674
+
675
+ .cancel-btn:focus-visible {
676
+ outline: 2px solid var(--ide-interactive-focus);
677
+ outline-offset: 2px;
678
+ }
679
+
680
+ /* Responsive */
681
+ @media (max-width: 480px) {
682
+ .lock-dialog {
683
+ max-width: 100%;
684
+ margin: var(--ide-spacing-sm);
685
+ }
686
+
687
+ .action-row--safe {
688
+ flex-direction: column;
689
+ }
690
+
691
+ .action-btn--safe {
692
+ min-width: 100%;
693
+ }
694
+
695
+ .lock-holder {
696
+ flex-wrap: wrap;
697
+ }
698
+
699
+ .lock-holder__timer {
700
+ width: 100%;
701
+ justify-content: center;
702
+ margin-top: 8px;
703
+ }
704
+ }
705
+ </style>
@@ -0,0 +1,21 @@
1
+ import type { VFSFileLock, Agent } from '../../types';
2
+ interface Props {
3
+ open: boolean;
4
+ filePath: string;
5
+ lock?: VFSFileLock;
6
+ lockHolderAgent?: Agent;
7
+ errorMessage?: string;
8
+ canForceUnlock?: boolean;
9
+ /** Pending local changes count */
10
+ pendingChanges?: number;
11
+ /** Last successful sync time */
12
+ lastSyncTime?: string;
13
+ onWait?: () => void;
14
+ onRequestAccess?: () => void;
15
+ onOpenReadOnly?: () => void;
16
+ onForceUnlock?: () => void;
17
+ onClose: () => void;
18
+ }
19
+ declare const LockConflictDialog: import("svelte").Component<Props, {}, "">;
20
+ type LockConflictDialog = ReturnType<typeof LockConflictDialog>;
21
+ export default LockConflictDialog;