viagen 0.0.21 → 0.0.22

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 (2) hide show
  1. package/dist/index.js +37 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -416,7 +416,6 @@ function buildClientScript(opts) {
416
416
  const toggleSideKey = pos.includes("left") ? "left" : "right";
417
417
  const toggleVerticalKey = pos.includes("top") ? "top" : "bottom";
418
418
  const toggleClosedVal = "16px";
419
- const toggleOpenVal = `${pw + 14}px`;
420
419
  return (
421
420
  /* js */
422
421
  `
@@ -519,10 +518,45 @@ function buildClientScript(opts) {
519
518
  var PANEL_KEY = 'viagen_panel_open';
520
519
  var panel = document.createElement('div');
521
520
  panel.id = 'viagen-panel';
522
- panel.style.cssText = 'position:fixed;top:0;${panelSide}bottom:0;width:${pw}px;z-index:99997;display:none;border-left:1px solid #27272a;box-shadow:-4px 0 24px rgba(0,0,0,0.5);';
521
+ var PANEL_WIDTH_KEY = 'viagen_panel_width';
522
+ var panelWidth = ${pw};
523
+ try { var saved = parseInt(sessionStorage.getItem(PANEL_WIDTH_KEY)); if (saved >= 280) panelWidth = saved; } catch(e) {}
524
+ panel.style.cssText = 'position:fixed;top:0;${panelSide}bottom:0;width:' + panelWidth + 'px;z-index:99997;display:none;border-${pos.includes("left") ? "right" : "left"}:1px solid #27272a;box-shadow:${pos.includes("left") ? "4" : "-4"}px 0 24px rgba(0,0,0,0.5);';
523
525
  var iframe = document.createElement('iframe');
524
526
  iframe.src = '/via/ui';
525
527
  iframe.style.cssText = 'width:100%;height:100%;border:none;background:#09090b;';
528
+
529
+ /* ---- Drag-resize handle ---- */
530
+ var handle = document.createElement('div');
531
+ handle.style.cssText = 'position:absolute;top:0;${pos.includes("left") ? "right" : "left"}:-3px;width:6px;height:100%;cursor:col-resize;z-index:1;background:transparent;transition:background 0.15s;';
532
+ handle.onmouseenter = function() { handle.style.background = '#3f3f46'; };
533
+ handle.onmouseleave = function() { if (!resizing) handle.style.background = 'transparent'; };
534
+ var resizing = false;
535
+
536
+ handle.addEventListener('mousedown', function(e) {
537
+ e.preventDefault();
538
+ resizing = true;
539
+ handle.style.background = '#3f3f46';
540
+ iframe.style.pointerEvents = 'none';
541
+ });
542
+ document.addEventListener('mousemove', function(e) {
543
+ if (!resizing) return;
544
+ var w = ${pos.includes("left") ? "e.clientX" : "window.innerWidth - e.clientX"};
545
+ if (w < 280) w = 280;
546
+ if (w > window.innerWidth - 100) w = window.innerWidth - 100;
547
+ panelWidth = w;
548
+ panel.style.width = w + 'px';
549
+ toggle.style.${toggleSideKey} = (w + 14) + 'px';
550
+ });
551
+ document.addEventListener('mouseup', function() {
552
+ if (!resizing) return;
553
+ resizing = false;
554
+ handle.style.background = 'transparent';
555
+ iframe.style.pointerEvents = '';
556
+ try { sessionStorage.setItem(PANEL_WIDTH_KEY, String(panelWidth)); } catch(e) {}
557
+ });
558
+
559
+ panel.appendChild(handle);
526
560
  panel.appendChild(iframe);
527
561
  document.body.appendChild(panel);
528
562
 
@@ -547,7 +581,7 @@ function buildClientScript(opts) {
547
581
  function setPanelOpen(open) {
548
582
  panel.style.display = open ? 'block' : 'none';
549
583
  toggle.innerHTML = open ? 'close' : dotHtml() + 'via';
550
- toggle.style.${toggleSideKey} = open ? '${toggleOpenVal}' : '${toggleClosedVal}';
584
+ toggle.style.${toggleSideKey} = open ? (panelWidth + 14) + 'px' : '${toggleClosedVal}';
551
585
  toggle.style.${toggleVerticalKey} = open ? '${pos.includes("top") ? "16" : "11"}px' : '12px';
552
586
  toggle.style.borderColor = open ? '#71717a' : '#3f3f46';
553
587
  toggle.style.color = open ? '#a1a1aa' : '#a1a1aa';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viagen",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Vite dev server plugin that exposes endpoints for chatting with Claude Code SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",