Live Preview: Svelte Agentation
Dev-mode Svelte inspector for source-aware element inspection and browser annotations.
sv-agentation helps developers inspect rendered DOM, jump to source, annotate UI directly in the browser, and copy structured output for developer or AI-assisted workflows.
npm install sv-agentation
pnpm add sv-agentation
yarn add sv-agentation
bun add sv-agentation
<script lang="ts">
import { browser, dev } from '$app/environment';
import { Agentation } from 'sv-agentation';
// for open in vs code feature
const workspaceRoot = '/absolute/path/to/your/repo';
</script>
{#if browser && dev}
<Agentation {workspaceRoot} />
{/if}
Mount the inspector only in development and only in the browser.
Agentation
-> element-source-inspector.svelte
-> CopyOpenController
-> internal/controller-state.svelte.ts
-> internal/controller-selection.ts
-> internal/controller-composer.ts
-> internal/controller-browser.ts
-> components/*
-> utils/note-*.ts + utils/selection.ts + utils/source.ts
inspect / select
-> open composer
-> save note
-> persist to localStorage
-> render markers
compact, standard, detailed, or forensic output modes.browser && dev.| Prop | Type | Description |
|---|---|---|
workspaceRoot |
string | null |
Absolute project root for source lookup and editor links. |
selector |
string | null |
Optional selector to scope inspectable elements. |
vscodeScheme |
'vscode' | 'vscode-insiders' |
Choose the VS Code URL scheme for open-in-editor actions. |
openSourceOnClick |
boolean |
Open source directly on click instead of only showing metadata. |
deleteAllDelayMs |
number |
Confirmation delay for delete-all notes. |
toolbarPosition |
'top-left' | 'top-center' | 'top-right' | 'mid-right' | 'mid-left' | 'bottom-left' | 'bottom-center' | 'bottom-right' |
Initial preset for the floating toolbar position. |
outputMode |
'compact' | 'standard' | 'detailed' | 'forensic' |
Initial copy/export mode for note output. |
pauseAnimations |
boolean |
Start with page animations paused while the inspector is active. |
clearOnCopy |
boolean |
Clear saved notes after a successful copy action. |
includeComponentContext |
boolean |
Include captured component ancestry in copied output. |
includeComputedStyles |
boolean |
Include computed styles in forensic output payloads. |
copyToClipboard |
boolean |
Disable direct clipboard writes and use callbacks only. |
onAnnotationAdd |
(annotation) => void |
Called after a note is created. |
onAnnotationUpdate |
(annotation) => void |
Called after a note is updated. |
onAnnotationDelete |
(annotation) => void |
Called after a note is deleted. |
onAnnotationsClear |
(annotations) => void |
Called after all notes are cleared. |
onCopy |
(markdown, payload) => void |
Called after note export is prepared. |
| Shortcut | Action | Description |
|---|---|---|
i |
Toggle inspector | Open or close the inspector toolbar and annotation mode. |
c |
Copy all notes | Copy notes as Markdown when at least one note exists. |
r |
Reset toolbar position | Move the floating toolbar back to its default bottom-right placement. |
o |
Open source | Open the currently hovered source location when the inspector is active. |
esc |
Cancel current action | Clear transient selections, close the composer, or close settings/delete state. |
shift + ctrl/cmd + click |
Build a group selection | Add or remove elements from a grouped annotation target before releasing the modifiers. |
element-source metadata and your workspaceRoot plus editor setup.This project is highly inspired by Agentation.com.