@visulima/dev-toolbar 1.0.10 → 1.0.11

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.
@@ -1,150 +1,139 @@
1
- import { D as DevToolbarApp, T as ToolbarSettings } from "./app.d-SmKEDxsI.js";
1
+ import { D as DevToolbarApp, T as ToolbarSettings } from "./app.d-BV5WIojP.js";
2
2
  import { ViteDevServer } from 'vite';
3
3
  /**
4
- * Severity levels for timeline events.
5
- */
4
+ * Severity levels for timeline events.
5
+ */
6
6
  type TimelineEventLevel = "info" | "warning" | "error";
7
7
  /**
8
- * A single captured event displayed in the timeline panel.
9
- */
8
+ * A single captured event displayed in the timeline panel.
9
+ */
10
10
  interface TimelineEvent {
11
11
  /**
12
- * Optional event data
13
- */
12
+ * Optional event data
13
+ */
14
14
  data?: Record<string, any>;
15
15
  /**
16
- * Optional duration (milliseconds)
17
- */
16
+ * Optional duration (milliseconds)
17
+ */
18
18
  duration?: number;
19
19
  /**
20
- * Unique event ID
21
- */
20
+ * Unique event ID
21
+ */
22
22
  id: string;
23
23
  /**
24
- * Event level
25
- */
24
+ * Event level
25
+ */
26
26
  level?: TimelineEventLevel;
27
27
  /**
28
- * Optional subtitle
29
- */
28
+ * Optional subtitle
29
+ */
30
30
  subtitle?: string;
31
31
  /**
32
- * Timestamp (milliseconds since epoch)
33
- */
32
+ * Timestamp (milliseconds since epoch)
33
+ */
34
34
  time: number;
35
35
  /**
36
- * Event title
37
- */
36
+ * Event title
37
+ */
38
38
  title: string;
39
39
  }
40
40
  /**
41
- * A named group that holds related timeline events.
42
- */
41
+ * A named group that holds related timeline events.
42
+ */
43
43
  interface TimelineGroup {
44
44
  /**
45
- * Group color (hex or CSS color)
46
- */
45
+ * Group color (hex or CSS color)
46
+ */
47
47
  color?: string;
48
48
  /**
49
- * Events in this group
50
- */
49
+ * Events in this group
50
+ */
51
51
  events: TimelineEvent[];
52
52
  /**
53
- * Group ID
54
- */
53
+ * Group ID
54
+ */
55
55
  id: string;
56
56
  /**
57
- * Group label
58
- */
57
+ * Group label
58
+ */
59
59
  label: string;
60
60
  }
61
61
  /**
62
- * Default timeline groups
63
- */
62
+ * Default timeline groups
63
+ */
64
64
  declare const DEFAULT_TIMELINE_GROUPS: ReadonlyArray<TimelineGroup>;
65
65
  /**
66
- * Hook event definitions
67
- */
66
+ * Hook event definitions
67
+ */
68
68
  interface HookEvents {
69
69
  [key: string]: (...args: any[]) => void;
70
70
  /**
71
- * App error occurred.
72
- * @param error Error object.
73
- * @param appId Optional app ID where error occurred.
74
- */
71
+ * App error occurred.
72
+ * @param error Error object.
73
+ * @param appId Optional app ID where error occurred.
74
+ */
75
75
  "app:error": (error: Error, appId?: string) => void;
76
76
  /**
77
- * DevTools closed.
78
- */
77
+ * DevTools closed.
78
+ */
79
79
  "devtools:close": () => void;
80
80
  /**
81
- * DevTools initialized.
82
- */
81
+ * DevTools initialized.
82
+ */
83
83
  "devtools:init": () => void;
84
84
  /**
85
- * DevTools opened.
86
- * @param appId ID of the opened app.
87
- */
85
+ * DevTools opened.
86
+ * @param appId ID of the opened app.
87
+ */
88
88
  "devtools:open": (appId: string) => void;
89
89
  /**
90
- * Timeline event added.
91
- * @param event Timeline event.
92
- */
90
+ * Timeline event added.
91
+ * @param event Timeline event.
92
+ */
93
93
  "timeline:event": (event: TimelineEvent) => void;
94
94
  }
