@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.
Files changed (95) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE.md +77 -0
  3. package/README.md +277 -29
  4. package/dist/apps/a11y/a11y-app.d.ts +5 -0
  5. package/dist/apps/a11y/a11y-store.d.ts +46 -0
  6. package/dist/apps/a11y/a11y-tooltip.d.ts +11 -0
  7. package/dist/apps/a11y/index.d.ts +3 -0
  8. package/dist/apps/a11y/index.js +21 -0
  9. package/dist/apps/module-graph/index.d.ts +3 -0
  10. package/dist/apps/module-graph/index.js +20 -0
  11. package/dist/apps/module-graph/module-graph-app.d.ts +5 -0
  12. package/dist/apps/more/index.d.ts +3 -0
  13. package/dist/apps/more/index.js +19 -0
  14. package/dist/apps/more/more-app.d.ts +5 -0
  15. package/dist/apps/performance/index.d.ts +3 -0
  16. package/dist/apps/performance/index.js +17 -0
  17. package/dist/apps/performance/performance-app.d.ts +5 -0
  18. package/dist/apps/performance/performance-tooltip.d.ts +5 -0
  19. package/dist/apps/seo/index.d.ts +3 -0
  20. package/dist/apps/seo/index.js +17 -0
  21. package/dist/apps/seo/seo-app.d.ts +5 -0
  22. package/dist/apps/settings/index.d.ts +3 -0
  23. package/dist/apps/settings/index.js +17 -0
  24. package/dist/apps/settings/settings-app.d.ts +5 -0
  25. package/dist/apps/timeline/index.d.ts +3 -0
  26. package/dist/apps/timeline/index.js +18 -0
  27. package/dist/apps/timeline/timeline-app.d.ts +5 -0
  28. package/dist/apps/vite-config/index.d.ts +3 -0
  29. package/dist/apps/vite-config/index.js +16 -0
  30. package/dist/apps/vite-config/vite-config-app.d.ts +5 -0
  31. package/dist/client/overlay.d.ts +1 -0
  32. package/dist/client/overlay.js +1 -0
  33. package/dist/hooks/create-hook.d.ts +10 -0
  34. package/dist/hooks/events.d.ts +5 -0
  35. package/dist/hooks/global-hook.d.ts +15 -0
  36. package/dist/hooks/index.d.ts +6 -0
  37. package/dist/index.d.ts +6 -0
  38. package/dist/index.js +1 -0
  39. package/dist/packem_shared/TimelineStore-BgBrirKd.js +1 -0
  40. package/dist/packem_shared/cn-BEsR6GkP.js +1 -0
  41. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +1 -0
  42. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +1 -0
  43. package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +1 -0
  44. package/dist/packem_shared/icon-BUQ92HaT.js +1 -0
  45. package/dist/packem_shared/loadSettings-hvjR4fcS.js +1 -0
  46. package/dist/packem_shared/setupGlobalHook-CFuxsCyl.js +1 -0
  47. package/dist/packem_shared/store-BxE0w51s.js +1 -0
  48. package/dist/performance/monitor.d.ts +115 -0
  49. package/dist/rpc/client.d.ts +7 -0
  50. package/dist/rpc/functions/module-graph.d.ts +17 -0
  51. package/dist/rpc/functions/open-in-editor.d.ts +9 -0
  52. package/dist/rpc/functions/vite-config.d.ts +7 -0
  53. package/dist/rpc/index.d.ts +8 -0
  54. package/dist/rpc/server.d.ts +9 -0
  55. package/dist/timeline/index.d.ts +6 -0
  56. package/dist/timeline/store.d.ts +52 -0
  57. package/dist/toolbar/app-manager.d.ts +95 -0
  58. package/dist/toolbar/components/app-button.d.ts +19 -0
  59. package/dist/toolbar/components/app-canvas.d.ts +13 -0
  60. package/dist/toolbar/components/app-tooltip-overlay.d.ts +13 -0
  61. package/dist/toolbar/components/first-visit-hint.d.ts +16 -0
  62. package/dist/toolbar/components/index.d.ts +4 -0
  63. package/dist/toolbar/components/pinned-tooltip-card.d.ts +23 -0
  64. package/dist/toolbar/components/toolbar-bar.d.ts +15 -0
  65. package/dist/toolbar/components/toolbar-container.d.ts +55 -0
  66. package/dist/toolbar/components/vite-overlay-button.d.ts +15 -0
  67. package/dist/toolbar/context/index.d.ts +2 -0
  68. package/dist/toolbar/context/toolbar-context.d.ts +106 -0
  69. package/dist/toolbar/global-api.d.ts +23 -0
  70. package/dist/toolbar/helpers.d.ts +6 -0
  71. package/dist/toolbar/hooks/index.d.ts +10 -0
  72. package/dist/toolbar/hooks/use-apps.d.ts +13 -0
  73. package/dist/toolbar/hooks/use-frame-state.d.ts +94 -0
  74. package/dist/toolbar/hooks/use-panel-visible.d.ts +21 -0
  75. package/dist/toolbar/hooks/use-position.d.ts +22 -0
  76. package/dist/toolbar/hooks/use-theme.d.ts +13 -0
  77. package/dist/toolbar/hooks/use-toolbar.d.ts +14 -0
  78. package/dist/toolbar/index.d.ts +58 -0
  79. package/dist/toolbar/index.js +22 -0
  80. package/dist/toolbar/settings.d.ts +17 -0
  81. package/dist/toolbar/stylesheet.d.ts +1 -0
  82. package/dist/toolbar/utils/index.d.ts +12 -0
  83. package/dist/types/app.d.ts +163 -0
  84. package/dist/types/global-api.d.ts +95 -0
  85. package/dist/types/hooks.d.ts +88 -0
  86. package/dist/types/index.d.ts +12 -0
  87. package/dist/types/messaging.d.ts +43 -0
  88. package/dist/types/rpc.d.ts +95 -0
  89. package/dist/types/timeline.d.ts +62 -0
  90. package/dist/types/toolbar.d.ts +56 -0
  91. package/dist/ui/components/icon.d.ts +21 -0
  92. package/dist/utils/cn.d.ts +8 -0
  93. package/dist/vite-plugin.d.ts +106 -0
  94. package/dist/vite-plugin.js +2 -0
  95. package/package.json +105 -7
