@ytspar/devbar 1.0.0-canary.bf42899 → 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/GlobalDevBar.d.ts +34 -0
- package/dist/GlobalDevBar.js +506 -93
- package/dist/constants.d.ts +30 -20
- package/dist/constants.js +37 -27
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/outline.js +43 -10
- package/dist/presets.d.ts +1 -1
- package/dist/schema.js +4 -3
- package/dist/settings.d.ts +150 -0
- package/dist/settings.js +292 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +2 -2
- package/dist/ui/modals.d.ts +4 -0
- package/dist/ui/modals.js +53 -7
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -11,8 +11,18 @@ export declare const MAX_RECONNECT_ATTEMPTS = 10;
|
|
|
11
11
|
export declare const BASE_RECONNECT_DELAY_MS = 1000;
|
|
12
12
|
/** Maximum delay between reconnection attempts (ms) */
|
|
13
13
|
export declare const MAX_RECONNECT_DELAY_MS = 30000;
|
|
14
|
-
/** Default WebSocket port for Sweetlink connection */
|
|
14
|
+
/** Default WebSocket port for Sweetlink connection (legacy fallback) */
|
|
15
15
|
export declare const WS_PORT = 9223;
|
|
16
|
+
/** Port offset from app port to calculate WebSocket port (matches SweetlinkBridge) */
|
|
17
|
+
export declare const WS_PORT_OFFSET = 6223;
|
|
18
|
+
/** Maximum ports to try when scanning for matching server */
|
|
19
|
+
export declare const MAX_PORT_RETRIES = 10;
|
|
20
|
+
/** Delay between port scan attempts (ms) */
|
|
21
|
+
export declare const PORT_RETRY_DELAY_MS = 100;
|
|
22
|
+
/** Timeout for server-info verification (ms) */
|
|
23
|
+
export declare const VERIFICATION_TIMEOUT_MS = 1000;
|
|
24
|
+
/** Delay before restarting port scan from base after all ports fail (ms) */
|
|
25
|
+
export declare const PORT_SCAN_RESTART_DELAY_MS = 3000;
|
|
16
26
|
/** Duration to show screenshot notification (ms) */
|
|
17
27
|
export declare const SCREENSHOT_NOTIFICATION_MS = 3000;
|
|
18
28
|
/** Duration to show clipboard notification (ms) */
|
|
@@ -130,28 +140,28 @@ export declare const DEVBAR_THEME: {
|
|
|
130
140
|
};
|
|
131
141
|
};
|
|
132
142
|
export type DevBarTheme = typeof DEVBAR_THEME;
|
|
133
|
-
/** Light theme variant -
|
|
143
|
+
/** Light theme variant - terminal aesthetic with light green tones */
|
|
134
144
|
export declare const DEVBAR_THEME_LIGHT: {
|
|
135
145
|
readonly colors: {
|
|
136
|
-
readonly primary: "#
|
|
137
|
-
readonly primaryHover: "#
|
|
138
|
-
readonly primaryGlow: "rgba(
|
|
139
|
-
readonly error: "#
|
|
146
|
+
readonly primary: "#047857";
|
|
147
|
+
readonly primaryHover: "#065f46";
|
|
148
|
+
readonly primaryGlow: "rgba(4, 120, 87, 0.25)";
|
|
149
|
+
readonly error: "#dc2626";
|
|
140
150
|
readonly warning: "#d97706";
|
|
141
151
|
readonly info: "#2563eb";
|
|
142
|
-
readonly purple: "#
|
|
152
|
+
readonly purple: "#7c3aed";
|
|
143
153
|
readonly cyan: "#0891b2";
|
|
144
154
|
readonly pink: "#db2777";
|
|
145
155
|
readonly lime: "#65a30d";
|
|
146
|
-
readonly bg: "#
|
|
147
|
-
readonly bgCard: "rgba(255, 255, 255, 0.
|
|
148
|
-
readonly bgElevated: "rgba(255, 255, 255, 0.
|
|
149
|
-
readonly bgInput: "rgba(
|
|
150
|
-
readonly text: "#
|
|
151
|
-
readonly textSecondary: "#
|
|
152
|
-
readonly textMuted: "#
|
|
153
|
-
readonly border: "rgba(
|
|
154
|
-
readonly borderSubtle: "rgba(
|
|
156
|
+
readonly bg: "#ecfdf5";
|
|
157
|
+
readonly bgCard: "rgba(255, 255, 255, 0.85)";
|
|
158
|
+
readonly bgElevated: "rgba(255, 255, 255, 0.95)";
|
|
159
|
+
readonly bgInput: "rgba(236, 253, 245, 0.9)";
|
|
160
|
+
readonly text: "#064e3b";
|
|
161
|
+
readonly textSecondary: "#065f46";
|
|
162
|
+
readonly textMuted: "#047857";
|
|
163
|
+
readonly border: "rgba(4, 120, 87, 0.3)";
|
|
164
|
+
readonly borderSubtle: "rgba(4, 120, 87, 0.1)";
|
|
155
165
|
};
|
|
156
166
|
readonly fonts: {
|
|
157
167
|
readonly mono: "'Departure Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
@@ -181,10 +191,10 @@ export declare const DEVBAR_THEME_LIGHT: {
|
|
|
181
191
|
readonly lg: "12px";
|
|
182
192
|
};
|
|
183
193
|
readonly shadows: {
|
|
184
|
-
readonly sm: "0 1px 2px rgba(
|
|
185
|
-
readonly md: "0 4px 12px rgba(
|
|
186
|
-
readonly lg: "0 8px 32px rgba(
|
|
187
|
-
readonly glow: "0 0 20px rgba(
|
|
194
|
+
readonly sm: "0 1px 2px rgba(4, 120, 87, 0.1)";
|
|
195
|
+
readonly md: "0 4px 12px rgba(4, 120, 87, 0.12), 0 0 0 1px rgba(4, 120, 87, 0.15)";
|
|
196
|
+
readonly lg: "0 8px 32px rgba(4, 120, 87, 0.15), 0 0 0 1px rgba(4, 120, 87, 0.2)";
|
|
197
|
+
readonly glow: "0 0 20px rgba(4, 120, 87, 0.15)";
|
|
188
198
|
};
|
|
189
199
|
readonly transitions: {
|
|
190
200
|
readonly fast: "150ms";
|
package/dist/constants.js
CHANGED
|
@@ -18,8 +18,18 @@ export const MAX_RECONNECT_DELAY_MS = 30000;
|
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// WebSocket Settings
|
|
20
20
|
// ============================================================================
|
|
21
|
-
/** Default WebSocket port for Sweetlink connection */
|
|
21
|
+
/** Default WebSocket port for Sweetlink connection (legacy fallback) */
|
|
22
22
|
export const WS_PORT = 9223;
|
|
23
|
+
/** Port offset from app port to calculate WebSocket port (matches SweetlinkBridge) */
|
|
24
|
+
export const WS_PORT_OFFSET = 6223;
|
|
25
|
+
/** Maximum ports to try when scanning for matching server */
|
|
26
|
+
export const MAX_PORT_RETRIES = 10;
|
|
27
|
+
/** Delay between port scan attempts (ms) */
|
|
28
|
+
export const PORT_RETRY_DELAY_MS = 100;
|
|
29
|
+
/** Timeout for server-info verification (ms) */
|
|
30
|
+
export const VERIFICATION_TIMEOUT_MS = 1000;
|
|
31
|
+
/** Delay before restarting port scan from base after all ports fail (ms) */
|
|
32
|
+
export const PORT_SCAN_RESTART_DELAY_MS = 3000;
|
|
23
33
|
// ============================================================================
|
|
24
34
|
// Notification Durations
|
|
25
35
|
// ============================================================================
|
|
@@ -174,44 +184,44 @@ export const DEVBAR_THEME = {
|
|
|
174
184
|
fast: '150ms',
|
|
175
185
|
},
|
|
176
186
|
};
|
|
177
|
-
/** Light theme variant -
|
|
187
|
+
/** Light theme variant - terminal aesthetic with light green tones */
|
|
178
188
|
export const DEVBAR_THEME_LIGHT = {
|
|
179
189
|
colors: {
|
|
180
|
-
// Primary accent (darker for
|
|
181
|
-
primary: '#
|
|
182
|
-
primaryHover: '#
|
|
183
|
-
primaryGlow: 'rgba(
|
|
184
|
-
// Semantic colors (
|
|
185
|
-
error:
|
|
186
|
-
warning: '#d97706',
|
|
187
|
-
info: '#2563eb',
|
|
188
|
-
// Extended palette (darker
|
|
189
|
-
purple: '#
|
|
190
|
+
// Primary accent (darker emerald for contrast)
|
|
191
|
+
primary: '#047857', // darker emerald for better contrast
|
|
192
|
+
primaryHover: '#065f46',
|
|
193
|
+
primaryGlow: 'rgba(4, 120, 87, 0.25)',
|
|
194
|
+
// Semantic colors (adjusted for light bg)
|
|
195
|
+
error: '#dc2626',
|
|
196
|
+
warning: '#d97706',
|
|
197
|
+
info: '#2563eb',
|
|
198
|
+
// Extended palette (darker for light mode)
|
|
199
|
+
purple: '#7c3aed',
|
|
190
200
|
cyan: '#0891b2',
|
|
191
201
|
pink: '#db2777',
|
|
192
202
|
lime: '#65a30d',
|
|
193
|
-
// Backgrounds
|
|
194
|
-
bg: '#
|
|
195
|
-
bgCard: 'rgba(255, 255, 255, 0.
|
|
196
|
-
bgElevated: 'rgba(255, 255, 255, 0.
|
|
197
|
-
bgInput: 'rgba(
|
|
203
|
+
// Backgrounds - terminal light green aesthetic
|
|
204
|
+
bg: '#ecfdf5', // very light mint/green
|
|
205
|
+
bgCard: 'rgba(255, 255, 255, 0.85)',
|
|
206
|
+
bgElevated: 'rgba(255, 255, 255, 0.95)',
|
|
207
|
+
bgInput: 'rgba(236, 253, 245, 0.9)', // light mint input
|
|
198
208
|
// Text (dark on light)
|
|
199
|
-
text: '#
|
|
200
|
-
textSecondary: '#
|
|
201
|
-
textMuted: '#
|
|
202
|
-
// Borders (
|
|
203
|
-
border: 'rgba(
|
|
204
|
-
borderSubtle: 'rgba(
|
|
209
|
+
text: '#064e3b', // dark emerald text
|
|
210
|
+
textSecondary: '#065f46',
|
|
211
|
+
textMuted: '#047857',
|
|
212
|
+
// Borders (emerald-tinted)
|
|
213
|
+
border: 'rgba(4, 120, 87, 0.3)',
|
|
214
|
+
borderSubtle: 'rgba(4, 120, 87, 0.1)',
|
|
205
215
|
},
|
|
206
216
|
// Other properties same as dark theme
|
|
207
217
|
fonts: DEVBAR_THEME.fonts,
|
|
208
218
|
typography: DEVBAR_THEME.typography,
|
|
209
219
|
radius: DEVBAR_THEME.radius,
|
|
210
220
|
shadows: {
|
|
211
|
-
sm: '0 1px 2px rgba(
|
|
212
|
-
md: '0 4px 12px rgba(
|
|
213
|
-
lg: '0 8px 32px rgba(
|
|
214
|
-
glow: '0 0 20px rgba(
|
|
221
|
+
sm: '0 1px 2px rgba(4, 120, 87, 0.1)',
|
|
222
|
+
md: '0 4px 12px rgba(4, 120, 87, 0.12), 0 0 0 1px rgba(4, 120, 87, 0.15)',
|
|
223
|
+
lg: '0 8px 32px rgba(4, 120, 87, 0.15), 0 0 0 1px rgba(4, 120, 87, 0.2)',
|
|
224
|
+
glow: '0 0 20px rgba(4, 120, 87, 0.15)',
|
|
215
225
|
},
|
|
216
226
|
transitions: DEVBAR_THEME.transitions,
|
|
217
227
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type A11yState, type AxeResult, type AxeViolation, clearA11yCache, formatViolation, getBadgeColor, getCachedResult, getImpactColor, getViolationCounts, groupViolationsByImpact, isAxeLoaded, preloadAxe, runA11yAudit, } from './accessibility.js';
|
|
2
|
+
export { BUTTON_COLORS, CATEGORY_COLORS, COLORS, DEVBAR_THEME, DEVBAR_THEME_LIGHT, type DevBarTheme, type DevBarThemeInput, FONT_MONO, generateBreakpointCSS, generateThemeCSSVars, getEffectiveTheme, getStoredThemeMode, getTheme, getThemeColors, injectThemeCSS, STORAGE_KEYS, setStoredThemeMode, TAILWIND_BREAKPOINTS, type TailwindBreakpoint, type ThemeColors, } from './constants.js';
|
|
2
3
|
export { DebugLogger, normalizeDebugConfig } from './debug.js';
|
|
3
4
|
export { EARLY_CONSOLE_CAPTURE_SCRIPT } from './earlyConsoleCapture.js';
|
|
4
5
|
export { destroyGlobalDevBar, earlyConsoleCapture, GlobalDevBar, getGlobalDevBar, initGlobalDevBar, } from './GlobalDevBar.js';
|
|
5
|
-
export { initDebug, initFull, initMinimal, initPerformance, initResponsive, PRESET_DEBUG, PRESET_FULL, PRESET_MINIMAL, PRESET_PERFORMANCE, PRESET_RESPONSIVE, } from './presets.js';
|
|
6
6
|
export { getHtml2Canvas, isHtml2CanvasLoaded, preloadHtml2Canvas } from './lazy/index.js';
|
|
7
|
+
export { formatBytes as formatNetworkBytes, formatDuration, getInitiatorColor, type NetworkEntry, NetworkMonitor, type NetworkState, } from './network.js';
|
|
7
8
|
export { extractDocumentOutline, outlineToMarkdown } from './outline.js';
|
|
9
|
+
export { initDebug, initFull, initMinimal, initPerformance, initResponsive, PRESET_DEBUG, PRESET_FULL, PRESET_MINIMAL, PRESET_PERFORMANCE, PRESET_RESPONSIVE, } from './presets.js';
|
|
8
10
|
export { extractPageSchema, schemaToMarkdown } from './schema.js';
|
|
9
|
-
export {
|
|
10
|
-
export { beautifyJson, clearLocalStorage, clearSessionStorage, deleteCookie, deleteLocalStorageItem, deleteSessionStorageItem, formatStorageSummary, getCookies, getLocalStorage, getSessionStorage, getStorageData, setLocalStorageItem, setSessionStorageItem, type CookieItem, type StorageData, type StorageItem, } from './storage.js';
|
|
11
|
-
export { clearA11yCache, formatViolation, getBadgeColor, getCachedResult, getImpactColor, getViolationCounts, groupViolationsByImpact, isAxeLoaded, preloadAxe, runA11yAudit, type A11yState, type AxeResult, type AxeViolation, } from './accessibility.js';
|
|
11
|
+
export { beautifyJson, type CookieItem, clearLocalStorage, clearSessionStorage, deleteCookie, deleteLocalStorageItem, deleteSessionStorageItem, formatStorageSummary, getCookies, getLocalStorage, getSessionStorage, getStorageData, type StorageData, type StorageItem, setLocalStorageItem, setSessionStorageItem, } from './storage.js';
|
|
12
12
|
export type { ConsoleLog, DebugConfig, DevBarControl, GlobalDevBarOptions, OutlineNode, PageSchema, SweetlinkCommand, ThemeMode, } from './types.js';
|
|
13
13
|
export { canvasToDataUrl, copyCanvasToClipboard, delay, formatArg, formatArgs, prepareForCapture, } from './utils.js';
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// DevBar - Development toolbar and utilities
|
|
2
2
|
// Pure vanilla JavaScript - no framework dependencies
|
|
3
|
+
// Accessibility audit utilities
|
|
4
|
+
export { clearA11yCache, formatViolation, getBadgeColor, getCachedResult, getImpactColor, getViolationCounts, groupViolationsByImpact, isAxeLoaded, preloadAxe, runA11yAudit, } from './accessibility.js';
|
|
3
5
|
// Re-export constants and theme utilities
|
|
4
|
-
export { BUTTON_COLORS, CATEGORY_COLORS, COLORS, DEVBAR_THEME, DEVBAR_THEME_LIGHT, FONT_MONO, generateBreakpointCSS, generateThemeCSSVars, getEffectiveTheme, getStoredThemeMode, getTheme, getThemeColors, injectThemeCSS,
|
|
6
|
+
export { BUTTON_COLORS, CATEGORY_COLORS, COLORS, DEVBAR_THEME, DEVBAR_THEME_LIGHT, FONT_MONO, generateBreakpointCSS, generateThemeCSSVars, getEffectiveTheme, getStoredThemeMode, getTheme, getThemeColors, injectThemeCSS, STORAGE_KEYS, setStoredThemeMode, TAILWIND_BREAKPOINTS, } from './constants.js';
|
|
5
7
|
// Debug utilities
|
|
6
8
|
export { DebugLogger, normalizeDebugConfig } from './debug.js';
|
|
7
9
|
// Early console capture script for injection
|
|
8
10
|
export { EARLY_CONSOLE_CAPTURE_SCRIPT } from './earlyConsoleCapture.js';
|
|
9
11
|
// Main vanilla JS devbar
|
|
10
12
|
export { destroyGlobalDevBar, earlyConsoleCapture, GlobalDevBar, getGlobalDevBar, initGlobalDevBar, } from './GlobalDevBar.js';
|
|
11
|
-
// Configuration presets
|
|
12
|
-
export { initDebug, initFull, initMinimal, initPerformance, initResponsive, PRESET_DEBUG, PRESET_FULL, PRESET_MINIMAL, PRESET_PERFORMANCE, PRESET_RESPONSIVE, } from './presets.js';
|
|
13
13
|
// Lazy loading utilities
|
|
14
14
|
export { getHtml2Canvas, isHtml2CanvasLoaded, preloadHtml2Canvas } from './lazy/index.js';
|
|
15
|
+
// Network monitoring utilities
|
|
16
|
+
export { formatBytes as formatNetworkBytes, formatDuration, getInitiatorColor, NetworkMonitor, } from './network.js';
|
|
15
17
|
// Re-export outline/schema functions
|
|
16
18
|
export { extractDocumentOutline, outlineToMarkdown } from './outline.js';
|
|
19
|
+
// Configuration presets
|
|
20
|
+
export { initDebug, initFull, initMinimal, initPerformance, initResponsive, PRESET_DEBUG, PRESET_FULL, PRESET_MINIMAL, PRESET_PERFORMANCE, PRESET_RESPONSIVE, } from './presets.js';
|
|
17
21
|
export { extractPageSchema, schemaToMarkdown } from './schema.js';
|
|
18
|
-
// Network monitoring utilities
|
|
19
|
-
export { formatBytes as formatNetworkBytes, formatDuration, getInitiatorColor, NetworkMonitor, } from './network.js';
|
|
20
22
|
// Storage inspection utilities
|
|
21
23
|
export { beautifyJson, clearLocalStorage, clearSessionStorage, deleteCookie, deleteLocalStorageItem, deleteSessionStorageItem, formatStorageSummary, getCookies, getLocalStorage, getSessionStorage, getStorageData, setLocalStorageItem, setSessionStorageItem, } from './storage.js';
|
|
22
|
-
// Accessibility audit utilities
|
|
23
|
-
export { clearA11yCache, formatViolation, getBadgeColor, getCachedResult, getImpactColor, getViolationCounts, groupViolationsByImpact, isAxeLoaded, preloadAxe, runA11yAudit, } from './accessibility.js';
|
|
24
24
|
// Re-export utilities for external use
|
|
25
25
|
export { canvasToDataUrl, copyCanvasToClipboard, delay, formatArg, formatArgs, prepareForCapture, } from './utils.js';
|
package/dist/outline.js
CHANGED
|
@@ -7,14 +7,39 @@
|
|
|
7
7
|
// Semantic Element Sets
|
|
8
8
|
// ============================================================================
|
|
9
9
|
const semanticElements = new Set([
|
|
10
|
-
'article',
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
10
|
+
'article',
|
|
11
|
+
'aside',
|
|
12
|
+
'nav',
|
|
13
|
+
'section',
|
|
14
|
+
'main',
|
|
15
|
+
'body',
|
|
16
|
+
'header',
|
|
17
|
+
'footer',
|
|
18
|
+
'figure',
|
|
19
|
+
'figcaption',
|
|
20
|
+
'details',
|
|
21
|
+
'summary',
|
|
22
|
+
'dialog',
|
|
23
|
+
'address',
|
|
24
|
+
'hgroup',
|
|
25
|
+
'form',
|
|
26
|
+
'fieldset',
|
|
27
|
+
'legend',
|
|
28
|
+
'ul',
|
|
29
|
+
'ol',
|
|
30
|
+
'dl',
|
|
31
|
+
'menu',
|
|
32
|
+
'table',
|
|
33
|
+
'thead',
|
|
34
|
+
'tbody',
|
|
35
|
+
'tfoot',
|
|
36
|
+
'caption',
|
|
37
|
+
'h1',
|
|
38
|
+
'h2',
|
|
39
|
+
'h3',
|
|
40
|
+
'h4',
|
|
41
|
+
'h5',
|
|
42
|
+
'h6',
|
|
18
43
|
]);
|
|
19
44
|
const headingElements = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']);
|
|
20
45
|
// ============================================================================
|
|
@@ -138,7 +163,15 @@ function extractFromElement(root) {
|
|
|
138
163
|
if (semanticElements.has(tagName)) {
|
|
139
164
|
const text = getElementText(child, tagName);
|
|
140
165
|
const isHeading = headingElements.has(tagName);
|
|
141
|
-
const isLandmark = [
|
|
166
|
+
const isLandmark = [
|
|
167
|
+
'main',
|
|
168
|
+
'nav',
|
|
169
|
+
'header',
|
|
170
|
+
'footer',
|
|
171
|
+
'article',
|
|
172
|
+
'section',
|
|
173
|
+
'aside',
|
|
174
|
+
].includes(tagName);
|
|
142
175
|
const hasText = text.length > 0;
|
|
143
176
|
if (isHeading || isLandmark || hasText) {
|
|
144
177
|
const level = isHeading ? parseInt(tagName[1], 10) : 0;
|
|
@@ -148,7 +181,7 @@ function extractFromElement(root) {
|
|
|
148
181
|
text: text || `<${tagName}>`,
|
|
149
182
|
id: child.id || undefined,
|
|
150
183
|
children: [],
|
|
151
|
-
category: getSemanticCategory(tagName)
|
|
184
|
+
category: getSemanticCategory(tagName),
|
|
152
185
|
};
|
|
153
186
|
if (!isHeading) {
|
|
154
187
|
node.children = extractFromElement(child);
|
package/dist/presets.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pre-configured options for common DevBar use cases.
|
|
5
5
|
*/
|
|
6
|
-
import { GlobalDevBar } from './GlobalDevBar.js';
|
|
6
|
+
import { type GlobalDevBar } from './GlobalDevBar.js';
|
|
7
7
|
import type { GlobalDevBarOptions } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Minimal preset - shows only essential features
|
package/dist/schema.js
CHANGED
|
@@ -15,7 +15,7 @@ export function extractPageSchema() {
|
|
|
15
15
|
metaTags: {},
|
|
16
16
|
openGraph: {},
|
|
17
17
|
twitter: {},
|
|
18
|
-
microdata: []
|
|
18
|
+
microdata: [],
|
|
19
19
|
};
|
|
20
20
|
// Extract JSON-LD
|
|
21
21
|
const jsonLdScripts = document.querySelectorAll('script[type="application/ld+json"]');
|
|
@@ -52,7 +52,8 @@ export function extractPageSchema() {
|
|
|
52
52
|
const propName = prop.getAttribute('itemprop') || '';
|
|
53
53
|
const propValue = prop.getAttribute('content') ||
|
|
54
54
|
prop.getAttribute('href') ||
|
|
55
|
-
prop.textContent?.trim().slice(0, 200) ||
|
|
55
|
+
prop.textContent?.trim().slice(0, 200) ||
|
|
56
|
+
'';
|
|
56
57
|
if (propName)
|
|
57
58
|
props[propName] = propValue;
|
|
58
59
|
});
|
|
@@ -71,7 +72,7 @@ export function schemaToMarkdown(schema) {
|
|
|
71
72
|
md += '## JSON-LD\n\n';
|
|
72
73
|
schema.jsonLd.forEach((item, i) => {
|
|
73
74
|
md += `### Schema ${i + 1}\n\n`;
|
|
74
|
-
md +=
|
|
75
|
+
md += `\`\`\`json\n${JSON.stringify(item, null, 2)}\n\`\`\`\n\n`;
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
if (Object.keys(schema.openGraph).length > 0) {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevBar Settings Persistence
|
|
3
|
+
*
|
|
4
|
+
* Handles saving and loading DevBar settings with Sweetlink server persistence
|
|
5
|
+
* and localStorage fallback.
|
|
6
|
+
*/
|
|
7
|
+
import type { ThemeMode } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Position options for the DevBar
|
|
10
|
+
*/
|
|
11
|
+
export type DevBarPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'bottom-center';
|
|
12
|
+
/**
|
|
13
|
+
* Metrics visibility configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface MetricsVisibility {
|
|
16
|
+
breakpoint: boolean;
|
|
17
|
+
fcp: boolean;
|
|
18
|
+
lcp: boolean;
|
|
19
|
+
cls: boolean;
|
|
20
|
+
inp: boolean;
|
|
21
|
+
pageSize: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Complete DevBar settings schema
|
|
25
|
+
*/
|
|
26
|
+
export interface DevBarSettings {
|
|
27
|
+
/** Schema version for future migrations */
|
|
28
|
+
version: 1;
|
|
29
|
+
position: DevBarPosition;
|
|
30
|
+
themeMode: ThemeMode;
|
|
31
|
+
compactMode: boolean;
|
|
32
|
+
accentColor: string;
|
|
33
|
+
showScreenshot: boolean;
|
|
34
|
+
showConsoleBadges: boolean;
|
|
35
|
+
showTooltips: boolean;
|
|
36
|
+
showMetrics: MetricsVisibility;
|
|
37
|
+
debug: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Default accent color (emerald) */
|
|
40
|
+
export declare const DEFAULT_ACCENT_COLOR = "#10b981";
|
|
41
|
+
/** Preset accent colors for the color picker */
|
|
42
|
+
export declare const ACCENT_COLOR_PRESETS: readonly [{
|
|
43
|
+
readonly name: "Emerald";
|
|
44
|
+
readonly value: "#10b981";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "Blue";
|
|
47
|
+
readonly value: "#3b82f6";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "Purple";
|
|
50
|
+
readonly value: "#a855f7";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "Pink";
|
|
53
|
+
readonly value: "#ec4899";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "Amber";
|
|
56
|
+
readonly value: "#f59e0b";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "Cyan";
|
|
59
|
+
readonly value: "#06b6d4";
|
|
60
|
+
}];
|
|
61
|
+
/**
|
|
62
|
+
* Default settings used when no saved settings exist
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEFAULT_SETTINGS: DevBarSettings;
|
|
65
|
+
/** LocalStorage key for DevBar settings fallback */
|
|
66
|
+
export declare const SETTINGS_STORAGE_KEY = "devbar-settings";
|
|
67
|
+
/**
|
|
68
|
+
* Callback type for settings change events
|
|
69
|
+
*/
|
|
70
|
+
export type SettingsChangeCallback = (settings: DevBarSettings) => void;
|
|
71
|
+
/**
|
|
72
|
+
* SettingsManager handles loading and saving DevBar settings.
|
|
73
|
+
*
|
|
74
|
+
* Storage priority:
|
|
75
|
+
* 1. Sweetlink server (.devbar/settings.json) when connected
|
|
76
|
+
* 2. localStorage fallback when disconnected
|
|
77
|
+
*
|
|
78
|
+
* Settings are always saved to localStorage as a backup, ensuring
|
|
79
|
+
* settings persist even when Sweetlink is unavailable.
|
|
80
|
+
*/
|
|
81
|
+
export declare class SettingsManager {
|
|
82
|
+
private settings;
|
|
83
|
+
private ws;
|
|
84
|
+
private sweetlinkConnected;
|
|
85
|
+
private changeCallbacks;
|
|
86
|
+
private saveTimeout;
|
|
87
|
+
private pendingLoadResolvers;
|
|
88
|
+
/** Debounce delay for saving settings (ms) */
|
|
89
|
+
private static readonly SAVE_DEBOUNCE_MS;
|
|
90
|
+
constructor();
|
|
91
|
+
/**
|
|
92
|
+
* Set the WebSocket connection for Sweetlink communication
|
|
93
|
+
*/
|
|
94
|
+
setWebSocket(ws: WebSocket | null): void;
|
|
95
|
+
/**
|
|
96
|
+
* Update connection status (called when WebSocket connects/disconnects)
|
|
97
|
+
*/
|
|
98
|
+
setConnected(connected: boolean): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get current settings (synchronous)
|
|
101
|
+
*/
|
|
102
|
+
getSettings(): DevBarSettings;
|
|
103
|
+
/**
|
|
104
|
+
* Get a specific setting value
|
|
105
|
+
*/
|
|
106
|
+
get<K extends keyof DevBarSettings>(key: K): DevBarSettings[K];
|
|
107
|
+
/**
|
|
108
|
+
* Load settings from storage
|
|
109
|
+
*
|
|
110
|
+
* When Sweetlink is connected, requests settings from the server.
|
|
111
|
+
* Otherwise, loads from localStorage.
|
|
112
|
+
*/
|
|
113
|
+
loadSettings(): Promise<DevBarSettings>;
|
|
114
|
+
/**
|
|
115
|
+
* Handle settings loaded from server (called by WebSocket message handler)
|
|
116
|
+
*/
|
|
117
|
+
handleSettingsLoaded(settings: DevBarSettings | null): void;
|
|
118
|
+
/**
|
|
119
|
+
* Save settings (debounced)
|
|
120
|
+
*
|
|
121
|
+
* Saves to both Sweetlink server (if connected) and localStorage.
|
|
122
|
+
*/
|
|
123
|
+
saveSettings(partial: Partial<DevBarSettings>): void;
|
|
124
|
+
/**
|
|
125
|
+
* Save settings immediately without debouncing
|
|
126
|
+
*/
|
|
127
|
+
saveSettingsNow(partial: Partial<DevBarSettings>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Reset settings to defaults
|
|
130
|
+
*/
|
|
131
|
+
resetToDefaults(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Subscribe to settings changes
|
|
134
|
+
*/
|
|
135
|
+
onChange(callback: SettingsChangeCallback): () => void;
|
|
136
|
+
private performSave;
|
|
137
|
+
private notifyChange;
|
|
138
|
+
private loadFromLocalStorage;
|
|
139
|
+
private saveToLocalStorage;
|
|
140
|
+
private loadFromServer;
|
|
141
|
+
private saveToServer;
|
|
142
|
+
/**
|
|
143
|
+
* Migrate settings from older versions and fill in missing defaults
|
|
144
|
+
*/
|
|
145
|
+
private migrateSettings;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the singleton SettingsManager instance
|
|
149
|
+
*/
|
|
150
|
+
export declare function getSettingsManager(): SettingsManager;
|