@visulima/dev-toolbar 1.0.0-alpha.4 → 1.0.0-alpha.41
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 +323 -0
- package/LICENSE.md +137 -5
- package/README.md +75 -18
- package/bin/mcp.js +29 -0
- package/dist/apps/a11y/index.d.ts +3 -2
- package/dist/apps/a11y/index.js +21 -2
- package/dist/apps/annotations/index.d.ts +4 -0
- package/dist/apps/annotations/index.js +18 -0
- package/dist/apps/assets/index.d.ts +4 -0
- package/dist/apps/assets/index.js +16 -0
- package/dist/apps/inspector/index.d.ts +3 -2
- package/dist/apps/inspector/index.js +30 -1
- package/dist/apps/module-graph/index.d.ts +3 -2
- package/dist/apps/module-graph/index.js +20 -1
- package/dist/apps/performance/index.d.ts +3 -2
- package/dist/apps/performance/index.js +17 -1
- package/dist/apps/seo/index.d.ts +3 -2
- package/dist/apps/seo/index.js +17 -1
- package/dist/apps/settings/index.d.ts +3 -2
- package/dist/apps/settings/index.js +17 -1
- package/dist/apps/tailwind/index.d.ts +3 -2
- package/dist/apps/tailwind/index.js +5 -5
- package/dist/apps/timeline/index.d.ts +3 -2
- package/dist/apps/timeline/index.js +18 -1
- package/dist/apps/vite-config/index.d.ts +3 -2
- package/dist/apps/vite-config/index.js +16 -1
- package/dist/client/overlay.d.ts +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +133 -8
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +1 -0
- package/dist/packem_chunks/inject-source.js +7 -1
- package/dist/packem_shared/Alert-CZq7C43v.js +1 -0
- package/dist/packem_shared/Badge-PpblpNWg.js +1 -0
- package/dist/packem_shared/Button-CAKvtfij.js +1 -0
- package/dist/packem_shared/Card-BSy2oRiS.js +1 -0
- package/dist/packem_shared/Icon-0XYV-4AL.js +1 -0
- package/dist/packem_shared/Input-Dc1WiT01.js +1 -0
- package/dist/packem_shared/Label-BZh8XxUb.js +1 -0
- package/dist/packem_shared/Popover-DuiU8EPg.js +1 -0
- package/dist/packem_shared/Progress-C90LC--2.js +1 -0
- package/dist/packem_shared/Select-CwD-d0pi.js +1 -0
- package/dist/packem_shared/Separator-PSjfhX_W.js +1 -0
- package/dist/packem_shared/Skeleton-BAFrGUR1.js +1 -0
- package/dist/packem_shared/Switch-Wpsp5M3p.js +1 -0
- package/dist/packem_shared/Tabs-BdNFQd3c.js +1 -0
- package/dist/packem_shared/Textarea-DP9gpte-.js +1 -0
- package/dist/packem_shared/Tooltip-DVeuszoY.js +1 -0
- package/dist/packem_shared/annotation-settings-DlLZO5Zp.js +1 -0
- package/dist/packem_shared/annotation-store-CXMIg0dM.js +1 -0
- package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
- package/dist/packem_shared/clsx-CtZWcPHt.js +1 -0
- package/dist/packem_shared/createClientRPCContext-80V9c3Qu.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-CzejbqD2.js +1 -0
- package/dist/packem_shared/createServerRPCContext-C30tqEfQ.js +1 -0
- package/dist/packem_shared/getGlobalHook-GRSqUNJ3.js +1 -0
- package/dist/packem_shared/getTimelineStore-BT5sImVb.js +1 -0
- package/dist/packem_shared/global-api.d-DeaCvII9.d.ts +546 -0
- package/dist/packem_shared/loadSettings-C0pUyx9j.js +1 -0
- package/dist/packem_shared/server.d-ZkcY0pge.d.ts +39 -0
- package/dist/packem_shared/sharedToolbarStylesheet-DNABzHAf.js +2 -0
- package/dist/packem_shared/store-Dqy0FbGw.js +1 -0
- package/dist/packem_shared/use-theme-DIqZkPAe.js +1 -0
- package/dist/toolbar/index.d.ts +152 -49
- package/dist/toolbar/index.js +3 -3
- package/dist/ui/index.d.ts +382 -17
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +183 -141
- package/dist/vite-plugin.js +5 -2
- package/package.json +41 -22
- package/dist/apps/a11y/a11y-app.d.ts +0 -5
- package/dist/apps/a11y/a11y-store.d.ts +0 -42
- package/dist/apps/a11y/a11y-tooltip.d.ts +0 -11
- package/dist/apps/inspector/inspector-app.d.ts +0 -12
- package/dist/apps/module-graph/module-graph-app.d.ts +0 -5
- package/dist/apps/more/index.d.ts +0 -3
- package/dist/apps/more/index.js +0 -2
- package/dist/apps/more/more-app.d.ts +0 -5
- package/dist/apps/performance/performance-app.d.ts +0 -5
- package/dist/apps/performance/performance-tooltip.d.ts +0 -5
- package/dist/apps/seo/seo-app.d.ts +0 -5
- package/dist/apps/settings/settings-app.d.ts +0 -4
- package/dist/apps/tailwind/tailwind-app.d.ts +0 -5
- package/dist/apps/timeline/timeline-app.d.ts +0 -5
- package/dist/apps/vite-config/vite-config-app.d.ts +0 -5
- package/dist/hooks/create-hook.d.ts +0 -12
- package/dist/hooks/events.d.ts +0 -7
- package/dist/hooks/global-hook.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -6
- package/dist/packem_shared/Alert-H-x1JuZ0.js +0 -1
- package/dist/packem_shared/Badge-C30mDKKG.js +0 -1
- package/dist/packem_shared/Button-DODNCTPZ.js +0 -1
- package/dist/packem_shared/Card-DdI7Wn3t.js +0 -1
- package/dist/packem_shared/Icon-DWFLZkwW.js +0 -1
- package/dist/packem_shared/Input-GfbOwAkK.js +0 -1
- package/dist/packem_shared/Label-Bzi47aUf.js +0 -1
- package/dist/packem_shared/Popover-CLt7YhUF.js +0 -1
- package/dist/packem_shared/Progress-vGfFpxRn.js +0 -1
- package/dist/packem_shared/Separator-DQGeJPQg.js +0 -1
- package/dist/packem_shared/Skeleton-BYXau6jM.js +0 -1
- package/dist/packem_shared/Switch-BeC78S_T.js +0 -1
- package/dist/packem_shared/Tabs-CXERaeAp.js +0 -1
- package/dist/packem_shared/Textarea-DvbSX13V.js +0 -1
- package/dist/packem_shared/Tooltip-tlBN-NdK.js +0 -1
- package/dist/packem_shared/cn-DWLJYh3h.js +0 -1
- package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +0 -1
- package/dist/packem_shared/createServerRPCContext-CEm1Ymkn.js +0 -1
- package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +0 -1
- package/dist/packem_shared/loadSettings-hvjR4fcS.js +0 -1
- package/dist/packem_shared/setupGlobalHook-CCf9Logv.js +0 -1
- package/dist/packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js +0 -2
- package/dist/packem_shared/store-DaUtLjf3.js +0 -1
- package/dist/packem_shared/use-theme-BOw3dPpY.js +0 -1
- package/dist/performance/monitor.d.ts +0 -116
- package/dist/rpc/client.d.ts +0 -9
- package/dist/rpc/functions/module-graph.d.ts +0 -17
- package/dist/rpc/functions/open-in-editor.d.ts +0 -16
- package/dist/rpc/functions/tailwind-config.d.ts +0 -15
- package/dist/rpc/functions/vite-config.d.ts +0 -9
- package/dist/rpc/server.d.ts +0 -15
- package/dist/timeline/capture.d.ts +0 -8
- package/dist/timeline/index.d.ts +0 -8
- package/dist/timeline/store.d.ts +0 -42
- package/dist/toolbar/app-manager.d.ts +0 -104
- package/dist/toolbar/components/app-button.d.ts +0 -19
- package/dist/toolbar/components/app-canvas.d.ts +0 -12
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -12
- package/dist/toolbar/components/first-visit-hint.d.ts +0 -16
- package/dist/toolbar/components/index.d.ts +0 -4
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -22
- package/dist/toolbar/components/toolbar-bar.d.ts +0 -14
- package/dist/toolbar/components/toolbar-container.d.ts +0 -55
- package/dist/toolbar/components/vite-overlay-button.d.ts +0 -14
- package/dist/toolbar/context/index.d.ts +0 -2
- package/dist/toolbar/context/toolbar-context.d.ts +0 -107
- package/dist/toolbar/global-api.d.ts +0 -24
- package/dist/toolbar/helpers.d.ts +0 -8
- package/dist/toolbar/hooks/index.d.ts +0 -10
- package/dist/toolbar/hooks/use-apps.d.ts +0 -15
- package/dist/toolbar/hooks/use-frame-state.d.ts +0 -100
- package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -23
- package/dist/toolbar/hooks/use-position.d.ts +0 -24
- package/dist/toolbar/hooks/use-theme.d.ts +0 -15
- package/dist/toolbar/hooks/use-toolbar.d.ts +0 -16
- package/dist/toolbar/settings.d.ts +0 -17
- package/dist/toolbar/stylesheet.d.ts +0 -3
- package/dist/toolbar/utils/index.d.ts +0 -12
- package/dist/types/app.d.ts +0 -175
- package/dist/types/global-api.d.ts +0 -91
- package/dist/types/hooks.d.ts +0 -86
- package/dist/types/index.d.ts +0 -12
- package/dist/types/messaging.d.ts +0 -43
- package/dist/types/rpc.d.ts +0 -97
- package/dist/types/timeline.d.ts +0 -62
- package/dist/types/toolbar.d.ts +0 -56
- package/dist/ui/components/alert.d.ts +0 -20
- package/dist/ui/components/badge.d.ts +0 -10
- package/dist/ui/components/button.d.ts +0 -12
- package/dist/ui/components/card.d.ts +0 -17
- package/dist/ui/components/icon.d.ts +0 -20
- package/dist/ui/components/input.d.ts +0 -8
- package/dist/ui/components/label.d.ts +0 -8
- package/dist/ui/components/popover.d.ts +0 -27
- package/dist/ui/components/progress.d.ts +0 -8
- package/dist/ui/components/separator.d.ts +0 -9
- package/dist/ui/components/skeleton.d.ts +0 -7
- package/dist/ui/components/switch.d.ts +0 -12
- package/dist/ui/components/tabs.d.ts +0 -29
- package/dist/ui/components/textarea.d.ts +0 -8
- package/dist/ui/components/tooltip.d.ts +0 -19
- package/dist/utils/cn.d.ts +0 -8
- package/dist/vite/inject-source.d.ts +0 -24
- package/dist/vite/matcher.d.ts +0 -6
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { ComponentType } from 'preact';
|
|
2
|
+
/**
|
|
3
|
+
* Toolbar placement options (for backward compatibility)
|
|
4
|
+
*/
|
|
5
|
+
type ToolbarPlacement = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
6
|
+
/**
|
|
7
|
+
* Notification levels
|
|
8
|
+
*/
|
|
9
|
+
type NotificationLevel = "info" | "warning" | "error";
|
|
10
|
+
/**
|
|
11
|
+
* Position anchor (which edge the toolbar is attached to)
|
|
12
|
+
* Matches Vue DevTools positioning
|
|
13
|
+
*/
|
|
14
|
+
type PositionAnchor = "top" | "bottom" | "left" | "right";
|
|
15
|
+
/**
|
|
16
|
+
* Frame state - matches Vue DevTools DevToolsFrameState
|
|
17
|
+
* @see https://github.com/vuejs/devtools/blob/main/packages/overlay/src/composables/state.ts
|
|
18
|
+
*/
|
|
19
|
+
interface FrameState {
|
|
20
|
+
/**
|
|
21
|
+
* Horizontal position as percentage (0-100)
|
|
22
|
+
*/
|
|
23
|
+
left: number;
|
|
24
|
+
/**
|
|
25
|
+
* Whether panel is open
|
|
26
|
+
*/
|
|
27
|
+
open: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Which edge the toolbar is anchored to
|
|
30
|
+
*/
|
|
31
|
+
position: PositionAnchor;
|
|
32
|
+
/**
|
|
33
|
+
* Vertical position as percentage (0-100)
|
|
34
|
+
*/
|
|
35
|
+
top: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Configuration options controlling the toolbar's initial appearance.
|
|
39
|
+
*/
|
|
40
|
+
interface ToolbarSettings {
|
|
41
|
+
/**
|
|
42
|
+
* Whether toolbar is visible by default
|
|
43
|
+
*/
|
|
44
|
+
defaultVisible: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Toolbar placement on screen
|
|
47
|
+
*/
|
|
48
|
+
placement: ToolbarPlacement;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to show notifications
|
|
51
|
+
*/
|
|
52
|
+
showNotifications: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Default toolbar settings
|
|
56
|
+
*/
|
|
57
|
+
declare const DEFAULT_TOOLBAR_SETTINGS: ToolbarSettings;
|
|
58
|
+
/**
|
|
59
|
+
* Server helpers available to apps
|
|
60
|
+
*/
|
|
61
|
+
interface ServerHelpers {
|
|
62
|
+
/**
|
|
63
|
+
* RPC client for calling server functions
|
|
64
|
+
*/
|
|
65
|
+
rpc: { [K in keyof ServerFunctions]: ServerFunctions[K] };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Props passed to app tooltip (hover mini-canvas) components.
|
|
69
|
+
* Keep compact — tooltip components should be lightweight.
|
|
70
|
+
*/
|
|
71
|
+
interface AppTooltipProps {
|
|
72
|
+
/**
|
|
73
|
+
* Server helpers (RPC, etc.)
|
|
74
|
+
*/
|
|
75
|
+
helpers: ServerHelpers;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Event target for app communication
|
|
79
|
+
*/
|
|
80
|
+
interface ToolbarAppEventTarget extends EventTarget {
|
|
81
|
+
/**
|
|
82
|
+
* Dispatch a custom event
|
|
83
|
+
*/
|
|
84
|
+
dispatchEvent: (event: Event) => boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* App view configuration
|
|
88
|
+
*/
|
|
89
|
+
type AppView = {
|
|
90
|
+
/**
|
|
91
|
+
* Render app inline in shadow DOM (default)
|
|
92
|
+
*/
|
|
93
|
+
type: "inline";
|
|
94
|
+
} | {
|
|
95
|
+
/**
|
|
96
|
+
* URL to load in iframe
|
|
97
|
+
*/
|
|
98
|
+
src: string;
|
|
99
|
+
/**
|
|
100
|
+
* Render app in iframe for isolation
|
|
101
|
+
*/
|
|
102
|
+
type: "iframe";
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Props passed to Preact component apps
|
|
106
|
+
*/
|
|
107
|
+
interface AppComponentProps {
|
|
108
|
+
/**
|
|
109
|
+
* Event target for app communication
|
|
110
|
+
*/
|
|
111
|
+
eventTarget: ToolbarAppEventTarget;
|
|
112
|
+
/**
|
|
113
|
+
* Server helpers (RPC, etc.)
|
|
114
|
+
*/
|
|
115
|
+
helpers: ServerHelpers;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Dev toolbar app definition
|
|
119
|
+
*/
|
|
120
|
+
interface DevToolbarApp {
|
|
121
|
+
/**
|
|
122
|
+
* Called before app is toggled off
|
|
123
|
+
* Return false to prevent closing
|
|
124
|
+
* @param canvas Shadow root of the app
|
|
125
|
+
* @returns Whether to allow closing
|
|
126
|
+
*/
|
|
127
|
+
beforeTogglingOff?: (canvas: ShadowRoot) => boolean | Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Preact component for rendering (alternative to init)
|
|
130
|
+
* If provided, this will be used instead of init
|
|
131
|
+
*/
|
|
132
|
+
component?: ComponentType<AppComponentProps>;
|
|
133
|
+
/**
|
|
134
|
+
* When true, this app is automatically activated when the toolbar opens for
|
|
135
|
+
* the first time (or when no other app has been activated yet).
|
|
136
|
+
* Only the first registered app with defaultOpen: true is used.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
defaultOpen?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Called when the app is unregistered / removed from the toolbar.
|
|
142
|
+
* Use this for final cleanup (event listeners, timers, subscriptions).
|
|
143
|
+
* @param canvas Shadow root of the app
|
|
144
|
+
*/
|
|
145
|
+
destroy?: (canvas: ShadowRoot) => Promise<void> | void;
|
|
146
|
+
/**
|
|
147
|
+
* Icon HTML string (SVG)
|
|
148
|
+
*/
|
|
149
|
+
icon: string;
|
|
150
|
+
/**
|
|
151
|
+
* Unique identifier for the app
|
|
152
|
+
*/
|
|
153
|
+
id: string;
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the app when opened (vanilla JS/CSS/HTML)
|
|
156
|
+
* @param canvas Shadow root to render into
|
|
157
|
+
* @param eventTarget Event target for app communication
|
|
158
|
+
* @param helpers Server helpers (RPC, etc.)
|
|
159
|
+
*/
|
|
160
|
+
init?: (canvas: ShadowRoot, eventTarget: ToolbarAppEventTarget, helpers: ServerHelpers) => void | Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Display name of the app
|
|
163
|
+
*/
|
|
164
|
+
name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Action button callback — called when the button is activated (active: false → true).
|
|
167
|
+
* When present, clicking the toolbar button will NOT open a panel.
|
|
168
|
+
* Instead the button toggles its active state and calls onClick (activate)
|
|
169
|
+
* or onDeactivate (deactivate).
|
|
170
|
+
*/
|
|
171
|
+
onClick?: () => Promise<void> | void;
|
|
172
|
+
/**
|
|
173
|
+
* Called when the action button is deactivated (active: true → false).
|
|
174
|
+
* Only meaningful when onClick is also provided.
|
|
175
|
+
*/
|
|
176
|
+
onDeactivate?: () => Promise<void> | void;
|
|
177
|
+
/**
|
|
178
|
+
* Optional hover tooltip component — renders a compact live preview when the
|
|
179
|
+
* user hovers over this app's button in the toolbar pill.
|
|
180
|
+
* The component should be small (≤280px wide) and self-contained.
|
|
181
|
+
* If omitted, hovering shows the native title tooltip only.
|
|
182
|
+
*/
|
|
183
|
+
tooltip?: ComponentType<AppTooltipProps>;
|
|
184
|
+
/**
|
|
185
|
+
* App rendering mode
|
|
186
|
+
*/
|
|
187
|
+
view?: AppView;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Internal app state (extends DevToolbarApp)
|
|
191
|
+
*/
|
|
192
|
+
interface DevToolbarAppState extends DevToolbarApp {
|
|
193
|
+
/**
|
|
194
|
+
* Whether the app is currently active/open
|
|
195
|
+
*/
|
|
196
|
+
active: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Whether this is a built-in app
|
|
199
|
+
*/
|
|
200
|
+
builtIn: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Event target for this app
|
|
203
|
+
*/
|
|
204
|
+
eventTarget: ToolbarAppEventTarget;
|
|
205
|
+
/**
|
|
206
|
+
* Notification state
|
|
207
|
+
*/
|
|
208
|
+
notification: {
|
|
209
|
+
/**
|
|
210
|
+
* Notification level
|
|
211
|
+
*/
|
|
212
|
+
level?: NotificationLevel;
|
|
213
|
+
/**
|
|
214
|
+
* Whether notification is active
|
|
215
|
+
*/
|
|
216
|
+
state: boolean;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* App initialization status
|
|
220
|
+
*/
|
|
221
|
+
status: "ready" | "loading" | "pending" | "error";
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Placeholder for ServerFunctions (defined in rpc.ts)
|
|
225
|
+
*/
|
|
226
|
+
interface ServerFunctions {
|
|
227
|
+
[key: string]: (...args: any[]) => Promise<any>;
|
|
228
|
+
}
|
|
229
|
+
export { AppView as A, DevToolbarApp as D, FrameState as F, NotificationLevel as N, PositionAnchor as P, ServerFunctions as S, ToolbarSettings as T, DevToolbarAppState as a, DEFAULT_TOOLBAR_SETTINGS as b, ServerHelpers as c, ToolbarAppEventTarget as d, ToolbarPlacement as e };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(e){var f,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(f=0;f<a;f++)e[f]&&(t=o(e[f]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function r(){for(var e,f,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(f=o(e))&&(n&&(n+=" "),n+=f);return n}export{r as clsx,r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=l=>{const i={onConfigChange:()=>{},onHMRUpdate:()=>{},onModuleUpdate:()=>{},...l},t=new Map;return globalThis.window!==void 0&&import.meta.hot&&(import.meta.hot.on("dev-toolbar:rpc:response",e=>{const o=t.get(e.id);o&&(t.delete(e.id),o.resolve(e.result))}),import.meta.hot.on("dev-toolbar:rpc:error",e=>{const o=t.get(e.id);o&&(t.delete(e.id),o.reject(new Error(e.error)))}),import.meta.hot.on("dev-toolbar:client",e=>{const{args:o,method:r}=e,n=i[r];if(n)try{n(...o)}catch(a){console.error(`[dev-toolbar] Error calling client function ${r}:`,a)}})),{async callServer(e,...o){if(globalThis.window===void 0||!import.meta.hot)throw new Error("RPC calls can only be made in browser environment with HMR");const r=`${Date.now()}-${Math.random().toString(36).slice(7)}`;return new Promise((n,a)=>{t.set(r,{reject:a,resolve:n}),setTimeout(()=>{t.has(r)&&(t.delete(r),a(new Error(`RPC call timeout: ${e}`)))},3e4),import.meta.hot.send("dev-toolbar:rpc",{args:o,id:r,method:e})})},registerFunction(e,o){i[e]=o}}};export{s as createClientRPCContext,s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=(s,i)=>{const n=new Map;return{addTimelineEvent(e,o){i&&i(e,o),this.emit("timeline:event",o)},emit(e,...o){const t=n.get(e);if(t)for(const r of t)try{r(...o)}catch(d){console.error(`[dev-toolbar] Error in hook handler for ${String(e)}:`,d)}},off(e,o){const t=n.get(e);t&&(o?(t.delete(o),t.size===0&&n.delete(e)):n.delete(e))},on(e,o){return n.has(e)||n.set(e,new Set),n.get(e).add(o),()=>{const t=n.get(e);t&&(t.delete(o),t.size===0&&n.delete(e))}},once(e,o){const t=((...r)=>{o(...r),this.off(e,t)});this.on(e,t)},registerApp(e){s&&s(e)}}};export{a as createDevToolbarHook,a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as k}from"node:module";import{w as b,r as h,c as p,d as P,M as S,b as x,e as R,a as F,s as _,i as v,S as T,f as j}from"./annotation-store-CXMIg0dM.js";import{normalizePath as A}from"vite";const O=k(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,t]=f.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return f.getBuiltinModule(r)}return O(r)},m=w("node:fs/promises"),u=w("node:path"),{createRequire:z}=w("node:module"),B=async r=>h(r.config.root),L=async(r,e)=>b(async()=>{const{root:t}=r.config,s=new Date().toISOString(),o=await h(t);if(o.length>=j)throw new Error(`Annotation limit reached (${j}). Resolve or delete existing annotations before creating new ones.`);const n={accessibility:e.accessibility,boundingBox:e.boundingBox,comment:p(e.comment),computedStyles:p(e.computedStyles),createdAt:s,cssClasses:p(e.cssClasses),elementBoundingBoxes:e.elementBoundingBoxes,elementLabel:p(e.elementLabel),elementPath:p(e.elementPath),elementTag:e.elementTag,frameworkContext:e.frameworkContext,fullPath:p(e.fullPath),id:crypto.randomUUID(),intent:e.intent,isFixed:e.isFixed,isMultiSelect:e.isMultiSelect,nearbyElements:p(e.nearbyElements),nearbyText:p(e.nearbyText),screenshot:e.screenshot,selectedText:p(e.selectedText),severity:e.severity,source:e.source,status:"pending",updatedAt:s,url:e.url,x:e.x,y:e.y};return o.push(n),await x(t,o),n}),W=async(r,e,t)=>b(async()=>{const{root:s}=r.config,o=await h(s),n=o.findIndex(c=>c.id===e);if(n===-1)return null;const i=o[n],a=new Date().toISOString();if(t.comment!==void 0&&(i.comment=p(t.comment)),t.intent!==void 0&&(i.intent=t.intent),t.severity!==void 0&&(i.severity=t.severity),t.status!==void 0&&(i.status=t.status,(t.status==="resolved"||t.status==="dismissed")&&(i.resolvedBy=t.resolvedBy??"human",i.resolvedAt=a,i.screenshot&&(await P(s,i.screenshot),i.screenshot=void 0))),t.threadMessage){if(i.thread||(i.thread=[]),i.thread.length>=S)throw new Error(`Thread message limit reached (${S}) for this annotation.`);i.thread.push({...t.threadMessage,content:p(t.threadMessage.content),id:crypto.randomUUID(),timestamp:a})}return i.updatedAt=a,o[n]=i,await x(s,o),i}),U=async(r,e)=>b(async()=>{const{root:t}=r.config,s=await h(t),o=s.findIndex(i=>i.id===e);if(o===-1)return!1;const n=s[o];return n.screenshot&&await P(t,n.screenshot),s.splice(o,1),await x(t,s),!0}),q=async(r,e,t)=>{const{root:s}=r.config;await R(s);const{base:o,screenshotsDir:n}=F(s),i=_(e);if(!i)throw new Error("Invalid annotation ID");let a,c;if(t.startsWith("data:image/png;base64,"))a="png",c=Buffer.from(t.slice(22),"base64");else if(t.startsWith("data:image/jpeg;base64,"))a="jpg",c=Buffer.from(t.slice(23),"base64");else if(t.startsWith("data:image/webp;base64,"))a="webp",c=Buffer.from(t.slice(23),"base64");else throw new Error("Unsupported screenshot format. Expected PNG, JPEG, or WebP data URL.");const l=`${i}.${a}`,d=u.join(n,l);if(!v(d,o))throw new Error("Invalid screenshot path");return await m.writeFile(d,c),`${T}/${l}`},G=async(r,e)=>{const{root:t}=r.config,s=(await h(t)).find(i=>i.id===e);if(!s?.screenshot||!s.screenshot.startsWith(`${T}/`))return null;const{base:o}=F(t),n=u.join(o,s.screenshot);if(!v(n,o))return null;try{const i=await m.readFile(n),a=u.extname(n).slice(1);return a==="svg"?`data:image/svg+xml,${encodeURIComponent(i.toString("utf8"))}`:`data:${a==="jpg"?"image/jpeg":`image/${a}`};base64,${i.toString("base64")}`}catch{return null}},N=new Set(["apng","avif","bmp","gif","ico","jpeg","jpg","png","svg","tiff","webp"]),H=new Set(["avi","mkv","mov","mp4","ogv","webm"]),X=new Set(["aac","flac","m4a","mp3","ogg","opus","wav"]),J=new Set(["eot","otf","ttf","woff","woff2"]),V=new Set(["css","csv","html","js","json","md","txt","xml"]),g=5e3,D=r=>{const e=r.toLowerCase();return N.has(e)?"image":H.has(e)?"video":X.has(e)?"audio":J.has(e)?"font":V.has(e)?"text":"other"},K=r=>{let e=0;const t=[];return{acquire:()=>new Promise(s=>{e<r?(e+=1,s()):t.push(()=>{e+=1,s()})}),release:()=>{e-=1,t.shift()?.()}}},I=async(r,e,t,s)=>{if(s.length>=g)return;let o;await t.acquire();try{o=await m.readdir(r,{withFileTypes:!0})}catch{return}finally{t.release()}await Promise.all(o.map(async n=>{if(s.length>=g)return;const i=u.join(r,n.name);if(n.isDirectory())await I(i,e,t,s);else if(n.isFile()||n.isSymbolicLink()){await t.acquire();try{const a=await m.lstat(i);if(a.isSymbolicLink()){let c;try{c=await m.realpath(i)}catch{return}if(!c.startsWith(e+u.sep)&&c!==e)return;const l=await m.stat(i),d=u.relative(e,i),M=`/${A(d)}`,$=u.extname(n.name).slice(1);s.length<g&&s.push({mtime:l.mtimeMs,publicPath:M,size:l.size,type:D($)})}else if(a.isFile()){const c=u.relative(e,i),l=`/${A(c)}`,d=u.extname(n.name).slice(1);s.length<g&&s.push({mtime:a.mtimeMs,publicPath:l,size:a.size,type:D(d)})}}catch{}finally{t.release()}}}))},Q=async r=>{const{publicDir:e}=r.config;if(!e)return[];let t;try{t=await m.realpath(e)}catch{return[]}const s=[],o=K(20);return await I(t,t,o,s),s.sort((n,i)=>n.publicPath.localeCompare(i.publicPath)),s},Y=async r=>{const{moduleGraph:e}=r,t=[];for(const s of e.idToModuleMap.values()){if(t.length>=5e3)break;const o=s.id??s.url,n=s.url??s.id;if(!o||!n||o.startsWith("/@"))continue;const i=[];s.importers.forEach(a=>{const c=a.url??a.id;c&&i.push(c)}),t.push({id:o,importerCount:s.importers.size,importerUrls:i,url:n})}return t},Z=async(r,e,t,s,o)=>{const n=u.resolve(r.config.root,e);if(!v(n,r.config.root))throw new Error(`Refusing to open file outside project root: ${e}`);const i=s===void 0?"":`:${s}`,a=t===void 0?"":`:${t}${i}`,c=`${n}${a}`,{default:l}=await import("launch-editor");l(c,o)},ee=/\/\*[\s\S]*?\*\//g,te=/\s+/g,E=/@theme\s+default[^{]*\{[\s\S]*?\}/g,y=/(--[\w-]+)\s*:\s*([\s\S]*?);/g,C=r=>{const e={},t=r.replaceAll(ee,"");let s=0;for(;s<t.length;){const o=t.indexOf("@theme",s);if(o===-1)break;const n=t.indexOf("{",o);if(n===-1)break;let i=1,a=n+1;for(;a<t.length&&i>0;)t[a]==="{"?i+=1:t[a]==="}"&&(i-=1),a+=1;const c=t.slice(n+1,a-1);y.lastIndex=0;let l=y.exec(c);for(;l!==null;){const d=l[2].replaceAll(te," ").trim();d&&!e[l[1]]&&(e[l[1]]=d),l=y.exec(c)}s=a}return e},se=async r=>{const e=[],t=async(s,o)=>{if(o>4)return;let n;try{n=await m.readdir(s,{encoding:"utf8",withFileTypes:!0})}catch{return}for(const i of n){const a=u.join(s,i.name);if(i.isDirectory()){if(i.name==="node_modules"||i.name===".git"||i.name==="dist")continue;await t(a,o+1)}else if(i.name.endsWith(".css"))try{const c=await m.readFile(a,"utf8");c.includes("@import")&&(c.includes('"tailwindcss"')||c.includes("'tailwindcss'"))&&e.push(a)}catch{}}};return await t(r,0),e},re=async r=>{const e={};for(const t of r)try{const s=await m.readFile(t,"utf8");E.lastIndex=0;const o=s.replaceAll(E,""),n=C(o);Object.assign(e,n)}catch{}return e},ne=async r=>{const{root:e}=r.config;let t="unknown",s={};const o=["tailwind.config.js","tailwind.config.ts","tailwind.config.mjs","tailwind.config.cjs"];for(const a of o)try{await m.access(u.join(e,a)),t="v3";break}catch{}try{const a=z(import.meta.url).resolve("tailwindcss/theme.css"),c=await m.readFile(a,"utf8");s=C(c),Object.keys(s).length>0&&t!=="v3"&&(t="v4")}catch{}const n=await se(e),i=await re(n);return{cssFiles:n.map(a=>u.relative(e,a)),customTheme:i,defaultTheme:s,version:t}},ie=r=>{if(Array.isArray(r))return r.filter(e=>e!=null&&(e.find!==void 0||e.replacement!==void 0)).map(e=>({find:e.find instanceof RegExp?e.find.toString():String(e.find??""),replacement:String(e.replacement??"")}));if(r!=null&&typeof r=="object")return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,String(t)]))},oe=r=>{if(typeof r=="boolean"||Array.isArray(r))return r},ae=async r=>{const{config:e}=r,t=[];for(const l of e.plugins.filter(d=>!!d?.name))t.push({enforce:l?.enforce,name:l.name});const s=ie(e.resolve?.alias),o=e.server?.proxy?Object.keys(e.server.proxy):void 0,n=e.server?.hmr,i=n!==!1,a=typeof n=="object"&&n!==null?n.port:void 0,c=oe(e.ssr?.noExternal);return{base:e.base,build:{assetsDir:e.build?.assetsDir,assetsInlineLimit:typeof e.build?.assetsInlineLimit=="number"?e.build.assetsInlineLimit:void 0,chunkSizeWarningLimit:e.build?.chunkSizeWarningLimit,cssCodeSplit:e.build?.cssCodeSplit,emptyOutDir:e.build?.emptyOutDir,minify:e.build?.minify,outDir:e.build?.outDir,reportCompressedSize:e.build?.reportCompressedSize,sourcemap:e.build?.sourcemap,target:e.build?.target},cacheDir:e.cacheDir,css:{devSourcemap:e.css?.devSourcemap,preprocessors:e.css?.preprocessorOptions?Object.keys(e.css.preprocessorOptions):[]},define:e.define,env:e.env,envDir:typeof e.envDir=="string"?e.envDir:void 0,envPrefix:e.envPrefix,esbuild:e.esbuild?{jsx:e.esbuild.jsx,jsxFactory:e.esbuild.jsxFactory,jsxFragment:e.esbuild.jsxFragment,jsxImportSource:e.esbuild.jsxImportSource,target:e.esbuild.target}:void 0,mode:e.mode,optimizeDeps:{exclude:e.optimizeDeps?.exclude,include:e.optimizeDeps?.include},plugins:t,publicDir:e.publicDir,resolve:{alias:s,conditions:e.resolve?.conditions,dedupe:e.resolve?.dedupe,extensions:e.resolve?.extensions,mainFields:e.resolve?.mainFields,preserveSymlinks:e.resolve?.preserveSymlinks},root:e.root,server:{cors:e.server?.cors===void 0?void 0:!!e.server.cors,hmrEnabled:i,hmrPort:a,host:e.server?.host,https:e.server?.https!==void 0,middlewareMode:(()=>{if(e.server?.middlewareMode!==void 0)return typeof e.server.middlewareMode=="object"?!0:!!e.server.middlewareMode})(),open:e.server?.open,origin:e.server?.origin,port:e.server?.port,proxy:o,strictPort:e.server?.strictPort},ssr:e.ssr===void 0?void 0:{external:Array.isArray(e.ssr?.external)?e.ssr.external:void 0,noExternal:c,target:e.ssr?.target}}},ce=["astro","cjs","css","cts","html","js","json","jsx","less","md","mdx","mjs","mts","sass","scss","svelte","ts","tsx","txt","vue"],le=(r,e={})=>{const t={createAnnotation:async s=>L(r,s),deleteAnnotation:async s=>U(r,s),getAnnotations:async()=>B(r),getModuleGraph:async()=>Y(r),getScreenshot:async s=>G(r,s),getStaticAssets:async()=>Q(r),getTailwindConfig:async()=>ne(r),getViteConfig:async()=>ae(r),openInEditor:async(s,o,n)=>Z(r,s,o,n,e.editor),saveScreenshot:async(s,o)=>q(r,s,o),updateAnnotation:async(s,o)=>W(r,s,o)};if(e.readFile!==!1){const s=new Set((e.readFile?.extensions??ce).map(o=>o.toLowerCase().replace(/^\./,"")));t.readFile=async o=>{const{readFile:n}=await import("node:fs/promises"),{extname:i,resolve:a}=await import("node:path"),{root:c}=r.config,l=a(c,o);if(!v(l,c))throw new Error(`Refusing to read file outside project root: ${o}`);const d=i(l).slice(1).toLowerCase();if(!s.has(d))throw new Error(`Refusing to read file with disallowed extension ".${d}": ${o}`);return n(l,"utf8")}}return t},pe=(r,e,t={})=>{const s={...le(r,t),...e};return r.ws.on("dev-toolbar:rpc",async(o,n)=>{const{args:i,id:a,method:c}=o,l=s[c];if(!l){n.send("dev-toolbar:rpc:error",{error:`Unknown RPC method: ${c}`,id:a});return}try{const d=await l(...i);n.send("dev-toolbar:rpc:response",{id:a,result:d})}catch(d){n.send("dev-toolbar:rpc:error",{error:d instanceof Error?d.message:String(d),id:a})}}),{callClient(o,...n){r.ws.send({data:{args:n,method:o},event:"dev-toolbar:client",type:"custom"})},registerFunction(o,n){s[o]=n},server:r}};export{pe as createServerRPCContext,pe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createDevToolbarHook as O}from"./createDevToolbarHook-CzejbqD2.js";let o;const e=(_,l)=>o||(o=O(_,l),globalThis.window!==void 0&&(globalThis.__DEV_TOOLBAR_HOOK__=o),o),i=()=>{const _=globalThis;return globalThis.window!==void 0&&_.__DEV_TOOLBAR_HOOK__?_.__DEV_TOOLBAR_HOOK__:o};export{i as getGlobalHook,e as setupGlobalHook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,u as o}from"./store-Dqy0FbGw.js";export{i as TimelineStore,o as getTimelineStore};
|