claude-dev-server 1.2.2 → 1.2.4
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/assets/dev.html +77 -7
- package/dist/chunk-QFMJYFLZ.js +671 -0
- package/dist/chunk-QFMJYFLZ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PZVR2URG.js +0 -1897
- package/dist/chunk-PZVR2URG.js.map +0 -1
package/dist/assets/dev.html
CHANGED
|
@@ -191,6 +191,18 @@ html, body {
|
|
|
191
191
|
const originalPath = '__CLAUDE_ORIGINAL_PATH__';
|
|
192
192
|
const iframeSrc = '__CLAUDE_IFRAME_SRC__';
|
|
193
193
|
|
|
194
|
+
// Prevent dev.html from being loaded inside an iframe (nested loading)
|
|
195
|
+
// If we detect we're in an iframe, redirect to the actual dev server content
|
|
196
|
+
(function preventNestedLoading() {
|
|
197
|
+
if (window.top !== window.self) {
|
|
198
|
+
// We're inside an iframe - this should not happen for dev.html
|
|
199
|
+
// Redirect this iframe to the actual dev server content
|
|
200
|
+
console.log('[Claude Dev Server Wrapper] Detected nested iframe loading, redirecting to:', iframeSrc);
|
|
201
|
+
window.location.href = iframeSrc;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
|
|
194
206
|
const urlParams = new URLSearchParams(window.location.search);
|
|
195
207
|
const wsPort = urlParams.get('wsPort');
|
|
196
208
|
|
|
@@ -231,6 +243,14 @@ html, body {
|
|
|
231
243
|
Claude Code
|
|
232
244
|
</span>
|
|
233
245
|
<div class="claude-dev-server-actions">
|
|
246
|
+
<button class="claude-dev-server-btn claude-dev-server-btn-reload" title="Reload Preview">
|
|
247
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
248
|
+
<path d="M23 4v6h-6"/>
|
|
249
|
+
<path d="M1 20v-6h6"/>
|
|
250
|
+
<path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/>
|
|
251
|
+
</svg>
|
|
252
|
+
Reload
|
|
253
|
+
</button>
|
|
234
254
|
<button class="claude-dev-server-btn claude-dev-server-btn-inspect" title="Inspect Element">
|
|
235
255
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
236
256
|
<path d="M19 11V4a2 2 0 00-2-2H4a2 2 0 00-2 2v13a2 2 0 002 2h7"/>
|
|
@@ -251,6 +271,19 @@ html, body {
|
|
|
251
271
|
}
|
|
252
272
|
});
|
|
253
273
|
|
|
274
|
+
const reloadBtn = header.querySelector('.claude-dev-server-btn-reload');
|
|
275
|
+
reloadBtn.addEventListener('click', () => {
|
|
276
|
+
if (devIframe) {
|
|
277
|
+
console.log('[Claude Dev Server Wrapper] Reloading dev iframe');
|
|
278
|
+
// Reload by reassigning src
|
|
279
|
+
const currentSrc = devIframe.src;
|
|
280
|
+
devIframe.src = '';
|
|
281
|
+
setTimeout(() => {
|
|
282
|
+
devIframe.src = currentSrc;
|
|
283
|
+
}, 10);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
254
287
|
// Terminal container
|
|
255
288
|
const terminal = document.createElement('div');
|
|
256
289
|
terminal.className = 'claude-dev-server-terminal';
|
|
@@ -500,8 +533,35 @@ html, body {
|
|
|
500
533
|
divider.addEventListener('touchstart', startDrag);
|
|
501
534
|
|
|
502
535
|
// Listen for orientation changes
|
|
503
|
-
window.matchMedia('(orientation: portrait)')
|
|
536
|
+
const orientationQuery = window.matchMedia('(orientation: portrait)');
|
|
537
|
+
orientationQuery.addEventListener('change', (e) => {
|
|
504
538
|
isPortrait = e.matches;
|
|
539
|
+
|
|
540
|
+
// Only need to adjust leftPanel, rightPanel stays flex: 1
|
|
541
|
+
const leftPanelEl = document.querySelector('.claude-dev-server-left');
|
|
542
|
+
|
|
543
|
+
if (e.matches) {
|
|
544
|
+
// Switching to portrait: ensure leftPanel width is 100%
|
|
545
|
+
if (leftPanelEl) {
|
|
546
|
+
leftPanelEl.style.width = '100%';
|
|
547
|
+
}
|
|
548
|
+
} else {
|
|
549
|
+
// Switching to landscape: clear inline styles
|
|
550
|
+
if (leftPanelEl) {
|
|
551
|
+
leftPanelEl.style.width = '';
|
|
552
|
+
leftPanelEl.style.height = '';
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Trigger resize events in iframes to notify their content
|
|
557
|
+
setTimeout(() => {
|
|
558
|
+
const iframes = document.querySelectorAll('iframe');
|
|
559
|
+
iframes.forEach(iframe => {
|
|
560
|
+
if (iframe.contentWindow) {
|
|
561
|
+
iframe.contentWindow.dispatchEvent(new Event('resize'));
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
}, 100);
|
|
505
565
|
});
|
|
506
566
|
|
|
507
567
|
function startDrag(e) {
|
|
@@ -522,6 +582,7 @@ html, body {
|
|
|
522
582
|
|
|
523
583
|
if (container && leftPanelEl) {
|
|
524
584
|
containerSize = isPortrait ? container.offsetHeight : container.offsetWidth;
|
|
585
|
+
// Always measure leftPanel
|
|
525
586
|
startSize = isPortrait ? leftPanelEl.offsetHeight : leftPanelEl.offsetWidth;
|
|
526
587
|
}
|
|
527
588
|
|
|
@@ -541,25 +602,34 @@ html, body {
|
|
|
541
602
|
|
|
542
603
|
// Use appropriate axis based on orientation
|
|
543
604
|
const currentValue = isPortrait ? clientY : clientX;
|
|
544
|
-
|
|
605
|
+
// Calculate delta: dragging down/right = positive, dragging up/left = negative
|
|
606
|
+
let delta = currentValue - startValue;
|
|
607
|
+
|
|
608
|
+
// In portrait with column-reverse: dragging down (positive) should make leftPanel smaller
|
|
609
|
+
if (isPortrait) {
|
|
610
|
+
delta = -delta;
|
|
611
|
+
}
|
|
545
612
|
|
|
546
613
|
let newSize = startSize + delta;
|
|
547
614
|
let percentage = (newSize / containerSize) * 100;
|
|
548
615
|
const clamped = Math.max(20, Math.min(80, percentage));
|
|
549
616
|
|
|
550
617
|
const leftPanelEl = document.querySelector('.claude-dev-server-left');
|
|
618
|
+
|
|
551
619
|
if (leftPanelEl) {
|
|
552
|
-
leftPanelEl.style.flex = 'none';
|
|
553
620
|
if (isPortrait) {
|
|
554
|
-
// Portrait: adjust height
|
|
621
|
+
// Portrait: adjust leftPanel (bottom) height, width is 100%
|
|
622
|
+
leftPanelEl.style.flex = 'none';
|
|
555
623
|
leftPanelEl.style.height = clamped + '%';
|
|
556
|
-
leftPanelEl.style.width = '';
|
|
624
|
+
leftPanelEl.style.width = '100%';
|
|
557
625
|
} else {
|
|
558
|
-
// Landscape: adjust width
|
|
626
|
+
// Landscape: adjust leftPanel (left) width
|
|
627
|
+
leftPanelEl.style.flex = 'none';
|
|
559
628
|
leftPanelEl.style.width = clamped + '%';
|
|
560
|
-
leftPanelEl.style.height = '';
|
|
561
629
|
}
|
|
562
630
|
}
|
|
631
|
+
|
|
632
|
+
// rightPanel stays flex: 1, no modifications needed
|
|
563
633
|
}
|
|
564
634
|
|
|
565
635
|
function endDrag() {
|