@unhingged/vizu-core 0.1.19 → 0.1.20
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/auto.cjs +40 -8
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.js +40 -8
- package/dist/auto.js.map +1 -1
- package/dist/index.cjs +40 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +40 -8
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +9 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +7 -0
- package/dist/internal.d.ts +7 -0
- package/dist/internal.js +9 -3
- package/dist/internal.js.map +1 -1
- package/dist/vizu.min.js +34 -31
- package/dist/vizu.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -664,6 +664,14 @@ declare class Vizu {
|
|
|
664
664
|
private selfHealedThisSession;
|
|
665
665
|
private actions;
|
|
666
666
|
private user;
|
|
667
|
+
/**
|
|
668
|
+
* Status filter shared by the sidebar tabs and the on-page markers.
|
|
669
|
+
* Picking a tab updates this (via the sidebar's onFilterChange) and
|
|
670
|
+
* re-renders markers so the page shows the same subset as the panel.
|
|
671
|
+
* Defaults to 'open' to match the sidebar's default tab — resolved /
|
|
672
|
+
* wontfix markers stay off the page until the user asks for them.
|
|
673
|
+
*/
|
|
674
|
+
private statusFilter;
|
|
667
675
|
/**
|
|
668
676
|
* Flipped true once the initial loadComments() at construction has
|
|
669
677
|
* settled (success or failure). The cloud onAuthChanged callback uses
|
|
@@ -809,6 +817,13 @@ declare class Vizu {
|
|
|
809
817
|
private openPopoverFor;
|
|
810
818
|
private closePopover;
|
|
811
819
|
private addToSelection;
|
|
820
|
+
/**
|
|
821
|
+
* Whether a comment (by id) matches the active status filter — the
|
|
822
|
+
* marker-render counterpart of the sidebar's tab filter. 'all' matches
|
|
823
|
+
* everything; the named tabs match their exact status. Unknown ids
|
|
824
|
+
* (shouldn't happen) match so we never silently drop a marker.
|
|
825
|
+
*/
|
|
826
|
+
private commentMatchesStatusFilter;
|
|
812
827
|
private commentsForElement;
|
|
813
828
|
private addCommentFromPopover;
|
|
814
829
|
private removeComment;
|
package/dist/index.d.ts
CHANGED
|
@@ -664,6 +664,14 @@ declare class Vizu {
|
|
|
664
664
|
private selfHealedThisSession;
|
|
665
665
|
private actions;
|
|
666
666
|
private user;
|
|
667
|
+
/**
|
|
668
|
+
* Status filter shared by the sidebar tabs and the on-page markers.
|
|
669
|
+
* Picking a tab updates this (via the sidebar's onFilterChange) and
|
|
670
|
+
* re-renders markers so the page shows the same subset as the panel.
|
|
671
|
+
* Defaults to 'open' to match the sidebar's default tab — resolved /
|
|
672
|
+
* wontfix markers stay off the page until the user asks for them.
|
|
673
|
+
*/
|
|
674
|
+
private statusFilter;
|
|
667
675
|
/**
|
|
668
676
|
* Flipped true once the initial loadComments() at construction has
|
|
669
677
|
* settled (success or failure). The cloud onAuthChanged callback uses
|
|
@@ -809,6 +817,13 @@ declare class Vizu {
|
|
|
809
817
|
private openPopoverFor;
|
|
810
818
|
private closePopover;
|
|
811
819
|
private addToSelection;
|
|
820
|
+
/**
|
|
821
|
+
* Whether a comment (by id) matches the active status filter — the
|
|
822
|
+
* marker-render counterpart of the sidebar's tab filter. 'all' matches
|
|
823
|
+
* everything; the named tabs match their exact status. Unknown ids
|
|
824
|
+
* (shouldn't happen) match so we never silently drop a marker.
|
|
825
|
+
*/
|
|
826
|
+
private commentMatchesStatusFilter;
|
|
812
827
|
private commentsForElement;
|
|
813
828
|
private addCommentFromPopover;
|
|
814
829
|
private removeComment;
|
package/dist/index.js
CHANGED
|
@@ -2238,6 +2238,7 @@ var Sidebar = class {
|
|
|
2238
2238
|
if (f && f !== this.filter) {
|
|
2239
2239
|
this.filter = f;
|
|
2240
2240
|
this.render(this.lastComments);
|
|
2241
|
+
this.callbacks.onFilterChange?.(f);
|
|
2241
2242
|
}
|
|
2242
2243
|
return;
|
|
2243
2244
|
}
|
|
@@ -2302,7 +2303,7 @@ var Sidebar = class {
|
|
|
2302
2303
|
const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
|
|
2303
2304
|
const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
|
|
2304
2305
|
const statusOf = (c) => c.status ?? "open";
|
|
2305
|
-
const visible = this.filter === "
|
|
2306
|
+
const visible = this.filter === "all" ? anchored : anchored.filter((c) => statusOf(c) === this.filter);
|
|
2306
2307
|
const visibleOrphans = this.filter === "all" ? orphans : [];
|
|
2307
2308
|
const counts = countByStatus(comments);
|
|
2308
2309
|
if (visible.length === 0 && visibleOrphans.length === 0) {
|
|
@@ -2313,7 +2314,9 @@ var Sidebar = class {
|
|
|
2313
2314
|
const closed = counts.resolved + counts.wontfix;
|
|
2314
2315
|
emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
|
|
2315
2316
|
} else if (this.filter === "resolved") {
|
|
2316
|
-
emptyCopy = `<strong>Nothing resolved.</strong
|
|
2317
|
+
emptyCopy = `<strong>Nothing resolved.</strong>Switch to <em>Open</em> or <em>All</em> to see more.`;
|
|
2318
|
+
} else if (this.filter === "wontfix") {
|
|
2319
|
+
emptyCopy = `<strong>Nothing marked won't fix.</strong>Switch to <em>Open</em> or <em>All</em> to see more.`;
|
|
2317
2320
|
} else {
|
|
2318
2321
|
emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
|
|
2319
2322
|
}
|
|
@@ -2413,7 +2416,10 @@ var Sidebar = class {
|
|
|
2413
2416
|
Open <span class="vz-sidebar-filter-count">${counts.open}</span>
|
|
2414
2417
|
</button>
|
|
2415
2418
|
<button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
|
|
2416
|
-
Resolved <span class="vz-sidebar-filter-count">${counts.resolved
|
|
2419
|
+
Resolved <span class="vz-sidebar-filter-count">${counts.resolved}</span>
|
|
2420
|
+
</button>
|
|
2421
|
+
<button class="vz-sidebar-filter ${this.filter === "wontfix" ? "is-active" : ""}" data-vz="filter" data-filter="wontfix" role="tab" aria-selected="${this.filter === "wontfix"}">
|
|
2422
|
+
Won't fix <span class="vz-sidebar-filter-count">${counts.wontfix}</span>
|
|
2417
2423
|
</button>
|
|
2418
2424
|
<button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
|
|
2419
2425
|
All <span class="vz-sidebar-filter-count">${total}</span>
|
|
@@ -3635,6 +3641,14 @@ var Vizu = class {
|
|
|
3635
3641
|
this.selfHealedThisSession = /* @__PURE__ */ new Set();
|
|
3636
3642
|
this.actions = [];
|
|
3637
3643
|
this.user = null;
|
|
3644
|
+
/**
|
|
3645
|
+
* Status filter shared by the sidebar tabs and the on-page markers.
|
|
3646
|
+
* Picking a tab updates this (via the sidebar's onFilterChange) and
|
|
3647
|
+
* re-renders markers so the page shows the same subset as the panel.
|
|
3648
|
+
* Defaults to 'open' to match the sidebar's default tab — resolved /
|
|
3649
|
+
* wontfix markers stay off the page until the user asks for them.
|
|
3650
|
+
*/
|
|
3651
|
+
this.statusFilter = "open";
|
|
3638
3652
|
/**
|
|
3639
3653
|
* Flipped true once the initial loadComments() at construction has
|
|
3640
3654
|
* settled (success or failure). The cloud onAuthChanged callback uses
|
|
@@ -4166,7 +4180,11 @@ var Vizu = class {
|
|
|
4166
4180
|
onJumpToReference: (commentId, refId2) => this.jumpToReference(commentId, refId2),
|
|
4167
4181
|
onDelete: (id) => void this.removeComment(id),
|
|
4168
4182
|
onUpdateStatus: (id, status) => void this.updateComment(id, { status }),
|
|
4169
|
-
onClose: () => this.closeSidebar()
|
|
4183
|
+
onClose: () => this.closeSidebar(),
|
|
4184
|
+
onFilterChange: (filter) => {
|
|
4185
|
+
this.statusFilter = filter;
|
|
4186
|
+
this.renderAllMarkers();
|
|
4187
|
+
}
|
|
4170
4188
|
});
|
|
4171
4189
|
this.pill = new Pill(this.root, {
|
|
4172
4190
|
onToggleSidebar: () => this.toggleSidebar(),
|
|
@@ -4265,6 +4283,18 @@ var Vizu = class {
|
|
|
4265
4283
|
if (this.pendingFingerprints.length > 0) this.multiSelectMode = true;
|
|
4266
4284
|
else this.multiSelectMode = false;
|
|
4267
4285
|
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Whether a comment (by id) matches the active status filter — the
|
|
4288
|
+
* marker-render counterpart of the sidebar's tab filter. 'all' matches
|
|
4289
|
+
* everything; the named tabs match their exact status. Unknown ids
|
|
4290
|
+
* (shouldn't happen) match so we never silently drop a marker.
|
|
4291
|
+
*/
|
|
4292
|
+
commentMatchesStatusFilter(id) {
|
|
4293
|
+
if (this.statusFilter === "all") return true;
|
|
4294
|
+
const c = this.comments.find((x) => x.id === id);
|
|
4295
|
+
if (!c) return true;
|
|
4296
|
+
return (c.status ?? "open") === this.statusFilter;
|
|
4297
|
+
}
|
|
4268
4298
|
commentsForElement(fp) {
|
|
4269
4299
|
const key2 = fingerprintKey(fp);
|
|
4270
4300
|
return this.comments.filter(
|
|
@@ -4456,6 +4486,8 @@ var Vizu = class {
|
|
|
4456
4486
|
}
|
|
4457
4487
|
for (const [key2, info] of byElement) {
|
|
4458
4488
|
if (info.confidence === "orphaned" || !info.target) continue;
|
|
4489
|
+
const idsForFilter = info.commentIds.filter((id) => this.commentMatchesStatusFilter(id));
|
|
4490
|
+
if (idsForFilter.length === 0) continue;
|
|
4459
4491
|
const outlineEl = document.createElement("div");
|
|
4460
4492
|
outlineEl.className = "vz-comment-outline";
|
|
4461
4493
|
if (info.confidence === "drifted") outlineEl.classList.add("vz-comment-outline-drifted");
|
|
@@ -4466,13 +4498,13 @@ var Vizu = class {
|
|
|
4466
4498
|
if (info.confidence === "drifted") marker.classList.add("vz-marker-drifted");
|
|
4467
4499
|
marker.setAttribute("data-element-key", key2);
|
|
4468
4500
|
marker.setAttribute("data-confidence", info.confidence);
|
|
4469
|
-
const total =
|
|
4501
|
+
const total = idsForFilter.length;
|
|
4470
4502
|
if (total > 1) {
|
|
4471
4503
|
marker.textContent = String(total);
|
|
4472
4504
|
marker.title = total + " comments";
|
|
4473
4505
|
} else {
|
|
4474
4506
|
marker.textContent = "";
|
|
4475
|
-
const c = this.comments.find((c2) => c2.id ===
|
|
4507
|
+
const c = this.comments.find((c2) => c2.id === idsForFilter[0]);
|
|
4476
4508
|
marker.title = c?.author ? "Comment by " + c.author.name : "Comment";
|
|
4477
4509
|
}
|
|
4478
4510
|
marker.addEventListener("click", (e) => {
|
|
@@ -4483,9 +4515,9 @@ var Vizu = class {
|
|
|
4483
4515
|
this.openPopoverFor([info.target], [info.fp], elComments);
|
|
4484
4516
|
}
|
|
4485
4517
|
});
|
|
4486
|
-
marker.addEventListener("mouseenter", () => this.pulseRelatedElements(
|
|
4518
|
+
marker.addEventListener("mouseenter", () => this.pulseRelatedElements(idsForFilter, key2));
|
|
4487
4519
|
this.root.appendChild(marker);
|
|
4488
|
-
this.markers.set(key2, { marker, target: info.target, fp: info.fp, commentIds:
|
|
4520
|
+
this.markers.set(key2, { marker, target: info.target, fp: info.fp, commentIds: idsForFilter });
|
|
4489
4521
|
if (info.target) {
|
|
4490
4522
|
this.positionMarker(marker, info.target);
|
|
4491
4523
|
this.positionOutline(outlineEl, info.target);
|