95
95
  /**
96
- * Dev toolbar hook interface.
97
- * Exposed as window.__DEV_TOOLBAR_HOOK__
98
- */
96
+ * Dev toolbar hook interface.
97
+ * Exposed as window.__DEV_TOOLBAR_HOOK__
98
+ */
99
99
  interface DevToolbarHook {
100
100
  /**
101
- * Adds a timeline event.
102
- * @param groupId Timeline group ID.
103
- * @param event Timeline event.
104
- */
101
+ * Adds a timeline event.
102
+ * @param groupId Timeline group ID.
103
+ * @param event Timeline event.
104
+ */
105
105
  addTimelineEvent: (groupId: string, event: TimelineEvent) => void;
106
106
  /**
107
- * Emits an event.
108
- * @param event Event name.
109
- * @param args Event arguments.
110
- */
107
+ * Emits an event.
108
+ * @param event Event name.
109
+ * @param args Event arguments.
110
+ */
111
111
  emit: <T extends keyof HookEvents>(event: T, ...args: Parameters<HookEvents[T]>) => void;
112
112
  /**
113
- * Unsubscribes from an event.
114
- * @param event Event name.
115
- * @param handler Optional specific handler to remove.
116
- */
113
+ * Unsubscribes from an event.
114
+ * @param event Event name.
115
+ * @param handler Optional specific handler to remove.
116
+ */
117
117
  off: <T extends keyof HookEvents>(event: T, handler?: HookEvents[T]) => void;
118
118
  /**
119
- * Subscribes to an event.
120
- * @param event Event name.
121
- * @param handler Event handler.
122
- * @returns Unsubscribe function.
123
- */
119
+ * Subscribes to an event.
120
+ * @param event Event name.
121
+ * @param handler Event handler.
122
+ * @returns Unsubscribe function.
123
+ */
124
124
  on: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => () => void;
125
125
  /**
126
- * Subscribes to an event once.
127
- * @param event Event name.
128
- * @param handler Event handler.
129
- */
126
+ * Subscribes to an event once.
127
+ * @param event Event name.
128
+ * @param handler Event handler.
129
+ */
130
130
  once: <T extends keyof HookEvents>(event: T, handler: HookEvents[T]) => void;
131
131
  /**
132
- * Registers a custom app.
133
- * @param app App definition.
134
- */
132
+ * Registers a custom app.
133
+ * @param app App definition.
134
+ */
135
135
  registerApp: (app: DevToolbarApp) => void;
136
136
  }
