@ytspar/devbar 1.0.0-canary.c37df82 → 1.0.0-canary.c511f13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -5,7 +5,28 @@
5
5
  *
6
6
  * NOTE: We import from the types sub-path to avoid pulling in Node.js-only modules.
7
7
  */
8
- export type { ConsoleLog, SweetlinkCommand, OutlineNode, PageSchema, } from '@ytspar/sweetlink/types';
8
+ export type { ConsoleLog, OutlineNode, PageSchema, SweetlinkCommand, } from '@ytspar/sweetlink/types';
9
+ /**
10
+ * Theme mode for DevBar display
11
+ */
12
+ export type ThemeMode = 'dark' | 'light' | 'system';
13
+ /**
14
+ * Debug configuration for DevBar
15
+ * When true, all debug options are enabled.
16
+ * When an object, specific options can be toggled.
17
+ */
18
+ export interface DebugConfig {
19
+ /** Enable debug logging. Default: false */
20
+ enabled: boolean;
21
+ /** Log lifecycle events (init, destroy). Default: true when enabled */
22
+ logLifecycle?: boolean;
23
+ /** Log state changes (collapse, modals). Default: true when enabled */
24
+ logStateChanges?: boolean;
25
+ /** Log WebSocket events (connect, disconnect, messages). Default: true when enabled */
26
+ logWebSocket?: boolean;
27
+ /** Log performance measurements (FCP, LCP, CLS, INP). Default: true when enabled */
28
+ logPerformance?: boolean;
29
+ }
9
30
  /**
10
31
  * Options for configuring the GlobalDevBar
11
32
  */
@@ -19,6 +40,8 @@ export interface GlobalDevBarOptions {
19
40
  breakpoint?: boolean;
20
41
  fcp?: boolean;
21
42
  lcp?: boolean;
43
+ cls?: boolean;
44
+ inp?: boolean;
22
45
  pageSize?: boolean;
23
46
  };
24
47
  /** Whether to show the screenshot button. Default: true */
@@ -36,6 +59,8 @@ export interface GlobalDevBarOptions {
36
59
  /** Custom min-width (CSS value). Optional */
37
60
  minWidth?: string;
38
61
  };
62
+ /** Enable debug logging. Pass true for all options, or an object for specific options. */
63
+ debug?: boolean | DebugConfig;
39
64
  }
40
65
  /**
41
66
  * Custom control that can be registered by host applications
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * Re-exports all UI utilities.
5
5
  */
6
+ export { createStyledButton, getButtonStyles } from './buttons.js';
6
7
  export { createSvgIcon } from './icons.js';
7
- export { getButtonStyles, createStyledButton } from './buttons.js';
8
- export { createModalOverlay, createModalBox, createModalHeader, createModalContent, createEmptyMessage, createInfoBox, type ModalConfig } from './modals.js';
8
+ export { createEmptyMessage, createInfoBox, createModalBox, createModalContent, createModalHeader, createModalOverlay, type ModalConfig, } from './modals.js';
package/dist/ui/index.js CHANGED
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * Re-exports all UI utilities.
5
5
  */
6
+ export { createStyledButton, getButtonStyles } from './buttons.js';
6
7
  export { createSvgIcon } from './icons.js';
7
- export { getButtonStyles, createStyledButton } from './buttons.js';
8
- export { createModalOverlay, createModalBox, createModalHeader, createModalContent, createEmptyMessage, createInfoBox } from './modals.js';
8
+ export { createEmptyMessage, createInfoBox, createModalBox, createModalContent, createModalHeader, createModalOverlay, } from './modals.js';
@@ -13,6 +13,10 @@ export interface ModalConfig {
13
13
  onCopyMd: () => Promise<void>;
14
14
  onSave?: () => void;
15
15
  sweetlinkConnected: boolean;
16
+ /** Whether a save operation is in progress */
17
+ isSaving?: boolean;
18
+ /** Path where data was saved (shows confirmation) */
19
+ savedPath?: string | null;
16
20
  }
17
21
  /**
18
22
  * Create modal overlay with click-outside-to-close behavior
package/dist/ui/modals.js CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Modal creation utilities for the DevBar UI.
5
5
  */
6
- import { MODAL_OVERLAY_STYLES, MODAL_BOX_BASE_STYLES } from '../constants.js';
6
+ import { MODAL_BOX_BASE_STYLES, MODAL_OVERLAY_STYLES } from '../constants.js';
7
7
  import { createStyledButton } from './buttons.js';
8
8
  /**
9
9
  * Create modal overlay with click-outside-to-close behavior
@@ -34,7 +34,7 @@ export function createModalBox(color) {
34
34
  * Create modal header with title, copy/save/close buttons
35
35
  */
