@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/GlobalDevBar.d.ts +96 -2
- package/dist/GlobalDevBar.js +1203 -114
- package/dist/accessibility.d.ts +84 -0
- package/dist/accessibility.js +155 -0
- package/dist/constants.d.ts +102 -1
- package/dist/constants.js +113 -13
- package/dist/debug.d.ts +39 -0
- package/dist/debug.js +92 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +19 -7
- package/dist/lazy/index.d.ts +6 -0
- package/dist/lazy/index.js +6 -0
- package/dist/lazy/lazyHtml2Canvas.d.ts +29 -0
- package/dist/lazy/lazyHtml2Canvas.js +37 -0
- package/dist/network.d.ts +92 -0
- package/dist/network.js +176 -0
- package/dist/outline.js +43 -10
- package/dist/presets.d.ts +57 -0
- package/dist/presets.js +133 -0
- package/dist/schema.js +4 -3
- package/dist/settings.d.ts +150 -0
- package/dist/settings.js +292 -0
- package/dist/storage.d.ts +83 -0
- package/dist/storage.js +182 -0
- package/dist/types.d.ts +26 -1
- 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/index.js
CHANGED
|
@@ -1,13 +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';
|
|
5
|
+
// Re-export constants and theme utilities
|
|
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';
|
|
7
|
+
// Debug utilities
|
|
8
|
+
export { DebugLogger, normalizeDebugConfig } from './debug.js';
|
|
9
|
+
// Early console capture script for injection
|
|
10
|
+
export { EARLY_CONSOLE_CAPTURE_SCRIPT } from './earlyConsoleCapture.js';
|
|
3
11
|
// Main vanilla JS devbar
|
|
4
|
-
export {
|
|
5
|
-
//
|
|
6
|
-
export {
|
|
12
|
+
export { destroyGlobalDevBar, earlyConsoleCapture, GlobalDevBar, getGlobalDevBar, initGlobalDevBar, } from './GlobalDevBar.js';
|
|
13
|
+
// Lazy loading utilities
|
|
14
|
+
export { getHtml2Canvas, isHtml2CanvasLoaded, preloadHtml2Canvas } from './lazy/index.js';
|
|
15
|
+
// Network monitoring utilities
|
|
16
|
+
export { formatBytes as formatNetworkBytes, formatDuration, getInitiatorColor, NetworkMonitor, } from './network.js';
|
|
7
17
|
// Re-export outline/schema functions
|
|
8
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';
|
|
9
21
|
export { extractPageSchema, schemaToMarkdown } from './schema.js';
|
|
10
|
-
//
|
|
11
|
-
export {
|
|
12
|
-
//
|
|
13
|
-
export {
|
|
22
|
+
// Storage inspection utilities
|
|
23
|
+
export { beautifyJson, clearLocalStorage, clearSessionStorage, deleteCookie, deleteLocalStorageItem, deleteSessionStorageItem, formatStorageSummary, getCookies, getLocalStorage, getSessionStorage, getStorageData, setLocalStorageItem, setSessionStorageItem, } from './storage.js';
|
|
24
|
+
// Re-export utilities for external use
|
|
25
|
+
export { canvasToDataUrl, copyCanvasToClipboard, delay, formatArg, formatArgs, prepareForCapture, } from './utils.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Loading for html2canvas
|
|
3
|
+
*
|
|
4
|
+
* Defers html2canvas-pro loading until first screenshot capture,
|
|
5
|
+
* reducing initial bundle size and page load time.
|
|
6
|
+
*/
|
|
7
|
+
type Html2CanvasFunc = (element: HTMLElement, options?: {
|
|
8
|
+
logging?: boolean;
|
|
9
|
+
useCORS?: boolean;
|
|
10
|
+
allowTaint?: boolean;
|
|
11
|
+
scale?: number;
|
|
12
|
+
width?: number;
|
|
13
|
+
windowWidth?: number;
|
|
14
|
+
}) => Promise<HTMLCanvasElement>;
|
|
15
|
+
/**
|
|
16
|
+
* Get html2canvas function, lazily loading it on first call.
|
|
17
|
+
* Subsequent calls return the same cached promise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getHtml2Canvas(): Promise<Html2CanvasFunc>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if html2canvas has been loaded
|
|
22
|
+
*/
|
|
23
|
+
export declare function isHtml2CanvasLoaded(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Preload html2canvas without waiting for result.
|
|
26
|
+
* Useful for warming up the cache before user interaction.
|
|
27
|
+
*/
|
|
28
|
+
export declare function preloadHtml2Canvas(): void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Loading for html2canvas
|
|
3
|
+
*
|
|
4
|
+
* Defers html2canvas-pro loading until first screenshot capture,
|
|
5
|
+
* reducing initial bundle size and page load time.
|
|
6
|
+
*/
|
|
7
|
+
// Cached promise for the html2canvas module
|
|
8
|
+
let html2canvasPromise = null;
|
|
9
|
+
/**
|
|
10
|
+
* Get html2canvas function, lazily loading it on first call.
|
|
11
|
+
* Subsequent calls return the same cached promise.
|
|
12
|
+
*/
|
|
13
|
+
export async function getHtml2Canvas() {
|
|
14
|
+
if (!html2canvasPromise) {
|
|
15
|
+
html2canvasPromise = import('html2canvas-pro').then((module) => {
|
|
16
|
+
// Handle ESM/CJS interop
|
|
17
|
+
const html2canvas = module.default ?? module;
|
|
18
|
+
return html2canvas;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return html2canvasPromise;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if html2canvas has been loaded
|
|
25
|
+
*/
|
|
26
|
+
export function isHtml2CanvasLoaded() {
|
|
27
|
+
return html2canvasPromise !== null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Preload html2canvas without waiting for result.
|
|
31
|
+
* Useful for warming up the cache before user interaction.
|
|
32
|
+
*/
|
|
33
|
+
export function preloadHtml2Canvas() {
|
|
34
|
+
getHtml2Canvas().catch(() => {
|
|
35
|
+
// Silently ignore preload errors
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Activity Monitor
|
|
3
|
+
*
|
|
4
|
+
* Tracks network requests using PerformanceObserver and fetch interception.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Network request entry
|
|
8
|
+
*/
|
|
9
|
+
export interface NetworkEntry {
|
|
10
|
+
url: string;
|
|
11
|
+
name: string;
|
|
12
|
+
initiatorType: string;
|
|
13
|
+
duration: number;
|
|
14
|
+
transferSize: number;
|
|
15
|
+
encodedBodySize: number;
|
|
16
|
+
decodedBodySize: number;
|
|
17
|
+
startTime: number;
|
|
18
|
+
responseEnd: number;
|
|
19
|
+
method?: string;
|
|
20
|
+
status?: number;
|
|
21
|
+
statusText?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Network monitor state
|
|
25
|
+
*/
|
|
26
|
+
export interface NetworkState {
|
|
27
|
+
entries: NetworkEntry[];
|
|
28
|
+
totalRequests: number;
|
|
29
|
+
totalSize: number;
|
|
30
|
+
pendingCount: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Network activity monitor using PerformanceObserver
|
|
34
|
+
*/
|
|
35
|
+
export declare class NetworkMonitor {
|
|
36
|
+
private entries;
|
|
37
|
+
private observer;
|
|
38
|
+
private listeners;
|
|
39
|
+
private maxEntries;
|
|
40
|
+
/**
|
|
41
|
+
* Start monitoring network activity
|
|
42
|
+
*/
|
|
43
|
+
start(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Stop monitoring network activity
|
|
46
|
+
*/
|
|
47
|
+
stop(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Add a new entry from PerformanceResourceTiming
|
|
50
|
+
*/
|
|
51
|
+
private addEntry;
|
|
52
|
+
/**
|
|
53
|
+
* Extract resource name from URL
|
|
54
|
+
*/
|
|
55
|
+
private getResourceName;
|
|
56
|
+
/**
|
|
57
|
+
* Get current network state
|
|
58
|
+
*/
|
|
59
|
+
getState(): NetworkState;
|
|
60
|
+
/**
|
|
61
|
+
* Get entries filtered by type
|
|
62
|
+
*/
|
|
63
|
+
getEntriesByType(type: string): NetworkEntry[];
|
|
64
|
+
/**
|
|
65
|
+
* Get entries filtered by search query
|
|
66
|
+
*/
|
|
67
|
+
search(query: string): NetworkEntry[];
|
|
68
|
+
/**
|
|
69
|
+
* Clear all entries
|
|
70
|
+
*/
|
|
71
|
+
clear(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to state changes
|
|
74
|
+
*/
|
|
75
|
+
subscribe(listener: (state: NetworkState) => void): () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Notify all listeners of state change
|
|
78
|
+
*/
|
|
79
|
+
private notifyListeners;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Format bytes to human-readable string
|
|
83
|
+
*/
|
|
84
|
+
export declare function formatBytes(bytes: number): string;
|
|
85
|
+
/**
|
|
86
|
+
* Format duration to human-readable string
|
|
87
|
+
*/
|
|
88
|
+
export declare function formatDuration(ms: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Get color for initiator type
|
|
91
|
+
*/
|
|
92
|
+
export declare function getInitiatorColor(type: string): string;
|
package/dist/network.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Activity Monitor
|
|
3
|
+
*
|
|
4
|
+
* Tracks network requests using PerformanceObserver and fetch interception.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Network activity monitor using PerformanceObserver
|
|
8
|
+
*/
|
|
9
|
+
export class NetworkMonitor {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.entries = [];
|
|
12
|
+
this.observer = null;
|
|
13
|
+
this.listeners = new Set();
|
|
14
|
+
this.maxEntries = 200;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Start monitoring network activity
|
|
18
|
+
*/
|
|
19
|
+
start() {
|
|
20
|
+
if (typeof PerformanceObserver === 'undefined') {
|
|
21
|
+
console.warn('[NetworkMonitor] PerformanceObserver not supported');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Get already loaded resources
|
|
25
|
+
const existingResources = performance.getEntriesByType('resource');
|
|
26
|
+
for (const entry of existingResources) {
|
|
27
|
+
this.addEntry(entry);
|
|
28
|
+
}
|
|
29
|
+
// Watch for new resources
|
|
30
|
+
try {
|
|
31
|
+
this.observer = new PerformanceObserver((list) => {
|
|
32
|
+
for (const entry of list.getEntries()) {
|
|
33
|
+
this.addEntry(entry);
|
|
34
|
+
}
|
|
35
|
+
this.notifyListeners();
|
|
36
|
+
});
|
|
37
|
+
this.observer.observe({ type: 'resource', buffered: true });
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.warn('[NetworkMonitor] Failed to start observer', e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stop monitoring network activity
|
|
45
|
+
*/
|
|
46
|
+
stop() {
|
|
47
|
+
if (this.observer) {
|
|
48
|
+
this.observer.disconnect();
|
|
49
|
+
this.observer = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Add a new entry from PerformanceResourceTiming
|
|
54
|
+
*/
|
|
55
|
+
addEntry(timing) {
|
|
56
|
+
const entry = {
|
|
57
|
+
url: timing.name,
|
|
58
|
+
name: this.getResourceName(timing.name),
|
|
59
|
+
initiatorType: timing.initiatorType,
|
|
60
|
+
duration: Math.round(timing.duration),
|
|
61
|
+
transferSize: timing.transferSize,
|
|
62
|
+
encodedBodySize: timing.encodedBodySize,
|
|
63
|
+
decodedBodySize: timing.decodedBodySize,
|
|
64
|
+
startTime: Math.round(timing.startTime),
|
|
65
|
+
responseEnd: Math.round(timing.responseEnd),
|
|
66
|
+
};
|
|
67
|
+
this.entries.push(entry);
|
|
68
|
+
// Trim to max entries
|
|
69
|
+
if (this.entries.length > this.maxEntries) {
|
|
70
|
+
this.entries = this.entries.slice(-this.maxEntries);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extract resource name from URL
|
|
75
|
+
*/
|
|
76
|
+
getResourceName(url) {
|
|
77
|
+
try {
|
|
78
|
+
const urlObj = new URL(url);
|
|
79
|
+
const pathname = urlObj.pathname;
|
|
80
|
+
const parts = pathname.split('/').filter(Boolean);
|
|
81
|
+
return parts.length > 0 ? parts[parts.length - 1] : urlObj.hostname;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return url.slice(0, 50);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get current network state
|
|
89
|
+
*/
|
|
90
|
+
getState() {
|
|
91
|
+
let totalSize = 0;
|
|
92
|
+
for (const entry of this.entries) {
|
|
93
|
+
totalSize += entry.transferSize || 0;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
entries: [...this.entries],
|
|
97
|
+
totalRequests: this.entries.length,
|
|
98
|
+
totalSize,
|
|
99
|
+
pendingCount: 0, // Could track with fetch interception
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get entries filtered by type
|
|
104
|
+
*/
|
|
105
|
+
getEntriesByType(type) {
|
|
106
|
+
return this.entries.filter((e) => e.initiatorType === type);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get entries filtered by search query
|
|
110
|
+
*/
|
|
111
|
+
search(query) {
|
|
112
|
+
const lowerQuery = query.toLowerCase();
|
|
113
|
+
return this.entries.filter((e) => e.url.toLowerCase().includes(lowerQuery) ||
|
|
114
|
+
e.name.toLowerCase().includes(lowerQuery) ||
|
|
115
|
+
e.initiatorType.toLowerCase().includes(lowerQuery));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Clear all entries
|
|
119
|
+
*/
|
|
120
|
+
clear() {
|
|
121
|
+
this.entries = [];
|
|
122
|
+
this.notifyListeners();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Subscribe to state changes
|
|
126
|
+
*/
|
|
127
|
+
subscribe(listener) {
|
|
128
|
+
this.listeners.add(listener);
|
|
129
|
+
return () => this.listeners.delete(listener);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Notify all listeners of state change
|
|
133
|
+
*/
|
|
134
|
+
notifyListeners() {
|
|
135
|
+
const state = this.getState();
|
|
136
|
+
for (const listener of this.listeners) {
|
|
137
|
+
listener(state);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Format bytes to human-readable string
|
|
143
|
+
*/
|
|
144
|
+
export function formatBytes(bytes) {
|
|
145
|
+
if (bytes === 0)
|
|
146
|
+
return '0 B';
|
|
147
|
+
if (bytes < 1024)
|
|
148
|
+
return `${bytes} B`;
|
|
149
|
+
if (bytes < 1024 * 1024)
|
|
150
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
151
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Format duration to human-readable string
|
|
155
|
+
*/
|
|
156
|
+
export function formatDuration(ms) {
|
|
157
|
+
if (ms < 1000)
|
|
158
|
+
return `${Math.round(ms)}ms`;
|
|
159
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get color for initiator type
|
|
163
|
+
*/
|
|
164
|
+
export function getInitiatorColor(type) {
|
|
165
|
+
const colors = {
|
|
166
|
+
script: '#f59e0b', // amber
|
|
167
|
+
link: '#3b82f6', // blue
|
|
168
|
+
css: '#a855f7', // purple
|
|
169
|
+
fetch: '#10b981', // emerald
|
|
170
|
+
xmlhttprequest: '#10b981', // emerald
|
|
171
|
+
img: '#ec4899', // pink
|
|
172
|
+
iframe: '#06b6d4', // cyan
|
|
173
|
+
other: '#6b7280', // gray
|
|
174
|
+
};
|
|
175
|
+
return colors[type] || colors.other;
|
|
176
|
+
}
|
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);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevBar Configuration Presets
|
|
3
|
+
*
|
|
4
|
+
* Pre-configured options for common DevBar use cases.
|
|
5
|
+
*/
|
|
6
|
+
import { type GlobalDevBar } from './GlobalDevBar.js';
|
|
7
|
+
import type { GlobalDevBarOptions } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Minimal preset - shows only essential features
|
|
10
|
+
* Good for production debugging with minimal visual footprint
|
|
11
|
+
*/
|
|
12
|
+
export declare const PRESET_MINIMAL: GlobalDevBarOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Full preset - shows all features
|
|
15
|
+
* Good for comprehensive development monitoring
|
|
16
|
+
*/
|
|
17
|
+
export declare const PRESET_FULL: GlobalDevBarOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Performance preset - focuses on Core Web Vitals
|
|
20
|
+
* Good for performance optimization work
|
|
21
|
+
*/
|
|
22
|
+
export declare const PRESET_PERFORMANCE: GlobalDevBarOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Responsive preset - focuses on responsive design
|
|
25
|
+
* Good for layout and breakpoint work
|
|
26
|
+
*/
|
|
27
|
+
export declare const PRESET_RESPONSIVE: GlobalDevBarOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Debug preset - full features with debug logging
|
|
30
|
+
* Good for troubleshooting DevBar itself
|
|
31
|
+
*/
|
|
32
|
+
export declare const PRESET_DEBUG: GlobalDevBarOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize DevBar with minimal preset
|
|
35
|
+
* @param options Additional options to merge with preset
|
|
36
|
+
*/
|
|
37
|
+
export declare function initMinimal(options?: Partial<GlobalDevBarOptions>): GlobalDevBar;
|
|
38
|
+
/**
|
|
39
|
+
* Initialize DevBar with full preset
|
|
40
|
+
* @param options Additional options to merge with preset
|
|
41
|
+
*/
|
|
42
|
+
export declare function initFull(options?: Partial<GlobalDevBarOptions>): GlobalDevBar;
|
|
43
|
+
/**
|
|
44
|
+
* Initialize DevBar with performance preset
|
|
45
|
+
* @param options Additional options to merge with preset
|
|
46
|
+
*/
|
|
47
|
+
export declare function initPerformance(options?: Partial<GlobalDevBarOptions>): GlobalDevBar;
|
|
48
|
+
/**
|
|
49
|
+
* Initialize DevBar with responsive preset
|
|
50
|
+
* @param options Additional options to merge with preset
|
|
51
|
+
*/
|
|
52
|
+
export declare function initResponsive(options?: Partial<GlobalDevBarOptions>): GlobalDevBar;
|
|
53
|
+
/**
|
|
54
|
+
* Initialize DevBar with debug preset
|
|
55
|
+
* @param options Additional options to merge with preset
|
|
56
|
+
*/
|
|
57
|
+
export declare function initDebug(options?: Partial<GlobalDevBarOptions>): GlobalDevBar;
|
package/dist/presets.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevBar Configuration Presets
|
|
3
|
+
*
|
|
4
|
+
* Pre-configured options for common DevBar use cases.
|
|
5
|
+
*/
|
|
6
|
+
import { initGlobalDevBar } from './GlobalDevBar.js';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Preset Configurations
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/**
|
|
11
|
+
* Minimal preset - shows only essential features
|
|
12
|
+
* Good for production debugging with minimal visual footprint
|
|
13
|
+
*/
|
|
14
|
+
export const PRESET_MINIMAL = {
|
|
15
|
+
showMetrics: {
|
|
16
|
+
breakpoint: false,
|
|
17
|
+
fcp: false,
|
|
18
|
+
lcp: false,
|
|
19
|
+
cls: false,
|
|
20
|
+
inp: false,
|
|
21
|
+
pageSize: false,
|
|
22
|
+
},
|
|
23
|
+
showScreenshot: false,
|
|
24
|
+
showConsoleBadges: true,
|
|
25
|
+
showTooltips: false,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Full preset - shows all features
|
|
29
|
+
* Good for comprehensive development monitoring
|
|
30
|
+
*/
|
|
31
|
+
export const PRESET_FULL = {
|
|
32
|
+
showMetrics: {
|
|
33
|
+
breakpoint: true,
|
|
34
|
+
fcp: true,
|
|
35
|
+
lcp: true,
|
|
36
|
+
cls: true,
|
|
37
|
+
inp: true,
|
|
38
|
+
pageSize: true,
|
|
39
|
+
},
|
|
40
|
+
showScreenshot: true,
|
|
41
|
+
showConsoleBadges: true,
|
|
42
|
+
showTooltips: true,
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Performance preset - focuses on Core Web Vitals
|
|
46
|
+
* Good for performance optimization work
|
|
47
|
+
*/
|
|
48
|
+
export const PRESET_PERFORMANCE = {
|
|
49
|
+
showMetrics: {
|
|
50
|
+
breakpoint: false,
|
|
51
|
+
fcp: true,
|
|
52
|
+
lcp: true,
|
|
53
|
+
cls: true,
|
|
54
|
+
inp: true,
|
|
55
|
+
pageSize: true,
|
|
56
|
+
},
|
|
57
|
+
showScreenshot: false,
|
|
58
|
+
showConsoleBadges: false,
|
|
59
|
+
showTooltips: true,
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Responsive preset - focuses on responsive design
|
|
63
|
+
* Good for layout and breakpoint work
|
|
64
|
+
*/
|
|
65
|
+
export const PRESET_RESPONSIVE = {
|
|
66
|
+
showMetrics: {
|
|
67
|
+
breakpoint: true,
|
|
68
|
+
fcp: false,
|
|
69
|
+
lcp: false,
|
|
70
|
+
cls: false,
|
|
71
|
+
inp: false,
|
|
72
|
+
pageSize: false,
|
|
73
|
+
},
|
|
74
|
+
showScreenshot: true,
|
|
75
|
+
showConsoleBadges: false,
|
|
76
|
+
showTooltips: true,
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Debug preset - full features with debug logging
|
|
80
|
+
* Good for troubleshooting DevBar itself
|
|
81
|
+
*/
|
|
82
|
+
export const PRESET_DEBUG = {
|
|
83
|
+
showMetrics: {
|
|
84
|
+
breakpoint: true,
|
|
85
|
+
fcp: true,
|
|
86
|
+
lcp: true,
|
|
87
|
+
cls: true,
|
|
88
|
+
inp: true,
|
|
89
|
+
pageSize: true,
|
|
90
|
+
},
|
|
91
|
+
showScreenshot: true,
|
|
92
|
+
showConsoleBadges: true,
|
|
93
|
+
showTooltips: true,
|
|
94
|
+
debug: true,
|
|
95
|
+
};
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// Convenience Initialization Functions
|
|
98
|
+
// ============================================================================
|
|
99
|
+
/**
|
|
100
|
+
* Initialize DevBar with minimal preset
|
|
101
|
+
* @param options Additional options to merge with preset
|
|
102
|
+
*/
|
|
103
|
+
export function initMinimal(options) {
|
|
104
|
+
return initGlobalDevBar({ ...PRESET_MINIMAL, ...options });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Initialize DevBar with full preset
|
|
108
|
+
* @param options Additional options to merge with preset
|
|
109
|
+
*/
|
|
110
|
+
export function initFull(options) {
|
|
111
|
+
return initGlobalDevBar({ ...PRESET_FULL, ...options });
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Initialize DevBar with performance preset
|
|
115
|
+
* @param options Additional options to merge with preset
|
|
116
|
+
*/
|
|
117
|
+
export function initPerformance(options) {
|
|
118
|
+
return initGlobalDevBar({ ...PRESET_PERFORMANCE, ...options });
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Initialize DevBar with responsive preset
|
|
122
|
+
* @param options Additional options to merge with preset
|
|
123
|
+
*/
|
|
124
|
+
export function initResponsive(options) {
|
|
125
|
+
return initGlobalDevBar({ ...PRESET_RESPONSIVE, ...options });
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Initialize DevBar with debug preset
|
|
129
|
+
* @param options Additional options to merge with preset
|
|
130
|
+
*/
|
|
131
|
+
export function initDebug(options) {
|
|
132
|
+
return initGlobalDevBar({ ...PRESET_DEBUG, ...options });
|
|
133
|
+
}
|
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) {
|