137
- /**
138
- * Global hook declaration
139
- */
140
- declare global$1 {
141
- interface Window {
142
- /**
143
- * Dev toolbar hook for library integrations.
144
- */
145
- __DEV_TOOLBAR_HOOK__?: DevToolbarHook;
146
- }
147
- }
148
137
  interface StaticAsset {
149
138
  /** Last-modified timestamp (ms since epoch) */
150
139
  mtime: number;
@@ -172,20 +161,20 @@ interface TailwindConfigResult {
172
161
  version: "v3" | "v4" | "unknown";
173
162
  }
174
163
  /**
175
- * Annotation intent — describes what the user wants to communicate.
176
- */
164
+ * Annotation intent — describes what the user wants to communicate.
165
+ */
177
166
  type AnnotationIntent = "approve" | "change" | "fix" | "question";
178
167
  /**
179
- * Annotation severity — how urgent or important the annotation is.
180
- */
168
+ * Annotation severity — how urgent or important the annotation is.
169
+ */
181
170
  type AnnotationSeverity = "blocking" | "important" | "suggestion";
182
171
  /**
183
- * Annotation status — lifecycle state.
184
- */
172
+ * Annotation status — lifecycle state.
173
+ */
185
174
  type AnnotationStatus = "acknowledged" | "dismissed" | "pending" | "resolved";
186
175
  /**
187
- * A single message in a conversation thread attached to an annotation.
188
- */
176
+ * A single message in a conversation thread attached to an annotation.
177
+ */
189
178
  interface ThreadMessage {
190
179
  /** Message text */
191
180
  content: string;
@@ -197,8 +186,8 @@ interface ThreadMessage {
197
186
  timestamp: string;
198
187
  }
199
188
  /**
200
- * Bounding box of the annotated element relative to the viewport.
201
- */
189
+ * Bounding box of the annotated element relative to the viewport.
190
+ */
202
191
  interface BoundingBox {
203
192
  height: number;
204
193
  width: number;
@@ -206,8 +195,8 @@ interface BoundingBox {
206
195
  y: number;
207
196
  }
208
197
  /**
209
- * Detected framework component information.
210
- */
198
+ * Detected framework component information.
199
+ */
211
200
  interface FrameworkContext {
212
201
  /** Component name */
213
202
  componentName?: string;
@@ -223,8 +212,8 @@ interface FrameworkContext {
223
212
  sourceLine?: number;
224
213
  }
225
214
  /**
226
- * Captured accessibility attributes for an element.
227
- */
215
+ * Captured accessibility attributes for an element.
216
+ */
228
217
  interface AccessibilityInfo {
229
218
  /** aria-describedby content */
230
219
  ariaDescribedBy?: string;
@@ -238,9 +227,9 @@ interface AccessibilityInfo {
238
227
  tabindex?: number;
239
228
  }
240
229
  /**
241
- * A visual annotation placed on a page element during development.
242
- * Stored in `.devtoolbar/annotations.json`.
243
- */
230
+ * A visual annotation placed on a page element during development.
231
+ * Stored in `.devtoolbar/annotations.json`.
232
+ */
244
233
  interface Annotation {
245
234
  /** Captured accessibility attributes */
246
235
  accessibility?: AccessibilityInfo;
@@ -301,18 +290,18 @@ interface Annotation {
301
290
  /** Click X as percentage of viewport width (0-100) — survives resize */
302
291
  x: number;
303
292
  /**
304
- * Click Y as absolute page position (pixels from document top) — survives scroll.
305
- * For fixed/sticky elements, Y is viewport-relative instead.
306
- */
293
+ * Click Y as absolute page position (pixels from document top) — survives scroll.
294
+ * For fixed/sticky elements, Y is viewport-relative instead.
295
+ */
307
296
  y: number;
308
297
  }
309
298
  /**
310
- * Data required to create a new annotation (server-generated fields omitted).
311
- */
299
+ * Data required to create a new annotation (server-generated fields omitted).
300
+ */
312
301
  type CreateAnnotationData = Omit<Annotation, "createdAt" | "id" | "resolvedAt" | "resolvedBy" | "status" | "thread" | "updatedAt">;
313
302
  /**
314
- * Fields that can be updated on an existing annotation.
315
- */
303
+ * Fields that can be updated on an existing annotation.
304
+ */
316
305
  interface UpdateAnnotationData {
317
306
  /** Updated comment text */
318
307
  comment?: string;
@@ -328,218 +317,231 @@ interface UpdateAnnotationData {
328
317
  threadMessage?: ThreadMessage;
329
318
  }
330
319
  /**
331
- * Server-side RPC functions
332
- * These can be called from the client
333
- */
320
+ * Server-side RPC functions
321
+ * These can be called from the client
322
+ */
334
323
  interface ServerFunctions {
335
324
  /**
336
- * Extension point for custom server functions
337
- */
325
+ * Extension point for custom server functions
326
+ */
338
327
  [key: string]: (...args: any[]) => Promise<any>;
339
328
  /**
340
- * Create a new annotation
341
- * @param data Annotation data (id, timestamps, status are generated server-side)
342
- */
329
+ * Create a new annotation
330
+ * @param data Annotation data (id, timestamps, status are generated server-side)
331
+ */
343
332
  createAnnotation: (data: CreateAnnotationData) => Promise<Annotation>;
344
333
  /**
345
- * Delete an annotation and its screenshot
346
- * @param id Annotation ID
347
- */
334
+ * Delete an annotation and its screenshot
335
+ * @param id Annotation ID
336
+ */
348
337
  deleteAnnotation: (id: string) => Promise<boolean>;
349
338
  /**
350
- * Get all annotations
351
- */
339
+ * Get all annotations
340
+ */
352
341
  getAnnotations: () => Promise<Annotation[]>;
353
342
  /**
354
- * Get module dependency graph
355
- */
343
+ * Get module dependency graph
344
+ */
356
345
  getModuleGraph: () => Promise<SerializableModuleNode[]>;
357
346
  /**
358
- * Get a screenshot as a base64 data URL
359
- * @param annotationId Annotation ID
360
- */
347
+ * Get a screenshot as a base64 data URL
348
+ * @param annotationId Annotation ID
349
+ */
361
350
  getScreenshot: (annotationId: string) => Promise<string | null>;
362
351
  /**
363
- * Get all static assets from the public directory
364
- */
352
+ * Get all static assets from the public directory
353
+ */
365
354
  getStaticAssets: () => Promise<StaticAsset[]>;
366
355
  /**
367
- * Get full Tailwind CSS theme (default + user overrides)
368
- */
356
+ * Get full Tailwind CSS theme (default + user overrides)
357
+ */
369
358
  getTailwindConfig: () => Promise<TailwindConfigResult>;
370
359
  /**
371
- * Get Vite configuration
372
- */
360
+ * Get Vite configuration
361
+ */
373
362
  getViteConfig: () => Promise<Record<string, any>>;
374
363
  /**
375
- * Open file in editor
376
- * @param file File path
377
- * @param line Line number (1-based)
378
- * @param column Column number (1-based)
379
- */
364
+ * Open file in editor
365
+ * @param file File path
366
+ * @param line Line number (1-based)
367
+ * @param column Column number (1-based)
368
+ */
380
369
  openInEditor: (file: string, line?: number, column?: number) => Promise<void>;
381
370
  /**
382
- * Read file contents
383
- * @param path File path
384
- */
371
+ * Read file contents
372
+ * @param path File path
373
+ */
385
374
  readFile: (path: string) => Promise<string>;
386
375
  /**
387
- * Save a screenshot for an annotation
388
- * @param annotationId Annotation ID
389
- * @param dataUrl Base64 data URL (PNG, JPEG, WebP, or SVG)
390
- * @returns Relative path within .devtoolbar/
391
- */
376
+ * Save a screenshot for an annotation
377
+ * @param annotationId Annotation ID
378
+ * @param dataUrl Base64 data URL (PNG, JPEG, WebP, or SVG)
379
+ * @returns Relative path within .devtoolbar/
380
+ */
392
381
  saveScreenshot: (annotationId: string, dataUrl: string) => Promise<string>;
393
382
  /**
394
- * Update an existing annotation
395
- * @param id Annotation ID
396
- * @param data Fields to update
397
- */
383
+ * Update an existing annotation
384
+ * @param id Annotation ID
385
+ * @param data Fields to update
386
+ */
398
387
  updateAnnotation: (id: string, data: UpdateAnnotationData) => Promise<Annotation | null>;
399
388
  }
400
389
  /**
401
- * Client-side RPC functions
402
- * These can be called from the server
403
- */
390
+ * Client-side RPC functions
391
+ * These can be called from the server
392
+ */
404
393
  interface ClientFunctions {
405
394
  [key: string]: (...args: any[]) => void;
406
395
  /**
407
- * Notify client of config change
408
- * @param config New Vite config
409
- */
396
+ * Notify client of config change
397
+ * @param config New Vite config
398
+ */
410
399
  onConfigChange: (config: Record<string, unknown>) => void;
411
400
  /**
412
- * Notify client of HMR update
413
- * @param payload HMR payload
414
- */
401
+ * Notify client of HMR update
402
+ * @param payload HMR payload
403
+ */
415
404
  onHMRUpdate: (payload: unknown) => void;
416
405
  /**
417
- * Notify client of module update
418
- * @param module Updated module node
419
- */
406
+ * Notify client of module update
407
+ * @param module Updated module node
408
+ */
420
409
  onModuleUpdate: (module: SerializableModuleNode) => void;
421
410
  }
422
411
  /**
423
- * RPC context for server-side
424
- */
412
+ * RPC context for server-side
413
+ */
425
414
  interface ServerRPCContext {
426
415
  /**
427
- * Call a client function
428
- * @param name Function name
429
- * @param args Function arguments
430
- */
416
+ * Call a client function
417
+ * @param name Function name
418
+ * @param args Function arguments
419
+ */
431
420
  callClient: <K extends keyof ClientFunctions>(name: K, ...args: Parameters<ClientFunctions[K]>) => void;
432
421
  /**
433
- * Register a server function
434
- * @param name Function name
435
- * @param fn Function implementation
436
- */
422
+ * Register a server function
423
+ * @param name Function name
424
+ * @param fn Function implementation
425
+ */
437
426
  registerFunction: <K extends keyof ServerFunctions>(name: K, function_: ServerFunctions[K]) => void;
438
427
  /**
439
- * Vite dev server instance
440
- */
428
+ * Vite dev server instance
429
+ */
441
430
  server: ViteDevServer;
442
431
  }
443
432
  /**
444
- * RPC context for client-side
445
- */
433
+ * RPC context for client-side
434
+ */
446
435
  interface ClientRPCContext {
447
436
  /**
448
- * Call a server function
449
- * @param name Function name
450
- * @param args Function arguments
451
- */
437
+ * Call a server function
438
+ * @param name Function name
439
+ * @param args Function arguments
440
+ */
452
441
  callServer: <K extends keyof ServerFunctions>(name: K, ...args: Parameters<ServerFunctions[K]>) => Promise<ReturnType<ServerFunctions[K]>>;
453
442
  /**
454
- * Register a client function
455
- * @param name Function name
456
- * @param function_ Function implementation
457
- */
443
+ * Register a client function
444
+ * @param name Function name
445
+ * @param function_ Function implementation
446
+ */
458
447
  registerFunction: <K extends keyof ClientFunctions>(name: K, function_: ClientFunctions[K]) => void;
459
448
  }
460
449
  /**
461
- * Global DevTools API interface.
462
- * Exposed as window.__VISULIMA_DEVTOOLS__
463
- */
450
+ * Global DevTools API interface.
451
+ * Exposed as window.__VISULIMA_DEVTOOLS__
452
+ */
464
453
  interface VisulimaDevTools {
465
454
  /**
466
- * Clears notification for an app.
467
- */
455
+ * Clears notification for an app.
456
+ */
468
457
  clearNotification: (appId: string) => void;
469
458
  /**
470
- * Closes the currently active app.
471
- */
459
+ * Closes the currently active app.
460
+ */
472
461
  closeApp: () => Promise<void>;
473
462
  /**
474
- * Gets the currently active app ID.
475
- */
463
+ * Gets the currently active app ID.
464
+ */
476
465
  getActiveApp: () => string | undefined;
477
466
  /**
478
- * Gets all registered apps.
479
- */
467
+ * Gets all registered apps.
468
+ */
480
469
  getApps: () => DevToolbarApp[];
481
470
  /**
482
- * Gets current toolbar settings.
483
- */
471
+ * Gets current toolbar settings.
472
+ */
484
473
  getSettings: () => ToolbarSettings;
485
474
  /**
486
- * Hides the toolbar.
487
- */
475
+ * Hides the toolbar.
476
+ */
488
477
  hide: () => void;
489
478
  /**
490
- * Hook instance for event subscriptions.
491
- */
479
+ * Hook instance for event subscriptions.
480
+ */
492
481
  hook: DevToolbarHook;
493
482
  /**
494
- * Shows a notification for an app.
495
- */
483
+ * Shows a notification for an app.
484
+ */
496
485
  notify: (appId: string, level: "info" | "warning" | "error") => void;
497
486
  /**
498
- * Opens an app by ID.
499
- */
487
+ * Opens an app by ID.
488
+ */
500
489
  openApp: (appId: string) => Promise<void>;
501
490
  /**
502
- * Registers a custom app.
503
- */
491
+ * Registers a custom app.
492
+ */
504
493
  registerApp: (app: DevToolbarApp) => void;
505
494
  /**
506
- * RPC client for calling server functions.
507
- */
495
+ * RPC client for calling server functions.
496
+ */
508
497
  rpc: ServerFunctions;
509
498
  /**
510
- * Directly sets the active state of an action button without invoking callbacks.
511
- * Useful for deactivating a button from async work running outside the toolbar.
512
- */
499
+ * Directly sets the active state of an action button without invoking callbacks.
500
+ * Useful for deactivating a button from async work running outside the toolbar.
501
+ */
513
502
  setAppActive: (appId: string, active: boolean) => void;
514
503
  /**
515
- * Shows the toolbar.
516
- */
504
+ * Shows the toolbar.
505
+ */
517
506
  show: () => void;
518
507
  /**
519
- * Toggles toolbar visibility.
520
- */
508
+ * Toggles toolbar visibility.
509
+ */
521
510
  toggle: () => void;
522
511
  /**
523
- * Unregisters an app by ID.
524
- */
512
+ * Unregisters an app by ID.
513
+ */
525
514
  unregisterApp: (appId: string) => void;
526
515
  /**
527
- * Updates toolbar settings.
528
- */
516
+ * Updates toolbar settings.
517
+ */
529
518
  updateSettings: (settings: Partial<ToolbarSettings>) => void;
530
519
  /**
531
- * Package version.
532
- */
520
+ * Package version.
521
+ */
533
522
  version: string;
534
523
  }
535
524
  /**
536
- * Global API declaration
537
- */
525
+ * Global `Window` augmentation for the whole package.
526
+ *
527
+ * Every `declare global` this package ships must live in this one block.
528
+ * packem's .d.ts bundler treats `global` as an ordinary identifier when
529
+ * de-duplicating declarations, so a second `declare global` in another
530
+ * bundled module is emitted as `declare global$1` — invalid TypeScript
531
+ * (TS1435), and *not* suppressed by `skipLibCheck` because it is a
532
+ * grammar error rather than a type error. That breaks every consumer's
533
+ * build. Keep additions here rather than adding a block next to the
534
+ * interface they relate to.
535
+ */
538
536
  declare global {
539
537
  interface Window {
540
538
  /**
541
- * Visulima DevTools global API.
542
- */
539
+ * Dev toolbar hook for library integrations.
540
+ */
541
+ __DEV_TOOLBAR_HOOK__?: DevToolbarHook;
542
+ /**
543
+ * Visulima DevTools global API.
544
+ */
543
545
  __VISULIMA_DEVTOOLS__?: VisulimaDevTools;
544
546
  }
545
547
  }