@visulima/dev-toolbar 1.0.0-alpha.12 → 1.0.0-alpha.14

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 (123) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +21 -0
  3. package/dist/apps/a11y/index.d.ts +3 -2
  4. package/dist/apps/a11y/index.js +1 -1
  5. package/dist/apps/annotations/index.d.ts +3 -2
  6. package/dist/apps/annotations/index.js +1 -1
  7. package/dist/apps/assets/index.d.ts +3 -2
  8. package/dist/apps/assets/index.js +1 -1
  9. package/dist/apps/inspector/index.d.ts +3 -2
  10. package/dist/apps/inspector/index.js +1 -1
  11. package/dist/apps/module-graph/index.d.ts +3 -2
  12. package/dist/apps/module-graph/index.js +1 -1
  13. package/dist/apps/performance/index.d.ts +3 -2
  14. package/dist/apps/performance/index.js +1 -1
  15. package/dist/apps/seo/index.d.ts +3 -2
  16. package/dist/apps/seo/index.js +1 -1
  17. package/dist/apps/settings/index.d.ts +3 -2
  18. package/dist/apps/settings/index.js +1 -1
  19. package/dist/apps/tailwind/index.d.ts +3 -2
  20. package/dist/apps/timeline/index.d.ts +3 -2
  21. package/dist/apps/timeline/index.js +1 -1
  22. package/dist/apps/vite-config/index.d.ts +3 -2
  23. package/dist/apps/vite-config/index.js +1 -1
  24. package/dist/client/overlay.d.ts +1 -1
  25. package/dist/index.d.ts +143 -8
  26. package/dist/mcp/server.d.ts +2 -12
  27. package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
  28. package/dist/packem_shared/global-api.d-BLfn-OUA.d.ts +547 -0
  29. package/dist/packem_shared/{sharedToolbarStylesheet-CaTdYhVe.js → sharedToolbarStylesheet-Bx1muJAh.js} +1 -1
  30. package/dist/toolbar/index.d.ts +152 -48
  31. package/dist/toolbar/index.js +1 -1
  32. package/dist/ui/index.d.ts +382 -18
  33. package/dist/vite-plugin.d.ts +155 -146
  34. package/package.json +4 -4
  35. package/dist/apps/a11y/a11y-app.d.ts +0 -4
  36. package/dist/apps/a11y/a11y-store.d.ts +0 -42
  37. package/dist/apps/a11y/a11y-tooltip.d.ts +0 -10
  38. package/dist/apps/annotations/annotations-app.d.ts +0 -4
  39. package/dist/apps/assets/assets-app.d.ts +0 -4
  40. package/dist/apps/inspector/a11y-capture.d.ts +0 -12
  41. package/dist/apps/inspector/annotation-overlay.d.ts +0 -55
  42. package/dist/apps/inspector/annotation-settings.d.ts +0 -33
  43. package/dist/apps/inspector/element-utils.d.ts +0 -115
  44. package/dist/apps/inspector/freeze-animations.d.ts +0 -22
  45. package/dist/apps/inspector/inspector-app.d.ts +0 -14
  46. package/dist/apps/inspector/rulers.d.ts +0 -14
  47. package/dist/apps/inspector/theme-palette.d.ts +0 -34
  48. package/dist/apps/module-graph/module-graph-app.d.ts +0 -4
  49. package/dist/apps/performance/performance-app.d.ts +0 -4
  50. package/dist/apps/performance/performance-tooltip.d.ts +0 -4
  51. package/dist/apps/seo/seo-app.d.ts +0 -4
  52. package/dist/apps/settings/settings-app.d.ts +0 -4
  53. package/dist/apps/tailwind/tailwind-app.d.ts +0 -4
  54. package/dist/apps/timeline/timeline-app.d.ts +0 -4
  55. package/dist/apps/vite-config/vite-config-app.d.ts +0 -4
  56. package/dist/hooks/create-hook.d.ts +0 -12
  57. package/dist/hooks/events.d.ts +0 -7
  58. package/dist/hooks/global-hook.d.ts +0 -15
  59. package/dist/hooks/index.d.ts +0 -6
  60. package/dist/performance/monitor.d.ts +0 -116
  61. package/dist/rpc/client.d.ts +0 -9
  62. package/dist/rpc/functions/annotations.d.ts +0 -28
  63. package/dist/rpc/functions/assets.d.ts +0 -16
  64. package/dist/rpc/functions/module-graph.d.ts +0 -17
  65. package/dist/rpc/functions/open-in-editor.d.ts +0 -16
  66. package/dist/rpc/functions/tailwind-config.d.ts +0 -15
  67. package/dist/rpc/functions/vite-config.d.ts +0 -83
  68. package/dist/rpc/server.d.ts +0 -15
  69. package/dist/store/annotation-store.d.ts +0 -41
  70. package/dist/timeline/capture.d.ts +0 -8
  71. package/dist/timeline/index.d.ts +0 -8
  72. package/dist/timeline/store.d.ts +0 -42
  73. package/dist/toolbar/app-manager.d.ts +0 -104
  74. package/dist/toolbar/components/app-button.d.ts +0 -18
  75. package/dist/toolbar/components/app-canvas.d.ts +0 -12
  76. package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -12
  77. package/dist/toolbar/components/first-visit-hint.d.ts +0 -15
  78. package/dist/toolbar/components/index.d.ts +0 -4
  79. package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -22
  80. package/dist/toolbar/components/toolbar-bar.d.ts +0 -9
  81. package/dist/toolbar/components/toolbar-container.d.ts +0 -49
  82. package/dist/toolbar/components/vite-overlay-button.d.ts +0 -14
  83. package/dist/toolbar/context/index.d.ts +0 -2
  84. package/dist/toolbar/context/toolbar-context.d.ts +0 -107
  85. package/dist/toolbar/global-api.d.ts +0 -24
  86. package/dist/toolbar/helpers.d.ts +0 -8
  87. package/dist/toolbar/hooks/index.d.ts +0 -10
  88. package/dist/toolbar/hooks/use-apps.d.ts +0 -15
  89. package/dist/toolbar/hooks/use-frame-state.d.ts +0 -110
  90. package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -23
  91. package/dist/toolbar/hooks/use-position.d.ts +0 -24
  92. package/dist/toolbar/hooks/use-theme.d.ts +0 -15
  93. package/dist/toolbar/hooks/use-toolbar.d.ts +0 -16
  94. package/dist/toolbar/settings.d.ts +0 -17
  95. package/dist/toolbar/stylesheet.d.ts +0 -3
  96. package/dist/toolbar/utils/index.d.ts +0 -12
  97. package/dist/types/annotations.d.ts +0 -156
  98. package/dist/types/app.d.ts +0 -175
  99. package/dist/types/global-api.d.ts +0 -91
  100. package/dist/types/hooks.d.ts +0 -86
  101. package/dist/types/index.d.ts +0 -13
  102. package/dist/types/messaging.d.ts +0 -43
  103. package/dist/types/rpc.d.ts +0 -137
  104. package/dist/types/timeline.d.ts +0 -62
  105. package/dist/types/toolbar.d.ts +0 -56
  106. package/dist/ui/components/alert.d.ts +0 -19
  107. package/dist/ui/components/badge.d.ts +0 -9
  108. package/dist/ui/components/button.d.ts +0 -11
  109. package/dist/ui/components/card.d.ts +0 -16
  110. package/dist/ui/components/icon.d.ts +0 -19
  111. package/dist/ui/components/input.d.ts +0 -7
  112. package/dist/ui/components/label.d.ts +0 -7
  113. package/dist/ui/components/popover.d.ts +0 -27
  114. package/dist/ui/components/progress.d.ts +0 -7
  115. package/dist/ui/components/select.d.ts +0 -54
  116. package/dist/ui/components/separator.d.ts +0 -8
  117. package/dist/ui/components/skeleton.d.ts +0 -6
  118. package/dist/ui/components/switch.d.ts +0 -11
  119. package/dist/ui/components/tabs.d.ts +0 -28
  120. package/dist/ui/components/textarea.d.ts +0 -7
  121. package/dist/ui/components/tooltip.d.ts +0 -19
  122. package/dist/vite/inject-source.d.ts +0 -24
  123. package/dist/vite/matcher.d.ts +0 -6
