claude-dev-server 1.2.1 → 1.2.3

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.
@@ -158,10 +158,10 @@ html, body {
158
158
  font-family: monospace;
159
159
  white-space: nowrap;
160
160
  }
161
- /* Portrait mode */
161
+ /* Portrait mode - dev on top, ttyd on bottom */
162
162
  @media (orientation: portrait) {
163
163
  .claude-dev-server-container {
164
- flex-direction: column;
164
+ flex-direction: column-reverse;
165
165
  }
166
166
  .claude-dev-server-divider {
167
167
  width: 100%;
@@ -172,9 +172,16 @@ html, body {
172
172
  width: 100%;
173
173
  min-width: unset;
174
174
  max-width: unset;
175
- height: 50%;
175
+ height: 70%;
176
176
  min-height: 200px;
177
177
  }
178
+ .claude-dev-server-left {
179
+ width: 100%;
180
+ min-width: unset;
181
+ max-width: unset;
182
+ height: 30%;
183
+ min-height: 150px;
184
+ }
178
185
  }
179
186
  </style>
180
187
  </head>
@@ -184,6 +191,18 @@ html, body {
184
191
  const originalPath = '__CLAUDE_ORIGINAL_PATH__';
185
192
  const iframeSrc = '__CLAUDE_IFRAME_SRC__';
186
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
+
187
206
  const urlParams = new URLSearchParams(window.location.search);
188
207
  const wsPort = urlParams.get('wsPort');
189
208
 
@@ -484,13 +503,46 @@ html, body {
484
503
  }
485
504
 
486
505
  function setupDraggable(divider) {
487
- let startX = 0;
488
- let startWidth = 0;
489
- let containerWidth = 0;
506
+ let startValue = 0;
507
+ let startSize = 0;
508
+ let containerSize = 0;
509
+ let isPortrait = window.matchMedia('(orientation: portrait)').matches;
490
510
 
491
511
  divider.addEventListener('mousedown', startDrag);
492
512
  divider.addEventListener('touchstart', startDrag);
493
513
 
514
+ // Listen for orientation changes
515
+ const orientationQuery = window.matchMedia('(orientation: portrait)');
516
+ orientationQuery.addEventListener('change', (e) => {
517
+ isPortrait = e.matches;
518
+
519
+ // Only need to adjust leftPanel, rightPanel stays flex: 1
520
+ const leftPanelEl = document.querySelector('.claude-dev-server-left');
521
+
522
+ if (e.matches) {
523
+ // Switching to portrait: ensure leftPanel width is 100%
524
+ if (leftPanelEl) {
525
+ leftPanelEl.style.width = '100%';
526
+ }
527
+ } else {
528
+ // Switching to landscape: clear inline styles
529
+ if (leftPanelEl) {
530
+ leftPanelEl.style.width = '';
531
+ leftPanelEl.style.height = '';
532
+ }
533
+ }
534
+
535
+ // Trigger resize events in iframes to notify their content
536
+ setTimeout(() => {
537
+ const iframes = document.querySelectorAll('iframe');
538
+ iframes.forEach(iframe => {
539
+ if (iframe.contentWindow) {
540
+ iframe.contentWindow.dispatchEvent(new Event('resize'));
541
+ }
542
+ });
543
+ }, 100);
544
+ });
545
+
494
546
  function startDrag(e) {
495
547
  isDragging = true;
496
548
  divider.classList.add('dragging');
@@ -499,14 +551,18 @@ html, body {
499
551
  iframes.forEach(iframe => iframe.style.pointerEvents = 'none');
500
552
 
501
553
  const clientX = e.touches ? e.touches[0].clientX : e.clientX;
502
- startX = clientX;
554
+ const clientY = e.touches ? e.touches[0].clientY : e.clientY;
555
+
556
+ // Use X for landscape (horizontal drag), Y for portrait (vertical drag)
557
+ startValue = isPortrait ? clientY : clientX;
503
558
 
504
559
  const container = document.querySelector('.claude-dev-server-container');
505
560
  const leftPanelEl = document.querySelector('.claude-dev-server-left');
506
561
 
507
562
  if (container && leftPanelEl) {
508
- containerWidth = container.offsetWidth;
509
- startWidth = leftPanelEl.offsetWidth;
563
+ containerSize = isPortrait ? container.offsetHeight : container.offsetWidth;
564
+ // Always measure leftPanel
565
+ startSize = isPortrait ? leftPanelEl.offsetHeight : leftPanelEl.offsetWidth;
510
566
  }
511
567
 
512
568
  e.preventDefault();
@@ -521,17 +577,38 @@ html, body {
521
577
  }
522
578
 
523
579
  const clientX = e.touches ? e.touches[0].clientX : e.clientX;
524
- const deltaX = clientX - startX;
580
+ const clientY = e.touches ? e.touches[0].clientY : e.clientY;
525
581
 
526
- let newWidth = startWidth + deltaX;
527
- let percentage = (newWidth / containerWidth) * 100;
582
+ // Use appropriate axis based on orientation
583
+ const currentValue = isPortrait ? clientY : clientX;
584
+ // Calculate delta: dragging down/right = positive, dragging up/left = negative
585
+ let delta = currentValue - startValue;
586
+
587
+ // In portrait with column-reverse: dragging down (positive) should make leftPanel smaller
588
+ if (isPortrait) {
589
+ delta = -delta;
590
+ }
591
+
592
+ let newSize = startSize + delta;
593
+ let percentage = (newSize / containerSize) * 100;
528
594
  const clamped = Math.max(20, Math.min(80, percentage));
529
595
 
530
596
  const leftPanelEl = document.querySelector('.claude-dev-server-left');
597
+
531
598
  if (leftPanelEl) {
532
- leftPanelEl.style.flex = 'none';
533
- leftPanelEl.style.width = clamped + '%';
599
+ if (isPortrait) {
600
+ // Portrait: adjust leftPanel (bottom) height, width is 100%
601
+ leftPanelEl.style.flex = 'none';
602
+ leftPanelEl.style.height = clamped + '%';
603
+ leftPanelEl.style.width = '100%';
604
+ } else {
605
+ // Landscape: adjust leftPanel (left) width
606
+ leftPanelEl.style.flex = 'none';
607
+ leftPanelEl.style.width = clamped + '%';
608
+ }
534
609
  }
610
+
611
+ // rightPanel stays flex: 1, no modifications needed
535
612
  }
536
613
 
537
614
  function endDrag() {