@visulima/dev-toolbar 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (83) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/apps/a11y/a11y-store.d.ts +12 -16
  3. package/dist/apps/a11y/index.js +2 -21
  4. package/dist/apps/inspector/index.js +1 -17
  5. package/dist/apps/module-graph/index.js +1 -20
  6. package/dist/apps/more/index.js +2 -19
  7. package/dist/apps/performance/index.js +1 -17
  8. package/dist/apps/seo/index.js +1 -17
  9. package/dist/apps/settings/index.js +1 -17
  10. package/dist/apps/tailwind/index.js +6 -6
  11. package/dist/apps/timeline/index.js +1 -18
  12. package/dist/apps/vite-config/index.js +1 -16
  13. package/dist/client/overlay.js +1 -1
  14. package/dist/hooks/create-hook.d.ts +7 -5
  15. package/dist/hooks/events.d.ts +4 -2
  16. package/dist/hooks/global-hook.d.ts +6 -6
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.js +1 -1
  19. package/dist/packem_chunks/inject-source.js +1 -1
  20. package/dist/packem_shared/Popover-CLt7YhUF.js +1 -0
  21. package/dist/packem_shared/Tabs-CXERaeAp.js +1 -0
  22. package/dist/packem_shared/Tooltip-tlBN-NdK.js +1 -0
  23. package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +1 -0
  24. package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +1 -0
  25. package/dist/packem_shared/createServerRPCContext-CEm1Ymkn.js +1 -0
  26. package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +1 -0
  27. package/dist/packem_shared/{setupGlobalHook-CFuxsCyl.js → setupGlobalHook-CCf9Logv.js} +1 -1
  28. package/dist/packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js +2 -0
  29. package/dist/packem_shared/store-DaUtLjf3.js +1 -0
  30. package/dist/packem_shared/{use-theme-CX1gG6Sv.js → use-theme-BOw3dPpY.js} +1 -1
  31. package/dist/performance/monitor.d.ts +27 -26
  32. package/dist/rpc/client.d.ts +6 -4
  33. package/dist/rpc/functions/open-in-editor.d.ts +7 -5
  34. package/dist/rpc/functions/tailwind-config.d.ts +7 -4
  35. package/dist/rpc/functions/vite-config.d.ts +6 -4
  36. package/dist/rpc/server.d.ts +9 -6
  37. package/dist/timeline/capture.d.ts +3 -1
  38. package/dist/timeline/index.d.ts +2 -1
  39. package/dist/timeline/store.d.ts +12 -22
  40. package/dist/toolbar/app-manager.d.ts +45 -43
  41. package/dist/toolbar/components/app-canvas.d.ts +1 -1
  42. package/dist/toolbar/components/toolbar-container.d.ts +1 -1
  43. package/dist/toolbar/components/vite-overlay-button.d.ts +2 -2
  44. package/dist/toolbar/context/toolbar-context.d.ts +20 -19
  45. package/dist/toolbar/global-api.d.ts +3 -3
  46. package/dist/toolbar/helpers.d.ts +5 -3
  47. package/dist/toolbar/hooks/use-apps.d.ts +5 -3
  48. package/dist/toolbar/hooks/use-frame-state.d.ts +16 -10
  49. package/dist/toolbar/hooks/use-panel-visible.d.ts +9 -7
  50. package/dist/toolbar/hooks/use-position.d.ts +7 -5
  51. package/dist/toolbar/hooks/use-theme.d.ts +6 -4
  52. package/dist/toolbar/hooks/use-toolbar.d.ts +4 -2
  53. package/dist/toolbar/index.d.ts +8 -14
  54. package/dist/toolbar/index.js +3 -3
  55. package/dist/toolbar/settings.d.ts +7 -7
  56. package/dist/toolbar/stylesheet.d.ts +3 -1
  57. package/dist/toolbar/utils/index.d.ts +3 -3
  58. package/dist/types/global-api.d.ts +22 -33
  59. package/dist/types/hooks.d.ts +32 -34
  60. package/dist/types/messaging.d.ts +2 -2
  61. package/dist/types/rpc.d.ts +3 -6
  62. package/dist/types/timeline.d.ts +3 -3
  63. package/dist/types/toolbar.d.ts +1 -1
  64. package/dist/ui/components/icon.d.ts +3 -4
  65. package/dist/ui/components/popover.d.ts +1 -1
  66. package/dist/ui/components/tabs.d.ts +1 -1
  67. package/dist/ui/components/tooltip.d.ts +1 -1
  68. package/dist/ui/index.js +1 -1
  69. package/dist/utils/cn.d.ts +3 -3
  70. package/dist/vite/inject-source.d.ts +0 -1
  71. package/dist/vite/matcher.d.ts +2 -1
  72. package/dist/vite-plugin.d.ts +5 -5
  73. package/dist/vite-plugin.js +2 -2
  74. package/package.json +4 -3
  75. package/dist/packem_shared/Popover-o3Vkvndp.js +0 -1
  76. package/dist/packem_shared/Tabs-BBc4S-2T.js +0 -1
  77. package/dist/packem_shared/TimelineStore-BgBrirKd.js +0 -1
  78. package/dist/packem_shared/Tooltip-BwK-2I9P.js +0 -1
  79. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +0 -1
  80. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +0 -1
  81. package/dist/packem_shared/createServerRPCContext-CRd6VAWp.js +0 -1
  82. package/dist/packem_shared/sharedToolbarStylesheet-DHHoFz2-.js +0 -2
  83. package/dist/packem_shared/store-BxE0w51s.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import type { ComponentChildren } from "preact";
