@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,441 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Conflict Zone Layer
|
|
4
|
+
*
|
|
5
|
+
* Visualizes potential conflict zones when multiple users
|
|
6
|
+
* are editing nearby regions. Shows warning indicators
|
|
7
|
+
* and participant avatars.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ConflictZone } from './core/conflict-predictor';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Conflict zones to display */
|
|
14
|
+
zones: ConflictZone[];
|
|
15
|
+
/** Line height in pixels */
|
|
16
|
+
lineHeight: number;
|
|
17
|
+
/** Gutter width in pixels */
|
|
18
|
+
gutterWidth?: number;
|
|
19
|
+
/** Whether to show participant indicators */
|
|
20
|
+
showParticipants?: boolean;
|
|
21
|
+
/** Whether enabled */
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
/** Callback when zone is clicked */
|
|
24
|
+
onZoneClick?: (zone: ConflictZone) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
zones = [],
|
|
29
|
+
lineHeight,
|
|
30
|
+
gutterWidth = 50,
|
|
31
|
+
showParticipants = true,
|
|
32
|
+
enabled = true,
|
|
33
|
+
onZoneClick
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
|
|
36
|
+
let hoveredZone = $state<ConflictZone | null>(null);
|
|
37
|
+
let tooltipPosition = $state({ top: 0, left: 0 });
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get color for severity level
|
|
41
|
+
*/
|
|
42
|
+
function getSeverityColor(severity: ConflictZone['severity']): string {
|
|
43
|
+
switch (severity) {
|
|
44
|
+
case 'critical':
|
|
45
|
+
return '#ef4444';
|
|
46
|
+
case 'high':
|
|
47
|
+
return '#f59e0b';
|
|
48
|
+
case 'medium':
|
|
49
|
+
return '#eab308';
|
|
50
|
+
case 'low':
|
|
51
|
+
return '#22c55e';
|
|
52
|
+
default:
|
|
53
|
+
return '#6b7280';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get opacity based on probability
|
|
59
|
+
*/
|
|
60
|
+
function getOpacity(probability: number): number {
|
|
61
|
+
return 0.1 + probability * 0.3;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get border opacity based on probability
|
|
66
|
+
*/
|
|
67
|
+
function getBorderOpacity(probability: number): number {
|
|
68
|
+
return 0.3 + probability * 0.5;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleMouseEnter(zone: ConflictZone, event: MouseEvent) {
|
|
72
|
+
hoveredZone = zone;
|
|
73
|
+
const rect = (event.target as HTMLElement).getBoundingClientRect();
|
|
74
|
+
tooltipPosition = {
|
|
75
|
+
top: rect.top + window.scrollY,
|
|
76
|
+
left: rect.right + 8
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function handleMouseLeave() {
|
|
81
|
+
hoveredZone = null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function handleClick(zone: ConflictZone) {
|
|
85
|
+
onZoneClick?.(zone);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get initials from name
|
|
90
|
+
*/
|
|
91
|
+
function getInitials(name: string): string {
|
|
92
|
+
return name
|
|
93
|
+
.split(' ')
|
|
94
|
+
.map((n) => n[0])
|
|
95
|
+
.join('')
|
|
96
|
+
.toUpperCase()
|
|
97
|
+
.slice(0, 2);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get severity icon
|
|
102
|
+
*/
|
|
103
|
+
function getSeverityIcon(severity: ConflictZone['severity']): string {
|
|
104
|
+
switch (severity) {
|
|
105
|
+
case 'critical':
|
|
106
|
+
return '\u{26A0}'; // Warning sign
|
|
107
|
+
case 'high':
|
|
108
|
+
return '\u{26A0}';
|
|
109
|
+
case 'medium':
|
|
110
|
+
return '\u{1F6C8}'; // Information
|
|
111
|
+
case 'low':
|
|
112
|
+
return '\u{1F465}'; // People
|
|
113
|
+
default:
|
|
114
|
+
return '\u{1F465}';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
{#if enabled && zones.length > 0}
|
|
120
|
+
<div class="conflict-zones" aria-hidden="true">
|
|
121
|
+
{#each zones as zone (zone.id)}
|
|
122
|
+
{@const color = getSeverityColor(zone.severity)}
|
|
123
|
+
{@const height = (zone.endLine - zone.startLine + 1) * lineHeight}
|
|
124
|
+
<div
|
|
125
|
+
class="conflict-zone conflict-zone--{zone.severity}"
|
|
126
|
+
style="
|
|
127
|
+
top: {zone.startLine * lineHeight}px;
|
|
128
|
+
height: {height}px;
|
|
129
|
+
left: {gutterWidth}px;
|
|
130
|
+
--zone-color: {color};
|
|
131
|
+
--zone-opacity: {getOpacity(zone.probability)};
|
|
132
|
+
--border-opacity: {getBorderOpacity(zone.probability)};
|
|
133
|
+
"
|
|
134
|
+
onmouseenter={(e) => handleMouseEnter(zone, e)}
|
|
135
|
+
onmouseleave={handleMouseLeave}
|
|
136
|
+
onclick={() => handleClick(zone)}
|
|
137
|
+
onkeydown={(e) => e.key === 'Enter' && handleClick(zone)}
|
|
138
|
+
role="button"
|
|
139
|
+
tabindex={-1}
|
|
140
|
+
>
|
|
141
|
+
<!-- Gutter indicator -->
|
|
142
|
+
<div
|
|
143
|
+
class="conflict-zone__gutter"
|
|
144
|
+
style="left: -{gutterWidth}px; width: {gutterWidth}px;"
|
|
145
|
+
>
|
|
146
|
+
<span class="conflict-zone__icon">{getSeverityIcon(zone.severity)}</span>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<!-- Participant avatars -->
|
|
150
|
+
{#if showParticipants && zone.participants.length > 0}
|
|
151
|
+
<div class="conflict-zone__participants">
|
|
152
|
+
{#each zone.participants.slice(0, 3) as participant, i}
|
|
153
|
+
<div
|
|
154
|
+
class="conflict-zone__avatar"
|
|
155
|
+
class:conflict-zone__avatar--ai={participant.isAI}
|
|
156
|
+
style="
|
|
157
|
+
background: {participant.color};
|
|
158
|
+
z-index: {10 - i};
|
|
159
|
+
"
|
|
160
|
+
title={participant.userName}
|
|
161
|
+
>
|
|
162
|
+
{#if participant.isAI}
|
|
163
|
+
<span class="ai-icon">🤖</span>
|
|
164
|
+
{:else}
|
|
165
|
+
{getInitials(participant.userName)}
|
|
166
|
+
{/if}
|
|
167
|
+
</div>
|
|
168
|
+
{/each}
|
|
169
|
+
{#if zone.participants.length > 3}
|
|
170
|
+
<div class="conflict-zone__avatar conflict-zone__avatar--more">
|
|
171
|
+
+{zone.participants.length - 3}
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
174
|
+
</div>
|
|
175
|
+
{/if}
|
|
176
|
+
|
|
177
|
+
<!-- Warning badge for high severity -->
|
|
178
|
+
{#if zone.severity === 'critical' || zone.severity === 'high'}
|
|
179
|
+
<div class="conflict-zone__warning">
|
|
180
|
+
<span class="conflict-zone__warning-text">
|
|
181
|
+
{Math.round(zone.probability * 100)}% conflict risk
|
|
182
|
+
</span>
|
|
183
|
+
</div>
|
|
184
|
+
{/if}
|
|
185
|
+
</div>
|
|
186
|
+
{/each}
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<!-- Tooltip -->
|
|
190
|
+
{#if hoveredZone}
|
|
191
|
+
<div
|
|
192
|
+
class="conflict-tooltip"
|
|
193
|
+
style="top: {tooltipPosition.top}px; left: {tooltipPosition.left}px;"
|
|
194
|
+
>
|
|
195
|
+
<div class="conflict-tooltip__header">
|
|
196
|
+
<span
|
|
197
|
+
class="conflict-tooltip__badge"
|
|
198
|
+
style="background: {getSeverityColor(hoveredZone.severity)}"
|
|
199
|
+
>
|
|
200
|
+
{Math.round(hoveredZone.probability * 100)}%
|
|
201
|
+
</span>
|
|
202
|
+
<span class="conflict-tooltip__title">
|
|
203
|
+
{hoveredZone.severity.charAt(0).toUpperCase() + hoveredZone.severity.slice(1)} Risk
|
|
204
|
+
</span>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="conflict-tooltip__region">
|
|
208
|
+
{hoveredZone.semanticUnit}
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<div class="conflict-tooltip__participants">
|
|
212
|
+
{#each hoveredZone.participants as participant}
|
|
213
|
+
<div class="conflict-tooltip__participant">
|
|
214
|
+
<span
|
|
215
|
+
class="conflict-tooltip__dot"
|
|
216
|
+
style="background: {participant.color}"
|
|
217
|
+
></span>
|
|
218
|
+
<span class="conflict-tooltip__name">
|
|
219
|
+
{participant.userName}
|
|
220
|
+
{#if participant.isAI}
|
|
221
|
+
<span class="ai-badge">AI</span>
|
|
222
|
+
{/if}
|
|
223
|
+
</span>
|
|
224
|
+
<span class="conflict-tooltip__line">Line {participant.cursorLine + 1}</span>
|
|
225
|
+
</div>
|
|
226
|
+
{/each}
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
{#if hoveredZone.suggestion}
|
|
230
|
+
<div class="conflict-tooltip__suggestion">
|
|
231
|
+
{hoveredZone.suggestion}
|
|
232
|
+
</div>
|
|
233
|
+
{/if}
|
|
234
|
+
</div>
|
|
235
|
+
{/if}
|
|
236
|
+
{/if}
|
|
237
|
+
|
|
238
|
+
<style>
|
|
239
|
+
.conflict-zones {
|
|
240
|
+
position: absolute;
|
|
241
|
+
top: 0;
|
|
242
|
+
left: 0;
|
|
243
|
+
right: 0;
|
|
244
|
+
bottom: 0;
|
|
245
|
+
pointer-events: none;
|
|
246
|
+
z-index: 4;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.conflict-zone {
|
|
250
|
+
position: absolute;
|
|
251
|
+
right: 0;
|
|
252
|
+
background: linear-gradient(
|
|
253
|
+
90deg,
|
|
254
|
+
rgba(var(--zone-color-rgb, 239, 68, 68), var(--zone-opacity)),
|
|
255
|
+
transparent
|
|
256
|
+
);
|
|
257
|
+
background-color: rgba(239, 68, 68, var(--zone-opacity));
|
|
258
|
+
border-left: 3px solid rgba(239, 68, 68, var(--border-opacity));
|
|
259
|
+
border-left-color: var(--zone-color);
|
|
260
|
+
pointer-events: auto;
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
transition: background-color 0.2s ease;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.conflict-zone:hover {
|
|
266
|
+
background-color: rgba(239, 68, 68, calc(var(--zone-opacity) + 0.1));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.conflict-zone--critical {
|
|
270
|
+
animation: conflict-pulse 2s ease-in-out infinite;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@keyframes conflict-pulse {
|
|
274
|
+
0%,
|
|
275
|
+
100% {
|
|
276
|
+
opacity: 1;
|
|
277
|
+
}
|
|
278
|
+
50% {
|
|
279
|
+
opacity: 0.7;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.conflict-zone__gutter {
|
|
284
|
+
position: absolute;
|
|
285
|
+
top: 0;
|
|
286
|
+
bottom: 0;
|
|
287
|
+
display: flex;
|
|
288
|
+
align-items: flex-start;
|
|
289
|
+
justify-content: center;
|
|
290
|
+
padding-top: 4px;
|
|
291
|
+
pointer-events: none;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.conflict-zone__icon {
|
|
295
|
+
font-size: 12px;
|
|
296
|
+
opacity: 0.8;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.conflict-zone__participants {
|
|
300
|
+
position: absolute;
|
|
301
|
+
right: 8px;
|
|
302
|
+
top: 4px;
|
|
303
|
+
display: flex;
|
|
304
|
+
gap: -8px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.conflict-zone__avatar {
|
|
308
|
+
display: flex;
|
|
309
|
+
align-items: center;
|
|
310
|
+
justify-content: center;
|
|
311
|
+
width: 24px;
|
|
312
|
+
height: 24px;
|
|
313
|
+
border-radius: 50%;
|
|
314
|
+
font-size: 10px;
|
|
315
|
+
font-weight: 600;
|
|
316
|
+
color: #fff;
|
|
317
|
+
border: 2px solid var(--color-surface, #1e1e2e);
|
|
318
|
+
margin-left: -8px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.conflict-zone__avatar:first-child {
|
|
322
|
+
margin-left: 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.conflict-zone__avatar--ai {
|
|
326
|
+
font-size: 14px;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.conflict-zone__avatar--more {
|
|
330
|
+
background: rgba(255, 255, 255, 0.2);
|
|
331
|
+
font-size: 9px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.conflict-zone__warning {
|
|
335
|
+
position: absolute;
|
|
336
|
+
right: 8px;
|
|
337
|
+
bottom: 4px;
|
|
338
|
+
padding: 2px 6px;
|
|
339
|
+
background: var(--zone-color);
|
|
340
|
+
border-radius: 4px;
|
|
341
|
+
font-size: 10px;
|
|
342
|
+
font-weight: 600;
|
|
343
|
+
color: #fff;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* Tooltip */
|
|
347
|
+
.conflict-tooltip {
|
|
348
|
+
position: fixed;
|
|
349
|
+
z-index: 1000;
|
|
350
|
+
min-width: 220px;
|
|
351
|
+
max-width: 300px;
|
|
352
|
+
padding: 12px;
|
|
353
|
+
background: var(--color-surface, #1e1e2e);
|
|
354
|
+
border: 1px solid var(--color-border, #333);
|
|
355
|
+
border-radius: 8px;
|
|
356
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
|
357
|
+
font-size: 12px;
|
|
358
|
+
pointer-events: none;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.conflict-tooltip__header {
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
gap: 8px;
|
|
365
|
+
margin-bottom: 8px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.conflict-tooltip__badge {
|
|
369
|
+
display: flex;
|
|
370
|
+
align-items: center;
|
|
371
|
+
justify-content: center;
|
|
372
|
+
padding: 2px 8px;
|
|
373
|
+
border-radius: 10px;
|
|
374
|
+
font-size: 11px;
|
|
375
|
+
font-weight: 700;
|
|
376
|
+
color: #fff;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.conflict-tooltip__title {
|
|
380
|
+
font-weight: 600;
|
|
381
|
+
color: var(--color-text, #e8e8f0);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.conflict-tooltip__region {
|
|
385
|
+
padding: 6px 8px;
|
|
386
|
+
background: rgba(255, 255, 255, 0.05);
|
|
387
|
+
border-radius: 4px;
|
|
388
|
+
color: var(--color-text-secondary, #aaa);
|
|
389
|
+
margin-bottom: 8px;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.conflict-tooltip__participants {
|
|
393
|
+
display: flex;
|
|
394
|
+
flex-direction: column;
|
|
395
|
+
gap: 6px;
|
|
396
|
+
margin-bottom: 8px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.conflict-tooltip__participant {
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
gap: 8px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.conflict-tooltip__dot {
|
|
406
|
+
width: 8px;
|
|
407
|
+
height: 8px;
|
|
408
|
+
border-radius: 50%;
|
|
409
|
+
flex-shrink: 0;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.conflict-tooltip__name {
|
|
413
|
+
flex: 1;
|
|
414
|
+
color: var(--color-text, #e8e8f0);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.conflict-tooltip__line {
|
|
418
|
+
font-size: 10px;
|
|
419
|
+
color: var(--color-text-muted, #888);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.ai-badge {
|
|
423
|
+
display: inline-block;
|
|
424
|
+
padding: 1px 4px;
|
|
425
|
+
margin-left: 4px;
|
|
426
|
+
background: rgba(168, 85, 247, 0.3);
|
|
427
|
+
border-radius: 3px;
|
|
428
|
+
font-size: 9px;
|
|
429
|
+
color: #a855f7;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.conflict-tooltip__suggestion {
|
|
433
|
+
padding: 8px;
|
|
434
|
+
background: rgba(255, 200, 0, 0.1);
|
|
435
|
+
border-radius: 4px;
|
|
436
|
+
border-left: 2px solid #eab308;
|
|
437
|
+
color: var(--color-text-secondary, #aaa);
|
|
438
|
+
font-size: 11px;
|
|
439
|
+
line-height: 1.4;
|
|
440
|
+
}
|
|
441
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conflict Zone Layer
|
|
3
|
+
*
|
|
4
|
+
* Visualizes potential conflict zones when multiple users
|
|
5
|
+
* are editing nearby regions. Shows warning indicators
|
|
6
|
+
* and participant avatars.
|
|
7
|
+
*/
|
|
8
|
+
import type { ConflictZone } from './core/conflict-predictor';
|
|
9
|
+
interface Props {
|
|
10
|
+
/** Conflict zones to display */
|
|
11
|
+
zones: ConflictZone[];
|
|
12
|
+
/** Line height in pixels */
|
|
13
|
+
lineHeight: number;
|
|
14
|
+
/** Gutter width in pixels */
|
|
15
|
+
gutterWidth?: number;
|
|
16
|
+
/** Whether to show participant indicators */
|
|
17
|
+
showParticipants?: boolean;
|
|
18
|
+
/** Whether enabled */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
/** Callback when zone is clicked */
|
|
21
|
+
onZoneClick?: (zone: ConflictZone) => void;
|
|
22
|
+
}
|
|
23
|
+
declare const ConflictZoneLayer: import("svelte").Component<Props, {}, "">;
|
|
24
|
+
type ConflictZoneLayer = ReturnType<typeof ConflictZoneLayer>;
|
|
25
|
+
export default ConflictZoneLayer;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Context Lens
|
|
4
|
+
*
|
|
5
|
+
* Displays inline, auto-collapsing type annotations and context information.
|
|
6
|
+
* When cursor enters a function, shows floating header with signature.
|
|
7
|
+
* For variables, shows subtle type badges.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Line } from './core/state';
|
|
11
|
+
|
|
12
|
+
interface ContextLensItem {
|
|
13
|
+
/** Type of lens item */
|
|
14
|
+
type: 'function-header' | 'variable-type' | 'parameter-info' | 'return-type';
|
|
15
|
+
/** Line number (0-based) */
|
|
16
|
+
line: number;
|
|
17
|
+
/** Column position */
|
|
18
|
+
column: number;
|
|
19
|
+
/** Content to display */
|
|
20
|
+
content: {
|
|
21
|
+
label: string;
|
|
22
|
+
detail?: string;
|
|
23
|
+
documentation?: string;
|
|
24
|
+
};
|
|
25
|
+
/** When to show */
|
|
26
|
+
visibility: 'always' | 'on-cursor' | 'on-hover';
|
|
27
|
+
/** Optional icon */
|
|
28
|
+
icon?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Props {
|
|
32
|
+
/** Lines to analyze */
|
|
33
|
+
lines: readonly Line[];
|
|
34
|
+
/** Current cursor line */
|
|
35
|
+
cursorLine: number;
|
|
36
|
+
/** Line height in pixels */
|
|
37
|
+
lineHeight: number;
|
|
38
|
+
/** Character width in pixels */
|
|
39
|
+
charWidth: number;
|
|
40
|
+
/** Gutter width in pixels */
|
|
41
|
+
gutterWidth: number;
|
|
42
|
+
/** Whether context lens is enabled */
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
/** Language for parsing */
|
|
45
|
+
language?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let {
|
|
49
|
+
lines,
|
|
50
|
+
cursorLine,
|
|
51
|
+
lineHeight,
|
|
52
|
+
charWidth,
|
|
53
|
+
gutterWidth,
|
|
54
|
+
enabled = true,
|
|
55
|
+
language = 'typescript'
|
|
56
|
+
}: Props = $props();
|
|
57
|
+
|
|
58
|
+
// Extract context lens items from code
|
|
59
|
+
let lensItems = $derived.by(() => {
|
|
60
|
+
if (!enabled || lines.length === 0) return [];
|
|
61
|
+
|
|
62
|
+
const items: ContextLensItem[] = [];
|
|
63
|
+
|
|
64
|
+
for (let i = 0; i < lines.length; i++) {
|
|
65
|
+
const text = lines[i].text;
|
|
66
|
+
|
|
67
|
+
// Detect function definitions
|
|
68
|
+
const funcMatch = text.match(
|
|
69
|
+
/^(\s*)(export\s+)?(async\s+)?function\s+(\w+)\s*(<[^>]+>)?\s*\(([^)]*)\)(\s*:\s*([^{]+))?/
|
|
70
|
+
);
|
|
71
|
+
if (funcMatch) {
|
|
72
|
+
const [, indent, , isAsync, name, generics, params, , returnType] = funcMatch;
|
|
73
|
+
items.push({
|
|
74
|
+
type: 'function-header',
|
|
75
|
+
line: i,
|
|
76
|
+
column: indent.length,
|
|
77
|
+
content: {
|
|
78
|
+
label: name,
|
|
79
|
+
detail: `${isAsync ? 'async ' : ''}(${params.trim()})${returnType ? ` => ${returnType.trim()}` : ''}`,
|
|
80
|
+
documentation: generics ? `Generic: ${generics}` : undefined
|
|
81
|
+
},
|
|
82
|
+
visibility: 'on-cursor',
|
|
83
|
+
icon: isAsync ? '\u{26A1}' : '\u{0192}'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Detect arrow functions with type annotations
|
|
88
|
+
const arrowMatch = text.match(
|
|
89
|
+
/^(\s*)(export\s+)?const\s+(\w+)\s*(<[^>]+>)?\s*=\s*(async\s*)?\(([^)]*)\)(\s*:\s*([^=]+))?\s*=>/
|
|
90
|
+
);
|
|
91
|
+
if (arrowMatch) {
|
|
92
|
+
const [, indent, , name, generics, isAsync, params, , returnType] = arrowMatch;
|
|
93
|
+
items.push({
|
|
94
|
+
type: 'function-header',
|
|
95
|
+
line: i,
|
|
96
|
+
column: indent.length,
|
|
97
|
+
content: {
|
|
98
|
+
label: name,
|
|
99
|
+
detail: `${isAsync ? 'async ' : ''}(${params.trim()})${returnType ? ` => ${returnType.trim()}` : ''}`,
|
|
100
|
+
documentation: generics ? `Generic: ${generics}` : undefined
|
|
101
|
+
},
|
|
102
|
+
visibility: 'on-cursor',
|
|
103
|
+
icon: '\u{21D2}'
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Detect interface/type definitions
|
|
108
|
+
const typeMatch = text.match(/^(\s*)(export\s+)?(interface|type)\s+(\w+)(<[^>]+>)?/);
|
|
109
|
+
if (typeMatch) {
|
|
110
|
+
const [, indent, , keyword, name, generics] = typeMatch;
|
|
111
|
+
items.push({
|
|
112
|
+
type: 'variable-type',
|
|
113
|
+
line: i,
|
|
114
|
+
column: indent.length,
|
|
115
|
+
content: {
|
|
116
|
+
label: name,
|
|
117
|
+
detail: keyword,
|
|
118
|
+
documentation: generics ? `Generic: ${generics}` : undefined
|
|
119
|
+
},
|
|
120
|
+
visibility: 'on-cursor',
|
|
121
|
+
icon: keyword === 'interface' ? '\u{1D540}' : '\u{1D54B}'
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Detect class definitions
|
|
126
|
+
const classMatch = text.match(
|
|
127
|
+
/^(\s*)(export\s+)?(abstract\s+)?class\s+(\w+)(<[^>]+>)?(\s+extends\s+(\w+))?(\s+implements\s+([^{]+))?/
|
|
128
|
+
);
|
|
129
|
+
if (classMatch) {
|
|
130
|
+
const [, indent, , isAbstract, name, generics, , extendsClass, , implementsInterfaces] =
|
|
131
|
+
classMatch;
|
|
132
|
+
let detail = isAbstract ? 'abstract class' : 'class';
|
|
133
|
+
if (extendsClass) detail += ` extends ${extendsClass}`;
|
|
134
|
+
if (implementsInterfaces) detail += ` implements ${implementsInterfaces.trim()}`;
|
|
135
|
+
|
|
136
|
+
items.push({
|
|
137
|
+
type: 'function-header',
|
|
138
|
+
line: i,
|
|
139
|
+
column: indent.length,
|
|
140
|
+
content: {
|
|
141
|
+
label: name,
|
|
142
|
+
detail,
|
|
143
|
+
documentation: generics ? `Generic: ${generics}` : undefined
|
|
144
|
+
},
|
|
145
|
+
visibility: 'on-cursor',
|
|
146
|
+
icon: '\u{1D49E}'
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return items;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Filter to visible items based on cursor position
|
|
155
|
+
let visibleItems = $derived(
|
|
156
|
+
lensItems.filter(
|
|
157
|
+
(item) =>
|
|
158
|
+
item.visibility === 'always' ||
|
|
159
|
+
(item.visibility === 'on-cursor' && item.line === cursorLine)
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Get position style for an item
|
|
165
|
+
*/
|
|
166
|
+
function getItemStyle(item: ContextLensItem): string {
|
|
167
|
+
const top = item.line * lineHeight - lineHeight - 2; // Position above the line
|
|
168
|
+
const left = gutterWidth + item.column * charWidth;
|
|
169
|
+
|
|
170
|
+
return `top: ${top}px; left: ${left}px;`;
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
{#if enabled && visibleItems.length > 0}
|
|
175
|
+
<div class="context-lens" aria-hidden="true">
|
|
176
|
+
{#each visibleItems as item (`${item.line}-${item.type}`)}
|
|
177
|
+
<div
|
|
178
|
+
class="context-lens__item context-lens__item--{item.type}"
|
|
179
|
+
style={getItemStyle(item)}
|
|
180
|
+
>
|
|
181
|
+
{#if item.icon}
|
|
182
|
+
<span class="context-lens__icon">{item.icon}</span>
|
|
183
|
+
{/if}
|
|
184
|
+
<span class="context-lens__label">{item.content.label}</span>
|
|
185
|
+
{#if item.content.detail}
|
|
186
|
+
<span class="context-lens__detail">{item.content.detail}</span>
|
|
187
|
+
{/if}
|
|
188
|
+
</div>
|
|
189
|
+
{/each}
|
|
190
|
+
</div>
|
|
191
|
+
{/if}
|
|
192
|
+
|
|
193
|
+
<style>
|
|
194
|
+
.context-lens {
|
|
195
|
+
position: absolute;
|
|
196
|
+
top: 0;
|
|
197
|
+
left: 0;
|
|
198
|
+
right: 0;
|
|
199
|
+
bottom: 0;
|
|
200
|
+
pointer-events: none;
|
|
201
|
+
z-index: 3;
|
|
202
|
+
overflow: hidden;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.context-lens__item {
|
|
206
|
+
position: absolute;
|
|
207
|
+
display: inline-flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
gap: 6px;
|
|
210
|
+
padding: 2px 8px;
|
|
211
|
+
background: rgba(30, 30, 30, 0.95);
|
|
212
|
+
border: 1px solid var(--color-border, #444);
|
|
213
|
+
border-radius: 4px;
|
|
214
|
+
font-size: 11px;
|
|
215
|
+
font-family: var(--font-mono, 'JetBrains Mono', monospace);
|
|
216
|
+
white-space: nowrap;
|
|
217
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
218
|
+
animation: lens-fade-in 0.15s ease-out;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@keyframes lens-fade-in {
|
|
222
|
+
from {
|
|
223
|
+
opacity: 0;
|
|
224
|
+
transform: translateY(4px);
|
|
225
|
+
}
|
|
226
|
+
to {
|
|
227
|
+
opacity: 1;
|
|
228
|
+
transform: translateY(0);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.context-lens__item--function-header {
|
|
233
|
+
border-left: 3px solid #3b82f6;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.context-lens__item--variable-type {
|
|
237
|
+
border-left: 3px solid #8b5cf6;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.context-lens__item--parameter-info {
|
|
241
|
+
border-left: 3px solid #22c55e;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.context-lens__item--return-type {
|
|
245
|
+
border-left: 3px solid #f59e0b;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.context-lens__icon {
|
|
249
|
+
font-size: 12px;
|
|
250
|
+
opacity: 0.8;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.context-lens__label {
|
|
254
|
+
color: #e8e8f0;
|
|
255
|
+
font-weight: 600;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.context-lens__detail {
|
|
259
|
+
color: #888;
|
|
260
|
+
font-weight: 400;
|
|
261
|
+
}
|
|
262
|
+
</style>
|