@visulima/dev-toolbar 0.0.1 → 1.0.0-alpha.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/CHANGELOG.md +5 -0
- package/LICENSE.md +77 -0
- package/README.md +277 -29
- package/dist/apps/a11y/a11y-app.d.ts +5 -0
- package/dist/apps/a11y/a11y-store.d.ts +46 -0
- package/dist/apps/a11y/a11y-tooltip.d.ts +11 -0
- package/dist/apps/a11y/index.d.ts +3 -0
- package/dist/apps/a11y/index.js +21 -0
- package/dist/apps/module-graph/index.d.ts +3 -0
- package/dist/apps/module-graph/index.js +20 -0
- package/dist/apps/module-graph/module-graph-app.d.ts +5 -0
- package/dist/apps/more/index.d.ts +3 -0
- package/dist/apps/more/index.js +19 -0
- package/dist/apps/more/more-app.d.ts +5 -0
- package/dist/apps/performance/index.d.ts +3 -0
- package/dist/apps/performance/index.js +17 -0
- package/dist/apps/performance/performance-app.d.ts +5 -0
- package/dist/apps/performance/performance-tooltip.d.ts +5 -0
- package/dist/apps/seo/index.d.ts +3 -0
- package/dist/apps/seo/index.js +17 -0
- package/dist/apps/seo/seo-app.d.ts +5 -0
- package/dist/apps/settings/index.d.ts +3 -0
- package/dist/apps/settings/index.js +17 -0
- package/dist/apps/settings/settings-app.d.ts +5 -0
- package/dist/apps/timeline/index.d.ts +3 -0
- package/dist/apps/timeline/index.js +18 -0
- package/dist/apps/timeline/timeline-app.d.ts +5 -0
- package/dist/apps/vite-config/index.d.ts +3 -0
- package/dist/apps/vite-config/index.js +16 -0
- package/dist/apps/vite-config/vite-config-app.d.ts +5 -0
- package/dist/client/overlay.d.ts +1 -0
- package/dist/client/overlay.js +1 -0
- package/dist/hooks/create-hook.d.ts +10 -0
- package/dist/hooks/events.d.ts +5 -0
- package/dist/hooks/global-hook.d.ts +15 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/packem_shared/TimelineStore-BgBrirKd.js +1 -0
- package/dist/packem_shared/cn-BEsR6GkP.js +1 -0
- package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +1 -0
- package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +1 -0
- package/dist/packem_shared/icon-BUQ92HaT.js +1 -0
- package/dist/packem_shared/loadSettings-hvjR4fcS.js +1 -0
- package/dist/packem_shared/setupGlobalHook-CFuxsCyl.js +1 -0
- package/dist/packem_shared/store-BxE0w51s.js +1 -0
- package/dist/performance/monitor.d.ts +115 -0
- package/dist/rpc/client.d.ts +7 -0
- package/dist/rpc/functions/module-graph.d.ts +17 -0
- package/dist/rpc/functions/open-in-editor.d.ts +9 -0
- package/dist/rpc/functions/vite-config.d.ts +7 -0
- package/dist/rpc/index.d.ts +8 -0
- package/dist/rpc/server.d.ts +9 -0
- package/dist/timeline/index.d.ts +6 -0
- package/dist/timeline/store.d.ts +52 -0
- package/dist/toolbar/app-manager.d.ts +95 -0
- package/dist/toolbar/components/app-button.d.ts +19 -0
- package/dist/toolbar/components/app-canvas.d.ts +13 -0
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +13 -0
- package/dist/toolbar/components/first-visit-hint.d.ts +16 -0
- package/dist/toolbar/components/index.d.ts +4 -0
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +23 -0
- package/dist/toolbar/components/toolbar-bar.d.ts +15 -0
- package/dist/toolbar/components/toolbar-container.d.ts +55 -0
- package/dist/toolbar/components/vite-overlay-button.d.ts +15 -0
- package/dist/toolbar/context/index.d.ts +2 -0
- package/dist/toolbar/context/toolbar-context.d.ts +106 -0
- package/dist/toolbar/global-api.d.ts +23 -0
- package/dist/toolbar/helpers.d.ts +6 -0
- package/dist/toolbar/hooks/index.d.ts +10 -0
- package/dist/toolbar/hooks/use-apps.d.ts +13 -0
- package/dist/toolbar/hooks/use-frame-state.d.ts +94 -0
- package/dist/toolbar/hooks/use-panel-visible.d.ts +21 -0
- package/dist/toolbar/hooks/use-position.d.ts +22 -0
- package/dist/toolbar/hooks/use-theme.d.ts +13 -0
- package/dist/toolbar/hooks/use-toolbar.d.ts +14 -0
- package/dist/toolbar/index.d.ts +58 -0
- package/dist/toolbar/index.js +22 -0
- package/dist/toolbar/settings.d.ts +17 -0
- package/dist/toolbar/stylesheet.d.ts +1 -0
- package/dist/toolbar/utils/index.d.ts +12 -0
- package/dist/types/app.d.ts +163 -0
- package/dist/types/global-api.d.ts +95 -0
- package/dist/types/hooks.d.ts +88 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/messaging.d.ts +43 -0
- package/dist/types/rpc.d.ts +95 -0
- package/dist/types/timeline.d.ts +62 -0
- package/dist/types/toolbar.d.ts +56 -0
- package/dist/ui/components/icon.d.ts +21 -0
- package/dist/utils/cn.d.ts +8 -0
- package/dist/vite-plugin.d.ts +106 -0
- package/dist/vite-plugin.js +2 -0
- package/package.json +105 -7
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { DevToolbarApp } from "./app.d.ts";
|
|
2
|
+
import type { ToolbarSettings } from "./toolbar.d.ts";
|
|
3
|
+
import type { DevToolbarHook } from "./hooks.d.ts";
|
|
4
|
+
import type { ServerFunctions } from "./rpc.d.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Global DevTools API interface
|
|
7
|
+
* Exposed as window.__VISULIMA_DEVTOOLS__
|
|
8
|
+
*/
|
|
9
|
+
export interface VisulimaDevTools {
|
|
10
|
+
/**
|
|
11
|
+
* Clear notification for an app
|
|
12
|
+
* @param appId App ID
|
|
13
|
+
*/
|
|
14
|
+
clearNotification: (appId: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Close the currently active app
|
|
17
|
+
*/
|
|
18
|
+
closeApp: () => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the currently active app ID
|
|
21
|
+
* @returns Active app ID or null
|
|
22
|
+
*/
|
|
23
|
+
getActiveApp: () => string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Get all registered apps
|
|
26
|
+
* @returns Array of app definitions
|
|
27
|
+
*/
|
|
28
|
+
getApps: () => DevToolbarApp[];
|
|
29
|
+
/**
|
|
30
|
+
* Get current toolbar settings
|
|
31
|
+
* @returns Toolbar settings
|
|
32
|
+
*/
|
|
33
|
+
getSettings: () => ToolbarSettings;
|
|
34
|
+
/**
|
|
35
|
+
* Hide the toolbar
|
|
36
|
+
*/
|
|
37
|
+
hide: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Hook instance for event subscriptions
|
|
40
|
+
*/
|
|
41
|
+
hook: DevToolbarHook;
|
|
42
|
+
/**
|
|
43
|
+
* Show a notification for an app
|
|
44
|
+
* @param appId App ID
|
|
45
|
+
* @param level Notification level
|
|
46
|
+
*/
|
|
47
|
+
notify: (appId: string, level: "info" | "warning" | "error") => void;
|
|
48
|
+
/**
|
|
49
|
+
* Open an app
|
|
50
|
+
* @param appId App ID to open
|
|
51
|
+
*/
|
|
52
|
+
openApp: (appId: string) => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Register a custom app
|
|
55
|
+
* @param app App definition
|
|
56
|
+
*/
|
|
57
|
+
registerApp: (app: DevToolbarApp) => void;
|
|
58
|
+
/**
|
|
59
|
+
* RPC client for calling server functions
|
|
60
|
+
*/
|
|
61
|
+
rpc: ServerFunctions;
|
|
62
|
+
/**
|
|
63
|
+
* Show the toolbar
|
|
64
|
+
*/
|
|
65
|
+
show: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Toggle toolbar visibility
|
|
68
|
+
*/
|
|
69
|
+
toggle: () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Unregister an app
|
|
72
|
+
* @param appId App ID to unregister
|
|
73
|
+
*/
|
|
74
|
+
unregisterApp: (appId: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Update toolbar settings
|
|
77
|
+
* @param settings Partial settings to update
|
|
78
|
+
*/
|
|
79
|
+
updateSettings: (settings: Partial<ToolbarSettings>) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Package version
|
|
82
|
+
*/
|
|
83
|
+
version: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Global API declaration
|
|
87
|
+
*/
|
|
88
|
+
declare global {
|
|
89
|
+
interface Window {
|
|
90
|
+
/**
|
|
91
|
+
* Visulima DevTools global API
|
|
92
|
+
*/
|
|
93
|
+
__VISULIMA_DEVTOOLS__?: VisulimaDevTools;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { DevToolbarApp } from "./app.d.ts";
|
|
2
|
+
import type { TimelineEvent } from "./timeline.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Hook event definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface HookEvents {
|
|
7
|
+
/**
|
|
8
|
+
* Extension point for custom events
|
|
9
|
+
*/
|
|
10
|
+
[key: string]: (...args: any[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* App error occurred
|
|
13
|
+
* @param error Error object
|
|
14
|
+
* @param appId Optional app ID where error occurred
|
|
15
|
+
*/
|
|
16
|
+
"app:error": (error: Error, appId?: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* DevTools closed
|
|
19
|
+
*/
|
|
20
|
+
"devtools:close": () => void;
|
|
21
|
+
/**
|
|
22
|
+
* DevTools initialized
|
|
23
|
+
*/
|
|
24
|
+
"devtools:init": () => void;
|
|
25
|
+
/**
|
|
26
|
+
* DevTools opened
|
|
27
|
+
* @param appId ID of the opened app
|
|
28
|
+
*/
|
|
29
|
+
"devtools:open": (appId: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Timeline event added
|
|
32
|
+
* @param event Timeline event
|
|
33
|
+
*/
|
|
34
|
+
"timeline:event": (event: TimelineEvent) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Dev toolbar hook interface
|
|
38
|
+
* Exposed as window.__DEV_TOOLBAR_HOOK__
|
|
39
|
+
*/
|
|
40
|
+
export interface DevToolbarHook {
|
|
41
|
+
/**
|
|
42
|
+
* Add a timeline event
|
|
43
|
+
* @param groupId Timeline group ID
|
|
44
|
+
* @param event Timeline event
|
|
45
|
+
*/
|
|
46
|
+
addTimelineEvent: (groupId: string, event: TimelineEvent) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Emit an event
|
|
49
|
+
* @param event Event name
|
|
50
|
+
* @param args Event arguments
|
|
51
|
+
*/
|
|
52
|
+
emit: <T extends keyof HookEvents>(event: T, ...args: Parameters<HookEvents[T]>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Unsubscribe from an event
|
|
55
|
+
* @param event Event name
|
|
56
|
+
* @param handler Optional specific handler to remove
|
|
57
|
+
*/
|
|
58
|
+
off: <T extends keyof HookEvents>(event: T, handler?: HookEvents[T]) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Subscribe to an event
|
|
61
|
+
* @param event Event name
|
|
62
|
+
* @param handler Event handler
|
|
63
|
+
* @returns Unsubscribe function
|
|
64
|
+
*/
|
|
65
|
+
on: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Subscribe to an event once
|
|
68
|
+
* @param event Event name
|
|
69
|
+
* @param handler Event handler
|
|
70
|
+
*/
|
|
71
|
+
once: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Register a custom app
|
|
74
|
+
* @param app App definition
|
|
75
|
+
*/
|
|
76
|
+
registerApp: (app: DevToolbarApp) => void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Global hook declaration
|
|
80
|
+
*/
|
|
81
|
+
declare global {
|
|
82
|
+
interface Window {
|
|
83
|
+
/**
|
|
84
|
+
* Dev toolbar hook for library integrations
|
|
85
|
+
*/
|
|
86
|
+
__DEV_TOOLBAR_HOOK__?: DevToolbarHook;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public type exports
|
|
3
|
+
*/
|
|
4
|
+
export type { AppView, DevToolbarApp, DevToolbarAppState, ServerFunctions, ServerHelpers, ToolbarAppEventTarget } from "./app.d.ts";
|
|
5
|
+
export type { VisulimaDevTools } from "./global-api.d.ts";
|
|
6
|
+
export type { DevToolbarHook, HookEvents } from "./hooks.d.ts";
|
|
7
|
+
export type { ChannelFactory, MessageChannel, MessageChannelContext } from "./messaging.d.ts";
|
|
8
|
+
export type { ClientRPCContext, ClientFunctions as RPCClientFunctions, ServerFunctions as RPCServerFunctions, ServerRPCContext } from "./rpc.d.ts";
|
|
9
|
+
export type { TimelineEvent, TimelineEventLevel, TimelineGroup } from "./timeline.d.ts";
|
|
10
|
+
export { DEFAULT_TIMELINE_GROUPS } from "./timeline.d.ts";
|
|
11
|
+
export type { FrameState, NotificationLevel, PositionAnchor, ToolbarPlacement, ToolbarSettings } from "./toolbar.d.ts";
|
|
12
|
+
export { DEFAULT_TOOLBAR_SETTINGS } from "./toolbar.d.ts";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message channel interface for bidirectional communication
|
|
3
|
+
*/
|
|
4
|
+
export interface MessageChannel<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
5
|
+
/**
|
|
6
|
+
* Unsubscribe from an event
|
|
7
|
+
* @param event Event name
|
|
8
|
+
* @param handler Optional specific handler to remove
|
|
9
|
+
*/
|
|
10
|
+
off: <K extends keyof TEvents>(event: K, handler?: TEvents[K]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Subscribe to an event
|
|
13
|
+
* @param event Event name
|
|
14
|
+
* @param handler Event handler
|
|
15
|
+
* @returns Unsubscribe function
|
|
16
|
+
*/
|
|
17
|
+
on: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe to an event once
|
|
20
|
+
* @param event Event name
|
|
21
|
+
* @param handler Event handler
|
|
22
|
+
*/
|
|
23
|
+
once: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Send a message/event
|
|
26
|
+
* @param event Event name
|
|
27
|
+
* @param data Event data
|
|
28
|
+
*/
|
|
29
|
+
send: <K extends keyof TEvents>(event: K, ...args: Parameters<TEvents[K]>) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Channel factory function
|
|
33
|
+
*/
|
|
34
|
+
export type ChannelFactory<TEvents extends Record<string, (...args: any[]) => void>> = () => MessageChannel<TEvents>;
|
|
35
|
+
/**
|
|
36
|
+
* Message channel context
|
|
37
|
+
*/
|
|
38
|
+
export interface MessageChannelContext<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
39
|
+
/**
|
|
40
|
+
* Create a new channel instance
|
|
41
|
+
*/
|
|
42
|
+
createChannel: () => MessageChannel<TEvents>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ViteDevServer } from "vite";
|
|
2
|
+
import type { SerializableModuleNode } from "../rpc/functions/module-graph.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Server-side RPC functions
|
|
5
|
+
* These can be called from the client
|
|
6
|
+
*/
|
|
7
|
+
export interface ServerFunctions {
|
|
8
|
+
/**
|
|
9
|
+
* Extension point for custom server functions
|
|
10
|
+
*/
|
|
11
|
+
[key: string]: (...args: any[]) => Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Get module dependency graph
|
|
14
|
+
*/
|
|
15
|
+
getModuleGraph: () => Promise<SerializableModuleNode[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get Vite configuration
|
|
18
|
+
*/
|
|
19
|
+
getViteConfig: () => Promise<Record<string, any>>;
|
|
20
|
+
/**
|
|
21
|
+
* Open file in editor
|
|
22
|
+
* @param file File path
|
|
23
|
+
* @param line Line number (1-based)
|
|
24
|
+
* @param column Column number (1-based)
|
|
25
|
+
*/
|
|
26
|
+
openInEditor: (file: string, line?: number, column?: number) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Read file contents
|
|
29
|
+
* @param path File path
|
|
30
|
+
*/
|
|
31
|
+
readFile: (path: string) => Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Client-side RPC functions
|
|
35
|
+
* These can be called from the server
|
|
36
|
+
*/
|
|
37
|
+
export interface ClientFunctions {
|
|
38
|
+
/**
|
|
39
|
+
* Extension point for custom client functions
|
|
40
|
+
*/
|
|
41
|
+
[key: string]: (...args: any[]) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Notify client of config change
|
|
44
|
+
* @param config New Vite config
|
|
45
|
+
*/
|
|
46
|
+
onConfigChange: (config: Record<string, any>) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Notify client of HMR update
|
|
49
|
+
* @param payload HMR payload
|
|
50
|
+
*/
|
|
51
|
+
onHMRUpdate: (payload: any) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Notify client of module update
|
|
54
|
+
* @param module Updated module node
|
|
55
|
+
*/
|
|
56
|
+
onModuleUpdate: (module: SerializableModuleNode) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* RPC context for server-side
|
|
60
|
+
*/
|
|
61
|
+
export interface ServerRPCContext {
|
|
62
|
+
/**
|
|
63
|
+
* Call a client function
|
|
64
|
+
* @param name Function name
|
|
65
|
+
* @param args Function arguments
|
|
66
|
+
*/
|
|
67
|
+
callClient: <K extends keyof ClientFunctions>(name: K, ...args: Parameters<ClientFunctions[K]>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Register a server function
|
|
70
|
+
* @param name Function name
|
|
71
|
+
* @param fn Function implementation
|
|
72
|
+
*/
|
|
73
|
+
registerFunction: <K extends keyof ServerFunctions>(name: K, function_: ServerFunctions[K]) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Vite dev server instance
|
|
76
|
+
*/
|
|
77
|
+
server: ViteDevServer;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* RPC context for client-side
|
|
81
|
+
*/
|
|
82
|
+
export interface ClientRPCContext {
|
|
83
|
+
/**
|
|
84
|
+
* Call a server function
|
|
85
|
+
* @param name Function name
|
|
86
|
+
* @param args Function arguments
|
|
87
|
+
*/
|
|
88
|
+
callServer: <K extends keyof ServerFunctions>(name: K, ...args: Parameters<ServerFunctions[K]>) => Promise<ReturnType<ServerFunctions[K]>>;
|
|
89
|
+
/**
|
|
90
|
+
* Register a client function
|
|
91
|
+
* @param name Function name
|
|
92
|
+
* @param fn Function implementation
|
|
93
|
+
*/
|
|
94
|
+
registerFunction: <K extends keyof ClientFunctions>(name: K, function_: ClientFunctions[K]) => void;
|
|
95
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline event level
|
|
3
|
+
*/
|
|
4
|
+
export type TimelineEventLevel = "info" | "warning" | "error";
|
|
5
|
+
/**
|
|
6
|
+
* Timeline event
|
|
7
|
+
*/
|
|
8
|
+
export interface TimelineEvent {
|
|
9
|
+
/**
|
|
10
|
+
* Optional event data
|
|
11
|
+
*/
|
|
12
|
+
data?: Record<string, any>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional duration (milliseconds)
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Unique event ID
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* Event level
|
|
23
|
+
*/
|
|
24
|
+
level?: TimelineEventLevel;
|
|
25
|
+
/**
|
|
26
|
+
* Optional subtitle
|
|
27
|
+
*/
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Timestamp (milliseconds since epoch)
|
|
31
|
+
*/
|
|
32
|
+
time: number;
|
|
33
|
+
/**
|
|
34
|
+
* Event title
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Timeline group
|
|
40
|
+
*/
|
|
41
|
+
export interface TimelineGroup {
|
|
42
|
+
/**
|
|
43
|
+
* Group color (hex or CSS color)
|
|
44
|
+
*/
|
|
45
|
+
color?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Events in this group
|
|
48
|
+
*/
|
|
49
|
+
events: TimelineEvent[];
|
|
50
|
+
/**
|
|
51
|
+
* Group ID
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
/**
|
|
55
|
+
* Group label
|
|
56
|
+
*/
|
|
57
|
+
label: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Default timeline groups
|
|
61
|
+
*/
|
|
62
|
+
export declare const DEFAULT_TIMELINE_GROUPS: ReadonlyArray<TimelineGroup>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar placement options (for backward compatibility)
|
|
3
|
+
*/
|
|
4
|
+
export type ToolbarPlacement = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
5
|
+
/**
|
|
6
|
+
* Notification levels
|
|
7
|
+
*/
|
|
8
|
+
export type NotificationLevel = "info" | "warning" | "error";
|
|
9
|
+
/**
|
|
10
|
+
* Position anchor (which edge the toolbar is attached to)
|
|
11
|
+
* Matches Vue DevTools positioning
|
|
12
|
+
*/
|
|
13
|
+
export type PositionAnchor = "top" | "bottom" | "left" | "right";
|
|
14
|
+
/**
|
|
15
|
+
* Frame state - matches Vue DevTools DevToolsFrameState
|
|
16
|
+
* @see https://github.com/vuejs/devtools/blob/main/packages/overlay/src/composables/state.ts
|
|
17
|
+
*/
|
|
18
|
+
export interface FrameState {
|
|
19
|
+
/**
|
|
20
|
+
* Horizontal position as percentage (0-100)
|
|
21
|
+
*/
|
|
22
|
+
left: number;
|
|
23
|
+
/**
|
|
24
|
+
* Whether panel is open
|
|
25
|
+
*/
|
|
26
|
+
open: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Which edge the toolbar is anchored to
|
|
29
|
+
*/
|
|
30
|
+
position: PositionAnchor;
|
|
31
|
+
/**
|
|
32
|
+
* Vertical position as percentage (0-100)
|
|
33
|
+
*/
|
|
34
|
+
top: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Toolbar settings
|
|
38
|
+
*/
|
|
39
|
+
export interface ToolbarSettings {
|
|
40
|
+
/**
|
|
41
|
+
* Whether toolbar is visible by default
|
|
42
|
+
*/
|
|
43
|
+
defaultVisible: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Toolbar placement on screen
|
|
46
|
+
*/
|
|
47
|
+
placement: ToolbarPlacement;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to show notifications
|
|
50
|
+
*/
|
|
51
|
+
showNotifications: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Default toolbar settings
|
|
55
|
+
*/
|
|
56
|
+
export declare const DEFAULT_TOOLBAR_SETTINGS: ToolbarSettings;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
import type { ComponentChildren } from "preact";
|
|
3
|
+
interface IconProps {
|
|
4
|
+
class?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
/**
|
|
7
|
+
* CSS data-URI from a `?data-uri&encoding=css` lucide-static import.
|
|
8
|
+
* Uses CSS mask-image so the icon inherits currentColor from the parent.
|
|
9
|
+
*/
|
|
10
|
+
src: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders a lucide-static icon using CSS mask-image.
|
|
14
|
+
* Color is driven by the parent element's `color` property (currentColor).
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* import xIcon from "lucide-static/icons/x.d.ts";
|
|
18
|
+
* <Icon src={xIcon} size={13} />
|
|
19
|
+
*/
|
|
20
|
+
declare const Icon: ({ src, size, class: className }: IconProps) => ComponentChildren;
|
|
21
|
+
export default Icon;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import type { DevToolbarApp, ServerFunctions } from "./types/index.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Dev toolbar plugin options
|
|
5
|
+
*/
|
|
6
|
+
export interface DevToolbarOptions {
|
|
7
|
+
/**
|
|
8
|
+
* append an import to the module id ending with `appendTo` instead of adding a script into body
|
|
9
|
+
* useful for projects that do not use html file as an entry
|
|
10
|
+
*
|
|
11
|
+
* WARNING: only set this if you know exactly what it does.
|
|
12
|
+
* @default ''
|
|
13
|
+
*/
|
|
14
|
+
appendTo?: string | RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* Built-in apps to enable
|
|
17
|
+
*/
|
|
18
|
+
apps?: {
|
|
19
|
+
[key: string]: boolean | undefined;
|
|
20
|
+
a11y?: boolean;
|
|
21
|
+
moduleGraph?: boolean;
|
|
22
|
+
performance?: boolean;
|
|
23
|
+
seo?: boolean;
|
|
24
|
+
settings?: boolean;
|
|
25
|
+
timeline?: boolean;
|
|
26
|
+
viteConfig?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Whether clicking outside the DevTools panel closes it.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
closeOnOutsideClick?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Custom apps to register
|
|
35
|
+
*/
|
|
36
|
+
customApps?: DevToolbarApp[];
|
|
37
|
+
/**
|
|
38
|
+
* Whether toolbar is visible by default
|
|
39
|
+
*/
|
|
40
|
+
defaultVisible?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Initial panel height as a percentage of the viewport height (20–95).
|
|
43
|
+
* @default 60
|
|
44
|
+
*/
|
|
45
|
+
height?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Keyboard shortcut bindings.
|
|
48
|
+
* These are project-level defaults; users can still override them via the
|
|
49
|
+
* Settings app (stored in localStorage).
|
|
50
|
+
*/
|
|
51
|
+
keybindings?: {
|
|
52
|
+
/** Close active app / panel. @default "Escape" */
|
|
53
|
+
close?: string;
|
|
54
|
+
/** Toggle the DevTools panel open/closed. @default "Alt+Shift+D" */
|
|
55
|
+
toggle?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Auto-hide the toolbar pill after this many milliseconds of inactivity.
|
|
59
|
+
* Set to -1 to never auto-hide.
|
|
60
|
+
* @default 5000
|
|
61
|
+
*/
|
|
62
|
+
minimizePanelInactive?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Toolbar placement (coarse shorthand — sets the edge and rough horizontal
|
|
65
|
+
* alignment of the toolbar pill).
|
|
66
|
+
* @default "bottom-center"
|
|
67
|
+
*/
|
|
68
|
+
placement?: "bottom-left" | "bottom-center" | "bottom-right";
|
|
69
|
+
/**
|
|
70
|
+
* Which edge of the viewport the toolbar pill is anchored to.
|
|
71
|
+
* Takes precedence over the edge implied by `placement`.
|
|
72
|
+
* @default "bottom"
|
|
73
|
+
*/
|
|
74
|
+
position?: "bottom" | "left" | "right" | "top";
|
|
75
|
+
/**
|
|
76
|
+
* Reduce motion for accessibility (disables all CSS animations).
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
reduceMotion?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Only activate the toolbar when the URL contains a specific query parameter.
|
|
82
|
+
* Useful for staging/production environments where you want opt-in debugging.
|
|
83
|
+
* @example requireUrlFlag: true, urlFlagName: 'debug' → toolbar only shows when URL has ?debug=true
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
requireUrlFlag?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Custom server RPC functions
|
|
89
|
+
*/
|
|
90
|
+
serverFunctions?: Partial<ServerFunctions>;
|
|
91
|
+
/**
|
|
92
|
+
* The URL query parameter name used when requireUrlFlag is true.
|
|
93
|
+
* @default 'devtools'
|
|
94
|
+
*/
|
|
95
|
+
urlFlagName?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Initial panel width as a percentage of the viewport width (20–95).
|
|
98
|
+
* Applies when position is "left" or "right".
|
|
99
|
+
* @default 80
|
|
100
|
+
*/
|
|
101
|
+
width?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Dev toolbar Vite plugin
|
|
105
|
+
*/
|
|
106
|
+
export declare const devToolbar: (options?: DevToolbarOptions) => Plugin;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.defineProperty;var p=(e,r)=>g(e,"name",{value:r,configurable:!0});import{createRequire as b}from"node:module";import{normalizePath as $}from"vite";import{createServerRPCContext as j}from"./packem_shared/createServerRPCContext-BVSesPXu.js";const h=b(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=p(e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,o]=s.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return s.getBuiltinModule(e)}return h(e)},"__cjs_getBuiltinModule"),y=u("node:fs"),_=u("node:path"),{fileURLToPath:T}=u("node:url");var P=Object.defineProperty,c=p((e,r)=>P(e,"name",{value:r,configurable:!0}),"o");const F=c(()=>$(_.dirname(T(import.meta.url))),"getDevToolbarPath"),C=c(e=>e.replace(/\?.*$/,""),"removeUrlQuery"),d="?__visulima-dev-toolbar-resource",f="virtual:visulima-dev-toolbar-options",m=`\0${f}`,a="virtual:visulima-dev-toolbar-path:",x=c((e={})=>{const r=F();let o;return{apply:"serve",configResolved(t){o=t},configureServer(t){j(t,e.serverFunctions),t.ws.on("connection",()=>{t.ws.send({event:"dev-toolbar:init",type:"custom"})})},enforce:"pre",async load(t){if(t===m)return`export default ${JSON.stringify({apps:{a11y:e.apps?.a11y??!0,moduleGraph:e.apps?.moduleGraph??!0,performance:e.apps?.performance??!0,seo:e.apps?.seo??!0,settings:e.apps?.settings??!0,timeline:e.apps?.timeline??!0,viteConfig:e.apps?.viteConfig??!0},base:o.base,closeOnOutsideClick:e.closeOnOutsideClick??!0,defaultVisible:e.defaultVisible??!0,height:e.height??60,keybindings:e.keybindings??{},minimizePanelInactive:e.minimizePanelInactive??5e3,placement:e.placement??"bottom-center",position:e.position??"bottom",reduceMotion:e.reduceMotion??!1,requireUrlFlag:e.requireUrlFlag??!1,urlFlagName:e.urlFlagName??"devtools",width:e.width??80})};`;if(t.endsWith(d)){const n=C(t);return this.addWatchFile(n),await y.promises.readFile(n,"utf8")}},name:"@visulima/dev-toolbar",resolveId(t){if(t===f)return m;if(t.startsWith(a))return`${t.replace(a,`${r}/`)}${d}`},transform(t,n,v){if(v?.ssr)return;const{appendTo:i}=e,l=n.split("?",2)[0];if(i&&l&&(typeof i=="string"&&l.endsWith(i)||i instanceof RegExp&&i.test(l)))return`import '${a}client/overlay.js';
|
|
2
|
+
${t}`},transformIndexHtml(){return e.appendTo?void 0:{html:"",tags:[{attrs:{src:`${o.base||"/"}@id/${a}client/overlay.js`,type:"module"},injectTo:"head-prepend",tag:"script"}]}}}},"devToolbar");export{x as devToolbar};
|