2
2
  import type { DevToolbarAppState } from "../../types/index.d.ts";
3
3
  interface DevPanelProps {
4
- activeAppId: string | null;
4
+ activeAppId: string | undefined;
5
5
  apps: DevToolbarAppState[];
6
6
  onClose: () => void;
7
7
  onToggleApp: (appId: string) => Promise<void>;
@@ -5,7 +5,7 @@ interface ToolbarContainerProps {
5
5
  /**
6
6
  * Active app ID
7
7
  */
8
- activeAppId: string | null;
8
+ activeAppId: string | undefined;
9
9
  /**
10
10
  * Initial apps
11
11
  */
@@ -1,10 +1,10 @@
1
1
  import type { ComponentChildren } from "preact";
2
2
  /**
3
- * Shows a red error button in the toolbar when @visulima/vite-overlay errors exist.
3
+ * Shows a red error button in the toolbar when `@visulima/vite-overlay` errors exist.
4
4
  * Clicking toggles the vite-overlay panel visibility.
5
5
  *
6
6
  * Only rendered when:
7
- * - @visulima/vite-overlay is installed and active (window.ErrorOverlay is defined)
7
+ * - `@visulima/vite-overlay` is installed and active (window.ErrorOverlay is defined)
8
8
  * - At least one error is present in the history
9
9
  *
10
10
  * Renders with its own left separator so it stays visually grouped on the
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource preact */
1
2
  import { createContext } from "preact";
2
3
  import type { DevToolbarAppState, ToolbarPlacement } from "../../types/index.d.ts";
3
4
  /**
@@ -14,29 +15,29 @@ export interface PinnedTooltip {
14
15
  initialY: number;
15
16
  }
16
17
  /**
17
- * Toolbar context state
18
+ * Shared state and actions exposed by the ToolbarContext.
18
19
  */
19
20
  export interface ToolbarContextState {
20
21
  /**
21
22
  * Currently active app ID
22
23
  */
23
- activeAppId: string | null;
24
+ activeAppId: string | undefined;
24
25
  /**
25
26
  * All registered apps
26
27
  */
27
28
  apps: DevToolbarAppState[];
28
29
  /**
29
- * Clear app notification
30
+ * Clears the notification badge for an app.
30
31
  */
31
32
  clearNotification: (appId: string) => void;
32
33
  /**
33
34
  * Currently hovered app (has a tooltip component)
34
35
  */
35
- hoveredApp: DevToolbarAppState | null;
36
+ hoveredApp: DevToolbarAppState | undefined;
36
37
  /**
37
38
  * Viewport rect of the hovered app button (for tooltip positioning)
38
39
  */
39
- hoveredAppRect: DOMRect | null;
40
+ hoveredAppRect: DOMRect | undefined;
40
41
  /**
41
42
  * Whether toolbar is being dragged
42
43
  */
@@ -59,48 +60,48 @@ export interface ToolbarContextState {
59
60
  */
60
61
  placement: ToolbarPlacement;
61
62
  /**
62
- * Register an app
63
+ * Registers an app with the toolbar.
63
64
  */
64
65
  registerApp: (app: DevToolbarAppState) => void;
65
66
  /**
66
- * Set dragging state
67
+ * Sets the dragging state.
67
68
  */
68
69
  setDragging: (dragging: boolean) => void;
69
70
  /**
70
- * Set/clear the hovered app. Pass null to start the leave debounce.
71
+ * Sets or clears the hovered app. Pass undefined to start the leave debounce.
71
72
  */
72
- setHoveredApp: (app: DevToolbarAppState | null, rect?: DOMRect | null) => void;
73
+ setHoveredApp: (app: DevToolbarAppState | undefined, rect?: DOMRect | undefined) => void;
73
74
  /**
74
- * Set app notification
75
+ * Sets a notification for an app.
75
76
  */
76
77
  setNotification: (appId: string, state: boolean, level?: "info" | "warning" | "error") => void;
77
78
  /**
78
- * Set toolbar placement
79
+ * Sets the toolbar placement.
79
80
  */
80
81
  setPlacement: (placement: ToolbarPlacement) => void;
81
82
  /**
82
- * Set toolbar visibility
83
+ * Sets toolbar visibility.
83
84
  */
84
85
  setVisible: (visible: boolean) => void;
85
86
  /**
86
- * Toggle an app
87
+ * Toggles an app's active state.
87
88
  */
88
89
  toggleApp: (appId: string) => Promise<void>;
89
90
  /**
90
- * Remove a pinned tooltip by its instance id.
91
+ * Removes a pinned tooltip by its instance id.
91
92
  */
92
93
  unpinTooltip: (id: string) => void;
93
94
  /**
94
- * Unregister an app
95
+ * Unregisters an app.
95
96
  */
96
97
  unregisterApp: (appId: string) => void;
97
98
  }
98
99
  /**
99
- * Toolbar context
100
+ * Preact context object that exposes the toolbar's shared state to all child components.
100
101
  */
101
- export declare const ToolbarContext: ReturnType<typeof createContext<ToolbarContextState | null>>;
102
+ export declare const ToolbarContext: ReturnType<typeof createContext<ToolbarContextState | undefined>>;
102
103
  /**
103
- * Hook to access toolbar context
104
- * @throws Error if used outside ToolbarContext provider
104
+ * Accesses the toolbar context, throwing if used outside a provider.
105
+ * @throws Error if used outside ToolbarContext provider.
105
106
  */
106
107
  export declare const useToolbarContext: () => ToolbarContextState;
@@ -1,7 +1,7 @@
1
1
  import type { VisulimaDevTools } from "../types/global-api.d.ts";
2
2
  import type { DevToolbarApp } from "../types/index.d.ts";
3
3
  /**
4
- * Global DevTools API implementation.
4
+ * Creates the global DevTools API implementation.
5
5
  */
6
6
  export declare const createGlobalAPI: (appManager: {
7
7
  clearNotification: (id: string) => void;
@@ -18,7 +18,7 @@ export declare const createGlobalAPI: (appManager: {
18
18
  toggle: () => void;
19
19
  }) => VisulimaDevTools;
20
20
  /**
21
- * Setup global API on window object
22
- * @param api API instance
21
+ * Mounts the global API on the window object so it can be accessed from outside the toolbar.
22
+ * @param api API instance to expose globally.
23
23
  */
24
24
  export declare const setupGlobalAPI: (api: VisulimaDevTools) => void;
@@ -1,6 +1,8 @@
1
1
  import type { ServerHelpers } from "../types/app.d.ts";
2
2
  /**
3
- * Create server helpers for apps
4
- * @returns Server helpers instance
3
+ * Creates server helpers that proxy RPC calls for use within app init().
4
+ * @returns Server helpers instance.
5
5
  */
6
- export declare const createServerHelpers: () => ServerHelpers;
6
+ declare const createServerHelpers: () => ServerHelpers;
7
+ export { createServerHelpers };
8
+ export default createServerHelpers;
@@ -1,9 +1,9 @@
1
1
  import type { DevToolbarAppState } from "../../types/index.d.ts";
2
2
  /**
3
- * Hook for app management - exposes context app methods directly
3
+ * Exposes app management methods from the toolbar context.
4
4
  */
5
- export declare const useApps: () => {
6
- activeAppId: string | null;
5
+ declare const useApps: () => {
6
+ activeAppId: string | undefined;
7
7
  apps: DevToolbarAppState[];
8
8
  clearNotification: (appId: string) => void;
9
9
  registerApp: (app: DevToolbarAppState) => void;
@@ -11,3 +11,5 @@ export declare const useApps: () => {
11
11
  toggleApp: (appId: string) => Promise<void>;
12
12
  unregisterApp: (appId: string) => void;
13
13
  };
14
+ export { useApps };
15
+ export default useApps;
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * Keyboard shortcut bindings
3
3
  */
4
- export interface KeyBindings {
4
+ interface KeyBindings {
5
5
  /** Close active app / panel */
6
6
  close: string;
7
7
  /** Toggle toolbar panel open/closed */
8
8
  toggle: string;
9
9
  }
10
- export declare const DEFAULT_KEYBINDINGS: KeyBindings;
10
+ declare const DEFAULT_KEYBINDINGS: KeyBindings;
11
11
  /**
12
- * Frame state interface
12
+ * Persistent state for the devtools panel frame.
13
13
  */
14
- export interface DevToolsFrameState {
14
+ interface DevToolsFrameState {
15
15
  /**
16
16
  * Close panel on outside click
17
17
  */
@@ -74,21 +74,27 @@ export interface DevToolsFrameState {
74
74
  width: number;
75
75
  }
76
76
  /**
77
- * Return type for useFrameState hook
77
+ * Default frame state - matches Vue DevTools exactly
78
78
  */
79
- export interface UseFrameStateReturn {
79
+ declare const DEFAULT_STATE: DevToolsFrameState;
80
+ /**
81
+ * Return type for the useFrameState hook.
82
+ */
83
+ interface UseFrameStateReturn {
80
84
  /**
81
- * Current frame state
85
+ * Current frame state.
82
86
  */
83
87
  state: DevToolsFrameState;
84
88
  /**
85
- * Update state with partial values
89
+ * Updates state with partial values.
86
90
  */
87
91
  updateState: (value: Partial<DevToolsFrameState>) => void;
88
92
  }
89
93
  /**
90
- * Hook for frame state management.
94
+ * Manages the shared devtools frame state.
91
95
  * All callers share the same module-level state so position, open, and other
92
96
  * fields stay in sync regardless of how many times the hook is called.
93
97
  */
94
- export declare const useFrameState: () => UseFrameStateReturn;
98
+ declare const useFrameState: () => UseFrameStateReturn;
99
+ export type { DevToolsFrameState, KeyBindings, UseFrameStateReturn };
100
+ export { DEFAULT_KEYBINDINGS, DEFAULT_STATE, useFrameState };
@@ -1,21 +1,23 @@
1
1
  /**
2
- * Return type for usePanelVisible hook
2
+ * Return type for the usePanelVisible hook.
3
3
  */
4
- export interface UsePanelVisibleReturn {
4
+ interface UsePanelVisibleReturn {
5
5
  /**
6
- * Close panel
6
+ * Closes the panel.
7
7
  */
8
8
  closePanel: () => void;
9
9
  /**
10
- * Whether panel is visible
10
+ * Whether the panel is currently visible.
11
11
  */
12
12
  panelVisible: boolean;
13
13
  /**
14
- * Toggle panel visibility
14
+ * Toggles panel visibility, optionally forcing a specific state.
15
15
  */
16
16
  togglePanelVisible: (_?: unknown, newState?: boolean) => void;
17
17
  }
18
18
  /**
19
- * Hook for panel visibility management - converted from Vue DevTools usePanelVisible
19
+ * Manages panel visibility with keyboard shortcut support.
20
20
  */
21
- export declare const usePanelVisible: () => UsePanelVisibleReturn;
21
+ declare const usePanelVisible: () => UsePanelVisibleReturn;
22
+ export type { UsePanelVisibleReturn };
23
+ export { usePanelVisible };
@@ -1,8 +1,8 @@
1
1
  import type { RefObject } from "preact";
2
2
  /**
3
- * Return type for usePosition hook
3
+ * Return type for usePosition hook.
4
4
  */
5
- export interface UsePositionReturn {
5
+ interface UsePositionReturn {
6
6
  anchorStyle: {
7
7
  left: string;
8
8
  top: string;
@@ -12,11 +12,13 @@ export interface UsePositionReturn {
12
12
  isDragging: boolean;
13
13
  isHidden: boolean;
14
14
  isVertical: boolean;
15
- onPointerDown: (e: PointerEvent) => void;
15
+ onPointerDown: (event: PointerEvent) => void;
16
16
  panelStyle: Record<string, string>;
17
17
  }
18
18
  /**
19
- * Hook for position management - converted from Vue DevTools usePosition
19
+ * Manages the draggable toolbar position, converted from Vue DevTools usePosition.
20
20
  * @see https://github.com/vuejs/devtools/blob/main/packages/overlay/src/composables/position.ts
21
21
  */
22
- export declare const usePosition: (panelElement: RefObject<HTMLElement>) => UsePositionReturn;
22
+ declare const usePosition: (panelElement: RefObject<HTMLElement>) => UsePositionReturn;
23
+ export type { UsePositionReturn };
24
+ export { usePosition };
@@ -1,13 +1,15 @@
1
- export type Theme = "light" | "dark" | "system";
2
- export interface UseThemeReturn {
1
+ type Theme = "light" | "dark" | "system";
2
+ interface UseThemeReturn {
3
3
  resolvedTheme: "light" | "dark";
4
4
  setTheme: (newTheme: Theme) => void;
5
5
  theme: Theme;
6
6
  toggleTheme: () => void;
7
7
  }
8
8
  /**
9
- * Hook for managing theme (light/dark mode).
9
+ * Manages the shared light/dark/system theme preference.
10
10
  * All callers share the same module-level state so theme changes propagate
11
11
  * to every component (ToolbarContainer, SettingsApp, etc.) immediately.
12
12
  */
13
- export declare const useTheme: () => UseThemeReturn;
13
+ declare const useTheme: () => UseThemeReturn;
14
+ export type { Theme, UseThemeReturn };
15
+ export { useTheme };
@@ -1,8 +1,8 @@
1
1
  import type { ToolbarPlacement } from "../../types/index.d.ts";
2
2
  /**
3
- * Hook for toolbar visibility and placement - exposes context methods directly
3
+ * Exposes toolbar visibility and placement controls from the toolbar context.
4
4
  */
5
- export declare const useToolbar: () => {
5
+ declare const useToolbar: () => {
6
6
  hide: () => void;
7
7
  isDragging: boolean;
8
8
  isVisible: boolean;
@@ -12,3 +12,5 @@ export declare const useToolbar: () => {
12
12
  show: () => void;
13
13
  toggle: () => void;
14
14
  };
15
+ export { useToolbar };
16
+ export default useToolbar;
@@ -1,7 +1,7 @@
1
1
  import type { DevToolbarApp } from "../types/index.d.ts";
2
2
  import { AppManager } from "./app-manager.d.ts";
3
3
  /**
4
- * Dev Toolbar Web Component
4
+ * Dev Toolbar Web Component.
5
5
  */
6
6
  export declare class DevToolbar extends HTMLElement {
7
7
  private appManager;
@@ -10,13 +10,13 @@ export declare class DevToolbar extends HTMLElement {
10
10
  private renderRoot;
11
11
  constructor();
12
12
  /**
13
- * Called when element is inserted into the DOM
14
- * According to Preact docs, rendering should happen here or after connection
13
+ * Called when element is inserted into the DOM.
14
+ * According to Preact docs, rendering should happen here or after connection.
15
15
  */
16
16
  connectedCallback(): void;
17
17
  /**
18
- * Called when element is removed from the DOM
19
- * Clean up Preact component to prevent memory leaks
18
+ * Called when element is removed from the DOM.
19
+ * Cleans up the Preact component to prevent memory leaks.
20
20
  */
21
21
  disconnectedCallback(): void;
22
22
  /**
@@ -32,7 +32,7 @@ export declare class DevToolbar extends HTMLElement {
32
32
  */
33
33
  setToolbarVisible(visible: boolean): void;
34
34
  /**
35
- * Register an app.
35
+ * Adds an app to the toolbar and triggers a re-render.
36
36
  */
37
37
  registerApp(app: DevToolbarApp, builtIn?: boolean): void;
38
38
  /**
@@ -40,17 +40,11 @@ export declare class DevToolbar extends HTMLElement {
40
40
  */
41
41
  getAppManager(): AppManager;
42
42
  /**
43
- * Inject Geist font into document.head once.
44
- * @font-face declared in the document is part of the global font registry and
45
- * is accessible from within shadow DOM roots — no duplication needed.
46
- */
47
- private static injectFont;
48
- /**
49
- * Render the toolbar UI using Preact
43
+ * Renders the toolbar UI using Preact.
50
44
  */
51
45
  private render;
52
46
  /**
53
- * Setup event listeners.
47
+ * Attaches global keyboard shortcuts and other DOM event listeners.
54
48
  */
55
49
  private setupEventListeners;
56
50
  }