visualproof 0.11.0 → 0.11.1

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.
@@ -6346,7 +6346,7 @@ var FocusMenu = class {
6346
6346
  };
6347
6347
 
6348
6348
  // src/web/src/reload.ts
6349
- var PAGE_VERSION = true ? "0.11.0" : null;
6349
+ var PAGE_VERSION = true ? "0.11.1" : null;
6350
6350
  var KEY = "visualproof:reload";
6351
6351
  var FOR_KEY = "visualproof:reloaded-for";
6352
6352
  var FRESH_MS = 10 * 6e4;
@@ -15546,16 +15546,43 @@ function sectionHead(id, shut, title, aside = "") {
15546
15546
  var TargetList = class {
15547
15547
  el;
15548
15548
  hooks;
15549
+ /** the gone target whose Unmark was pressed once, waiting for the second press */
15550
+ arming = null;
15551
+ /** an Unmark under way, and why the last one was refused */
15552
+ busy = null;
15553
+ refused = null;
15549
15554
  constructor(el, hooks) {
15550
15555
  this.el = el;
15551
15556
  this.hooks = hooks;
15552
15557
  el.addEventListener("click", (e2) => {
15553
15558
  const t2 = e2.target;
15559
+ const unmark = t2.closest("[data-unmark]");
15560
+ if (unmark) return void this.unmark(unmark.dataset.unmark);
15561
+ if (this.arming !== null) {
15562
+ this.arming = null;
15563
+ this.render();
15564
+ }
15554
15565
  if (t2.closest("[data-sec]")) return this.hooks.toggle("targets");
15555
15566
  const row = t2.closest("[data-target]");
15556
15567
  if (row) this.hooks.open(row.dataset.open ?? null, row.dataset.target);
15557
15568
  });
15558
15569
  }
15570
+ /** Unmark pressed on a gone target's row: the first press arms it, the second takes it off. */
15571
+ async unmark(target) {
15572
+ if (!this.hooks.unmark || this.busy !== null) return;
15573
+ if (this.arming !== target) {
15574
+ this.arming = target;
15575
+ this.refused = null;
15576
+ return this.render();
15577
+ }
15578
+ this.arming = null;
15579
+ this.busy = target;
15580
+ this.render();
15581
+ const why = await this.hooks.unmark(target);
15582
+ this.busy = null;
15583
+ this.refused = why ? { target, why } : null;
15584
+ this.render();
15585
+ }
15559
15586
  render() {
15560
15587
  const rows = targetRows(this.hooks.targets(), this.hooks.list());
15561
15588
  const shut = this.hooks.shut("targets");
@@ -15565,12 +15592,17 @@ var TargetList = class {
15565
15592
  html += rows.length ? `<div class="tg-rows">` + rows.map(({ target, view: v2 }) => {
15566
15593
  const p2 = this.hooks.progress(target);
15567
15594
  const k2 = this.hooks.keyProgress(target);
15595
+ const gone = p2 === null && !!this.hooks.unmark && !this.hooks.readOnly?.();
15596
+ const armed = this.arming === target;
15597
+ const unmark = gone ? `<button class="tg-unmark${armed ? " armed" : ""}" data-unmark="${escapeHtml(target)}"${this.busy === target ? " disabled" : ""} title="${escapeHtml(armed ? `Press again to unmark ${target}: it is no target any more; the history keeps that it was` : `Unmark ${target}: it is not in the graph now, and is no target any more; the history keeps that it was`)}">${armed ? "Unmark it?" : "Unmark"}</button>` : "";
15598
+ const why = this.refused?.target === target ? `<div class="act-warn tg-why">${escapeHtml(this.refused.why)}</div>` : "";
15568
15599
  const pct2 = (x2) => p2 && p2.total ? (100 * x2 / p2.total).toFixed(1) : "0";
15569
15600
  const tip = v2 ? `${target} \u2014 open its view, on it: ${this.hooks.title?.(v2.id) ?? v2.id}` : `${target} \u2014 it has no view: open a temporary view of its TCB, linked to it until it goes (pin, fold or name it to keep it)`;
15570
- return `<button class="tg-row${v2 && v2.id === active ? " on" : ""}${v2 ? "" : " tg-viewless"}"${v2 ? ` data-open="${escapeHtml(v2.id)}"` : ""} data-target="${escapeHtml(target)}" title="${escapeHtml(tip)}"><span class="tg-name"><span class="star">\u2605</span>${escapeHtml(target.split(".").pop())}</span>` + (p2 ? (
15601
+ const row = `<button class="tg-row${v2 && v2.id === active ? " on" : ""}${v2 ? "" : " tg-viewless"}"${v2 ? ` data-open="${escapeHtml(v2.id)}"` : ""} data-target="${escapeHtml(target)}" title="${escapeHtml(tip)}"><span class="tg-name"><span class="star">\u2605</span>${escapeHtml(target.split(".").pop())}</span>` + (p2 ? (
15571
15602
  // with no view, that is said where the bar is, so that the name keeps its room
15572
15603
  (v2 ? `<span class="rv-bar"><i class="ok" style="width:${pct2(p2.approved)}%"></i><i class="commented" style="width:${pct2(p2.commented)}%"></i><i class="stale" style="width:${pct2(p2.stale)}%"></i></span>` : `<span class="tg-noview">no view</span>`) + (k2 ? `<span class="tg-key" title="${escapeHtml(`Key declarations that need review: ${k2.approved} of ${k2.total} approved, the target among them${k2.trusted ? `; ${k2.trusted} more trusted, in need of no review` : ""}`)}"><span class="key-mark">\u25C6</span>${k2.approved}/${k2.total}</span>` : "") + `<span class="tg-n" title="${escapeHtml(`All it rests on: ${p2.approved} of ${p2.total} approved`)}">${p2.approved}/${p2.total}</span>`
15573
15604
  ) : `<span class="muted tg-gone">not in the graph now${v2 ? "" : ", no view"}</span>`) + `</button>`;
15605
+ return unmark ? `<div class="tg-line">${row}${unmark}</div>${why}` : row;
15574
15606
  }).join("") + `</div>` : `<div class="tg-none muted">${this.hooks.readOnly?.() ? "No targets yet." : "No targets yet: \u2606 Mark as target in a theorem's panel."}</div>`;
15575
15607
  }
15576
15608
  keepFocus(this.el, () => this.el.innerHTML = html);
@@ -55921,6 +55953,9 @@ function tabsPart(page) {
55921
55953
  return i2 === void 0 ? null : page.flowNow.keyProgress(i2);
55922
55954
  },
55923
55955
  open: (id, target) => openTarget(id, target),
55956
+ // a target gone from the graph taken off from its row (HistorySpec decision 13), under the
55957
+ // reader's name
55958
+ unmark: async (target) => await page.people.ensure() ? page.submit({ op: "target", name: target, on: false }) : "A target is unmarked under your name: give one first.",
55924
55959
  title: (id) => page.views.title(id),
55925
55960
  shut: page.shut,
55926
55961
  toggle: page.toggleSection
@@ -56905,6 +56940,8 @@ var LostAndFound = class {
56905
56940
  flash = null;
56906
56941
  /** the Archived section opened by the reader */
56907
56942
  archivedOpen = false;
56943
+ /** the target entry whose Unmark was pressed once, by its key, waiting for the second press */
56944
+ unmarking = null;
56908
56945
  constructor(el, api2, hooks) {
56909
56946
  this.el = el;
56910
56947
  this.api = api2;
@@ -57034,6 +57071,22 @@ var LostAndFound = class {
57034
57071
  return;
57035
57072
  }
57036
57073
  const ek = at("data-lf-e");
57074
+ if (ek !== null && t2.closest("[data-lf-unmark]")) {
57075
+ const entry = group()?.entries[Number(ek)];
57076
+ if (!entry || entry.kind !== "target" || !this.hooks.unmark) return;
57077
+ if (this.unmarking !== entry.key) {
57078
+ this.unmarking = entry.key;
57079
+ return this.render();
57080
+ }
57081
+ this.unmarking = null;
57082
+ const unmark = this.hooks.unmark;
57083
+ void this.act(entry.key, async () => {
57084
+ const why = await unmark(entry.name);
57085
+ return why ? { error: why } : { ok: true };
57086
+ });
57087
+ return;
57088
+ }
57089
+ if (this.unmarking !== null) this.unmarking = null;
57037
57090
  if (ek !== null && t2.closest("[data-lf-archive]")) {
57038
57091
  const g2 = group();
57039
57092
  const entry = g2?.entries[Number(ek)];
@@ -57165,7 +57218,7 @@ var LostAndFound = class {
57165
57218
  g2.entries.forEach((e2, ei) => {
57166
57219
  const ewait = this.busy.has(e2.key) || this.busy.has(name) ? " disabled" : "";
57167
57220
  const eerr = this.errors.get(e2.key);
57168
- html += `<div class="lf-entry" data-lf-e="${ei}" data-lf-key="${escapeHtml(e2.key)}"><span class="lf-kind lf-${e2.kind}">${e2.kind}</span><div class="lf-entry-t">${this.entryHtml(e2)}</div><button class="lf-arch" data-lf-archive${ewait} title="Archive: hide it from the list; it is kept, under Archived">Archive</button>` + (eerr ? `<div class="act-warn">${escapeHtml(eerr)}</div>` : "") + `</div>`;
57221
+ html += `<div class="lf-entry" data-lf-e="${ei}" data-lf-key="${escapeHtml(e2.key)}"><span class="lf-kind lf-${e2.kind}">${e2.kind}</span><div class="lf-entry-t">${this.entryHtml(e2)}</div>` + (e2.kind === "target" && this.hooks.unmark ? this.unmarking === e2.key ? `<button class="lf-arch lf-unmark armed" data-lf-unmark${ewait} title="Press again to unmark it: it is no target any more; the history keeps that it was">Unmark it?</button>` : `<button class="lf-arch lf-unmark" data-lf-unmark${ewait} title="Unmark target: it is no target any more, and leaves this list; the history keeps that it was">Unmark</button>` : "") + `<button class="lf-arch" data-lf-archive${ewait} title="Archive: hide it from the list; it is kept, under Archived">Archive</button>` + (eerr ? `<div class="act-warn">${escapeHtml(eerr)}</div>` : "") + `</div>`;
57169
57222
  });
57170
57223
  return html + `</div>`;
57171
57224
  }
@@ -57290,6 +57343,9 @@ function timelinePart(page) {
57290
57343
  timeMachine: (at) => page.timeMachine(at),
57291
57344
  ensureName: () => page.people.ensure(),
57292
57345
  nameLost: () => page.people.lost(),
57346
+ // a lost target taken off from its entry (HistorySpec decision 13); the drawer asked for a name.
57347
+ // Not where the review cannot be changed: a snapshot, a read-only page
57348
+ ...data.snapshot || reader ? {} : { unmark: (name) => page.submit({ op: "target", name, on: false }) },
57293
57349
  toggled: (open) => {
57294
57350
  if (open && activity.open) activity.toggle(false);
57295
57351
  page.syncInsets();
@@ -1742,6 +1742,8 @@ details.lf-archived > summary { cursor: pointer; }
1742
1742
  }
1743
1743
  .lf-arch:hover { border-color: var(--accent); color: var(--accent); }
1744
1744
  .lf-arch:disabled, .act-undo:disabled { opacity: 0.5; cursor: default; }
1745
+ .lf-unmark { margin-right: 4px; }
1746
+ .lf-unmark.armed { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
1745
1747
  .lf-mv { font-size: 12.5px; }
1746
1748
  .lf-how { color: var(--text-2); font-size: 12px; }
1747
1749
  .lf-carried { color: var(--text-2); font-size: 11.5px; }
@@ -2088,7 +2090,19 @@ details.lf-archived > summary { cursor: pointer; }
2088
2090
  .tg-n { color: var(--text-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
2089
2091
  .tg-key { color: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
2090
2092
  .tg-key .key-mark { margin-right: 1px; }
2091
- .tg-gone { grid-column: 2 / 5; font-size: 11px; }
2093
+ /* gone from the graph: said on a line of its own under the name, which keeps its room beside Unmark */
2094
+ .tg-gone { grid-column: 1 / -1; font-size: 11px; }
2095
+ /* a target gone from the graph: its row, and Unmark beside it (HistorySpec decision 13) */
2096
+ .tg-line { display: flex; align-items: center; gap: 4px; }
2097
+ .tg-line > .tg-row { flex: 1 1 auto; min-width: 0; }
2098
+ .tg-unmark {
2099
+ flex: none; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-solid);
2100
+ color: var(--text-2); font: 500 11px var(--font); line-height: 18px; cursor: pointer;
2101
+ }
2102
+ .tg-unmark:hover, .tg-unmark:focus-visible { border-color: var(--accent); color: var(--accent); }
2103
+ .tg-unmark.armed { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
2104
+ .tg-unmark:disabled { opacity: 0.5; cursor: default; }
2105
+ .tg-why { margin: 2px 6px 4px; font-size: 11px; }
2092
2106
  .tg-none { margin-top: 4px; font-size: 11.5px; line-height: 1.4; }
2093
2107
  /* the board (web/src/boardpanel.ts): which view, kept or not, and its scope as chips */
2094
2108
  .board-h { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visualproof",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "description": "See a Lean codebase's declaration graph and the TCB of its theorems.",
6
6
  "license": "Apache-2.0",