visualproof 0.4.1 → 0.4.3

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.
@@ -39,6 +39,21 @@ export function nonStandardAxiom(g, i) {
39
39
  export function needsReview(g, d, i) {
40
40
  return nonStandardAxiom(g, i) || !trusted(d, g.nodes[i].name, g.nodes[i].module, g.isExt(i));
41
41
  }
42
+ /** What set `s` holds besides `skip`, as a TCB's size counts it (TCBSpec decision 7): `counted`,
43
+ * what needs review; `trusted`, the rest, told apart and never added in. The panel's counts and
44
+ * the selection bar's (ViewSpec decision 14) count so. */
45
+ export function trustSplit(g, d, s, skip = -1) {
46
+ let counted = 0, t = 0;
47
+ for (let j = 0; j < s.length; j++) {
48
+ if (!s[j] || j === skip)
49
+ continue;
50
+ if (needsReview(g, d, j))
51
+ counted++;
52
+ else
53
+ t++;
54
+ }
55
+ return { counted, trusted: t };
56
+ }
42
57
  /** What `root`'s review holds, its review set (`reviewScope`), in the graph's numbering. */
43
58
  export function reviewSet(g, d, root) {
44
59
  return evaluate(reviewScope(g.nodes[root].name), { g, review: d });
@@ -3040,6 +3040,18 @@ function inTargets(g2, targets) {
3040
3040
  function nonStandardAxiom(g2, i2) {
3041
3041
  return g2.nodes[i2].kind === "axiom" && !STANDARD_AXIOMS.includes(g2.nodes[i2].name);
3042
3042
  }
3043
+ function needsReview(g2, d2, i2) {
3044
+ return nonStandardAxiom(g2, i2) || !trusted(d2, g2.nodes[i2].name, g2.nodes[i2].module, g2.isExt(i2));
3045
+ }
3046
+ function trustSplit(g2, d2, s2, skip = -1) {
3047
+ let counted = 0, t2 = 0;
3048
+ for (let j2 = 0; j2 < s2.length; j2++) {
3049
+ if (!s2[j2] || j2 === skip) continue;
3050
+ if (needsReview(g2, d2, j2)) counted++;
3051
+ else t2++;
3052
+ }
3053
+ return { counted, trusted: t2 };
3054
+ }
3043
3055
  function reviewSet(g2, d2, root) {
3044
3056
  return evaluate(reviewScope(g2.nodes[root].name), { g: g2, review: d2 });
3045
3057
  }
@@ -12234,6 +12246,7 @@ function editorAnchor(href) {
12234
12246
 
12235
12247
  // src/web/src/panel.ts
12236
12248
  var PANEL_SECTIONS = { why: "p-why", stats: "p-stats", axioms: "p-axioms", tcb: "p-tcb" };
12249
+ var TRUSTED_TITLE = "Trusted without review, and not counted: what a trusted prefix covers (Mathlib, Lean's own by default), and the standard axioms";
12237
12250
  function banner(f2) {
12238
12251
  if (!f2) return "";
12239
12252
  const when = f2.builtAt ? new Date(f2.builtAt).toLocaleString() : "";
@@ -12352,18 +12365,16 @@ var Panel = class {
12352
12365
  const tcb = g2.reach([i2], SITE_STMT | SITE_BODY, "out");
12353
12366
  const deps = g2.reach([i2], ALL_SITES, "out");
12354
12367
  const apps = g2.reach([i2], ALL_SITES, "in");
12355
- const count2 = (s2) => {
12356
- let p2 = 0, x2 = 0;
12357
- for (let j2 = 0; j2 < s2.length; j2++) if (s2[j2] && j2 !== i2) g2.isExt(j2) ? x2++ : p2++;
12358
- return [p2, x2];
12359
- };
12360
- const [tcbP, tcbX] = count2(tcb);
12361
- const [depP, depX] = count2(deps);
12362
- const [appP] = count2(apps);
12368
+ const d2 = this.hooks.reviewData();
12369
+ const inTcb = trustSplit(g2, d2, tcb, i2);
12370
+ const used = trustSplit(g2, d2, deps, i2);
12371
+ const n3 = (x2) => x2.toLocaleString();
12372
+ let appP = 0;
12373
+ for (let j2 = 0; j2 < apps.length; j2++) if (apps[j2] && j2 !== i2 && !g2.isExt(j2)) appP++;
12363
12374
  const axioms = g2.axiomsOf(i2);
12364
12375
  const groups = /* @__PURE__ */ new Map();
12365
12376
  for (let j2 = 0; j2 < tcb.length; j2++) {
12366
- if (!tcb[j2] || j2 === i2 || g2.isExt(j2)) continue;
12377
+ if (!tcb[j2] || j2 === i2 || !needsReview(g2, d2, j2)) continue;
12367
12378
  const k2 = g2.nodes[j2].kind;
12368
12379
  if (!groups.has(k2)) groups.set(k2, []);
12369
12380
  groups.get(k2).push(j2);
@@ -12371,7 +12382,7 @@ var Panel = class {
12371
12382
  const order = ["axiom", "opaque", "structure", "class", "inductive", "def", "abbrev", "instance", "notation", "theorem"];
12372
12383
  const tcbList = [...groups.entries()].sort((a3, b2) => order.indexOf(a3[0]) - order.indexOf(b2[0])).map(([k2, xs]) => {
12373
12384
  xs.sort((a3, b2) => g2.nodes[a3].name < g2.nodes[b2].name ? -1 : 1);
12374
- return `<div class="grp"><div class="grp-h"><span class="dot k-${k2}"></span>${k2} <span class="muted">${xs.length}</span></div>` + xs.map((j2) => `<button class="row rv-${markOf(this.hooks.reviewData(), g2.nodes[j2].name, g2.nodes[j2].module, false, g2.nodes[j2].hash)}" data-go="${j2}" title="Go to ${escapeHtml(g2.nodes[j2].name)}">${escapeHtml(g2.nodes[j2].name)}</button>`).join("") + `</div>`;
12385
+ return `<div class="grp"><div class="grp-h"><span class="dot k-${k2}"></span>${k2} <span class="muted">${xs.length}</span></div>` + xs.map((j2) => `<button class="row rv-${markOf(d2, g2.nodes[j2].name, g2.nodes[j2].module, g2.isExt(j2), g2.nodes[j2].hash)}" data-go="${j2}" title="Go to ${escapeHtml(g2.nodes[j2].name)}">${escapeHtml(g2.nodes[j2].name)}</button>`).join("") + `</div>`;
12375
12386
  }).join("");
12376
12387
  const listOrder = this.hooks.listOrder();
12377
12388
  const keyOnly = listOrder === "key";
@@ -12413,11 +12424,11 @@ var Panel = class {
12413
12424
  ${this.hooks.links?.(i2) ?? ""}
12414
12425
  ${this.box.html(i2, true, tcb)}
12415
12426
  ${why ? part(PANEL_SECTIONS.why, "Why in the TCB", "", () => why) : ""}
12416
- ${part(PANEL_SECTIONS.stats, "Counts", `${tcbP} in TCB \xB7 ${depP} uses \xB7 ${appP} used by`, () => `
12427
+ ${part(PANEL_SECTIONS.stats, "Counts", `${n3(inTcb.counted)} in TCB \xB7 ${n3(used.counted)} uses \xB7 ${n3(appP)} used by`, () => `
12417
12428
  <div class="stats">
12418
- <div class="stat"><div class="n grad-tcb">${tcbP}</div><div class="l">in TCB<br><span class="muted">+${tcbX} external</span></div></div>
12419
- <div class="stat"><div class="n grad-dep">${depP}</div><div class="l">uses<br><span class="muted">+${depX} external</span></div></div>
12420
- <div class="stat"><div class="n grad-app">${appP}</div><div class="l">used by</div></div>
12429
+ <div class="stat"><div class="n grad-tcb">${n3(inTcb.counted)}</div><div class="l">in TCB<br><span class="muted" title="${TRUSTED_TITLE}">+${n3(inTcb.trusted)} trusted</span></div></div>
12430
+ <div class="stat"><div class="n grad-dep">${n3(used.counted)}</div><div class="l">uses<br><span class="muted" title="${TRUSTED_TITLE}">+${n3(used.trusted)} trusted</span></div></div>
12431
+ <div class="stat"><div class="n grad-app">${n3(appP)}</div><div class="l">used by</div></div>
12421
12432
  </div>`)}
12422
12433
  ${part(
12423
12434
  PANEL_SECTIONS.axioms,
@@ -12427,7 +12438,7 @@ var Panel = class {
12427
12438
  () => `<div class="axioms">${axioms.length ? axioms.map((a3) => `<span class="chip ${nonStd.includes(a3) ? "bad" : ""}">${escapeHtml(a3)}</span>`).join("") : `<span class="muted">none</span>`}</div>`
12428
12439
  )}
12429
12440
  ${notationHtml(g2, i2)}
12430
- ${tcbP ? part(PANEL_SECTIONS.tcb, "Its TCB", `${tcbP}${queue === null ? "" : keyOnly ? " \xB7 key declarations" : inOrder ? " \xB7 in review order" : " \xB7 by kind"}`, () => `<div class="sec-tcb p-order">${orderSwitch}</div><div class="tcb-list">${inOrder ? queue : tcbList}</div>`, { id: "checks", title: "What a TCB is: the film's chapter on the ways to check" }) : ""}
12441
+ ${inTcb.counted ? part(PANEL_SECTIONS.tcb, "Its TCB", `${inTcb.counted}${queue === null ? "" : keyOnly ? " \xB7 key declarations" : inOrder ? " \xB7 in review order" : " \xB7 by kind"}`, () => `<div class="sec-tcb p-order">${orderSwitch}</div><div class="tcb-list">${inOrder ? queue : tcbList}</div>`, { id: "checks", title: "What a TCB is: the film's chapter on the ways to check" }) : ""}
12431
12442
  `;
12432
12443
  this.el.classList.add("open");
12433
12444
  if (!same2) this.el.scrollTop = 0;
@@ -18901,8 +18912,17 @@ var FocusMenu = class {
18901
18912
 
18902
18913
  // src/web/src/phone.ts
18903
18914
  var PHONE = "(max-width: 640px)";
18915
+ var TALL = "(min-width: 641px) and (max-aspect-ratio: 5/6)";
18916
+ var SHEETED = "(max-width: 640px), (max-aspect-ratio: 5/6)";
18917
+ var matches = (q2) => typeof matchMedia === "function" && matchMedia(q2).matches;
18904
18918
  function isPhone() {
18905
- return typeof matchMedia === "function" && matchMedia(PHONE).matches;
18919
+ return matches(PHONE);
18920
+ }
18921
+ function isTall() {
18922
+ return matches(TALL);
18923
+ }
18924
+ function sheeted() {
18925
+ return matches(SHEETED);
18906
18926
  }
18907
18927
  var ITEMS = [
18908
18928
  { id: "share-btn", label: "Share" },
@@ -18923,6 +18943,28 @@ var SIDE_POPS = [
18923
18943
  var SHEET_MID = 0.55;
18924
18944
  var SHEET_TOP = 0.92;
18925
18945
  var GRIP_PX = 34;
18946
+ var TALL_MID = 0.5;
18947
+ var TALL_LEAST = 0.33;
18948
+ var TALL_TOP_PX = 120;
18949
+ var EDGE_PX = 12;
18950
+ var SHEETS = ["panel", "activity", "lostfound"];
18951
+ var DOCKED = "#windows > :is(.sw-win, .pw-win, #following.talking):not(.collapsed, [hidden])";
18952
+ function tallInsets() {
18953
+ const $5 = (id) => document.getElementById(id);
18954
+ const bar = $5("selbar");
18955
+ const strip = [$5("lensbar"), $5("tm-kept")].find((e2) => e2 && !e2.hidden);
18956
+ const under2 = !bar.hidden ? bar.getBoundingClientRect().bottom : strip ? strip.getBoundingClientRect().bottom : $5("viewbar").getBoundingClientRect().bottom;
18957
+ let low = 0;
18958
+ for (const id of SHEETS) {
18959
+ const el = $5(id);
18960
+ if (el?.classList.contains("open")) low = Math.max(low, el.offsetHeight);
18961
+ }
18962
+ if (document.querySelector(DOCKED)) low = Math.max(low, $5("windows").offsetHeight);
18963
+ const room2 = low ? low + EDGE_PX + 8 : EDGE_PX;
18964
+ document.body.style.setProperty("--room-bottom", `${room2}px`);
18965
+ document.body.style.setProperty("--room-shown", innerHeight - room2 - under2 < 200 ? "hidden" : "visible");
18966
+ return { left: 0, right: 0, top: under2 + 12, bottom: room2 + 36 };
18967
+ }
18926
18968
  var Phone = class {
18927
18969
  hooks;
18928
18970
  pop;
@@ -18960,12 +19002,30 @@ var Phone = class {
18960
19002
  }).observe(badge, { attributes: true, childList: true, characterData: true, subtree: true });
18961
19003
  document.getElementById("side-btn").addEventListener("click", () => this.drawer(!document.body.classList.contains("side-open")));
18962
19004
  document.getElementById("side").addEventListener("click", (e2) => {
18963
- if (!isPhone()) return;
19005
+ if (!sheeted()) return;
18964
19006
  const t2 = e2.target;
18965
19007
  if (t2.closest(".tw, button, [data-sec]")) return;
18966
19008
  if (t2.closest(".tg-row, .o-row, [data-go], [data-open]")) setTimeout(() => this.drawer(false), 120);
18967
19009
  });
18968
- this.bindSheet(document.getElementById("panel"));
19010
+ for (const id of SHEETS) {
19011
+ const el = document.getElementById(id);
19012
+ if (el) this.bindSheet(el);
19013
+ }
19014
+ const dock = document.getElementById("windows");
19015
+ if (dock) this.bindSheet(dock, 14, true);
19016
+ const changed = () => {
19017
+ if (!sheeted()) this.drawer(false);
19018
+ this.sizeSheet();
19019
+ this.hooks.resized();
19020
+ };
19021
+ if (typeof matchMedia === "function") for (const q2 of [PHONE, TALL]) matchMedia(q2).addEventListener("change", changed);
19022
+ addEventListener("resize", () => this.sizeSheet());
19023
+ this.sizeSheet();
19024
+ const windows = document.getElementById("windows");
19025
+ if (windows)
19026
+ new MutationObserver((ms) => {
19027
+ if (isTall() && ms.some((m3) => m3.type === "childList" ? m3.target === windows : m3.target.parentNode === windows)) this.hooks.resized();
19028
+ }).observe(windows, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "hidden"] });
18969
19029
  for (const [id, close] of [["activity", "[data-act-close]"], ["lostfound", "[data-lf-close]"]]) {
18970
19030
  const el = document.getElementById(id);
18971
19031
  el?.addEventListener("click", (e2) => {
@@ -19026,24 +19086,63 @@ var Phone = class {
19026
19086
  document.body.classList.toggle("side-open", on);
19027
19087
  document.getElementById("side-btn").setAttribute("aria-expanded", String(on));
19028
19088
  }
19029
- /** The panel's sheet: a tap on its handle, at its top, makes it the whole screen or half of it
19030
- * (PhoneSpec decision 10: a tap, not a drag); ✕ closes it. */
19031
- bindSheet(panel) {
19089
+ /** The sheet's height as a share of the screen's, while the page is open: on a phone the middle
19090
+ * or the top (decision 10), on a tall screen what the reader set (decision 20). */
19091
+ share = { phone: SHEET_MID, tall: TALL_MID };
19092
+ /** The sheet's height, in px, for the screen as it is now (`--sheet-h`: the panel, Activity, the
19093
+ * lost-and-found and the windows docked in their place read it). */
19094
+ sizeSheet() {
19095
+ const tall = isTall();
19096
+ const h2 = tall ? Math.min(innerHeight * this.share.tall, innerHeight - TALL_TOP_PX - EDGE_PX) : innerHeight * this.share.phone;
19097
+ document.documentElement.style.setProperty("--sheet-h", `${Math.round(h2)}px`);
19098
+ }
19099
+ /** A sheet: a tap on its handle, at its top, makes it the tallest or half of the screen (PhoneSpec
19100
+ * decision 10: on a phone a tap, not a drag); on a tall screen a drag on the handle sets its
19101
+ * height too (decision 20). ✕ closes it. */
19102
+ bindSheet(sheet, grip = GRIP_PX, own2 = false) {
19032
19103
  let press = null;
19033
- panel.addEventListener("pointerdown", (e2) => {
19034
- if (!isPhone() || e2.button !== 0) return;
19035
- const r2 = panel.getBoundingClientRect();
19036
- press = e2.clientY - r2.top <= GRIP_PX ? { id: e2.pointerId, y: e2.clientY } : null;
19037
- });
19038
- panel.addEventListener("pointerup", (e2) => {
19104
+ const move = (e2) => {
19039
19105
  const p2 = press;
19106
+ if (!p2 || p2.id !== e2.pointerId) return;
19107
+ if (!p2.dragged && Math.abs(e2.clientY - p2.y) <= 10) return;
19108
+ p2.dragged = true;
19109
+ sheet.classList.add("sizing");
19110
+ const h2 = Math.max(innerHeight * TALL_LEAST, Math.min(p2.h + p2.y - e2.clientY, innerHeight - TALL_TOP_PX - EDGE_PX));
19111
+ this.share.tall = h2 / innerHeight;
19112
+ this.sizeSheet();
19113
+ };
19114
+ const end = (e2) => {
19115
+ const p2 = press;
19116
+ if (!p2 || p2.id !== e2.pointerId) return;
19040
19117
  press = null;
19041
- if (!p2 || p2.id !== e2.pointerId || Math.abs(e2.clientY - p2.y) > 10) return;
19042
- const full = panel.getBoundingClientRect().height > innerHeight * ((SHEET_MID + SHEET_TOP) / 2);
19043
- panel.style.setProperty("--sheet-h", `${Math.round(innerHeight * (full ? SHEET_MID : SHEET_TOP))}px`);
19118
+ removeEventListener("pointermove", move);
19119
+ removeEventListener("pointerup", end);
19120
+ removeEventListener("pointercancel", end);
19121
+ sheet.classList.remove("sizing");
19122
+ if (e2.type === "pointercancel") return;
19123
+ if (p2.dragged) return void this.hooks.resized();
19124
+ if (Math.abs(e2.clientY - p2.y) > 10) return;
19125
+ if (isTall()) {
19126
+ const top = (innerHeight - TALL_TOP_PX - EDGE_PX) / innerHeight;
19127
+ this.share.tall = this.share.tall > (TALL_MID + top) / 2 ? TALL_MID : top;
19128
+ } else {
19129
+ const full = sheet.getBoundingClientRect().height > innerHeight * ((SHEET_MID + SHEET_TOP) / 2);
19130
+ this.share.phone = full ? SHEET_MID : SHEET_TOP;
19131
+ }
19132
+ this.sizeSheet();
19044
19133
  setTimeout(() => this.hooks.resized(), 240);
19134
+ };
19135
+ sheet.addEventListener("pointerdown", (e2) => {
19136
+ if (!sheeted() || e2.button !== 0 || press) return;
19137
+ if (e2.target.closest("button, a, input, textarea, select") || own2 && e2.target !== sheet) return;
19138
+ if (own2 && !isTall()) return;
19139
+ const r2 = sheet.getBoundingClientRect();
19140
+ if (e2.clientY - r2.top > grip) return;
19141
+ press = { id: e2.pointerId, y: e2.clientY, h: r2.height, dragged: false };
19142
+ if (isTall()) addEventListener("pointermove", move);
19143
+ addEventListener("pointerup", end);
19144
+ addEventListener("pointercancel", end);
19045
19145
  });
19046
- panel.addEventListener("pointercancel", () => press = null);
19047
19146
  }
19048
19147
  };
19049
19148
 
@@ -19097,7 +19196,7 @@ var TOUR = [
19097
19196
  {
19098
19197
  id: "checks",
19099
19198
  title: "Three ways to check",
19100
- text: "<b>Selection</b>: the statement alone, least effort. <b>Keys</b>: the few that carry the meaning. <b>TCB</b>: all it rests on, most effort, most confidence. The counts say what each costs.",
19199
+ text: "<b>Selection</b>: the statement alone, least effort. <b>Keys</b>: the few that carry the meaning. <b>TCB</b>: all it rests on, most effort, most confidence. The counts say what each costs, the trusted apart.",
19101
19200
  about: ["#lightup [data-mode=plain]", "#rests-steps [data-mode=keys]", "#rests-steps [data-mode=tcb]", "key:2"],
19102
19201
  showMe: "tcb-three",
19103
19202
  // tcb-first: the reader's own click selects, under Rests on · TCB, a theorem whose TCB lights
@@ -19507,7 +19606,7 @@ function tipsFor(ctx, tips = TIPS) {
19507
19606
  function plain(html) {
19508
19607
  return html.replace(/<[^>]*>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
19509
19608
  }
19510
- function matches(t2, filter) {
19609
+ function matches2(t2, filter) {
19511
19610
  const words = filter.toLowerCase().split(/\s+/).filter(Boolean);
19512
19611
  const text2 = `${t2.title} ${plain(t2.text)}`.toLowerCase();
19513
19612
  return words.every((w2) => text2.includes(w2));
@@ -19526,7 +19625,7 @@ function rowHtml(t2, ctx, open) {
19526
19625
  return `<div class="ref${open ? " open" : ""}" data-tip="${t2.id}"><button class="ref-head" data-ref-toggle="${t2.id}" aria-expanded="${open}"><span class="ref-title">${escapeHtml(t2.title)}${isNew ? ` <span class="tip-new">New</span>` : ""}</span><span class="ref-line">${escapeHtml(plain(t2.text))}</span></button>` + (open ? `<div class="ref-body"><div class="tip-text">${t2.text}</div>${clip}${actsHtml(t2.showMe, t2.manual, ctx, `data-tip-show="${t2.id}"`)}</div>` : "") + `</div>`;
19527
19626
  }
19528
19627
  function refsHtml(ctx, filter, open) {
19529
- const mine = tipsFor(ctx).filter((t2) => matches(t2, filter));
19628
+ const mine = tipsFor(ctx).filter((t2) => matches2(t2, filter));
19530
19629
  if (!mine.length) return `<div class="tips-none help-note">No tip says that. The <b>Keys</b> tab lists every key.</div>`;
19531
19630
  return GROUPS.map((g2) => {
19532
19631
  const of = mine.filter((t2) => t2.group === g2.id);
@@ -20122,6 +20221,40 @@ function besideSide(btn, el) {
20122
20221
  }
20123
20222
 
20124
20223
  // src/web/src/guide.ts
20224
+ function restsOnCounts(g2, d2, self2, lit) {
20225
+ let read2 = 0, assumed = 0, proofs = 0, keys = 0;
20226
+ for (let j2 = 0; j2 < g2.n; j2++) {
20227
+ if (j2 === self2) continue;
20228
+ if (!lit.tcb?.[j2]) {
20229
+ if (lit.uses?.[j2]) proofs++;
20230
+ continue;
20231
+ }
20232
+ if (!needsReview(g2, d2, j2)) assumed++;
20233
+ else read2++;
20234
+ if (lit.keys?.[j2]) keys++;
20235
+ }
20236
+ const at = self2 >= 0 && lit.tcb?.[self2] ? needsReview(g2, d2, self2) ? "read" : "trusted" : null;
20237
+ return { self: at, read: read2, assumed, proofs, keys };
20238
+ }
20239
+ function tcbText(r2) {
20240
+ const n3 = (x2) => x2.toLocaleString();
20241
+ const proofs = r2.proofs ? ` What its proofs alone use, ${n3(r2.proofs)} more, is not lit: the proofs are Lean's to check.` : "";
20242
+ if (!r2.read && !r2.assumed) return `Its <b>TCB</b> is itself alone: its statement rests on nothing but Lean.${proofs}`;
20243
+ const decls = (x2) => `${n3(x2)} declaration${x2 === 1 ? "" : "s"}`;
20244
+ const readThem = r2.read ? ` To trust it, read ${r2.read === 1 ? "that one" : `those ${n3(r2.read)}`}.` : "";
20245
+ if (r2.self === "read") {
20246
+ const one2 = r2.assumed === 1;
20247
+ const trusted3 = r2.assumed ? ` The ${one2 ? "one" : n3(r2.assumed)} trusted, as Mathlib is, light${one2 ? "s" : ""} too, and ${one2 ? "is" : "are"} assumed.` : "";
20248
+ if (!r2.read) return `Its <b>TCB</b> lights it alone to read: the ${one2 ? "one" : n3(r2.assumed)} it rests on ${one2 ? "is" : "are"} trusted, as Mathlib is, and assumed.${proofs}`;
20249
+ return `Its <b>TCB</b> lights ${n3(r2.read + 1)}: it, and ${decls(r2.read)} to read \u2014 definitions, axioms, the project's notation.${trusted3}${readThem}${proofs}`;
20250
+ }
20251
+ const trusted2 = r2.assumed + (r2.self === "trusted" ? 1 : 0);
20252
+ return `Its <b>TCB</b> lights ${r2.read ? `${decls(r2.read)} to read` : "nothing to read"}, and ${n3(trusted2)} trusted${r2.self === "trusted" ? ", it among them" : ""}, as Mathlib is, and assumed.${readThem}${proofs}`;
20253
+ }
20254
+ function keysText(r2) {
20255
+ const of = `Of the ${r2.read.toLocaleString()} declaration${r2.read === 1 ? "" : "s"} to read, `;
20256
+ return r2.keys === 1 ? `${of}the one the review marked <b>key</b>: what carries its meaning. Read it first.` : `${of}the ${r2.keys.toLocaleString()} the review marked <b>key</b>: the few that carry its meaning. Read them first.`;
20257
+ }
20125
20258
  var $2 = (sel) => document.querySelector(sel);
20126
20259
  function welcomeOf(o2) {
20127
20260
  if (o2.guided || o2.welcomed) return "none";
@@ -20151,10 +20284,12 @@ function around(...sels) {
20151
20284
  function board() {
20152
20285
  const side2 = $2("#side")?.getBoundingClientRect();
20153
20286
  const panel = $2("#panel.open")?.getBoundingClientRect();
20154
- const left = side2 && side2.width && !isPhone() ? side2.right + 8 : 12;
20155
- const right = panel && panel.width && !isPhone() ? panel.left - 8 : innerWidth - 12;
20156
- const top = isPhone() ? 104 : 108;
20157
- const bottom = isPhone() && panel && panel.height ? panel.top - 8 : innerHeight - 48;
20287
+ const sheet = sheeted();
20288
+ const bar = isTall() ? $2("#selbar:not([hidden])")?.getBoundingClientRect() : void 0;
20289
+ const left = side2 && side2.width && !sheet ? side2.right + 8 : 12;
20290
+ const right = panel && panel.width && !sheet ? panel.left - 8 : innerWidth - 12;
20291
+ const top = isPhone() ? 104 : bar?.height ? bar.bottom + 8 : 108;
20292
+ const bottom = sheet && panel && panel.height ? panel.top - 8 : innerHeight - 48;
20158
20293
  return new DOMRect(left, top, Math.max(40, right - left), Math.max(40, bottom - top));
20159
20294
  }
20160
20295
  var TOUCH = [
@@ -20613,7 +20748,7 @@ var Guide = class {
20613
20748
  const ring = (step2) => () => (phone ? around("#panel") : around(step2)) ?? board();
20614
20749
  const lit = (step2) => () => {
20615
20750
  const b2 = board();
20616
- const m3 = phone ? null : around(step2);
20751
+ const m3 = phone ? null : around(step2, "#selbar .sb-n");
20617
20752
  if (!m3) return b2;
20618
20753
  const l2 = Math.min(b2.left, m3.left), t2 = Math.min(b2.top, m3.top);
20619
20754
  return new DOMRect(l2, t2, Math.max(b2.right, m3.right) - l2, Math.max(b2.bottom, m3.bottom) - t2);
@@ -20635,15 +20770,8 @@ var Guide = class {
20635
20770
  this.hooks.setTool("tcb");
20636
20771
  this.hooks.frameLit();
20637
20772
  },
20638
- // the numbers add up to the selection bar's: the theorem, what is to be read, what is assumed
20639
- text: () => {
20640
- const lit2 = r2.read + r2.assumed;
20641
- const assumed = r2.assumed ? `${r2.assumed} trusted, as Mathlib is, and assumed` : "";
20642
- const proofs = r2.proofs ? ` What its proofs alone use, ${r2.proofs} more, is not lit: the proofs are Lean's to check.` : "";
20643
- if (!lit2) return `Its <b>TCB</b> is itself alone: its statement rests on nothing but Lean.${proofs}`;
20644
- if (!r2.read) return `Its <b>TCB</b> lights ${lit2} besides it, all ${r2.assumed === 1 ? "of it " : ""}trusted, as Mathlib is, and assumed: nothing of the project's to read.${proofs}`;
20645
- return `Its <b>TCB</b> lights ${lit2} besides it: ${r2.read} to read \u2014 definitions, axioms, the project's notation \u2014${assumed ? ` and ${assumed}` : ""}. To trust it, read ${r2.read === 1 ? "that one" : `those ${r2.read}`}.${proofs}`;
20646
- },
20773
+ // the numbers are the selection bar's: the theorem and what is to be read, what is trusted
20774
+ text: () => tcbText(r2),
20647
20775
  at: lit("#rests-steps [data-mode=tcb]")
20648
20776
  },
20649
20777
  {
@@ -20653,7 +20781,7 @@ var Guide = class {
20653
20781
  this.hooks.setTool(r2.keys ? "keys" : "tcb");
20654
20782
  this.hooks.frameLit();
20655
20783
  },
20656
- text: () => r2.keys ? r2.keys === 1 ? `Of those ${r2.read + r2.assumed}, the one the review marked <b>key</b>: what carries its meaning. Read it first.` : `Of those ${r2.read + r2.assumed}, the ${r2.keys} the review marked <b>key</b>: the few that carry its meaning. Read them first.` : ro || this.hooks.snapshot() ? "None is marked <b>key</b> yet: the review marks the few of a target's TCB that carry its meaning." : phone ? "None is marked <b>key</b> yet. On a target's view, its panel's \u25C7 Mark as key marks the few that carry its meaning." : "None is marked <b>key</b> yet. On a view focused on a target, <kbd>k</kbd> marks the few of its TCB that carry its meaning.",
20784
+ text: () => r2.keys ? keysText(r2) : ro || this.hooks.snapshot() ? "None is marked <b>key</b> yet: the review marks the few of a target's TCB that carry its meaning." : phone ? "None is marked <b>key</b> yet. On a target's view, its panel's \u25C7 Mark as key marks the few that carry its meaning." : "None is marked <b>key</b> yet. On a view focused on a target, <kbd>k</kbd> marks the few of its TCB that carry its meaning.",
20657
20785
  at: () => r2.keys ? lit("#rests-steps [data-mode=keys]")() : ring("#rests-steps [data-mode=keys]")()
20658
20786
  }
20659
20787
  ];
@@ -21580,7 +21708,7 @@ var SelectionBar = class {
21580
21708
  return !this.el.hidden;
21581
21709
  }
21582
21710
  /** The picks, the one the panel tells of (its index, or -1), how many declarations are lit on the
21583
- * board, and whether Zoom in has a view to open that is not this one: one holding something,
21711
+ * board, the trusted apart, and whether Zoom in has a view to open that is not this one: one holding something,
21584
21712
  * and not just what this board holds (shared/board.ts, zoomScope). */
21585
21713
  render(picks, panel, lit, zoom, key = null) {
21586
21714
  this.el.hidden = !picks.length;
@@ -21589,12 +21717,12 @@ var SelectionBar = class {
21589
21717
  return;
21590
21718
  }
21591
21719
  const esc2 = escapeHtml;
21592
- const why = lit ? "This board holds just what is lit already" : "Nothing selected is on this board";
21720
+ const why = lit.counted + lit.trusted ? "This board holds just what is lit already" : "Nothing selected is on this board";
21593
21721
  const chips = picks.map((p2, k2) => {
21594
21722
  const words = pickWords(p2);
21595
21723
  return `<span class="sb-chip t-${p2.tool}${k2 === panel ? " on" : ""}" title="${esc2(printQuery(p2.q))}"><button class="sb-go" data-show="${k2}"${p2.root ? ` title="Show ${esc2(words)}"` : " disabled"}>${esc2(words)}</button><button class="sb-x" data-rm="${k2}" title="Take it out" aria-label="Take ${esc2(words)} out">\xD7</button></span>`;
21596
21724
  }).join("");
21597
- this.el.innerHTML = `<span class="sb-chips">${chips}</span><span class="sb-meta"><span class="sb-n" title="Declarations lit on this board">${lit.toLocaleString()} lit</span>` + (this.hooks.canOpenViews() ? `<button class="sb-btn" data-zoom${zoom ? ` title="Open a view of what is selected, laid out on its own, in a tab"` : ` disabled title="${why}"`}>Zoom in</button>` : "") + (key ? `<button class="sb-btn sb-key" data-mark-keys${key.fresh ? ` title="${esc2(`Mark the ${key.fresh} declaration${key.fresh === 1 ? "" : "s"} you clicked as key for ${key.target}`)}"` : ` disabled title="${esc2(key.already ? `What you clicked is key for ${key.target} already` : `Nothing you clicked is in ${key.target}'s review besides the target`)}"`}>\u25C6 Mark selected as key${key.fresh > 1 ? ` (${key.fresh})` : ""}</button>` : "") + `<button class="sb-btn" data-clear title="Select nothing (Esc)">Clear</button></span>`;
21725
+ this.el.innerHTML = `<span class="sb-chips">${chips}</span><span class="sb-meta"><span class="sb-n"><span title="Declarations lit on this board that are not trusted">${lit.counted.toLocaleString()} lit</span>` + (lit.trusted ? `<span class="sb-trusted" title="Trusted declarations lit too: assumed without review, and not counted \u2014 what a trusted prefix covers, and the standard axioms"> \xB7 +${lit.trusted.toLocaleString()} trusted</span>` : "") + `</span>` + (this.hooks.canOpenViews() ? `<button class="sb-btn" data-zoom${zoom ? ` title="Open a view of what is selected, laid out on its own, in a tab"` : ` disabled title="${why}"`}>Zoom in</button>` : "") + (key ? `<button class="sb-btn sb-key" data-mark-keys${key.fresh ? ` title="${esc2(`Mark the ${key.fresh} declaration${key.fresh === 1 ? "" : "s"} you clicked as key for ${key.target}`)}"` : ` disabled title="${esc2(key.already ? `What you clicked is key for ${key.target} already` : `Nothing you clicked is in ${key.target}'s review besides the target`)}"`}>\u25C6 Mark selected as key${key.fresh > 1 ? ` (${key.fresh})` : ""}</button>` : "") + `<button class="sb-btn" data-clear title="Select nothing (Esc)">Clear</button></span>`;
21598
21726
  }
21599
21727
  };
21600
21728
 
@@ -21882,6 +22010,7 @@ var FloatWindow = class {
21882
22010
  * touch alike, the pointer captured until it is let go. */
21883
22011
  press(e2) {
21884
22012
  if (!this.o.live() || this.collapsed || this.dragging || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
22013
+ if (sheeted()) return;
21885
22014
  const t2 = e2.target;
21886
22015
  const edge = t2.closest("[data-rz]");
21887
22016
  const bar = t2.closest(this.o.handle);
@@ -23198,7 +23327,7 @@ function offsetIn(root, node, off) {
23198
23327
  }
23199
23328
 
23200
23329
  // src/web/src/reload.ts
23201
- var PAGE_VERSION = true ? "0.4.1" : null;
23330
+ var PAGE_VERSION = true ? "0.4.3" : null;
23202
23331
  var KEY4 = "visualproof:reload";
23203
23332
  var FOR_KEY2 = "visualproof:reloaded-for";
23204
23333
  var FRESH_MS = 10 * 6e4;
@@ -44365,7 +44494,7 @@ function lineOf(p2, k2) {
44365
44494
  const next = p2.lines.find((s2) => s2 > k2);
44366
44495
  return [first, (next ?? p2.words.length) - 1];
44367
44496
  }
44368
- var TALL = 3;
44497
+ var TALL2 = 3;
44369
44498
  var usualHeights = /* @__PURE__ */ new WeakMap();
44370
44499
  function usualHeight(words) {
44371
44500
  let h2 = usualHeights.get(words);
@@ -44377,7 +44506,7 @@ function usualHeight(words) {
44377
44506
  return h2;
44378
44507
  }
44379
44508
  function nearestWord(p2, x2, y2, aspect) {
44380
- const tall = TALL * usualHeight(p2.words);
44509
+ const tall = TALL2 * usualHeight(p2.words);
44381
44510
  let best = -1;
44382
44511
  let bestRank = 3;
44383
44512
  let bestD = Infinity;
@@ -47574,7 +47703,7 @@ var NOTE_LINES = 14;
47574
47703
  var DOT = 4;
47575
47704
  var EASE_MS = 480;
47576
47705
  var SLIDE_MS = 70;
47577
- var EDGE_PX = 48;
47706
+ var EDGE_PX2 = 48;
47578
47707
  var EDGE_SPEED = 0.9;
47579
47708
  var ARCS_MOST = 6e3;
47580
47709
  var FOLD_MORE = 10;
@@ -47587,7 +47716,8 @@ var LinearForm = class {
47587
47716
  ctx;
47588
47717
  canvas;
47589
47718
  hooks;
47590
- /** why it is shown: the Export window is open, the reader asked for it */
47719
+ /** why it is shown: the Export window is open, the reader asked for it, or the reader they follow
47720
+ * shows it (kept once following ends: CollabSpec decision 4) */
47591
47721
  why = /* @__PURE__ */ new Set();
47592
47722
  outline = null;
47593
47723
  rows = [];
@@ -47636,11 +47766,16 @@ var LinearForm = class {
47636
47766
  get shown() {
47637
47767
  return this.why.size > 0;
47638
47768
  }
47639
- /** Whether the reader asked for it (⋯, the key), as followers take it. */
47769
+ /** Whether the reader asked for it (⋯, the key), or has it from a reader they follow or followed:
47770
+ * ⋯ and the key put it away. */
47640
47771
  get asked() {
47641
- return this.why.has("reader");
47772
+ return this.why.has("reader") || this.why.has("followed");
47642
47773
  }
47643
- /** Show it, for the Export window or at the reader's asking. */
47774
+ /** Whether it shows as a followed reader's does, or did when following ended. */
47775
+ get followed() {
47776
+ return this.why.has("followed");
47777
+ }
47778
+ /** Show it, for the Export window, at the reader's asking, or as a followed reader's. */
47644
47779
  async show(why) {
47645
47780
  const was = this.shown;
47646
47781
  this.why.add(why);
@@ -47660,9 +47795,11 @@ var LinearForm = class {
47660
47795
  this.ease(1);
47661
47796
  this.hooks.changed(true);
47662
47797
  }
47663
- /** Put it away, for `why`; the board comes back once nothing asks for it. */
47664
- hide(why) {
47665
- if (!this.why.delete(why) || this.shown) return;
47798
+ /** Put it away, for each of `whys`; the board comes back once nothing asks for it. */
47799
+ hide(...whys) {
47800
+ const was = this.shown;
47801
+ for (const w2 of whys) this.why.delete(w2);
47802
+ if (!was || this.shown) return;
47666
47803
  this.turn++;
47667
47804
  this.press = null;
47668
47805
  this.drag = null;
@@ -47672,7 +47809,7 @@ var LinearForm = class {
47672
47809
  this.hooks.changed(false);
47673
47810
  }
47674
47811
  toggle() {
47675
- if (this.asked) this.hide("reader");
47812
+ if (this.asked) this.hide("reader", "followed");
47676
47813
  else void this.show("reader");
47677
47814
  }
47678
47815
  /** The board changed (a pin, a note, another build, another board): the outline is asked for
@@ -47885,7 +48022,7 @@ var LinearForm = class {
47885
48022
  if (d2) {
47886
48023
  const v2 = this.view();
47887
48024
  const room2 = (v2.h - v2.top) / this.cam.k;
47888
- const edge = d2.py < v2.top + EDGE_PX && this.cam.y > 0 ? -1 : d2.py > v2.h - EDGE_PX && this.cam.y + room2 < this.height ? 1 : 0;
48025
+ const edge = d2.py < v2.top + EDGE_PX2 && this.cam.y > 0 ? -1 : d2.py > v2.h - EDGE_PX2 && this.cam.y + room2 < this.height ? 1 : 0;
47889
48026
  if (edge) {
47890
48027
  this.cam.y += edge * EDGE_SPEED * dt2 / this.cam.k;
47891
48028
  this.clampCam();
@@ -50990,7 +51127,7 @@ var KEEP_GRAPHS = 5;
50990
51127
  var KEEP_LAYOUTS = 16;
50991
51128
  var BUSY_AFTER_MS = 150;
50992
51129
  var DWELL_MS = 90;
50993
- var EDGE_PX2 = 12;
51130
+ var EDGE_PX3 = 12;
50994
51131
  var EDGE_MS = 60;
50995
51132
  var SPIN_MS = 900;
50996
51133
  var spinPhase = () => `animation-delay:-${Math.round(performance.now() % SPIN_MS)}ms`;
@@ -51818,8 +51955,8 @@ var TimeMachine = class {
51818
51955
  const edge = () => {
51819
51956
  const p2 = place2(lastX);
51820
51957
  if (!p2 || dragging === null || !this.ruler) return 0;
51821
- if (p2.x < EDGE_PX2 && this.scroll > 0) return -1;
51822
- if (p2.x > p2.w - EDGE_PX2 && this.scroll < maxScroll(this.ruler)) return 1;
51958
+ if (p2.x < EDGE_PX3 && this.scroll > 0) return -1;
51959
+ if (p2.x > p2.w - EDGE_PX3 && this.scroll < maxScroll(this.ruler)) return 1;
51823
51960
  return 0;
51824
51961
  };
51825
51962
  const roll = () => {
@@ -52621,9 +52758,9 @@ async function boot() {
52621
52758
  else delete document.body.dataset.artBg;
52622
52759
  if (a3 && a3.style !== "board") document.body.dataset.artStyle = a3.style;
52623
52760
  else delete document.body.dataset.artStyle;
52624
- for (const el of document.querySelectorAll(ART_INERT)) el.inert = !!a3;
52761
+ artReach();
52625
52762
  if (a3) {
52626
- linear.hide("reader");
52763
+ linear.hide("reader", "followed");
52627
52764
  document.documentElement.dataset.theme = a3.style === "board" ? a3.theme : "dark";
52628
52765
  } else applyTheme();
52629
52766
  canvas.setArt(a3 && { labels: a3.labels, namesFrom: a3.namesFrom, hidden: new Set(a3.hiddenNames), shown: new Set(a3.shownNames), ruled: new Set(a3.ruledNames), edges: a3.edges, targets: a3.targets, shownTargets: new Set(a3.shownTargets), keys: a3.keys, style: a3.style });
@@ -52631,6 +52768,9 @@ async function boot() {
52631
52768
  syncEdges();
52632
52769
  apply();
52633
52770
  };
52771
+ const artReach = () => {
52772
+ for (const el of document.querySelectorAll(ART_INERT)) el.inert = !!artLook && !(people.following && el.matches(".peers-wrap"));
52773
+ };
52634
52774
  let drawnAt = 0;
52635
52775
  canvas.onFrame = () => {
52636
52776
  drawnAt = performance.now();
@@ -52771,7 +52911,10 @@ async function boot() {
52771
52911
  right: 0,
52772
52912
  top: bar2.hidden ? $4("#viewbar").getBoundingClientRect().bottom + (strip ? 44 : 12) : bar2.getBoundingClientRect().bottom + 12,
52773
52913
  bottom: sheet ? sheet + 8 : 56
52774
- } : {
52914
+ } : isTall() ? (
52915
+ // a tall screen (PhoneSpec, "Tall screens"): the whole width, above the sheet and the dock
52916
+ tallInsets()
52917
+ ) : {
52775
52918
  left: side2.width ? side2.right + 8 : 0,
52776
52919
  // offsetWidth, not the bounding box: the panel may still be sliding in
52777
52920
  right: open ? $4("#panel").offsetWidth + 20 : bar2.hidden ? 0 : bar2.offsetWidth + 20,
@@ -52880,7 +53023,7 @@ async function boot() {
52880
53023
  if (ownScheme() !== v2.scheme) chooseScheme(v2.scheme);
52881
53024
  },
52882
53025
  edges: (v2) => setEdges(v2.edges),
52883
- linear: (v2) => v2.linear ? void linear.show("reader") : linear.hide("reader"),
53026
+ linear: (v2) => v2.linear ? void linear.show("followed") : linear.hide("reader", "followed"),
52884
53027
  artwork: (v2) => art.follow(v2.artwork ?? null)
52885
53028
  }
52886
53029
  };
@@ -52933,16 +53076,23 @@ async function boot() {
52933
53076
  reveal: () => chatWin.reveal(),
52934
53077
  stripDrawn: () => talk.dress(),
52935
53078
  describe: (v2) => describePlace(v2),
52936
- follow: (v2) => void goWhere(v2, false),
53079
+ follow: (v2) => {
53080
+ artReach();
53081
+ void goWhere(v2, false);
53082
+ },
52937
53083
  changed: () => {
52938
53084
  syncPeers();
52939
53085
  peerMenu.render();
52940
53086
  },
52941
53087
  // the windows that stood for the followed reader's are this reader's own now, and none says any
52942
- // more that the reader follows someone
53088
+ // more that the reader follows someone; what following left is theirs to leave (CollabSpec, "What
53089
+ // following leaves"): the artwork mode's bar, all but Share and Search out of reach again; the
53090
+ // linear form, which nothing on the screen says how to put away — the line does, once
52943
53091
  unfollowed: () => {
52944
53092
  sources.release();
52945
53093
  papers.unfollowed();
53094
+ artReach();
53095
+ if (!people.following && linear.followed && !exportModal.isOpen) say(`The board stays in the linear form you followed: ${isPhone() ? "\u22EF at the bottom \u2192 Linear form puts" : "o, or \u22EF at the bottom \u2192 Linear form, puts"} it away.`);
52946
53096
  },
52947
53097
  // what is left to review where the review has a focus is the reader's own
52948
53098
  renamed: () => {
@@ -53007,12 +53157,15 @@ async function boot() {
53007
53157
  else if (!(id && await nav.select(id, to)) && scope2) await nav.open(scope2, to);
53008
53158
  const reached = nav.board.id === id || scope2 !== null && nav.query() === scope2;
53009
53159
  if (once && !reached) place2(to, false);
53010
- if (v2.history) {
53011
- if (!tm.active) await tm.open({ snapshot: v2.history.snapshot });
53012
- else if (tm.snapshot !== v2.history.snapshot) await tm.show(v2.history.snapshot);
53013
- } else if (tm.active) await tm.close();
53160
+ const ended = () => !once && !people.following;
53161
+ if (!ended()) {
53162
+ if (v2.history) {
53163
+ if (!tm.active) await tm.open({ snapshot: v2.history.snapshot });
53164
+ else if (tm.snapshot !== v2.history.snapshot) await tm.show(v2.history.snapshot);
53165
+ } else if (tm.active) await tm.close();
53166
+ }
53014
53167
  writeAddress(false);
53015
- if (!once && !people.following) return reached;
53168
+ if (ended()) return reached;
53016
53169
  applyOwn(v2, parts.apply);
53017
53170
  if (!once) papers.mirror(v2.paper);
53018
53171
  if (!pastShown())
@@ -53270,7 +53423,10 @@ async function boot() {
53270
53423
  },
53271
53424
  start: (body) => data.exportDoc(body),
53272
53425
  poll: (id) => data.exportJob(id),
53273
- shown: (open) => open ? void linear.show("export") : linear.hide("export"),
53426
+ // the window closing, following nobody, takes with it the form following left, which nobody here
53427
+ // asked for: the followed reader's own Export window drew it, as often as not (CollabSpec, "What
53428
+ // following leaves")
53429
+ shown: (open) => open ? void linear.show("export") : people.following ? linear.hide("export") : linear.hide("export", "followed"),
53274
53430
  artwork: () => art.open(),
53275
53431
  artworkOnly: () => !!data.snapshot
53276
53432
  });
@@ -53428,7 +53584,8 @@ async function boot() {
53428
53584
  review = { ...review, rev: c3.rev, problems: c3.problems, error: problemsText(c3.problems) };
53429
53585
  reviewChanged();
53430
53586
  };
53431
- const renderSelBar = (q2 = selectionQuery(picks), lit = q2 && litOn(q2)) => selBar.render(picks, picks.findIndex((p2) => !!shown && sameShown(shownOf(p2), shown)), lit?.count ?? 0, zoomOf(q2, lit) !== null, keyMarking());
53587
+ const litCount = (lit) => lit ? trustSplit(vg(), boardReview(), lit.set) : { counted: 0, trusted: 0 };
53588
+ const renderSelBar = (q2 = selectionQuery(picks), lit = q2 && litOn(q2)) => selBar.render(picks, picks.findIndex((p2) => !!shown && sameShown(shownOf(p2), shown)), litCount(lit), zoomOf(q2, lit) !== null, keyMarking());
53432
53589
  const apply = () => {
53433
53590
  const G2 = vg();
53434
53591
  syncFocus();
@@ -55070,20 +55227,8 @@ ${n3.note.text.slice(0, 200)}`)) return;
55070
55227
  const q2 = selectionQuery([declPick(tool, name, keysFor({ decl: name }))]);
55071
55228
  return q2 ? litOn(q2).set : null;
55072
55229
  };
55073
- const tcb = lit("tcb"), uses = lit("deps"), keys = lit("keys");
55074
- const self2 = toView(i2);
55075
- let read2 = 0, assumed = 0, proofs = 0, k2 = 0;
55076
- for (let j2 = 0; j2 < G2.n; j2++) {
55077
- if (j2 === self2) continue;
55078
- if (keys?.[j2]) k2++;
55079
- if (!tcb?.[j2]) {
55080
- if (uses?.[j2]) proofs++;
55081
- continue;
55082
- }
55083
- if (trusted(d2, G2.nodes[j2].name, G2.nodes[j2].module, G2.isExt(j2))) assumed++;
55084
- else read2++;
55085
- }
55086
- return { name: g2.nodes[i2].display ?? name.split(".").pop(), read: read2, assumed, proofs, keys: k2, target: isTarget(name) };
55230
+ const counts2 = restsOnCounts(G2, d2, toView(i2), { tcb: lit("tcb"), uses: lit("deps"), keys: lit("keys") });
55231
+ return { name: g2.nodes[i2].display ?? name.split(".").pop(), ...counts2, target: isTarget(name) };
55087
55232
  };
55088
55233
  const showMe = (action) => {
55089
55234
  const i2 = tourExample();
@@ -1019,7 +1019,9 @@ button.o-trust:hover { color: var(--accent); background: var(--code-bg); }
1019
1019
  box-shadow: 0 0 0 1px var(--line), var(--shadow-lg);
1020
1020
  }
1021
1021
  #peer-menu[hidden] { display: none; }
1022
- #bar:has(#peer-menu:not([hidden])) { z-index: 36; }
1022
+ /* over the Export window and the artwork's panel too: following someone, or no longer, is the
1023
+ reader's own way out wherever they are (CollabSpec, "What following leaves") */
1024
+ #bar:has(#peer-menu:not([hidden])) { z-index: 42; }
1023
1025
  .pm-who { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 6px 10px 4px; }
1024
1026
  .pm-dot { width: 9px; height: 9px; border-radius: 50%; }
1025
1027
  .pm-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -2649,7 +2651,6 @@ span.tm-row { color: var(--text-2); cursor: default; }
2649
2651
  width: auto !important; max-width: none !important; max-height: calc(100dvh - 70px); overflow: auto;
2650
2652
  }
2651
2653
  #viewbar { top: 58px; left: 8px; right: 8px; gap: 6px; }
2652
- .side-btn { display: inline-flex; flex: none; width: 36px; justify-content: center; padding: 0; }
2653
2654
  #tabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
2654
2655
  #tabs::-webkit-scrollbar { display: none; }
2655
2656
  .vb-gap, .light-l { display: none; }
@@ -2688,20 +2689,6 @@ span.tm-row { color: var(--text-2); cursor: default; }
2688
2689
  }
2689
2690
  #panel.open { transform: none; }
2690
2691
  #panel::before { content: ""; position: sticky; top: -18px; display: block; width: 40px; height: 5px; margin: -18px auto 13px; border-radius: 3px; background: var(--text-3); opacity: 0.6; }
2691
- /* the side panel: a drawer from the left, over a shade */
2692
- body.side-open #side { display: flex; position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); border-radius: 0 16px 16px 0; z-index: 47; padding-top: env(safe-area-inset-top); background: var(--surface-solid); }
2693
- body.side-open::after { content: ""; position: fixed; inset: 0; z-index: 46; background: rgba(0, 0, 0, 0.3); }
2694
- /* ⚙ Board and Trusted: in the drawer's place, over it, with a way back */
2695
- body.side-open .side-pop {
2696
- left: 0 !important; top: 0 !important; bottom: 0 !important; right: auto !important; width: min(320px, 86vw) !important;
2697
- height: auto !important; max-height: none !important; border-radius: 0 16px 16px 0; z-index: 48;
2698
- background: var(--surface-solid); padding-top: calc(8px + env(safe-area-inset-top));
2699
- }
2700
- body.side-open .side-back {
2701
- display: flex; align-items: center; gap: 4px; min-height: 40px; margin: 0 0 6px -6px; padding: 0 6px; border: 0;
2702
- background: none; color: var(--accent); font: 600 15px var(--font);
2703
- }
2704
- .side-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
2705
2692
  /* a field under 16 px makes iOS zoom the whole page into it */
2706
2693
  #panel textarea, #panel input, #share-pop input, #share-pop select, #who-menu input, #modal input, .sh-field input, .sh-field select { font-size: 16px; }
2707
2694
  /* nothing slides sideways: the page is the screen */
@@ -2741,3 +2728,109 @@ span.tm-row { color: var(--text-2); cursor: default; }
2741
2728
  }
2742
2729
  .act-head .icon { width: 40px; height: 40px; font-size: 20px; }
2743
2730
  }
2731
+
2732
+ /* ---------------------------------------------------------------- a phone or a tall screen
2733
+
2734
+ What the two shapes whose panel is a sheet share (web/src/phone.ts, SHEETED): the side panel is a
2735
+ drawer from ☰, at the left of the view bar, and ⚙ Board and Trusted take its place. */
2736
+ @media (max-width: 640px), (max-aspect-ratio: 5/6) {
2737
+ .side-btn { display: inline-flex; flex: none; width: 36px; justify-content: center; padding: 0; }
2738
+ /* the side panel: a drawer from the left, over a shade */
2739
+ body.side-open #side { display: flex; position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); border-radius: 0 16px 16px 0; z-index: 47; padding-top: env(safe-area-inset-top); background: var(--surface-solid); }
2740
+ body.side-open::after { content: ""; position: fixed; inset: 0; z-index: 46; background: rgba(0, 0, 0, 0.3); }
2741
+ /* ⚙ Board and Trusted: in the drawer's place, over it, with a way back */
2742
+ body.side-open .side-pop {
2743
+ left: 0 !important; top: 0 !important; bottom: 0 !important; right: auto !important; width: min(320px, 86vw) !important;
2744
+ height: auto !important; max-height: none !important; border-radius: 0 16px 16px 0; z-index: 48;
2745
+ background: var(--surface-solid); padding-top: calc(8px + env(safe-area-inset-top));
2746
+ }
2747
+ body.side-open .side-back {
2748
+ display: flex; align-items: center; gap: 4px; min-height: 40px; margin: 0 0 6px -6px; padding: 0 6px; border: 0;
2749
+ background: none; color: var(--accent); font: 600 15px var(--font);
2750
+ }
2751
+ .side-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
2752
+ }
2753
+
2754
+ /* ---------------------------------------------------------------- a tall screen (PhoneSpec, "Tall screens")
2755
+
2756
+ Wider than a phone and upright: a tablet held upright, a narrow window, a monitor on its side. A
2757
+ larger screen's page, placed for the shape: the side panel is the drawer (above), the panel a sheet
2758
+ from the bottom across the screen, and what takes the panel's place on a larger screen —
2759
+ Activity, the lost-and-found, Export's window — takes the sheet's; the floating windows dock there
2760
+ too. The review strip, then the selection bar, go across under the view bar; the legend and the
2761
+ zoom's box keep to the board's room, above the sheet (--room-bottom: web/src/phone.ts). */
2762
+ @media (min-width: 641px) and (max-aspect-ratio: 5/6) {
2763
+ /* the tallest the sheet and the dock go: under the view bar, the review strip and the selection
2764
+ bar (--strip-h, --selbar-h: main.ts) */
2765
+ body { --sheet-most: calc(100dvh - 120px - var(--strip-h, 0px) - var(--selbar-h, 0px)); }
2766
+ #side { display: none; }
2767
+ body.side-open #side, body.side-open .side-pop { width: min(360px, 60vw) !important; }
2768
+ /* the sheet: the panel, or Activity or the lost-and-found in its place, at the height the reader
2769
+ gives it (a drag on its handle, or a tap: half the screen or the tallest, under the view bar) */
2770
+ #panel, #activity, #lostfound {
2771
+ top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; height: var(--sheet-h, 50dvh); max-height: var(--sheet-most);
2772
+ padding-top: 30px; overflow-x: hidden; overscroll-behavior: contain;
2773
+ transform: translateY(calc(100% + 60px)); transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1), height 0.2s;
2774
+ }
2775
+ #activity, #lostfound { z-index: 7; }
2776
+ #panel.open, #activity.open, #lostfound.open { transform: none; }
2777
+ #panel.sizing, #activity.sizing, #lostfound.sizing { transition: none; user-select: none; -webkit-user-select: none; }
2778
+ #panel::before, #activity::before, #lostfound::before {
2779
+ content: ""; position: sticky; top: -22px; z-index: 3; display: block; width: 44px; height: 5px; margin: -22px auto 17px;
2780
+ border-radius: 3px; background: var(--text-3); opacity: 0.6; cursor: ns-resize; touch-action: none;
2781
+ }
2782
+ /* the floating windows: docked in the sheet's place, over it, side by side where there is room
2783
+ and one over the other where there is not; a collapsed one its pill, at the dock's foot. The
2784
+ dock places them: no edge resizes them, no drag moves them (web/src/floatwin.ts) */
2785
+ #windows {
2786
+ top: auto; left: 12px; right: 12px; bottom: 12px; height: var(--sheet-h, 50dvh); max-height: var(--sheet-most);
2787
+ display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
2788
+ }
2789
+ /* its handle, over the windows while one is open there, sets the dock's height as the sheet's does
2790
+ (the same height: web/src/phone.ts) */
2791
+ #windows:has(> :is(.sw-win, .pw-win, #following.talking):not(.collapsed, [hidden])) { padding-top: 14px; }
2792
+ #windows:has(> :is(.sw-win, .pw-win, #following.talking):not(.collapsed, [hidden]))::before {
2793
+ content: ""; position: absolute; top: 0; left: 50%; width: 120px; height: 14px; transform: translateX(-50%);
2794
+ pointer-events: auto; cursor: ns-resize; touch-action: none;
2795
+ background: linear-gradient(var(--text-3), var(--text-3)) center 4px / 44px 5px no-repeat; opacity: 0.6; border-radius: 3px;
2796
+ }
2797
+ /* the declaration's source first, then the reference beside it, then a conversation */
2798
+ #windows > .sw-win { order: 1; }
2799
+ #windows > .pw-win { order: 2; }
2800
+ #windows > #following { order: 3; }
2801
+ #windows > .sw-win, #windows > .pw-win, #windows > #following.talking {
2802
+ position: relative !important; inset: auto !important; transform: none;
2803
+ width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important;
2804
+ flex: 1 1 0; z-index: auto !important;
2805
+ }
2806
+ #windows > .collapsed { flex: none; align-self: flex-start; max-width: min(360px, 100%) !important; }
2807
+ #windows .fl-rz { display: none !important; }
2808
+ @media (min-width: 960px) { #windows { flex-direction: row; align-items: stretch; } #windows > .collapsed { align-self: flex-end; } }
2809
+ #windows .sw-head, #windows .pw-head, #windows > #following.talking > .fl-strip { cursor: default; }
2810
+ /* Export's window: in the sheet's place too, the outline it arranges above it */
2811
+ #export-modal { top: auto; left: 12px; right: 12px; bottom: 12px; }
2812
+ #export-modal .ex-box { width: auto; max-height: var(--sheet-h, 50dvh); }
2813
+ /* under the view bar, across the screen: the review strip, then the selection bar (--strip-h:
2814
+ main.ts) */
2815
+ #lensbar, #tm-kept { top: 108px; left: 12px; right: 12px; transform: none; max-width: none; }
2816
+ #selbar { top: calc(108px + var(--strip-h, 0px)); left: 12px; right: 12px; width: auto; }
2817
+ /* the legend and the zoom's box at the foot of the board's room, above the sheet or the dock */
2818
+ #foot { left: 12px; bottom: var(--room-bottom, 12px); visibility: var(--room-shown, visible); transition: bottom 0.32s cubic-bezier(0.2, 0.9, 0.25, 1); }
2819
+ #zoom { right: 12px; bottom: var(--room-bottom, 12px); visibility: var(--room-shown, visible); transition: bottom 0.32s cubic-bezier(0.2, 0.9, 0.25, 1); }
2820
+ #following:not(.talking), #whatsnew { bottom: calc(var(--room-bottom, 12px) + 40px); }
2821
+ #welcome { left: 12px; bottom: calc(var(--room-bottom, 12px) + 40px); }
2822
+ /* the bar's popovers: at its right, under it, never past the screen's edge */
2823
+ .share-wrap, .library-wrap { position: static; }
2824
+ #share-pop, #library-pop { top: calc(100% + 6px); right: 0; }
2825
+ /* the help: as wide as the screen allows, the film over its chapters */
2826
+ .help-box, .help-box:has([data-help-pane="tips"]:not([hidden])) { width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }
2827
+ }
2828
+ /* a tall screen narrower than the bar's words: Share, the library and Export by their icons; the
2829
+ focus gives way to the Time Machine, as on a phone */
2830
+ @media (min-width: 641px) and (max-width: 1000px) and (max-aspect-ratio: 5/6) {
2831
+ body.tm .focus-wrap { display: none; }
2832
+ }
2833
+ @media (min-width: 641px) and (max-width: 900px) and (max-aspect-ratio: 5/6) {
2834
+ #share-btn > span, #library-btn > span, #export-btn > span { display: none; }
2835
+ #bar { gap: 10px; }
2836
+ }
@@ -39,9 +39,10 @@ Everything about one declaration; here `include=print` while Lean loads:
39
39
  a personal link, `by` their name now; `recordedBy`: typed for `by` by that person, at one screen
40
40
  (theirs all the same); `trustedBy`: covering prefixes, or `["standard axiom"]`.
41
41
  - `editedSinceCompiled`: file differs from what was compiled (null outside the project); `keyFor`,
42
- `inTcbOf`: targets it is key for, whose TCB holds it; `usesDirect`, `usedBy.direct`: what it
43
- refers to by name, what refers to it (`uses`, `users` list them); `usedBy.all`: all reaching it,
44
- proofs included.
42
+ `inTcbOf`: targets it is key for, whose TCB holds it; `tcbSize`: its TCB besides it, by where,
43
+ trusted included (a TCB's size leaves them out: `tcb`'s `needReview`, `trustedNotCounted`);
44
+ `usesDirect`, `usedBy.direct`: what it refers to by name, what refers to it (`uses`, `users` list
45
+ them); `usedBy.all`: all reaching it, proofs included.
45
46
 
46
47
  **`include`**: comma-separated parts, each answered under its name as its endpoint would. `uses`,
47
48
  `users` take `offset`, `limit`, `where` from the query; `print` takes `proofs`; `describe` and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visualproof",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
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",