@ytspar/devbar 1.3.1 → 1.4.1

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 (93) hide show
  1. package/README.md +43 -0
  2. package/dist/accessibility.d.ts +4 -0
  3. package/dist/accessibility.d.ts.map +1 -1
  4. package/dist/accessibility.js +57 -0
  5. package/dist/accessibility.js.map +1 -1
  6. package/dist/constants.d.ts +8 -23
  7. package/dist/constants.d.ts.map +1 -1
  8. package/dist/constants.js +10 -3
  9. package/dist/constants.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/modules/index.d.ts +1 -1
  15. package/dist/modules/index.d.ts.map +1 -1
  16. package/dist/modules/index.js +1 -0
  17. package/dist/modules/index.js.map +1 -1
  18. package/dist/modules/keyboard.d.ts +1 -1
  19. package/dist/modules/keyboard.d.ts.map +1 -1
  20. package/dist/modules/keyboard.js +4 -11
  21. package/dist/modules/keyboard.js.map +1 -1
  22. package/dist/modules/rendering/buttons.d.ts +19 -0
  23. package/dist/modules/rendering/buttons.d.ts.map +1 -0
  24. package/dist/modules/rendering/buttons.js +369 -0
  25. package/dist/modules/rendering/buttons.js.map +1 -0
  26. package/dist/modules/rendering/collapsed.d.ts +6 -0
  27. package/dist/modules/rendering/collapsed.d.ts.map +1 -0
  28. package/dist/modules/rendering/collapsed.js +124 -0
  29. package/dist/modules/rendering/collapsed.js.map +1 -0
  30. package/dist/modules/rendering/common.d.ts +21 -0
  31. package/dist/modules/rendering/common.d.ts.map +1 -0
  32. package/dist/modules/rendering/common.js +60 -0
  33. package/dist/modules/rendering/common.js.map +1 -0
  34. package/dist/modules/rendering/compact.d.ts +6 -0
  35. package/dist/modules/rendering/compact.d.ts.map +1 -0
  36. package/dist/modules/rendering/compact.js +107 -0
  37. package/dist/modules/rendering/compact.js.map +1 -0
  38. package/dist/modules/rendering/console.d.ts +7 -0
  39. package/dist/modules/rendering/console.d.ts.map +1 -0
  40. package/dist/modules/rendering/console.js +78 -0
  41. package/dist/modules/rendering/console.js.map +1 -0
  42. package/dist/modules/rendering/expanded.d.ts +13 -0
  43. package/dist/modules/rendering/expanded.d.ts.map +1 -0
  44. package/dist/modules/rendering/expanded.js +439 -0
  45. package/dist/modules/rendering/expanded.js.map +1 -0
  46. package/dist/modules/rendering/index.d.ts +22 -0
  47. package/dist/modules/rendering/index.d.ts.map +1 -0
  48. package/dist/modules/rendering/index.js +109 -0
  49. package/dist/modules/rendering/index.js.map +1 -0
  50. package/dist/modules/rendering/modals.d.ts +9 -0
  51. package/dist/modules/rendering/modals.d.ts.map +1 -0
  52. package/dist/modules/rendering/modals.js +1068 -0
  53. package/dist/modules/rendering/modals.js.map +1 -0
  54. package/dist/modules/rendering/settings.d.ts +6 -0
  55. package/dist/modules/rendering/settings.d.ts.map +1 -0
  56. package/dist/modules/rendering/settings.js +605 -0
  57. package/dist/modules/rendering/settings.js.map +1 -0
  58. package/dist/modules/rendering.d.ts +15 -16
  59. package/dist/modules/rendering.d.ts.map +1 -1
  60. package/dist/modules/rendering.js +15 -2919
  61. package/dist/modules/rendering.js.map +1 -1
  62. package/dist/modules/screenshot.d.ts +11 -2
  63. package/dist/modules/screenshot.d.ts.map +1 -1
  64. package/dist/modules/screenshot.js +32 -29
  65. package/dist/modules/screenshot.js.map +1 -1
  66. package/dist/modules/tooltips.d.ts +7 -5
  67. package/dist/modules/tooltips.d.ts.map +1 -1
  68. package/dist/modules/tooltips.js +133 -157
  69. package/dist/modules/tooltips.js.map +1 -1
  70. package/dist/modules/types.d.ts +7 -0
  71. package/dist/modules/types.d.ts.map +1 -1
  72. package/dist/modules/types.js +14 -1
  73. package/dist/modules/types.js.map +1 -1
  74. package/dist/modules/websocket.d.ts.map +1 -1
  75. package/dist/modules/websocket.js +334 -264
  76. package/dist/modules/websocket.js.map +1 -1
  77. package/dist/ui/buttons.d.ts.map +1 -1
  78. package/dist/ui/buttons.js +11 -9
  79. package/dist/ui/buttons.js.map +1 -1
  80. package/dist/ui/cards.js +3 -3
  81. package/dist/ui/cards.js.map +1 -1
  82. package/dist/ui/icons.d.ts +13 -0
  83. package/dist/ui/icons.d.ts.map +1 -1
  84. package/dist/ui/icons.js +24 -3
  85. package/dist/ui/icons.js.map +1 -1
  86. package/dist/ui/index.d.ts +1 -1
  87. package/dist/ui/index.d.ts.map +1 -1
  88. package/dist/ui/index.js.map +1 -1
  89. package/dist/ui/modals.d.ts +3 -2
  90. package/dist/ui/modals.d.ts.map +1 -1
  91. package/dist/ui/modals.js +28 -26
  92. package/dist/ui/modals.js.map +1 -1
  93. package/package.json +3 -4
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Compact state rendering for the DevBar.
3
+ */
4
+ import { BUTTON_COLORS, FONT_MONO, withAlpha } from '../../constants.js';
5
+ import { attachTextTooltip } from '../tooltips.js';
6
+ import { createConsoleBadge, createScreenshotButton, createSettingsButton } from './buttons.js';
7
+ import { captureDotPosition, createConnectionIndicator } from './common.js';
8
+ export function renderCompact(state) {
9
+ if (!state.container)
10
+ return;
11
+ const { position, accentColor } = state.options;
12
+ const { errorCount, warningCount, infoCount } = state.getLogCounts();
13
+ // Simple position styles - same anchor points as expanded mode
14
+ const positionStyles = {
15
+ 'bottom-left': { bottom: '20px', left: '80px' },
16
+ 'bottom-right': { bottom: '20px', right: '16px' },
17
+ 'top-left': { top: '20px', left: '80px' },
18
+ 'top-right': { top: '20px', right: '16px' },
19
+ 'bottom-center': { bottom: '12px', left: '50%', transform: 'translateX(-50%)' },
20
+ };
21
+ const posStyle = positionStyles[position] ?? positionStyles['bottom-left'];
22
+ const wrapper = state.container;
23
+ state.resetPositionStyles(wrapper);
24
+ Object.assign(wrapper.style, {
25
+ position: 'fixed',
26
+ ...posStyle,
27
+ zIndex: '9999',
28
+ backgroundColor: 'var(--devbar-color-bg-card)',
29
+ border: `1px solid ${accentColor}`,
30
+ borderRadius: '20px',
31
+ color: accentColor,
32
+ boxShadow: `0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px ${withAlpha(accentColor, 10)}`,
33
+ backdropFilter: 'blur(8px)',
34
+ WebkitBackdropFilter: 'blur(8px)',
35
+ padding: '6px 10px',
36
+ display: 'flex',
37
+ alignItems: 'center',
38
+ gap: '8px',
39
+ fontFamily: FONT_MONO,
40
+ fontSize: '0.6875rem',
41
+ });
42
+ // Connection indicator
43
+ const connIndicator = createConnectionIndicator(state);
44
+ const connDot = connIndicator.querySelector('.devbar-conn-dot');
45
+ attachTextTooltip(state, connIndicator, () => state.sweetlinkConnected ? 'Sweetlink connected' : 'Sweetlink disconnected');
46
+ connIndicator.onclick = (e) => {
47
+ e.stopPropagation();
48
+ captureDotPosition(state, connDot);
49
+ state.collapsed = true;
50
+ state.debug.state('Collapsed DevBar from compact mode');
51
+ state.render();
52
+ };
53
+ wrapper.appendChild(connIndicator);
54
+ // Error badge
55
+ if (errorCount > 0) {
56
+ wrapper.appendChild(createConsoleBadge(state, 'error', errorCount, BUTTON_COLORS.error));
57
+ }
58
+ // Warning badge
59
+ if (warningCount > 0) {
60
+ wrapper.appendChild(createConsoleBadge(state, 'warn', warningCount, BUTTON_COLORS.warning));
61
+ }
62
+ // Info badge
63
+ if (infoCount > 0) {
64
+ wrapper.appendChild(createConsoleBadge(state, 'info', infoCount, BUTTON_COLORS.info));
65
+ }
66
+ // Screenshot button (if enabled)
67
+ if (state.options.showScreenshot) {
68
+ wrapper.appendChild(createScreenshotButton(state, accentColor));
69
+ }
70
+ // Settings gear button
71
+ wrapper.appendChild(createSettingsButton(state));
72
+ // Expand button (double-arrow)
73
+ const expandBtn = document.createElement('button');
74
+ expandBtn.type = 'button';
75
+ Object.assign(expandBtn.style, {
76
+ display: 'flex',
77
+ alignItems: 'center',
78
+ justifyContent: 'center',
79
+ width: '18px',
80
+ height: '18px',
81
+ borderRadius: '50%',
82
+ border: `1px solid ${withAlpha(accentColor, 38)}`,
83
+ backgroundColor: 'transparent',
84
+ color: withAlpha(accentColor, 60),
85
+ cursor: 'pointer',
86
+ fontSize: '0.5rem',
87
+ transition: 'all 150ms',
88
+ });
89
+ expandBtn.textContent = '\u27EB';
90
+ attachTextTooltip(state, expandBtn, () => 'Expand DevBar', {
91
+ onEnter: () => {
92
+ expandBtn.style.backgroundColor = withAlpha(accentColor, 13);
93
+ expandBtn.style.borderColor = accentColor;
94
+ expandBtn.style.color = accentColor;
95
+ },
96
+ onLeave: () => {
97
+ expandBtn.style.backgroundColor = 'transparent';
98
+ expandBtn.style.borderColor = withAlpha(accentColor, 38);
99
+ expandBtn.style.color = withAlpha(accentColor, 60);
100
+ },
101
+ });
102
+ expandBtn.onclick = () => {
103
+ state.toggleCompactMode();
104
+ };
105
+ wrapper.appendChild(expandBtn);
106
+ }
107
+ //# sourceMappingURL=compact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../src/modules/rendering/compact.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,UAAU,aAAa,CAAC,KAAkB;IAC9C,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO;IAE7B,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;IAChD,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IAErE,+DAA+D;IAC/D,MAAM,cAAc,GAAkC;QACpD,aAAa,EAAE,EAAE,MAAM,EA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,CAAC;IACH,SAAS,CAAC,OAAO,GAAG,GAAG,EAAE;QACvB,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC5B,CAAC,CAAC;IACF,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Console popup rendering for the DevBar.
3
+ */
4
+ import type { ConsoleCapture } from '@ytspar/sweetlink/browser/consoleCapture';
5
+ import type { DevBarState } from '../types.js';
6
+ export declare function renderConsolePopup(state: DevBarState, consoleCaptureSingleton: ConsoleCapture): void;
7
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/modules/rendering/console.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAW/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,cAAc,GAAG,IAAI,CAiDpG"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Console popup rendering for the DevBar.
3
+ */
4
+ import { BUTTON_COLORS, CSS_COLORS } from '../../constants.js';
5
+ import { createEmptyMessage, createModalBox, createModalContent, createModalHeader, createModalOverlay, } from '../../ui/index.js';
6
+ import { consoleLogsToMarkdown, handleSaveConsoleLogs } from '../screenshot.js';
7
+ export function renderConsolePopup(state, consoleCaptureSingleton) {
8
+ const filterType = state.consoleFilter;
9
+ if (!filterType)
10
+ return;
11
+ const logs = consoleCaptureSingleton
12
+ .getLogs()
13
+ .filter((log) => log.level === filterType);
14
+ const colorMap = { error: BUTTON_COLORS.error, warn: BUTTON_COLORS.warning, info: BUTTON_COLORS.info };
15
+ const color = colorMap[filterType];
16
+ const labelMap = { error: 'Errors', warn: 'Warnings', info: 'Info' };
17
+ const label = labelMap[filterType];
18
+ const closeModal = () => {
19
+ state.consoleFilter = null;
20
+ state.render();
21
+ };
22
+ const overlay = createModalOverlay(closeModal);
23
+ const modal = createModalBox(color);
24
+ const header = createModalHeader({
25
+ color,
26
+ title: `Console ${label} (${logs.length})`,
27
+ onClose: closeModal,
28
+ onCopyMd: async () => {
29
+ await navigator.clipboard.writeText(consoleLogsToMarkdown(logs));
30
+ },
31
+ onSave: () => handleSaveConsoleLogs(state, logs),
32
+ onClear: () => state.clearConsoleLogs(),
33
+ sweetlinkConnected: state.sweetlinkConnected,
34
+ saveLocation: state.options.saveLocation,
35
+ isSaving: state.savingConsoleLogs,
36
+ savedPath: state.lastConsoleLogs,
37
+ });
38
+ modal.appendChild(header);
39
+ const content = createModalContent();
40
+ if (logs.length === 0) {
41
+ content.appendChild(createEmptyMessage(`No ${filterType}s recorded`));
42
+ }
43
+ else {
44
+ renderConsoleLogs(content, logs, color);
45
+ }
46
+ modal.appendChild(content);
47
+ overlay.appendChild(modal);
48
+ state.overlayElement = overlay;
49
+ document.body.appendChild(overlay);
50
+ }
51
+ function renderConsoleLogs(container, logs, color) {
52
+ logs.forEach((log, index) => {
53
+ const logItem = document.createElement('div');
54
+ Object.assign(logItem.style, {
55
+ padding: '8px 14px',
56
+ borderBottom: index < logs.length - 1 ? '1px solid rgba(255, 255, 255, 0.05)' : 'none',
57
+ });
58
+ const timestamp = document.createElement('span');
59
+ Object.assign(timestamp.style, {
60
+ color: CSS_COLORS.textMuted,
61
+ fontSize: '0.625rem',
62
+ marginRight: '8px',
63
+ });
64
+ timestamp.textContent = new Date(log.timestamp).toLocaleTimeString();
65
+ logItem.appendChild(timestamp);
66
+ const message = document.createElement('span');
67
+ Object.assign(message.style, {
68
+ color,
69
+ fontSize: '0.6875rem',
70
+ wordBreak: 'break-word',
71
+ whiteSpace: 'pre-wrap',
72
+ });
73
+ message.textContent = log.message;
74
+ logItem.appendChild(message);
75
+ container.appendChild(logItem);
76
+ });
77
+ }
78
+ //# sourceMappingURL=console.js.map
@@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G,EAAE,KAAK,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;YAC3B,OAAO,EAAE,UAAU;YACnB,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,MAAM;SACvF,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE;YAC7B,KAAK,EAAE,UAAU,CAAC,SAAS;YAC3B,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAC;QACrE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAE/B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;YAC3B,KAAK;YACL,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,UAAU;SACvB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC;QAClC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAE7B,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Expanded state rendering for the DevBar — helper functions and orchestrator.
3
+ */
4
+ import type { DevBarState } from '../types.js';
5
+ export declare function renderExpanded(state: DevBarState, customControls: {
6
+ id: string;
7
+ label: string;
8
+ onClick: () => void;
9
+ active?: boolean;
10
+ disabled?: boolean;
11
+ variant?: 'default' | 'warning';
12
+ }[]): void;
13
+ //# sourceMappingURL=expanded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expanded.d.ts","sourceRoot":"","sources":["../../../src/modules/rendering/expanded.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAghB9D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,cAAc,EAAE;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC,EAAE,GACF,IAAI,CAiCN"}
@@ -0,0 +1,439 @@
1
+ /**
2
+ * Expanded state rendering for the DevBar — helper functions and orchestrator.
3
+ */
4
+ import { BUTTON_COLORS, CSS_COLORS, FONT_MONO, TAILWIND_BREAKPOINTS, withAlpha, } from '../../constants.js';
5
+ import { getResponsiveMetricVisibility } from '../performance.js';
6
+ import { addTooltipTitle, attachBreakpointTooltip, attachClickToggleTooltip, attachInfoTooltip, attachMetricTooltip, attachTextTooltip, } from '../tooltips.js';
7
+ import { createA11yButton, createAIReviewButton, createCompactToggleButton, createConsoleBadge, createOutlineButton, createSchemaButton, createScreenshotButton, createSettingsButton, } from './buttons.js';
8
+ import { captureDotPosition, createConnectionIndicator } from './common.js';
9
+ /**
10
+ * Compute the CSS position for the expanded devbar wrapper.
11
+ * Uses the captured dot position when available for smooth collapse/expand transitions.
12
+ */
13
+ function computeExpandedPosition(state, position, isCentered) {
14
+ // Dot offset from container edge in expanded mode:
15
+ // border (1px) + padding (12px) + half indicator (6px) = 19px from left
16
+ // border (1px) + padding (8px) + half indicator (6px) = 15px from top
17
+ const DOT_OFFSET_LEFT = 19;
18
+ const DOT_OFFSET_TOP = 15;
19
+ // Use captured dot position to align the expanded bar's dot with where it was
20
+ // Always use top/left positioning for precise alignment
21
+ if (state.lastDotPosition && !isCentered) {
22
+ const isRight = position.endsWith('right');
23
+ let posStyle;
24
+ if (isRight) {
25
+ // For right-aligned, fall back to default
26
+ const isTop = position.startsWith('top');
27
+ posStyle = isTop ? { top: '20px', right: '16px' } : { bottom: '20px', right: '16px' };
28
+ }
29
+ else {
30
+ // Use top positioning for precise dot alignment
31
+ posStyle = {
32
+ top: `${state.lastDotPosition.top - DOT_OFFSET_TOP}px`,
33
+ left: `${state.lastDotPosition.left - DOT_OFFSET_LEFT}px`,
34
+ };
35
+ }
36
+ // Clear the position after using it
37
+ state.lastDotPosition = null;
38
+ return posStyle;
39
+ }
40
+ const positionStyles = {
41
+ 'bottom-left': { bottom: '20px', left: '80px' },
42
+ 'bottom-right': { bottom: '20px', right: '16px' },
43
+ 'top-left': { top: '20px', left: '80px' },
44
+ 'top-right': { top: '20px', right: '16px' },
45
+ 'bottom-center': { bottom: '12px', left: '50%', transform: 'translateX(-50%)' },
46
+ };
47
+ return positionStyles[position] ?? positionStyles['bottom-left'];
48
+ }
49
+ /**
50
+ * Style the expanded wrapper container and attach the double-click-to-collapse handler.
51
+ */
52
+ function styleExpandedWrapper(state, wrapper, posStyle, accentColor, isCentered) {
53
+ state.resetPositionStyles(wrapper);
54
+ const sizeOverrides = state.options.sizeOverrides;
55
+ // Calculate size values with overrides or defaults
56
+ // Use fit-content so DevBar only takes space it needs, but allow expansion up to max
57
+ // Centered: 16px margin each side. Left/right: 80px for Next.js bar + 16px margin
58
+ const defaultWidth = 'fit-content';
59
+ const defaultMinWidth = 'auto';
60
+ const defaultMaxWidth = isCentered ? 'calc(100vw - 32px)' : 'calc(100vw - 96px)';
61
+ Object.assign(wrapper.style, {
62
+ position: 'fixed',
63
+ ...posStyle,
64
+ zIndex: '9999',
65
+ backgroundColor: 'var(--devbar-color-bg-card)',
66
+ border: `1px solid ${accentColor}`,
67
+ borderRadius: '12px',
68
+ color: accentColor,
69
+ boxShadow: `0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px ${withAlpha(accentColor, 10)}`,
70
+ backdropFilter: 'blur(8px)',
71
+ WebkitBackdropFilter: 'blur(8px)',
72
+ boxSizing: 'border-box',
73
+ width: sizeOverrides?.width ?? defaultWidth,
74
+ maxWidth: sizeOverrides?.maxWidth ?? defaultMaxWidth,
75
+ minWidth: sizeOverrides?.minWidth ?? defaultMinWidth,
76
+ cursor: 'default',
77
+ });
78
+ wrapper.ondblclick = (e) => {
79
+ // Ignore double-clicks on interactive elements (buttons, inputs, selects)
80
+ // to prevent rapid settings-button clicks from collapsing the devbar
81
+ const target = e.target;
82
+ if (target?.closest('button, input, select, a'))
83
+ return;
84
+ const dotEl = wrapper.querySelector('.devbar-status span span');
85
+ if (dotEl) {
86
+ captureDotPosition(state, dotEl);
87
+ }
88
+ state.collapsed = true;
89
+ state.debug.state('Collapsed DevBar (double-click)');
90
+ state.render();
91
+ };
92
+ }
93
+ /**
94
+ * Create the main row flex container used in expanded mode.
95
+ */
96
+ function createExpandedMainRow() {
97
+ const mainRow = document.createElement('div');
98
+ mainRow.className = 'devbar-main';
99
+ Object.assign(mainRow.style, {
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ alignContent: 'flex-start',
103
+ justifyContent: 'flex-start',
104
+ gap: '0.5rem',
105
+ padding: '0.5rem 0.75rem',
106
+ minWidth: '0',
107
+ boxSizing: 'border-box',
108
+ fontFamily: FONT_MONO,
109
+ fontSize: '0.6875rem',
110
+ lineHeight: '1rem',
111
+ });
112
+ return mainRow;
113
+ }
114
+ /**
115
+ * Create the connection indicator configured to collapse the devbar on click.
116
+ */
117
+ function createExpandedConnectionIndicator(state) {
118
+ const connIndicator = createConnectionIndicator(state);
119
+ attachTextTooltip(state, connIndicator, () => state.sweetlinkConnected
120
+ ? 'Sweetlink connected (click to minimize)'
121
+ : 'Sweetlink disconnected (click to minimize)');
122
+ connIndicator.onclick = (e) => {
123
+ e.stopPropagation();
124
+ captureDotPosition(state, connIndicator);
125
+ state.collapsed = true;
126
+ state.debug.state('Collapsed DevBar (connection dot click)');
127
+ state.render();
128
+ };
129
+ return connIndicator;
130
+ }
131
+ /**
132
+ * Create the info section containing breakpoint display and performance metrics.
133
+ */
134
+ function createInfoSection(state, showMetrics) {
135
+ const infoSection = document.createElement('div');
136
+ infoSection.className = 'devbar-info';
137
+ Object.assign(infoSection.style, {
138
+ display: 'flex',
139
+ alignItems: 'center',
140
+ gap: '0.5rem',
141
+ textTransform: 'uppercase',
142
+ letterSpacing: '0.05em',
143
+ flexShrink: '1',
144
+ minWidth: '0',
145
+ overflow: 'visible',
146
+ });
147
+ // Breakpoint info
148
+ if (showMetrics.breakpoint && state.breakpointInfo) {
149
+ appendBreakpointInfo(state, infoSection);
150
+ }
151
+ // Performance stats with responsive visibility
152
+ if (state.perfStats) {
153
+ appendPerformanceMetrics(state, infoSection, showMetrics);
154
+ }
155
+ return infoSection;
156
+ }
157
+ /**
158
+ * Append the Tailwind breakpoint indicator to the info section.
159
+ */
160
+ function appendBreakpointInfo(state, infoSection) {
161
+ if (!state.breakpointInfo)
162
+ return;
163
+ const bp = state.breakpointInfo.tailwindBreakpoint;
164
+ const breakpointData = TAILWIND_BREAKPOINTS[bp];
165
+ const bpSpan = document.createElement('span');
166
+ bpSpan.className = 'devbar-item';
167
+ Object.assign(bpSpan.style, { opacity: '0.9', cursor: 'default' });
168
+ // Use HTML tooltip for breakpoint info
169
+ attachBreakpointTooltip(state, bpSpan, bp, state.breakpointInfo.dimensions, breakpointData?.label || '');
170
+ let bpText = bp;
171
+ if (bp !== 'base') {
172
+ bpText =
173
+ bp === 'sm'
174
+ ? `${bp} - ${state.breakpointInfo.dimensions.split('x')[0]}`
175
+ : `${bp} - ${state.breakpointInfo.dimensions}`;
176
+ }
177
+ bpSpan.textContent = bpText;
178
+ infoSection.appendChild(bpSpan);
179
+ }
180
+ /**
181
+ * Build the metric configuration map from current perf stats.
182
+ */
183
+ function buildMetricConfigs(perfStats) {
184
+ return {
185
+ fcp: {
186
+ label: 'FCP',
187
+ value: perfStats.fcp,
188
+ title: 'First Contentful Paint (FCP)',
189
+ description: 'Time until the first text or image renders on screen.',
190
+ thresholds: { good: '<1.8s', needsWork: '1.8-3s', poor: '>3s' },
191
+ },
192
+ lcp: {
193
+ label: 'LCP',
194
+ value: perfStats.lcp,
195
+ title: 'Largest Contentful Paint (LCP)',
196
+ description: 'Time until the largest visible element renders on screen.',
197
+ thresholds: { good: '<2.5s', needsWork: '2.5-4s', poor: '>4s' },
198
+ },
199
+ cls: {
200
+ label: 'CLS',
201
+ value: perfStats.cls,
202
+ title: 'Cumulative Layout Shift (CLS)',
203
+ description: 'Visual stability score. Higher values mean more unexpected layout shifts.',
204
+ thresholds: { good: '<0.1', needsWork: '0.1-0.25', poor: '>0.25' },
205
+ },
206
+ inp: {
207
+ label: 'INP',
208
+ value: perfStats.inp,
209
+ title: 'Interaction to Next Paint (INP)',
210
+ description: 'Responsiveness to user input. Measures the longest interaction delay.',
211
+ thresholds: { good: '<200ms', needsWork: '200-500ms', poor: '>500ms' },
212
+ },
213
+ pageSize: {
214
+ label: '',
215
+ value: perfStats.totalSize,
216
+ title: 'Total Page Size',
217
+ description: 'Compressed/transferred size including HTML, CSS, JS, images, and other resources.',
218
+ },
219
+ };
220
+ }
221
+ /**
222
+ * Append performance metric spans (visible metrics + hidden-metrics ellipsis) to the info section.
223
+ */
224
+ function appendPerformanceMetrics(state, infoSection, showMetrics) {
225
+ if (!state.perfStats)
226
+ return;
227
+ const { visible, hidden } = getResponsiveMetricVisibility(state);
228
+ const metricConfigs = buildMetricConfigs(state.perfStats);
229
+ const addSeparator = () => {
230
+ const sep = document.createElement('span');
231
+ sep.style.opacity = '0.4';
232
+ sep.textContent = '|';
233
+ infoSection.appendChild(sep);
234
+ };
235
+ // Render visible metrics
236
+ for (const metric of visible) {
237
+ if (!showMetrics[metric])
238
+ continue;
239
+ const config = metricConfigs[metric];
240
+ addSeparator();
241
+ const span = document.createElement('span');
242
+ span.className = 'devbar-item';
243
+ Object.assign(span.style, {
244
+ opacity: metric === 'pageSize' ? '0.7' : '0.85',
245
+ cursor: 'default',
246
+ });
247
+ span.textContent = config.label ? `${config.label} ${config.value}` : config.value;
248
+ if (config.thresholds) {
249
+ attachMetricTooltip(state, span, config.title, config.description, config.thresholds);
250
+ }
251
+ else {
252
+ attachInfoTooltip(state, span, config.title, config.description);
253
+ }
254
+ infoSection.appendChild(span);
255
+ }
256
+ // Render ellipsis button for hidden metrics
257
+ const hiddenMetricsEnabled = hidden.filter((m) => showMetrics[m]);
258
+ if (hiddenMetricsEnabled.length > 0) {
259
+ addSeparator();
260
+ appendHiddenMetricsEllipsis(state, infoSection, hiddenMetricsEnabled, metricConfigs);
261
+ }
262
+ }
263
+ /**
264
+ * Append the ellipsis button that reveals hidden metrics in a click-toggle tooltip.
265
+ */
266
+ function appendHiddenMetricsEllipsis(state, infoSection, hiddenMetricsEnabled, metricConfigs) {
267
+ const ellipsisBtn = document.createElement('span');
268
+ ellipsisBtn.className = 'devbar-item devbar-clickable';
269
+ Object.assign(ellipsisBtn.style, {
270
+ opacity: '0.7',
271
+ cursor: 'pointer',
272
+ padding: '0 2px',
273
+ });
274
+ ellipsisBtn.textContent = '\u00B7\u00B7\u00B7';
275
+ // Attach click-toggle tooltip showing hidden metrics (for mobile support)
276
+ attachClickToggleTooltip(state, ellipsisBtn, (tooltip) => {
277
+ addTooltipTitle(state, tooltip, 'More Metrics');
278
+ const metricsContainer = document.createElement('div');
279
+ Object.assign(metricsContainer.style, {
280
+ display: 'flex',
281
+ flexDirection: 'column',
282
+ gap: '6px',
283
+ marginTop: '8px',
284
+ });
285
+ for (const metric of hiddenMetricsEnabled) {
286
+ const config = metricConfigs[metric];
287
+ const row = document.createElement('div');
288
+ Object.assign(row.style, {
289
+ display: 'flex',
290
+ justifyContent: 'space-between',
291
+ gap: '12px',
292
+ });
293
+ const labelSpan = document.createElement('span');
294
+ Object.assign(labelSpan.style, { color: CSS_COLORS.textMuted });
295
+ labelSpan.textContent = config.title.split('(')[0].trim();
296
+ const valueSpan = document.createElement('span');
297
+ Object.assign(valueSpan.style, { color: CSS_COLORS.text, fontWeight: '500' });
298
+ valueSpan.textContent = config.value;
299
+ row.appendChild(labelSpan);
300
+ row.appendChild(valueSpan);
301
+ metricsContainer.appendChild(row);
302
+ }
303
+ tooltip.appendChild(metricsContainer);
304
+ });
305
+ infoSection.appendChild(ellipsisBtn);
306
+ }
307
+ /**
308
+ * Create the status row containing the connection indicator, info section, and console badges.
309
+ */
310
+ function createStatusRow(state, showMetrics, showConsoleBadges, errorCount, warningCount, infoCount) {
311
+ const connIndicator = createExpandedConnectionIndicator(state);
312
+ const statusRow = document.createElement('div');
313
+ statusRow.className = 'devbar-status';
314
+ Object.assign(statusRow.style, {
315
+ display: 'flex',
316
+ alignItems: 'center',
317
+ gap: '0.5rem',
318
+ flexWrap: 'nowrap',
319
+ flexShrink: '0',
320
+ });
321
+ statusRow.appendChild(connIndicator);
322
+ const infoSection = createInfoSection(state, showMetrics);
323
+ statusRow.appendChild(infoSection);
324
+ // Console badges - add to status row so they stay with info
325
+ if (showConsoleBadges) {
326
+ if (errorCount > 0) {
327
+ statusRow.appendChild(createConsoleBadge(state, 'error', errorCount, BUTTON_COLORS.error));
328
+ }
329
+ if (warningCount > 0) {
330
+ statusRow.appendChild(createConsoleBadge(state, 'warn', warningCount, BUTTON_COLORS.warning));
331
+ }
332
+ if (infoCount > 0) {
333
+ statusRow.appendChild(createConsoleBadge(state, 'info', infoCount, BUTTON_COLORS.info));
334
+ }
335
+ }
336
+ return statusRow;
337
+ }
338
+ /**
339
+ * Create the action buttons container (screenshot, AI review, outline, schema, a11y, settings, compact).
340
+ */
341
+ function createActionButtonsContainer(state, showScreenshot, accentColor) {
342
+ const actionsContainer = document.createElement('div');
343
+ actionsContainer.className = 'devbar-actions';
344
+ if (showScreenshot) {
345
+ actionsContainer.appendChild(createScreenshotButton(state, accentColor));
346
+ }
347
+ actionsContainer.appendChild(createAIReviewButton(state));
348
+ actionsContainer.appendChild(createOutlineButton(state));
349
+ actionsContainer.appendChild(createSchemaButton(state));
350
+ actionsContainer.appendChild(createA11yButton(state));
351
+ actionsContainer.appendChild(createSettingsButton(state));
352
+ actionsContainer.appendChild(createCompactToggleButton(state));
353
+ return actionsContainer;
354
+ }
355
+ /**
356
+ * Create the custom controls row for user-defined buttons.
357
+ * Returns null if there are no custom controls.
358
+ */
359
+ function createCustomControlsRow(customControls, accentColor) {
360
+ if (customControls.length === 0)
361
+ return null;
362
+ const customRow = document.createElement('div');
363
+ Object.assign(customRow.style, {
364
+ display: 'flex',
365
+ flexWrap: 'wrap',
366
+ alignItems: 'center',
367
+ gap: '0.5rem',
368
+ padding: '0 0.75rem 0.5rem 0.75rem',
369
+ borderTop: `1px solid ${withAlpha(accentColor, 19)}`,
370
+ marginTop: '0',
371
+ paddingTop: '0.5rem',
372
+ fontFamily: FONT_MONO,
373
+ fontSize: '0.6875rem',
374
+ });
375
+ customControls.forEach((control) => {
376
+ const btn = document.createElement('button');
377
+ btn.type = 'button';
378
+ const color = control.variant === 'warning' ? BUTTON_COLORS.warning : accentColor;
379
+ const isActive = control.active ?? false;
380
+ const isDisabled = control.disabled ?? false;
381
+ Object.assign(btn.style, {
382
+ padding: '4px 10px',
383
+ backgroundColor: isActive ? withAlpha(color, 20) : 'transparent',
384
+ border: `1px solid ${isActive ? color : withAlpha(color, 38)}`,
385
+ borderRadius: '6px',
386
+ color: isActive ? color : withAlpha(color, 60),
387
+ fontSize: '0.625rem',
388
+ cursor: isDisabled ? 'not-allowed' : 'pointer',
389
+ opacity: isDisabled ? '0.5' : '1',
390
+ transition: 'all 150ms',
391
+ });
392
+ btn.textContent = control.label;
393
+ btn.disabled = isDisabled;
394
+ if (!isDisabled) {
395
+ btn.onmouseenter = () => {
396
+ btn.style.backgroundColor = withAlpha(color, 13);
397
+ btn.style.borderColor = color;
398
+ btn.style.color = color;
399
+ };
400
+ btn.onmouseleave = () => {
401
+ btn.style.backgroundColor = isActive ? withAlpha(color, 20) : 'transparent';
402
+ btn.style.borderColor = isActive ? color : withAlpha(color, 38);
403
+ btn.style.color = isActive ? color : withAlpha(color, 60);
404
+ };
405
+ btn.onclick = () => control.onClick();
406
+ }
407
+ customRow.appendChild(btn);
408
+ });
409
+ return customRow;
410
+ }
411
+ // ============================================================================
412
+ // Expanded State -- Orchestrator
413
+ // ============================================================================
414
+ export function renderExpanded(state, customControls) {
415
+ if (!state.container)
416
+ return;
417
+ const { position, accentColor, showMetrics, showScreenshot, showConsoleBadges } = state.options;
418
+ const { errorCount, warningCount, infoCount } = state.getLogCounts();
419
+ const isCentered = position === 'bottom-center';
420
+ const wrapper = state.container;
421
+ // 1. Position and style the wrapper
422
+ const posStyle = computeExpandedPosition(state, position, isCentered);
423
+ styleExpandedWrapper(state, wrapper, posStyle, accentColor, isCentered);
424
+ // 2. Build the main row
425
+ const mainRow = createExpandedMainRow();
426
+ // 3. Status row (connection dot + info metrics + console badges)
427
+ const statusRow = createStatusRow(state, showMetrics, showConsoleBadges, errorCount, warningCount, infoCount);
428
+ mainRow.appendChild(statusRow);
429
+ // 4. Action buttons
430
+ const actionsContainer = createActionButtonsContainer(state, showScreenshot, accentColor);
431
+ mainRow.appendChild(actionsContainer);
432
+ wrapper.appendChild(mainRow);
433
+ // 5. Custom controls row (if any)
434
+ const customRow = createCustomControlsRow(customControls, accentColor);
435
+ if (customRow) {
436
+ wrapper.appendChild(customRow);
437
+ }
438
+ }
439
+ //# sourceMappingURL=expanded.js.map