@@ -0,0 +1,52 @@
1
+ import type { TimelineEvent, TimelineGroup } from "../types/timeline.d.ts";
2
+ /**
3
+ * Timeline store for managing events
4
+ */
5
+ export declare class TimelineStore {
6
+ private groups;
7
+ private maxEvents;
8
+ constructor(maxEvents?: number);
9
+ /**
10
+ * Add an event to a group
11
+ * @param groupId Group ID
12
+ * @param event Timeline event
13
+ */
14
+ addEvent(groupId: string, event: TimelineEvent): void;
15
+ /**
16
+ * Get all groups
17
+ * @returns Array of timeline groups
18
+ */
19
+ getGroups(): TimelineGroup[];
20
+ /**
21
+ * Get events for a specific group
22
+ * @param groupId Group ID
23
+ * @returns Array of events or empty array
24
+ */
25
+ getGroupEvents(groupId: string): TimelineEvent[];
26
+ /**
27
+ * Get all events across all groups
28
+ * @returns Array of all events
29
+ */
30
+ getAllEvents(): TimelineEvent[];
31
+ /**
32
+ * Clear events for a group
33
+ * @param groupId Group ID
34
+ */
35
+ clearGroup(groupId: string): void;
36
+ /**
37
+ * Clear all events
38
+ */
39
+ clearAll(): void;
40
+ /**
41
+ * Get events within a time range
42
+ * @param startTime Start timestamp
43
+ * @param endTime End timestamp
44
+ * @returns Array of events in range
45
+ */
46
+ getEventsInRange(startTime: number, endTime: number): TimelineEvent[];
47
+ }
48
+ /**
49
+ * Get or create timeline store instance
50
+ * @returns Timeline store instance
51
+ */
52
+ export declare const getTimelineStore: () => TimelineStore;
@@ -0,0 +1,95 @@
1
+ import type { DevToolbarApp, DevToolbarAppState } from "../types/app.d.ts";
2
+ /**
3
+ * App manager for handling app lifecycle
4
+ */
5
+ export declare class AppManager {
6
+ private apps;
7
+ private activeAppId;
8
+ private initializedApps;
9
+ private appCanvases;
10
+ /**
11
+ * Register an app
12
+ * @param app App definition
13
+ * @param builtIn Whether this is a built-in app
14
+ */
15
+ registerApp(app: DevToolbarApp, builtIn?: boolean): void;
16
+ /**
17
+ * Unregister an app
18
+ * @param appId App ID
19
+ */
20
+ unregisterApp(appId: string): Promise<void>;
21
+ /**
22
+ * Get an app by ID
23
+ * @param appId App ID
24
+ * @returns App state or undefined
25
+ */
26
+ getApp(appId: string): DevToolbarAppState | undefined;
27
+ /**
28
+ * Get all apps
29
+ * @returns Array of app states
30
+ */
31
+ getAllApps(): DevToolbarAppState[];
32
+ /**
33
+ * Get active app
34
+ * @returns Active app state or undefined
35
+ */
36
+ getActiveApp(): DevToolbarAppState | undefined;
37
+ /**
38
+ * Toggle app active state
39
+ * @param appId App ID
40
+ * @returns Whether toggle was successful
41
+ */
42
+ toggleApp(appId: string): Promise<boolean>;
43
+ /**
44
+ * Check if an app has been initialized
45
+ * @returns True when the app's init() has already been called
46
+ */
47
+ isAppInitialized(appId: string): boolean;
48
+ /**
49
+ * Mark an app as initialized
50
+ * @returns void
51
+ */
52
+ markAppInitialized(appId: string): void;
53
+ /**
54
+ * Open an app
55
+ * @param appId App ID
56
+ * @returns Whether open was successful
57
+ */
58
+ openApp(appId: string): Promise<boolean>;
59
+ /**
60
+ * Close an app
61
+ * @param appId App ID
62
+ * @returns Whether close was successful
63
+ */
64
+ closeApp(appId: string): Promise<boolean>;
65
+ /**
66
+ * Set app notification
67
+ * @param appId App ID
68
+ * @param state Notification state
69
+ * @param level Notification level
70
+ */
71
+ setNotification(appId: string, state: boolean, level?: "info" | "warning" | "error"): void;
72
+ /**
73
+ * Clear app notification
74
+ * @param appId App ID
75
+ */
76
+ clearNotification(appId: string): void;
77
+ /**
78
+ * Get app canvas element
79
+ * @param appId App ID
80
+ * @returns Canvas element with shadow root or null
81
+ */
82
+ getAppCanvas(appId: string): {
83
+ element: HTMLElement;
84
+ shadowRoot: ShadowRoot;
85
+ } | null;
86
+ /**
87
+ * Set app canvas element (called by toolbar component)
88
+ * @param appId App ID
89
+ * @param canvas Canvas with shadow root
90
+ */
91
+ setAppCanvas(appId: string, canvas: {
92
+ element: HTMLElement;
93
+ shadowRoot: ShadowRoot;
94
+ }): void;
95
+ }
@@ -0,0 +1,19 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { DevToolbarAppState } from "../../types/index.d.ts";
4
+ interface AppButtonProps {
5
+ /**
6
+ * App state
7
+ */
8
+ app: DevToolbarAppState;
9
+ }
10
+ /**
11
+ * App button component — shown in the toolbar pill.
12
+ * When an app declares a `tooltip` component, hovering the button shows a live
13
+ * mini-canvas via AppTooltipOverlay (rendered outside overflow:hidden pill).
14
+ * @param props - Component props
15
+ * @param props.app - App state
16
+ * @returns Rendered button component
17
+ */
18
+ declare const AppButton: ({ app }: AppButtonProps) => ComponentChildren;
19
+ export default AppButton;
@@ -0,0 +1,13 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { DevToolbarAppState } from "../../types/index.d.ts";
4
+ interface DevPanelProps {
5
+ activeAppId: string | null;
6
+ apps: DevToolbarAppState[];
7
+ onClose: () => void;
8
+ onToggleApp: (appId: string) => Promise<void>;
9
+ panelVisible: boolean;
10
+ position: "bottom" | "left" | "right" | "top";
11
+ }
12
+ declare const DevPanel: ({ activeAppId, apps, onClose, onToggleApp, panelVisible, position }: DevPanelProps) => ComponentChildren;
13
+ export default DevPanel;
@@ -0,0 +1,13 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ interface AppTooltipOverlayProps {
4
+ position: "bottom" | "left" | "right" | "top";
5
+ }
6
+ /**
7
+ * Floating mini-canvas that appears when hovering a toolbar app button that
8
+ * provides a `tooltip` component. Rendered as `position:fixed` so it escapes
9
+ * the pill's `overflow:hidden`. The leave-debounce (handled in ToolbarContainer)
10
+ * keeps it visible while the mouse moves from button to tooltip.
11
+ */
12
+ declare const AppTooltipOverlay: ({ position }: AppTooltipOverlayProps) => ComponentChildren;
13
+ export default AppTooltipOverlay;
@@ -0,0 +1,16 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ interface FirstVisitHintProps {
4
+ onDismiss: () => void;
5
+ position: "bottom" | "left" | "right" | "top";
6
+ }
7
+ /**
8
+ * First-visit hint overlay showing keyboard and interaction tips.
9
+ * Appears ~600 ms after mount to let the toolbar pill animate in first.
10
+ * @param props - Component props
11
+ * @param props.onDismiss - Called after the dismiss animation completes
12
+ * @param props.position - Current toolbar position (controls hint placement)
13
+ * @returns Rendered hint component
14
+ */
15
+ declare const FirstVisitHint: ({ onDismiss, position }: FirstVisitHintProps) => ComponentChildren;
16
+ export default FirstVisitHint;
@@ -0,0 +1,4 @@
1
+ export { default as AppButton } from "./app-button.d.ts";
2
+ export { default as AppCanvas } from "./app-canvas.d.ts";
3
+ export { default as ToolbarBar } from "./toolbar-bar.d.ts";
4
+ export { default as ToolbarContainer } from "./toolbar-container.d.ts";
@@ -0,0 +1,23 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { PinnedTooltip } from "../context/index.d.ts";
4
+ interface PinnedTooltipCardProps {
5
+ /** Called once when a drag ends so the parent can persist the new position. */
6
+ onMove: (id: string, x: number, y: number) => void;
7
+ onUnpin: (id: string) => void;
8
+ pinned: PinnedTooltip;
9
+ }
10
+ /**
11
+ * A pinned tooltip card — persists on screen until the user unpins it.
12
+ *
13
+ * Position is updated via direct DOM style mutations during drag so that
14
+ * Preact never re-renders the component on mousemove — drag is silky smooth
15
+ * regardless of how expensive the tooltip content component is.
16
+ * @param props Component props
17
+ * @param props.onMove Called with the pin ID and final (x, y) coordinates when a drag ends
18
+ * @param props.onUnpin Called with the pin ID when the user clicks the unpin button
19
+ * @param props.pinned Pinned tooltip descriptor — contains the app reference and initial position
20
+ * @returns Rendered draggable pinned card, or null if the app has no tooltip component
21
+ */
22
+ declare const PinnedTooltipCard: ({ onMove, onUnpin, pinned }: PinnedTooltipCardProps) => ComponentChildren;
23
+ export default PinnedTooltipCard;
@@ -0,0 +1,15 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ interface ToolbarBarProps {
4
+ /**
5
+ * Number of custom apps to show before "more" button
6
+ */
7
+ customAppsToShow?: number;
8
+ }
9
+ /**
10
+ * Toolbar bar — row of app buttons inside the pill.
11
+ * Left/right placement rotates the whole pill 90deg via CSS,
12
+ * so this always stays flex-row internally.
13
+ */
14
+ declare const ToolbarBar: ({ customAppsToShow }: ToolbarBarProps) => ComponentChildren;
15
+ export default ToolbarBar;
@@ -0,0 +1,55 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { DevToolbarAppState } from "../../types/index.d.ts";
4
+ interface ToolbarContainerProps {
5
+ /**
6
+ * Active app ID
7
+ */
8
+ activeAppId: string | null;
9
+ /**
10
+ * Initial apps
11
+ */
12
+ apps: DevToolbarAppState[];
13
+ /**
14
+ * Number of custom apps to show
15
+ */
16
+ customAppsToShow?: number;
17
+ /**
18
+ * Callback when notification should be cleared
19
+ */
20
+ onClearNotification: (appId: string) => void;
21
+ /**
22
+ * Callback when app should be registered
23
+ */
24
+ onRegisterApp: (app: DevToolbarAppState) => void;
25
+ /**
26
+ * Callback when notification should be set
27
+ */
28
+ onSetNotification: (appId: string, state: boolean, level?: "error" | "info" | "warning") => void;
29
+ /**
30
+ * Callback when app should be toggled
31
+ */
32
+ onToggleApp: (appId: string) => Promise<void>;
33
+ /**
34
+ * Callback when app should be unregistered
35
+ */
36
+ onUnregisterApp: (appId: string) => void;
37
+ }
38
+ /**
39
+ * Root toolbar container component — orchestrates the toolbar pill, app panel,
40
+ * tooltip overlays, pinned cards, and first-visit hint.
41
+ * Manages active app state, hover tooltips, pinned tooltip persistence (localStorage),
42
+ * and delegates app lifecycle events to the parent via callbacks.
43
+ * @param props Component props
44
+ * @param props.activeAppId ID of the currently open app, or null if no app is open
45
+ * @param props.apps Initial array of registered app states
46
+ * @param props.customAppsToShow Maximum number of custom apps to show in the pill (default: 3)
47
+ * @param props.onClearNotification Called when an app's notification badge should be cleared
48
+ * @param props.onRegisterApp Called when a new app is dynamically registered
49
+ * @param props.onSetNotification Called when an app requests a notification badge update
50
+ * @param props.onToggleApp Called when the user clicks an app button to open/close it
51
+ * @param props.onUnregisterApp Called when an app is dynamically unregistered
52
+ * @returns Rendered toolbar component tree
53
+ */
54
+ declare const ToolbarContainer: ({ activeAppId, apps, customAppsToShow, onClearNotification, onRegisterApp, onSetNotification, onToggleApp, onUnregisterApp, }: ToolbarContainerProps) => ComponentChildren;
55
+ export default ToolbarContainer;
@@ -0,0 +1,15 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ /**
4
+ * Shows a red error button in the toolbar when @visulima/vite-overlay errors exist.
5
+ * Clicking toggles the vite-overlay panel visibility.
6
+ *
7
+ * Only rendered when:
8
+ * - @visulima/vite-overlay is installed and active (window.ErrorOverlay is defined)
9
+ * - At least one error is present in the history
10
+ *
11
+ * Renders with its own left separator so it stays visually grouped on the
12
+ * right side of the toolbar, distinct from the regular app buttons.
13
+ */
14
+ declare const ViteOverlayButton: () => ComponentChildren;
15
+ export default ViteOverlayButton;
@@ -0,0 +1,2 @@
1
+ export { ToolbarContext, useToolbarContext } from "./toolbar-context.d.ts";
2
+ export type { PinnedTooltip, ToolbarContextState } from "./toolbar-context.d.ts";
@@ -0,0 +1,106 @@
1
+ import { createContext } from "preact";
2
+ import type { DevToolbarAppState, ToolbarPlacement } from "../../types/index.d.ts";
3
+ /**
4
+ * A tooltip that has been pinned by the user — stays visible until unpinned.
5
+ */
6
+ export interface PinnedTooltip {
7
+ /** The app whose tooltip is shown */
8
+ app: DevToolbarAppState;
9
+ /** Unique instance identifier (appId + timestamp) */
10
+ id: string;
11
+ /** Initial left position (viewport px) */
12
+ initialX: number;
13
+ /** Initial top position (viewport px) */
14
+ initialY: number;
15
+ }
16
+ /**
17
+ * Toolbar context state
18
+ */
19
+ export interface ToolbarContextState {
20
+ /**
21
+ * All registered apps
22
+ */
23
+ apps: DevToolbarAppState[];
24
+ /**
25
+ * Currently active app ID
26
+ */
27
+ activeAppId: string | null;
28
+ /**
29
+ * Whether toolbar is visible
30
+ */
31
+ isVisible: boolean;
32
+ /**
33
+ * Toolbar placement on screen
34
+ */
35
+ placement: ToolbarPlacement;
36
+ /**
37
+ * Whether toolbar is being dragged
38
+ */
39
+ isDragging: boolean;
40
+ /**
41
+ * Set toolbar visibility
42
+ */
43
+ setVisible: (visible: boolean) => void;
44
+ /**
45
+ * Set toolbar placement
46
+ */
47
+ setPlacement: (placement: ToolbarPlacement) => void;
48
+ /**
49
+ * Set dragging state
50
+ */
51
+ setDragging: (dragging: boolean) => void;
52
+ /**
53
+ * Register an app
54
+ */
55
+ registerApp: (app: DevToolbarAppState) => void;
56
+ /**
57
+ * Unregister an app
58
+ */
59
+ unregisterApp: (appId: string) => void;
60
+ /**
61
+ * Toggle an app
62
+ */
63
+ toggleApp: (appId: string) => Promise<void>;
64
+ /**
65
+ * Set app notification
66
+ */
67
+ setNotification: (appId: string, state: boolean, level?: "info" | "warning" | "error") => void;
68
+ /**
69
+ * Clear app notification
70
+ */
71
+ clearNotification: (appId: string) => void;
72
+ /**
73
+ * Currently hovered app (has a tooltip component)
74
+ */
75
+ hoveredApp: DevToolbarAppState | null;
76
+ /**
77
+ * Viewport rect of the hovered app button (for tooltip positioning)
78
+ */
79
+ hoveredAppRect: DOMRect | null;
80
+ /**
81
+ * Set/clear the hovered app. Pass null to start the leave debounce.
82
+ */
83
+ setHoveredApp: (app: DevToolbarAppState | null, rect?: DOMRect | null) => void;
84
+ /**
85
+ * Currently pinned tooltip cards
86
+ */
87
+ pinnedTooltips: PinnedTooltip[];
88
+ /**
89
+ * Pin a tooltip at the given viewport position.
90
+ * Multiple pins from the same app are allowed (each gets a unique id).
91
+ */
92
+ pinTooltip: (app: DevToolbarAppState, x: number, y: number) => void;
93
+ /**
94
+ * Remove a pinned tooltip by its instance id.
95
+ */
96
+ unpinTooltip: (id: string) => void;
97
+ }
98
+ /**
99
+ * Toolbar context
100
+ */
101
+ export declare const ToolbarContext: ReturnType<typeof createContext<ToolbarContextState | null>>;
102
+ /**
103
+ * Hook to access toolbar context
104
+ * @throws Error if used outside ToolbarContext provider
105
+ */
106
+ export declare const useToolbarContext: () => ToolbarContextState;
@@ -0,0 +1,23 @@
1
+ import type { VisulimaDevTools } from "../types/global-api.d.ts";
2
+ import type { DevToolbarApp } from "../types/index.d.ts";
3
+ /**
4
+ * Global DevTools API implementation.
5
+ */
6
+ export declare const createGlobalAPI: (appManager: {
7
+ clearNotification: (id: string) => void;
8
+ getActiveApp: () => DevToolbarApp | undefined;
9
+ getApps: () => DevToolbarApp[];
10
+ registerApp: (app: DevToolbarApp) => void;
11
+ setNotification: (id: string, state: boolean, level?: "info" | "warning" | "error") => void;
12
+ toggleApp: (id: string) => Promise<boolean>;
13
+ unregisterApp: (id: string) => void;
14
+ }, toolbar: {
15
+ hide: () => void;
16
+ show: () => void;
17
+ toggle: () => void;
18
+ }) => VisulimaDevTools;
19
+ /**
20
+ * Setup global API on window object
21
+ * @param api API instance
22
+ */
23
+ export declare const setupGlobalAPI: (api: VisulimaDevTools) => void;
@@ -0,0 +1,6 @@
1
+ import type { ServerHelpers } from "../types/app.d.ts";
2
+ /**
3
+ * Create server helpers for apps
4
+ * @returns Server helpers instance
5
+ */
6
+ export declare const createServerHelpers: () => ServerHelpers;
@@ -0,0 +1,10 @@
1
+ export { useApps } from "./use-apps.d.ts";
2
+ export { useFrameState } from "./use-frame-state.d.ts";
3
+ export type { DevToolsFrameState, UseFrameStateReturn } from "./use-frame-state.d.ts";
4
+ export { usePanelVisible } from "./use-panel-visible.d.ts";
5
+ export type { UsePanelVisibleReturn } from "./use-panel-visible.d.ts";
6
+ export { usePosition } from "./use-position.d.ts";
7
+ export type { UsePositionReturn } from "./use-position.d.ts";
8
+ export { useTheme } from "./use-theme.d.ts";
9
+ export type { Theme, UseThemeReturn } from "./use-theme.d.ts";
10
+ export { useToolbar } from "./use-toolbar.d.ts";
@@ -0,0 +1,13 @@
1
+ import type { DevToolbarAppState } from "../../types/index.d.ts";
2
+ /**
3
+ * Hook for app management - exposes context app methods directly
4
+ */
5
+ export declare const useApps: () => {
6
+ activeAppId: string | null;
7
+ apps: DevToolbarAppState[];
8
+ clearNotification: (appId: string) => void;
9
+ registerApp: (app: DevToolbarAppState) => void;
10
+ setNotification: (appId: string, state: boolean, level?: "info" | "warning" | "error") => void;
11
+ toggleApp: (appId: string) => Promise<void>;
12
+ unregisterApp: (appId: string) => void;
13
+ };
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Keyboard shortcut bindings
3
+ */
4
+ export interface KeyBindings {
5
+ /** Toggle toolbar panel open/closed */
6
+ toggle: string;
7
+ /** Close active app / panel */
8
+ close: string;
9
+ }
10
+ export declare const DEFAULT_KEYBINDINGS: KeyBindings;
11
+ /**
12
+ * Frame state interface
13
+ */
14
+ export interface DevToolsFrameState {
15
+ /**
16
+ * Close panel on outside click
17
+ */
18
+ closeOnOutsideClick: boolean;
19
+ /**
20
+ * Panel height as viewport height percentage
21
+ */
22
+ height: number;
23
+ /**
24
+ * Whether DevTools panel is open in a Picture-in-Picture window
25
+ */
26
+ isPip: boolean;
27
+ /**
28
+ * Whether this is the first visit (used to show onboarding hint)
29
+ */
30
+ isFirstVisit: boolean;
31
+ /**
32
+ * Keyboard shortcut bindings
33
+ */
34
+ keybindings: KeyBindings;
35
+ /**
36
+ * Horizontal position as percentage (0-100)
37
+ */
38
+ left: number;
39
+ /**
40
+ * Auto-hide timeout in milliseconds (-1 = never hide, 0 = always hide when inactive)
41
+ */
42
+ minimizePanelInactive: number;
43
+ /**
44
+ * Whether panel is open
45
+ */
46
+ open: boolean;
47
+ /**
48
+ * Position anchor
49
+ */
50
+ position: "top" | "bottom" | "left" | "right";
51
+ /**
52
+ * Prefer showing floating panel
53
+ */
54
+ preferShowFloatingPanel: boolean;
55
+ /**
56
+ * Reduce motion for accessibility
57
+ */
58
+ reduceMotion: boolean;
59
+ /**
60
+ * Current route
61
+ */
62
+ route: string;
63
+ /**
64
+ * Vertical position as percentage (0-100)
65
+ */
66
+ top: number;
67
+ /**
68
+ * Panel view mode
69
+ */
70
+ viewMode: "default" | "fullscreen" | "wide";
71
+ /**
72
+ * Panel width as viewport width percentage
73
+ */
74
+ width: number;
75
+ }
76
+ /**
77
+ * Return type for useFrameState hook
78
+ */
79
+ export interface UseFrameStateReturn {
80
+ /**
81
+ * Current frame state
82
+ */
83
+ state: DevToolsFrameState;
84
+ /**
85
+ * Update state with partial values
86
+ */
87
+ updateState: (value: Partial<DevToolsFrameState>) => void;
88
+ }
89
+ /**
90
+ * Hook for frame state management.
91
+ * All callers share the same module-level state so position, open, and other
92
+ * fields stay in sync regardless of how many times the hook is called.
93
+ */
94
+ export declare const useFrameState: () => UseFrameStateReturn;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Return type for usePanelVisible hook
3
+ */
4
+ export interface UsePanelVisibleReturn {
5
+ /**
6
+ * Close panel
7
+ */
8
+ closePanel: () => void;
9
+ /**
10
+ * Whether panel is visible
11
+ */
12
+ panelVisible: boolean;
13
+ /**
14
+ * Toggle panel visibility
15
+ */
16
+ togglePanelVisible: (_?: unknown, newState?: boolean) => void;
17
+ }
18
+ /**
19
+ * Hook for panel visibility management - converted from Vue DevTools usePanelVisible
20
+ */
21
+ export declare const usePanelVisible: () => UsePanelVisibleReturn;
@@ -0,0 +1,22 @@
1
+ import type { RefObject } from "preact";
2
+ /**
3
+ * Return type for usePosition hook
4
+ */
5
+ export interface UsePositionReturn {
6
+ anchorStyle: {
7
+ left: string;
8
+ top: string;
9
+ };
10
+ bringUp: () => void;
11
+ iframeStyle: Record<string, string>;
12
+ isDragging: boolean;
13
+ isHidden: boolean;
14
+ isVertical: boolean;
15
+ onPointerDown: (e: PointerEvent) => void;
16
+ panelStyle: Record<string, string>;
17
+ }
18
+ /**
19
+ * Hook for position management - converted from Vue DevTools usePosition
20
+ * @see https://github.com/vuejs/devtools/blob/main/packages/overlay/src/composables/position.ts
21
+ */
22
+ export declare const usePosition: (panelEl: RefObject<HTMLElement>) => UsePositionReturn;
@@ -0,0 +1,13 @@
1
+ export type Theme = "light" | "dark" | "system";
2
+ export interface UseThemeReturn {
3
+ resolvedTheme: "light" | "dark";
4
+ setTheme: (newTheme: Theme) => void;
5
+ theme: Theme;
6
+ toggleTheme: () => void;
7
+ }
8
+ /**
9
+ * Hook for managing theme (light/dark mode).
10
+ * All callers share the same module-level state so theme changes propagate
11
+ * to every component (ToolbarContainer, SettingsApp, etc.) immediately.
12
+ */
13
+ export declare const useTheme: () => UseThemeReturn;
@@ -0,0 +1,14 @@
1
+ import type { ToolbarPlacement } from "../../types/index.d.ts";
2
+ /**
3
+ * Hook for toolbar visibility and placement - exposes context methods directly
4
+ */
5
+ export declare const useToolbar: () => {
6
+ hide: () => void;
7
+ isDragging: boolean;
8
+ isVisible: boolean;
9
+ placement: ToolbarPlacement;
10
+ setDragging: (dragging: boolean) => void;
11
+ setPlacement: (placement: ToolbarPlacement) => void;
12
+ show: () => void;
13
+ toggle: () => void;
14
+ };