@@ -1,12 +0,0 @@
1
- /**
2
- * Clamps a value between min and max.
3
- */
4
- export declare const clamp: (value: number, min: number, max: number) => number;
5
- /**
6
- * Returns true when the current browser is Safari.
7
- */
8
- export declare const checkIsSafari: () => boolean;
9
- /**
10
- * Converts a pixel string value to a number (e.g. "10px" becomes 10).
11
- */
12
- export declare const pixelToNumber: (value: string | number) => number;
@@ -1,156 +0,0 @@
1
- /**
2
- * Annotation intent — describes what the user wants to communicate.
3
- */
4
- export type AnnotationIntent = "approve" | "change" | "fix" | "question";
5
- /**
6
- * Annotation severity — how urgent or important the annotation is.
7
- */
8
- export type AnnotationSeverity = "blocking" | "important" | "suggestion";
9
- /**
10
- * Annotation status — lifecycle state.
11
- */
12
- export type AnnotationStatus = "acknowledged" | "dismissed" | "pending" | "resolved";
13
- /**
14
- * A single message in a conversation thread attached to an annotation.
15
- */
16
- export interface ThreadMessage {
17
- /** Message text */
18
- content: string;
19
- /** Unique message identifier */
20
- id?: string;
21
- /** Who wrote it — e.g. "human", "agent", or a specific agent name */
22
- role: string;
23
- /** ISO 8601 timestamp */
24
- timestamp: string;
25
- }
26
- /**
27
- * Bounding box of the annotated element relative to the viewport.
28
- */
29
- export interface BoundingBox {
30
- height: number;
31
- width: number;
32
- x: number;
33
- y: number;
34
- }
35
- /**
36
- * Detected framework component information.
37
- */
38
- export interface FrameworkContext {
39
- /** Component name */
40
- componentName?: string;
41
- /** Full component stack (e.g. ["App", "Layout", "Header", "Button"]) */
42
- componentStack?: string[];
43
- /** Additional framework-specific data (e.g. props) */
44
- data?: Record<string, unknown>;
45
- /** Framework identifier (react, vue, svelte, etc.) */
46
- framework: string;
47
- /** Source file path */
48
- sourceFile?: string;
49
- /** Source line number */
50
- sourceLine?: number;
51
- }
52
- /**
53
- * Captured accessibility attributes for an element.
54
- */
55
- export interface AccessibilityInfo {
56
- /** aria-describedby content */
57
- ariaDescribedBy?: string;
58
- /** aria-label value */
59
- ariaLabel?: string;
60
- /** Whether the element is focusable */
61
- focusable: boolean;
62
- /** ARIA role (explicit or implicit) */
63
- role?: string;
64
- /** tabindex value */
65
- tabindex?: number;
66
- }
67
- /**
68
- * A visual annotation placed on a page element during development.
69
- * Stored in `.devtoolbar/annotations.json`.
70
- */
71
- export interface Annotation {
72
- /** Captured accessibility attributes */
73
- accessibility?: AccessibilityInfo;
74
- /** Element bounding box at annotation time */
75
- boundingBox?: BoundingBox;
76
- /** User feedback / description */
77
- comment: string;
78
- /** Key computed CSS properties for forensic context */
79
- computedStyles?: string;
80
- /** ISO 8601 creation timestamp */
81
- createdAt: string;
82
- /** CSS classes on the annotated element (module hashes cleaned) */
83
- cssClasses?: string;
84
- /** Bounding boxes for multi-select annotations */
85
- elementBoundingBoxes?: BoundingBox[];
86
- /** Human-readable element label (e.g. 'button "Submit"') */
87
- elementLabel?: string;
88
- /** CSS selector path to the element */
89
- elementPath?: string;
90
- /** HTML tag name of the annotated element */
91
- elementTag: string;
92
- /** Detected framework component context */
93
- frameworkContext?: FrameworkContext;
94
- /** Full DOM ancestry path (e.g. "body > main > article > p") */
95
- fullPath?: string;
96
- /** Unique identifier (crypto.randomUUID) */
97
- id: string;
98
- /** What the user wants — fix, change, question, or approve */
99
- intent: AnnotationIntent;
100
- /** Whether the element has fixed/sticky positioning */
101
- isFixed?: boolean;
102
- /** Whether this is a multi-select (drag) annotation */
103
- isMultiSelect?: boolean;
104
- /** Sibling elements for spatial context */
105
- nearbyElements?: string;
106
- /** Text near the annotated element for additional context */
107
- nearbyText?: string;
108
- /** ISO 8601 resolution timestamp */
109
- resolvedAt?: string;
110
- /** Who resolved it — "human" or "agent" (or a specific agent name) */
111
- resolvedBy?: string;
112
- /** Path to screenshot file relative to .devtoolbar/ (e.g. "screenshots/&lt;id>.png") */
113
- screenshot?: string;
114
- /** Text the user had selected when annotating */
115
- selectedText?: string;
116
- /** Severity level */
117
- severity: AnnotationSeverity;
118
- /** Source file location from data-vdt-source (file:line:col) */
119
- source?: string;
120
- /** Lifecycle status */
121
- status: AnnotationStatus;
122
- /** Conversation thread (human ↔ AI agent) */
123
- thread?: ThreadMessage[];
124
- /** ISO 8601 last-updated timestamp */
125
- updatedAt: string;
126
- /** Page URL where the annotation was created */
127
- url: string;
128
- /** Click X as percentage of viewport width (0-100) — survives resize */
129
- x: number;
130
- /**
131
- * Click Y as absolute page position (pixels from document top) — survives scroll.
132
- * For fixed/sticky elements, Y is viewport-relative instead.
133
- */
134
- y: number;
135
- }
136
- /**
137
- * Data required to create a new annotation (server-generated fields omitted).
138
- */
139
- export type CreateAnnotationData = Omit<Annotation, "createdAt" | "id" | "resolvedAt" | "resolvedBy" | "status" | "thread" | "updatedAt">;
140
- /**
141
- * Fields that can be updated on an existing annotation.
142
- */
143
- export interface UpdateAnnotationData {
144
- /** Updated comment text */
145
- comment?: string;
146
- /** Updated intent */
147
- intent?: AnnotationIntent;
148
- /** Who resolved the annotation */
149
- resolvedBy?: string;
150
- /** Updated severity */
151
- severity?: AnnotationSeverity;
152
- /** New status */
153
- status?: AnnotationStatus;
154
- /** Append a thread message */
155
- threadMessage?: ThreadMessage;
156
- }
@@ -1,175 +0,0 @@
1
- import type { ComponentType } from "preact";
2
- import type { NotificationLevel } from "./toolbar.d.ts";
3
- /**
4
- * Server helpers available to apps
5
- */
6
- export interface ServerHelpers {
7
- /**
8
- * RPC client for calling server functions
9
- */
10
- rpc: {
11
- [K in keyof ServerFunctions]: ServerFunctions[K];
12
- };
13
- }
14
- /**
15
- * Props passed to app tooltip (hover mini-canvas) components.
16
- * Keep compact — tooltip components should be lightweight.
17
- */
18
- export interface AppTooltipProps {
19
- /**
20
- * Server helpers (RPC, etc.)
21
- */
22
- helpers: ServerHelpers;
23
- }
24
- /**
25
- * Event target for app communication
26
- */
27
- export interface ToolbarAppEventTarget extends EventTarget {
28
- /**
29
- * Dispatch a custom event
30
- */
31
- dispatchEvent: (event: Event) => boolean;
32
- }
33
- /**
34
- * App view configuration
35
- */
36
- export type AppView = {
37
- /**
38
- * Render app inline in shadow DOM (default)
39
- */
40
- type: "inline";
41
- } | {
42
- /**
43
- * URL to load in iframe
44
- */
45
- src: string;
46
- /**
47
- * Render app in iframe for isolation
48
- */
49
- type: "iframe";
50
- };
51
- /**
52
- * Props passed to Preact component apps
53
- */
54
- export interface AppComponentProps {
55
- /**
56
- * Event target for app communication
57
- */
58
- eventTarget: ToolbarAppEventTarget;
59
- /**
60
- * Server helpers (RPC, etc.)
61
- */
62
- helpers: ServerHelpers;
63
- }
64
- /**
65
- * Dev toolbar app definition
66
- */
67
- export interface DevToolbarApp {
68
- /**
69
- * Called before app is toggled off
70
- * Return false to prevent closing
71
- * @param canvas Shadow root of the app
72
- * @returns Whether to allow closing
73
- */
74
- beforeTogglingOff?: (canvas: ShadowRoot) => boolean | Promise<boolean>;
75
- /**
76
- * Preact component for rendering (alternative to init)
77
- * If provided, this will be used instead of init
78
- */
79
- component?: ComponentType<AppComponentProps>;
80
- /**
81
- * When true, this app is automatically activated when the toolbar opens for
82
- * the first time (or when no other app has been activated yet).
83
- * Only the first registered app with defaultOpen: true is used.
84
- * @default false
85
- */
86
- defaultOpen?: boolean;
87
- /**
88
- * Called when the app is unregistered / removed from the toolbar.
89
- * Use this for final cleanup (event listeners, timers, subscriptions).
90
- * @param canvas Shadow root of the app
91
- */
92
- destroy?: (canvas: ShadowRoot) => Promise<void> | void;
93
- /**
94
- * Icon HTML string (SVG)
95
- */
96
- icon: string;
97
- /**
98
- * Unique identifier for the app
99
- */
100
- id: string;
101
- /**
102
- * Initialize the app when opened (vanilla JS/CSS/HTML)
103
- * @param canvas Shadow root to render into
104
- * @param eventTarget Event target for app communication
105
- * @param helpers Server helpers (RPC, etc.)
106
- */
107
- init?: (canvas: ShadowRoot, eventTarget: ToolbarAppEventTarget, helpers: ServerHelpers) => void | Promise<void>;
108
- /**
109
- * Display name of the app
110
- */
111
- name: string;
112
- /**
113
- * Action button callback — called when the button is activated (active: false → true).
114
- * When present, clicking the toolbar button will NOT open a panel.
115
- * Instead the button toggles its active state and calls onClick (activate)
116
- * or onDeactivate (deactivate).
117
- */
118
- onClick?: () => Promise<void> | void;
119
- /**
120
- * Called when the action button is deactivated (active: true → false).
121
- * Only meaningful when onClick is also provided.
122
- */
123
- onDeactivate?: () => Promise<void> | void;
124
- /**
125
- * Optional hover tooltip component — renders a compact live preview when the
126
- * user hovers over this app's button in the toolbar pill.
127
- * The component should be small (≤280px wide) and self-contained.
128
- * If omitted, hovering shows the native title tooltip only.
129
- */
130
- tooltip?: ComponentType<AppTooltipProps>;
131
- /**
132
- * App rendering mode
133
- */
134
- view?: AppView;
135
- }
136
- /**
137
- * Internal app state (extends DevToolbarApp)
138
- */
139
- export interface DevToolbarAppState extends DevToolbarApp {
140
- /**
141
- * Whether the app is currently active/open
142
- */
143
- active: boolean;
144
- /**
145
- * Whether this is a built-in app
146
- */
147
- builtIn: boolean;
148
- /**
149
- * Event target for this app
150
- */
151
- eventTarget: ToolbarAppEventTarget;
152
- /**
153
- * Notification state
154
- */
155
- notification: {
156
- /**
157
- * Notification level
158
- */
159
- level?: NotificationLevel;
160
- /**
161
- * Whether notification is active
162
- */
163
- state: boolean;
164
- };
165
- /**
166
- * App initialization status
167
- */
168
- status: "ready" | "loading" | "pending" | "error";
169
- }
170
- /**
171
- * Placeholder for ServerFunctions (defined in rpc.ts)
172
- */
173
- export interface ServerFunctions {
174
- [key: string]: (...args: any[]) => Promise<any>;
175
- }
@@ -1,91 +0,0 @@
1
- import type { DevToolbarApp } from "./app.d.ts";
2
- import type { DevToolbarHook } from "./hooks.d.ts";
3
- import type { ServerFunctions } from "./rpc.d.ts";
4
- import type { ToolbarSettings } from "./toolbar.d.ts";
5
- /**
6
- * Global DevTools API interface.
7
- * Exposed as window.__VISULIMA_DEVTOOLS__
8
- */
9
- interface VisulimaDevTools {
10
- /**
11
- * Clears notification for an app.
12
- */
13
- clearNotification: (appId: string) => void;
14
- /**
15
- * Closes the currently active app.
16
- */
17
- closeApp: () => Promise<void>;
18
- /**
19
- * Gets the currently active app ID.
20
- */
21
- getActiveApp: () => string | undefined;
22
- /**
23
- * Gets all registered apps.
24
- */
25
- getApps: () => DevToolbarApp[];
26
- /**
27
- * Gets current toolbar settings.
28
- */
29
- getSettings: () => ToolbarSettings;
30
- /**
31
- * Hides the toolbar.
32
- */
33
- hide: () => void;
34
- /**
35
- * Hook instance for event subscriptions.
36
- */
37
- hook: DevToolbarHook;
38
- /**
39
- * Shows a notification for an app.
40
- */
41
- notify: (appId: string, level: "info" | "warning" | "error") => void;
42
- /**
43
- * Opens an app by ID.
44
- */
45
- openApp: (appId: string) => Promise<void>;
46
- /**
47
- * Registers a custom app.
48
- */
49
- registerApp: (app: DevToolbarApp) => void;
50
- /**
51
- * RPC client for calling server functions.
52
- */
53
- rpc: ServerFunctions;
54
- /**
55
- * Directly sets the active state of an action button without invoking callbacks.
56
- * Useful for deactivating a button from async work running outside the toolbar.
57
- */
58
- setAppActive: (appId: string, active: boolean) => void;
59
- /**
60
- * Shows the toolbar.
61
- */
62
- show: () => void;
63
- /**
64
- * Toggles toolbar visibility.
65
- */
66
- toggle: () => void;
67
- /**
68
- * Unregisters an app by ID.
69
- */
70
- unregisterApp: (appId: string) => void;
71
- /**
72
- * Updates toolbar settings.
73
- */
74
- updateSettings: (settings: Partial<ToolbarSettings>) => void;
75
- /**
76
- * Package version.
77
- */
78
- version: string;
79
- }
80
- /**
81
- * Global API declaration
82
- */
83
- declare global {
84
- interface Window {
85
- /**
86
- * Visulima DevTools global API.
87
- */
88
- __VISULIMA_DEVTOOLS__?: VisulimaDevTools;
89
- }
90
- }
91
- export type { VisulimaDevTools };
@@ -1,86 +0,0 @@
1
- import type { DevToolbarApp } from "./app.d.ts";
2
- import type { TimelineEvent } from "./timeline.d.ts";
3
- /**
4
- * Hook event definitions
5
- */
6
- interface HookEvents {
7
- [key: string]: (...args: any[]) => void;
8
- /**
9
- * App error occurred.
10
- * @param error Error object.
11
- * @param appId Optional app ID where error occurred.
12
- */
13
- "app:error": (error: Error, appId?: string) => void;
14
- /**
15
- * DevTools closed.
16
- */
17
- "devtools:close": () => void;
18
- /**
19
- * DevTools initialized.
20
- */
21
- "devtools:init": () => void;
22
- /**
23
- * DevTools opened.
24
- * @param appId ID of the opened app.
25
- */
26
- "devtools:open": (appId: string) => void;
27
- /**
28
- * Timeline event added.
29
- * @param event Timeline event.
30
- */
31
- "timeline:event": (event: TimelineEvent) => void;
32
- }
33
- /**
34
- * Dev toolbar hook interface.
35
- * Exposed as window.__DEV_TOOLBAR_HOOK__
36
- */
37
- interface DevToolbarHook {
38
- /**
39
- * Adds a timeline event.
40
- * @param groupId Timeline group ID.
41
- * @param event Timeline event.
42
- */
43
- addTimelineEvent: (groupId: string, event: TimelineEvent) => void;
44
- /**
45
- * Emits an event.
46
- * @param event Event name.
47
- * @param args Event arguments.
48
- */
49
- emit: <T extends keyof HookEvents>(event: T, ...args: Parameters<HookEvents[T]>) => void;
50
- /**
51
- * Unsubscribes from an event.
52
- * @param event Event name.
53
- * @param handler Optional specific handler to remove.
54
- */
55
- off: <T extends keyof HookEvents>(event: T, handler?: HookEvents[T]) => void;
56
- /**
57
- * Subscribes to an event.
58
- * @param event Event name.
59
- * @param handler Event handler.
60
- * @returns Unsubscribe function.
61
- */
62
- on: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => () => void;
63
- /**
64
- * Subscribes to an event once.
65
- * @param event Event name.
66
- * @param handler Event handler.
67
- */
68
- once: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => void;
69
- /**
70
- * Registers a custom app.
71
- * @param app App definition.
72
- */
73
- registerApp: (app: DevToolbarApp) => void;
74
- }
75
- /**
76
- * Global hook declaration
77
- */
78
- declare global {
79
- interface Window {
80
- /**
81
- * Dev toolbar hook for library integrations.
82
- */
83
- __DEV_TOOLBAR_HOOK__?: DevToolbarHook;
84
- }
85
- }
86
- export type { DevToolbarHook, HookEvents };
@@ -1,13 +0,0 @@
1
- /**
2
- * Public type exports
3
- */
4
- export type { AccessibilityInfo, Annotation, AnnotationIntent, AnnotationSeverity, AnnotationStatus, BoundingBox, CreateAnnotationData, FrameworkContext, ThreadMessage, UpdateAnnotationData, } from "./annotations.d.ts";
5
- export type { AppView, DevToolbarApp, DevToolbarAppState, ServerFunctions, ServerHelpers, ToolbarAppEventTarget } from "./app.d.ts";
6
- export type { VisulimaDevTools } from "./global-api.d.ts";
7
- export type { DevToolbarHook, HookEvents } from "./hooks.d.ts";
8
- export type { ChannelFactory, MessageChannel, MessageChannelContext } from "./messaging.d.ts";
9
- export type { ClientRPCContext, ClientFunctions as RPCClientFunctions, ServerFunctions as RPCServerFunctions, ServerRPCContext } from "./rpc.d.ts";
10
- export type { TimelineEvent, TimelineEventLevel, TimelineGroup } from "./timeline.d.ts";
11
- export { DEFAULT_TIMELINE_GROUPS } from "./timeline.d.ts";
12
- export type { FrameState, NotificationLevel, PositionAnchor, ToolbarPlacement, ToolbarSettings } from "./toolbar.d.ts";
13
- export { DEFAULT_TOOLBAR_SETTINGS } from "./toolbar.d.ts";
@@ -1,43 +0,0 @@
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
- * Factory result providing a method to instantiate named message channels.
37
- */
38
- export interface MessageChannelContext<TEvents extends Record<string, (...args: any[]) => void>> {
39
- /**
40
- * Creates and returns a new channel instance.
41
- */
42
- createChannel: () => MessageChannel<TEvents>;
43
- }