36
36
  export function createModalHeader(config) {
37
- const { color, title, onClose, onCopyMd, onSave, sweetlinkConnected } = config;
37
+ const { color, title, onClose, onCopyMd, onSave, sweetlinkConnected, isSaving, savedPath } = config;
38
38
  const header = document.createElement('div');
39
39
  Object.assign(header.style, {
40
40
  display: 'flex',
@@ -42,6 +42,8 @@ export function createModalHeader(config) {
42
42
  justifyContent: 'space-between',
43
43
  padding: '16px 20px',
44
44
  borderBottom: `1px solid ${color}40`,
45
+ flexWrap: 'wrap',
46
+ gap: '8px',
45
47
  });
46
48
  const titleEl = document.createElement('h2');
47
49
  Object.assign(titleEl.style, {
@@ -53,14 +55,16 @@ export function createModalHeader(config) {
53
55
  titleEl.textContent = title;
54
56
  header.appendChild(titleEl);
55
57
  const headerButtons = document.createElement('div');
56
- Object.assign(headerButtons.style, { display: 'flex', gap: '10px' });
58
+ Object.assign(headerButtons.style, { display: 'flex', gap: '10px', alignItems: 'center' });
57
59
  // Copy MD button
58
60
  const copyBtn = createStyledButton({ color, text: 'Copy MD' });
59
61
  copyBtn.onclick = async () => {
60
62
  try {
61
63
  await onCopyMd();
62
64
  copyBtn.textContent = 'Copied!';
63
- setTimeout(() => { copyBtn.textContent = 'Copy MD'; }, 1500);
65
+ setTimeout(() => {
66
+ copyBtn.textContent = 'Copy MD';
67
+ }, 1500);
64
68
  }
65
69
  catch {
66
70
  console.error('[GlobalDevBar] Failed to copy to clipboard');
@@ -69,8 +73,17 @@ export function createModalHeader(config) {
69
73
  headerButtons.appendChild(copyBtn);
70
74
  // Save button (if Sweetlink connected)
71
75
  if (sweetlinkConnected && onSave) {
72
- const saveBtn = createStyledButton({ color, text: 'Save' });
73
- saveBtn.onclick = onSave;
76
+ const saveBtn = createStyledButton({
77
+ color,
78
+ text: isSaving ? 'Saving...' : 'Save',
79
+ });
80
+ if (isSaving) {
81
+ saveBtn.style.opacity = '0.6';
82
+ saveBtn.style.cursor = 'not-allowed';
83
+ }
84
+ else {
85
+ saveBtn.onclick = onSave;
86
+ }
74
87
  headerButtons.appendChild(saveBtn);
75
88
  }
76
89
  // Close button - use same padding as other buttons for consistent height
@@ -83,6 +96,39 @@ export function createModalHeader(config) {
83
96
  closeBtn.onclick = onClose;
84
97
  headerButtons.appendChild(closeBtn);
85
98
  header.appendChild(headerButtons);
99
+ // Show saved path confirmation below buttons
100
+ if (savedPath) {
101
+ const savedConfirm = document.createElement('div');
102
+ Object.assign(savedConfirm.style, {
103
+ width: '100%',
104
+ marginTop: '4px',
105
+ padding: '8px 12px',
106
+ backgroundColor: `${color}15`,
107
+ border: `1px solid ${color}30`,
108
+ borderRadius: '6px',
109
+ fontSize: '0.75rem',
110
+ color: color,
111
+ display: 'flex',
112
+ alignItems: 'center',
113
+ gap: '6px',
114
+ });
115
+ // Checkmark icon
116
+ const checkmark = document.createElement('span');
117
+ checkmark.textContent = '✓';
118
+ Object.assign(checkmark.style, { fontWeight: '600' });
119
+ savedConfirm.appendChild(checkmark);
120
+ // Path text
121
+ const pathText = document.createElement('span');
122
+ Object.assign(pathText.style, {
123
+ color: '#9ca3af',
124
+ fontFamily: 'monospace',
125
+ fontSize: '0.6875rem',
126
+ wordBreak: 'break-all',
127
+ });
128
+ pathText.textContent = `Saved to ${savedPath}`;
129
+ savedConfirm.appendChild(pathText);
130
+ header.appendChild(savedConfirm);
131
+ }
86
132
  return header;
87
133
  }
88
134
  /**
@@ -138,7 +184,7 @@ export function createInfoBox(color, title, content) {
138
184
  box.appendChild(textEl);
139
185
  }
140
186
  else {
141
- content.forEach(el => box.appendChild(el));
187
+ content.forEach((el) => box.appendChild(el));
142
188
  }
143
189
  return box;
144
190
  }
package/dist/utils.d.ts CHANGED
@@ -8,4 +8,4 @@
8
8
  * that would break browser/test environments.
9
9
  */
10
10
  export { formatArg, formatArgs } from '@ytspar/sweetlink/browser/consoleCapture';
11
- export { canvasToDataUrl, prepareForCapture, delay, copyCanvasToClipboard, } from '@ytspar/sweetlink/browser/screenshotUtils';
11
+ export { canvasToDataUrl, copyCanvasToClipboard, delay, prepareForCapture, } from '@ytspar/sweetlink/browser/screenshotUtils';
package/dist/utils.js CHANGED
@@ -10,4 +10,4 @@
10
10
  // Re-export console formatting utilities from sweetlink's browser module
11
11
  export { formatArg, formatArgs } from '@ytspar/sweetlink/browser/consoleCapture';
12
12
  // Re-export screenshot utilities from sweetlink's browser module
13
- export { canvasToDataUrl, prepareForCapture, delay, copyCanvasToClipboard, } from '@ytspar/sweetlink/browser/screenshotUtils';
13
+ export { canvasToDataUrl, copyCanvasToClipboard, delay, prepareForCapture, } from '@ytspar/sweetlink/browser/screenshotUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ytspar/devbar",
3
- "version": "1.0.0-canary.c37df82",
3
+ "version": "1.0.0-canary.c511f13",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Development toolbar and utilities with Sweetlink integration - pure vanilla JS, no framework dependencies",