@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.
- package/LICENSE +21 -0
- package/README.md +251 -0
- package/dist/components/agents/AgentActivityPanel.svelte +565 -0
- package/dist/components/agents/AgentActivityPanel.svelte.d.ts +24 -0
- package/dist/components/agents/AgentAvatar.svelte +417 -0
- package/dist/components/agents/AgentAvatar.svelte.d.ts +23 -0
- package/dist/components/agents/AgentCursor.svelte +224 -0
- package/dist/components/agents/AgentCursor.svelte.d.ts +35 -0
- package/dist/components/agents/AgentPresenceBar.svelte +261 -0
- package/dist/components/agents/AgentPresenceBar.svelte.d.ts +20 -0
- package/dist/components/agents/index.d.ts +4 -0
- package/dist/components/agents/index.js +5 -0
- package/dist/components/ai/AIConversationList.svelte +524 -0
- package/dist/components/ai/AIConversationList.svelte.d.ts +17 -0
- package/dist/components/ai/AIEditPreview.svelte +132 -0
- package/dist/components/ai/AIEditPreview.svelte.d.ts +8 -0
- package/dist/components/ai/AIInlineEdit.svelte +155 -0
- package/dist/components/ai/AIInlineEdit.svelte.d.ts +10 -0
- package/dist/components/ai/AIMessage.svelte +239 -0
- package/dist/components/ai/AIMessage.svelte.d.ts +13 -0
- package/dist/components/ai/AIMessageActions.svelte +176 -0
- package/dist/components/ai/AIMessageActions.svelte.d.ts +12 -0
- package/dist/components/ai/AIMessageContent.svelte +355 -0
- package/dist/components/ai/AIMessageContent.svelte.d.ts +7 -0
- package/dist/components/ai/AIPanel.svelte +561 -0
- package/dist/components/ai/AIPanel.svelte.d.ts +7 -0
- package/dist/components/ai/AISuggestionWidget.svelte +132 -0
- package/dist/components/ai/AISuggestionWidget.svelte.d.ts +10 -0
- package/dist/components/ai/AIToolCallDisplay.svelte +317 -0
- package/dist/components/ai/AIToolCallDisplay.svelte.d.ts +12 -0
- package/dist/components/ai/index.d.ts +9 -0
- package/dist/components/ai/index.js +10 -0
- package/dist/components/core/Avatar.svelte +110 -0
- package/dist/components/core/Avatar.svelte.d.ts +12 -0
- package/dist/components/core/Badge.svelte +98 -0
- package/dist/components/core/Badge.svelte.d.ts +11 -0
- package/dist/components/core/Button.svelte +175 -0
- package/dist/components/core/Button.svelte.d.ts +18 -0
- package/dist/components/core/ConnectionStatus.svelte +294 -0
- package/dist/components/core/ConnectionStatus.svelte.d.ts +20 -0
- package/dist/components/core/ContextMenu.svelte +176 -0
- package/dist/components/core/ContextMenu.svelte.d.ts +19 -0
- package/dist/components/core/ErrorBoundary.svelte +277 -0
- package/dist/components/core/ErrorBoundary.svelte.d.ts +23 -0
- package/dist/components/core/Icon.svelte +107 -0
- package/dist/components/core/Icon.svelte.d.ts +8 -0
- package/dist/components/core/Input.svelte +138 -0
- package/dist/components/core/Input.svelte.d.ts +20 -0
- package/dist/components/core/Kbd.svelte +34 -0
- package/dist/components/core/Kbd.svelte.d.ts +7 -0
- package/dist/components/core/ResizeHandle.svelte +200 -0
- package/dist/components/core/ResizeHandle.svelte.d.ts +23 -0
- package/dist/components/core/Spinner.svelte +35 -0
- package/dist/components/core/Spinner.svelte.d.ts +7 -0
- package/dist/components/core/Textarea.svelte +112 -0
- package/dist/components/core/Textarea.svelte.d.ts +18 -0
- package/dist/components/core/Tooltip.svelte +103 -0
- package/dist/components/core/Tooltip.svelte.d.ts +11 -0
- package/dist/components/core/index.d.ts +13 -0
- package/dist/components/core/index.js +14 -0
- package/dist/components/editor/AIFocusLayer.svelte +430 -0
- package/dist/components/editor/AIFocusLayer.svelte.d.ts +32 -0
- package/dist/components/editor/Breadcrumbs.svelte +435 -0
- package/dist/components/editor/Breadcrumbs.svelte.d.ts +33 -0
- package/dist/components/editor/BreakpointLayer.svelte +642 -0
- package/dist/components/editor/BreakpointLayer.svelte.d.ts +20 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte +324 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte.d.ts +18 -0
- package/dist/components/editor/CollaborativeEditor.svelte +218 -0
- package/dist/components/editor/CollaborativeEditor.svelte.d.ts +32 -0
- package/dist/components/editor/CommandPalette.svelte +434 -0
- package/dist/components/editor/CommandPalette.svelte.d.ts +11 -0
- package/dist/components/editor/ComplexityLayer.svelte +293 -0
- package/dist/components/editor/ComplexityLayer.svelte.d.ts +23 -0
- package/dist/components/editor/ConflictZoneLayer.svelte +441 -0
- package/dist/components/editor/ConflictZoneLayer.svelte.d.ts +25 -0
- package/dist/components/editor/ContextLens.svelte +262 -0
- package/dist/components/editor/ContextLens.svelte.d.ts +27 -0
- package/dist/components/editor/CustomEditor.svelte +1242 -0
- package/dist/components/editor/CustomEditor.svelte.d.ts +37 -0
- package/dist/components/editor/DebugConsole.svelte +646 -0
- package/dist/components/editor/DebugConsole.svelte.d.ts +41 -0
- package/dist/components/editor/EchoCursorLayer.svelte +363 -0
- package/dist/components/editor/EchoCursorLayer.svelte.d.ts +24 -0
- package/dist/components/editor/Editor.svelte +61 -0
- package/dist/components/editor/Editor.svelte.d.ts +22 -0
- package/dist/components/editor/EditorGutter.svelte +119 -0
- package/dist/components/editor/EditorGutter.svelte.d.ts +19 -0
- package/dist/components/editor/EditorLines.svelte +182 -0
- package/dist/components/editor/EditorLines.svelte.d.ts +43 -0
- package/dist/components/editor/EditorPane.svelte +134 -0
- package/dist/components/editor/EditorPane.svelte.d.ts +9 -0
- package/dist/components/editor/EditorSelections.svelte +186 -0
- package/dist/components/editor/EditorSelections.svelte.d.ts +25 -0
- package/dist/components/editor/EditorTabs.svelte +170 -0
- package/dist/components/editor/EditorTabs.svelte.d.ts +12 -0
- package/dist/components/editor/FileExplorer.svelte +811 -0
- package/dist/components/editor/FileExplorer.svelte.d.ts +67 -0
- package/dist/components/editor/FileIcon.svelte +110 -0
- package/dist/components/editor/FileIcon.svelte.d.ts +10 -0
- package/dist/components/editor/FindReplace.svelte +448 -0
- package/dist/components/editor/FindReplace.svelte.d.ts +40 -0
- package/dist/components/editor/GhostBracketLayer.svelte +391 -0
- package/dist/components/editor/GhostBracketLayer.svelte.d.ts +24 -0
- package/dist/components/editor/GitBlameLayer.svelte +436 -0
- package/dist/components/editor/GitBlameLayer.svelte.d.ts +18 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte +540 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte.d.ts +35 -0
- package/dist/components/editor/InlineDiffLayer.svelte +337 -0
- package/dist/components/editor/InlineDiffLayer.svelte.d.ts +31 -0
- package/dist/components/editor/MinimalEditor.svelte +75 -0
- package/dist/components/editor/MinimalEditor.svelte.d.ts +6 -0
- package/dist/components/editor/MinimalEditor2.svelte +84 -0
- package/dist/components/editor/MinimalEditor2.svelte.d.ts +6 -0
- package/dist/components/editor/Minimap.svelte +327 -0
- package/dist/components/editor/Minimap.svelte.d.ts +34 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte +793 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte.d.ts +49 -0
- package/dist/components/editor/ProblemsPanel.svelte +628 -0
- package/dist/components/editor/ProblemsPanel.svelte.d.ts +25 -0
- package/dist/components/editor/QuickActionsMenu.svelte +403 -0
- package/dist/components/editor/QuickActionsMenu.svelte.d.ts +18 -0
- package/dist/components/editor/SnippetPalette.svelte +530 -0
- package/dist/components/editor/SnippetPalette.svelte.d.ts +16 -0
- package/dist/components/editor/StructureMap.svelte +431 -0
- package/dist/components/editor/StructureMap.svelte.d.ts +37 -0
- package/dist/components/editor/SymbolOutline.svelte +722 -0
- package/dist/components/editor/SymbolOutline.svelte.d.ts +44 -0
- package/dist/components/editor/TimelineScrubber.svelte +470 -0
- package/dist/components/editor/TimelineScrubber.svelte.d.ts +40 -0
- package/dist/components/editor/TokenRenderer.svelte +69 -0
- package/dist/components/editor/TokenRenderer.svelte.d.ts +15 -0
- package/dist/components/editor/constants.d.ts +32 -0
- package/dist/components/editor/constants.js +36 -0
- package/dist/components/editor/core/ai-awareness.d.ts +176 -0
- package/dist/components/editor/core/ai-awareness.js +210 -0
- package/dist/components/editor/core/bracket-healer.d.ts +189 -0
- package/dist/components/editor/core/bracket-healer.js +406 -0
- package/dist/components/editor/core/breakpoints.d.ts +203 -0
- package/dist/components/editor/core/breakpoints.js +414 -0
- package/dist/components/editor/core/commands.d.ts +108 -0
- package/dist/components/editor/core/commands.js +246 -0
- package/dist/components/editor/core/complexity-analyzer.d.ts +123 -0
- package/dist/components/editor/core/complexity-analyzer.js +376 -0
- package/dist/components/editor/core/conflict-predictor.d.ts +135 -0
- package/dist/components/editor/core/conflict-predictor.js +316 -0
- package/dist/components/editor/core/crdt-binding.d.ts +118 -0
- package/dist/components/editor/core/crdt-binding.js +286 -0
- package/dist/components/editor/core/diagnostics.d.ts +210 -0
- package/dist/components/editor/core/diagnostics.js +335 -0
- package/dist/components/editor/core/echo-cursor.d.ts +201 -0
- package/dist/components/editor/core/echo-cursor.js +267 -0
- package/dist/components/editor/core/folding.d.ts +124 -0
- package/dist/components/editor/core/folding.js +672 -0
- package/dist/components/editor/core/ghost-pair.d.ts +122 -0
- package/dist/components/editor/core/ghost-pair.js +221 -0
- package/dist/components/editor/core/git-blame.d.ts +170 -0
- package/dist/components/editor/core/git-blame.js +324 -0
- package/dist/components/editor/core/index.d.ts +26 -0
- package/dist/components/editor/core/index.js +24 -0
- package/dist/components/editor/core/keybindings.d.ts +79 -0
- package/dist/components/editor/core/keybindings.js +357 -0
- package/dist/components/editor/core/multi-cursor.d.ts +196 -0
- package/dist/components/editor/core/multi-cursor.js +521 -0
- package/dist/components/editor/core/navigation.d.ts +107 -0
- package/dist/components/editor/core/navigation.js +408 -0
- package/dist/components/editor/core/quick-actions.d.ts +189 -0
- package/dist/components/editor/core/quick-actions.js +427 -0
- package/dist/components/editor/core/search.d.ts +88 -0
- package/dist/components/editor/core/search.js +192 -0
- package/dist/components/editor/core/semantic-analyzer.d.ts +77 -0
- package/dist/components/editor/core/semantic-analyzer.js +424 -0
- package/dist/components/editor/core/snippet-manager.d.ts +202 -0
- package/dist/components/editor/core/snippet-manager.js +565 -0
- package/dist/components/editor/core/state.d.ts +367 -0
- package/dist/components/editor/core/state.js +900 -0
- package/dist/components/editor/core/timeline.d.ts +204 -0
- package/dist/components/editor/core/timeline.js +349 -0
- package/dist/components/editor/editor-find.d.ts +56 -0
- package/dist/components/editor/editor-find.js +148 -0
- package/dist/components/editor/editor-input.d.ts +77 -0
- package/dist/components/editor/editor-input.js +445 -0
- package/dist/components/editor/editor-multicursor.d.ts +21 -0
- package/dist/components/editor/editor-multicursor.js +196 -0
- package/dist/components/editor/editor-scroll.d.ts +14 -0
- package/dist/components/editor/editor-scroll.js +34 -0
- package/dist/components/editor/index.d.ts +15 -0
- package/dist/components/editor/index.js +21 -0
- package/dist/components/editor/languages.d.ts +62 -0
- package/dist/components/editor/languages.js +285 -0
- package/dist/components/editor/theme.d.ts +88 -0
- package/dist/components/editor/theme.js +139 -0
- package/dist/components/editor/tokenizer/base.d.ts +40 -0
- package/dist/components/editor/tokenizer/base.js +203 -0
- package/dist/components/editor/tokenizer/index.d.ts +56 -0
- package/dist/components/editor/tokenizer/index.js +215 -0
- package/dist/components/editor/tokenizer/languages/css.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/css.js +194 -0
- package/dist/components/editor/tokenizer/languages/go.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/go.js +220 -0
- package/dist/components/editor/tokenizer/languages/html.d.ts +24 -0
- package/dist/components/editor/tokenizer/languages/html.js +145 -0
- package/dist/components/editor/tokenizer/languages/javascript.d.ts +56 -0
- package/dist/components/editor/tokenizer/languages/javascript.js +452 -0
- package/dist/components/editor/tokenizer/languages/json.d.ts +12 -0
- package/dist/components/editor/tokenizer/languages/json.js +91 -0
- package/dist/components/editor/tokenizer/languages/markdown.d.ts +16 -0
- package/dist/components/editor/tokenizer/languages/markdown.js +156 -0
- package/dist/components/editor/tokenizer/languages/python.d.ts +20 -0
- package/dist/components/editor/tokenizer/languages/python.js +227 -0
- package/dist/components/editor/tokenizer/languages/svelte.d.ts +40 -0
- package/dist/components/editor/tokenizer/languages/svelte.js +326 -0
- package/dist/components/editor/tokenizer/types.d.ts +86 -0
- package/dist/components/editor/tokenizer/types.js +4 -0
- package/dist/components/layout/IDELayout.svelte +274 -0
- package/dist/components/layout/IDELayout.svelte.d.ts +29 -0
- package/dist/components/layout/StatusBar.svelte +511 -0
- package/dist/components/layout/StatusBar.svelte.d.ts +47 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +3 -0
- package/dist/components/lsp/AutocompleteWidget.svelte +364 -0
- package/dist/components/lsp/AutocompleteWidget.svelte.d.ts +33 -0
- package/dist/components/lsp/DiagnosticMarker.svelte +166 -0
- package/dist/components/lsp/DiagnosticMarker.svelte.d.ts +19 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte +388 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte.d.ts +21 -0
- package/dist/components/lsp/HoverTooltip.svelte +274 -0
- package/dist/components/lsp/HoverTooltip.svelte.d.ts +24 -0
- package/dist/components/lsp/LSPEditor.svelte +486 -0
- package/dist/components/lsp/LSPEditor.svelte.d.ts +39 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte +216 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte.d.ts +22 -0
- package/dist/components/lsp/index.d.ts +6 -0
- package/dist/components/lsp/index.js +7 -0
- package/dist/components/plugins/PluginCard.svelte +153 -0
- package/dist/components/plugins/PluginCard.svelte.d.ts +19 -0
- package/dist/components/plugins/PluginPanel.svelte +280 -0
- package/dist/components/plugins/PluginPanel.svelte.d.ts +8 -0
- package/dist/components/plugins/PluginProposalForm.svelte +250 -0
- package/dist/components/plugins/PluginProposalForm.svelte.d.ts +6 -0
- package/dist/components/plugins/PluginStatusBadge.svelte +14 -0
- package/dist/components/plugins/PluginStatusBadge.svelte.d.ts +8 -0
- package/dist/components/plugins/index.d.ts +4 -0
- package/dist/components/plugins/index.js +5 -0
- package/dist/components/vfs/LockConflictDialog.svelte +705 -0
- package/dist/components/vfs/LockConflictDialog.svelte.d.ts +21 -0
- package/dist/components/vfs/LockIndicator.svelte +194 -0
- package/dist/components/vfs/LockIndicator.svelte.d.ts +29 -0
- package/dist/components/vfs/LockOverlay.svelte +344 -0
- package/dist/components/vfs/LockOverlay.svelte.d.ts +17 -0
- package/dist/components/vfs/VersionConflictDialog.svelte +549 -0
- package/dist/components/vfs/VersionConflictDialog.svelte.d.ts +24 -0
- package/dist/components/vfs/index.d.ts +4 -0
- package/dist/components/vfs/index.js +5 -0
- package/dist/crdt/awareness.d.ts +42 -0
- package/dist/crdt/awareness.js +109 -0
- package/dist/crdt/document.d.ts +101 -0
- package/dist/crdt/document.js +187 -0
- package/dist/crdt/index.d.ts +9 -0
- package/dist/crdt/index.js +8 -0
- package/dist/crdt/provider.d.ts +85 -0
- package/dist/crdt/provider.js +150 -0
- package/dist/crdt/types.d.ts +61 -0
- package/dist/crdt/types.js +4 -0
- package/dist/crdt/undo.d.ts +34 -0
- package/dist/crdt/undo.js +70 -0
- package/dist/index.d.ts +277 -0
- package/dist/index.js +280 -0
- package/dist/plugins/index.d.ts +103 -0
- package/dist/plugins/index.js +153 -0
- package/dist/services/error-handling.d.ts +95 -0
- package/dist/services/error-handling.js +413 -0
- package/dist/services/ide-integration.d.ts +83 -0
- package/dist/services/ide-integration.js +367 -0
- package/dist/services/lsp-client.d.ts +69 -0
- package/dist/services/lsp-client.js +667 -0
- package/dist/services/mock-ai.d.ts +37 -0
- package/dist/services/mock-ai.js +318 -0
- package/dist/services/optimistic.d.ts +141 -0
- package/dist/services/optimistic.js +367 -0
- package/dist/services/vfs-client.d.ts +81 -0
- package/dist/services/vfs-client.js +348 -0
- package/dist/stores/agents.svelte.d.ts +85 -0
- package/dist/stores/agents.svelte.js +459 -0
- package/dist/stores/ai-persistence.svelte.d.ts +76 -0
- package/dist/stores/ai-persistence.svelte.js +334 -0
- package/dist/stores/ai.svelte.d.ts +140 -0
- package/dist/stores/ai.svelte.js +383 -0
- package/dist/stores/collaboration.svelte.d.ts +164 -0
- package/dist/stores/collaboration.svelte.js +334 -0
- package/dist/stores/editor.svelte.d.ts +131 -0
- package/dist/stores/editor.svelte.js +250 -0
- package/dist/stores/index.d.ts +10 -0
- package/dist/stores/index.js +29 -0
- package/dist/stores/layout.svelte.d.ts +171 -0
- package/dist/stores/layout.svelte.js +351 -0
- package/dist/stores/plugin.svelte.d.ts +121 -0
- package/dist/stores/plugin.svelte.js +410 -0
- package/dist/stores/vfs.svelte.d.ts +123 -0
- package/dist/stores/vfs.svelte.js +680 -0
- package/dist/styles/theme.css +623 -0
- package/dist/types/agents.d.ts +127 -0
- package/dist/types/agents.js +5 -0
- package/dist/types/ai.d.ts +137 -0
- package/dist/types/ai.js +4 -0
- package/dist/types/crdt.d.ts +222 -0
- package/dist/types/crdt.js +5 -0
- package/dist/types/editor.d.ts +52 -0
- package/dist/types/editor.js +18 -0
- package/dist/types/events.d.ts +133 -0
- package/dist/types/events.js +4 -0
- package/dist/types/filesystem.d.ts +77 -0
- package/dist/types/filesystem.js +4 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +12 -0
- package/dist/types/lsp.d.ts +691 -0
- package/dist/types/lsp.js +108 -0
- package/dist/types/plugin.d.ts +239 -0
- package/dist/types/plugin.js +5 -0
- package/dist/types/vfs.d.ts +191 -0
- package/dist/types/vfs.js +18 -0
- package/dist/utils/format.d.ts +55 -0
- package/dist/utils/format.js +152 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/keybindings.d.ts +33 -0
- package/dist/utils/keybindings.js +171 -0
- package/dist/utils/language.d.ts +27 -0
- package/dist/utils/language.js +222 -0
- package/package.json +178 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success';
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
type?: 'button' | 'submit' | 'reset';
|
|
11
|
+
title?: string;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
icon?: Snippet;
|
|
16
|
+
onclick?: (event: MouseEvent) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
variant = 'primary',
|
|
21
|
+
size = 'md',
|
|
22
|
+
disabled = false,
|
|
23
|
+
loading = false,
|
|
24
|
+
fullWidth = false,
|
|
25
|
+
type = 'button',
|
|
26
|
+
title,
|
|
27
|
+
'aria-label': ariaLabel,
|
|
28
|
+
class: className = '',
|
|
29
|
+
children,
|
|
30
|
+
icon,
|
|
31
|
+
onclick
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<button
|
|
36
|
+
{type}
|
|
37
|
+
class="ide-button ide-button--{variant} ide-button--{size} {fullWidth
|
|
38
|
+
? 'ide-button--full'
|
|
39
|
+
: ''} {className}"
|
|
40
|
+
disabled={disabled || loading}
|
|
41
|
+
{title}
|
|
42
|
+
aria-label={ariaLabel}
|
|
43
|
+
{onclick}
|
|
44
|
+
>
|
|
45
|
+
{#if loading}
|
|
46
|
+
<span class="ide-button__spinner"></span>
|
|
47
|
+
{:else if icon}
|
|
48
|
+
<span class="ide-button__icon">
|
|
49
|
+
{@render icon()}
|
|
50
|
+
</span>
|
|
51
|
+
{/if}
|
|
52
|
+
<span class="ide-button__content">
|
|
53
|
+
{@render children()}
|
|
54
|
+
</span>
|
|
55
|
+
</button>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.ide-button {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
gap: var(--ide-spacing-sm);
|
|
63
|
+
font-family: var(--ide-font-sans);
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
border-radius: var(--ide-radius-md);
|
|
66
|
+
transition: all var(--ide-transition-fast);
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
border: 1px solid transparent;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ide-button:focus-visible {
|
|
73
|
+
outline: 2px solid var(--ide-interactive-focus);
|
|
74
|
+
outline-offset: 2px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ide-button:disabled {
|
|
78
|
+
opacity: 0.5;
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ide-button--full {
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Variants */
|
|
87
|
+
.ide-button--primary {
|
|
88
|
+
background: var(--ide-interactive-active);
|
|
89
|
+
color: var(--ide-text-primary);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ide-button--primary:hover:not(:disabled) {
|
|
93
|
+
background: var(--ide-interactive-hover);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ide-button--secondary {
|
|
97
|
+
background: var(--ide-bg-tertiary);
|
|
98
|
+
color: var(--ide-text-primary);
|
|
99
|
+
border-color: var(--ide-border);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ide-button--secondary:hover:not(:disabled) {
|
|
103
|
+
background: var(--ide-bg-hover);
|
|
104
|
+
border-color: var(--ide-interactive);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ide-button--ghost {
|
|
108
|
+
background: transparent;
|
|
109
|
+
color: var(--ide-text-secondary);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ide-button--ghost:hover:not(:disabled) {
|
|
113
|
+
background: var(--ide-bg-elevated);
|
|
114
|
+
color: var(--ide-text-primary);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ide-button--danger {
|
|
118
|
+
background: var(--ide-error);
|
|
119
|
+
color: white;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ide-button--danger:hover:not(:disabled) {
|
|
123
|
+
background: color-mix(in srgb, var(--ide-error) 80%, black);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ide-button--success {
|
|
127
|
+
background: var(--ide-success);
|
|
128
|
+
color: var(--ide-text-inverse);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ide-button--success:hover:not(:disabled) {
|
|
132
|
+
background: color-mix(in srgb, var(--ide-success) 80%, black);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Sizes */
|
|
136
|
+
.ide-button--xs {
|
|
137
|
+
height: 1.5rem;
|
|
138
|
+
padding: 0 var(--ide-spacing-xs);
|
|
139
|
+
font-size: var(--ide-font-size-xs);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.ide-button--sm {
|
|
143
|
+
height: 1.75rem;
|
|
144
|
+
padding: 0 var(--ide-spacing-sm);
|
|
145
|
+
font-size: var(--ide-font-size-xs);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.ide-button--md {
|
|
149
|
+
height: 2.25rem;
|
|
150
|
+
padding: 0 var(--ide-spacing-md);
|
|
151
|
+
font-size: var(--ide-font-size-sm);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ide-button--lg {
|
|
155
|
+
height: 2.75rem;
|
|
156
|
+
padding: 0 var(--ide-spacing-lg);
|
|
157
|
+
font-size: var(--ide-font-size-base);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Spinner */
|
|
161
|
+
.ide-button__spinner {
|
|
162
|
+
width: 1em;
|
|
163
|
+
height: 1em;
|
|
164
|
+
border: 2px solid currentColor;
|
|
165
|
+
border-right-color: transparent;
|
|
166
|
+
border-radius: 50%;
|
|
167
|
+
animation: ide-spin 0.6s linear infinite;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.ide-button__icon {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success';
|
|
4
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
type?: 'button' | 'submit' | 'reset';
|
|
9
|
+
title?: string;
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
children: Snippet;
|
|
13
|
+
icon?: Snippet;
|
|
14
|
+
onclick?: (event: MouseEvent) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type Button = ReturnType<typeof Button>;
|
|
18
|
+
export default Button;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* ConnectionStatus Component
|
|
4
|
+
*
|
|
5
|
+
* Displays the current connection status with the VFS server.
|
|
6
|
+
* Shows connected, disconnected, and reconnecting states.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type ConnectionState = 'connected' | 'disconnected' | 'connecting' | 'reconnecting' | 'error';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
state: ConnectionState;
|
|
13
|
+
reconnectAttempts?: number;
|
|
14
|
+
maxReconnectAttempts?: number;
|
|
15
|
+
lastEventTime?: string | null;
|
|
16
|
+
errorMessage?: string | null;
|
|
17
|
+
onRetry?: () => void;
|
|
18
|
+
compact?: boolean;
|
|
19
|
+
showLabel?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
state,
|
|
24
|
+
reconnectAttempts = 0,
|
|
25
|
+
maxReconnectAttempts = 10,
|
|
26
|
+
lastEventTime = null,
|
|
27
|
+
errorMessage = null,
|
|
28
|
+
onRetry,
|
|
29
|
+
compact = false,
|
|
30
|
+
showLabel = true
|
|
31
|
+
}: Props = $props();
|
|
32
|
+
|
|
33
|
+
// Computed display values
|
|
34
|
+
let statusLabel = $derived.by(() => {
|
|
35
|
+
switch (state) {
|
|
36
|
+
case 'connected':
|
|
37
|
+
return 'Connected';
|
|
38
|
+
case 'disconnected':
|
|
39
|
+
return 'Disconnected';
|
|
40
|
+
case 'connecting':
|
|
41
|
+
return 'Connecting...';
|
|
42
|
+
case 'reconnecting':
|
|
43
|
+
return `Reconnecting (${reconnectAttempts}/${maxReconnectAttempts})`;
|
|
44
|
+
case 'error':
|
|
45
|
+
return 'Connection Error';
|
|
46
|
+
default:
|
|
47
|
+
return 'Unknown';
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
let statusIcon = $derived.by(() => {
|
|
52
|
+
switch (state) {
|
|
53
|
+
case 'connected':
|
|
54
|
+
return 'check';
|
|
55
|
+
case 'disconnected':
|
|
56
|
+
case 'error':
|
|
57
|
+
return 'x';
|
|
58
|
+
case 'connecting':
|
|
59
|
+
case 'reconnecting':
|
|
60
|
+
return 'loader';
|
|
61
|
+
default:
|
|
62
|
+
return 'circle';
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
let lastSyncDisplay = $derived.by(() => {
|
|
67
|
+
if (!lastEventTime) return null;
|
|
68
|
+
const date = new Date(lastEventTime);
|
|
69
|
+
const now = new Date();
|
|
70
|
+
const diff = now.getTime() - date.getTime();
|
|
71
|
+
|
|
72
|
+
if (diff < 60000) return 'Just now';
|
|
73
|
+
if (diff < 3600000) return `${Math.floor(diff / 60000)}m ago`;
|
|
74
|
+
if (diff < 86400000) return `${Math.floor(diff / 3600000)}h ago`;
|
|
75
|
+
return date.toLocaleDateString();
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<div
|
|
80
|
+
class="connection-status"
|
|
81
|
+
class:compact
|
|
82
|
+
class:connected={state === 'connected'}
|
|
83
|
+
class:disconnected={state === 'disconnected'}
|
|
84
|
+
class:connecting={state === 'connecting' || state === 'reconnecting'}
|
|
85
|
+
class:error={state === 'error'}
|
|
86
|
+
role="status"
|
|
87
|
+
aria-live="polite"
|
|
88
|
+
>
|
|
89
|
+
<span class="status-indicator">
|
|
90
|
+
{#if statusIcon === 'check'}
|
|
91
|
+
<svg
|
|
92
|
+
class="icon icon-check"
|
|
93
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
94
|
+
width="14"
|
|
95
|
+
height="14"
|
|
96
|
+
viewBox="0 0 24 24"
|
|
97
|
+
fill="none"
|
|
98
|
+
stroke="currentColor"
|
|
99
|
+
stroke-width="2"
|
|
100
|
+
stroke-linecap="round"
|
|
101
|
+
stroke-linejoin="round"
|
|
102
|
+
>
|
|
103
|
+
<polyline points="20 6 9 17 4 12" />
|
|
104
|
+
</svg>
|
|
105
|
+
{:else if statusIcon === 'x'}
|
|
106
|
+
<svg
|
|
107
|
+
class="icon icon-x"
|
|
108
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
109
|
+
width="14"
|
|
110
|
+
height="14"
|
|
111
|
+
viewBox="0 0 24 24"
|
|
112
|
+
fill="none"
|
|
113
|
+
stroke="currentColor"
|
|
114
|
+
stroke-width="2"
|
|
115
|
+
stroke-linecap="round"
|
|
116
|
+
stroke-linejoin="round"
|
|
117
|
+
>
|
|
118
|
+
<path d="M18 6 6 18M6 6l12 12" />
|
|
119
|
+
</svg>
|
|
120
|
+
{:else if statusIcon === 'loader'}
|
|
121
|
+
<svg
|
|
122
|
+
class="icon icon-loader"
|
|
123
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
124
|
+
width="14"
|
|
125
|
+
height="14"
|
|
126
|
+
viewBox="0 0 24 24"
|
|
127
|
+
fill="none"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
stroke-width="2"
|
|
130
|
+
stroke-linecap="round"
|
|
131
|
+
stroke-linejoin="round"
|
|
132
|
+
>
|
|
133
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
134
|
+
</svg>
|
|
135
|
+
{:else}
|
|
136
|
+
<span class="dot"></span>
|
|
137
|
+
{/if}
|
|
138
|
+
</span>
|
|
139
|
+
|
|
140
|
+
{#if showLabel}
|
|
141
|
+
<span class="status-label">{statusLabel}</span>
|
|
142
|
+
{/if}
|
|
143
|
+
|
|
144
|
+
{#if lastSyncDisplay && state === 'connected' && !compact}
|
|
145
|
+
<span class="last-sync">Last sync: {lastSyncDisplay}</span>
|
|
146
|
+
{/if}
|
|
147
|
+
|
|
148
|
+
{#if (state === 'disconnected' || state === 'error') && onRetry}
|
|
149
|
+
<button class="retry-btn" onclick={onRetry}>
|
|
150
|
+
<svg
|
|
151
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
152
|
+
width="12"
|
|
153
|
+
height="12"
|
|
154
|
+
viewBox="0 0 24 24"
|
|
155
|
+
fill="none"
|
|
156
|
+
stroke="currentColor"
|
|
157
|
+
stroke-width="2"
|
|
158
|
+
stroke-linecap="round"
|
|
159
|
+
stroke-linejoin="round"
|
|
160
|
+
>
|
|
161
|
+
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
|
|
162
|
+
<path d="M21 3v5h-5" />
|
|
163
|
+
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
|
|
164
|
+
<path d="M3 21v-5h5" />
|
|
165
|
+
</svg>
|
|
166
|
+
Retry
|
|
167
|
+
</button>
|
|
168
|
+
{/if}
|
|
169
|
+
|
|
170
|
+
{#if errorMessage && state === 'error' && !compact}
|
|
171
|
+
<span class="error-message" title={errorMessage}>
|
|
172
|
+
{errorMessage.length > 40 ? `${errorMessage.slice(0, 40)}...` : errorMessage}
|
|
173
|
+
</span>
|
|
174
|
+
{/if}
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<style>
|
|
178
|
+
.connection-status {
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 6px;
|
|
182
|
+
font-size: 12px;
|
|
183
|
+
color: var(--ide-text-secondary, #a0a0a0);
|
|
184
|
+
padding: 4px 8px;
|
|
185
|
+
border-radius: 4px;
|
|
186
|
+
transition: all 0.2s ease;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.connection-status.compact {
|
|
190
|
+
padding: 2px 4px;
|
|
191
|
+
gap: 4px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.connection-status.connected {
|
|
195
|
+
color: var(--ide-agent-online, #4ec9b0);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.connection-status.disconnected {
|
|
199
|
+
color: var(--ide-text-muted, #808080);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.connection-status.connecting {
|
|
203
|
+
color: var(--ide-agent-busy, #dcdcaa);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.connection-status.error {
|
|
207
|
+
color: var(--ide-error, #f44747);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.status-indicator {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
width: 16px;
|
|
215
|
+
height: 16px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.icon {
|
|
219
|
+
width: 14px;
|
|
220
|
+
height: 14px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.icon-loader {
|
|
224
|
+
animation: spin 1s linear infinite;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@keyframes spin {
|
|
228
|
+
from {
|
|
229
|
+
transform: rotate(0deg);
|
|
230
|
+
}
|
|
231
|
+
to {
|
|
232
|
+
transform: rotate(360deg);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.dot {
|
|
237
|
+
width: 8px;
|
|
238
|
+
height: 8px;
|
|
239
|
+
border-radius: 50%;
|
|
240
|
+
background: currentColor;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.status-label {
|
|
244
|
+
font-weight: 500;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.last-sync {
|
|
248
|
+
color: var(--ide-text-muted, #808080);
|
|
249
|
+
font-size: 11px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.retry-btn {
|
|
253
|
+
display: inline-flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
gap: 4px;
|
|
256
|
+
padding: 2px 6px;
|
|
257
|
+
background: var(--ide-bg-tertiary, #2d2d2d);
|
|
258
|
+
border: 1px solid var(--ide-border, #3c3c3c);
|
|
259
|
+
border-radius: 3px;
|
|
260
|
+
color: var(--ide-text-secondary, #a0a0a0);
|
|
261
|
+
font-size: 11px;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
transition: all 0.15s ease;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.retry-btn:hover {
|
|
267
|
+
background: var(--ide-bg-hover, #3c3c3c);
|
|
268
|
+
color: var(--ide-text-primary, #e0e0e0);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.error-message {
|
|
272
|
+
font-size: 11px;
|
|
273
|
+
color: var(--ide-error, #f44747);
|
|
274
|
+
max-width: 200px;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
text-overflow: ellipsis;
|
|
277
|
+
white-space: nowrap;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Pulse animation for reconnecting */
|
|
281
|
+
.connection-status.connecting .dot {
|
|
282
|
+
animation: pulse 1.5s ease-in-out infinite;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@keyframes pulse {
|
|
286
|
+
0%,
|
|
287
|
+
100% {
|
|
288
|
+
opacity: 1;
|
|
289
|
+
}
|
|
290
|
+
50% {
|
|
291
|
+
opacity: 0.4;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectionStatus Component
|
|
3
|
+
*
|
|
4
|
+
* Displays the current connection status with the VFS server.
|
|
5
|
+
* Shows connected, disconnected, and reconnecting states.
|
|
6
|
+
*/
|
|
7
|
+
export type ConnectionState = 'connected' | 'disconnected' | 'connecting' | 'reconnecting' | 'error';
|
|
8
|
+
interface Props {
|
|
9
|
+
state: ConnectionState;
|
|
10
|
+
reconnectAttempts?: number;
|
|
11
|
+
maxReconnectAttempts?: number;
|
|
12
|
+
lastEventTime?: string | null;
|
|
13
|
+
errorMessage?: string | null;
|
|
14
|
+
onRetry?: () => void;
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
showLabel?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const ConnectionStatus: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type ConnectionStatus = ReturnType<typeof ConnectionStatus>;
|
|
20
|
+
export default ConnectionStatus;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from './Icon.svelte';
|
|
3
|
+
import Kbd from './Kbd.svelte';
|
|
4
|
+
|
|
5
|
+
export interface ContextMenuItem {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
shortcut?: string[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
danger?: boolean;
|
|
12
|
+
separator?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
items: ContextMenuItem[];
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
onSelect: (item: ContextMenuItem) => void;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let { items, x, y, onSelect, onClose }: Props = $props();
|
|
24
|
+
|
|
25
|
+
let menuRef: HTMLDivElement;
|
|
26
|
+
|
|
27
|
+
// Adjust position to stay in viewport
|
|
28
|
+
let adjustedX = $state(0);
|
|
29
|
+
let adjustedY = $state(0);
|
|
30
|
+
|
|
31
|
+
$effect(() => {
|
|
32
|
+
// Initialize with prop values and adjust based on viewport
|
|
33
|
+
if (menuRef) {
|
|
34
|
+
const rect = menuRef.getBoundingClientRect();
|
|
35
|
+
const viewportWidth = window.innerWidth;
|
|
36
|
+
const viewportHeight = window.innerHeight;
|
|
37
|
+
|
|
38
|
+
if (x + rect.width > viewportWidth) {
|
|
39
|
+
adjustedX = viewportWidth - rect.width - 8;
|
|
40
|
+
} else {
|
|
41
|
+
adjustedX = x;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (y + rect.height > viewportHeight) {
|
|
45
|
+
adjustedY = viewportHeight - rect.height - 8;
|
|
46
|
+
} else {
|
|
47
|
+
adjustedY = y;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
// Before menu is mounted, use initial prop values
|
|
51
|
+
adjustedX = x;
|
|
52
|
+
adjustedY = y;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
function handleClick(item: ContextMenuItem) {
|
|
57
|
+
if (item.disabled || item.separator) return;
|
|
58
|
+
onSelect(item);
|
|
59
|
+
onClose();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
63
|
+
if (event.key === 'Escape') {
|
|
64
|
+
onClose();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function handleBackdropClick(event: MouseEvent) {
|
|
69
|
+
if (event.target === event.currentTarget) {
|
|
70
|
+
onClose();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<svelte:window onkeydown={handleKeydown} />
|
|
76
|
+
|
|
77
|
+
<div class="ide-context-menu-backdrop" onclick={handleBackdropClick} role="presentation">
|
|
78
|
+
<div
|
|
79
|
+
bind:this={menuRef}
|
|
80
|
+
class="ide-context-menu"
|
|
81
|
+
style="left: {adjustedX}px; top: {adjustedY}px"
|
|
82
|
+
role="menu"
|
|
83
|
+
>
|
|
84
|
+
{#each items as item}
|
|
85
|
+
{#if item.separator}
|
|
86
|
+
<div class="ide-context-menu__separator"></div>
|
|
87
|
+
{:else}
|
|
88
|
+
<button
|
|
89
|
+
class="ide-context-menu__item"
|
|
90
|
+
class:ide-context-menu__item--disabled={item.disabled}
|
|
91
|
+
class:ide-context-menu__item--danger={item.danger}
|
|
92
|
+
disabled={item.disabled}
|
|
93
|
+
role="menuitem"
|
|
94
|
+
onclick={() => handleClick(item)}
|
|
95
|
+
>
|
|
96
|
+
{#if item.icon}
|
|
97
|
+
<Icon name={item.icon} size={14} />
|
|
98
|
+
{:else}
|
|
99
|
+
<span class="ide-context-menu__icon-placeholder"></span>
|
|
100
|
+
{/if}
|
|
101
|
+
<span class="ide-context-menu__label">{item.label}</span>
|
|
102
|
+
{#if item.shortcut}
|
|
103
|
+
<Kbd keys={item.shortcut} />
|
|
104
|
+
{/if}
|
|
105
|
+
</button>
|
|
106
|
+
{/if}
|
|
107
|
+
{/each}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<style>
|
|
112
|
+
.ide-context-menu-backdrop {
|
|
113
|
+
position: fixed;
|
|
114
|
+
inset: 0;
|
|
115
|
+
z-index: var(--ide-z-dropdown);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.ide-context-menu {
|
|
119
|
+
position: fixed;
|
|
120
|
+
min-width: 180px;
|
|
121
|
+
padding: var(--ide-spacing-xs);
|
|
122
|
+
background: var(--ide-bg-elevated);
|
|
123
|
+
border: 1px solid var(--ide-border);
|
|
124
|
+
border-radius: var(--ide-radius-lg);
|
|
125
|
+
box-shadow: var(--ide-shadow-lg);
|
|
126
|
+
animation: ide-fade-in var(--ide-transition-fast);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.ide-context-menu__item {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: var(--ide-spacing-sm);
|
|
133
|
+
width: 100%;
|
|
134
|
+
padding: var(--ide-spacing-xs) var(--ide-spacing-sm);
|
|
135
|
+
font-family: var(--ide-font-sans);
|
|
136
|
+
font-size: var(--ide-font-size-sm);
|
|
137
|
+
color: var(--ide-text-primary);
|
|
138
|
+
background: transparent;
|
|
139
|
+
border: none;
|
|
140
|
+
border-radius: var(--ide-radius-sm);
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
text-align: left;
|
|
143
|
+
transition: background var(--ide-transition-fast);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ide-context-menu__item:hover:not(:disabled) {
|
|
147
|
+
background: var(--ide-bg-hover);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ide-context-menu__item--disabled {
|
|
151
|
+
opacity: 0.5;
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ide-context-menu__item--danger {
|
|
156
|
+
color: var(--ide-error);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.ide-context-menu__item--danger:hover:not(:disabled) {
|
|
160
|
+
background: color-mix(in srgb, var(--ide-error) 15%, transparent);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.ide-context-menu__icon-placeholder {
|
|
164
|
+
width: 14px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ide-context-menu__label {
|
|
168
|
+
flex: 1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ide-context-menu__separator {
|
|
172
|
+
height: 1px;
|
|
173
|
+
margin: var(--ide-spacing-xs) 0;
|
|
174
|
+
background: var(--ide-border);
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ContextMenuItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
shortcut?: string[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
separator?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
items: ContextMenuItem[];
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
onSelect: (item: ContextMenuItem) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare const ContextMenu: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type ContextMenu = ReturnType<typeof ContextMenu>;
|
|
19
|
+
export default ContextMenu;
|