@loupekit/sdk 0.10.7 → 0.10.8

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/index.js CHANGED
@@ -2476,8 +2476,25 @@ var HttpAdapter = class {
2476
2476
  }
2477
2477
  };
2478
2478
 
2479
+ // ../shared/dist/index.js
2480
+ var COMMENT_STAGES = ["queue", "todo", "in_progress", "in_review", "resolved"];
2481
+ var LEGACY_STATUS = {
2482
+ open: "queue",
2483
+ in_progress: "in_progress",
2484
+ done: "resolved"
2485
+ };
2486
+ function normalizeStatus(value) {
2487
+ if (typeof value === "string") {
2488
+ if (COMMENT_STAGES.includes(value))
2489
+ return value;
2490
+ if (value in LEGACY_STATUS)
2491
+ return LEGACY_STATUS[value];
2492
+ }
2493
+ return "queue";
2494
+ }
2495
+
2479
2496
  // src/app.ts
2480
- var SDK_VERSION = true ? "0.10.7" : "dev";
2497
+ var SDK_VERSION = true ? "0.10.8" : "dev";
2481
2498
  var DOCK_MODES = ["left", "right", "bottom", "float"];
2482
2499
  var RECORD_MAX_MS = 2e4;
2483
2500
  var MAX_FILES = 10;
@@ -3420,7 +3437,7 @@ var LoupeApp = class {
3420
3437
  author: this.cfg.user,
3421
3438
  title,
3422
3439
  body,
3423
- status: "open",
3440
+ status: "queue",
3424
3441
  kind: target.kind,
3425
3442
  anchor,
3426
3443
  context,
@@ -3482,7 +3499,7 @@ var LoupeApp = class {
3482
3499
  this.pins.set(c.id, pin);
3483
3500
  }
3484
3501
  pin.textContent = String(i + 1);
3485
- pin.classList.toggle("done", c.status === "done");
3502
+ pin.classList.toggle("done", isResolved(c));
3486
3503
  pin.classList.toggle("free", c.kind === "free");
3487
3504
  });
3488
3505
  this.updateCount();
@@ -3661,11 +3678,11 @@ var LoupeApp = class {
3661
3678
  this.updateCount();
3662
3679
  }
3663
3680
  itemView(c, i) {
3664
- const detached = this.pins.get(c.id)?.classList.contains("detached") && c.status !== "done";
3681
+ const detached = this.pins.get(c.id)?.classList.contains("detached") && !isResolved(c);
3665
3682
  const open = this.expanded.has(c.id);
3666
3683
  const item = el("div", "item" + (open ? "" : " collapsed"));
3667
3684
  const top = el("div", "top");
3668
- const num = el("span", "num" + (c.status === "done" ? " done" : detached ? " detached" : ""), String(i + 1));
3685
+ const num = el("span", "num" + (isResolved(c) ? " done" : detached ? " detached" : ""), String(i + 1));
3669
3686
  top.append(num);
3670
3687
  if (c.recording) top.appendChild(el("span", "rectag", "\u23FA recording"));
3671
3688
  const vw = c.viewport?.w;
@@ -3674,7 +3691,7 @@ var LoupeApp = class {
3674
3691
  const icon = vw < 768 ? "\u{1F4F1}" : vw < 1024 ? "\u25A6" : "\u{1F5A5}";
3675
3692
  top.appendChild(el("span", "device", `${icon} ${kind}`));
3676
3693
  }
3677
- if (c.status === "done") top.appendChild(el("span", "badge done", "done"));
3694
+ if (isResolved(c)) top.appendChild(el("span", "badge done", "resolved"));
3678
3695
  else if (detached) top.appendChild(el("span", "badge detached", "element moved/removed"));
3679
3696
  top.appendChild(el("span", "caret", open ? "\u25BE" : "\u25B8"));
3680
3697
  item.appendChild(top);
@@ -3710,10 +3727,10 @@ var LoupeApp = class {
3710
3727
  }
3711
3728
  }
3712
3729
  const actions = el("div", "actions");
3713
- const doneBtn = el("button", "", c.status === "done" ? "Reopen" : "Mark done");
3730
+ const doneBtn = el("button", "", isResolved(c) ? "Reopen" : "Resolve");
3714
3731
  doneBtn.onclick = async (e) => {
3715
3732
  e.stopPropagation();
3716
- const status = c.status === "done" ? "open" : "done";
3733
+ const status = isResolved(c) ? "queue" : "resolved";
3717
3734
  c.status = status;
3718
3735
  await this.store.update(c.id, { status });
3719
3736
  this.renderPins();
@@ -3886,6 +3903,9 @@ function describeAnchor(c) {
3886
3903
  if (c.kind === "free") return "Free note \xB7 page-level";
3887
3904
  return c.anchor.testid ? `[data-testid="${c.anchor.testid}"]` : c.anchor.cssPath;
3888
3905
  }
3906
+ function isResolved(c) {
3907
+ return normalizeStatus(c.status) === "resolved";
3908
+ }
3889
3909
 
3890
3910
  // src/index.ts
3891
3911
  var app = null;