@visulima/dev-toolbar 1.0.0-alpha.1 → 1.0.0-alpha.10
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/CHANGELOG.md +218 -0
- package/LICENSE.md +116 -5
- package/README.md +70 -43
- package/bin/mcp.js +29 -0
- package/dist/apps/a11y/a11y-app.d.ts +0 -1
- package/dist/apps/a11y/a11y-store.d.ts +12 -16
- package/dist/apps/a11y/a11y-tooltip.d.ts +1 -2
- package/dist/apps/a11y/index.js +3 -3
- package/dist/apps/annotations/annotations-app.d.ts +4 -0
- package/dist/apps/annotations/index.d.ts +3 -0
- package/dist/apps/annotations/index.js +18 -0
- package/dist/apps/assets/assets-app.d.ts +4 -0
- package/dist/apps/assets/index.d.ts +3 -0
- package/dist/apps/assets/index.js +16 -0
- package/dist/apps/inspector/a11y-capture.d.ts +12 -0
- package/dist/apps/inspector/annotation-overlay.d.ts +55 -0
- package/dist/apps/inspector/annotation-settings.d.ts +33 -0
- package/dist/apps/inspector/element-utils.d.ts +115 -0
- package/dist/apps/inspector/freeze-animations.d.ts +22 -0
- package/dist/apps/inspector/index.d.ts +3 -0
- package/dist/apps/inspector/index.js +30 -0
- package/dist/apps/inspector/inspector-app.d.ts +14 -0
- package/dist/apps/inspector/rulers.d.ts +14 -0
- package/dist/apps/inspector/theme-palette.d.ts +34 -0
- package/dist/apps/module-graph/index.js +2 -2
- package/dist/apps/module-graph/module-graph-app.d.ts +0 -1
- package/dist/apps/performance/index.js +2 -2
- package/dist/apps/performance/performance-app.d.ts +0 -1
- package/dist/apps/performance/performance-tooltip.d.ts +0 -1
- package/dist/apps/seo/index.js +2 -2
- package/dist/apps/seo/seo-app.d.ts +0 -1
- package/dist/apps/settings/index.js +2 -2
- package/dist/apps/settings/settings-app.d.ts +0 -1
- package/dist/apps/tailwind/index.d.ts +3 -0
- package/dist/apps/tailwind/index.js +7 -0
- package/dist/apps/tailwind/tailwind-app.d.ts +4 -0
- package/dist/apps/timeline/index.js +2 -2
- package/dist/apps/timeline/timeline-app.d.ts +0 -1
- package/dist/apps/vite-config/index.js +2 -2
- package/dist/apps/vite-config/vite-config-app.d.ts +0 -1
- package/dist/client/overlay.js +1 -1
- package/dist/hooks/create-hook.d.ts +7 -5
- package/dist/hooks/events.d.ts +4 -2
- package/dist/hooks/global-hook.d.ts +6 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +12 -0
- package/dist/mcp/server.js +1 -0
- package/dist/packem_chunks/inject-source.js +9 -0
- package/dist/packem_shared/Alert-D2CvX4fw.js +1 -0
- package/dist/packem_shared/Badge-BEgU04nl.js +1 -0
- package/dist/packem_shared/Button-Bkx66Co7.js +1 -0
- package/dist/packem_shared/Card-CJa4vHVc.js +1 -0
- package/dist/packem_shared/Icon-B6UHkC0o.js +1 -0
- package/dist/packem_shared/Input-Cs6aduTi.js +1 -0
- package/dist/packem_shared/Label-DyCng4Cp.js +1 -0
- package/dist/packem_shared/Popover-BtFVaZYg.js +1 -0
- package/dist/packem_shared/Progress-DN6zn-0l.js +1 -0
- package/dist/packem_shared/Select-DgQ4ss-s.js +1 -0
- package/dist/packem_shared/Separator-D38mKeZv.js +1 -0
- package/dist/packem_shared/Skeleton-Dv-tcA1P.js +1 -0
- package/dist/packem_shared/Switch-C3NTpeoR.js +1 -0
- package/dist/packem_shared/Tabs-DKWMiawt.js +1 -0
- package/dist/packem_shared/Textarea-Yfg3dLZi.js +1 -0
- package/dist/packem_shared/Tooltip-CioncSXj.js +1 -0
- package/dist/packem_shared/annotation-settings-Bv0TH4WI.js +1 -0
- package/dist/packem_shared/annotation-store-bLQRYMaI.js +1 -0
- package/dist/packem_shared/clsx-wGlvpUfw.js +1 -0
- package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +1 -0
- package/dist/packem_shared/createServerRPCContext-D-yZrEjs.js +1 -0
- package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +1 -0
- package/dist/packem_shared/{setupGlobalHook-CFuxsCyl.js → setupGlobalHook-CCf9Logv.js} +1 -1
- package/dist/packem_shared/sharedToolbarStylesheet-CaTdYhVe.js +2 -0
- package/dist/packem_shared/store-DaUtLjf3.js +1 -0
- package/dist/packem_shared/use-frame-state-CxrlPUM5.js +1 -0
- package/dist/packem_shared/use-theme-zpm4zmqP.js +1 -0
- package/dist/performance/monitor.d.ts +27 -26
- package/dist/rpc/client.d.ts +6 -4
- package/dist/rpc/functions/annotations.d.ts +28 -0
- package/dist/rpc/functions/assets.d.ts +16 -0
- package/dist/rpc/functions/module-graph.d.ts +2 -2
- package/dist/rpc/functions/open-in-editor.d.ts +13 -6
- package/dist/rpc/functions/tailwind-config.d.ts +15 -0
- package/dist/rpc/functions/vite-config.d.ts +80 -4
- package/dist/rpc/server.d.ts +11 -5
- package/dist/store/annotation-store.d.ts +41 -0
- package/dist/timeline/capture.d.ts +8 -0
- package/dist/timeline/index.d.ts +3 -1
- package/dist/timeline/store.d.ts +12 -22
- package/dist/toolbar/app-manager.d.ts +49 -40
- package/dist/toolbar/components/app-button.d.ts +2 -3
- package/dist/toolbar/components/app-canvas.d.ts +1 -2
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -1
- package/dist/toolbar/components/first-visit-hint.d.ts +3 -4
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -1
- package/dist/toolbar/components/toolbar-bar.d.ts +1 -7
- package/dist/toolbar/components/toolbar-container.d.ts +2 -8
- package/dist/toolbar/components/vite-overlay-button.d.ts +2 -3
- package/dist/toolbar/context/index.d.ts +1 -1
- package/dist/toolbar/context/toolbar-context.d.ts +43 -42
- package/dist/toolbar/global-api.d.ts +4 -3
- package/dist/toolbar/helpers.d.ts +5 -3
- package/dist/toolbar/hooks/index.d.ts +4 -4
- package/dist/toolbar/hooks/use-apps.d.ts +5 -3
- package/dist/toolbar/hooks/use-frame-state.d.ts +32 -16
- package/dist/toolbar/hooks/use-panel-visible.d.ts +9 -7
- package/dist/toolbar/hooks/use-position.d.ts +7 -5
- package/dist/toolbar/hooks/use-theme.d.ts +6 -4
- package/dist/toolbar/hooks/use-toolbar.d.ts +4 -2
- package/dist/toolbar/index.d.ts +9 -17
- package/dist/toolbar/index.js +3 -4
- package/dist/toolbar/settings.d.ts +7 -7
- package/dist/toolbar/stylesheet.d.ts +3 -1
- package/dist/toolbar/utils/index.d.ts +3 -3
- package/dist/types/annotations.d.ts +156 -0
- package/dist/types/app.d.ts +26 -14
- package/dist/types/global-api.d.ts +27 -31
- package/dist/types/hooks.d.ts +32 -34
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messaging.d.ts +2 -2
- package/dist/types/rpc.d.ts +49 -7
- package/dist/types/timeline.d.ts +3 -3
- package/dist/types/toolbar.d.ts +1 -1
- package/dist/ui/components/alert.d.ts +19 -0
- package/dist/ui/components/badge.d.ts +9 -0
- package/dist/ui/components/button.d.ts +11 -0
- package/dist/ui/components/card.d.ts +16 -0
- package/dist/ui/components/icon.d.ts +5 -7
- package/dist/ui/components/input.d.ts +7 -0
- package/dist/ui/components/label.d.ts +7 -0
- package/dist/ui/components/popover.d.ts +27 -0
- package/dist/ui/components/progress.d.ts +7 -0
- package/dist/ui/components/select.d.ts +54 -0
- package/dist/ui/components/separator.d.ts +8 -0
- package/dist/ui/components/skeleton.d.ts +6 -0
- package/dist/ui/components/switch.d.ts +11 -0
- package/dist/ui/components/tabs.d.ts +28 -0
- package/dist/ui/components/textarea.d.ts +7 -0
- package/dist/ui/components/tooltip.d.ts +19 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.js +1 -0
- package/dist/vite/inject-source.d.ts +24 -0
- package/dist/vite/matcher.d.ts +6 -0
- package/dist/vite-plugin.d.ts +49 -6
- package/dist/vite-plugin.js +5 -2
- package/package.json +51 -12
- package/dist/apps/more/index.d.ts +0 -3
- package/dist/apps/more/index.js +0 -19
- package/dist/apps/more/more-app.d.ts +0 -5
- package/dist/packem_shared/TimelineStore-BgBrirKd.js +0 -1
- package/dist/packem_shared/cn-BEsR6GkP.js +0 -1
- package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +0 -1
- package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +0 -1
- package/dist/packem_shared/icon-BUQ92HaT.js +0 -1
- package/dist/packem_shared/store-BxE0w51s.js +0 -1
- package/dist/rpc/index.d.ts +0 -8
- package/dist/utils/cn.d.ts +0 -8
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation intent — describes what the user wants to communicate.
|
|
3
|
+
*/
|
|
4
|
+
export type AnnotationIntent = "approve" | "change" | "fix" | "question";
|
|
5
|
+
/**
|
|
6
|
+
* Annotation severity — how urgent or important the annotation is.
|
|
7
|
+
*/
|
|
8
|
+
export type AnnotationSeverity = "blocking" | "important" | "suggestion";
|
|
9
|
+
/**
|
|
10
|
+
* Annotation status — lifecycle state.
|
|
11
|
+
*/
|
|
12
|
+
export type AnnotationStatus = "acknowledged" | "dismissed" | "pending" | "resolved";
|
|
13
|
+
/**
|
|
14
|
+
* A single message in a conversation thread attached to an annotation.
|
|
15
|
+
*/
|
|
16
|
+
export interface ThreadMessage {
|
|
17
|
+
/** Message text */
|
|
18
|
+
content: string;
|
|
19
|
+
/** Unique message identifier */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** Who wrote it — e.g. "human", "agent", or a specific agent name */
|
|
22
|
+
role: string;
|
|
23
|
+
/** ISO 8601 timestamp */
|
|
24
|
+
timestamp: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Bounding box of the annotated element relative to the viewport.
|
|
28
|
+
*/
|
|
29
|
+
export interface BoundingBox {
|
|
30
|
+
height: number;
|
|
31
|
+
width: number;
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Detected framework component information.
|
|
37
|
+
*/
|
|
38
|
+
export interface FrameworkContext {
|
|
39
|
+
/** Component name */
|
|
40
|
+
componentName?: string;
|
|
41
|
+
/** Full component stack (e.g. ["App", "Layout", "Header", "Button"]) */
|
|
42
|
+
componentStack?: string[];
|
|
43
|
+
/** Additional framework-specific data (e.g. props) */
|
|
44
|
+
data?: Record<string, unknown>;
|
|
45
|
+
/** Framework identifier (react, vue, svelte, etc.) */
|
|
46
|
+
framework: string;
|
|
47
|
+
/** Source file path */
|
|
48
|
+
sourceFile?: string;
|
|
49
|
+
/** Source line number */
|
|
50
|
+
sourceLine?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Captured accessibility attributes for an element.
|
|
54
|
+
*/
|
|
55
|
+
export interface AccessibilityInfo {
|
|
56
|
+
/** aria-describedby content */
|
|
57
|
+
ariaDescribedBy?: string;
|
|
58
|
+
/** aria-label value */
|
|
59
|
+
ariaLabel?: string;
|
|
60
|
+
/** Whether the element is focusable */
|
|
61
|
+
focusable: boolean;
|
|
62
|
+
/** ARIA role (explicit or implicit) */
|
|
63
|
+
role?: string;
|
|
64
|
+
/** tabindex value */
|
|
65
|
+
tabindex?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A visual annotation placed on a page element during development.
|
|
69
|
+
* Stored in `.devtoolbar/annotations.json`.
|
|
70
|
+
*/
|
|
71
|
+
export interface Annotation {
|
|
72
|
+
/** Captured accessibility attributes */
|
|
73
|
+
accessibility?: AccessibilityInfo;
|
|
74
|
+
/** Element bounding box at annotation time */
|
|
75
|
+
boundingBox?: BoundingBox;
|
|
76
|
+
/** User feedback / description */
|
|
77
|
+
comment: string;
|
|
78
|
+
/** Key computed CSS properties for forensic context */
|
|
79
|
+
computedStyles?: string;
|
|
80
|
+
/** ISO 8601 creation timestamp */
|
|
81
|
+
createdAt: string;
|
|
82
|
+
/** CSS classes on the annotated element (module hashes cleaned) */
|
|
83
|
+
cssClasses?: string;
|
|
84
|
+
/** Bounding boxes for multi-select annotations */
|
|
85
|
+
elementBoundingBoxes?: BoundingBox[];
|
|
86
|
+
/** Human-readable element label (e.g. 'button "Submit"') */
|
|
87
|
+
elementLabel?: string;
|
|
88
|
+
/** CSS selector path to the element */
|
|
89
|
+
elementPath?: string;
|
|
90
|
+
/** HTML tag name of the annotated element */
|
|
91
|
+
elementTag: string;
|
|
92
|
+
/** Detected framework component context */
|
|
93
|
+
frameworkContext?: FrameworkContext;
|
|
94
|
+
/** Full DOM ancestry path (e.g. "body > main > article > p") */
|
|
95
|
+
fullPath?: string;
|
|
96
|
+
/** Unique identifier (crypto.randomUUID) */
|
|
97
|
+
id: string;
|
|
98
|
+
/** What the user wants — fix, change, question, or approve */
|
|
99
|
+
intent: AnnotationIntent;
|
|
100
|
+
/** Whether the element has fixed/sticky positioning */
|
|
101
|
+
isFixed?: boolean;
|
|
102
|
+
/** Whether this is a multi-select (drag) annotation */
|
|
103
|
+
isMultiSelect?: boolean;
|
|
104
|
+
/** Sibling elements for spatial context */
|
|
105
|
+
nearbyElements?: string;
|
|
106
|
+
/** Text near the annotated element for additional context */
|
|
107
|
+
nearbyText?: string;
|
|
108
|
+
/** ISO 8601 resolution timestamp */
|
|
109
|
+
resolvedAt?: string;
|
|
110
|
+
/** Who resolved it — "human" or "agent" (or a specific agent name) */
|
|
111
|
+
resolvedBy?: string;
|
|
112
|
+
/** Path to screenshot file relative to .devtoolbar/ (e.g. "screenshots/<id>.png") */
|
|
113
|
+
screenshot?: string;
|
|
114
|
+
/** Text the user had selected when annotating */
|
|
115
|
+
selectedText?: string;
|
|
116
|
+
/** Severity level */
|
|
117
|
+
severity: AnnotationSeverity;
|
|
118
|
+
/** Source file location from data-vdt-source (file:line:col) */
|
|
119
|
+
source?: string;
|
|
120
|
+
/** Lifecycle status */
|
|
121
|
+
status: AnnotationStatus;
|
|
122
|
+
/** Conversation thread (human ↔ AI agent) */
|
|
123
|
+
thread?: ThreadMessage[];
|
|
124
|
+
/** ISO 8601 last-updated timestamp */
|
|
125
|
+
updatedAt: string;
|
|
126
|
+
/** Page URL where the annotation was created */
|
|
127
|
+
url: string;
|
|
128
|
+
/** Click X as percentage of viewport width (0-100) — survives resize */
|
|
129
|
+
x: number;
|
|
130
|
+
/**
|
|
131
|
+
* Click Y as absolute page position (pixels from document top) — survives scroll.
|
|
132
|
+
* For fixed/sticky elements, Y is viewport-relative instead.
|
|
133
|
+
*/
|
|
134
|
+
y: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Data required to create a new annotation (server-generated fields omitted).
|
|
138
|
+
*/
|
|
139
|
+
export type CreateAnnotationData = Omit<Annotation, "createdAt" | "id" | "resolvedAt" | "resolvedBy" | "status" | "thread" | "updatedAt">;
|
|
140
|
+
/**
|
|
141
|
+
* Fields that can be updated on an existing annotation.
|
|
142
|
+
*/
|
|
143
|
+
export interface UpdateAnnotationData {
|
|
144
|
+
/** Updated comment text */
|
|
145
|
+
comment?: string;
|
|
146
|
+
/** Updated intent */
|
|
147
|
+
intent?: AnnotationIntent;
|
|
148
|
+
/** Who resolved the annotation */
|
|
149
|
+
resolvedBy?: string;
|
|
150
|
+
/** Updated severity */
|
|
151
|
+
severity?: AnnotationSeverity;
|
|
152
|
+
/** New status */
|
|
153
|
+
status?: AnnotationStatus;
|
|
154
|
+
/** Append a thread message */
|
|
155
|
+
threadMessage?: ThreadMessage;
|
|
156
|
+
}
|
package/dist/types/app.d.ts
CHANGED
|
@@ -73,11 +73,10 @@ export interface DevToolbarApp {
|
|
|
73
73
|
*/
|
|
74
74
|
beforeTogglingOff?: (canvas: ShadowRoot) => boolean | Promise<boolean>;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @param canvas Shadow root of the app
|
|
76
|
+
* Preact component for rendering (alternative to init)
|
|
77
|
+
* If provided, this will be used instead of init
|
|
79
78
|
*/
|
|
80
|
-
|
|
79
|
+
component?: ComponentType<AppComponentProps>;
|
|
81
80
|
/**
|
|
82
81
|
* When true, this app is automatically activated when the toolbar opens for
|
|
83
82
|
* the first time (or when no other app has been activated yet).
|
|
@@ -86,17 +85,11 @@ export interface DevToolbarApp {
|
|
|
86
85
|
*/
|
|
87
86
|
defaultOpen?: boolean;
|
|
88
87
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
component?: ComponentType<AppComponentProps>;
|
|
93
|
-
/**
|
|
94
|
-
* Optional hover tooltip component — renders a compact live preview when the
|
|
95
|
-
* user hovers over this app's button in the toolbar pill.
|
|
96
|
-
* The component should be small (≤280px wide) and self-contained.
|
|
97
|
-
* If omitted, hovering shows the native title tooltip only.
|
|
88
|
+
* Called when the app is unregistered / removed from the toolbar.
|
|
89
|
+
* Use this for final cleanup (event listeners, timers, subscriptions).
|
|
90
|
+
* @param canvas Shadow root of the app
|
|
98
91
|
*/
|
|
99
|
-
|
|
92
|
+
destroy?: (canvas: ShadowRoot) => Promise<void> | void;
|
|
100
93
|
/**
|
|
101
94
|
* Icon HTML string (SVG)
|
|
102
95
|
*/
|
|
@@ -116,6 +109,25 @@ export interface DevToolbarApp {
|
|
|
116
109
|
* Display name of the app
|
|
117
110
|
*/
|
|
118
111
|
name: string;
|
|
112
|
+
/**
|
|
113
|
+
* Action button callback — called when the button is activated (active: false → true).
|
|
114
|
+
* When present, clicking the toolbar button will NOT open a panel.
|
|
115
|
+
* Instead the button toggles its active state and calls onClick (activate)
|
|
116
|
+
* or onDeactivate (deactivate).
|
|
117
|
+
*/
|
|
118
|
+
onClick?: () => Promise<void> | void;
|
|
119
|
+
/**
|
|
120
|
+
* Called when the action button is deactivated (active: true → false).
|
|
121
|
+
* Only meaningful when onClick is also provided.
|
|
122
|
+
*/
|
|
123
|
+
onDeactivate?: () => Promise<void> | void;
|
|
124
|
+
/**
|
|
125
|
+
* Optional hover tooltip component — renders a compact live preview when the
|
|
126
|
+
* user hovers over this app's button in the toolbar pill.
|
|
127
|
+
* The component should be small (≤280px wide) and self-contained.
|
|
128
|
+
* If omitted, hovering shows the native title tooltip only.
|
|
129
|
+
*/
|
|
130
|
+
tooltip?: ComponentType<AppTooltipProps>;
|
|
119
131
|
/**
|
|
120
132
|
* App rendering mode
|
|
121
133
|
*/
|
|
@@ -1,84 +1,79 @@
|
|
|
1
1
|
import type { DevToolbarApp } from "./app.d.ts";
|
|
2
|
-
import type { ToolbarSettings } from "./toolbar.d.ts";
|
|
3
2
|
import type { DevToolbarHook } from "./hooks.d.ts";
|
|
4
3
|
import type { ServerFunctions } from "./rpc.d.ts";
|
|
4
|
+
import type { ToolbarSettings } from "./toolbar.d.ts";
|
|
5
5
|
/**
|
|
6
|
-
* Global DevTools API interface
|
|
6
|
+
* Global DevTools API interface.
|
|
7
7
|
* Exposed as window.__VISULIMA_DEVTOOLS__
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
interface VisulimaDevTools {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param appId App ID
|
|
11
|
+
* Clears notification for an app.
|
|
13
12
|
*/
|
|
14
13
|
clearNotification: (appId: string) => void;
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
* Closes the currently active app.
|
|
17
16
|
*/
|
|
18
17
|
closeApp: () => Promise<void>;
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @returns Active app ID or null
|
|
19
|
+
* Gets the currently active app ID.
|
|
22
20
|
*/
|
|
23
|
-
getActiveApp: () => string |
|
|
21
|
+
getActiveApp: () => string | undefined;
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @returns Array of app definitions
|
|
23
|
+
* Gets all registered apps.
|
|
27
24
|
*/
|
|
28
25
|
getApps: () => DevToolbarApp[];
|
|
29
26
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @returns Toolbar settings
|
|
27
|
+
* Gets current toolbar settings.
|
|
32
28
|
*/
|
|
33
29
|
getSettings: () => ToolbarSettings;
|
|
34
30
|
/**
|
|
35
|
-
*
|
|
31
|
+
* Hides the toolbar.
|
|
36
32
|
*/
|
|
37
33
|
hide: () => void;
|
|
38
34
|
/**
|
|
39
|
-
* Hook instance for event subscriptions
|
|
35
|
+
* Hook instance for event subscriptions.
|
|
40
36
|
*/
|
|
41
37
|
hook: DevToolbarHook;
|
|
42
38
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @param appId App ID
|
|
45
|
-
* @param level Notification level
|
|
39
|
+
* Shows a notification for an app.
|
|
46
40
|
*/
|
|
47
41
|
notify: (appId: string, level: "info" | "warning" | "error") => void;
|
|
48
42
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param appId App ID to open
|
|
43
|
+
* Opens an app by ID.
|
|
51
44
|
*/
|
|
52
45
|
openApp: (appId: string) => Promise<void>;
|
|
53
46
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @param app App definition
|
|
47
|
+
* Registers a custom app.
|
|
56
48
|
*/
|
|
57
49
|
registerApp: (app: DevToolbarApp) => void;
|
|
58
50
|
/**
|
|
59
|
-
* RPC client for calling server functions
|
|
51
|
+
* RPC client for calling server functions.
|
|
60
52
|
*/
|
|
61
53
|
rpc: ServerFunctions;
|
|
62
54
|
/**
|
|
63
|
-
*
|
|
55
|
+
* Directly sets the active state of an action button without invoking callbacks.
|
|
56
|
+
* Useful for deactivating a button from async work running outside the toolbar.
|
|
57
|
+
*/
|
|
58
|
+
setAppActive: (appId: string, active: boolean) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Shows the toolbar.
|
|
64
61
|
*/
|
|
65
62
|
show: () => void;
|
|
66
63
|
/**
|
|
67
|
-
*
|
|
64
|
+
* Toggles toolbar visibility.
|
|
68
65
|
*/
|
|
69
66
|
toggle: () => void;
|
|
70
67
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param appId App ID to unregister
|
|
68
|
+
* Unregisters an app by ID.
|
|
73
69
|
*/
|
|
74
70
|
unregisterApp: (appId: string) => void;
|
|
75
71
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @param settings Partial settings to update
|
|
72
|
+
* Updates toolbar settings.
|
|
78
73
|
*/
|
|
79
74
|
updateSettings: (settings: Partial<ToolbarSettings>) => void;
|
|
80
75
|
/**
|
|
81
|
-
* Package version
|
|
76
|
+
* Package version.
|
|
82
77
|
*/
|
|
83
78
|
version: string;
|
|
84
79
|
}
|
|
@@ -88,8 +83,9 @@ export interface VisulimaDevTools {
|
|
|
88
83
|
declare global {
|
|
89
84
|
interface Window {
|
|
90
85
|
/**
|
|
91
|
-
* Visulima DevTools global API
|
|
86
|
+
* Visulima DevTools global API.
|
|
92
87
|
*/
|
|
93
88
|
__VISULIMA_DEVTOOLS__?: VisulimaDevTools;
|
|
94
89
|
}
|
|
95
90
|
}
|
|
91
|
+
export type { VisulimaDevTools };
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -3,75 +3,72 @@ import type { TimelineEvent } from "./timeline.d.ts";
|
|
|
3
3
|
/**
|
|
4
4
|
* Hook event definitions
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Extension point for custom events
|
|
9
|
-
*/
|
|
6
|
+
interface HookEvents {
|
|
10
7
|
[key: string]: (...args: any[]) => void;
|
|
11
8
|
/**
|
|
12
|
-
* App error occurred
|
|
13
|
-
* @param error Error object
|
|
14
|
-
* @param appId Optional app ID where error occurred
|
|
9
|
+
* App error occurred.
|
|
10
|
+
* @param error Error object.
|
|
11
|
+
* @param appId Optional app ID where error occurred.
|
|
15
12
|
*/
|
|
16
13
|
"app:error": (error: Error, appId?: string) => void;
|
|
17
14
|
/**
|
|
18
|
-
* DevTools closed
|
|
15
|
+
* DevTools closed.
|
|
19
16
|
*/
|
|
20
17
|
"devtools:close": () => void;
|
|
21
18
|
/**
|
|
22
|
-
* DevTools initialized
|
|
19
|
+
* DevTools initialized.
|
|
23
20
|
*/
|
|
24
21
|
"devtools:init": () => void;
|
|
25
22
|
/**
|
|
26
|
-
* DevTools opened
|
|
27
|
-
* @param appId ID of the opened app
|
|
23
|
+
* DevTools opened.
|
|
24
|
+
* @param appId ID of the opened app.
|
|
28
25
|
*/
|
|
29
26
|
"devtools:open": (appId: string) => void;
|
|
30
27
|
/**
|
|
31
|
-
* Timeline event added
|
|
32
|
-
* @param event Timeline event
|
|
28
|
+
* Timeline event added.
|
|
29
|
+
* @param event Timeline event.
|
|
33
30
|
*/
|
|
34
31
|
"timeline:event": (event: TimelineEvent) => void;
|
|
35
32
|
}
|
|
36
33
|
/**
|
|
37
|
-
* Dev toolbar hook interface
|
|
34
|
+
* Dev toolbar hook interface.
|
|
38
35
|
* Exposed as window.__DEV_TOOLBAR_HOOK__
|
|
39
36
|
*/
|
|
40
|
-
|
|
37
|
+
interface DevToolbarHook {
|
|
41
38
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param groupId Timeline group ID
|
|
44
|
-
* @param event Timeline event
|
|
39
|
+
* Adds a timeline event.
|
|
40
|
+
* @param groupId Timeline group ID.
|
|
41
|
+
* @param event Timeline event.
|
|
45
42
|
*/
|
|
46
43
|
addTimelineEvent: (groupId: string, event: TimelineEvent) => void;
|
|
47
44
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param event Event name
|
|
50
|
-
* @param args Event arguments
|
|
45
|
+
* Emits an event.
|
|
46
|
+
* @param event Event name.
|
|
47
|
+
* @param args Event arguments.
|
|
51
48
|
*/
|
|
52
49
|
emit: <T extends keyof HookEvents>(event: T, ...args: Parameters<HookEvents[T]>) => void;
|
|
53
50
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @param event Event name
|
|
56
|
-
* @param handler Optional specific handler to remove
|
|
51
|
+
* Unsubscribes from an event.
|
|
52
|
+
* @param event Event name.
|
|
53
|
+
* @param handler Optional specific handler to remove.
|
|
57
54
|
*/
|
|
58
55
|
off: <T extends keyof HookEvents>(event: T, handler?: HookEvents[T]) => void;
|
|
59
56
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param event Event name
|
|
62
|
-
* @param handler Event handler
|
|
63
|
-
* @returns Unsubscribe function
|
|
57
|
+
* Subscribes to an event.
|
|
58
|
+
* @param event Event name.
|
|
59
|
+
* @param handler Event handler.
|
|
60
|
+
* @returns Unsubscribe function.
|
|
64
61
|
*/
|
|
65
62
|
on: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => () => void;
|
|
66
63
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @param event Event name
|
|
69
|
-
* @param handler Event handler
|
|
64
|
+
* Subscribes to an event once.
|
|
65
|
+
* @param event Event name.
|
|
66
|
+
* @param handler Event handler.
|
|
70
67
|
*/
|
|
71
68
|
once: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => void;
|
|
72
69
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param app App definition
|
|
70
|
+
* Registers a custom app.
|
|
71
|
+
* @param app App definition.
|
|
75
72
|
*/
|
|
76
73
|
registerApp: (app: DevToolbarApp) => void;
|
|
77
74
|
}
|
|
@@ -81,8 +78,9 @@ export interface DevToolbarHook {
|
|
|
81
78
|
declare global {
|
|
82
79
|
interface Window {
|
|
83
80
|
/**
|
|
84
|
-
* Dev toolbar hook for library integrations
|
|
81
|
+
* Dev toolbar hook for library integrations.
|
|
85
82
|
*/
|
|
86
83
|
__DEV_TOOLBAR_HOOK__?: DevToolbarHook;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
86
|
+
export type { DevToolbarHook, HookEvents };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public type exports
|
|
3
3
|
*/
|
|
4
|
+
export type { AccessibilityInfo, Annotation, AnnotationIntent, AnnotationSeverity, AnnotationStatus, BoundingBox, CreateAnnotationData, FrameworkContext, ThreadMessage, UpdateAnnotationData, } from "./annotations.d.ts";
|
|
4
5
|
export type { AppView, DevToolbarApp, DevToolbarAppState, ServerFunctions, ServerHelpers, ToolbarAppEventTarget } from "./app.d.ts";
|
|
5
6
|
export type { VisulimaDevTools } from "./global-api.d.ts";
|
|
6
7
|
export type { DevToolbarHook, HookEvents } from "./hooks.d.ts";
|
|
@@ -33,11 +33,11 @@ export interface MessageChannel<TEvents extends Record<string, (...args: any[])
|
|
|
33
33
|
*/
|
|
34
34
|
export type ChannelFactory<TEvents extends Record<string, (...args: any[]) => void>> = () => MessageChannel<TEvents>;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Factory result providing a method to instantiate named message channels.
|
|
37
37
|
*/
|
|
38
38
|
export interface MessageChannelContext<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Creates and returns a new channel instance.
|
|
41
41
|
*/
|
|
42
42
|
createChannel: () => MessageChannel<TEvents>;
|
|
43
43
|
}
|
package/dist/types/rpc.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ViteDevServer } from "vite";
|
|
2
|
+
import type { StaticAsset } from "../rpc/functions/assets.d.ts";
|
|
2
3
|
import type { SerializableModuleNode } from "../rpc/functions/module-graph.d.ts";
|
|
4
|
+
import type { TailwindConfigResult } from "../rpc/functions/tailwind-config.d.ts";
|
|
5
|
+
import type { Annotation, CreateAnnotationData, UpdateAnnotationData } from "./annotations.d.ts";
|
|
3
6
|
/**
|
|
4
7
|
* Server-side RPC functions
|
|
5
8
|
* These can be called from the client
|
|
@@ -9,10 +12,37 @@ export interface ServerFunctions {
|
|
|
9
12
|
* Extension point for custom server functions
|
|
10
13
|
*/
|
|
11
14
|
[key: string]: (...args: any[]) => Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new annotation
|
|
17
|
+
* @param data Annotation data (id, timestamps, status are generated server-side)
|
|
18
|
+
*/
|
|
19
|
+
createAnnotation: (data: CreateAnnotationData) => Promise<Annotation>;
|
|
20
|
+
/**
|
|
21
|
+
* Delete an annotation and its screenshot
|
|
22
|
+
* @param id Annotation ID
|
|
23
|
+
*/
|
|
24
|
+
deleteAnnotation: (id: string) => Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Get all annotations
|
|
27
|
+
*/
|
|
28
|
+
getAnnotations: () => Promise<Annotation[]>;
|
|
12
29
|
/**
|
|
13
30
|
* Get module dependency graph
|
|
14
31
|
*/
|
|
15
32
|
getModuleGraph: () => Promise<SerializableModuleNode[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a screenshot as a base64 data URL
|
|
35
|
+
* @param annotationId Annotation ID
|
|
36
|
+
*/
|
|
37
|
+
getScreenshot: (annotationId: string) => Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Get all static assets from the public directory
|
|
40
|
+
*/
|
|
41
|
+
getStaticAssets: () => Promise<StaticAsset[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get full Tailwind CSS theme (default + user overrides)
|
|
44
|
+
*/
|
|
45
|
+
getTailwindConfig: () => Promise<TailwindConfigResult>;
|
|
16
46
|
/**
|
|
17
47
|
* Get Vite configuration
|
|
18
48
|
*/
|
|
@@ -22,33 +52,44 @@ export interface ServerFunctions {
|
|
|
22
52
|
* @param file File path
|
|
23
53
|
* @param line Line number (1-based)
|
|
24
54
|
* @param column Column number (1-based)
|
|
55
|
+
* @param editor Editor override (e.g. "code", "webstorm") — empty string means auto-detect
|
|
25
56
|
*/
|
|
26
|
-
openInEditor: (file: string, line?: number, column?: number) => Promise<void>;
|
|
57
|
+
openInEditor: (file: string, line?: number, column?: number, editor?: string) => Promise<void>;
|
|
27
58
|
/**
|
|
28
59
|
* Read file contents
|
|
29
60
|
* @param path File path
|
|
30
61
|
*/
|
|
31
62
|
readFile: (path: string) => Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Save a screenshot for an annotation
|
|
65
|
+
* @param annotationId Annotation ID
|
|
66
|
+
* @param dataUrl Base64 data URL (PNG, JPEG, WebP, or SVG)
|
|
67
|
+
* @returns Relative path within .devtoolbar/
|
|
68
|
+
*/
|
|
69
|
+
saveScreenshot: (annotationId: string, dataUrl: string) => Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Update an existing annotation
|
|
72
|
+
* @param id Annotation ID
|
|
73
|
+
* @param data Fields to update
|
|
74
|
+
*/
|
|
75
|
+
updateAnnotation: (id: string, data: UpdateAnnotationData) => Promise<Annotation | null>;
|
|
32
76
|
}
|
|
33
77
|
/**
|
|
34
78
|
* Client-side RPC functions
|
|
35
79
|
* These can be called from the server
|
|
36
80
|
*/
|
|
37
81
|
export interface ClientFunctions {
|
|
38
|
-
/**
|
|
39
|
-
* Extension point for custom client functions
|
|
40
|
-
*/
|
|
41
82
|
[key: string]: (...args: any[]) => void;
|
|
42
83
|
/**
|
|
43
84
|
* Notify client of config change
|
|
44
85
|
* @param config New Vite config
|
|
45
86
|
*/
|
|
46
|
-
onConfigChange: (config: Record<string,
|
|
87
|
+
onConfigChange: (config: Record<string, unknown>) => void;
|
|
47
88
|
/**
|
|
48
89
|
* Notify client of HMR update
|
|
49
90
|
* @param payload HMR payload
|
|
50
91
|
*/
|
|
51
|
-
onHMRUpdate: (payload:
|
|
92
|
+
onHMRUpdate: (payload: unknown) => void;
|
|
52
93
|
/**
|
|
53
94
|
* Notify client of module update
|
|
54
95
|
* @param module Updated module node
|
|
@@ -89,7 +130,8 @@ export interface ClientRPCContext {
|
|
|
89
130
|
/**
|
|
90
131
|
* Register a client function
|
|
91
132
|
* @param name Function name
|
|
92
|
-
* @param
|
|
133
|
+
* @param function_ Function implementation
|
|
93
134
|
*/
|
|
94
135
|
registerFunction: <K extends keyof ClientFunctions>(name: K, function_: ClientFunctions[K]) => void;
|
|
95
136
|
}
|
|
137
|
+
export { type StaticAsset } from "../rpc/functions/assets.d.ts";
|
package/dist/types/timeline.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Severity levels for timeline events.
|
|
3
3
|
*/
|
|
4
4
|
export type TimelineEventLevel = "info" | "warning" | "error";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* A single captured event displayed in the timeline panel.
|
|
7
7
|
*/
|
|
8
8
|
export interface TimelineEvent {
|
|
9
9
|
/**
|
|
@@ -36,7 +36,7 @@ export interface TimelineEvent {
|
|
|
36
36
|
title: string;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* A named group that holds related timeline events.
|
|
40
40
|
*/
|
|
41
41
|
export interface TimelineGroup {
|
|
42
42
|
/**
|
package/dist/types/toolbar.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
2
|
+
type AlertVariant = "default" | "destructive" | "info" | "success" | "warning";
|
|
3
|
+
interface AlertProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children?: ComponentChildren;
|
|
5
|
+
class?: string;
|
|
6
|
+
variant?: AlertVariant;
|
|
7
|
+
}
|
|
8
|
+
interface AlertTitleProps extends JSX.HTMLAttributes<HTMLHeadingElement> {
|
|
9
|
+
children?: ComponentChildren;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
interface AlertDescriptionProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
children?: ComponentChildren;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Alert: ({ children, class: className, variant, ...rest }: AlertProps) => JSX.Element;
|
|
17
|
+
declare const AlertTitle: ({ children, class: className, ...rest }: AlertTitleProps) => JSX.Element;
|
|
18
|
+
declare const AlertDescription: ({ children, class: className, ...rest }: AlertDescriptionProps) => JSX.Element;
|
|
19
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
2
|
+
type BadgeVariant = "default" | "destructive" | "info" | "outline" | "secondary" | "success" | "warning";
|
|
3
|
+
interface BadgeProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children?: ComponentChildren;
|
|
5
|
+
class?: string;
|
|
6
|
+
variant?: BadgeVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const Badge: ({ children, class: className, variant, ...rest }: BadgeProps) => JSX.Element;
|
|
9
|
+
export default Badge;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
2
|
+
type ButtonSize = "default" | "icon" | "lg" | "sm";
|
|
3
|
+
type ButtonVariant = "default" | "destructive" | "ghost" | "link" | "outline" | "secondary";
|
|
4
|
+
interface ButtonProps extends JSX.ButtonHTMLAttributes {
|
|
5
|
+
children?: ComponentChildren;
|
|
6
|
+
class?: string;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: ({ children, class: className, size, type, variant, ...rest }: ButtonProps) => JSX.Element;
|
|
11
|
+
export default Button;
|