@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,430 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AI Focus Layer
|
|
4
|
+
*
|
|
5
|
+
* Renders AI agent focus visualization in the editor:
|
|
6
|
+
* - Ghost cursors showing where AI is "looking"
|
|
7
|
+
* - Focus region highlights with glow effects
|
|
8
|
+
* - Activity indicators and labels
|
|
9
|
+
*
|
|
10
|
+
* Creates the "Ghost Pair" programming experience.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { AIAwareness, AIFocusRegion, AICursor } from './core/ai-awareness';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** AI agents to visualize */
|
|
17
|
+
agents: AIAwareness[];
|
|
18
|
+
/** Line height in pixels */
|
|
19
|
+
lineHeight: number;
|
|
20
|
+
/** Character width in pixels */
|
|
21
|
+
charWidth: number;
|
|
22
|
+
/** Gutter width in pixels */
|
|
23
|
+
gutterWidth: number;
|
|
24
|
+
/** Content padding in pixels */
|
|
25
|
+
contentPadding?: number;
|
|
26
|
+
/** Whether to show cursor labels */
|
|
27
|
+
showLabels?: boolean;
|
|
28
|
+
/** Whether to show focus regions */
|
|
29
|
+
showFocusRegions?: boolean;
|
|
30
|
+
/** Whether the layer is enabled */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let {
|
|
35
|
+
agents,
|
|
36
|
+
lineHeight,
|
|
37
|
+
charWidth,
|
|
38
|
+
gutterWidth,
|
|
39
|
+
contentPadding = 8,
|
|
40
|
+
showLabels = true,
|
|
41
|
+
showFocusRegions = true,
|
|
42
|
+
enabled = true
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
|
|
45
|
+
// Filter to active agents with cursors
|
|
46
|
+
let visibleAgents = $derived(
|
|
47
|
+
enabled ? agents.filter((a) => a.isActive && (a.cursor?.visible || a.focusRegions.length > 0)) : []
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get cursor position style
|
|
52
|
+
*/
|
|
53
|
+
function getCursorStyle(cursor: AICursor, color: string): string {
|
|
54
|
+
const left = gutterWidth + contentPadding + cursor.position.column * charWidth;
|
|
55
|
+
const top = cursor.position.line * lineHeight;
|
|
56
|
+
|
|
57
|
+
return `
|
|
58
|
+
left: ${left}px;
|
|
59
|
+
top: ${top}px;
|
|
60
|
+
height: ${lineHeight}px;
|
|
61
|
+
--ai-color: ${color};
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get focus region style
|
|
67
|
+
*/
|
|
68
|
+
function getRegionStyle(region: AIFocusRegion, color: string): string {
|
|
69
|
+
const top = region.startLine * lineHeight;
|
|
70
|
+
const height = (region.endLine - region.startLine + 1) * lineHeight;
|
|
71
|
+
|
|
72
|
+
// Calculate left/width if column info provided
|
|
73
|
+
let left = gutterWidth + contentPadding;
|
|
74
|
+
let width = 'calc(100% - var(--region-left))';
|
|
75
|
+
|
|
76
|
+
if (region.startColumn !== undefined && region.endColumn !== undefined) {
|
|
77
|
+
left += region.startColumn * charWidth;
|
|
78
|
+
width = `${(region.endColumn - region.startColumn) * charWidth}px`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return `
|
|
82
|
+
top: ${top}px;
|
|
83
|
+
left: ${left}px;
|
|
84
|
+
height: ${height}px;
|
|
85
|
+
width: ${width};
|
|
86
|
+
--ai-color: ${color};
|
|
87
|
+
--ai-intensity: ${region.intensity};
|
|
88
|
+
--region-left: ${left}px;
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get label position style
|
|
94
|
+
*/
|
|
95
|
+
function getLabelStyle(cursor: AICursor): string {
|
|
96
|
+
const left = gutterWidth + contentPadding + cursor.position.column * charWidth + 4;
|
|
97
|
+
const top = cursor.position.line * lineHeight - 20;
|
|
98
|
+
|
|
99
|
+
return `left: ${left}px; top: ${top}px;`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get attention type icon/indicator
|
|
104
|
+
*/
|
|
105
|
+
function getAttentionIndicator(type: AIAwareness['attentionType']): string {
|
|
106
|
+
switch (type) {
|
|
107
|
+
case 'reading':
|
|
108
|
+
return '\u{1F440}'; // Eyes
|
|
109
|
+
case 'thinking':
|
|
110
|
+
return '\u{1F4AD}'; // Thought bubble
|
|
111
|
+
case 'writing':
|
|
112
|
+
return '\u{270D}\u{FE0F}'; // Writing hand
|
|
113
|
+
case 'reviewing':
|
|
114
|
+
return '\u{1F50D}'; // Magnifying glass
|
|
115
|
+
case 'waiting':
|
|
116
|
+
return '\u{23F3}'; // Hourglass
|
|
117
|
+
default:
|
|
118
|
+
return '🤖'; // Robot
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get cursor animation class
|
|
124
|
+
*/
|
|
125
|
+
function getCursorAnimationClass(animation: AICursor['animation']): string {
|
|
126
|
+
switch (animation) {
|
|
127
|
+
case 'moving':
|
|
128
|
+
return 'ai-focus-layer__cursor--moving';
|
|
129
|
+
case 'typing':
|
|
130
|
+
return 'ai-focus-layer__cursor--typing';
|
|
131
|
+
case 'thinking':
|
|
132
|
+
return 'ai-focus-layer__cursor--thinking';
|
|
133
|
+
default:
|
|
134
|
+
return 'ai-focus-layer__cursor--idle';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
{#if enabled && visibleAgents.length > 0}
|
|
140
|
+
<div class="ai-focus-layer" aria-hidden="true">
|
|
141
|
+
{#each visibleAgents as agent (agent.agentId)}
|
|
142
|
+
<!-- Focus regions (background glow) -->
|
|
143
|
+
{#if showFocusRegions && agent.focusRegions.length > 0}
|
|
144
|
+
{#each agent.focusRegions as region, idx (`${agent.agentId}-region-${idx}`)}
|
|
145
|
+
<div
|
|
146
|
+
class="ai-focus-layer__region"
|
|
147
|
+
class:ai-focus-layer__region--reading={region.type === 'reading'}
|
|
148
|
+
class:ai-focus-layer__region--thinking={region.type === 'thinking'}
|
|
149
|
+
class:ai-focus-layer__region--writing={region.type === 'writing'}
|
|
150
|
+
class:ai-focus-layer__region--reviewing={region.type === 'reviewing'}
|
|
151
|
+
style={getRegionStyle(region, agent.color)}
|
|
152
|
+
>
|
|
153
|
+
{#if region.label}
|
|
154
|
+
<span class="ai-focus-layer__region-label">{region.label}</span>
|
|
155
|
+
{/if}
|
|
156
|
+
</div>
|
|
157
|
+
{/each}
|
|
158
|
+
{/if}
|
|
159
|
+
|
|
160
|
+
<!-- AI Cursor (ghost cursor with glow) -->
|
|
161
|
+
{#if agent.cursor?.visible}
|
|
162
|
+
<div
|
|
163
|
+
class="ai-focus-layer__cursor {getCursorAnimationClass(agent.cursor.animation)}"
|
|
164
|
+
style={getCursorStyle(agent.cursor, agent.color)}
|
|
165
|
+
>
|
|
166
|
+
<!-- Cursor glow effect -->
|
|
167
|
+
<div class="ai-focus-layer__cursor-glow"></div>
|
|
168
|
+
<!-- Cursor line -->
|
|
169
|
+
<div class="ai-focus-layer__cursor-line"></div>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<!-- Agent label -->
|
|
173
|
+
{#if showLabels}
|
|
174
|
+
<div class="ai-focus-layer__label" style={getLabelStyle(agent.cursor)}>
|
|
175
|
+
<span class="ai-focus-layer__label-indicator">
|
|
176
|
+
{getAttentionIndicator(agent.attentionType)}
|
|
177
|
+
</span>
|
|
178
|
+
<span class="ai-focus-layer__label-name" style="color: {agent.color}">
|
|
179
|
+
{agent.agentName}
|
|
180
|
+
</span>
|
|
181
|
+
{#if agent.activity}
|
|
182
|
+
<span class="ai-focus-layer__label-activity">{agent.activity}</span>
|
|
183
|
+
{/if}
|
|
184
|
+
</div>
|
|
185
|
+
{/if}
|
|
186
|
+
{/if}
|
|
187
|
+
{/each}
|
|
188
|
+
</div>
|
|
189
|
+
{/if}
|
|
190
|
+
|
|
191
|
+
<style>
|
|
192
|
+
.ai-focus-layer {
|
|
193
|
+
position: absolute;
|
|
194
|
+
top: 0;
|
|
195
|
+
left: 0;
|
|
196
|
+
right: 0;
|
|
197
|
+
bottom: 0;
|
|
198
|
+
pointer-events: none;
|
|
199
|
+
z-index: 5;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Focus Region Styles */
|
|
204
|
+
.ai-focus-layer__region {
|
|
205
|
+
position: absolute;
|
|
206
|
+
border-radius: 4px;
|
|
207
|
+
pointer-events: none;
|
|
208
|
+
transition:
|
|
209
|
+
opacity 0.3s ease,
|
|
210
|
+
background 0.3s ease;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Reading - subtle blue glow */
|
|
214
|
+
.ai-focus-layer__region--reading {
|
|
215
|
+
background: linear-gradient(
|
|
216
|
+
90deg,
|
|
217
|
+
rgba(var(--ai-color-rgb, 59, 130, 246), calc(var(--ai-intensity) * 0.15)) 0%,
|
|
218
|
+
rgba(var(--ai-color-rgb, 59, 130, 246), calc(var(--ai-intensity) * 0.05)) 50%,
|
|
219
|
+
transparent 100%
|
|
220
|
+
);
|
|
221
|
+
box-shadow: inset 0 0 20px rgba(var(--ai-color-rgb, 59, 130, 246), calc(var(--ai-intensity) * 0.1));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* Thinking - pulsing purple glow */
|
|
225
|
+
.ai-focus-layer__region--thinking {
|
|
226
|
+
background: linear-gradient(
|
|
227
|
+
90deg,
|
|
228
|
+
rgba(var(--ai-color-rgb, 139, 92, 246), calc(var(--ai-intensity) * 0.2)) 0%,
|
|
229
|
+
rgba(var(--ai-color-rgb, 139, 92, 246), calc(var(--ai-intensity) * 0.08)) 50%,
|
|
230
|
+
transparent 100%
|
|
231
|
+
);
|
|
232
|
+
animation: region-think-pulse 2s ease-in-out infinite;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Writing - bright green glow */
|
|
236
|
+
.ai-focus-layer__region--writing {
|
|
237
|
+
background: linear-gradient(
|
|
238
|
+
90deg,
|
|
239
|
+
rgba(34, 197, 94, calc(var(--ai-intensity) * 0.25)) 0%,
|
|
240
|
+
rgba(34, 197, 94, calc(var(--ai-intensity) * 0.1)) 50%,
|
|
241
|
+
transparent 100%
|
|
242
|
+
);
|
|
243
|
+
box-shadow: inset 0 0 30px rgba(34, 197, 94, calc(var(--ai-intensity) * 0.15));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Reviewing - amber scan effect */
|
|
247
|
+
.ai-focus-layer__region--reviewing {
|
|
248
|
+
background: linear-gradient(
|
|
249
|
+
90deg,
|
|
250
|
+
rgba(245, 158, 11, calc(var(--ai-intensity) * 0.15)) 0%,
|
|
251
|
+
rgba(245, 158, 11, calc(var(--ai-intensity) * 0.05)) 50%,
|
|
252
|
+
transparent 100%
|
|
253
|
+
);
|
|
254
|
+
animation: region-scan 3s linear infinite;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@keyframes region-think-pulse {
|
|
258
|
+
0%, 100% {
|
|
259
|
+
opacity: 0.7;
|
|
260
|
+
}
|
|
261
|
+
50% {
|
|
262
|
+
opacity: 1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@keyframes region-scan {
|
|
267
|
+
0% {
|
|
268
|
+
background-position: -100% 0;
|
|
269
|
+
}
|
|
270
|
+
100% {
|
|
271
|
+
background-position: 200% 0;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.ai-focus-layer__region-label {
|
|
276
|
+
position: absolute;
|
|
277
|
+
right: 8px;
|
|
278
|
+
top: 2px;
|
|
279
|
+
font-size: 10px;
|
|
280
|
+
color: var(--color-text-muted, #888);
|
|
281
|
+
opacity: 0.7;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* AI Cursor Styles */
|
|
285
|
+
.ai-focus-layer__cursor {
|
|
286
|
+
position: absolute;
|
|
287
|
+
width: 2px;
|
|
288
|
+
pointer-events: none;
|
|
289
|
+
z-index: 10;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.ai-focus-layer__cursor-line {
|
|
293
|
+
position: absolute;
|
|
294
|
+
top: 0;
|
|
295
|
+
left: 0;
|
|
296
|
+
width: 2px;
|
|
297
|
+
height: 100%;
|
|
298
|
+
background: var(--ai-color);
|
|
299
|
+
border-radius: 1px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.ai-focus-layer__cursor-glow {
|
|
303
|
+
position: absolute;
|
|
304
|
+
top: -4px;
|
|
305
|
+
left: -8px;
|
|
306
|
+
width: 18px;
|
|
307
|
+
height: calc(100% + 8px);
|
|
308
|
+
background: radial-gradient(
|
|
309
|
+
ellipse at center,
|
|
310
|
+
rgba(var(--ai-color-rgb, 139, 92, 246), 0.4) 0%,
|
|
311
|
+
rgba(var(--ai-color-rgb, 139, 92, 246), 0.1) 50%,
|
|
312
|
+
transparent 70%
|
|
313
|
+
);
|
|
314
|
+
filter: blur(4px);
|
|
315
|
+
border-radius: 50%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Cursor Animations */
|
|
319
|
+
.ai-focus-layer__cursor--idle {
|
|
320
|
+
animation: cursor-idle-pulse 2s ease-in-out infinite;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.ai-focus-layer__cursor--moving {
|
|
324
|
+
animation: cursor-move-trail 0.3s ease-out;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.ai-focus-layer__cursor--typing {
|
|
328
|
+
animation: cursor-type-flash 0.15s ease-in-out infinite;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.ai-focus-layer__cursor--thinking {
|
|
332
|
+
animation: cursor-think-glow 1.5s ease-in-out infinite;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@keyframes cursor-idle-pulse {
|
|
336
|
+
0%, 100% {
|
|
337
|
+
opacity: 0.8;
|
|
338
|
+
}
|
|
339
|
+
50% {
|
|
340
|
+
opacity: 0.5;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
@keyframes cursor-move-trail {
|
|
345
|
+
0% {
|
|
346
|
+
opacity: 0.3;
|
|
347
|
+
transform: scaleY(0.8);
|
|
348
|
+
}
|
|
349
|
+
100% {
|
|
350
|
+
opacity: 1;
|
|
351
|
+
transform: scaleY(1);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@keyframes cursor-type-flash {
|
|
356
|
+
0%, 100% {
|
|
357
|
+
opacity: 1;
|
|
358
|
+
}
|
|
359
|
+
50% {
|
|
360
|
+
opacity: 0.6;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@keyframes cursor-think-glow {
|
|
365
|
+
0%, 100% {
|
|
366
|
+
filter: brightness(1);
|
|
367
|
+
}
|
|
368
|
+
50% {
|
|
369
|
+
filter: brightness(1.5);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.ai-focus-layer__cursor--thinking .ai-focus-layer__cursor-glow {
|
|
374
|
+
animation: glow-expand 1.5s ease-in-out infinite;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@keyframes glow-expand {
|
|
378
|
+
0%, 100% {
|
|
379
|
+
transform: scale(1);
|
|
380
|
+
opacity: 0.4;
|
|
381
|
+
}
|
|
382
|
+
50% {
|
|
383
|
+
transform: scale(1.5);
|
|
384
|
+
opacity: 0.6;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* Agent Label */
|
|
389
|
+
.ai-focus-layer__label {
|
|
390
|
+
position: absolute;
|
|
391
|
+
display: flex;
|
|
392
|
+
align-items: center;
|
|
393
|
+
gap: 4px;
|
|
394
|
+
padding: 2px 8px;
|
|
395
|
+
background: rgba(30, 30, 30, 0.95);
|
|
396
|
+
border: 1px solid var(--color-border, #333);
|
|
397
|
+
border-radius: 4px;
|
|
398
|
+
font-size: 11px;
|
|
399
|
+
white-space: nowrap;
|
|
400
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
401
|
+
z-index: 15;
|
|
402
|
+
pointer-events: none;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.ai-focus-layer__label-indicator {
|
|
406
|
+
font-size: 12px;
|
|
407
|
+
line-height: 1;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.ai-focus-layer__label-name {
|
|
411
|
+
font-weight: 600;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.ai-focus-layer__label-activity {
|
|
415
|
+
color: var(--color-text-muted, #888);
|
|
416
|
+
font-size: 10px;
|
|
417
|
+
max-width: 150px;
|
|
418
|
+
overflow: hidden;
|
|
419
|
+
text-overflow: ellipsis;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/* Selection highlight for AI cursor selection */
|
|
423
|
+
.ai-focus-layer__selection {
|
|
424
|
+
position: absolute;
|
|
425
|
+
background: rgba(var(--ai-color-rgb, 139, 92, 246), 0.2);
|
|
426
|
+
border: 1px solid rgba(var(--ai-color-rgb, 139, 92, 246), 0.4);
|
|
427
|
+
border-radius: 2px;
|
|
428
|
+
pointer-events: none;
|
|
429
|
+
}
|
|
430
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Focus Layer
|
|
3
|
+
*
|
|
4
|
+
* Renders AI agent focus visualization in the editor:
|
|
5
|
+
* - Ghost cursors showing where AI is "looking"
|
|
6
|
+
* - Focus region highlights with glow effects
|
|
7
|
+
* - Activity indicators and labels
|
|
8
|
+
*
|
|
9
|
+
* Creates the "Ghost Pair" programming experience.
|
|
10
|
+
*/
|
|
11
|
+
import type { AIAwareness } from './core/ai-awareness';
|
|
12
|
+
interface Props {
|
|
13
|
+
/** AI agents to visualize */
|
|
14
|
+
agents: AIAwareness[];
|
|
15
|
+
/** Line height in pixels */
|
|
16
|
+
lineHeight: number;
|
|
17
|
+
/** Character width in pixels */
|
|
18
|
+
charWidth: number;
|
|
19
|
+
/** Gutter width in pixels */
|
|
20
|
+
gutterWidth: number;
|
|
21
|
+
/** Content padding in pixels */
|
|
22
|
+
contentPadding?: number;
|
|
23
|
+
/** Whether to show cursor labels */
|
|
24
|
+
showLabels?: boolean;
|
|
25
|
+
/** Whether to show focus regions */
|
|
26
|
+
showFocusRegions?: boolean;
|
|
27
|
+
/** Whether the layer is enabled */
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare const AIFocusLayer: import("svelte").Component<Props, {}, "">;
|
|
31
|
+
type AIFocusLayer = ReturnType<typeof AIFocusLayer>;
|
|
32
|
+
export default AIFocusLayer;
|