@ytspar/devbar 1.0.0-canary.c511f13 → 1.0.0-canary.cdf7fa2
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 +0 -7
- package/dist/GlobalDevBar.js +34 -135
- package/dist/constants.d.ts +1 -11
- package/dist/constants.js +1 -11
- package/dist/ui/modals.d.ts +0 -4
- package/dist/ui/modals.js +4 -48
- package/package.json +1 -1
package/dist/GlobalDevBar.d.ts
CHANGED
|
@@ -46,8 +46,6 @@ export declare class GlobalDevBar {
|
|
|
46
46
|
private apiKeyStatus;
|
|
47
47
|
private lastOutline;
|
|
48
48
|
private lastSchema;
|
|
49
|
-
private savingOutline;
|
|
50
|
-
private savingSchema;
|
|
51
49
|
private consoleFilter;
|
|
52
50
|
private showOutlineModal;
|
|
53
51
|
private showSchemaModal;
|
|
@@ -57,11 +55,6 @@ export declare class GlobalDevBar {
|
|
|
57
55
|
private clsValue;
|
|
58
56
|
private inpValue;
|
|
59
57
|
private reconnectAttempts;
|
|
60
|
-
private readonly currentAppPort;
|
|
61
|
-
private readonly baseWsPort;
|
|
62
|
-
private wsVerified;
|
|
63
|
-
private serverProjectDir;
|
|
64
|
-
private verificationTimeout;
|
|
65
58
|
private lastDotPosition;
|
|
66
59
|
private reconnectTimeout;
|
|
67
60
|
private screenshotTimeout;
|
package/dist/GlobalDevBar.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* to avoid React dependency conflicts in host applications.
|
|
9
9
|
*/
|
|
10
10
|
import * as html2canvasModule from 'html2canvas-pro';
|
|
11
|
-
import { BASE_RECONNECT_DELAY_MS, BUTTON_COLORS, CATEGORY_COLORS, CLIPBOARD_NOTIFICATION_MS, COLORS, DESIGN_REVIEW_NOTIFICATION_MS, DEVBAR_SCREENSHOT_QUALITY, FONT_MONO, getEffectiveTheme,
|
|
11
|
+
import { BASE_RECONNECT_DELAY_MS, BUTTON_COLORS, CATEGORY_COLORS, CLIPBOARD_NOTIFICATION_MS, COLORS, DESIGN_REVIEW_NOTIFICATION_MS, DEVBAR_SCREENSHOT_QUALITY, FONT_MONO, getEffectiveTheme, getThemeColors, MAX_CONSOLE_LOGS, MAX_RECONNECT_ATTEMPTS, MAX_RECONNECT_DELAY_MS, SCREENSHOT_BLUR_DELAY_MS, SCREENSHOT_NOTIFICATION_MS, SCREENSHOT_SCALE, TAILWIND_BREAKPOINTS, TOOLTIP_STYLES, WS_PORT, } from './constants.js';
|
|
12
12
|
import { DebugLogger, normalizeDebugConfig } from './debug.js';
|
|
13
13
|
import { extractDocumentOutline, outlineToMarkdown } from './outline.js';
|
|
14
14
|
import { extractPageSchema, schemaToMarkdown } from './schema.js';
|
|
@@ -91,8 +91,6 @@ export class GlobalDevBar {
|
|
|
91
91
|
this.apiKeyStatus = null;
|
|
92
92
|
this.lastOutline = null;
|
|
93
93
|
this.lastSchema = null;
|
|
94
|
-
this.savingOutline = false;
|
|
95
|
-
this.savingSchema = false;
|
|
96
94
|
this.consoleFilter = null;
|
|
97
95
|
// Modal states
|
|
98
96
|
this.showOutlineModal = false;
|
|
@@ -103,9 +101,6 @@ export class GlobalDevBar {
|
|
|
103
101
|
this.clsValue = 0;
|
|
104
102
|
this.inpValue = 0;
|
|
105
103
|
this.reconnectAttempts = 0;
|
|
106
|
-
this.wsVerified = false;
|
|
107
|
-
this.serverProjectDir = null;
|
|
108
|
-
this.verificationTimeout = null;
|
|
109
104
|
// Track the position of the connection indicator dot for smooth collapse
|
|
110
105
|
this.lastDotPosition = null;
|
|
111
106
|
this.reconnectTimeout = null;
|
|
@@ -137,17 +132,6 @@ export class GlobalDevBar {
|
|
|
137
132
|
this.debug = new DebugLogger(this.debugConfig);
|
|
138
133
|
// Initialize settings manager
|
|
139
134
|
this.settingsManager = getSettingsManager();
|
|
140
|
-
// Calculate app port from URL for multi-instance support
|
|
141
|
-
if (typeof window !== 'undefined') {
|
|
142
|
-
this.currentAppPort =
|
|
143
|
-
parseInt(window.location.port, 10) || (window.location.protocol === 'https:' ? 443 : 80);
|
|
144
|
-
// Calculate expected WS port (appPort + port offset) like SweetlinkBridge does
|
|
145
|
-
this.baseWsPort = this.currentAppPort > 0 ? this.currentAppPort + WS_PORT_OFFSET : WS_PORT;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
this.currentAppPort = 0;
|
|
149
|
-
this.baseWsPort = WS_PORT;
|
|
150
|
-
}
|
|
151
135
|
this.options = {
|
|
152
136
|
position: options.position ?? 'bottom-left',
|
|
153
137
|
accentColor: options.accentColor ?? COLORS.primary,
|
|
@@ -303,8 +287,6 @@ export class GlobalDevBar {
|
|
|
303
287
|
this.reconnectAttempts = MAX_RECONNECT_ATTEMPTS; // Prevent reconnection
|
|
304
288
|
if (this.reconnectTimeout)
|
|
305
289
|
clearTimeout(this.reconnectTimeout);
|
|
306
|
-
if (this.verificationTimeout)
|
|
307
|
-
clearTimeout(this.verificationTimeout);
|
|
308
290
|
if (this.ws)
|
|
309
291
|
this.ws.close();
|
|
310
292
|
// Clear timeouts
|
|
@@ -363,82 +345,27 @@ export class GlobalDevBar {
|
|
|
363
345
|
document.head.appendChild(style);
|
|
364
346
|
}
|
|
365
347
|
}
|
|
366
|
-
connectWebSocket(
|
|
348
|
+
connectWebSocket() {
|
|
367
349
|
if (this.destroyed)
|
|
368
350
|
return;
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const ws = new WebSocket(`ws://localhost:${targetPort}`);
|
|
351
|
+
this.debug.ws('Connecting to WebSocket', { port: WS_PORT });
|
|
352
|
+
const ws = new WebSocket(`ws://localhost:${WS_PORT}`);
|
|
372
353
|
this.ws = ws;
|
|
373
|
-
this.wsVerified = false;
|
|
374
|
-
// Timeout for server-info verification
|
|
375
|
-
this.verificationTimeout = setTimeout(() => {
|
|
376
|
-
if (!this.wsVerified && ws.readyState === WebSocket.OPEN) {
|
|
377
|
-
// Server didn't send server-info (old version) - accept for backwards compatibility
|
|
378
|
-
this.debug.ws('Server is old version (no server-info), accepting for backwards compat');
|
|
379
|
-
this.wsVerified = true;
|
|
380
|
-
this.sweetlinkConnected = true;
|
|
381
|
-
this.reconnectAttempts = 0;
|
|
382
|
-
this.settingsManager.setWebSocket(ws);
|
|
383
|
-
this.settingsManager.setConnected(true);
|
|
384
|
-
ws.send(JSON.stringify({ type: 'load-settings' }));
|
|
385
|
-
this.render();
|
|
386
|
-
}
|
|
387
|
-
}, VERIFICATION_TIMEOUT_MS);
|
|
388
354
|
ws.onopen = () => {
|
|
389
|
-
this.
|
|
355
|
+
this.sweetlinkConnected = true;
|
|
356
|
+
this.reconnectAttempts = 0;
|
|
357
|
+
this.debug.ws('WebSocket connected');
|
|
358
|
+
// Update settings manager with WebSocket connection
|
|
359
|
+
this.settingsManager.setWebSocket(ws);
|
|
360
|
+
this.settingsManager.setConnected(true);
|
|
390
361
|
ws.send(JSON.stringify({ type: 'browser-client-ready' }));
|
|
362
|
+
// Request settings from server
|
|
363
|
+
ws.send(JSON.stringify({ type: 'load-settings' }));
|
|
364
|
+
this.render();
|
|
391
365
|
};
|
|
392
366
|
ws.onmessage = async (event) => {
|
|
393
367
|
try {
|
|
394
|
-
const
|
|
395
|
-
// Handle server-info for port matching
|
|
396
|
-
if (message.type === 'server-info') {
|
|
397
|
-
if (this.verificationTimeout) {
|
|
398
|
-
clearTimeout(this.verificationTimeout);
|
|
399
|
-
this.verificationTimeout = null;
|
|
400
|
-
}
|
|
401
|
-
const serverAppPort = message.appPort;
|
|
402
|
-
const serverMatchesApp = serverAppPort === null || serverAppPort === this.currentAppPort;
|
|
403
|
-
if (!serverMatchesApp) {
|
|
404
|
-
this.debug.ws('Server mismatch', {
|
|
405
|
-
serverAppPort,
|
|
406
|
-
currentAppPort: this.currentAppPort,
|
|
407
|
-
tryingNextPort: targetPort + 1,
|
|
408
|
-
});
|
|
409
|
-
ws.close();
|
|
410
|
-
// Try next port
|
|
411
|
-
const nextPort = targetPort + 1;
|
|
412
|
-
if (nextPort < this.baseWsPort + MAX_PORT_RETRIES) {
|
|
413
|
-
setTimeout(() => this.connectWebSocket(nextPort), PORT_RETRY_DELAY_MS);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
this.debug.ws('No matching server found, will retry from base port');
|
|
417
|
-
setTimeout(() => this.connectWebSocket(this.baseWsPort), PORT_SCAN_RESTART_DELAY_MS);
|
|
418
|
-
}
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
// Server matches - mark as verified and connected
|
|
422
|
-
this.wsVerified = true;
|
|
423
|
-
this.sweetlinkConnected = true;
|
|
424
|
-
this.reconnectAttempts = 0;
|
|
425
|
-
this.serverProjectDir = message.projectDir ?? null;
|
|
426
|
-
this.debug.ws('Server verified', {
|
|
427
|
-
appPort: serverAppPort ?? 'any',
|
|
428
|
-
projectDir: this.serverProjectDir,
|
|
429
|
-
});
|
|
430
|
-
this.settingsManager.setWebSocket(ws);
|
|
431
|
-
this.settingsManager.setConnected(true);
|
|
432
|
-
ws.send(JSON.stringify({ type: 'load-settings' }));
|
|
433
|
-
this.render();
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
// Ignore other commands until verified
|
|
437
|
-
if (!this.wsVerified) {
|
|
438
|
-
this.debug.ws('Ignoring command before verification', { type: message.type });
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
const command = message;
|
|
368
|
+
const command = JSON.parse(event.data);
|
|
442
369
|
this.debug.ws('Received command', { type: command.type });
|
|
443
370
|
await this.handleSweetlinkCommand(command);
|
|
444
371
|
}
|
|
@@ -447,25 +374,16 @@ export class GlobalDevBar {
|
|
|
447
374
|
}
|
|
448
375
|
};
|
|
449
376
|
ws.onclose = () => {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
//
|
|
455
|
-
if (this.
|
|
456
|
-
|
|
457
|
-
this.
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
460
|
-
this.debug.ws('WebSocket disconnected');
|
|
461
|
-
this.render();
|
|
462
|
-
// Auto-reconnect with exponential backoff (start from base port)
|
|
463
|
-
if (!this.destroyed && this.reconnectAttempts < MAX_RECONNECT_ATTEMPTS) {
|
|
464
|
-
const delayMs = BASE_RECONNECT_DELAY_MS * 2 ** this.reconnectAttempts;
|
|
465
|
-
this.reconnectAttempts++;
|
|
466
|
-
this.debug.ws('Scheduling reconnect', { attempt: this.reconnectAttempts, delayMs });
|
|
467
|
-
this.reconnectTimeout = setTimeout(() => this.connectWebSocket(this.baseWsPort), Math.min(delayMs, MAX_RECONNECT_DELAY_MS));
|
|
468
|
-
}
|
|
377
|
+
this.sweetlinkConnected = false;
|
|
378
|
+
this.settingsManager.setConnected(false);
|
|
379
|
+
this.debug.ws('WebSocket disconnected');
|
|
380
|
+
this.render();
|
|
381
|
+
// Auto-reconnect with exponential backoff
|
|
382
|
+
if (!this.destroyed && this.reconnectAttempts < MAX_RECONNECT_ATTEMPTS) {
|
|
383
|
+
const delayMs = BASE_RECONNECT_DELAY_MS * 2 ** this.reconnectAttempts;
|
|
384
|
+
this.reconnectAttempts++;
|
|
385
|
+
this.debug.ws('Scheduling reconnect', { attempt: this.reconnectAttempts, delayMs });
|
|
386
|
+
this.reconnectTimeout = setTimeout(() => this.connectWebSocket(), Math.min(delayMs, MAX_RECONNECT_DELAY_MS));
|
|
469
387
|
}
|
|
470
388
|
};
|
|
471
389
|
ws.onerror = () => {
|
|
@@ -661,7 +579,6 @@ export class GlobalDevBar {
|
|
|
661
579
|
}, durationMs);
|
|
662
580
|
break;
|
|
663
581
|
case 'outline':
|
|
664
|
-
this.savingOutline = false;
|
|
665
582
|
this.lastOutline = path;
|
|
666
583
|
if (this.outlineTimeout)
|
|
667
584
|
clearTimeout(this.outlineTimeout);
|
|
@@ -671,7 +588,6 @@ export class GlobalDevBar {
|
|
|
671
588
|
}, durationMs);
|
|
672
589
|
break;
|
|
673
590
|
case 'schema':
|
|
674
|
-
this.savingSchema = false;
|
|
675
591
|
this.lastSchema = path;
|
|
676
592
|
if (this.schemaTimeout)
|
|
677
593
|
clearTimeout(this.schemaTimeout);
|
|
@@ -871,8 +787,6 @@ export class GlobalDevBar {
|
|
|
871
787
|
this.themeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
872
788
|
this.themeMediaHandler = () => {
|
|
873
789
|
if (this.themeMode === 'system') {
|
|
874
|
-
// Re-inject theme CSS when system preference changes
|
|
875
|
-
injectThemeCSS(getTheme(this.themeMode));
|
|
876
790
|
this.debug.state('System theme changed', {
|
|
877
791
|
effectiveTheme: getEffectiveTheme(this.themeMode),
|
|
878
792
|
});
|
|
@@ -899,8 +813,6 @@ export class GlobalDevBar {
|
|
|
899
813
|
setThemeMode(mode) {
|
|
900
814
|
this.themeMode = mode;
|
|
901
815
|
this.settingsManager.saveSettings({ themeMode: mode });
|
|
902
|
-
// Inject the appropriate theme CSS variables
|
|
903
|
-
injectThemeCSS(getTheme(mode));
|
|
904
816
|
this.debug.state('Theme mode changed', { mode, effectiveTheme: getEffectiveTheme(mode) });
|
|
905
817
|
this.render();
|
|
906
818
|
}
|
|
@@ -1154,13 +1066,9 @@ export class GlobalDevBar {
|
|
|
1154
1066
|
this.render();
|
|
1155
1067
|
}
|
|
1156
1068
|
handleSaveOutline() {
|
|
1157
|
-
if (this.savingOutline)
|
|
1158
|
-
return; // Prevent repeated clicks
|
|
1159
1069
|
const outline = extractDocumentOutline();
|
|
1160
1070
|
const markdown = outlineToMarkdown(outline);
|
|
1161
1071
|
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
1162
|
-
this.savingOutline = true;
|
|
1163
|
-
this.render();
|
|
1164
1072
|
this.ws.send(JSON.stringify({
|
|
1165
1073
|
type: 'save-outline',
|
|
1166
1074
|
data: {
|
|
@@ -1174,13 +1082,9 @@ export class GlobalDevBar {
|
|
|
1174
1082
|
}
|
|
1175
1083
|
}
|
|
1176
1084
|
handleSaveSchema() {
|
|
1177
|
-
if (this.savingSchema)
|
|
1178
|
-
return; // Prevent repeated clicks
|
|
1179
1085
|
const schema = extractPageSchema();
|
|
1180
1086
|
const markdown = schemaToMarkdown(schema);
|
|
1181
1087
|
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
1182
|
-
this.savingSchema = true;
|
|
1183
|
-
this.render();
|
|
1184
1088
|
this.ws.send(JSON.stringify({
|
|
1185
1089
|
type: 'save-schema',
|
|
1186
1090
|
data: {
|
|
@@ -1558,8 +1462,6 @@ export class GlobalDevBar {
|
|
|
1558
1462
|
},
|
|
1559
1463
|
onSave: () => this.handleSaveOutline(),
|
|
1560
1464
|
sweetlinkConnected: this.sweetlinkConnected,
|
|
1561
|
-
isSaving: this.savingOutline,
|
|
1562
|
-
savedPath: this.lastOutline,
|
|
1563
1465
|
});
|
|
1564
1466
|
modal.appendChild(header);
|
|
1565
1467
|
const content = createModalContent();
|
|
@@ -1646,8 +1548,6 @@ export class GlobalDevBar {
|
|
|
1646
1548
|
},
|
|
1647
1549
|
onSave: () => this.handleSaveSchema(),
|
|
1648
1550
|
sweetlinkConnected: this.sweetlinkConnected,
|
|
1649
|
-
isSaving: this.savingSchema,
|
|
1650
|
-
savedPath: this.lastSchema,
|
|
1651
1551
|
});
|
|
1652
1552
|
modal.appendChild(header);
|
|
1653
1553
|
const content = createModalContent();
|
|
@@ -2015,8 +1915,7 @@ export class GlobalDevBar {
|
|
|
2015
1915
|
const isCompact = this.compactMode;
|
|
2016
1916
|
const tooltip = isCompact ? 'Expand (Cmd+Shift+M)' : 'Compact (Cmd+Shift+M)';
|
|
2017
1917
|
btn.setAttribute('data-tooltip', tooltip);
|
|
2018
|
-
const
|
|
2019
|
-
const iconColor = COLORS.textSecondary;
|
|
1918
|
+
const color = COLORS.textSecondary;
|
|
2020
1919
|
Object.assign(btn.style, {
|
|
2021
1920
|
display: 'flex',
|
|
2022
1921
|
alignItems: 'center',
|
|
@@ -2027,21 +1926,21 @@ export class GlobalDevBar {
|
|
|
2027
1926
|
minHeight: '22px',
|
|
2028
1927
|
flexShrink: '0',
|
|
2029
1928
|
borderRadius: '50%',
|
|
2030
|
-
border: `1px solid ${
|
|
1929
|
+
border: `1px solid ${color}60`,
|
|
2031
1930
|
backgroundColor: 'transparent',
|
|
2032
|
-
color: `${
|
|
1931
|
+
color: `${color}99`,
|
|
2033
1932
|
cursor: 'pointer',
|
|
2034
1933
|
transition: 'all 150ms',
|
|
2035
1934
|
});
|
|
2036
1935
|
btn.onmouseenter = () => {
|
|
2037
|
-
btn.style.borderColor =
|
|
2038
|
-
btn.style.backgroundColor = `${
|
|
2039
|
-
btn.style.color =
|
|
1936
|
+
btn.style.borderColor = color;
|
|
1937
|
+
btn.style.backgroundColor = `${color}20`;
|
|
1938
|
+
btn.style.color = color;
|
|
2040
1939
|
};
|
|
2041
1940
|
btn.onmouseleave = () => {
|
|
2042
|
-
btn.style.borderColor = `${
|
|
1941
|
+
btn.style.borderColor = `${color}60`;
|
|
2043
1942
|
btn.style.backgroundColor = 'transparent';
|
|
2044
|
-
btn.style.color = `${
|
|
1943
|
+
btn.style.color = `${color}99`;
|
|
2045
1944
|
};
|
|
2046
1945
|
btn.onclick = () => {
|
|
2047
1946
|
this.toggleCompactMode();
|
|
@@ -2057,8 +1956,8 @@ export class GlobalDevBar {
|
|
|
2057
1956
|
svg.setAttribute('stroke-linecap', 'round');
|
|
2058
1957
|
svg.setAttribute('stroke-linejoin', 'round');
|
|
2059
1958
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');
|
|
2060
|
-
//
|
|
2061
|
-
path.setAttribute('points', isCompact ? '
|
|
1959
|
+
// Right chevron (>) when not compact, left chevron (<) when compact
|
|
1960
|
+
path.setAttribute('points', isCompact ? '15 18 9 12 15 6' : '9 18 15 12 9 6');
|
|
2062
1961
|
svg.appendChild(path);
|
|
2063
1962
|
btn.appendChild(svg);
|
|
2064
1963
|
return btn;
|
package/dist/constants.d.ts
CHANGED
|
@@ -11,18 +11,8 @@ 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 */
|
|
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;
|
|
26
16
|
/** Duration to show screenshot notification (ms) */
|
|
27
17
|
export declare const SCREENSHOT_NOTIFICATION_MS = 3000;
|
|
28
18
|
/** Duration to show clipboard notification (ms) */
|
package/dist/constants.js
CHANGED
|
@@ -18,18 +18,8 @@ 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 */
|
|
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;
|
|
33
23
|
// ============================================================================
|
|
34
24
|
// Notification Durations
|
|
35
25
|
// ============================================================================
|
package/dist/ui/modals.d.ts
CHANGED
|
@@ -13,10 +13,6 @@ 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;
|
|
20
16
|
}
|
|
21
17
|
/**
|
|
22
18
|
* Create modal overlay with click-outside-to-close behavior
|
package/dist/ui/modals.js
CHANGED
|
@@ -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
|
|
37
|
+
const { color, title, onClose, onCopyMd, onSave, sweetlinkConnected } = config;
|
|
38
38
|
const header = document.createElement('div');
|
|
39
39
|
Object.assign(header.style, {
|
|
40
40
|
display: 'flex',
|
|
@@ -42,8 +42,6 @@ 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',
|
|
47
45
|
});
|
|
48
46
|
const titleEl = document.createElement('h2');
|
|
49
47
|
Object.assign(titleEl.style, {
|
|
@@ -55,7 +53,7 @@ export function createModalHeader(config) {
|
|
|
55
53
|
titleEl.textContent = title;
|
|
56
54
|
header.appendChild(titleEl);
|
|
57
55
|
const headerButtons = document.createElement('div');
|
|
58
|
-
Object.assign(headerButtons.style, { display: 'flex', gap: '10px'
|
|
56
|
+
Object.assign(headerButtons.style, { display: 'flex', gap: '10px' });
|
|
59
57
|
// Copy MD button
|
|
60
58
|
const copyBtn = createStyledButton({ color, text: 'Copy MD' });
|
|
61
59
|
copyBtn.onclick = async () => {
|
|
@@ -73,17 +71,8 @@ export function createModalHeader(config) {
|
|
|
73
71
|
headerButtons.appendChild(copyBtn);
|
|
74
72
|
// Save button (if Sweetlink connected)
|
|
75
73
|
if (sweetlinkConnected && onSave) {
|
|
76
|
-
const saveBtn = createStyledButton({
|
|
77
|
-
|
|
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
|
+
const saveBtn = createStyledButton({ color, text: 'Save' });
|
|
75
|
+
saveBtn.onclick = onSave;
|
|
87
76
|
headerButtons.appendChild(saveBtn);
|
|
88
77
|
}
|
|
89
78
|
// Close button - use same padding as other buttons for consistent height
|
|
@@ -96,39 +85,6 @@ export function createModalHeader(config) {
|
|
|
96
85
|
closeBtn.onclick = onClose;
|
|
97
86
|
headerButtons.appendChild(closeBtn);
|
|
98
87
|
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
|
-
}
|
|
132
88
|
return header;
|
|
133
89
|
}
|
|
134
90
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ytspar/devbar",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.cdf7fa2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Development toolbar and utilities with Sweetlink integration - pure vanilla JS, no framework dependencies",
|