@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,277 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* ErrorBoundary Component
|
|
4
|
+
*
|
|
5
|
+
* Catches errors in child components and displays a fallback UI.
|
|
6
|
+
* Provides retry and recovery options.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Snippet } from 'svelte';
|
|
10
|
+
import type { VFSError, RecoveryOption } from '../../services/error-handling';
|
|
11
|
+
import { isVFSError } from '../../services/error-handling';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
children: Snippet;
|
|
15
|
+
fallback?: Snippet<[{ error: Error; reset: () => void }]>;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
onReset?: () => void;
|
|
18
|
+
showDetails?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let { children, fallback, onError, onReset, showDetails = false }: Props = $props();
|
|
22
|
+
|
|
23
|
+
let error = $state<Error | null>(null);
|
|
24
|
+
let showTechnicalDetails = $state(false);
|
|
25
|
+
|
|
26
|
+
// Derived error info
|
|
27
|
+
let vfsError = $derived(error && isVFSError(error) ? (error as VFSError) : null);
|
|
28
|
+
let errorTitle = $derived(vfsError?.code ?? 'Error');
|
|
29
|
+
let errorMessage = $derived(vfsError?.userMessage ?? error?.message ?? 'An unexpected error occurred');
|
|
30
|
+
let recoveryOptions = $derived(vfsError?.recoveryOptions ?? []);
|
|
31
|
+
|
|
32
|
+
function handleError(e: Error) {
|
|
33
|
+
error = e;
|
|
34
|
+
onError?.(e);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function reset() {
|
|
38
|
+
error = null;
|
|
39
|
+
showTechnicalDetails = false;
|
|
40
|
+
onReset?.();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleRecovery(option: RecoveryOption) {
|
|
44
|
+
if (option.action === 'retry' || option.action === 'refresh') {
|
|
45
|
+
reset();
|
|
46
|
+
}
|
|
47
|
+
// Other actions would be handled by parent via onError
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Expose error handler for programmatic use
|
|
51
|
+
export function setError(e: Error) {
|
|
52
|
+
handleError(e);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function clearError() {
|
|
56
|
+
reset();
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
{#if error}
|
|
61
|
+
{#if fallback}
|
|
62
|
+
{@render fallback({ error, reset })}
|
|
63
|
+
{:else}
|
|
64
|
+
<div class="error-boundary" role="alert">
|
|
65
|
+
<div class="error-content">
|
|
66
|
+
<div class="error-icon">
|
|
67
|
+
<svg
|
|
68
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
69
|
+
width="48"
|
|
70
|
+
height="48"
|
|
71
|
+
viewBox="0 0 24 24"
|
|
72
|
+
fill="none"
|
|
73
|
+
stroke="currentColor"
|
|
74
|
+
stroke-width="2"
|
|
75
|
+
stroke-linecap="round"
|
|
76
|
+
stroke-linejoin="round"
|
|
77
|
+
>
|
|
78
|
+
<circle cx="12" cy="12" r="10" />
|
|
79
|
+
<line x1="12" y1="8" x2="12" y2="12" />
|
|
80
|
+
<line x1="12" y1="16" x2="12.01" y2="16" />
|
|
81
|
+
</svg>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<h2 class="error-title">{errorTitle}</h2>
|
|
85
|
+
<p class="error-message">{errorMessage}</p>
|
|
86
|
+
|
|
87
|
+
{#if recoveryOptions.length > 0}
|
|
88
|
+
<div class="recovery-options">
|
|
89
|
+
{#each recoveryOptions as option}
|
|
90
|
+
<button
|
|
91
|
+
class="recovery-btn"
|
|
92
|
+
class:recommended={option.recommended}
|
|
93
|
+
class:dangerous={option.dangerous}
|
|
94
|
+
onclick={() => handleRecovery(option)}
|
|
95
|
+
>
|
|
96
|
+
{option.label}
|
|
97
|
+
</button>
|
|
98
|
+
{/each}
|
|
99
|
+
</div>
|
|
100
|
+
{:else}
|
|
101
|
+
<div class="recovery-options">
|
|
102
|
+
<button class="recovery-btn recommended" onclick={reset}>
|
|
103
|
+
Try Again
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
{/if}
|
|
107
|
+
|
|
108
|
+
{#if showDetails && (vfsError?.technicalDetails || error.stack)}
|
|
109
|
+
<button
|
|
110
|
+
class="details-toggle"
|
|
111
|
+
onclick={() => (showTechnicalDetails = !showTechnicalDetails)}
|
|
112
|
+
>
|
|
113
|
+
{showTechnicalDetails ? 'Hide' : 'Show'} Technical Details
|
|
114
|
+
</button>
|
|
115
|
+
|
|
116
|
+
{#if showTechnicalDetails}
|
|
117
|
+
<div class="technical-details">
|
|
118
|
+
{#if vfsError}
|
|
119
|
+
<div class="detail-row">
|
|
120
|
+
<span class="detail-label">Code:</span>
|
|
121
|
+
<span class="detail-value">{vfsError.code}</span>
|
|
122
|
+
</div>
|
|
123
|
+
{#if vfsError.statusCode}
|
|
124
|
+
<div class="detail-row">
|
|
125
|
+
<span class="detail-label">Status:</span>
|
|
126
|
+
<span class="detail-value">{vfsError.statusCode}</span>
|
|
127
|
+
</div>
|
|
128
|
+
{/if}
|
|
129
|
+
{#if vfsError.path}
|
|
130
|
+
<div class="detail-row">
|
|
131
|
+
<span class="detail-label">Path:</span>
|
|
132
|
+
<span class="detail-value">{vfsError.path}</span>
|
|
133
|
+
</div>
|
|
134
|
+
{/if}
|
|
135
|
+
{/if}
|
|
136
|
+
{#if error.stack}
|
|
137
|
+
<pre class="stack-trace">{error.stack}</pre>
|
|
138
|
+
{/if}
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
{/if}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
{/if}
|
|
145
|
+
{:else}
|
|
146
|
+
{@render children()}
|
|
147
|
+
{/if}
|
|
148
|
+
|
|
149
|
+
<style>
|
|
150
|
+
.error-boundary {
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
min-height: 200px;
|
|
155
|
+
padding: 24px;
|
|
156
|
+
background: var(--ide-bg-primary, #1e1e1e);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.error-content {
|
|
160
|
+
max-width: 480px;
|
|
161
|
+
text-align: center;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.error-icon {
|
|
165
|
+
color: var(--ide-error, #f44747);
|
|
166
|
+
margin-bottom: 16px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.error-title {
|
|
170
|
+
margin: 0 0 8px;
|
|
171
|
+
font-size: 20px;
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
color: var(--ide-text-primary, #e0e0e0);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.error-message {
|
|
177
|
+
margin: 0 0 20px;
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
color: var(--ide-text-secondary, #a0a0a0);
|
|
180
|
+
line-height: 1.5;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.recovery-options {
|
|
184
|
+
display: flex;
|
|
185
|
+
gap: 8px;
|
|
186
|
+
justify-content: center;
|
|
187
|
+
flex-wrap: wrap;
|
|
188
|
+
margin-bottom: 16px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.recovery-btn {
|
|
192
|
+
padding: 8px 16px;
|
|
193
|
+
border: 1px solid var(--ide-border, #3c3c3c);
|
|
194
|
+
border-radius: 4px;
|
|
195
|
+
background: var(--ide-bg-secondary, #252526);
|
|
196
|
+
color: var(--ide-text-primary, #e0e0e0);
|
|
197
|
+
font-size: 13px;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
transition: all 0.15s ease;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.recovery-btn:hover {
|
|
203
|
+
background: var(--ide-bg-hover, #3c3c3c);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.recovery-btn.recommended {
|
|
207
|
+
background: var(--ide-accent, #569cd6);
|
|
208
|
+
border-color: var(--ide-accent, #569cd6);
|
|
209
|
+
color: white;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.recovery-btn.recommended:hover {
|
|
213
|
+
background: var(--ide-accent-hover, #4a8bc4);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.recovery-btn.dangerous {
|
|
217
|
+
border-color: var(--ide-error, #f44747);
|
|
218
|
+
color: var(--ide-error, #f44747);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.recovery-btn.dangerous:hover {
|
|
222
|
+
background: rgba(244, 71, 71, 0.1);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.details-toggle {
|
|
226
|
+
background: transparent;
|
|
227
|
+
border: none;
|
|
228
|
+
color: var(--ide-text-muted, #808080);
|
|
229
|
+
font-size: 12px;
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
text-decoration: underline;
|
|
232
|
+
margin-bottom: 12px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.details-toggle:hover {
|
|
236
|
+
color: var(--ide-text-secondary, #a0a0a0);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.technical-details {
|
|
240
|
+
text-align: left;
|
|
241
|
+
background: var(--ide-bg-secondary, #252526);
|
|
242
|
+
border: 1px solid var(--ide-border, #3c3c3c);
|
|
243
|
+
border-radius: 4px;
|
|
244
|
+
padding: 12px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.detail-row {
|
|
248
|
+
display: flex;
|
|
249
|
+
gap: 8px;
|
|
250
|
+
font-size: 12px;
|
|
251
|
+
margin-bottom: 4px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.detail-label {
|
|
255
|
+
color: var(--ide-text-muted, #808080);
|
|
256
|
+
min-width: 60px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.detail-value {
|
|
260
|
+
color: var(--ide-text-primary, #e0e0e0);
|
|
261
|
+
font-family: var(--ide-font-mono, monospace);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.stack-trace {
|
|
265
|
+
margin: 8px 0 0;
|
|
266
|
+
padding: 8px;
|
|
267
|
+
background: var(--ide-bg-primary, #1e1e1e);
|
|
268
|
+
border-radius: 4px;
|
|
269
|
+
font-family: var(--ide-font-mono, monospace);
|
|
270
|
+
font-size: 11px;
|
|
271
|
+
color: var(--ide-text-muted, #808080);
|
|
272
|
+
white-space: pre-wrap;
|
|
273
|
+
word-break: break-word;
|
|
274
|
+
max-height: 200px;
|
|
275
|
+
overflow: auto;
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorBoundary Component
|
|
3
|
+
*
|
|
4
|
+
* Catches errors in child components and displays a fallback UI.
|
|
5
|
+
* Provides retry and recovery options.
|
|
6
|
+
*/
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
interface Props {
|
|
9
|
+
children: Snippet;
|
|
10
|
+
fallback?: Snippet<[{
|
|
11
|
+
error: Error;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
}]>;
|
|
14
|
+
onError?: (error: Error) => void;
|
|
15
|
+
onReset?: () => void;
|
|
16
|
+
showDetails?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const ErrorBoundary: import("svelte").Component<Props, {
|
|
19
|
+
setError: (e: Error) => void;
|
|
20
|
+
clearError: () => void;
|
|
21
|
+
}, "">;
|
|
22
|
+
type ErrorBoundary = ReturnType<typeof ErrorBoundary>;
|
|
23
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number | string;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let { name, size = 16, class: className = '' }: Props = $props();
|
|
9
|
+
|
|
10
|
+
// Icon paths - using simple SVG paths for common icons
|
|
11
|
+
const icons: Record<string, string> = {
|
|
12
|
+
// Files
|
|
13
|
+
file: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM13 3.5L18.5 9H14a1 1 0 0 1-1-1V3.5z',
|
|
14
|
+
folder: 'M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z',
|
|
15
|
+
'folder-open':
|
|
16
|
+
'M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2v2M2 11h20l-2 8H4l-2-8z',
|
|
17
|
+
|
|
18
|
+
// Actions
|
|
19
|
+
close: 'M18 6L6 18M6 6l12 12',
|
|
20
|
+
plus: 'M12 5v14M5 12h14',
|
|
21
|
+
minus: 'M5 12h14',
|
|
22
|
+
check: 'M20 6L9 17l-5-5',
|
|
23
|
+
x: 'M18 6L6 18M6 6l12 12',
|
|
24
|
+
search: 'M21 21l-6-6m2-5a7 7 0 1 1-14 0 7 7 0 0 1 14 0z',
|
|
25
|
+
settings: 'M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z',
|
|
26
|
+
refresh: 'M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15',
|
|
27
|
+
save: 'M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2zM17 21v-8H7v8M7 3v5h8',
|
|
28
|
+
copy: 'M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2zM5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1',
|
|
29
|
+
trash: 'M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2',
|
|
30
|
+
edit: 'M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z',
|
|
31
|
+
|
|
32
|
+
// Navigation
|
|
33
|
+
'chevron-right': 'M9 18l6-6-6-6',
|
|
34
|
+
'chevron-down': 'M6 9l6 6 6-6',
|
|
35
|
+
'chevron-up': 'M18 15l-6-6-6 6',
|
|
36
|
+
'chevron-left': 'M15 18l-6-6 6-6',
|
|
37
|
+
'arrow-left': 'M19 12H5M12 19l-7-7 7-7',
|
|
38
|
+
'arrow-right': 'M5 12h14M12 5l7 7-7 7',
|
|
39
|
+
menu: 'M3 12h18M3 6h18M3 18h18',
|
|
40
|
+
|
|
41
|
+
// UI
|
|
42
|
+
sidebar: 'M3 3h18v18H3V3zM9 3v18',
|
|
43
|
+
terminal: 'M4 17l6-6-6-6M12 19h8',
|
|
44
|
+
code: 'M16 18l6-6-6-6M8 6l-6 6 6 6',
|
|
45
|
+
split: 'M12 3v18M3 3h18v18H3z',
|
|
46
|
+
maximize: 'M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3',
|
|
47
|
+
minimize: 'M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3',
|
|
48
|
+
|
|
49
|
+
// AI
|
|
50
|
+
sparkles: 'M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z',
|
|
51
|
+
bot: 'M12 8V4H8M12 8a4 4 0 0 0-4 4v6a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-6a4 4 0 0 0-4-4zM9 13h.01M15 13h.01',
|
|
52
|
+
wand: 'M15 4V2M15 16v-2M8 9h2M20 9h2M17.8 11.8L19 13M17.8 6.2L19 5M12.2 11.8L11 13M12.2 6.2L11 5M12 12l-9 9',
|
|
53
|
+
message: 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10z',
|
|
54
|
+
|
|
55
|
+
// Status
|
|
56
|
+
info: 'M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 16v-4M12 8h.01',
|
|
57
|
+
warning: 'M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z',
|
|
58
|
+
error: 'M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM15 9l-6 6M9 9l6 6',
|
|
59
|
+
success: 'M22 11.08V12a10 10 0 1 1-5.93-9.14M22 4L12 14.01l-3-3',
|
|
60
|
+
loading: 'M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83',
|
|
61
|
+
|
|
62
|
+
// Users
|
|
63
|
+
user: 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z',
|
|
64
|
+
users: 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75M9 7a4 4 0 1 0 0-8 4 4 0 0 0 0 8z',
|
|
65
|
+
|
|
66
|
+
// Git
|
|
67
|
+
'git-branch': 'M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9a9 9 0 0 1-9 9',
|
|
68
|
+
'git-commit': 'M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM1.05 12H8M16 12h6.95',
|
|
69
|
+
'git-merge': 'M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21V9a9 9 0 0 0 9 9M6 21h12',
|
|
70
|
+
|
|
71
|
+
// Misc
|
|
72
|
+
play: 'M5 3l14 9-14 9V3z',
|
|
73
|
+
pause: 'M6 4h4v16H6zM14 4h4v16h-4z',
|
|
74
|
+
stop: 'M6 4h12v16H6z',
|
|
75
|
+
link: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71',
|
|
76
|
+
external: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3',
|
|
77
|
+
clock: 'M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 6v6l4 2',
|
|
78
|
+
zap: 'M13 2L3 14h9l-1 8 10-12h-9l1-8z',
|
|
79
|
+
plugin: 'M12 2v6M12 18v4M4.93 4.93l4.24 4.24M14.83 14.83l4.24 4.24M2 12h6M18 12h4M4.93 19.07l4.24-4.24M14.83 9.17l4.24-4.24'
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const path = $derived(icons[name] ?? icons.file);
|
|
83
|
+
const sizeValue = $derived(typeof size === 'number' ? `${size}px` : size);
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<svg
|
|
87
|
+
class="ide-icon {className}"
|
|
88
|
+
width={sizeValue}
|
|
89
|
+
height={sizeValue}
|
|
90
|
+
viewBox="0 0 24 24"
|
|
91
|
+
fill="none"
|
|
92
|
+
stroke="currentColor"
|
|
93
|
+
stroke-width="2"
|
|
94
|
+
stroke-linecap="round"
|
|
95
|
+
stroke-linejoin="round"
|
|
96
|
+
aria-hidden="true"
|
|
97
|
+
>
|
|
98
|
+
<path d={path}></path>
|
|
99
|
+
</svg>
|
|
100
|
+
|
|
101
|
+
<style>
|
|
102
|
+
.ide-icon {
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
display: inline-block;
|
|
105
|
+
vertical-align: middle;
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
id?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'search' | 'url';
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
oninput?: (event: Event) => void;
|
|
14
|
+
onchange?: (event: Event) => void;
|
|
15
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
16
|
+
onfocus?: (event: FocusEvent) => void;
|
|
17
|
+
onblur?: (event: FocusEvent) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
value = $bindable(''),
|
|
23
|
+
type = 'text',
|
|
24
|
+
placeholder = '',
|
|
25
|
+
disabled = false,
|
|
26
|
+
readonly = false,
|
|
27
|
+
error = '',
|
|
28
|
+
size = 'md',
|
|
29
|
+
fullWidth = false,
|
|
30
|
+
class: className = '',
|
|
31
|
+
oninput,
|
|
32
|
+
onchange,
|
|
33
|
+
onkeydown,
|
|
34
|
+
onfocus,
|
|
35
|
+
onblur
|
|
36
|
+
}: Props = $props();
|
|
37
|
+
|
|
38
|
+
function handleInput(event: Event) {
|
|
39
|
+
const target = event.target as HTMLInputElement;
|
|
40
|
+
value = target.value;
|
|
41
|
+
oninput?.(event);
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div class="ide-input-wrapper {fullWidth ? 'ide-input-wrapper--full' : ''} {className}">
|
|
46
|
+
<input
|
|
47
|
+
{id}
|
|
48
|
+
class="ide-input ide-input--{size}"
|
|
49
|
+
class:ide-input--error={!!error}
|
|
50
|
+
{type}
|
|
51
|
+
{value}
|
|
52
|
+
{placeholder}
|
|
53
|
+
{disabled}
|
|
54
|
+
{readonly}
|
|
55
|
+
oninput={handleInput}
|
|
56
|
+
{onchange}
|
|
57
|
+
{onkeydown}
|
|
58
|
+
{onfocus}
|
|
59
|
+
{onblur}
|
|
60
|
+
/>
|
|
61
|
+
{#if error}
|
|
62
|
+
<span class="ide-input__error">{error}</span>
|
|
63
|
+
{/if}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.ide-input-wrapper {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
gap: var(--ide-spacing-xs);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ide-input-wrapper--full {
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ide-input {
|
|
78
|
+
width: 100%;
|
|
79
|
+
font-family: var(--ide-font-sans);
|
|
80
|
+
background: var(--ide-bg-secondary);
|
|
81
|
+
color: var(--ide-text-primary);
|
|
82
|
+
border: 1px solid var(--ide-border);
|
|
83
|
+
border-radius: var(--ide-radius-md);
|
|
84
|
+
transition: all var(--ide-transition-fast);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ide-input:hover:not(:disabled) {
|
|
88
|
+
border-color: var(--ide-interactive);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ide-input:focus {
|
|
92
|
+
outline: none;
|
|
93
|
+
border-color: var(--ide-interactive-focus);
|
|
94
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ide-interactive-focus) 25%, transparent);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ide-input:disabled {
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ide-input::placeholder {
|
|
103
|
+
color: var(--ide-text-muted);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ide-input--error {
|
|
107
|
+
border-color: var(--ide-error);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.ide-input--error:focus {
|
|
111
|
+
border-color: var(--ide-error);
|
|
112
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ide-error) 25%, transparent);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Sizes */
|
|
116
|
+
.ide-input--sm {
|
|
117
|
+
height: 1.75rem;
|
|
118
|
+
padding: 0 var(--ide-spacing-sm);
|
|
119
|
+
font-size: var(--ide-font-size-xs);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ide-input--md {
|
|
123
|
+
height: 2.25rem;
|
|
124
|
+
padding: 0 var(--ide-spacing-md);
|
|
125
|
+
font-size: var(--ide-font-size-sm);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ide-input--lg {
|
|
129
|
+
height: 2.75rem;
|
|
130
|
+
padding: 0 var(--ide-spacing-md);
|
|
131
|
+
font-size: var(--ide-font-size-base);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ide-input__error {
|
|
135
|
+
font-size: var(--ide-font-size-xs);
|
|
136
|
+
color: var(--ide-error);
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
id?: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'search' | 'url';
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
oninput?: (event: Event) => void;
|
|
13
|
+
onchange?: (event: Event) => void;
|
|
14
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
15
|
+
onfocus?: (event: FocusEvent) => void;
|
|
16
|
+
onblur?: (event: FocusEvent) => void;
|
|
17
|
+
}
|
|
18
|
+
declare const Input: import("svelte").Component<Props, {}, "value">;
|
|
19
|
+
type Input = ReturnType<typeof Input>;
|
|
20
|
+
export default Input;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { formatKeybinding } from '../../utils/keybindings';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
keys: string[];
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { keys, class: className = '' }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const formatted = $derived(formatKeybinding(keys));
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<kbd class="ide-kbd {className}">{formatted}</kbd>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
.ide-kbd {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
padding: 2px 6px;
|
|
22
|
+
font-family: var(--ide-font-sans);
|
|
23
|
+
font-size: var(--ide-font-size-xs);
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
color: var(--ide-text-secondary);
|
|
26
|
+
background: var(--ide-bg-secondary);
|
|
27
|
+
border: 1px solid var(--ide-border);
|
|
28
|
+
border-radius: var(--ide-radius-sm);
|
|
29
|
+
box-shadow:
|
|
30
|
+
0 1px 0 var(--ide-border),
|
|
31
|
+
inset 0 -1px 0 color-mix(in srgb, var(--ide-border) 50%, transparent);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
</style>
|