@unhingged/vizu-core 0.1.19 → 0.1.21

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.
@@ -414,12 +414,19 @@ declare class Highlighter {
414
414
  destroy(): void;
415
415
  }
416
416
 
417
+ /** Status filter shared by the sidebar tabs and the on-page markers. */
418
+ type SidebarFilter = 'open' | 'resolved' | 'wontfix' | 'all';
417
419
  interface SidebarCallbacks {
418
420
  onJumpTo: (fp: ElementFingerprint) => void;
419
421
  onJumpToReference: (commentId: string, refId: string) => void;
420
422
  onDelete: (id: string) => void;
421
423
  onUpdateStatus: (id: string, status: CommentStatus) => void;
422
424
  onClose: () => void;
425
+ /**
426
+ * Fired when the user picks a status tab. The host mirrors this onto
427
+ * the on-page markers so the page and the panel show the same subset.
428
+ */
429
+ onFilterChange?: (filter: SidebarFilter) => void;
423
430
  }
424
431
  declare class Sidebar {
425
432
  private el;
@@ -414,12 +414,19 @@ declare class Highlighter {
414
414
  destroy(): void;
415
415
  }
416
416
 
417
+ /** Status filter shared by the sidebar tabs and the on-page markers. */
418
+ type SidebarFilter = 'open' | 'resolved' | 'wontfix' | 'all';
417
419
  interface SidebarCallbacks {
418
420
  onJumpTo: (fp: ElementFingerprint) => void;
419
421
  onJumpToReference: (commentId: string, refId: string) => void;
420
422
  onDelete: (id: string) => void;
421
423
  onUpdateStatus: (id: string, status: CommentStatus) => void;
422
424
  onClose: () => void;
425
+ /**
426
+ * Fired when the user picks a status tab. The host mirrors this onto
427
+ * the on-page markers so the page and the panel show the same subset.
428
+ */
429
+ onFilterChange?: (filter: SidebarFilter) => void;
423
430
  }
424
431
  declare class Sidebar {
425
432
  private el;
package/dist/internal.js CHANGED
@@ -1214,7 +1214,7 @@ var Highlighter = class {
1214
1214
  var Sidebar = class {
1215
1215
  constructor(root, callbacks) {
1216
1216
  this.open = false;
1217
- this.filter = "open";
1217
+ this.filter = "all";
1218
1218
  this.lastComments = [];
1219
1219
  this.lastConfidence = /* @__PURE__ */ new Map();
1220
1220
  this.handleClick = (e) => {
@@ -1234,6 +1234,7 @@ var Sidebar = class {
1234
1234
  if (f && f !== this.filter) {
1235
1235
  this.filter = f;
1236
1236
  this.render(this.lastComments);
1237
+ this.callbacks.onFilterChange?.(f);
1237
1238
  }
1238
1239
  return;
1239
1240
  }
@@ -1298,7 +1299,7 @@ var Sidebar = class {
1298
1299
  const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
1299
1300
  const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
1300
1301
  const statusOf = (c) => c.status ?? "open";
1301
- const visible = this.filter === "open" ? anchored.filter((c) => statusOf(c) === "open") : this.filter === "resolved" ? anchored.filter((c) => statusOf(c) !== "open") : anchored;
1302
+ const visible = this.filter === "all" ? anchored : anchored.filter((c) => statusOf(c) === this.filter);
1302
1303
  const visibleOrphans = this.filter === "all" ? orphans : [];
1303
1304
  const counts = countByStatus(comments);
1304
1305
  if (visible.length === 0 && visibleOrphans.length === 0) {
@@ -1309,7 +1310,9 @@ var Sidebar = class {
1309
1310
  const closed = counts.resolved + counts.wontfix;
1310
1311
  emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
1311
1312
  } else if (this.filter === "resolved") {
1312
- emptyCopy = `<strong>Nothing resolved.</strong>${counts.open} still open. Switch to <em>Open</em> or <em>All</em> to see more.`;
1313
+ emptyCopy = `<strong>Nothing resolved.</strong>Switch to <em>Open</em> or <em>All</em> to see more.`;
1314
+ } else if (this.filter === "wontfix") {
1315
+ emptyCopy = `<strong>Nothing marked won&apos;t&nbsp;fix.</strong>Switch to <em>Open</em> or <em>All</em> to see more.`;
1313
1316
  } else {
1314
1317
  emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
1315
1318
  }
@@ -1409,7 +1412,10 @@ var Sidebar = class {
1409
1412
  Open <span class="vz-sidebar-filter-count">${counts.open}</span>
1410
1413
  </button>
1411
1414
  <button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
1412
- Resolved <span class="vz-sidebar-filter-count">${counts.resolved + counts.wontfix}</span>
1415
+ Resolved <span class="vz-sidebar-filter-count">${counts.resolved}</span>
1416
+ </button>
1417
+ <button class="vz-sidebar-filter ${this.filter === "wontfix" ? "is-active" : ""}" data-vz="filter" data-filter="wontfix" role="tab" aria-selected="${this.filter === "wontfix"}">
1418
+ Won&apos;t fix <span class="vz-sidebar-filter-count">${counts.wontfix}</span>
1413
1419
  </button>
1414
1420
  <button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
1415
1421
  All <span class="vz-sidebar-filter-count">${total}</span>