clay-server 2.20.0-beta.2 → 2.20.0-beta.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.
Files changed (2) hide show
  1. package/lib/public/app.js +42 -28
  2. package/package.json +1 -1
package/lib/public/app.js CHANGED
@@ -5527,26 +5527,31 @@ import { initDebate, handleDebateStarted, handleDebateResumed, handleDebateTurn,
5527
5527
  '<h2 style="margin:0 0 8px;color:var(--text,#fff);font-size:22px">Set your new PIN</h2>' +
5528
5528
  '<p style="margin:0 0 24px;color:var(--text-secondary,#aaa);font-size:14px">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
5529
5529
  '<div style="display:flex;gap:8px;justify-content:center;margin-bottom:16px" id="fcp-boxes">' +
5530
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5531
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5532
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5533
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5534
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5535
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-secondary,#1a1a1e);color:var(--text,#fff);outline:none">' +
5530
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5531
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5532
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5533
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5534
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5535
+ '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
5536
5536
  '</div>' +
5537
5537
  '<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent,#7c3aed);color:#fff;font-size:15px;font-weight:600;cursor:pointer;opacity:0.5">Save PIN</button>' +
5538
5538
  '<div id="fcp-err" style="margin-top:12px;color:#ef4444;font-size:13px"></div>' +
5539
5539
  '</div>';
5540
5540
  document.body.appendChild(ov);
5541
5541
 
5542
- var digits = ov.querySelectorAll(".fcp-digit");
5542
+ var boxes = ov.querySelectorAll(".fcp-digit");
5543
5543
  var saveBtn = ov.querySelector("#fcp-save");
5544
5544
  var errEl = ov.querySelector("#fcp-err");
5545
+ var pinValues = ["", "", "", "", "", ""];
5546
+
5547
+ function setDigit(idx, v) {
5548
+ pinValues[idx] = v;
5549
+ boxes[idx].value = v ? "\u2022" : "";
5550
+ boxes[idx].classList.toggle("filled", v.length > 0);
5551
+ }
5545
5552
 
5546
5553
  function getPin() {
5547
- var pin = "";
5548
- for (var i = 0; i < digits.length; i++) pin += digits[i].value;
5549
- return pin;
5554
+ return pinValues.join("");
5550
5555
  }
5551
5556
 
5552
5557
  function updateBtn() {
@@ -5555,40 +5560,49 @@ import { initDebate, handleDebateStarted, handleDebateResumed, handleDebateTurn,
5555
5560
  saveBtn.style.opacity = ready ? "1" : "0.5";
5556
5561
  }
5557
5562
 
5558
- for (var i = 0; i < digits.length; i++) {
5563
+ for (var i = 0; i < boxes.length; i++) {
5559
5564
  (function (idx) {
5560
- digits[idx].addEventListener("input", function () {
5561
- var val = this.value.replace(/\D/g, "");
5562
- this.value = val.substring(0, 1);
5563
- if (val && idx < digits.length - 1) digits[idx + 1].focus();
5565
+ boxes[idx].addEventListener("input", function () {
5566
+ var raw = this.value.replace(/[^0-9]/g, "");
5567
+ if (!raw) { setDigit(idx, ""); updateBtn(); return; }
5568
+ var v = raw.charAt(raw.length - 1);
5569
+ setDigit(idx, v);
5570
+ if (v && idx < 5) boxes[idx + 1].focus();
5564
5571
  updateBtn();
5565
5572
  });
5566
- digits[idx].addEventListener("keydown", function (e) {
5567
- if (e.key === "Backspace" && !this.value && idx > 0) {
5568
- digits[idx - 1].focus();
5569
- digits[idx - 1].value = "";
5573
+ boxes[idx].addEventListener("keydown", function (e) {
5574
+ if (e.key === "Backspace") {
5575
+ if (!pinValues[idx] && idx > 0) {
5576
+ setDigit(idx - 1, "");
5577
+ boxes[idx - 1].focus();
5578
+ } else {
5579
+ setDigit(idx, "");
5580
+ }
5570
5581
  updateBtn();
5571
5582
  }
5583
+ if (e.key === "ArrowLeft" && idx > 0) boxes[idx - 1].focus();
5584
+ if (e.key === "ArrowRight" && idx < 5) boxes[idx + 1].focus();
5572
5585
  if (e.key === "Enter" && !saveBtn.disabled) doSave();
5573
5586
  e.stopPropagation();
5574
5587
  });
5575
- digits[idx].addEventListener("keyup", function (e) { e.stopPropagation(); });
5576
- digits[idx].addEventListener("keypress", function (e) { e.stopPropagation(); });
5577
- digits[idx].addEventListener("paste", function (e) {
5588
+ boxes[idx].addEventListener("keyup", function (e) { e.stopPropagation(); });
5589
+ boxes[idx].addEventListener("keypress", function (e) { e.stopPropagation(); });
5590
+ boxes[idx].addEventListener("paste", function (e) {
5578
5591
  e.preventDefault();
5579
- var text = (e.clipboardData || window.clipboardData).getData("text").replace(/\D/g, "").substring(0, 6);
5580
- for (var j = 0; j < text.length && (idx + j) < digits.length; j++) {
5581
- digits[idx + j].value = text[j];
5592
+ var text = (e.clipboardData || window.clipboardData).getData("text").replace(/[^0-9]/g, "").substring(0, 6);
5593
+ for (var j = 0; j < text.length && (idx + j) < 6; j++) {
5594
+ setDigit(idx + j, text.charAt(j));
5582
5595
  }
5583
5596
  if (text.length > 0) {
5584
- var focusIdx = Math.min(idx + text.length, digits.length - 1);
5585
- digits[focusIdx].focus();
5597
+ var focusIdx = Math.min(idx + text.length, 5);
5598
+ boxes[focusIdx].focus();
5586
5599
  }
5587
5600
  updateBtn();
5588
5601
  });
5602
+ boxes[idx].addEventListener("focus", function () { this.select(); });
5589
5603
  })(i);
5590
5604
  }
5591
- digits[0].focus();
5605
+ boxes[0].focus();
5592
5606
 
5593
5607
  function doSave() {
5594
5608
  var pin = getPin();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.20.0-beta.2",
3
+ "version": "2.20.0-beta.4",
4
4
  "description": "Web UI for Claude Code. Any device. Push notifications.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",