visualproof 0.7.0 → 0.8.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.
- package/README.md +1 -1
- package/dist/assets/tips/phone-fingers.light.mp4 +0 -0
- package/dist/assets/tips/phone-fingers.light.webp +0 -0
- package/dist/assets/tips/tour-agent.webp +0 -0
- package/dist/assets/tips/tour-arrange.webp +0 -0
- package/dist/assets/tips/tour-artwork.webp +0 -0
- package/dist/assets/tips/tour-checks.webp +0 -0
- package/dist/assets/tips/tour-export.webp +0 -0
- package/dist/assets/tips/tour-keys.webp +0 -0
- package/dist/assets/tips/tour-library.webp +0 -0
- package/dist/assets/tips/tour-project.webp +0 -0
- package/dist/assets/tips/tour-review.webp +0 -0
- package/dist/assets/tips/tour-share.webp +0 -0
- package/dist/assets/tips/tour-source.webp +0 -0
- package/dist/assets/tips/tour-target.webp +0 -0
- package/dist/assets/tips/tour-view.webp +0 -0
- package/dist/assets/tips/tour.json +90 -90
- package/dist/assets/tips/tour.webp +0 -0
- package/dist/server/agent.js +2 -2
- package/dist/server/agentadvice.js +16 -3
- package/dist/server/agentfollow.js +32 -4
- package/dist/server/agentviews.js +1 -1
- package/dist/server/app.js +3 -1
- package/dist/server/apptalk.js +21 -4
- package/dist/server/live.js +101 -10
- package/dist/server/mcptools.js +1 -1
- package/dist/server/presence.js +25 -8
- package/dist/server/readonlygate.js +4 -0
- package/dist/server/reviewapi.js +10 -3
- package/dist/shared/board.js +9 -8
- package/dist/shared/collab.js +53 -6
- package/dist/shared/pointer.js +152 -0
- package/dist/shared/query.js +36 -5
- package/dist/shared/review.js +34 -2
- package/dist/shared/sharesnap.js +15 -0
- package/dist/shared/titles.js +4 -0
- package/dist/web/bundle/app.js +1495 -248
- package/dist/web/index.html +4 -0
- package/dist/web/src/canvas.js +16 -14
- package/dist/web/src/highlight.js +8 -3
- package/dist/web/src/reviewqueue.js +52 -10
- package/dist/web/src/status.js +65 -1
- package/dist/web/style.css +121 -7
- package/docs/agent-api/advice.md +4 -1
- package/docs/agent-api/following.md +9 -3
- package/docs/agent-api/views.md +3 -1
- package/package.json +1 -1
package/dist/web/bundle/app.js
CHANGED
|
@@ -15,6 +15,50 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
// src/shared/doc/settings.ts
|
|
19
|
+
var DEFAULT_SETTINGS = Object.freeze({
|
|
20
|
+
paper: "a4",
|
|
21
|
+
margin: 22,
|
|
22
|
+
fontSize: 11,
|
|
23
|
+
codeSize: 8.5,
|
|
24
|
+
contents: true
|
|
25
|
+
});
|
|
26
|
+
var RETIRED_SETTINGS = ["scheme", "lineNumbers", "context", "figure", "supportIndex", "title", "author"];
|
|
27
|
+
function readSettings(raw) {
|
|
28
|
+
if (raw === void 0 || raw === null) return { settings: { ...DEFAULT_SETTINGS } };
|
|
29
|
+
if (typeof raw !== "object" || Array.isArray(raw)) return { error: "settings is an object of options" };
|
|
30
|
+
const o2 = raw;
|
|
31
|
+
const s2 = { ...DEFAULT_SETTINGS };
|
|
32
|
+
for (const [k2, v2] of Object.entries(o2)) {
|
|
33
|
+
if (RETIRED_SETTINGS.includes(k2)) continue;
|
|
34
|
+
if (!Object.hasOwn(DEFAULT_SETTINGS, k2)) return { error: `${k2} is not a setting (${Object.keys(DEFAULT_SETTINGS).join(", ")})` };
|
|
35
|
+
if (v2 === void 0) continue;
|
|
36
|
+
switch (k2) {
|
|
37
|
+
case "paper":
|
|
38
|
+
if (v2 !== "a4" && v2 !== "letter") return { error: "paper is a4 or letter" };
|
|
39
|
+
s2.paper = v2;
|
|
40
|
+
break;
|
|
41
|
+
case "margin":
|
|
42
|
+
if (typeof v2 !== "number" || !Number.isFinite(v2) || v2 < 10 || v2 > 40) return { error: "margin is in millimetres, 10\u201340" };
|
|
43
|
+
s2.margin = Math.round(v2);
|
|
44
|
+
break;
|
|
45
|
+
case "fontSize":
|
|
46
|
+
if (v2 !== 10 && v2 !== 11 && v2 !== 12) return { error: "fontSize is 10, 11 or 12" };
|
|
47
|
+
s2.fontSize = v2;
|
|
48
|
+
break;
|
|
49
|
+
case "codeSize":
|
|
50
|
+
if (typeof v2 !== "number" || !Number.isFinite(v2) || v2 < 6 || v2 > 12) return { error: "codeSize is in points, 6\u201312" };
|
|
51
|
+
s2.codeSize = Math.round(v2 * 2) / 2;
|
|
52
|
+
break;
|
|
53
|
+
case "contents":
|
|
54
|
+
if (typeof v2 !== "boolean") return { error: `${k2} is true or false` };
|
|
55
|
+
s2.contents = v2;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { settings: s2 };
|
|
60
|
+
}
|
|
61
|
+
|
|
18
62
|
// src/shared/collab.ts
|
|
19
63
|
var MAX_NAME = 60;
|
|
20
64
|
function validName(s2) {
|
|
@@ -60,7 +104,28 @@ function colorOf(name) {
|
|
|
60
104
|
const hue = ((h2 >>> 0) % 360 + 360) % 360;
|
|
61
105
|
return `hsl(${hue} 62% 46%)`;
|
|
62
106
|
}
|
|
107
|
+
function personKey(p2) {
|
|
108
|
+
return p2.agent ? `a:${p2.id}` : p2.name ? `${p2.verified ? "v" : "n"}:${p2.name}` : `s:${p2.id}`;
|
|
109
|
+
}
|
|
110
|
+
function cleanFollowing(x2) {
|
|
111
|
+
return typeof x2 === "string" && x2.length <= 200 && /^[avns]:[^\u0000-\u001f\u007f]+$/.test(x2) ? x2 : null;
|
|
112
|
+
}
|
|
63
113
|
var MAX_PINNED = 6;
|
|
114
|
+
var EXPORT_SETTINGS = ["paper", "fontSize", "codeSize", "contents"];
|
|
115
|
+
var EXPORT_ERROR_MAX = 500;
|
|
116
|
+
function cleanExport(v2) {
|
|
117
|
+
if (!v2 || typeof v2 !== "object" || typeof v2.open !== "boolean") return null;
|
|
118
|
+
const o2 = v2;
|
|
119
|
+
if (!o2.open) return { open: false };
|
|
120
|
+
const raw = o2.settings && typeof o2.settings === "object" && !Array.isArray(o2.settings) ? o2.settings : null;
|
|
121
|
+
const read2 = raw ? readSettings(Object.fromEntries(EXPORT_SETTINGS.filter((k2) => k2 in raw).map((k2) => [k2, raw[k2]]))) : null;
|
|
122
|
+
const settings = read2 && "settings" in read2 ? Object.fromEntries(EXPORT_SETTINGS.map((k2) => [k2, read2.settings[k2]])) : null;
|
|
123
|
+
const j2 = o2.job && typeof o2.job === "object" ? o2.job : null;
|
|
124
|
+
const state = j2 && ["running", "done", "failed"].includes(j2.state) ? j2.state : null;
|
|
125
|
+
const id = j2 && typeof j2.id === "string" && /^(?:[0-9a-f]{32})?$/.test(j2.id) ? j2.id : null;
|
|
126
|
+
const job = state && id !== null && (id || state !== "done") ? { id, state, ...state === "failed" && typeof j2.error === "string" ? { error: cutShort(j2.error.replace(/[\u0000-\u001f\u007f]+/g, " "), EXPORT_ERROR_MAX) } : {} } : null;
|
|
127
|
+
return { open: true, ...settings ? { settings } : {}, ...job ? { job } : {} };
|
|
128
|
+
}
|
|
64
129
|
var ART_STYLES = ["board", "cells", "stars"];
|
|
65
130
|
var TITLE_SIZE = { least: 3, most: 16, first: 7 };
|
|
66
131
|
var FOOT_SIZE = { least: 0.8, most: 4, first: 1.6 };
|
|
@@ -117,6 +182,7 @@ function cleanArtwork(v2) {
|
|
|
117
182
|
return { w: w2, h: h2, scheme, theme, background, labels, namesFrom, hiddenNames, shownNames, ruledNames, edges, notes: o2.notes, targets, shownTargets, keys, selection: o2.selection, source: o2.source === true, style, title: cleanTitle(o2.title), subtitle: cleanTitle(o2.subtitle), titleSize: cleanTitleSize(o2.titleSize), footSize: cleanFootSize(o2.footSize), border: o2.border === true, region: [...r2] };
|
|
118
183
|
}
|
|
119
184
|
var SCHEMES = ["kind", "status"];
|
|
185
|
+
var BOARD_SCHEMES = ["kind", "status", "mine"];
|
|
120
186
|
var ACTIVITY_KINDS = ["all", "review", "build", "change"];
|
|
121
187
|
var ACTIVITY_WHO = ["all", "agents", "people"];
|
|
122
188
|
function madeBy(t2, who) {
|
|
@@ -154,7 +220,7 @@ function cleanView(v2) {
|
|
|
154
220
|
const kind = one2(ACTIVITY_KINDS, av?.kind), who = one2(ACTIVITY_WHO, av?.who);
|
|
155
221
|
const activity = av && typeof av.open === "boolean" && kind && who ? { open: av.open, kind, who, ...typeof av.mine === "string" && validName(av.mine) ? { mine: av.mine } : {} } : null;
|
|
156
222
|
const lost = o2.lostFound && typeof o2.lostFound === "object" ? o2.lostFound.open : void 0;
|
|
157
|
-
const scheme = one2(
|
|
223
|
+
const scheme = one2(BOARD_SCHEMES, o2.scheme);
|
|
158
224
|
const pinned = Array.isArray(o2.pinned) ? o2.pinned.slice(0, MAX_PINNED).map((w2) => {
|
|
159
225
|
const decl = w2 && typeof w2 === "object" ? str2(w2.decl) : null;
|
|
160
226
|
return decl ? { decl, collapsed: w2.collapsed === true } : null;
|
|
@@ -171,6 +237,7 @@ function cleanView(v2) {
|
|
|
171
237
|
view: str2(o2.view, 300),
|
|
172
238
|
scope: str2(o2.scope, 4e3),
|
|
173
239
|
tabs: Array.isArray(o2.tabs) ? o2.tabs.slice(0, 50).map((t2) => str2(t2, 300)).filter((t2) => t2 !== null) : [],
|
|
240
|
+
...cleanFollowing(o2.following) ? { following: cleanFollowing(o2.following) } : {},
|
|
174
241
|
...snapshot !== null ? { history: { snapshot } } : {},
|
|
175
242
|
...o2.focus === null || str2(o2.focus) ? { focus: o2.focus } : {},
|
|
176
243
|
...visitors.length ? { visitors } : {},
|
|
@@ -180,7 +247,8 @@ function cleanView(v2) {
|
|
|
180
247
|
...scheme ? { scheme } : {},
|
|
181
248
|
...typeof o2.edges === "boolean" ? { edges: o2.edges } : {},
|
|
182
249
|
...typeof o2.linear === "boolean" ? { linear: o2.linear } : {},
|
|
183
|
-
...o2.artwork === null ? { artwork: null } : cleanArtwork(o2.artwork) ? { artwork: cleanArtwork(o2.artwork) } : {}
|
|
250
|
+
...o2.artwork === null ? { artwork: null } : cleanArtwork(o2.artwork) ? { artwork: cleanArtwork(o2.artwork) } : {},
|
|
251
|
+
...cleanExport(o2.export) ? { export: cleanExport(o2.export) } : {}
|
|
184
252
|
};
|
|
185
253
|
}
|
|
186
254
|
|
|
@@ -1209,7 +1277,7 @@ var Separator = class {
|
|
|
1209
1277
|
const moved = this.moved, next = this.movedNext;
|
|
1210
1278
|
moved.fill(1, 0, B2.n);
|
|
1211
1279
|
let any = false;
|
|
1212
|
-
for (let
|
|
1280
|
+
for (let round4 = 0; round4 < rounds; round4++) {
|
|
1213
1281
|
any = false;
|
|
1214
1282
|
next.fill(0, 0, B2.n);
|
|
1215
1283
|
this.build(B2);
|
|
@@ -1836,12 +1904,12 @@ function computeLayout(mode, nodes, edges, hidden = []) {
|
|
|
1836
1904
|
const cv = chainOf2(home[v2]);
|
|
1837
1905
|
let i2 = 0;
|
|
1838
1906
|
while (i2 < cu.length && i2 < cv.length && cu[i2] === cv[i2]) i2++;
|
|
1839
|
-
const
|
|
1907
|
+
const meet2 = cu[i2 - 1];
|
|
1840
1908
|
const a3 = i2 < cu.length ? cu[i2].slot : leafSlot[u2];
|
|
1841
1909
|
const b2 = i2 < cv.length ? cv[i2].slot : leafSlot[v2];
|
|
1842
1910
|
if (a3 !== b2) {
|
|
1843
|
-
const key = a3 * (
|
|
1844
|
-
|
|
1911
|
+
const key = a3 * (meet2.m + 1) + b2;
|
|
1912
|
+
meet2.flow.set(key, (meet2.flow.get(key) ?? 0) + 1);
|
|
1845
1913
|
}
|
|
1846
1914
|
for (let j2 = i2; j2 < cu.length; j2++) cu[j2].gOut[j2 + 1 < cu.length ? cu[j2 + 1].slot : leafSlot[u2]]++;
|
|
1847
1915
|
for (let j2 = i2; j2 < cv.length; j2++) cv[j2].gIn[j2 + 1 < cv.length ? cv[j2 + 1].slot : leafSlot[v2]]++;
|
|
@@ -2586,17 +2654,17 @@ function wordsText(words, lines) {
|
|
|
2586
2654
|
return { text: text2, starts };
|
|
2587
2655
|
}
|
|
2588
2656
|
function quoteInRegion(words, lines, r2) {
|
|
2589
|
-
const
|
|
2657
|
+
const inside3 = [];
|
|
2590
2658
|
words.forEach((w2, k2) => {
|
|
2591
2659
|
const x2 = (w2[1] + w2[3]) / 2, y2 = (w2[2] + w2[4]) / 2;
|
|
2592
|
-
if (x2 >= r2[0] && x2 <= r2[2] && y2 >= r2[1] && y2 <= r2[3])
|
|
2660
|
+
if (x2 >= r2[0] && x2 <= r2[2] && y2 >= r2[1] && y2 <= r2[3]) inside3.push(k2);
|
|
2593
2661
|
});
|
|
2594
|
-
if (!
|
|
2662
|
+
if (!inside3.length) return null;
|
|
2595
2663
|
const { text: text2, starts } = wordsText(words, lines);
|
|
2596
|
-
const first =
|
|
2664
|
+
const first = inside3[0], last2 = inside3[inside3.length - 1];
|
|
2597
2665
|
const q2 = quoteAt(text2, starts[first], starts[last2] + words[last2][0].length);
|
|
2598
2666
|
if (!q2) return null;
|
|
2599
|
-
const own2 =
|
|
2667
|
+
const own2 = inside3.length === last2 - first + 1 ? q2.text : inside3.map((k2) => words[k2][0]).join(" ");
|
|
2600
2668
|
const clean = (s2) => s2 ? squeeze(s2.replace(CONTROL, " ")).s : "";
|
|
2601
2669
|
const out = clean(own2).slice(0, LIMITS.quote);
|
|
2602
2670
|
if (!out) return null;
|
|
@@ -3038,6 +3106,16 @@ function standing(d2, name, who) {
|
|
|
3038
3106
|
const o2 = (Object.hasOwn(d2.opinions, name) ? d2.opinions[name] : []).findLast((p2) => author(p2) === whose);
|
|
3039
3107
|
return o2 && !o2.withdrawn ? o2 : null;
|
|
3040
3108
|
}
|
|
3109
|
+
function ownStatus(d2, name, who, hash) {
|
|
3110
|
+
const o2 = standing(d2, name, who);
|
|
3111
|
+
if (!o2) return "none";
|
|
3112
|
+
return !fresh(o2, hash) ? "stale" : STATUS_OF[o2.verdict];
|
|
3113
|
+
}
|
|
3114
|
+
function approval(d2, name, who, hash) {
|
|
3115
|
+
const o2 = standing(d2, name, who);
|
|
3116
|
+
if (!o2 || o2.verdict !== "approve") return "none";
|
|
3117
|
+
return fresh(o2, hash) ? "approved" : "stale";
|
|
3118
|
+
}
|
|
3041
3119
|
function recordedFor(d2, o2, forName, forPerson) {
|
|
3042
3120
|
const { by, person, ...rest } = o2;
|
|
3043
3121
|
const name = forPerson && Object.hasOwn(d2.people, forPerson) ? d2.people[forPerson].name : forName;
|
|
@@ -3618,6 +3696,7 @@ function diffPins(mode, before, after) {
|
|
|
3618
3696
|
// src/shared/query.ts
|
|
3619
3697
|
var KINDS = ["theorem", "def", "abbrev", "instance", "structure", "class", "inductive", "opaque", "axiom", "quot", "constructor", "recursor", "notation", "unknown"];
|
|
3620
3698
|
var STATUSES = ["unreviewed", "approved", "commented", "stale"];
|
|
3699
|
+
var MINE_STATUSES = ["approved", "commented", "stale", "none"];
|
|
3621
3700
|
var VERDICTS = ["approve", "comment"];
|
|
3622
3701
|
var CLOSURES = ["tcb", "uses", "usedBy", "refs"];
|
|
3623
3702
|
var PLAIN = ["all", "selection", "trusted", "external", "sorry", "nonstandard"];
|
|
@@ -3855,7 +3934,8 @@ function parse(text2) {
|
|
|
3855
3934
|
if (w2 === "kind") return { op: "kind", kinds: choose(args(), KINDS, "kind") };
|
|
3856
3935
|
if (w2 === "status") return { op: "status", statuses: choose(args(), STATUSES, "status") };
|
|
3857
3936
|
if (w2 === "advice") return { op: "advice", verdicts: choose(args(), VERDICTS, "advice") };
|
|
3858
|
-
|
|
3937
|
+
if (w2 === "mine") return { op: "mine", statuses: choose(args(), MINE_STATUSES, "mine") };
|
|
3938
|
+
throw new QueryError(`${text1(t2)} is not a word of the query language (all, tcb, uses, usedBy, refs, decl, key, ns, file, trusted, external, kind, status, advice, mine, sorry, nonstandard)`, t2.at);
|
|
3859
3939
|
};
|
|
3860
3940
|
const expr = () => {
|
|
3861
3941
|
let q3 = atom();
|
|
@@ -3903,6 +3983,8 @@ function printQuery(q2) {
|
|
|
3903
3983
|
return `status(${q2.statuses.join(", ")})`;
|
|
3904
3984
|
case "advice":
|
|
3905
3985
|
return `advice(${q2.verdicts.join(", ")})`;
|
|
3986
|
+
case "mine":
|
|
3987
|
+
return `mine(${q2.statuses.join(", ")})`;
|
|
3906
3988
|
case "and":
|
|
3907
3989
|
case "or":
|
|
3908
3990
|
case "except": {
|
|
@@ -3965,6 +4047,8 @@ function readJson(x2, why = false) {
|
|
|
3965
4047
|
return Array.isArray(o2.statuses) && o2.statuses.length && o2.statuses.every((s2) => STATUSES.includes(s2)) ? { op: "status", statuses: [...o2.statuses] } : null;
|
|
3966
4048
|
case "advice":
|
|
3967
4049
|
return Array.isArray(o2.verdicts) && o2.verdicts.length && o2.verdicts.every((s2) => VERDICTS.includes(s2)) ? { op: "advice", verdicts: [...o2.verdicts] } : null;
|
|
4050
|
+
case "mine":
|
|
4051
|
+
return Array.isArray(o2.statuses) && o2.statuses.length && o2.statuses.every((s2) => MINE_STATUSES.includes(s2)) ? { op: "mine", statuses: [...o2.statuses] } : null;
|
|
3968
4052
|
case "and":
|
|
3969
4053
|
case "or":
|
|
3970
4054
|
case "except": {
|
|
@@ -4000,11 +4084,17 @@ function within(q2, board2) {
|
|
|
4000
4084
|
return board2.op === "all" || sameQuery(q2, board2) ? q2 : { op: "and", a: q2, b: board2 };
|
|
4001
4085
|
}
|
|
4002
4086
|
function readsReview(q2) {
|
|
4003
|
-
if (q2.op === "trusted" || q2.op === "status" || q2.op === "advice" || q2.op === "key") return true;
|
|
4087
|
+
if (q2.op === "trusted" || q2.op === "status" || q2.op === "advice" || q2.op === "key" || q2.op === "mine") return true;
|
|
4004
4088
|
if ((q2.op === "tcb" || q2.op === "uses" || q2.op === "usedBy" || q2.op === "refs") && q2.of !== "selection" && !Array.isArray(q2.of)) return readsReview(q2.of);
|
|
4005
4089
|
if (q2.op === "and" || q2.op === "or" || q2.op === "except") return readsReview(q2.a) || readsReview(q2.b);
|
|
4006
4090
|
return false;
|
|
4007
4091
|
}
|
|
4092
|
+
function readsMine(q2) {
|
|
4093
|
+
if (q2.op === "mine") return true;
|
|
4094
|
+
if ((q2.op === "tcb" || q2.op === "uses" || q2.op === "usedBy" || q2.op === "refs") && q2.of !== "selection" && !Array.isArray(q2.of)) return readsMine(q2.of);
|
|
4095
|
+
if (q2.op === "and" || q2.op === "or" || q2.op === "except") return readsMine(q2.a) || readsMine(q2.b);
|
|
4096
|
+
return false;
|
|
4097
|
+
}
|
|
4008
4098
|
function reviewScope(target) {
|
|
4009
4099
|
const axioms = { op: "and", a: { op: "and", a: { op: "uses", of: [target] }, b: { op: "kind", kinds: ["axiom"] } }, b: { op: "nonstandard" } };
|
|
4010
4100
|
return fromChain({ op: "tcb", of: [target] }, [
|
|
@@ -4042,6 +4132,7 @@ var last = (name) => {
|
|
|
4042
4132
|
var list = (names2) => names2.length > 2 ? `${names2.slice(0, 2).map(last).join(", ")} +${names2.length - 2}` : names2.map(last).join(", ");
|
|
4043
4133
|
var roots = (of) => of === "selection" ? "the selection" : Array.isArray(of) ? list(of) : describe(of);
|
|
4044
4134
|
var or = (xs) => xs.length > 1 ? `${xs.slice(0, -1).join(", ")} or ${xs[xs.length - 1]}` : xs[0];
|
|
4135
|
+
var MINE_WORDS = { approved: "approved by me", commented: "commented on by me", stale: "stale of mine", none: "not reviewed by me" };
|
|
4045
4136
|
var PLURAL = /* @__PURE__ */ new Map([["theorem", "theorems"], ["def", "definitions"], ["abbrev", "abbreviations"], ["instance", "instances"], ["structure", "structures"], ["class", "classes"], ["inductive", "inductive types"], ["opaque", "opaque constants"], ["axiom", "axioms"], ["notation", "notations"]]);
|
|
4046
4137
|
function describe(q2) {
|
|
4047
4138
|
const k2 = readKeys(q2);
|
|
@@ -4085,6 +4176,8 @@ function describe(q2) {
|
|
|
4085
4176
|
return or(q2.statuses.map((s2) => s2 === "unreviewed" ? "not yet reviewed" : s2));
|
|
4086
4177
|
case "advice":
|
|
4087
4178
|
return `what an agent ${or(q2.verdicts.map((v2) => v2 === "approve" ? "approves" : "comments on"))}`;
|
|
4179
|
+
case "mine":
|
|
4180
|
+
return or(q2.statuses.map((s2) => MINE_WORDS[s2]));
|
|
4088
4181
|
case "and":
|
|
4089
4182
|
case "or":
|
|
4090
4183
|
case "except":
|
|
@@ -4100,7 +4193,7 @@ function describeCondition(c3) {
|
|
|
4100
4193
|
if (q2.op === "nonstandard") return "only with non-standard axioms";
|
|
4101
4194
|
if (q2.op === "ns") return `only in namespace ${q2.prefix}`;
|
|
4102
4195
|
if (q2.op === "file") return `only in files under ${q2.prefix}`;
|
|
4103
|
-
if (q2.op === "kind" || q2.op === "status" || q2.op === "advice" || q2.op === "key") return `only ${describe(q2)}`;
|
|
4196
|
+
if (q2.op === "kind" || q2.op === "status" || q2.op === "advice" || q2.op === "key" || q2.op === "mine") return `only ${describe(q2)}`;
|
|
4104
4197
|
return `and ${describe(q2)}`;
|
|
4105
4198
|
}
|
|
4106
4199
|
if (c3.op === "except") return `except ${describe(q2)}`;
|
|
@@ -4186,6 +4279,12 @@ function evaluateIn(q2, ctx, walks) {
|
|
|
4186
4279
|
return a3 !== null && vs.has(a3);
|
|
4187
4280
|
});
|
|
4188
4281
|
}
|
|
4282
|
+
case "mine": {
|
|
4283
|
+
const me = ctx.me;
|
|
4284
|
+
if (!me) return out;
|
|
4285
|
+
const ss = new Set(q2.statuses);
|
|
4286
|
+
return each((i2) => ss.has(ownStatus(d2, g2.nodes[i2].name, me, g2.nodes[i2].hash)));
|
|
4287
|
+
}
|
|
4189
4288
|
case "and":
|
|
4190
4289
|
case "or":
|
|
4191
4290
|
case "except": {
|
|
@@ -4329,6 +4428,8 @@ function filterWords(q2) {
|
|
|
4329
4428
|
return or2(q2.statuses);
|
|
4330
4429
|
case "advice":
|
|
4331
4430
|
return or2(q2.verdicts.map((v2) => v2 === "approve" ? "agent-approved" : "agent-commented"));
|
|
4431
|
+
case "mine":
|
|
4432
|
+
return or2(q2.statuses.map((s2) => s2 === "none" ? "not reviewed by me" : s2 === "stale" ? "stale of mine" : `${s2} by me`));
|
|
4332
4433
|
case "sorry":
|
|
4333
4434
|
return "with sorry";
|
|
4334
4435
|
case "nonstandard":
|
|
@@ -4381,6 +4482,7 @@ function said(q2, N2) {
|
|
|
4381
4482
|
case "kind":
|
|
4382
4483
|
case "status":
|
|
4383
4484
|
case "advice":
|
|
4485
|
+
case "mine":
|
|
4384
4486
|
return filterWords(q2);
|
|
4385
4487
|
case "and":
|
|
4386
4488
|
case "or":
|
|
@@ -5102,7 +5204,7 @@ function reviewState(raw) {
|
|
|
5102
5204
|
}
|
|
5103
5205
|
var graphQuery = (v2, i2, first) => v2 ? `${first}v=${v2}${i2 ? `&i=${encodeURIComponent(i2)}` : ""}` : "";
|
|
5104
5206
|
function heartbeatRequest(token, beat, headers) {
|
|
5105
|
-
if ("private" in beat) return { headers: { "content-type": "application/json" }, body: JSON.stringify({ token, private: true }) };
|
|
5207
|
+
if ("private" in beat) return { headers: { "content-type": "application/json" }, body: JSON.stringify({ token, private: true, ...beat.following ? { following: beat.following } : {} }) };
|
|
5106
5208
|
return { headers, body: JSON.stringify({ token, view: beat.view, idle: beat.idle }) };
|
|
5107
5209
|
}
|
|
5108
5210
|
async function inflate(id) {
|
|
@@ -5215,6 +5317,8 @@ function snapshotSource(info2) {
|
|
|
5215
5317
|
identity: async () => ({ mode: "none", name: null }),
|
|
5216
5318
|
presence: async () => {
|
|
5217
5319
|
},
|
|
5320
|
+
pointer: () => {
|
|
5321
|
+
},
|
|
5218
5322
|
undoLayout: async () => ({ error: "a snapshot shows the layout as it was" }),
|
|
5219
5323
|
exportHead: async () => "a snapshot cannot typeset documents: export from the server",
|
|
5220
5324
|
exportOutline: async () => "a snapshot of the page has no linear form: its document is the server's",
|
|
@@ -5350,6 +5454,11 @@ function serverSource() {
|
|
|
5350
5454
|
exportDoc: (body) => exportAnswer(fetch("/api/export", { method: "POST", headers: headers(), body: JSON.stringify(body) })),
|
|
5351
5455
|
exportJob: (id) => exportAnswer(fetch(`/api/export/job?id=${encodeURIComponent(id)}`)),
|
|
5352
5456
|
undoLayout: (id) => fetch("/api/layout/undo", { method: "POST", headers: headers(), body: JSON.stringify({ id }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5457
|
+
// let go as soon as it is sent: what matters is the next one, some 60 ms later
|
|
5458
|
+
pointer: (body) => {
|
|
5459
|
+
void fetch("/api/pointer", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) }).then((res) => void res.body?.cancel()).catch(() => {
|
|
5460
|
+
});
|
|
5461
|
+
},
|
|
5353
5462
|
presence: (token, beat) => {
|
|
5354
5463
|
const r2 = heartbeatRequest(token, beat, headers());
|
|
5355
5464
|
return fetch("/api/presence", { method: "POST", headers: r2.headers, body: r2.body, keepalive: true }).then((res) => void res.body?.cancel()).catch(() => {
|
|
@@ -5396,6 +5505,9 @@ async function exportAnswer(r2) {
|
|
|
5396
5505
|
try {
|
|
5397
5506
|
const res = await r2;
|
|
5398
5507
|
const b2 = await res.json().catch(() => ({}));
|
|
5508
|
+
const now = Date.parse(res.headers.get("date") ?? "");
|
|
5509
|
+
const at = b2.job?.at ? Date.parse(b2.job.at) : NaN;
|
|
5510
|
+
if (b2.job && Number.isFinite(now) && Number.isFinite(at)) b2.job.startedHere = Date.now() - Math.max(0, now - at);
|
|
5399
5511
|
return b2.job ?? b2.error ?? `the server answered ${res.status}`;
|
|
5400
5512
|
} catch {
|
|
5401
5513
|
return "the server could not be reached";
|
|
@@ -5710,12 +5822,13 @@ function tokenHtml(t2, isRef) {
|
|
|
5710
5822
|
}
|
|
5711
5823
|
}
|
|
5712
5824
|
var HANG_MAX = 24;
|
|
5713
|
-
function highlightLines(src, isRef) {
|
|
5825
|
+
function highlightLines(src, isRef, first) {
|
|
5714
5826
|
const lines = tokenLines(tokenizeLean(src));
|
|
5715
5827
|
return src.split("\n").map((text2, k2) => {
|
|
5716
5828
|
const indent = Math.min(/^ */.exec(text2)[0].length, HANG_MAX);
|
|
5717
5829
|
const html = (lines[k2] ?? []).map((t2) => tokenHtml(t2, isRef)).join("");
|
|
5718
|
-
|
|
5830
|
+
const n3 = first !== void 0 ? ` data-n="${first + k2}"` : "";
|
|
5831
|
+
return `<span class="ln"${n3} style="--in:${indent}">${html}${k2 < lines.length - 1 ? "\n" : ""}</span>`;
|
|
5719
5832
|
}).join("");
|
|
5720
5833
|
}
|
|
5721
5834
|
function renderHover(md, isRef) {
|
|
@@ -6176,7 +6289,7 @@ var FocusMenu = class {
|
|
|
6176
6289
|
};
|
|
6177
6290
|
|
|
6178
6291
|
// src/web/src/reload.ts
|
|
6179
|
-
var PAGE_VERSION = true ? "0.
|
|
6292
|
+
var PAGE_VERSION = true ? "0.8.1" : null;
|
|
6180
6293
|
var KEY = "visualproof:reload";
|
|
6181
6294
|
var FOR_KEY = "visualproof:reloaded-for";
|
|
6182
6295
|
var FRESH_MS = 10 * 6e4;
|
|
@@ -6332,6 +6445,10 @@ var same = (...fields) => ({
|
|
|
6332
6445
|
write: (v2) => Object.fromEntries(fields.filter((f2) => v2[f2] !== void 0).map((f2) => [f2, v2[f2]])),
|
|
6333
6446
|
read: (o2, clean) => Object.fromEntries(fields.filter((f2) => f2 in o2 && clean[f2] !== void 0).map((f2) => [f2, clean[f2]]))
|
|
6334
6447
|
});
|
|
6448
|
+
function namedJob(e2) {
|
|
6449
|
+
const { job, ...rest } = e2;
|
|
6450
|
+
return { ...rest, ...job?.id ? { job } : {} };
|
|
6451
|
+
}
|
|
6335
6452
|
var tenth = (n3) => Math.round(n3 * 10) / 10;
|
|
6336
6453
|
var SNAPSHOT_FORMS = {
|
|
6337
6454
|
view: same("view", "scope", "clusterMode"),
|
|
@@ -6367,6 +6484,15 @@ var SNAPSHOT_FORMS = {
|
|
|
6367
6484
|
colouring: same("scheme"),
|
|
6368
6485
|
edges: same("edges"),
|
|
6369
6486
|
linear: same("linear"),
|
|
6487
|
+
// the Export window open, with its settings and the document it shows typeset or typesetting,
|
|
6488
|
+
// which the opener reads by its id from the export's cache (the owner's decision of 2026-10-20); a
|
|
6489
|
+
// job the server had not named yet, or refused, is no document to show, and is left out. Closed,
|
|
6490
|
+
// nothing: the opener's own stays as it is
|
|
6491
|
+
export: {
|
|
6492
|
+
fields: ["export"],
|
|
6493
|
+
write: (v2) => v2.export?.open ? { export: namedJob(v2.export) } : {},
|
|
6494
|
+
read: (o2, clean) => "export" in o2 && clean.export?.open ? { export: namedJob(clean.export) } : {}
|
|
6495
|
+
},
|
|
6370
6496
|
artwork: same("artwork")
|
|
6371
6497
|
};
|
|
6372
6498
|
async function writeSnapshot(v2, screen) {
|
|
@@ -7145,10 +7271,11 @@ var Store = class {
|
|
|
7145
7271
|
this.save();
|
|
7146
7272
|
}
|
|
7147
7273
|
/** The colour scheme where the review has a focus (`review`) or on any other board: the reader's
|
|
7148
|
-
* choice there, or else Status where the review is done, and Kind
|
|
7274
|
+
* choice there — Kind, Status or Mine —, or else Status where the review is done, and Kind
|
|
7275
|
+
* elsewhere. */
|
|
7149
7276
|
schemeFor(review) {
|
|
7150
7277
|
const s2 = this.data.scheme?.[review ? "review" : "other"];
|
|
7151
|
-
return s2 === "kind" || s2 === "status" ? s2 : review ? "status" : "kind";
|
|
7278
|
+
return s2 === "kind" || s2 === "status" || s2 === "mine" ? s2 : review ? "status" : "kind";
|
|
7152
7279
|
}
|
|
7153
7280
|
/** The reader chose a scheme where the review has a focus, or elsewhere: kept for boards of that
|
|
7154
7281
|
* kind. */
|
|
@@ -8741,6 +8868,53 @@ var ReviewBox = class {
|
|
|
8741
8868
|
for (const w2 of document.querySelectorAll("[data-rv-for-who]")) w2.textContent = f2 ? ` for ${f2}` : "";
|
|
8742
8869
|
const mine = this.voiceMatch();
|
|
8743
8870
|
for (const b2 of document.querySelectorAll("button[data-rv-withdraw]")) b2.hidden = !mine({ by: b2.dataset.rvBy ?? "", person: b2.dataset.rvPerson });
|
|
8871
|
+
for (const b2 of document.querySelectorAll("button[data-rv-state]")) {
|
|
8872
|
+
const name2 = b2.dataset.rvName ?? "";
|
|
8873
|
+
const j2 = this.g.byName.get(name2);
|
|
8874
|
+
const html = b2.dataset.rvAx !== void 0 ? this.approveHtml(name2, void 0, true) : this.approveHtml(name2, j2 === void 0 ? void 0 : this.g.nodes[j2].hash);
|
|
8875
|
+
if (b2.outerHTML !== html) b2.outerHTML = html;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
/** Whose opinions the box records now (ReviewSpec decision 8), as the review keys them: the
|
|
8879
|
+
* person spoken for — someone invited by their link in force, else a guest as the logs write
|
|
8880
|
+
* their name (the server's `voice`, server/reviewapi.ts) — or else the reader, by their link
|
|
8881
|
+
* where they came by one, else by their name; null for a reader without one. */
|
|
8882
|
+
voiceAuthor() {
|
|
8883
|
+
const f2 = this.forName();
|
|
8884
|
+
const R2 = this.hooks.review();
|
|
8885
|
+
if (f2) {
|
|
8886
|
+
const id = invitedId(f2);
|
|
8887
|
+
if (id) return { by: f2, person: id };
|
|
8888
|
+
for (const ops of Object.values(R2.data.opinions)) for (const o2 of ops) if (!o2.agent && !o2.person && sameName(o2.by, f2)) return { by: o2.by };
|
|
8889
|
+
return { by: f2 };
|
|
8890
|
+
}
|
|
8891
|
+
const me = R2.reviewer?.trim();
|
|
8892
|
+
if (R2.person) return { by: me ?? "", person: R2.person };
|
|
8893
|
+
return me ? { by: me } : null;
|
|
8894
|
+
}
|
|
8895
|
+
/** Where the approval of whoever the box records for stands on `name`, at the version whose hash
|
|
8896
|
+
* is `hash` (shared/review.ts, approval): what Approve says, and does. */
|
|
8897
|
+
approvalOf(name, hash) {
|
|
8898
|
+
const who = this.voiceAuthor();
|
|
8899
|
+
return who ? approval(this.hooks.review().data, name, who, hash) : "none";
|
|
8900
|
+
}
|
|
8901
|
+
/** Approve as it stands for `name` (ReviewSpec decision 1, the owner's decision of 2026-10-20):
|
|
8902
|
+
* *Approve*; *Approved ✓*, which reads *Withdraw approval* under the pointer or the keyboard's
|
|
8903
|
+
* focus, and withdraws it; or *Approve again*, the approval being of an earlier version. `axiom`:
|
|
8904
|
+
* an axiom's, from its target's box (the board has no declaration for it). The names stay where
|
|
8905
|
+
* speaking for someone else changes whose approval it is (speakFor). */
|
|
8906
|
+
approveHtml(name, hash, axiom = false) {
|
|
8907
|
+
const esc2 = escapeHtml;
|
|
8908
|
+
const f2 = this.forName();
|
|
8909
|
+
const who = `<span data-rv-for-who>${f2 ? ` for ${esc2(f2)}` : ""}</span>`;
|
|
8910
|
+
const st2 = this.approvalOf(name, hash);
|
|
8911
|
+
const whose = f2 ? `${esc2(f2)}'s` : "your";
|
|
8912
|
+
const attrs = axiom ? `data-rv-ax="${esc2(name)}" data-rv-axv="approve"` : `data-rv="approve"`;
|
|
8913
|
+
const state = ` data-rv-state="${st2}" data-rv-name="${esc2(name)}"`;
|
|
8914
|
+
if (st2 === "approved")
|
|
8915
|
+
return `<button class="rv-btn approve on" ${attrs}${state} aria-pressed="true" title="${f2 ? `${esc2(f2)} approved` : "You approved"} this version${axiom ? "" : " (a records nothing more)"}. Click to withdraw ${whose} approval: afterwards there is no opinion of ${f2 ? "theirs" : "yours"} here, and it stays in the history"><span class="rv-is">Approved \u2713${who}</span><span class="rv-undo">Withdraw approval${who}</span></button>`;
|
|
8916
|
+
const title = st2 === "stale" ? `${f2 ? `${esc2(f2)}'s` : "Your"} approval is of an earlier version: approve the present one${axiom ? "" : " (a)"}, with the comment if there is one` : axiom ? "Approve it" : "Approve (a), with the comment if there is one";
|
|
8917
|
+
return `<button class="rv-btn approve" ${attrs}${state} title="${title}">${st2 === "stale" ? "Approve again" : "Approve"}${who}</button>`;
|
|
8744
8918
|
}
|
|
8745
8919
|
/** Whose opinions Withdraw takes back (ReviewSpec decision 9): the person the boxes record for
|
|
8746
8920
|
* (decision 8), found as the server finds them (server/reviewapi.ts, voice) — someone invited by
|
|
@@ -8833,6 +9007,10 @@ var ReviewBox = class {
|
|
|
8833
9007
|
this.hooks.linkHere?.(i2);
|
|
8834
9008
|
return true;
|
|
8835
9009
|
}
|
|
9010
|
+
if (t2.closest("[data-rv-fold]")) {
|
|
9011
|
+
this.hooks.showOpinions?.(!this.opinionsShown());
|
|
9012
|
+
return true;
|
|
9013
|
+
}
|
|
8836
9014
|
const changes = t2.closest("summary")?.parentElement;
|
|
8837
9015
|
if (changes?.matches("details[data-rv-changes]")) {
|
|
8838
9016
|
const key2 = changes.dataset.rvChanges;
|
|
@@ -8856,6 +9034,15 @@ var ReviewBox = class {
|
|
|
8856
9034
|
this.withdraw(i2, { by: wd.dataset.rvBy ?? "", ...wd.dataset.rvPerson ? { person: wd.dataset.rvPerson } : {} }, root);
|
|
8857
9035
|
return true;
|
|
8858
9036
|
}
|
|
9037
|
+
const btn = t2.closest("[data-rv], [data-rv-ax]");
|
|
9038
|
+
if (btn?.dataset.rvState === "approved") {
|
|
9039
|
+
const who = this.voiceAuthor();
|
|
9040
|
+
const name = btn.dataset.rvAx ?? v2.name;
|
|
9041
|
+
if (!who || R2.readOnly || R2.blocked) return true;
|
|
9042
|
+
if (this.approvalOf(name, btn.dataset.rvAx === void 0 ? v2.hash : void 0) !== "approved") this.told(root, "That approval is no longer the one that stands.");
|
|
9043
|
+
else this.takeBack(name, btn.dataset.rvAx ?? this.g.short(i2), who, root);
|
|
9044
|
+
return true;
|
|
9045
|
+
}
|
|
8859
9046
|
const verdict = t2.closest("[data-rv]")?.dataset.rv;
|
|
8860
9047
|
if (verdict) {
|
|
8861
9048
|
this.give(verdict, i2, root);
|
|
@@ -8869,6 +9056,10 @@ var ReviewBox = class {
|
|
|
8869
9056
|
if (t2.closest("[data-rv-target]")) return this.as(root, () => this.hooks.submit({ op: "target", name: v2.name, on: !Object.hasOwn(R2.data.targets, v2.name) }));
|
|
8870
9057
|
return false;
|
|
8871
9058
|
}
|
|
9059
|
+
/** Whether the opinions are all shown (the reader's own, kept in this browser), or all folded. */
|
|
9060
|
+
opinionsShown() {
|
|
9061
|
+
return this.hooks.opinionsShown?.() ?? true;
|
|
9062
|
+
}
|
|
8872
9063
|
/** Whether the review of declaration `i` compares a stale opinion with its source: drawn again
|
|
8873
9064
|
* once the file has been read. */
|
|
8874
9065
|
needsSource(i2) {
|
|
@@ -8928,6 +9119,7 @@ var ReviewBox = class {
|
|
|
8928
9119
|
const v2 = this.g.nodes[i2];
|
|
8929
9120
|
const R2 = this.hooks.review();
|
|
8930
9121
|
if (R2.readOnly || R2.blocked || this.hooks.editedNow(i2) === true) return;
|
|
9122
|
+
if (verdict === "approve" && this.approvalOf(v2.name, v2.hash) === "approved") return this.already(root, this.g.short(i2));
|
|
8931
9123
|
const comment = (this.drafts.get(v2.name) ?? "").trim();
|
|
8932
9124
|
if (verdict === "comment" && !comment) {
|
|
8933
9125
|
this.told(root, "Write the comment first, in the box.");
|
|
@@ -8942,17 +9134,21 @@ var ReviewBox = class {
|
|
|
8942
9134
|
* recorded as by the reader. An approval goes at once; a comment, whose text then leaves the
|
|
8943
9135
|
* review for its history, is asked about first. What was done is said. */
|
|
8944
9136
|
withdraw(i2, whose, root) {
|
|
8945
|
-
|
|
9137
|
+
this.takeBack(this.g.nodes[i2].name, this.g.short(i2), whose, root);
|
|
9138
|
+
}
|
|
9139
|
+
/** `withdraw`, of the opinion on `name` (an axiom the graph has no declaration for among them),
|
|
9140
|
+
* said `label`. */
|
|
9141
|
+
takeBack(name, label, whose, root) {
|
|
8946
9142
|
const R2 = this.hooks.review();
|
|
8947
9143
|
if (R2.readOnly || R2.blocked) return;
|
|
8948
|
-
const o2 = standing(R2.data,
|
|
9144
|
+
const o2 = standing(R2.data, name, whose);
|
|
8949
9145
|
if (!o2) return this.told(root, "That opinion is no longer the one that stands.");
|
|
8950
9146
|
const f2 = this.forName();
|
|
8951
9147
|
const theirs = f2 ? `${o2.by}'s` : "your";
|
|
8952
|
-
const what = `${theirs} ${NOUN[o2.verdict]} ${o2.verdict === "approve" ? "of" : "on"} ${
|
|
8953
|
-
if (o2.verdict === "comment" && typeof confirm === "function" && !confirm(`Withdraw ${what}? It stays in the history; ${f2 ? `${o2.by} will have` : "you will have"} no opinion on ${
|
|
9148
|
+
const what = `${theirs} ${NOUN[o2.verdict]} ${o2.verdict === "approve" ? "of" : "on"} ${label}`;
|
|
9149
|
+
if (o2.verdict === "comment" && typeof confirm === "function" && !confirm(`Withdraw ${what}? It stays in the history; ${f2 ? `${o2.by} will have` : "you will have"} no opinion on ${label}.`)) return;
|
|
8954
9150
|
this.as(root, async () => {
|
|
8955
|
-
const why = await this.hooks.submit({ op: "withdraw", name
|
|
9151
|
+
const why = await this.hooks.submit({ op: "withdraw", name, ...f2 ? { for: f2 } : {} });
|
|
8956
9152
|
if (why) return why;
|
|
8957
9153
|
const done = `Withdrew ${what}${f2 ? ", recorded by you" : ""}.`;
|
|
8958
9154
|
if (this.hooks.said) this.hooks.said(done);
|
|
@@ -8965,6 +9161,7 @@ var ReviewBox = class {
|
|
|
8965
9161
|
giveAxiom(verdict, name, i2, root) {
|
|
8966
9162
|
const R2 = this.hooks.review();
|
|
8967
9163
|
if (R2.readOnly || R2.blocked) return;
|
|
9164
|
+
if (verdict === "approve" && this.approvalOf(name, void 0) === "approved") return this.already(root, name);
|
|
8968
9165
|
const target = this.g.nodes[i2].name;
|
|
8969
9166
|
const comment = (this.drafts.get(target) ?? "").trim();
|
|
8970
9167
|
if (verdict === "comment" && !comment) {
|
|
@@ -9050,12 +9247,13 @@ var ReviewBox = class {
|
|
|
9050
9247
|
}
|
|
9051
9248
|
const by = findOpinion(this.hooks.review().data, this.g.nodes[j2].name, r2.by, r2.at)?.by ?? r2.by;
|
|
9052
9249
|
this.flashing = { key: opinionRef(this.g.nodes[j2].name, by, r2.at), until: Date.now() + 3e3, since: 0, shown: /* @__PURE__ */ new WeakSet() };
|
|
9250
|
+
if (!this.opinionsShown()) this.hooks.showOpinions?.(true);
|
|
9053
9251
|
if (j2 !== i2 || !root) return this.hooks.go(j2);
|
|
9054
9252
|
if (!this.reveal(root)) this.told(root, `That opinion of ${r2.by}'s is not in the review now.`);
|
|
9055
9253
|
}
|
|
9056
9254
|
/** Once the review is drawn in `root`: a quoted opinion being gone to flashes there — in the
|
|
9057
|
-
* history
|
|
9058
|
-
* Drawn again while it flashes, it flashes on from where it was. Whether it is there. */
|
|
9255
|
+
* history when it is not among the latest, the opinions shown — and is scrolled to, once in each
|
|
9256
|
+
* place. Drawn again while it flashes, it flashes on from where it was. Whether it is there. */
|
|
9059
9257
|
reveal(root) {
|
|
9060
9258
|
const f2 = this.flashing;
|
|
9061
9259
|
if (!f2) return false;
|
|
@@ -9117,6 +9315,14 @@ var ReviewBox = class {
|
|
|
9117
9315
|
void this.hooks.ensureReviewer().then((me) => me ? act(me).then((why) => this.told(root, why)) : void 0);
|
|
9118
9316
|
return true;
|
|
9119
9317
|
}
|
|
9318
|
+
/** Approving where the approval of this version stands already (the key a, a page behind): nothing
|
|
9319
|
+
* is sent, and the reader is told so — for a moment where the page can say it, else in the box. */
|
|
9320
|
+
already(root, label) {
|
|
9321
|
+
const f2 = this.forName();
|
|
9322
|
+
const text2 = `${f2 ? `${f2}'s` : "Your"} approval of this version of ${label} stands already: nothing more is recorded (Approved \u2713 withdraws it).`;
|
|
9323
|
+
if (this.hooks.said) this.hooks.said(text2);
|
|
9324
|
+
else this.told(root, text2);
|
|
9325
|
+
}
|
|
9120
9326
|
/** Why a request was refused, under the buttons in `root`. */
|
|
9121
9327
|
told(root, why) {
|
|
9122
9328
|
if (!why) return;
|
|
@@ -9140,27 +9346,30 @@ var ReviewBox = class {
|
|
|
9140
9346
|
const quote = (o2) => o2.comment && writable ? ` <button type="button" class="rv-quote" data-rv-quote="${key(o2)}" title="Quote this comment in yours, linking back to it">Quote</button>` : "";
|
|
9141
9347
|
const mine = this.voiceMatch();
|
|
9142
9348
|
const withdraw = (o2) => R2.readOnly || R2.blocked || o2.agent ? "" : ` <button type="button" class="rv-quote rv-withdraw" data-rv-withdraw data-rv-by="${esc2(o2.by)}"${o2.person ? ` data-rv-person="${esc2(o2.person)}"` : ""}${mine(o2) ? "" : " hidden"} title="Withdraw this ${NOUN[o2.verdict]}: afterwards there is no opinion of ${esc2(o2.by)}'s here (an earlier one is not restored); it stays in the history">Withdraw</button>`;
|
|
9349
|
+
const shown2 = this.opinionsShown();
|
|
9143
9350
|
const opinion = (o2, compare = false) => {
|
|
9144
9351
|
const now2 = fresh(o2, v2.hash);
|
|
9145
9352
|
return (
|
|
9146
9353
|
// recorded for them by someone else: theirs, without the mark they did not give it under
|
|
9147
9354
|
// (ReviewSpec decision 8)
|
|
9148
|
-
`<div class="rv-op rv-${o2.verdict}${now2 ? "" : " old"}${o2.withdrawn ? " withdrawn" : ""}" data-rv-op="${key(o2)}"><span class="rv-dot"></span><b>${esc2(o2.by)}</b>${o2.person && !o2.recordedBy ? VERIFIED : ""} ${VERB[o2.verdict]} <span class="muted">\xB7 ${ago(o2.at)}${o2.recordedBy ? ` \xB7 recorded by ${esc2(o2.recordedBy.by)}` : ""}${now2 ? "" : " \xB7 on an earlier version"}${o2.withdrawn ? " \xB7 withdrawn" : ""}</span>${quote(o2)}${compare ? withdraw(o2) : ""}` + (o2.comment ? `<div class="rv-c md">${this.comment(o2.comment, v2.name)}</div>` : "") + `</div>` + // beside the opinion, not in it: a stale opinion is faded, what changed must read clearly
|
|
9355
|
+
`<div class="rv-op rv-${o2.verdict}${now2 ? "" : " old"}${o2.withdrawn ? " withdrawn" : ""}${shown2 ? "" : " rv-line"}" data-rv-op="${key(o2)}"><span class="rv-dot"></span><b>${esc2(o2.by)}</b>${o2.person && !o2.recordedBy ? VERIFIED : ""} ${VERB[o2.verdict]} <span class="muted">\xB7 ${ago(o2.at)}${o2.recordedBy ? ` \xB7 recorded by ${esc2(o2.recordedBy.by)}` : ""}${now2 ? "" : shown2 ? " \xB7 on an earlier version" : " \xB7 stale"}${o2.withdrawn ? " \xB7 withdrawn" : ""}</span>${shown2 ? quote(o2) : ""}${compare ? withdraw(o2) : ""}` + (shown2 && o2.comment ? `<div class="rv-c md">${this.comment(o2.comment, v2.name)}</div>` : "") + `</div>` + // beside the opinion, not in it: a stale opinion is faded, what changed must read clearly
|
|
9149
9356
|
(compare && !now2 ? this.changes(i2, o2) : "")
|
|
9150
9357
|
);
|
|
9151
9358
|
};
|
|
9152
9359
|
const now = current(d2, v2.name);
|
|
9153
9360
|
const all = (Object.hasOwn(d2.opinions, v2.name) ? d2.opinions[v2.name] : []).filter((o2) => !o2.agent);
|
|
9154
|
-
const
|
|
9361
|
+
const adv = advice(d2, v2.name);
|
|
9362
|
+
const earlier = all.filter((o2) => !now.includes(o2));
|
|
9363
|
+
const gone = earlier.filter((o2) => o2.withdrawn).length;
|
|
9364
|
+
const toggle = all.length || adv.length ? `<button type="button" class="rv-fold" data-rv-fold aria-expanded="${shown2}" title="${shown2 ? "Fold every opinion to a line \u2014 who, what, when \u2014 here and in every source window (kept in this browser)" : "Show every opinion in full, the earlier and withdrawn ones too, here and in every source window (kept in this browser)"}">${shown2 ? "Fold all" : "Show all"}</button>` : "";
|
|
9365
|
+
const ops = `<div class="rv-ops-h"><span class="rv-ops-n">${now.length ? `Opinions <b>${now.length}</b>` : all.length ? "No opinions now" : "No opinions yet"}` + (earlier.length ? ` <span class="muted">\xB7 ${earlier.length} earlier${gone ? `, ${gone} withdrawn` : ""}</span>` : "") + `</span>${toggle}</div>` + now.map((o2) => opinion(o2, true)).join("");
|
|
9155
9366
|
const withdrawal = (o2) => `<div class="rv-op rv-wd" data-rv-wd="${key(o2)}"><span class="rv-dot"></span><b>${esc2(o2.by)}</b>${o2.person && !o2.withdrawn.recordedBy ? VERIFIED : ""} withdrew their ${NOUN[o2.verdict]} <span class="muted">\xB7 ${ago(o2.withdrawn.at)}${o2.withdrawn.recordedBy ? ` \xB7 recorded by ${esc2(o2.withdrawn.recordedBy.by)}` : ""}</span></div>`;
|
|
9156
|
-
const entries =
|
|
9367
|
+
const entries = earlier.flatMap((o2) => [{ at: o2.at, html: () => opinion(o2) }, ...o2.withdrawn ? [{ at: o2.withdrawn.at, html: () => withdrawal(o2) }] : []]);
|
|
9157
9368
|
entries.sort((a3, b2) => a3.at < b2.at ? -1 : a3.at > b2.at ? 1 : 0);
|
|
9158
|
-
const
|
|
9159
|
-
const history2 = all.length > now.length ? `<details class="rv-hist"><summary>All ${all.length} opinions${gone ? ` \xB7 ${gone} withdrawn` : ""}</summary>${entries.map((x2) => x2.html()).join("")}</details>` : "";
|
|
9160
|
-
const adv = advice(d2, v2.name);
|
|
9369
|
+
const history2 = shown2 && entries.length ? `<div class="rv-hist"><div class="rv-hist-h">Earlier</div>${entries.map((x2) => x2.html()).join("")}</div>` : "";
|
|
9161
9370
|
const advised = adv.length ? `<div class="rv-advice"><div class="rv-adv-h">${BOT}Advice from agents <span class="muted">\xB7 not counted</span></div>` + adv.map((o2) => {
|
|
9162
9371
|
const on = fresh(o2, v2.hash);
|
|
9163
|
-
return `<div class="rv-adv rv-adv-${o2.verdict}${on ? "" : " old"}" data-rv-op="${key(o2)}"><b>${esc2(agentName(o2.by))}</b> ${o2.verdict === "approve" ? `suggests: <b class="rv-adv-v">approve</b>` : `<b class="rv-adv-v">comments</b>`} <span class="muted">\xB7 ${ago(o2.at)}${on ? "" : " \xB7 on an earlier version"}</span>${quote(o2)}` + (o2.comment ? `<div class="rv-adv-c md">${this.comment(o2.comment, v2.name)}</div>` : "") + `</div>`;
|
|
9372
|
+
return `<div class="rv-adv rv-adv-${o2.verdict}${on ? "" : " old"}${shown2 ? "" : " rv-line"}" data-rv-op="${key(o2)}"><b>${esc2(agentName(o2.by))}</b> ${o2.verdict === "approve" ? `suggests: <b class="rv-adv-v">approve</b>` : `<b class="rv-adv-v">comments</b>`} <span class="muted">\xB7 ${ago(o2.at)}${on ? "" : shown2 ? " \xB7 on an earlier version" : " \xB7 stale"}</span>${shown2 ? quote(o2) : ""}` + (shown2 && o2.comment ? `<div class="rv-adv-c md">${this.comment(o2.comment, v2.name)}</div>` : "") + `</div>`;
|
|
9164
9373
|
}).join("") + `</div>` : "";
|
|
9165
9374
|
let controls;
|
|
9166
9375
|
if (R2.readOnly) controls = `<div class="muted rv-note">${esc2(R2.note ?? "A snapshot shows the review as it was when it was taken.")}</div>`;
|
|
@@ -9170,7 +9379,7 @@ var ReviewBox = class {
|
|
|
9170
9379
|
else {
|
|
9171
9380
|
this.people(d2);
|
|
9172
9381
|
const f2 = this.forName();
|
|
9173
|
-
controls = `<div class="rv-for-on" data-rv-for-on${f2 ? "" : " hidden"}>${f2 ? `Recording for <b>${esc2(f2)}</b> \u2014 their opinion, recorded by you` : ""}</div><textarea class="rv-text" data-rv-comment="${esc2(v2.name)}" rows="${rowsFor(this.drafts.get(v2.name) ?? "")}" placeholder="Comment (optional with an approval) \xB7 Markdown" title="Markdown: > quote, \`code\`, \`\`\`lean blocks, **bold**, *italics*; a declaration's full name in backticks links to it. Quote an opinion with its Quote, lines of code by selecting them in the source window">${esc2(this.drafts.get(v2.name) ?? "")}</textarea><div class="rv-actions"
|
|
9382
|
+
controls = `<div class="rv-for-on" data-rv-for-on${f2 ? "" : " hidden"}>${f2 ? `Recording for <b>${esc2(f2)}</b> \u2014 their opinion, recorded by you` : ""}</div><textarea class="rv-text" data-rv-comment="${esc2(v2.name)}" rows="${rowsFor(this.drafts.get(v2.name) ?? "")}" placeholder="Comment (optional with an approval) \xB7 Markdown" title="Markdown: > quote, \`code\`, \`\`\`lean blocks, **bold**, *italics*; a declaration's full name in backticks links to it. Quote an opinion with its Quote, lines of code by selecting them in the source window">${esc2(this.drafts.get(v2.name) ?? "")}</textarea><div class="rv-actions">${this.approveHtml(v2.name, v2.hash)}<button class="rv-btn comment" data-rv="comment" title="Comment (m): send what you wrote in the box">Comment<span data-rv-for-who>${f2 ? ` for ${esc2(f2)}` : ""}</span></button><label class="rv-for" title="Record the opinion as another person's, at the same screen: it counts as theirs, recorded by you. Empty: your own">Speaking for <input class="rv-for-in" data-rv-for list="rv-people" value="${esc2(this.speakingFor ?? "")}" placeholder="${esc2(R2.reviewer ?? "yourself")}" maxlength="${MAX_NAME}" spellcheck="false" autocomplete="off"></label></div><div class="rv-err" hidden></div>`;
|
|
9174
9383
|
}
|
|
9175
9384
|
if (R2.error && !R2.readOnly && !R2.blocked) controls += `<div class="banner warn">${esc2(R2.error)}</div>`;
|
|
9176
9385
|
const by = trustedBy(d2, v2.name, v2.module, ext);
|
|
@@ -9235,7 +9444,7 @@ var ReviewBox = class {
|
|
|
9235
9444
|
return `<div class="rv-axioms"><div class="rv-diff-h">Axioms outside the graph <span class="muted">${off.length} \xB7 counted, approved here</span></div>` + off.map((a3) => {
|
|
9236
9445
|
const s2 = statusOf(d2, a3.name, void 0);
|
|
9237
9446
|
const where = a3.via.length ? ` \xB7 comes in through ${a3.via.map((j2) => g2.nodes[j2].name).join(", ")}` : "";
|
|
9238
|
-
return `<div class="row rv-${s2}" title="${esc2(`${a3.name}: a non-standard axiom ${g2.nodes[i2].name} rests on${where}`)}"><b>axiom ${esc2(a3.name)}</b> <span class="muted">${s2 === "none" ? "not yet reviewed" : s2}${esc2(where)}</span>` + (readOnly ? "" : `<span class="rv-actions"
|
|
9447
|
+
return `<div class="row rv-${s2}" title="${esc2(`${a3.name}: a non-standard axiom ${g2.nodes[i2].name} rests on${where}`)}"><b>axiom ${esc2(a3.name)}</b> <span class="muted">${s2 === "none" ? "not yet reviewed" : s2}${esc2(where)}</span>` + (readOnly ? "" : `<span class="rv-actions">${this.approveHtml(a3.name, void 0, true)}<button class="rv-btn comment" data-rv-ax="${esc2(a3.name)}" data-rv-axv="comment" title="Send the comment written above">Comment</button></span>`) + `</div>`;
|
|
9239
9448
|
}).join("") + `</div>`;
|
|
9240
9449
|
}
|
|
9241
9450
|
};
|
|
@@ -10600,7 +10809,7 @@ var Phone = class {
|
|
|
10600
10809
|
}
|
|
10601
10810
|
}
|
|
10602
10811
|
open() {
|
|
10603
|
-
const label = (id, fallback) => id === "who" ? `Your name: ${document.
|
|
10812
|
+
const label = (id, fallback) => id === "who" ? `Your name: ${document.querySelector("#who .who-n")?.textContent?.trim() || "set it"}` : fallback;
|
|
10604
10813
|
const icon = (id) => OWN_ICON[id] ?? document.getElementById(id)?.querySelector("svg")?.outerHTML ?? `<svg viewBox="0 0 16 16"></svg>`;
|
|
10605
10814
|
const shown2 = (badge, cls) => {
|
|
10606
10815
|
const b2 = document.getElementById(badge);
|
|
@@ -10608,7 +10817,12 @@ var Phone = class {
|
|
|
10608
10817
|
};
|
|
10609
10818
|
const badges = {
|
|
10610
10819
|
"activity-btn": () => shown2("activity-badge", "act-badge"),
|
|
10611
|
-
"talk-btn": () => shown2("talk-badge", "act-badge") + shown2("talk-at", "talk-at")
|
|
10820
|
+
"talk-btn": () => shown2("talk-badge", "act-badge") + shown2("talk-at", "talk-at"),
|
|
10821
|
+
// who follows the reader (the owner's decision of 2026-10-20), as the name's mark says it
|
|
10822
|
+
who: () => {
|
|
10823
|
+
const said2 = document.getElementById("who-fol")?.getAttribute("aria-label");
|
|
10824
|
+
return said2 ? `<span class="more-fol">${said2}</span>` : "";
|
|
10825
|
+
}
|
|
10612
10826
|
};
|
|
10613
10827
|
this.pop.innerHTML = this.modes() + ITEMS.map(({ id, label: l2 }) => {
|
|
10614
10828
|
if (document.getElementById(id)?.hidden) return "";
|
|
@@ -10733,7 +10947,8 @@ var FOLLOWED = [
|
|
|
10733
10947
|
part: "tool",
|
|
10734
10948
|
what: "the tool: Selection, Rests on and its step, Used by",
|
|
10735
10949
|
fields: ["mode"],
|
|
10736
|
-
|
|
10950
|
+
// a phone's ⋯ holds the modes too (PhoneSpec decision 7): its items press #lightup's buttons
|
|
10951
|
+
changes: "#lightup, #more-pop [data-mode-for]",
|
|
10737
10952
|
keys: ["1", "2", "3"],
|
|
10738
10953
|
place: true
|
|
10739
10954
|
},
|
|
@@ -10791,7 +11006,7 @@ var FOLLOWED = [
|
|
|
10791
11006
|
part: "activity",
|
|
10792
11007
|
what: "Activity: open or closed, and its filters",
|
|
10793
11008
|
fields: ["activity"],
|
|
10794
|
-
changes: "#activity-btn, #activity .act-filters",
|
|
11009
|
+
changes: "#activity-btn, #more-pop [data-for=activity-btn], #activity .act-filters",
|
|
10795
11010
|
reads: "#activity"
|
|
10796
11011
|
},
|
|
10797
11012
|
{
|
|
@@ -10803,7 +11018,7 @@ var FOLLOWED = [
|
|
|
10803
11018
|
},
|
|
10804
11019
|
{
|
|
10805
11020
|
part: "colouring",
|
|
10806
|
-
what: "the colouring: the legend's Kind or
|
|
11021
|
+
what: "the colouring: the legend's Kind, Status or Mine (the followed reader's own review)",
|
|
10807
11022
|
fields: ["scheme"],
|
|
10808
11023
|
changes: "#legend [data-scheme]",
|
|
10809
11024
|
keys: ["c"]
|
|
@@ -10822,6 +11037,16 @@ var FOLLOWED = [
|
|
|
10822
11037
|
changes: "#linear-btn",
|
|
10823
11038
|
keys: ["o"]
|
|
10824
11039
|
},
|
|
11040
|
+
{
|
|
11041
|
+
part: "export",
|
|
11042
|
+
what: "the Export window (ExportSpec decision 5; followed, the owner's decision of 2026-10-20): open or closed, which view it exports and what its document holds, its settings, title and author line, and the document typeset \u2014 Generate's progress, the downloads",
|
|
11043
|
+
fields: ["export"],
|
|
11044
|
+
// the bar's button, and a phone's ⋯ item for it, open or close it; every control in it changes it
|
|
11045
|
+
// or acts on what it shows (a setting, Generate, a download, Close) — a check's words too, which
|
|
11046
|
+
// press its box
|
|
11047
|
+
changes: "#export-btn, #more-pop [data-for=export-btn], #export-modal .ex-check",
|
|
11048
|
+
reads: "#export-modal"
|
|
11049
|
+
},
|
|
10825
11050
|
{
|
|
10826
11051
|
part: "artwork",
|
|
10827
11052
|
what: "the artwork mode (ExportSpec decision 19): on or off, its settings \u2014 the board drawn with them, the names and targets ticked \u2014 and what its frame holds",
|
|
@@ -10837,7 +11062,10 @@ var YOURS = [
|
|
|
10837
11062
|
{ id: "windowPlaces", what: "where windows sit and how big they are (a drag on a title bar presses no control; the edges resize)", where: ".fl-rz" },
|
|
10838
11063
|
{ id: "scroll", what: "scroll positions: the wheel off the canvas, a scrollbar" },
|
|
10839
11064
|
{ id: "sections", what: "folded sections of the side panel, the panel and the lost-and-found", where: "[data-sec], #lostfound .lf-archived > summary" },
|
|
10840
|
-
{ id: "tcbOrder", what: "the TCB list's order", where: "[data-tcb-order]" },
|
|
11065
|
+
{ id: "tcbOrder", what: "the TCB list's order, and what of it is kept to by the reader's own review", where: "[data-tcb-order], [data-q-own]" },
|
|
11066
|
+
// the review box's opinions all folded or all shown (ReviewSpec, "One review box", the owner's
|
|
11067
|
+
// decision of 2026-10-20), a reading preference, and What changed under a stale one opened
|
|
11068
|
+
{ id: "opinions", what: "the review box's opinions, all folded or all shown, and What changed under a stale one", where: "[data-rv-fold], [data-rv-changes] > summary" },
|
|
10841
11069
|
{ id: "outline", what: "the outline's levels opened", where: "#outline .tw" },
|
|
10842
11070
|
{ id: "whatChanged", what: `"What changed" opened: the Time Machine's counts and the lists they open`, where: "#tmbar .tm-sum, [data-tm-list], #tm-list" },
|
|
10843
11071
|
{ id: "legend", what: "the legend folded or open", where: "#legend" },
|
|
@@ -10849,7 +11077,6 @@ var YOURS = [
|
|
|
10849
11077
|
// reader's own next drag; what they select on a page is reading, which ends nothing
|
|
10850
11078
|
{ id: "paperTools", what: "zoom, find and the box tool in the reference window", where: "[data-pw-zoom], [data-pw-find], [data-pw-box], .pw-find" },
|
|
10851
11079
|
{ id: "share", what: "Share, and its switch Exactly what I see", where: "#share-btn, #share-pop" },
|
|
10852
|
-
{ id: "export", what: "Export", where: "#export-btn, #export-modal" },
|
|
10853
11080
|
{ id: "help", what: "Help: the ? menu and its sheet, its tips and its keys, the tour, a tip in place, What's new, the welcome of a first visit (GuideSpec)", where: "#help-btn, #help-menu, #help, #tour, #intip, #whatsnew, #welcome, [data-tip-open]", keys: ["?"] },
|
|
10854
11081
|
// the tour film in the sheet (GuideSpec decision 6, web/src/tourfilm.ts): its keys play it, go
|
|
10855
11082
|
// from chapter to chapter, turn its captions on or off, there alone
|
|
@@ -10876,15 +11103,21 @@ var YOURS = [
|
|
|
10876
11103
|
{ id: "conversation", what: "the conversation window \u2014 its channels, its thread, its box, a link to what you see \u2014, the conversation button and a mention's notice", where: "#convo, #talk-btn, #talk-notice", whole: true },
|
|
10877
11104
|
{ id: "followingStrip", what: "the following strip: whom you follow, and its \u2715", where: "#following", whole: true },
|
|
10878
11105
|
{ id: "hoverCards", what: "hover cards", where: ".hcard" },
|
|
11106
|
+
// the downloads of a followed reader's Export window (the owner's decision of 2026-10-21): taking
|
|
11107
|
+
// the file is reading, as copying text is; every other control of the window ends following
|
|
11108
|
+
{ id: "exportDownloads", what: "the downloads the Export window offers: the PDF, the LaTeX sources, the .tex and the .sty", where: "#export-modal .ex-dl a" },
|
|
11109
|
+
// a pointer of the room scrolled away (the owner's decisions of 2026-10-20): its mark at the edge of
|
|
11110
|
+
// what holds it scrolls the reader's own view there; scrolling is never followed
|
|
11111
|
+
{ id: "pointerMarks", what: "the mark at the edge of a panel or window where another's pointer is scrolled away, which scrolls there", where: ".ptr-edge" },
|
|
10879
11112
|
{ id: "pointer", what: "the pointer's highlight" },
|
|
10880
11113
|
{ id: "meter", what: "the frame meter", keys: ["p"] }
|
|
10881
11114
|
];
|
|
10882
|
-
var BOOKKEEPING = ["tabs"];
|
|
11115
|
+
var BOOKKEEPING = ["tabs", "following"];
|
|
10883
11116
|
function followedOf(read2) {
|
|
10884
11117
|
return Object.assign({}, ...FOLLOWED.map((p2) => read2[p2.part]()));
|
|
10885
11118
|
}
|
|
10886
|
-
function presenceOf(read2, tabs) {
|
|
10887
|
-
return { ...followedOf(read2), tabs };
|
|
11119
|
+
function presenceOf(read2, tabs, following = null) {
|
|
11120
|
+
return { ...followedOf(read2), tabs, ...following ? { following } : {} };
|
|
10888
11121
|
}
|
|
10889
11122
|
function applyOwn(v2, apply) {
|
|
10890
11123
|
for (const p2 of FOLLOWED) {
|
|
@@ -10969,14 +11202,26 @@ function openKey(key) {
|
|
|
10969
11202
|
if (key === "ArrowUp") return -1;
|
|
10970
11203
|
return null;
|
|
10971
11204
|
}
|
|
11205
|
+
function followersCount(f2) {
|
|
11206
|
+
const n3 = f2.names.length + f2.private;
|
|
11207
|
+
return n3 ? `${n3} follow${n3 === 1 ? "s" : ""} you` : null;
|
|
11208
|
+
}
|
|
11209
|
+
function followersLine(f2) {
|
|
11210
|
+
return [...f2.names, ...f2.private ? [`+${f2.private} private`] : []].join(", ");
|
|
11211
|
+
}
|
|
10972
11212
|
var ASK_ALL = "Everyone here gets a request for 30 s.";
|
|
10973
11213
|
function menuHtml(h2) {
|
|
10974
11214
|
const name = h2.name();
|
|
10975
11215
|
const vis = h2.visibility();
|
|
10976
11216
|
const person = h2.mode() === "person";
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
11217
|
+
const f2 = h2.followers?.();
|
|
11218
|
+
const said2 = f2 ? followersCount(f2) : null;
|
|
11219
|
+
return (
|
|
11220
|
+
// who follows this reader, which nothing to choose: a heading and a line
|
|
11221
|
+
(said2 ? `<div class="wm-h" id="wm-fol">${said2}</div><div class="wm-note wm-fol" aria-labelledby="wm-fol">${escapeHtml(followersLine(f2))}</div><div class="wm-sep" role="separator"></div>` : "") + (h2.mode() === "header" ? `<div class="wm-note">${name ? `Signed in as <b>${escapeHtml(name)}</b>` : "Not signed in"}: your name is the sign-in's, in front of this server.</div>` : `<button type="button" role="menuitem" class="wm-item" data-act="rename"><span class="wm-t">${name ? "Change name\u2026" : "Set your name\u2026"}</span>` + (person ? `<span class="wm-d">${VERIFIED} You came by a personal link: the name is yours, and what you did stays yours when you change it.</span>` : "") + `</button>`) + (person && h2.myLink ? `<button type="button" role="menuitem" class="wm-item" data-act="mylink"><span class="wm-t">My personal link\u2026</span><span class="wm-d">To open this site as you in another browser.</span></button>` : "") + (h2.askAll ? askItem(h2.askWhy?.() ?? null) : "") + `<div class="wm-sep" role="separator"></div><div class="wm-h" id="wm-vis">Visibility</div><div role="group" aria-labelledby="wm-vis">` + CHOICES.map(
|
|
11222
|
+
(c3) => `<button type="button" role="menuitemradio" aria-checked="${c3.key === vis}" class="wm-item wm-radio" data-act="vis" data-vis="${c3.key}"><span class="wm-t">${c3.title}</span><span class="wm-d">${c3.line}</span></button>`
|
|
11223
|
+
).join("") + `</div>`
|
|
11224
|
+
);
|
|
10980
11225
|
}
|
|
10981
11226
|
function askItem(why) {
|
|
10982
11227
|
return `<button type="button" role="menuitem" class="wm-item" data-act="ask"${why ? ' aria-disabled="true"' : ""}><span class="wm-t">Ask everyone to follow me</span><span class="wm-d">${escapeHtml(why ?? ASK_ALL)}</span></button>`;
|
|
@@ -11100,9 +11345,14 @@ function acts(e2) {
|
|
|
11100
11345
|
}
|
|
11101
11346
|
var READ_ONLY = "This page is read-only: it changes nothing that is shared.";
|
|
11102
11347
|
var $3 = (sel) => document.querySelector(sel);
|
|
11103
|
-
function
|
|
11104
|
-
|
|
11348
|
+
function followerKeys(peers, me) {
|
|
11349
|
+
const out = /* @__PURE__ */ new Set();
|
|
11350
|
+
if (!me) return out;
|
|
11351
|
+
const mine = personKey(me);
|
|
11352
|
+
for (const p2 of peers) if (!p2.agent && p2.id !== me.id && p2.view?.following === mine) out.add(personKey(p2));
|
|
11353
|
+
return out;
|
|
11105
11354
|
}
|
|
11355
|
+
var FOLLOWED_MARK = `<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><circle cx="8" cy="5.2" r="2.6" fill="currentColor"/><path d="M3.2 13.6c.5-2.9 2.4-4.5 4.8-4.5s4.3 1.6 4.8 4.5" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>`;
|
|
11106
11356
|
function newSession() {
|
|
11107
11357
|
const b2 = crypto.getRandomValues(new Uint8Array(16));
|
|
11108
11358
|
return [...b2].map((x2) => x2.toString(16).padStart(2, "0")).join("");
|
|
@@ -11143,6 +11393,16 @@ var People = class {
|
|
|
11143
11393
|
hidden;
|
|
11144
11394
|
/** how many private readers the server counts: this page among them once its hello says so */
|
|
11145
11395
|
privateAll = 0;
|
|
11396
|
+
/** how many of them follow this reader, as the server counts them for this page */
|
|
11397
|
+
privateFollowers = 0;
|
|
11398
|
+
/** someone unseen (a read-only reader) follows this reader: shown nowhere, but the pointer is sent
|
|
11399
|
+
* for them (the owner's decision of 2026-10-21) */
|
|
11400
|
+
unseen = false;
|
|
11401
|
+
/** this page as the server lists it, with the others: null while it is not listed (private,
|
|
11402
|
+
* read-only, before its first heartbeat) */
|
|
11403
|
+
me = null;
|
|
11404
|
+
/** who follows this reader, as last drawn: the name is drawn again when it changes */
|
|
11405
|
+
followersDrawn = "";
|
|
11146
11406
|
menu;
|
|
11147
11407
|
/** the personal link this reader came by, shown to them in the name's window */
|
|
11148
11408
|
myLink;
|
|
@@ -11166,7 +11426,8 @@ var People = class {
|
|
|
11166
11426
|
// offered where the reader came by a personal link alone (the menu asks the mode)
|
|
11167
11427
|
myLink: () => void this.myLink.open(),
|
|
11168
11428
|
setVisibility: (v2) => this.setPrivate(v2 === "private"),
|
|
11169
|
-
...hooks.askAll ? { askAll: () => hooks.askAll(), askWhy: () => hooks.askWhy?.() ?? null } : {}
|
|
11429
|
+
...hooks.askAll ? { askAll: () => hooks.askAll(), askWhy: () => hooks.askWhy?.() ?? null } : {},
|
|
11430
|
+
followers: () => this.followers()
|
|
11170
11431
|
});
|
|
11171
11432
|
}
|
|
11172
11433
|
// ---------------------------------------------------------------- who this reader is
|
|
@@ -11245,18 +11506,57 @@ var People = class {
|
|
|
11245
11506
|
this.renderMe();
|
|
11246
11507
|
this.renderPeers();
|
|
11247
11508
|
this.beat();
|
|
11509
|
+
this.hooks.roomChanged?.();
|
|
11248
11510
|
}
|
|
11249
11511
|
renderMe() {
|
|
11250
11512
|
const who = $3("#who");
|
|
11251
11513
|
who.hidden = this.mode === "none";
|
|
11252
|
-
|
|
11514
|
+
const f2 = this.followers();
|
|
11515
|
+
const said2 = followersCount(f2);
|
|
11516
|
+
const line = followersLine(f2);
|
|
11517
|
+
const mark = said2 ? `<span class="who-fol" id="who-fol" aria-label="${escapeHtml(said2)}">${FOLLOWED_MARK}<b>${f2.names.length + f2.private}</b></span>` : "";
|
|
11518
|
+
this.followersDrawn = this.followersSig(f2);
|
|
11519
|
+
who.innerHTML = `<span class="who-n">${escapeHtml(this.name ?? (this.mode === "header" ? "Not signed in" : "Set your name"))}</span>` + (this.mode === "person" ? VERIFIED : "") + (this.hidden ? HIDDEN : "") + mark;
|
|
11253
11520
|
who.classList.toggle("unset", !this.name);
|
|
11254
11521
|
who.classList.toggle("private", this.hidden);
|
|
11255
11522
|
who.style.setProperty("--me", this.name ? colorOf(this.name) : "var(--text-3)");
|
|
11256
11523
|
const records = this.hidden ? "Your opinions are recorded under this name; what you arrange, as someone's" : "Your opinions, pins and re-layouts are recorded under this name";
|
|
11257
|
-
who.title = (this.hidden ? "Private: the others see only that someone is here. " : "") + (this.mode === "header" ? "Your name, as the sign-in in front of this server gives it \u2014 click for your visibility" : this.mode === "person" ? `${records}; you came by a personal link, so it is yours (\u2713) \u2014 click to change it, or your visibility` : this.name ? `${records} \u2014 click to change it, or your visibility` : "Give the name your opinions are recorded under \u2014 click to give it, or for your visibility");
|
|
11524
|
+
who.title = (this.hidden ? "Private: the others see only that someone is here. " : "") + (this.mode === "header" ? "Your name, as the sign-in in front of this server gives it \u2014 click for your visibility" : this.mode === "person" ? `${records}; you came by a personal link, so it is yours (\u2713) \u2014 click to change it, or your visibility` : this.name ? `${records} \u2014 click to change it, or your visibility` : "Give the name your opinions are recorded under \u2014 click to give it, or for your visibility") + (said2 ? ` \xB7 ${said2}: ${line}` : "");
|
|
11258
11525
|
this.menu.render();
|
|
11259
11526
|
}
|
|
11527
|
+
/** Who follows this reader (the owner's decision of 2026-10-20): the people, named as the page
|
|
11528
|
+
* names them, and the private readers the server counts; nobody, while this reader is private. */
|
|
11529
|
+
followers() {
|
|
11530
|
+
if (this.hidden) return { names: [], private: 0 };
|
|
11531
|
+
const keys = followerKeys(this.peers, this.me);
|
|
11532
|
+
return {
|
|
11533
|
+
names: this.people().filter((p2) => keys.has(p2.key)).map((p2) => p2.name ? this.nameOf(p2) : "a reader without a name"),
|
|
11534
|
+
private: this.privateFollowers
|
|
11535
|
+
};
|
|
11536
|
+
}
|
|
11537
|
+
followersSig(f2) {
|
|
11538
|
+
return JSON.stringify(f2);
|
|
11539
|
+
}
|
|
11540
|
+
/** Whom this page follows changed: the server is told at once — by a private page too, whose
|
|
11541
|
+
* heartbeat says only that — so that the reader it follows sees it. */
|
|
11542
|
+
toldFollowing() {
|
|
11543
|
+
if (this.hidden) void this.beat();
|
|
11544
|
+
else this.report();
|
|
11545
|
+
this.hooks.roomChanged?.();
|
|
11546
|
+
}
|
|
11547
|
+
/** This page as the server lists it: null while it is not listed (private, read-only, before its
|
|
11548
|
+
* first heartbeat). */
|
|
11549
|
+
get listed() {
|
|
11550
|
+
return this.me;
|
|
11551
|
+
}
|
|
11552
|
+
/** How many private readers follow this reader, as the server counts them. */
|
|
11553
|
+
get privateFollowing() {
|
|
11554
|
+
return this.privateFollowers;
|
|
11555
|
+
}
|
|
11556
|
+
/** Whether someone unseen — a read-only reader — follows this reader: never who nor how many. */
|
|
11557
|
+
get unseenFollowing() {
|
|
11558
|
+
return this.unseen;
|
|
11559
|
+
}
|
|
11260
11560
|
/** The name's window, from the menu under it: give the name, or change it. */
|
|
11261
11561
|
async whoClicked() {
|
|
11262
11562
|
await this.ready;
|
|
@@ -11393,7 +11693,7 @@ var People = class {
|
|
|
11393
11693
|
if (this.wait) clearTimeout(this.wait);
|
|
11394
11694
|
this.wait = null;
|
|
11395
11695
|
if (!this.stream) return Promise.resolve();
|
|
11396
|
-
return this.data.presence(this.stream.token, this.hidden ? { private: true } : { view: this.hooks.view(), idle: this.idle });
|
|
11696
|
+
return this.data.presence(this.stream.token, this.hidden ? { private: true, following: this.followed?.key ?? null } : { view: this.hooks.view(), idle: this.idle });
|
|
11397
11697
|
}
|
|
11398
11698
|
/** The event stream (re)connected and was named, or was named afresh as this page went private or
|
|
11399
11699
|
* visible: the others are told where this page is at once, under its new id, without waiting for
|
|
@@ -11410,10 +11710,19 @@ var People = class {
|
|
|
11410
11710
|
});
|
|
11411
11711
|
return told;
|
|
11412
11712
|
}
|
|
11413
|
-
/** How many private readers the server counts (CollabSpec decision 8)
|
|
11414
|
-
|
|
11415
|
-
|
|
11713
|
+
/** How many private readers the server counts (CollabSpec decision 8), and how many of them follow
|
|
11714
|
+
* this reader. */
|
|
11715
|
+
setPrivateCount(p2) {
|
|
11716
|
+
this.privateAll = p2.count;
|
|
11717
|
+
this.privateFollowers = p2.followers ?? 0;
|
|
11718
|
+
this.unseen = p2.unseen === true;
|
|
11416
11719
|
this.renderPeers();
|
|
11720
|
+
this.followersChanged();
|
|
11721
|
+
this.hooks.roomChanged?.();
|
|
11722
|
+
}
|
|
11723
|
+
/** The name drawn again where who follows this reader changed. */
|
|
11724
|
+
followersChanged() {
|
|
11725
|
+
if (this.followersSig(this.followers()) !== this.followersDrawn) this.renderMe();
|
|
11417
11726
|
}
|
|
11418
11727
|
/** The private readers but this one: the server counts this page too once its hello says so. */
|
|
11419
11728
|
get privateOthers() {
|
|
@@ -11422,8 +11731,11 @@ var People = class {
|
|
|
11422
11731
|
/** The list of pages, as the server sends it. */
|
|
11423
11732
|
setPeers(all) {
|
|
11424
11733
|
this.peers = all.filter((p3) => p3.id !== this.stream?.id);
|
|
11734
|
+
this.me = all.find((p3) => p3.id === this.stream?.id) ?? null;
|
|
11425
11735
|
this.renderPeers();
|
|
11736
|
+
this.followersChanged();
|
|
11426
11737
|
this.hooks.changed();
|
|
11738
|
+
this.hooks.roomChanged?.();
|
|
11427
11739
|
if (!this.followed) return;
|
|
11428
11740
|
const p2 = this.people().find((x2) => x2.key === this.followed.key);
|
|
11429
11741
|
if (!p2) {
|
|
@@ -11476,6 +11788,8 @@ var People = class {
|
|
|
11476
11788
|
const box = $3("#peers");
|
|
11477
11789
|
const all = this.people();
|
|
11478
11790
|
const hidden = this.privateOthers;
|
|
11791
|
+
const following = this.hidden ? /* @__PURE__ */ new Set() : followerKeys(this.peers, this.me);
|
|
11792
|
+
const me = this.name ? colorOf(this.name) : "var(--accent)";
|
|
11479
11793
|
box.hidden = all.length === 0 && hidden === 0;
|
|
11480
11794
|
const shown2 = all.slice(0, initialsShown(all.length, hidden > 0, isPhone()));
|
|
11481
11795
|
box.innerHTML = shown2.map((p2) => {
|
|
@@ -11485,14 +11799,15 @@ var People = class {
|
|
|
11485
11799
|
const talk = s2.talk ? ` \xB7 ${stateWords(s2.talk)}` : "";
|
|
11486
11800
|
const ask = p2.agent ? null : this.hooks.asked?.(p2) ?? null;
|
|
11487
11801
|
const does = !this.hooks.menu ? "click to follow" : p2.agent ? `click to follow${s2.talk ? " or talk with it" : " it"}` : "click to follow, or to ask them to follow you";
|
|
11488
|
-
const
|
|
11802
|
+
const fol = following.has(p2.key);
|
|
11803
|
+
const tip = `${who}${where ? ` \u2014 ${where}` : ""}${s2.idle && !s2.talk ? " \xB7 away" : ""}${talk}${fol ? " \xB7 follows you" : ""}${ask ? ` \xB7 ${ask.tip}` : ""} \xB7 ${does}`;
|
|
11489
11804
|
const on = this.followed?.key === p2.key ? " on" : "";
|
|
11490
11805
|
const bot = p2.agent ? `<span class="peer-bot">${BOT}</span>` : p2.verified ? `<span class="peer-vf" aria-hidden="true">\u2713</span>` : "";
|
|
11491
11806
|
const dot = s2.talk ? `<span class="peer-dot st-${s2.talk.state}"></span>` : "";
|
|
11492
|
-
const mark = ask ? `<span class="peer-ask ${ask.cls}" aria-hidden="true">${ask.glyph}</span>` : "";
|
|
11807
|
+
const mark = (ask ? `<span class="peer-ask ${ask.cls}" aria-hidden="true">${ask.glyph}</span>` : "") + (fol ? `<span class="peer-fol" style="--me:${me}" aria-hidden="true">${FOLLOWED_MARK}</span>` : "");
|
|
11493
11808
|
const state = s2.talk?.state === "offline" ? " offline" : s2.idle ? " idle" : "";
|
|
11494
11809
|
const menu = !this.hooks.menu ? "" : ` aria-haspopup="menu"`;
|
|
11495
|
-
return `<button class="peer${p2.agent ? " agent" : p2.verified ? " verified" : ""}${state}${on}${ask ? " asked" : ""}" data-person="${escapeHtml(p2.key)}" style="--c:${this.colorOf(p2)}" title="${escapeHtml(tip)}"${menu}>${escapeHtml(this.label(p2))}${bot}${dot}${mark}</button>`;
|
|
11810
|
+
return `<button class="peer${p2.agent ? " agent" : p2.verified ? " verified" : ""}${state}${on}${ask ? " asked" : ""}${fol ? " follows" : ""}" data-person="${escapeHtml(p2.key)}" style="--c:${this.colorOf(p2)}" title="${escapeHtml(tip)}"${menu}>${escapeHtml(this.label(p2))}${bot}${dot}${mark}</button>`;
|
|
11496
11811
|
}).join("") + (all.length > shown2.length ? `<span class="peer more" title="${escapeHtml(all.slice(shown2.length).map((p2) => this.nameOf(p2)).join(", "))}">+${all.length - shown2.length}</span>` : "") + // the private readers, counted: nothing else is known of them (CollabSpec decision 8); on a
|
|
11497
11812
|
// phone the count alone, dashed
|
|
11498
11813
|
(hidden ? `<span class="peer-private" title="${hidden === 1 ? "1 reader is" : `${hidden} readers are`} here privately: not listed, and cannot be followed">+${hidden}<span class="pv-word"> private</span></span>` : "");
|
|
@@ -11505,6 +11820,7 @@ var People = class {
|
|
|
11505
11820
|
if (this.followed) this.hooks.unfollowed();
|
|
11506
11821
|
this.followed = { key, name: this.nameOf(p2) };
|
|
11507
11822
|
this.applied = "";
|
|
11823
|
+
this.toldFollowing();
|
|
11508
11824
|
const box = $3("#following");
|
|
11509
11825
|
box.style.setProperty("--c", this.colorOf(p2));
|
|
11510
11826
|
this.renderStrip(p2.agent);
|
|
@@ -11519,6 +11835,7 @@ var People = class {
|
|
|
11519
11835
|
this.followed = null;
|
|
11520
11836
|
document.body.classList.remove("following");
|
|
11521
11837
|
this.hooks.unfollowed();
|
|
11838
|
+
this.toldFollowing();
|
|
11522
11839
|
this.renderPeers();
|
|
11523
11840
|
const box = $3("#following");
|
|
11524
11841
|
if (box.contains(document.activeElement)) document.activeElement.blur();
|
|
@@ -11973,16 +12290,16 @@ function setKey(g2, set) {
|
|
|
11973
12290
|
}
|
|
11974
12291
|
return `${count2}.${sum.toString(36)}.${mix.toString(36)}`;
|
|
11975
12292
|
}
|
|
11976
|
-
function boardSet(g2, review, scope2) {
|
|
11977
|
-
const set = evaluate(scope2, { g: g2, review });
|
|
12293
|
+
function boardSet(g2, review, scope2, me = null) {
|
|
12294
|
+
const set = evaluate(scope2, { g: g2, review, me });
|
|
11978
12295
|
let own2 = 0, ext = 0;
|
|
11979
12296
|
for (let i2 = 0; i2 < g2.n; i2++) if (set[i2]) i2 < g2.projectCount ? own2++ : ext++;
|
|
11980
12297
|
const outsideAll = ext === g2.n - g2.projectCount;
|
|
11981
12298
|
const whole2 = own2 === g2.projectCount && g2.projectCount > 0 && (ext === 0 || outsideAll);
|
|
11982
12299
|
return { set, key: setKey(g2, set), count: own2 + ext, whole: whole2, outside: whole2 && ext > 0, sub: whole2 ? null : subgraph(g2, set) };
|
|
11983
12300
|
}
|
|
11984
|
-
function lightUp(g2, review, bs, q2) {
|
|
11985
|
-
const full = evaluate(q2, { g: g2, review });
|
|
12301
|
+
function lightUp(g2, review, bs, q2, me = null) {
|
|
12302
|
+
const full = evaluate(q2, { g: g2, review, me });
|
|
11986
12303
|
let total = 0, count2 = 0;
|
|
11987
12304
|
if (!bs.sub) {
|
|
11988
12305
|
const every = bs.count === g2.n;
|
|
@@ -12512,7 +12829,7 @@ var Views = class {
|
|
|
12512
12829
|
const preview = this.hooks.preview?.(rec, past?.past ?? null) ?? false;
|
|
12513
12830
|
const have = this.boards.get(id);
|
|
12514
12831
|
if (have && have.scope === scope2 && have.full === full && have.preview === preview) return have;
|
|
12515
|
-
return this.make(id, rec, scope2, boardSet(full, this.reviewOf(past), rec.scope), past, preview);
|
|
12832
|
+
return this.make(id, rec, scope2, boardSet(full, this.reviewOf(past), rec.scope, this.hooks.me?.() ?? null), past, preview);
|
|
12516
12833
|
}
|
|
12517
12834
|
/** The review as a board of `past` (null: the graph on show) reads it: by its names then too. */
|
|
12518
12835
|
reviewOf(past) {
|
|
@@ -12592,7 +12909,7 @@ var Views = class {
|
|
|
12592
12909
|
b2.from[mode] = mem?.set ?? null;
|
|
12593
12910
|
if (next && !b2.preview) b2.made[mode] = next;
|
|
12594
12911
|
else delete b2.made[mode];
|
|
12595
|
-
if (!next || tries >= 2 || b2.preview || this.hooks.handsOver?.() === false) return made2(layout);
|
|
12912
|
+
if (!next || tries >= 2 || b2.preview || this.hooks.handsOver?.() === false || readsMine(b2.rec.scope)) return made2(layout);
|
|
12596
12913
|
const r2 = await this.api.post("memory", { id: b2.id, mode, base: mem?.set ?? null, memory: next });
|
|
12597
12914
|
if (r2.accepted || r2.error) {
|
|
12598
12915
|
if (r2.accepted) {
|
|
@@ -12644,14 +12961,15 @@ var Views = class {
|
|
|
12644
12961
|
graphChanged() {
|
|
12645
12962
|
this.boards.clear();
|
|
12646
12963
|
}
|
|
12647
|
-
/** The review changed: boards whose scope reads it are
|
|
12964
|
+
/** The review changed, or whose own review `mine(…)` reads: boards whose scope reads it are
|
|
12965
|
+
* computed again; the ids of those whose
|
|
12648
12966
|
* set changed. A board whose set stays is the same board, layouts and all, so that one drawn
|
|
12649
12967
|
* or being laid out is not replaced by an equal one (a redraw waiting for it would be lost). */
|
|
12650
12968
|
reviewChanged() {
|
|
12651
12969
|
const out = [];
|
|
12652
12970
|
for (const [id, b2] of [...this.boards]) {
|
|
12653
12971
|
if (!readsReview(b2.rec.scope)) continue;
|
|
12654
|
-
const bs = boardSet(b2.full, this.reviewOf(b2.past ?? null), b2.rec.scope);
|
|
12972
|
+
const bs = boardSet(b2.full, this.reviewOf(b2.past ?? null), b2.rec.scope, this.hooks.me?.() ?? null);
|
|
12655
12973
|
if (bs.key === b2.bs.key) continue;
|
|
12656
12974
|
this.make(id, b2.rec, printQuery(b2.rec.scope), bs, b2.past ?? null, b2.preview);
|
|
12657
12975
|
out.push(id);
|
|
@@ -13140,11 +13458,11 @@ var TimeMachine = class {
|
|
|
13140
13458
|
* reads the review (which changes in place). */
|
|
13141
13459
|
boardOfNow(rec) {
|
|
13142
13460
|
const now = this.hooks.present();
|
|
13143
|
-
if (readsReview(rec.scope)) return boardSet(now, this.hooks.review(), rec.scope);
|
|
13461
|
+
if (readsReview(rec.scope)) return boardSet(now, this.hooks.review(), rec.scope, this.hooks.me?.() ?? null);
|
|
13144
13462
|
this.sameNow(now);
|
|
13145
13463
|
const k2 = printQuery(rec.scope);
|
|
13146
13464
|
let bs = this.nowBoards.get(k2);
|
|
13147
|
-
if (!bs) this.nowBoards.set(k2, bs = boardSet(now, this.hooks.review(), rec.scope));
|
|
13465
|
+
if (!bs) this.nowBoards.set(k2, bs = boardSet(now, this.hooks.review(), rec.scope, this.hooks.me?.() ?? null));
|
|
13148
13466
|
return bs;
|
|
13149
13467
|
}
|
|
13150
13468
|
/** A build's board laid out for the view on show, as the views will ask for it when it is shown:
|
|
@@ -13153,7 +13471,7 @@ var TimeMachine = class {
|
|
|
13153
13471
|
const b2 = this.hooks.board();
|
|
13154
13472
|
if (!b2) return null;
|
|
13155
13473
|
const mode = b2.rec.clustering;
|
|
13156
|
-
const bs = boardSet(past.graph, reviewThen(this.hooks.review(), past.nowName), b2.rec.scope);
|
|
13474
|
+
const bs = boardSet(past.graph, reviewThen(this.hooks.review(), past.nowName), b2.rec.scope, this.hooks.me?.() ?? null);
|
|
13157
13475
|
const graph = bs.sub ? bs.sub.graph : past.graph;
|
|
13158
13476
|
const mem = await this.memoryOf(b2.rec, mode);
|
|
13159
13477
|
if (mem?.set === pastSetKey(past.snapshot.id, layoutKey(bs.key, b2.rec.hidden[mode]))) return null;
|
|
@@ -13700,6 +14018,8 @@ async function viewsPart(page) {
|
|
|
13700
14018
|
handsOver: () => page.handsOver(),
|
|
13701
14019
|
meta: () => page.meta,
|
|
13702
14020
|
review: () => page.review.data,
|
|
14021
|
+
// whose own review mine(…) reads: the reader's, or whom they follow (web/src/pagescheme.ts)
|
|
14022
|
+
me: () => page.mineAuthor?.() ?? null,
|
|
13703
14023
|
// a view in the Time Machine, or kept at a past build, shows that build's graph; at another build
|
|
13704
14024
|
// than its own, it is a preview
|
|
13705
14025
|
past: (rec) => data.snapshot ? null : tm.sourceFor(rec),
|
|
@@ -13733,6 +14053,7 @@ async function viewsPart(page) {
|
|
|
13733
14053
|
present: () => page.present,
|
|
13734
14054
|
meta: () => page.meta,
|
|
13735
14055
|
review: () => page.review.data,
|
|
14056
|
+
me: () => page.mineAuthor?.() ?? null,
|
|
13736
14057
|
board: () => nav.board ?? null,
|
|
13737
14058
|
title: (id) => views.title(id),
|
|
13738
14059
|
tip: (id) => views.tip(id),
|
|
@@ -14021,10 +14342,10 @@ function binderNames(binders) {
|
|
|
14021
14342
|
if (depth++ === 0) start = k2 + 1;
|
|
14022
14343
|
} else if (close.includes(ch) && depth > 0) {
|
|
14023
14344
|
if (--depth === 0) {
|
|
14024
|
-
const
|
|
14025
|
-
const colon = topColon(
|
|
14345
|
+
const inside3 = binders.slice(start, k2);
|
|
14346
|
+
const colon = topColon(inside3);
|
|
14026
14347
|
if (colon >= 0) {
|
|
14027
|
-
for (const w2 of
|
|
14348
|
+
for (const w2 of inside3.slice(0, colon).trim().split(/\s+/)) if (w2 && w2 !== "_" && IDENT.test(w2)) names2.push(w2);
|
|
14028
14349
|
}
|
|
14029
14350
|
}
|
|
14030
14351
|
}
|
|
@@ -14043,11 +14364,11 @@ function topColon(s2) {
|
|
|
14043
14364
|
return -1;
|
|
14044
14365
|
}
|
|
14045
14366
|
var escapeRe = (s2) => s2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14046
|
-
function usedVariables(lines,
|
|
14367
|
+
function usedVariables(lines, texts2, exact = false) {
|
|
14047
14368
|
if (exact) return new Set(lines.flatMap((l2, k2) => l2.used ? [k2] : []));
|
|
14048
14369
|
const occurs = (name) => {
|
|
14049
14370
|
const re = new RegExp(`(?<![\\p{L}\\p{N}_'!?.])${escapeRe(name)}(?![\\p{L}\\p{N}_'!?])`, "u");
|
|
14050
|
-
return
|
|
14371
|
+
return texts2.some((t2) => re.test(t2));
|
|
14051
14372
|
};
|
|
14052
14373
|
const used = /* @__PURE__ */ new Set();
|
|
14053
14374
|
const usedNames = /* @__PURE__ */ new Set();
|
|
@@ -14171,6 +14492,12 @@ function statusCounts(g2, d2, xs) {
|
|
|
14171
14492
|
}
|
|
14172
14493
|
|
|
14173
14494
|
// src/web/src/reviewqueue.ts
|
|
14495
|
+
var OWN_FILTERS = ["none", "stale", "commented"];
|
|
14496
|
+
var OWN_WORDS = {
|
|
14497
|
+
none: { label: "Not reviewed", title: "Only what you have given no opinion on (none, or one withdrawn)", note: "you have not reviewed" },
|
|
14498
|
+
stale: { label: "Stale", title: "Only where your opinion is on an earlier version: it changed since", note: "where your opinion is stale" },
|
|
14499
|
+
commented: { label: "Commented", title: "Only what your current opinion comments on", note: "you commented on" }
|
|
14500
|
+
};
|
|
14174
14501
|
function chainName(g2, i2) {
|
|
14175
14502
|
return g2.nodes[i2].name.split(".").slice(-2).join(".");
|
|
14176
14503
|
}
|
|
@@ -14322,15 +14649,27 @@ var ReviewFlow = class {
|
|
|
14322
14649
|
* where it is used; one the graph has no declaration for on the board is listed first, and goes
|
|
14323
14650
|
* to the target, whose panel approves it. `keyOnly` (◆ Key): the key declarations alone, in their
|
|
14324
14651
|
* order (shared/keys.ts, keySet) — the trusted ones first, marked trusted and unnumbered, since
|
|
14325
|
-
* they are not in the review order; then the rest, numbered as in the review order.
|
|
14326
|
-
|
|
14652
|
+
* they are not in the review order; then the rest, numbered as in the review order. `own`: only
|
|
14653
|
+
* those where the reader's own review stands so (OwnFilter), the trusted key declarations, which
|
|
14654
|
+
* need none, left out; the filter's switch heads the list where the reader has a name. */
|
|
14655
|
+
listHtml(root, keyOnly = false, own2 = null) {
|
|
14327
14656
|
const g2 = this.hooks.graph();
|
|
14328
14657
|
const d2 = this.hooks.review();
|
|
14329
14658
|
const q2 = this.queue(root);
|
|
14330
14659
|
const kg = this.keys(root);
|
|
14331
14660
|
const keys = new Set(kg.keys);
|
|
14332
|
-
const
|
|
14333
|
-
const
|
|
14661
|
+
const me = this.hooks.me?.() ?? null;
|
|
14662
|
+
const ownOf = (name, hash) => me ? ownStatus(d2, name, me, hash) : "none";
|
|
14663
|
+
const position0 = new Set(q2.order);
|
|
14664
|
+
const allOff = keyOnly ? [] : offBoard(q2);
|
|
14665
|
+
const allOrder = keyOnly ? kg.keys : q2.order;
|
|
14666
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
14667
|
+
for (const a3 of allOff) counts2.set(ownOf(a3.name, void 0), (counts2.get(ownOf(a3.name, void 0)) ?? 0) + 1);
|
|
14668
|
+
for (const i2 of allOrder) if (position0.has(i2)) counts2.set(ownOf(g2.nodes[i2].name, g2.nodes[i2].hash), (counts2.get(ownOf(g2.nodes[i2].name, g2.nodes[i2].hash)) ?? 0) + 1);
|
|
14669
|
+
const filter = me ? own2 : null;
|
|
14670
|
+
const keep2 = (name, hash) => filter === null || ownOf(name, hash) === filter;
|
|
14671
|
+
const off = allOff.filter((a3) => keep2(a3.name, void 0));
|
|
14672
|
+
const order = filter === null ? allOrder : allOrder.filter((i2) => position0.has(i2) && keep2(g2.nodes[i2].name, g2.nodes[i2].hash));
|
|
14334
14673
|
const position = new Map(q2.order.map((i2, k2) => [i2, k2]));
|
|
14335
14674
|
const offN = offBoard(q2).length;
|
|
14336
14675
|
const where = (a3) => a3.via.length ? ` \xB7 used in ${a3.via.map((j2) => chainName(g2, j2)).join(", ")}` : "";
|
|
@@ -14339,8 +14678,12 @@ var ReviewFlow = class {
|
|
|
14339
14678
|
(a3, k2) => `<button class="row q-row rv-${statusOf(d2, a3.name, void 0)}${this.axiomDone(a3) ? " q-mine" : ""}" data-walk="${root}" title="${escapeHtml(`${a3.name}: a non-standard axiom the target rests on, which the graph has no declaration for${where(a3)} \u2014 approve it or comment on it in the target's panel`)}"><span class="q-n">${k2 + 1}</span>axiom ${escapeHtml(a3.name)}<span class="muted">${escapeHtml(where(a3))}</span></button>`
|
|
14340
14679
|
);
|
|
14341
14680
|
const kp = this.keyProgress(root);
|
|
14342
|
-
const
|
|
14343
|
-
|
|
14681
|
+
const shown2 = order.length + off.length;
|
|
14682
|
+
const note = filter !== null ? shown2 ? `${shown2} of ${allOrder.filter((i2) => position0.has(i2)).length + allOff.length} ${OWN_WORDS[filter].note}, in review order.` : `Nothing here ${OWN_WORDS[filter].note}.` : keyOnly ? `The key declarations, \u25C6, ${kp.trusted ? `${kp.trusted} trusted first, needing no review, then the rest ` : ""}in review order: ${kp.approved} of ${kp.total} approved, ${this.keysLeft(root)} not yet reviewed by you.` : `Non-standard axioms first, then bottom-up: what a declaration uses comes before it; ${this.left(root)} of ${q2.order.length + offN} not yet reviewed by you.`;
|
|
14683
|
+
const switcher = me ? `<div class="q-own" role="group" aria-label="Only by your own review"><span class="muted">Yours:</span><span class="seg mini"><button data-q-own="" class="${filter === null ? "on" : ""}" aria-pressed="${filter === null}" title="Everything in the list">All</button>` + OWN_FILTERS.map(
|
|
14684
|
+
(f2) => `<button data-q-own="${f2}" class="${filter === f2 ? "on" : ""}" aria-pressed="${filter === f2}" title="${OWN_WORDS[f2].title}">${OWN_WORDS[f2].label} <span class="q-own-n">${counts2.get(f2) ?? 0}</span></button>`
|
|
14685
|
+
).join("") + `</span></div>` : "";
|
|
14686
|
+
return switcher + `<div class="q-note muted">${note}</div><div class="q-list">` + offRows.join("") + order.map((i2) => {
|
|
14344
14687
|
const v2 = g2.nodes[i2];
|
|
14345
14688
|
const at = position.get(i2);
|
|
14346
14689
|
if (at === void 0) {
|
|
@@ -14425,6 +14768,7 @@ function reviewPart(page) {
|
|
|
14425
14768
|
page.pastShown() ? Promise.resolve(PAST_REVIEW) : data.postReview(op).then(
|
|
14426
14769
|
(c3) => {
|
|
14427
14770
|
if (c3) takeChange(c3);
|
|
14771
|
+
else if (op.op === "opinion") return `${op.for ? `${op.for}'s` : "Your"} approval of this version stands already: nothing was recorded.`;
|
|
14428
14772
|
tipsOnReview(op);
|
|
14429
14773
|
return null;
|
|
14430
14774
|
},
|
|
@@ -14434,7 +14778,7 @@ function reviewPart(page) {
|
|
|
14434
14778
|
}
|
|
14435
14779
|
)
|
|
14436
14780
|
);
|
|
14437
|
-
const flow = new ReviewFlow({ graph: () => page.g, review: () => boardReview(), reader: () => page.people.name });
|
|
14781
|
+
const flow = new ReviewFlow({ graph: () => page.g, review: () => boardReview(), reader: () => page.people.name, me: () => page.readerAuthor() });
|
|
14438
14782
|
const flowNow = new ReviewFlow({ graph: () => page.present, review: () => page.review.data, reader: () => page.people.name });
|
|
14439
14783
|
const blocked = () => {
|
|
14440
14784
|
const me = page.people.name?.trim();
|
|
@@ -14486,6 +14830,14 @@ function reviewPart(page) {
|
|
|
14486
14830
|
ensureReviewer: () => page.people.ensure(),
|
|
14487
14831
|
submit,
|
|
14488
14832
|
said: (text2) => page.say(text2),
|
|
14833
|
+
// the opinions folded or shown, the reader's own, kept in this browser: every review box at once,
|
|
14834
|
+
// the panel's and each source window's
|
|
14835
|
+
opinionsShown: () => !store2.data.opinionsFolded,
|
|
14836
|
+
showOpinions: (shown2) => {
|
|
14837
|
+
store2.data.opinionsFolded = shown2 ? void 0 : true;
|
|
14838
|
+
store2.save();
|
|
14839
|
+
page.showSelected();
|
|
14840
|
+
},
|
|
14489
14841
|
queue: (i2) => flow.queue(i2),
|
|
14490
14842
|
progress: (i2) => flow.progress(i2),
|
|
14491
14843
|
reviewLens: (i2) => page.reviewTarget(i2),
|
|
@@ -14548,7 +14900,7 @@ function reviewPart(page) {
|
|
|
14548
14900
|
void submit({ op: "key", target, name: page.g.nodes[i2].name, on: !keyMarked(page.review.data, target, page.g.nodes[i2].name) }).then((why) => why && page.say(why));
|
|
14549
14901
|
});
|
|
14550
14902
|
};
|
|
14551
|
-
const litOn = (q2) => lightUp(page.nav.board.full, boardReview(), page.nav.board.bs, q2);
|
|
14903
|
+
const litOn = (q2) => lightUp(page.nav.board.full, boardReview(), page.nav.board.bs, q2, page.mineAuthor());
|
|
14552
14904
|
const zoomOf = (q2, lit = q2 && litOn(q2)) => q2 && lit && zoomScope(q2, page.nav.board.rec.scope, lit, page.nav.board.bs);
|
|
14553
14905
|
let approvedInFocus = 0;
|
|
14554
14906
|
const tipsOnReview = (op) => {
|
|
@@ -14782,6 +15134,13 @@ var Panel = class {
|
|
|
14782
15134
|
if (i2 !== void 0) this.hooks.go(i2);
|
|
14783
15135
|
return;
|
|
14784
15136
|
}
|
|
15137
|
+
const own2 = t2.closest("[data-q-own]");
|
|
15138
|
+
if (own2 && this.current !== null) {
|
|
15139
|
+
const f2 = own2.dataset.qOwn;
|
|
15140
|
+
this.hooks.setListOwn?.(OWN_FILTERS.includes(f2) ? f2 : null);
|
|
15141
|
+
this.show(this.current);
|
|
15142
|
+
return;
|
|
15143
|
+
}
|
|
14785
15144
|
const order = t2.closest("[data-tcb-order]");
|
|
14786
15145
|
if (order && this.current !== null) {
|
|
14787
15146
|
const o2 = order.dataset.tcbOrder;
|
|
@@ -14867,7 +15226,7 @@ var Panel = class {
|
|
|
14867
15226
|
}).join("");
|
|
14868
15227
|
const listOrder = this.hooks.listOrder();
|
|
14869
15228
|
const keyOnly = listOrder === "key";
|
|
14870
|
-
const queue = this.hooks.queue(i2, keyOnly);
|
|
15229
|
+
const queue = this.hooks.queue(i2, keyOnly, this.hooks.listOwn?.() ?? null);
|
|
14871
15230
|
const inOrder = queue !== null && listOrder !== "kind";
|
|
14872
15231
|
const orderSwitch = queue === null ? `<span class="muted">\u2014 reached from the statement, proofs skipped</span>` : `<span class="seg mini"><button data-tcb-order="review" class="${inOrder && !keyOnly ? "on" : ""}" title="Bottom-up: what a declaration uses before it">Review order</button><button data-tcb-order="key" class="${keyOnly ? "on" : ""}" title="The key declarations alone: the trusted ones first, then in review order">\u25C6 Key</button><button data-tcb-order="kind" class="${inOrder ? "" : "on"}" title="Grouped by kind, by name">By kind</button></span>`;
|
|
14873
15232
|
const part = (key, title, aside, body, tip) => {
|
|
@@ -15457,10 +15816,10 @@ var FloatWindow = class {
|
|
|
15457
15816
|
* the kind keeps it. */
|
|
15458
15817
|
collapse(on) {
|
|
15459
15818
|
if (!this.o.live() || on === this.collapsed) return;
|
|
15460
|
-
const
|
|
15819
|
+
const inside3 = this.el.contains(document.activeElement);
|
|
15461
15820
|
this.setCollapsed(on);
|
|
15462
15821
|
if (this.o.keepsCollapsed) this.keep({ collapsed: on });
|
|
15463
|
-
if (
|
|
15822
|
+
if (inside3) this.el.querySelector(on ? this.o.opener : this.o.collapser)?.focus();
|
|
15464
15823
|
this.o.collapsed?.(on);
|
|
15465
15824
|
}
|
|
15466
15825
|
/** A press on the title bar moves the window, on an edge or a corner resizes it; mouse, pen or
|
|
@@ -15514,6 +15873,35 @@ var FloatWindow = class {
|
|
|
15514
15873
|
}
|
|
15515
15874
|
};
|
|
15516
15875
|
|
|
15876
|
+
// src/web/src/gutter.ts
|
|
15877
|
+
function gutterRows(lines) {
|
|
15878
|
+
let last2 = 0;
|
|
15879
|
+
return lines.map((line) => {
|
|
15880
|
+
if (!(line > 0)) return { n: null, gap: false };
|
|
15881
|
+
const row = { n: line === last2 ? null : line, gap: last2 > 0 && line !== last2 && line !== last2 + 1 };
|
|
15882
|
+
last2 = line;
|
|
15883
|
+
return row;
|
|
15884
|
+
});
|
|
15885
|
+
}
|
|
15886
|
+
function gutterDigits(largest) {
|
|
15887
|
+
return String(Math.max(1, Math.floor(largest))).length;
|
|
15888
|
+
}
|
|
15889
|
+
function contextGutter(lines, kept, code) {
|
|
15890
|
+
const open = gutterRows([...lines, code]);
|
|
15891
|
+
const shown2 = lines.flatMap((l2, k2) => kept[k2] ? [l2] : []);
|
|
15892
|
+
const few = gutterRows([...shown2, code]);
|
|
15893
|
+
let j2 = 0;
|
|
15894
|
+
const folded = lines.map((_2, k2) => kept[k2] ? few[j2++] : null);
|
|
15895
|
+
return { open: open.slice(0, -1), folded, cut: { open: open[open.length - 1].gap, folded: few[few.length - 1].gap } };
|
|
15896
|
+
}
|
|
15897
|
+
function rowMarks(open, folded) {
|
|
15898
|
+
const marks = [open.gap && "gap", open.n === null && "again", folded?.gap && "gap-f", folded && folded.n === null && "again-f"];
|
|
15899
|
+
return marks.filter(Boolean).join(" ");
|
|
15900
|
+
}
|
|
15901
|
+
function cutMarks(cut3) {
|
|
15902
|
+
return [cut3.open && "cut", cut3.folded && "cut-f"].filter(Boolean).join(" ");
|
|
15903
|
+
}
|
|
15904
|
+
|
|
15517
15905
|
// src/web/src/pastsource.ts
|
|
15518
15906
|
function pastText(g2, i2, src) {
|
|
15519
15907
|
const v2 = g2.nodes[i2];
|
|
@@ -16407,20 +16795,20 @@ var SourceWindow = class {
|
|
|
16407
16795
|
if (c3) [node, off] = [c3.offsetNode, c3.offset];
|
|
16408
16796
|
}
|
|
16409
16797
|
if (!node || node.nodeType !== Node.TEXT_NODE || !pre.contains(node)) return null;
|
|
16410
|
-
const
|
|
16798
|
+
const texts2 = [];
|
|
16411
16799
|
const walker = document.createTreeWalker(pre, NodeFilter.SHOW_TEXT);
|
|
16412
|
-
for (let t2 = walker.nextNode(); t2; t2 = walker.nextNode())
|
|
16800
|
+
for (let t2 = walker.nextNode(); t2; t2 = walker.nextNode()) texts2.push(t2);
|
|
16413
16801
|
let abs = 0;
|
|
16414
|
-
for (const t2 of
|
|
16802
|
+
for (const t2 of texts2) {
|
|
16415
16803
|
if (t2 === node) break;
|
|
16416
16804
|
abs += t2.data.length;
|
|
16417
16805
|
}
|
|
16418
16806
|
abs += off;
|
|
16419
|
-
const text2 =
|
|
16807
|
+
const text2 = texts2.map((t2) => t2.data).join("");
|
|
16420
16808
|
const box = (k2) => {
|
|
16421
16809
|
if (k2 < 0 || k2 >= text2.length || text2[k2] === "\n") return null;
|
|
16422
16810
|
let acc = 0;
|
|
16423
|
-
for (const t2 of
|
|
16811
|
+
for (const t2 of texts2) {
|
|
16424
16812
|
if (k2 < acc + t2.data.length) {
|
|
16425
16813
|
const range2 = document.createRange();
|
|
16426
16814
|
range2.setStart(t2, k2 - acc);
|
|
@@ -16431,12 +16819,12 @@ var SourceWindow = class {
|
|
|
16431
16819
|
}
|
|
16432
16820
|
return null;
|
|
16433
16821
|
};
|
|
16434
|
-
const
|
|
16822
|
+
const inside3 = (k2) => {
|
|
16435
16823
|
const b2 = box(k2);
|
|
16436
16824
|
return b2 && x2 >= b2.rect.left && x2 <= b2.rect.right && y2 >= b2.rect.top && y2 <= b2.rect.bottom ? b2 : null;
|
|
16437
16825
|
};
|
|
16438
|
-
let hit =
|
|
16439
|
-
if (!hit && (hit =
|
|
16826
|
+
let hit = inside3(abs);
|
|
16827
|
+
if (!hit && (hit = inside3(abs - 1))) abs--;
|
|
16440
16828
|
if (!hit) return null;
|
|
16441
16829
|
const before = text2.lastIndexOf("\n", abs - 1);
|
|
16442
16830
|
const line = text2.slice(0, abs).split("\n").length - 1;
|
|
@@ -16446,14 +16834,14 @@ var SourceWindow = class {
|
|
|
16446
16834
|
while (isWord(text2[from - 1])) from--;
|
|
16447
16835
|
while (isWord(text2[to])) to++;
|
|
16448
16836
|
}
|
|
16449
|
-
const range = this.rangeIn(
|
|
16837
|
+
const range = this.rangeIn(texts2, from, to);
|
|
16450
16838
|
return { line, ch: abs - (before + 1), word: `${line}:${from - (before + 1)}`, box: range ? range.getBoundingClientRect() : hit.rect };
|
|
16451
16839
|
}
|
|
16452
16840
|
/** A range over characters `from`–`to` of the text nodes `texts`. */
|
|
16453
|
-
rangeIn(
|
|
16841
|
+
rangeIn(texts2, from, to) {
|
|
16454
16842
|
const r2 = document.createRange();
|
|
16455
16843
|
let acc = 0, started = false;
|
|
16456
|
-
for (const t2 of
|
|
16844
|
+
for (const t2 of texts2) {
|
|
16457
16845
|
const len = t2.data.length;
|
|
16458
16846
|
if (!started && from < acc + len) {
|
|
16459
16847
|
r2.setStart(t2, from - acc);
|
|
@@ -16598,7 +16986,7 @@ var SourceWindow = class {
|
|
|
16598
16986
|
frame2(
|
|
16599
16987
|
escapeHtml(shot.where),
|
|
16600
16988
|
notes2.join(""),
|
|
16601
|
-
this.contextHtml(got.text.split("\n"), shot.start, v2.type ?? "", shot.text, shot.resolve, null) +
|
|
16989
|
+
this.contextHtml(got.text.split("\n"), shot.start, v2.type ?? "", shot.text, shot.resolve, null) + codeHtml(highlightLines(shot.text, (w2) => shot.resolve(w2), shot.start + 1), shot.start, shot.text) + (interpretsHtml(g2, i2) ? `<div class="sw-interprets">${interpretsHtml(g2, i2)}</div>` : "") + this.generatedHtml(v2.name, [...v2.leanName ? [v2.leanName] : [], ...v2.also ?? []])
|
|
16602
16990
|
);
|
|
16603
16991
|
return settle2();
|
|
16604
16992
|
}
|
|
@@ -16646,10 +17034,14 @@ var SourceWindow = class {
|
|
|
16646
17034
|
const key = `${v2.module}:${src.hash ?? ""}:${at.start}`;
|
|
16647
17035
|
const known2 = this.still ? void 0 : this.memory.learned.get(key);
|
|
16648
17036
|
const words = [];
|
|
16649
|
-
const code = highlightLines(
|
|
16650
|
-
|
|
16651
|
-
|
|
16652
|
-
|
|
17037
|
+
const code = highlightLines(
|
|
17038
|
+
text2,
|
|
17039
|
+
(w2, off) => {
|
|
17040
|
+
words.push({ word: w2, at: off });
|
|
17041
|
+
return known2?.has(off) ? known2.get(off) : resolve(w2);
|
|
17042
|
+
},
|
|
17043
|
+
at.start + 1
|
|
17044
|
+
);
|
|
16653
17045
|
if (src.hash) {
|
|
16654
17046
|
this.shown = { module: v2.module, start: at.start, hash: src.hash };
|
|
16655
17047
|
if (fresh3 && !this.still) this.data.hoverOpen(v2.module);
|
|
@@ -16657,7 +17049,7 @@ var SourceWindow = class {
|
|
|
16657
17049
|
frame2(
|
|
16658
17050
|
`${escapeHtml(place2)}:${at.start + 1}\u2013${at.end + 1}${edited ? " \xB7 present text" : ""}`,
|
|
16659
17051
|
notes.join(""),
|
|
16660
|
-
this.contextHtml(lines, at.start, v2.type ?? "", text2, resolve, edited ? null : exactContext(src.contexts, v2.name, src.hash)) +
|
|
17052
|
+
this.contextHtml(lines, at.start, v2.type ?? "", text2, resolve, edited ? null : exactContext(src.contexts, v2.name, src.hash)) + codeHtml(code, at.start, text2) + // a rule beside the grammar it interprets, and the other way round
|
|
16661
17053
|
(interpretsHtml(g2, i2) ? `<div class="sw-interprets">${interpretsHtml(g2, i2)}</div>` : "") + (v2.gen !== void 0 && !this.still ? `<div class="sw-print"><div class="sw-print-h">#print ${escapeHtml(v2.name)}</div><pre class="code" data-sw-print>Asking Lean\u2026</pre></div>` : "") + // a notation unit's own Lean constant (its name is not one) with what its command generated
|
|
16662
17054
|
this.generatedHtml(v2.name, [...v2.leanName ? [v2.leanName] : [], ...v2.also ?? []]),
|
|
16663
17055
|
this.still ? null : this.hooks.editorLink(g2, i2, edited ? { line: at.start + 1, col: 1 } : void 0)
|
|
@@ -16677,23 +17069,29 @@ var SourceWindow = class {
|
|
|
16677
17069
|
* its first lines and its namespaces and sections, with the `variable`s the declaration uses
|
|
16678
17070
|
* marked and always shown — those Lean included in it where the context is the elaborator's
|
|
16679
17071
|
* (`exact`, the usage pass's), else those that seem to be (a name of theirs in its statement or
|
|
16680
|
-
* its text).
|
|
17072
|
+
* its text). Each command is numbered in the gutter at the line it is written on (its first),
|
|
17073
|
+
* a break before it where lines were left out, and under the last one where the code does not
|
|
17074
|
+
* follow it: as the context shows whole, and folded (web/src/gutter.ts). */
|
|
16681
17075
|
contextHtml(lines, start, type, text2, resolve, exact) {
|
|
16682
17076
|
const ctx = contextLines(readContext(lines, start, exact));
|
|
16683
17077
|
if (!ctx.length) return "";
|
|
16684
17078
|
const used = usedVariables(ctx, [type, text2], !!exact);
|
|
16685
17079
|
const FIRST = 3, LONG = 6;
|
|
16686
17080
|
const long = ctx.length > LONG;
|
|
17081
|
+
const kept = ctx.map((l2, k2) => !long || k2 < FIRST || l2.kind === "namespace" || l2.kind === "section" || l2.kind === "mutual" || used.has(k2) || / in$/.test(l2.text));
|
|
17082
|
+
const gutter = contextGutter(ctx.map((l2) => l2.line), kept, start + 1);
|
|
16687
17083
|
let hidden = 0;
|
|
16688
17084
|
const rows = ctx.map((l2, k2) => {
|
|
16689
|
-
const keep2 =
|
|
17085
|
+
const keep2 = kept[k2];
|
|
16690
17086
|
if (!keep2) hidden++;
|
|
16691
|
-
const
|
|
17087
|
+
const marks = rowMarks(gutter.open[k2], gutter.folded[k2]);
|
|
17088
|
+
const cls = `sw-ctx-l${used.has(k2) ? " used" : ""}${keep2 ? "" : " fold"}${marks ? ` ${marks}` : ""}`;
|
|
16692
17089
|
const tip = !used.has(k2) ? "" : exact ? ` title="Lean included this variable in the declaration"` : ` title="A name it binds occurs in this declaration: Lean may include it"`;
|
|
16693
|
-
return `<div class="${cls}"${tip}>${highlightLines(l2.text, (w2) => resolve(w2))}</div>`;
|
|
17090
|
+
return `<div class="${cls}"${tip}>${highlightLines(l2.text, (w2) => resolve(w2), l2.line > 0 ? l2.line : void 0)}</div>`;
|
|
16694
17091
|
});
|
|
16695
17092
|
const more = hidden ? `${hidden} more` : "";
|
|
16696
|
-
|
|
17093
|
+
const cut3 = cutMarks(gutter.cut);
|
|
17094
|
+
return `<div class="sw-ctx${this.ctxOpen ? " open" : ""}${exact ? " exact" : ""}${cut3 ? ` ${cut3}` : ""}" style="--gw:${gutterDigits(start + text2.split("\n").length)}" aria-label="The context it is written in" title="${exact ? "The context as Lean elaborated it" : "The context, read from the file's text"}"><div class="code">${rows.join("")}</div>` + (more ? `<button class="link sw-ctx-more" data-sw-ctx="${more}">${this.ctxOpen ? "fewer" : more}</button>` : "") + `</div>`;
|
|
16697
17095
|
}
|
|
16698
17096
|
/** The declarations Lean generated from the command on show, folded into its unit: each with a
|
|
16699
17097
|
* button that asks Lean's `#print` for it; on a past graph, their names alone, Lean knowing only
|
|
@@ -16795,7 +17193,7 @@ var SourceWindow = class {
|
|
|
16795
17193
|
if (this.memory.learned.size > 64) this.memory.learned.delete(this.memory.learned.keys().next().value);
|
|
16796
17194
|
const pre = this.el.querySelector("pre.src");
|
|
16797
17195
|
if (!pre || turn !== this.turn) return;
|
|
16798
|
-
pre.innerHTML = highlightLines(text2, (w2, off) => learned.has(off) ? learned.get(off) : resolve(w2));
|
|
17196
|
+
pre.innerHTML = highlightLines(text2, (w2, off) => learned.has(off) ? learned.get(off) : resolve(w2), start + 1);
|
|
16799
17197
|
this.flashLines();
|
|
16800
17198
|
}
|
|
16801
17199
|
};
|
|
@@ -16805,6 +17203,9 @@ function offsetIn(root, node, off) {
|
|
|
16805
17203
|
r2.setEnd(node, off);
|
|
16806
17204
|
return r2.toString().length;
|
|
16807
17205
|
}
|
|
17206
|
+
function codeHtml(lines, start, text2) {
|
|
17207
|
+
return `<pre class="code src" style="--gw:${gutterDigits(start + text2.split("\n").length)}">${lines}</pre>`;
|
|
17208
|
+
}
|
|
16808
17209
|
function githubAnchor(href, commit, what) {
|
|
16809
17210
|
const title = what ? `These lines of ${what}, on GitHub` : `These lines at ${commit.slice(0, 7)}, the commit of the build shown, on GitHub`;
|
|
16810
17211
|
return `<a class="link editor-link gh-link" href="${escapeHtml(href)}" target="_blank" rel="noopener" title="${escapeHtml(title)}">Open on GitHub</a>`;
|
|
@@ -39182,18 +39583,18 @@ var PaperWin = class {
|
|
|
39182
39583
|
this.dockedEl = el;
|
|
39183
39584
|
this.el.classList.remove("waiting");
|
|
39184
39585
|
if (el) {
|
|
39185
|
-
const
|
|
39586
|
+
const follow2 = () => {
|
|
39186
39587
|
const waits = el.matches(".opening");
|
|
39187
39588
|
this.el.classList.toggle("waiting", waits);
|
|
39188
39589
|
if (!waits && !el.matches(".moving, .sizing")) this.win.layout();
|
|
39189
39590
|
};
|
|
39190
|
-
this.dockWatch = new MutationObserver(
|
|
39591
|
+
this.dockWatch = new MutationObserver(follow2);
|
|
39191
39592
|
this.dockWatch.observe(el, { attributes: true, attributeFilter: ["style", "class"] });
|
|
39192
39593
|
if (typeof ResizeObserver !== "undefined") {
|
|
39193
|
-
this.dockSize = new ResizeObserver(
|
|
39594
|
+
this.dockSize = new ResizeObserver(follow2);
|
|
39194
39595
|
this.dockSize.observe(el);
|
|
39195
39596
|
}
|
|
39196
|
-
|
|
39597
|
+
follow2();
|
|
39197
39598
|
} else if (this.open) this.win.layout();
|
|
39198
39599
|
}
|
|
39199
39600
|
// ---------------------------------------------------------------- linking
|
|
@@ -39917,12 +40318,17 @@ function panelsPart(page) {
|
|
|
39917
40318
|
const r2 = page.reviewRoot();
|
|
39918
40319
|
return r2 === null ? "" : page.flow.whyHtml(r2, i2);
|
|
39919
40320
|
},
|
|
39920
|
-
queue: (i2, keyOnly) => page.flow.isTarget(i2) ? page.flow.listHtml(i2, keyOnly) : null,
|
|
40321
|
+
queue: (i2, keyOnly, own2) => page.flow.isTarget(i2) ? page.flow.listHtml(i2, keyOnly, own2 ?? null) : null,
|
|
39921
40322
|
listOrder: () => S7.tcbOrder ?? "review",
|
|
39922
40323
|
setListOrder: (o2) => {
|
|
39923
40324
|
S7.tcbOrder = o2;
|
|
39924
40325
|
store2.save();
|
|
39925
40326
|
},
|
|
40327
|
+
listOwn: () => S7.tcbOwn ?? null,
|
|
40328
|
+
setListOwn: (own2) => {
|
|
40329
|
+
S7.tcbOwn = own2 ?? void 0;
|
|
40330
|
+
store2.save();
|
|
40331
|
+
},
|
|
39926
40332
|
editorLink: (i2) => editor.href(page.g, i2),
|
|
39927
40333
|
shut: (section) => store2.isShut(section),
|
|
39928
40334
|
toggle: (section) => store2.toggleShut(section),
|
|
@@ -40859,12 +41265,12 @@ var OverviewModel = class {
|
|
|
40859
41265
|
const X2 = (id) => id < nc ? S7.cwx[id] : S7.nwx[id - nc];
|
|
40860
41266
|
const Y2 = (id) => id < nc ? S7.cwy[id] : S7.nwy[id - nc];
|
|
40861
41267
|
const U2 = v2.units;
|
|
40862
|
-
let
|
|
41268
|
+
let onScreen2 = 0;
|
|
40863
41269
|
for (let k2 = 0; k2 < U2.length; k2++) {
|
|
40864
41270
|
const x2 = X2(U2[k2]), y2 = Y2(U2[k2]);
|
|
40865
|
-
if (Math.abs(x2 - cam.x) <= hw && Math.abs(y2 - cam.y) <= hh)
|
|
41271
|
+
if (Math.abs(x2 - cam.x) <= hw && Math.abs(y2 - cam.y) <= hh) onScreen2++;
|
|
40866
41272
|
}
|
|
40867
|
-
const budget = Math.max(250, Math.min(1500, Math.round(0.6 *
|
|
41273
|
+
const budget = Math.max(250, Math.min(1500, Math.round(0.6 * onScreen2)));
|
|
40868
41274
|
const score2 = new Float64Array(P2.n);
|
|
40869
41275
|
const both = [];
|
|
40870
41276
|
const one2 = [];
|
|
@@ -40895,13 +41301,13 @@ var OverviewModel = class {
|
|
|
40895
41301
|
const inner = ranked(both, innerCap);
|
|
40896
41302
|
const outer = ranked(one2, budget - Math.min(inner.idx.length, innerCap));
|
|
40897
41303
|
const n3 = inner.idx.length + outer.idx.length;
|
|
40898
|
-
const sel = new Int32Array(n3),
|
|
41304
|
+
const sel = new Int32Array(n3), inside3 = new Uint8Array(n3), strength = new Float32Array(n3);
|
|
40899
41305
|
sel.set(inner.idx);
|
|
40900
41306
|
sel.set(outer.idx, inner.idx.length);
|
|
40901
|
-
|
|
41307
|
+
inside3.fill(1, 0, inner.idx.length);
|
|
40902
41308
|
strength.set(inner.strength);
|
|
40903
41309
|
strength.set(outer.strength, inner.idx.length);
|
|
40904
|
-
return { sel, inside:
|
|
41310
|
+
return { sel, inside: inside3, strength };
|
|
40905
41311
|
}
|
|
40906
41312
|
/** How step `v` draws what was chosen of it, each edge by its units' ids (`a:b`): width and alpha
|
|
40907
41313
|
* grow with the weight relative to the heaviest chosen of their kind (in view, or leaving it), so
|
|
@@ -40910,12 +41316,12 @@ var OverviewModel = class {
|
|
|
40910
41316
|
looksOf(v2, chosen, ask, S7) {
|
|
40911
41317
|
const P2 = v2.pairs;
|
|
40912
41318
|
const T2 = this.tree;
|
|
40913
|
-
const { sel, inside:
|
|
41319
|
+
const { sel, inside: inside3, strength } = chosen;
|
|
40914
41320
|
let maxIn = 1, maxOut = 1, nIn = 0, n3 = 0;
|
|
40915
41321
|
for (let j2 = 0; j2 < sel.length; j2++) {
|
|
40916
41322
|
const w2 = P2.w[sel[j2]];
|
|
40917
41323
|
n3 += strength[j2];
|
|
40918
|
-
if (
|
|
41324
|
+
if (inside3[j2]) {
|
|
40919
41325
|
maxIn = Math.max(maxIn, w2);
|
|
40920
41326
|
nIn += strength[j2];
|
|
40921
41327
|
} else maxOut = Math.max(maxOut, w2);
|
|
@@ -40930,7 +41336,7 @@ var OverviewModel = class {
|
|
|
40930
41336
|
for (let j2 = 0; j2 < sel.length; j2++) {
|
|
40931
41337
|
const k2 = sel[j2];
|
|
40932
41338
|
const a3 = P2.a[k2], b2 = P2.b[k2], w2 = P2.w[k2];
|
|
40933
|
-
const max =
|
|
41339
|
+
const max = inside3[j2] ? maxIn : maxOut;
|
|
40934
41340
|
const t2 = Math.log1p(w2) / Math.log1p(max);
|
|
40935
41341
|
const width = 0.7 + 2 * t2 * Math.min(1, Math.log1p(max) / Math.log1p(50));
|
|
40936
41342
|
const alpha = (floor + (0.45 - floor) * t2 * t2) * fade2 * strength[j2];
|
|
@@ -40999,8 +41405,8 @@ function blendPoints(sets, put) {
|
|
|
40999
41405
|
var BRACKET = 4;
|
|
41000
41406
|
function aim(z2, ready, near = [-Infinity, Infinity]) {
|
|
41001
41407
|
const all = [...ready];
|
|
41002
|
-
const
|
|
41003
|
-
const R2 = new Set(
|
|
41408
|
+
const inside3 = all.filter((r2) => r2 >= near[0] && r2 <= near[1]);
|
|
41409
|
+
const R2 = new Set(inside3.length ? inside3 : all);
|
|
41004
41410
|
const i0 = Math.floor(z2);
|
|
41005
41411
|
const t2 = z2 - i0;
|
|
41006
41412
|
if (R2.has(i0) && R2.has(i0 + 1)) return [{ point: i0, w: 1 - t2 }, { point: i0 + 1, w: t2 }];
|
|
@@ -42386,6 +42792,7 @@ var Motion = class {
|
|
|
42386
42792
|
};
|
|
42387
42793
|
|
|
42388
42794
|
// src/web/src/status.ts
|
|
42795
|
+
var SCHEMES_SHOWN = ["kind", "status", "mine"];
|
|
42389
42796
|
var STATUSES2 = ["failed", "building", "sorry", "commented", "stale", "approved", "unreviewed", "trusted"];
|
|
42390
42797
|
var ST_FAILED = 0;
|
|
42391
42798
|
var ST_BUILDING = 1;
|
|
@@ -42415,6 +42822,50 @@ var STATUS_HINT = {
|
|
|
42415
42822
|
unreviewed: "Nobody has given an opinion on it yet, and nothing trusts it",
|
|
42416
42823
|
trusted: "Trusted without review (Mathlib, Lean core, a trusted prefix, the standard axioms), with no opinion on it"
|
|
42417
42824
|
};
|
|
42825
|
+
var MINE_STATES = [ST_COMMENTED, ST_STALE, ST_APPROVED, ST_UNREVIEWED, ST_TRUSTED];
|
|
42826
|
+
function mineLabel(code, whose) {
|
|
42827
|
+
const who = whose ?? "you";
|
|
42828
|
+
switch (code) {
|
|
42829
|
+
case ST_COMMENTED:
|
|
42830
|
+
return `${who} commented`;
|
|
42831
|
+
case ST_STALE:
|
|
42832
|
+
return `${whose ? `${whose}'s` : "your"} opinion is stale`;
|
|
42833
|
+
case ST_APPROVED:
|
|
42834
|
+
return `${who} approved`;
|
|
42835
|
+
case ST_TRUSTED:
|
|
42836
|
+
return "trusted";
|
|
42837
|
+
default:
|
|
42838
|
+
return `not reviewed by ${whose ?? "you"}`;
|
|
42839
|
+
}
|
|
42840
|
+
}
|
|
42841
|
+
function mineHint(code, whose) {
|
|
42842
|
+
const your = whose ? `${whose}'s` : "Your";
|
|
42843
|
+
switch (code) {
|
|
42844
|
+
case ST_COMMENTED:
|
|
42845
|
+
return `${your} current opinion on its present version is a comment`;
|
|
42846
|
+
case ST_STALE:
|
|
42847
|
+
return `${your} current opinion is on an earlier version: it changed since`;
|
|
42848
|
+
case ST_APPROVED:
|
|
42849
|
+
return `${your} current opinion approves its present version`;
|
|
42850
|
+
case ST_TRUSTED:
|
|
42851
|
+
return `Trusted without review, and no opinion of ${whose ? `${whose}'s` : "yours"} on it`;
|
|
42852
|
+
default:
|
|
42853
|
+
return `It needs review, and ${whose ? `${whose} has` : "you have"} no opinion on it (none given, or withdrawn)`;
|
|
42854
|
+
}
|
|
42855
|
+
}
|
|
42856
|
+
function mineState(d2, g2, i2, me) {
|
|
42857
|
+
const v2 = g2.nodes[i2];
|
|
42858
|
+
const s2 = me ? ownStatus(d2, v2.name, me, v2.hash) : "none";
|
|
42859
|
+
if (s2 === "stale") return ST_STALE;
|
|
42860
|
+
if (s2 === "commented") return ST_COMMENTED;
|
|
42861
|
+
if (s2 === "approved") return ST_APPROVED;
|
|
42862
|
+
return needsReview(g2, d2, i2) ? ST_UNREVIEWED : ST_TRUSTED;
|
|
42863
|
+
}
|
|
42864
|
+
function mineCodes(d2, g2, me) {
|
|
42865
|
+
const out = new Uint8Array(g2.n);
|
|
42866
|
+
for (let i2 = 0; i2 < g2.n; i2++) out[i2] = mineState(d2, g2, i2, me);
|
|
42867
|
+
return out;
|
|
42868
|
+
}
|
|
42418
42869
|
function statusState(d2, g2, i2, file, sorryAx) {
|
|
42419
42870
|
if (file?.state === "building") return ST_BUILDING;
|
|
42420
42871
|
if (file?.state === "failed" || file?.state === "unbuilt") return ST_FAILED;
|
|
@@ -43202,7 +43653,8 @@ var GraphCanvas = class {
|
|
|
43202
43653
|
/** how the points are coloured (setScheme): by kind, or by where each stands (CanvasSpec,
|
|
43203
43654
|
* "Colour schemes", decided 2026-10-08) */
|
|
43204
43655
|
scheme = "kind";
|
|
43205
|
-
/** per node, its state in the Status scheme (web/src/status.ts),
|
|
43656
|
+
/** per node, its state in the Status scheme — in the Mine scheme, its Mine state — (web/src/status.ts),
|
|
43657
|
+
* from setStatus */
|
|
43206
43658
|
statusCode = new Uint8Array(0);
|
|
43207
43659
|
/** per cluster, of what it holds that needs review: how many are approved, commented, and in
|
|
43208
43660
|
* all (the Status scheme's progress arcs) */
|
|
@@ -43508,16 +43960,17 @@ var GraphCanvas = class {
|
|
|
43508
43960
|
isKey(i2) {
|
|
43509
43961
|
return this.keyList.includes(i2);
|
|
43510
43962
|
}
|
|
43511
|
-
/** Where each node of the canvas's graph stands (web/src/status.ts, statusCodes
|
|
43512
|
-
* the Status scheme, and the clusters' progress. */
|
|
43963
|
+
/** Where each node of the canvas's graph stands (web/src/status.ts, statusCodes; mineCodes in the
|
|
43964
|
+
* Mine scheme): its colour in the Status or the Mine scheme, and the clusters' progress. */
|
|
43513
43965
|
setStatus(codes) {
|
|
43514
43966
|
this.statusCode = codes.length === this.g.n ? codes : new Uint8Array(this.g.n).fill(ST_UNREVIEWED);
|
|
43515
43967
|
this.countProgress();
|
|
43516
|
-
if (this.scheme
|
|
43968
|
+
if (this.scheme !== "kind") this.clearCards();
|
|
43517
43969
|
this.invalidate();
|
|
43518
43970
|
}
|
|
43519
|
-
/** Colour the points by kind
|
|
43520
|
-
* the
|
|
43971
|
+
/** Colour the points by kind, by status or by the reader's own review (Mine, in Status's colours,
|
|
43972
|
+
* from the codes setStatus was given). Rings, the target's star and the others' marks are the same
|
|
43973
|
+
* in each. */
|
|
43521
43974
|
setScheme(s2) {
|
|
43522
43975
|
if (s2 === this.scheme) return;
|
|
43523
43976
|
this.scheme = s2;
|
|
@@ -44101,12 +44554,12 @@ var GraphCanvas = class {
|
|
|
44101
44554
|
artNames(rect) {
|
|
44102
44555
|
const S7 = this.scene;
|
|
44103
44556
|
if (!S7) return [];
|
|
44104
|
-
const
|
|
44557
|
+
const inside3 = (x2, y2) => x2 >= rect.x && x2 <= rect.x + rect.w && y2 >= rect.y && y2 <= rect.y + rect.h;
|
|
44105
44558
|
const out = [];
|
|
44106
44559
|
for (let c3 = 0; c3 < S7.nc; c3++) {
|
|
44107
44560
|
const spot = this.chosenSpot(c3);
|
|
44108
44561
|
const cl = this.layout.clusters[c3];
|
|
44109
|
-
if (!spot || !
|
|
44562
|
+
if (!spot || !inside3(spot.x, spot.y) || !spot.board && !this.artClusters.has(cl.key) && !this.artRuled.has(cl.key)) continue;
|
|
44110
44563
|
out.push({ id: artNameId("cluster", cl.key), label: cl.label, full: cl.key.replace("\u27E8external\u27E9", "External"), cluster: true });
|
|
44111
44564
|
}
|
|
44112
44565
|
const mx = rect.x + rect.w / 2, my = rect.y + rect.h / 2;
|
|
@@ -44115,7 +44568,7 @@ var GraphCanvas = class {
|
|
|
44115
44568
|
for (let i2 = 0; i2 < this.g.n; i2++) {
|
|
44116
44569
|
if (!this.visibleNode(i2)) continue;
|
|
44117
44570
|
const [sx, sy] = this.toScreen(this.px[i2], this.py[i2]);
|
|
44118
|
-
if (!
|
|
44571
|
+
if (!inside3(sx, sy)) continue;
|
|
44119
44572
|
decls.push(i2);
|
|
44120
44573
|
dist.set(i2, (sx - mx) ** 2 + (sy - my) ** 2);
|
|
44121
44574
|
}
|
|
@@ -44975,7 +45428,7 @@ var GraphCanvas = class {
|
|
|
44975
45428
|
/** A node's colour in the scheme in force. */
|
|
44976
45429
|
colorOf(i2) {
|
|
44977
45430
|
const th = this.theme;
|
|
44978
|
-
if (this.scheme
|
|
45431
|
+
if (this.scheme !== "kind") return th.status[this.statusCode[i2] ?? ST_UNREVIEWED];
|
|
44979
45432
|
return this.g.isExt(i2) ? th.ext : th.kind[this.g.nodes[i2].kind] ?? th.ext;
|
|
44980
45433
|
}
|
|
44981
45434
|
/** Draw node `i` as a point into `L`: a dot in its colour, `alpha` its opacity. The world outside
|
|
@@ -45014,13 +45467,13 @@ var GraphCanvas = class {
|
|
|
45014
45467
|
this.buildScene();
|
|
45015
45468
|
}
|
|
45016
45469
|
const dotR = this.dotPx();
|
|
45017
|
-
const
|
|
45470
|
+
const onScreen2 = (sx, sy, pad) => sx > -pad && sy > -pad && sx < this.w + pad && sy < this.h + pad;
|
|
45018
45471
|
const activeDots = [];
|
|
45019
45472
|
if (this.active) {
|
|
45020
45473
|
for (const i2 of this.activeList) {
|
|
45021
45474
|
if (!this.visibleNode(i2)) continue;
|
|
45022
45475
|
const [sx, sy] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45023
|
-
if (
|
|
45476
|
+
if (onScreen2(sx, sy, 8)) activeDots.push(i2);
|
|
45024
45477
|
}
|
|
45025
45478
|
}
|
|
45026
45479
|
this.drawCards(activeDots);
|
|
@@ -45051,7 +45504,7 @@ var GraphCanvas = class {
|
|
|
45051
45504
|
this.gl.setPositions(P2);
|
|
45052
45505
|
}
|
|
45053
45506
|
this.gl.render(this.cam, this.w, this.h, this.dpr, dotR);
|
|
45054
|
-
this.drawLabels(
|
|
45507
|
+
this.drawLabels(onScreen2, dotR);
|
|
45055
45508
|
this.onFrame?.();
|
|
45056
45509
|
this.drawMs = performance.now() - t0;
|
|
45057
45510
|
}
|
|
@@ -45261,7 +45714,7 @@ var GraphCanvas = class {
|
|
|
45261
45714
|
}
|
|
45262
45715
|
}
|
|
45263
45716
|
/** Text: cluster labels, labels of folded clusters, names up close. */
|
|
45264
|
-
drawLabels(
|
|
45717
|
+
drawLabels(onScreen2, dotR) {
|
|
45265
45718
|
const ctx = this.ctx;
|
|
45266
45719
|
const k2 = this.cam.k;
|
|
45267
45720
|
const th = this.theme;
|
|
@@ -45325,7 +45778,7 @@ var GraphCanvas = class {
|
|
|
45325
45778
|
const shown2 = (i2) => {
|
|
45326
45779
|
if (!this.visibleNode(i2)) return false;
|
|
45327
45780
|
const [sx, sy] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45328
|
-
return
|
|
45781
|
+
return onScreen2(sx, sy, 8);
|
|
45329
45782
|
};
|
|
45330
45783
|
const targets = art ? this.markedTargets() : [];
|
|
45331
45784
|
const look = art ? artText(art.style, th) : null;
|
|
@@ -45339,12 +45792,12 @@ var GraphCanvas = class {
|
|
|
45339
45792
|
ctx.textAlign = "center";
|
|
45340
45793
|
if (S7.rep[c3] === c3) {
|
|
45341
45794
|
const r2 = Math.max(6, S7.drawnR[c3] * k2);
|
|
45342
|
-
if (!anywhere && (r2 <= 10 || !
|
|
45795
|
+
if (!anywhere && (r2 <= 10 || !onScreen2(sx, sy, r2) || act && this.clusterHasActive(c3))) return false;
|
|
45343
45796
|
ctx.font = L2.sub(11);
|
|
45344
45797
|
return place2(cl.label, sx, sy + r2 + 13, 11, id, force);
|
|
45345
45798
|
}
|
|
45346
45799
|
const sr = S7.drawnR[c3] * k2;
|
|
45347
|
-
if (!anywhere && (sr <= 38 || !
|
|
45800
|
+
if (!anywhere && (sr <= 38 || !onScreen2(sx, sy, sr))) return false;
|
|
45348
45801
|
const top = cl.depth === 0;
|
|
45349
45802
|
const size = Math.max(10, Math.min(top ? 22 : 16, 9 + sr / 40));
|
|
45350
45803
|
const text2 = top ? cl.label.toUpperCase() : cl.label;
|
|
@@ -45380,7 +45833,7 @@ var GraphCanvas = class {
|
|
|
45380
45833
|
const cl = this.layout.clusters[c3];
|
|
45381
45834
|
if (!this.artClusters.has(cl.key) || S7.rep[c3] >= 0 && S7.rep[c3] !== c3 || !this.clusterVisible(c3)) continue;
|
|
45382
45835
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45383
|
-
if (
|
|
45836
|
+
if (onScreen2(sx, sy, 400)) artCluster(c3, true);
|
|
45384
45837
|
}
|
|
45385
45838
|
if (chosen) {
|
|
45386
45839
|
const bold = new Set(targets);
|
|
@@ -45400,7 +45853,7 @@ var GraphCanvas = class {
|
|
|
45400
45853
|
const cl = this.layout.clusters[c3];
|
|
45401
45854
|
if (!this.artRuled.has(cl.key) || this.artClusters.has(cl.key) || S7.rep[c3] >= 0 && S7.rep[c3] !== c3 || !this.clusterVisible(c3)) continue;
|
|
45402
45855
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45403
|
-
if (
|
|
45856
|
+
if (onScreen2(sx, sy, 400)) artCluster(c3, "fit");
|
|
45404
45857
|
}
|
|
45405
45858
|
ctx.textAlign = "left";
|
|
45406
45859
|
for (const name of this.artRuledDecls) {
|
|
@@ -45426,7 +45879,7 @@ var GraphCanvas = class {
|
|
|
45426
45879
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45427
45880
|
if (rep === c3) {
|
|
45428
45881
|
const r2 = Math.max(6, S7.drawnR[c3] * k2);
|
|
45429
|
-
if (r2 > 10 &&
|
|
45882
|
+
if (r2 > 10 && onScreen2(sx, sy, r2) && !(act && this.clusterHasActive(c3))) {
|
|
45430
45883
|
ctx.font = `500 11px ${FONT}`;
|
|
45431
45884
|
place2(cl.label, sx, sy + r2 + 13, 11, art ? artNameId("cluster", cl.key) : "");
|
|
45432
45885
|
}
|
|
@@ -45434,22 +45887,22 @@ var GraphCanvas = class {
|
|
|
45434
45887
|
}
|
|
45435
45888
|
if (rep >= 0) continue;
|
|
45436
45889
|
const sr = S7.drawnR[c3] * k2;
|
|
45437
|
-
if (sr <= 38 || !
|
|
45890
|
+
if (sr <= 38 || !onScreen2(sx, sy, sr)) continue;
|
|
45438
45891
|
const size = Math.max(10, Math.min(20, 9 + sr / 40));
|
|
45439
45892
|
ctx.font = `${cl.depth === 0 ? 600 : 500} ${size}px ${FONT}`;
|
|
45440
45893
|
const id = art ? artNameId("cluster", cl.key) : "";
|
|
45441
45894
|
if (place2(cl.label, sx, sy - sr + size + 6, size, id) || sr > 4 * size && place2(cl.label, sx, sy - sr + 2 * size + 10, size, id)) named2.set(c3, labels.length - 4);
|
|
45442
45895
|
}
|
|
45443
|
-
if (!art) this.tempLabels(place2,
|
|
45896
|
+
if (!art) this.tempLabels(place2, onScreen2);
|
|
45444
45897
|
this.labelBoxes = labels;
|
|
45445
45898
|
this.labelOfC = named2;
|
|
45446
|
-
this.drawProgress(
|
|
45899
|
+
this.drawProgress(onScreen2);
|
|
45447
45900
|
this.drawLeaders();
|
|
45448
|
-
if (!art || art.keys) this.drawKeys(
|
|
45449
|
-
this.drawStars(
|
|
45901
|
+
if (!art || art.keys) this.drawKeys(onScreen2, dotR);
|
|
45902
|
+
this.drawStars(onScreen2, dotR);
|
|
45450
45903
|
if (!art) {
|
|
45451
|
-
this.drawVisitors(
|
|
45452
|
-
this.drawPeers(
|
|
45904
|
+
this.drawVisitors(onScreen2);
|
|
45905
|
+
this.drawPeers(onScreen2, dotR);
|
|
45453
45906
|
}
|
|
45454
45907
|
this.drawSelection(dotR);
|
|
45455
45908
|
const marked2 = art && art.labels !== "none" && asShown ? targets.filter((i2) => shown2(i2) && !extra(artNameId("decl", this.g.nodes[i2].name))) : [];
|
|
@@ -45488,7 +45941,7 @@ var GraphCanvas = class {
|
|
|
45488
45941
|
for (let i2 = 0; i2 < this.g.n; i2++) {
|
|
45489
45942
|
if (!this.visibleNode(i2)) continue;
|
|
45490
45943
|
const [sx, sy] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45491
|
-
if (!
|
|
45944
|
+
if (!onScreen2(sx, sy, 8)) continue;
|
|
45492
45945
|
near.push(i2);
|
|
45493
45946
|
dist[i2] = (sx - cx) ** 2 + (sy - cy) ** 2;
|
|
45494
45947
|
}
|
|
@@ -45513,12 +45966,12 @@ var GraphCanvas = class {
|
|
|
45513
45966
|
const bg = this.theme.bg;
|
|
45514
45967
|
writeNames(this.ctx, names2, halo ?? `rgb(${Math.round(bg[0] * 255)}, ${Math.round(bg[1] * 255)}, ${Math.round(bg[2] * 255)})`);
|
|
45515
45968
|
}
|
|
45516
|
-
/** In the Status
|
|
45517
|
-
* arc from the top, clockwise, for the share approved,
|
|
45518
|
-
* it holds that needs review. Only on circles large
|
|
45519
|
-
* has been said. */
|
|
45520
|
-
drawProgress(
|
|
45521
|
-
if (this.scheme
|
|
45969
|
+
/** In the Status and Mine schemes, how far the review of each cluster on screen has come — the
|
|
45970
|
+
* reader's own in Mine —, on its outline: an arc from the top, clockwise, for the share approved,
|
|
45971
|
+
* then one for the share commented, of what it holds that needs review. Only on circles large
|
|
45972
|
+
* enough to read it, and only where something has been said. */
|
|
45973
|
+
drawProgress(onScreen2) {
|
|
45974
|
+
if (this.scheme === "kind" || !this.clusterProgress.length) return;
|
|
45522
45975
|
const S7 = this.scene;
|
|
45523
45976
|
const P2 = this.clusterProgress;
|
|
45524
45977
|
const ctx = this.ctx;
|
|
@@ -45537,7 +45990,7 @@ var GraphCanvas = class {
|
|
|
45537
45990
|
const r2 = rep === c3 ? Math.max(6, S7.drawnR[c3] * this.cam.k) : S7.drawnR[c3] * this.cam.k;
|
|
45538
45991
|
if (r2 < 18) continue;
|
|
45539
45992
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45540
|
-
if (!
|
|
45993
|
+
if (!onScreen2(sx, sy, r2)) continue;
|
|
45541
45994
|
let a3 = -Math.PI / 2;
|
|
45542
45995
|
for (let k2 = 0; k2 < 2; k2++) {
|
|
45543
45996
|
const share = P2[3 * c3 + k2] / total;
|
|
@@ -45553,7 +46006,7 @@ var GraphCanvas = class {
|
|
|
45553
46006
|
}
|
|
45554
46007
|
/** A gold five-pointed star on every target: on its point, or on the edge of the folded cluster
|
|
45555
46008
|
* hiding it. Never smaller than can be seen. */
|
|
45556
|
-
drawStars(
|
|
46009
|
+
drawStars(onScreen2, dotR) {
|
|
45557
46010
|
const targets = this.markedTargets();
|
|
45558
46011
|
if (!targets.length) return;
|
|
45559
46012
|
const ctx = this.ctx;
|
|
@@ -45580,7 +46033,7 @@ var GraphCanvas = class {
|
|
|
45580
46033
|
for (const i2 of targets) {
|
|
45581
46034
|
if (this.visibleNode(i2)) {
|
|
45582
46035
|
const [sx2, sy2] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45583
|
-
if (
|
|
46036
|
+
if (onScreen2(sx2, sy2, 20)) star(sx2, sy2, Math.max(9, dotR * 2.2));
|
|
45584
46037
|
continue;
|
|
45585
46038
|
}
|
|
45586
46039
|
const c3 = S7.nodeRep[i2];
|
|
@@ -45588,7 +46041,7 @@ var GraphCanvas = class {
|
|
|
45588
46041
|
seen.add(c3);
|
|
45589
46042
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45590
46043
|
const r2 = Math.max(6, S7.drawnR[c3] * this.cam.k);
|
|
45591
|
-
if (
|
|
46044
|
+
if (onScreen2(sx, sy, r2 + 20)) star(sx + r2 * 0.71, sy - r2 * 0.71, 7);
|
|
45592
46045
|
}
|
|
45593
46046
|
ctx.restore();
|
|
45594
46047
|
}
|
|
@@ -45596,7 +46049,7 @@ var GraphCanvas = class {
|
|
|
45596
46049
|
* still shows, and its name, written to the right, stays clear; hidden in a folded cluster, one
|
|
45597
46050
|
* on the edge of its disc, opposite the star's place. Never smaller than can be seen. An artwork
|
|
45598
46051
|
* whose targets are chosen draws only the keys of those it chose. */
|
|
45599
|
-
drawKeys(
|
|
46052
|
+
drawKeys(onScreen2, dotR) {
|
|
45600
46053
|
if (!this.keyList.length) return;
|
|
45601
46054
|
const on = this.art?.targets === "chosen" ? this.chosenTargets() : null;
|
|
45602
46055
|
const ctx = this.ctx;
|
|
@@ -45624,7 +46077,7 @@ var GraphCanvas = class {
|
|
|
45624
46077
|
if (this.visibleNode(i2)) {
|
|
45625
46078
|
const [sx2, sy2] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45626
46079
|
const out = outside(this.g.nodes[i2].kind) * 0.71;
|
|
45627
|
-
if (
|
|
46080
|
+
if (onScreen2(sx2, sy2, 12)) diamond(sx2 - dotR - out - R2 * 0.4, sy2 - dotR - out - R2 * 0.3, R2);
|
|
45628
46081
|
continue;
|
|
45629
46082
|
}
|
|
45630
46083
|
const c3 = S7.nodeRep[i2];
|
|
@@ -45632,13 +46085,13 @@ var GraphCanvas = class {
|
|
|
45632
46085
|
seen.add(c3);
|
|
45633
46086
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45634
46087
|
const r2 = Math.max(6, S7.drawnR[c3] * this.cam.k);
|
|
45635
|
-
if (
|
|
46088
|
+
if (onScreen2(sx, sy, r2 + 12)) diamond(sx - r2 * 0.71, sy - r2 * 0.71, 5);
|
|
45636
46089
|
}
|
|
45637
46090
|
ctx.restore();
|
|
45638
46091
|
}
|
|
45639
46092
|
/** Others' selections: a ring around the point, split between the readers on it, and their
|
|
45640
46093
|
* initials beside; hidden in a folded cluster, the same on the edge of its disc. */
|
|
45641
|
-
drawPeers(
|
|
46094
|
+
drawPeers(onScreen2, dotR) {
|
|
45642
46095
|
if (!this.peerMarks.size) return;
|
|
45643
46096
|
const ctx = this.ctx;
|
|
45644
46097
|
const S7 = this.scene;
|
|
@@ -45670,7 +46123,7 @@ var GraphCanvas = class {
|
|
|
45670
46123
|
if (i2 < 0 || i2 >= this.g.n) continue;
|
|
45671
46124
|
if (this.visibleNode(i2)) {
|
|
45672
46125
|
const [sx, sy] = this.toScreen(this.px[i2], this.py[i2]);
|
|
45673
|
-
if (
|
|
46126
|
+
if (onScreen2(sx, sy, 30)) mark(sx, sy, pickRadius(dotR, this.g.nodes[i2].kind), m3);
|
|
45674
46127
|
continue;
|
|
45675
46128
|
}
|
|
45676
46129
|
const c3 = S7.nodeRep[i2];
|
|
@@ -45683,7 +46136,7 @@ var GraphCanvas = class {
|
|
|
45683
46136
|
for (const [c3, m3] of folded) {
|
|
45684
46137
|
const [sx, sy] = this.toScreen(S7.cwx[c3], S7.cwy[c3]);
|
|
45685
46138
|
const r2 = Math.max(6, S7.drawnR[c3] * this.cam.k);
|
|
45686
|
-
if (
|
|
46139
|
+
if (onScreen2(sx, sy, r2 + 30)) mark(sx - r2 * 0.71, sy + r2 * 0.71, 6, m3);
|
|
45687
46140
|
}
|
|
45688
46141
|
ctx.restore();
|
|
45689
46142
|
}
|
|
@@ -45703,7 +46156,7 @@ var GraphCanvas = class {
|
|
|
45703
46156
|
/** The temporary clusters' names (ViewSpec decision 27), in italics: inside the top of a circle
|
|
45704
46157
|
* large enough on the screen, as a cluster's is, else just above it, or below where that is taken,
|
|
45705
46158
|
* each kept off the names already written. */
|
|
45706
|
-
tempLabels(place2,
|
|
46159
|
+
tempLabels(place2, onScreen2) {
|
|
45707
46160
|
const V2 = this.visits, W2 = this.visitW;
|
|
45708
46161
|
if (!V2 || !W2) return;
|
|
45709
46162
|
const ctx = this.ctx;
|
|
@@ -45713,7 +46166,7 @@ var GraphCanvas = class {
|
|
|
45713
46166
|
if (W2.trep[j2] >= 0 || t2.in >= 0 && !this.clusterVisible(t2.in)) return;
|
|
45714
46167
|
const [sx, sy] = this.toScreen(W2.tx[j2], W2.ty[j2]);
|
|
45715
46168
|
const sr = W2.tr[j2] * k2;
|
|
45716
|
-
if (sr < 3 || !
|
|
46169
|
+
if (sr < 3 || !onScreen2(sx, sy, sr + 60)) return;
|
|
45717
46170
|
const size = sr > 38 ? Math.max(10, Math.min(20, 9 + sr / 40)) : 11;
|
|
45718
46171
|
ctx.font = `italic 500 ${size}px ${FONT}`;
|
|
45719
46172
|
if (sr > 38 && place2(t2.label, sx, sy - sr + size + 6, size)) return;
|
|
@@ -45770,7 +46223,7 @@ var GraphCanvas = class {
|
|
|
45770
46223
|
* temporary, not of the board — on a halo of the canvas's colour, its name beside it in italics, a
|
|
45771
46224
|
* target's star and a key declaration's diamond as on any point. One inside a folded cluster is not
|
|
45772
46225
|
* drawn: the cluster's card carries a marker, a dashed ring with how many it hides. */
|
|
45773
|
-
drawVisitors(
|
|
46226
|
+
drawVisitors(onScreen2) {
|
|
45774
46227
|
const W2 = this.visitW;
|
|
45775
46228
|
if (!this.visitors.length || !W2) return;
|
|
45776
46229
|
const ctx = this.ctx;
|
|
@@ -45786,8 +46239,8 @@ var GraphCanvas = class {
|
|
|
45786
46239
|
if (k2 >= W2.vx.length) return;
|
|
45787
46240
|
if (W2.vrep[k2] >= 0) return void hidden.set(W2.vrep[k2], (hidden.get(W2.vrep[k2]) ?? 0) + 1);
|
|
45788
46241
|
const [x2, y2] = this.toScreen(W2.vx[k2], W2.vy[k2]);
|
|
45789
|
-
if (!
|
|
45790
|
-
const c3 = this.scheme
|
|
46242
|
+
if (!onScreen2(x2, y2, 200)) return;
|
|
46243
|
+
const c3 = this.scheme !== "kind" ? th.status[v2.status] ?? th.status[ST_UNREVIEWED] : v2.kind === "external" ? th.ext : th.kind[v2.kind] ?? th.ext;
|
|
45791
46244
|
ctx.fillStyle = css(th.bg);
|
|
45792
46245
|
ctx.beginPath();
|
|
45793
46246
|
ctx.arc(x2, y2, R2 + 3 + (v2.axiom ? AXIOM_OUT : 0), 0, 2 * Math.PI);
|
|
@@ -45847,7 +46300,7 @@ var GraphCanvas = class {
|
|
|
45847
46300
|
for (const [c3, n3] of hidden) {
|
|
45848
46301
|
if (!this.clusterVisible(c3)) continue;
|
|
45849
46302
|
const [x2, y2] = this.visitMarkAt(c3);
|
|
45850
|
-
if (!
|
|
46303
|
+
if (!onScreen2(x2, y2, 20)) continue;
|
|
45851
46304
|
ctx.fillStyle = css(th.bg);
|
|
45852
46305
|
ctx.beginPath();
|
|
45853
46306
|
ctx.arc(x2, y2, 8, 0, 2 * Math.PI);
|
|
@@ -46169,7 +46622,7 @@ var GraphCanvas = class {
|
|
|
46169
46622
|
const g2 = this.g;
|
|
46170
46623
|
const v2 = g2.nodes[i2];
|
|
46171
46624
|
const el = document.createElement("div");
|
|
46172
|
-
const st2 = this.scheme
|
|
46625
|
+
const st2 = this.scheme !== "kind" ? ` ss s-${STATUSES2[this.statusCode[i2] ?? ST_UNREVIEWED]}` : "";
|
|
46173
46626
|
el.className = `card ${kindDot(v2.kind, g2.isExt(i2))}${st2}${this.targetList.includes(i2) ? " target" : this.keyList.includes(i2) ? " key" : ""}`;
|
|
46174
46627
|
el.dataset.node = String(i2);
|
|
46175
46628
|
const marks = this.pastMarks?.[i2] ?? 0;
|
|
@@ -46410,7 +46863,7 @@ function noteBoard(L2, mode, nodes) {
|
|
|
46410
46863
|
const inner = { namespace: innerKeys("namespace", nodes), module: innerKeys("module", nodes) };
|
|
46411
46864
|
const on = { namespace: /* @__PURE__ */ new Set(), module: /* @__PURE__ */ new Set() };
|
|
46412
46865
|
const stands = /* @__PURE__ */ new Map();
|
|
46413
|
-
const
|
|
46866
|
+
const meet2 = (a3, b2) => {
|
|
46414
46867
|
while (a3 !== b2) {
|
|
46415
46868
|
if (a3 < 0 || b2 < 0) return -1;
|
|
46416
46869
|
if (L2.clusters[a3].depth >= L2.clusters[b2].depth) a3 = L2.clusters[a3].parent;
|
|
@@ -46422,12 +46875,12 @@ function noteBoard(L2, mode, nodes) {
|
|
|
46422
46875
|
inner[mode].forEach((key, j2) => {
|
|
46423
46876
|
const c3 = L2.cluster[j2] ?? -1;
|
|
46424
46877
|
const was = own2.get(key);
|
|
46425
|
-
own2.set(key, was === void 0 ? c3 :
|
|
46878
|
+
own2.set(key, was === void 0 ? c3 : meet2(was, c3));
|
|
46426
46879
|
});
|
|
46427
46880
|
for (const [key, c3] of own2)
|
|
46428
46881
|
for (const k2 of keyChain(key)) {
|
|
46429
46882
|
const was = stands.get(k2);
|
|
46430
|
-
stands.set(k2, was === void 0 ? c3 :
|
|
46883
|
+
stands.set(k2, was === void 0 ? c3 : meet2(was, c3));
|
|
46431
46884
|
}
|
|
46432
46885
|
for (const k2 of stands.keys()) on[mode].add(k2);
|
|
46433
46886
|
const other = otherMode(mode);
|
|
@@ -47550,8 +48003,8 @@ var Stickies = class {
|
|
|
47550
48003
|
if (!b2 || !nb) return null;
|
|
47551
48004
|
if (kind === "view") return { kind, place: placeAt(b2.mode, world, this.clusters()) };
|
|
47552
48005
|
const clusters = this.clusters(true);
|
|
47553
|
-
const
|
|
47554
|
-
if (
|
|
48006
|
+
const inside3 = placeIn2(world, clusters, nb);
|
|
48007
|
+
if (inside3) return { kind, mode: b2.mode, place: inside3 };
|
|
47555
48008
|
const ring = this.ring ?? this.ringNow();
|
|
47556
48009
|
return ring ? { kind, mode: b2.mode, place: { ring: angleOf(ring, world[0], world[1]) } } : null;
|
|
47557
48010
|
}
|
|
@@ -48065,18 +48518,18 @@ var LinearForm = class {
|
|
|
48065
48518
|
if (!fold2) note(it2, depth, group, inKey, false);
|
|
48066
48519
|
} else {
|
|
48067
48520
|
const s2 = it2;
|
|
48068
|
-
const
|
|
48521
|
+
const inside3 = [...path, s2.key];
|
|
48069
48522
|
if (fold2) {
|
|
48070
|
-
walk2(s2.items, depth + 1, s2.key, fold2,
|
|
48523
|
+
walk2(s2.items, depth + 1, s2.key, fold2, inside3);
|
|
48071
48524
|
continue;
|
|
48072
48525
|
}
|
|
48073
48526
|
const folded = this.isFolded(s2.key, s2.items.length);
|
|
48074
48527
|
const row = { kind: "section", k: clusterOf2.get(s2.key) ?? -1, move: clusterOf2.get(s2.keys[0]) ?? -1, name: s2.key, label: `${s2.number ? `${s2.number} ` : ""}${s2.title}`, depth, y0: y2, y1: 0, cy: 0, item: s2, group, in: inKey, ...folded ? { members: [] } : {} };
|
|
48075
48528
|
rows.push(row);
|
|
48076
48529
|
y2 += ROW;
|
|
48077
|
-
if (folded) walk2(s2.items, depth + 1, s2.key, row,
|
|
48530
|
+
if (folded) walk2(s2.items, depth + 1, s2.key, row, inside3);
|
|
48078
48531
|
else {
|
|
48079
|
-
walk2(s2.items, depth + 1, s2.key, null,
|
|
48532
|
+
walk2(s2.items, depth + 1, s2.key, null, inside3);
|
|
48080
48533
|
y2 += PAD;
|
|
48081
48534
|
}
|
|
48082
48535
|
row.y1 = y2;
|
|
@@ -48270,10 +48723,10 @@ var LinearForm = class {
|
|
|
48270
48723
|
const k2 = this.cam.k;
|
|
48271
48724
|
const p2 = ease2(this.t);
|
|
48272
48725
|
const sy = (y2) => v2.top + (y2 - this.cam.y) * k2;
|
|
48273
|
-
const
|
|
48726
|
+
const onScreen2 = (y0, y1) => sy(y1) > -40 && sy(y0) < h2 + 40;
|
|
48274
48727
|
const oy = (r2) => this.off.get(keyOf2(r2))?.dy ?? 0;
|
|
48275
48728
|
const ox = (r2) => this.off.get(keyOf2(r2))?.dx ?? 0;
|
|
48276
|
-
const shown2 = (r2, y0, y1) =>
|
|
48729
|
+
const shown2 = (r2, y0, y1) => onScreen2(y0 + oy(r2), y1 + oy(r2));
|
|
48277
48730
|
const at = (r2, y2, rad) => {
|
|
48278
48731
|
const f2 = r2.from;
|
|
48279
48732
|
const x2 = v2.x + ox(r2), yy = sy(y2 + oy(r2));
|
|
@@ -48490,6 +48943,45 @@ var LinearForm = class {
|
|
|
48490
48943
|
c3.lineWidth = 1;
|
|
48491
48944
|
c3.globalAlpha = 1;
|
|
48492
48945
|
}
|
|
48946
|
+
// ---------------------------------------------------------------- another reader's pointer
|
|
48947
|
+
/** Where a point of the screen is on the line, as another page finds it again (web/src/pointers.ts;
|
|
48948
|
+
* the owner's decisions of 2026-10-20): the row at its height, by its key, how far down that row
|
|
48949
|
+
* (0–1), and how far right of the line in the outline's units; null off every row. */
|
|
48950
|
+
pointAt(x2, y2) {
|
|
48951
|
+
if (!this.shown || this.t < 1) return null;
|
|
48952
|
+
const box = this.el.getBoundingClientRect();
|
|
48953
|
+
const v2 = this.view();
|
|
48954
|
+
const oy = this.cam.y + (y2 - box.top - v2.top) / this.cam.k;
|
|
48955
|
+
for (const r2 of this.byY) {
|
|
48956
|
+
const bottom = r2.kind === "section" ? r2.y0 + ROW : r2.y1;
|
|
48957
|
+
if (oy >= r2.y0 && oy < bottom) return [keyOf2(r2), (oy - r2.y0) / Math.max(1, bottom - r2.y0), (x2 - box.left - v2.x) / this.cam.k];
|
|
48958
|
+
}
|
|
48959
|
+
return null;
|
|
48960
|
+
}
|
|
48961
|
+
/** The point of the screen `pointAt` said, on this page's line: null where the row is not drawn
|
|
48962
|
+
* here (folded in a section, or not in this outline). */
|
|
48963
|
+
screenOf([key, fy, dx]) {
|
|
48964
|
+
if (!this.shown || this.t < 1) return null;
|
|
48965
|
+
const r2 = this.rows.find((q2) => keyOf2(q2) === key);
|
|
48966
|
+
if (!r2 || !this.byY.includes(r2)) return null;
|
|
48967
|
+
const box = this.el.getBoundingClientRect();
|
|
48968
|
+
const v2 = this.view();
|
|
48969
|
+
const bottom = r2.kind === "section" ? r2.y0 + ROW : r2.y1;
|
|
48970
|
+
return [box.left + v2.x + dx * this.cam.k, box.top + v2.top + (r2.y0 + fy * (bottom - r2.y0) - this.cam.y) * this.cam.k];
|
|
48971
|
+
}
|
|
48972
|
+
/** The room the line has on the screen. */
|
|
48973
|
+
room() {
|
|
48974
|
+
const box = this.el.getBoundingClientRect();
|
|
48975
|
+
const { insets } = this.canvas.screen;
|
|
48976
|
+
return { left: box.left + insets.left, top: box.top + insets.top, right: box.right - insets.right, bottom: box.bottom - insets.bottom };
|
|
48977
|
+
}
|
|
48978
|
+
/** Bring a row into view: this reader's own scrolling of the line. */
|
|
48979
|
+
reveal(key) {
|
|
48980
|
+
const r2 = this.rows.find((q2) => keyOf2(q2) === key);
|
|
48981
|
+
if (!r2) return;
|
|
48982
|
+
this.cam = { ...this.cam, y: Math.max(0, r2.cy - this.view().h / (3 * this.cam.k)) };
|
|
48983
|
+
this.request();
|
|
48984
|
+
}
|
|
48493
48985
|
// ---------------------------------------------------------------- the pointer
|
|
48494
48986
|
/** The row at a point of the screen: the one at its height (a section by its heading's row) whose
|
|
48495
48987
|
* point and name it is over, from a little left of the line to a little past the name's end. */
|
|
@@ -48926,8 +49418,8 @@ function boardPart(page) {
|
|
|
48926
49418
|
const v2 = page.vg().nodes[i2];
|
|
48927
49419
|
const f2 = canvas.fileOf(i2);
|
|
48928
49420
|
const ss = STATUSES2[canvas.statusOf(i2)];
|
|
48929
|
-
const st2 = canvas.scheme === "status" ? ` <span class="tip-st">${STATUS_LABEL[ss]}</span>` : f2 && STATE_LABEL[f2.state] ? ` <span class="tip-st st-${f2.state}">${STATE_LABEL[f2.state]}</span>` : "";
|
|
48930
|
-
const dot = canvas.scheme
|
|
49421
|
+
const st2 = canvas.scheme === "status" ? ` <span class="tip-st">${STATUS_LABEL[ss]}</span>` : canvas.scheme === "mine" ? ` <span class="tip-st">${escapeHtml(mineLabel(canvas.statusOf(i2), page.mineWhose()))}</span>` : f2 && STATE_LABEL[f2.state] ? ` <span class="tip-st st-${f2.state}">${STATE_LABEL[f2.state]}</span>` : "";
|
|
49422
|
+
const dot = canvas.scheme !== "kind" ? `ss s-${ss}${page.vg().isExt(i2) ? " k-external" : ""}${ringed(v2.kind) ? " axiom" : ""}` : kindDot(v2.kind, page.vg().isExt(i2));
|
|
48931
49423
|
const then = markWords(canvas.pastMarkOf(i2), canvas.nowNameOf(i2));
|
|
48932
49424
|
tip.innerHTML = `<span class="dot ${dot}"></span>${escapeHtml(v2.name)}${st2}${then.length ? ` <span class="tip-st tip-tm">${escapeHtml(then.join(" \xB7 "))}</span>` : ""}`;
|
|
48933
49425
|
} else if (t2.kind === "visitor") {
|
|
@@ -48936,8 +49428,8 @@ function boardPart(page) {
|
|
|
48936
49428
|
if (!vis || i2 === void 0) return void (tip.hidden = true);
|
|
48937
49429
|
const dot = kindDot(page.g.nodes[i2].kind, page.g.isExt(i2));
|
|
48938
49430
|
const card = canvas.visitorCard(t2.k);
|
|
48939
|
-
const
|
|
48940
|
-
tip.innerHTML = `<span class="dot ${dot}"></span>${escapeHtml(vis.name)} <span class="tip-st tip-visit">visiting \u2014 not on this board${vis.from ? `; reached from ${escapeHtml(short2(vis.from))}` : ""}${
|
|
49431
|
+
const inside3 = card >= 0 ? `; inside folded ${escapeHtml(canvas.layout.clusters[card].label)}, a click opens it for you` : "";
|
|
49432
|
+
tip.innerHTML = `<span class="dot ${dot}"></span>${escapeHtml(vis.name)} <span class="tip-st tip-visit">visiting \u2014 not on this board${vis.from ? `; reached from ${escapeHtml(short2(vis.from))}` : ""}${inside3} \xB7 Add to view keeps it</span>`;
|
|
48941
49433
|
} else {
|
|
48942
49434
|
const cl = canvas.layout.clusters[t2.c];
|
|
48943
49435
|
const what = canvas.openForVisitor(t2.c) ? "folded on this board, open for your visitor \xB7 double-click to open it for everyone" : `click to select \xB7 double-click to ${canvas.folded.has(t2.c) ? "open" : "fold"}`;
|
|
@@ -50401,7 +50893,7 @@ var ArtFrame = class {
|
|
|
50401
50893
|
if (!s2) return;
|
|
50402
50894
|
this.renderSky();
|
|
50403
50895
|
this.renderInk();
|
|
50404
|
-
const
|
|
50896
|
+
const scrolls3 = [...this.panel.querySelectorAll("[data-art-rows]")].map((el) => [el.dataset.artRows, el.scrollTop]);
|
|
50405
50897
|
const was = document.activeElement instanceof HTMLElement && this.panel.contains(document.activeElement) ? document.activeElement : null;
|
|
50406
50898
|
const mark = was && ["art", "artName", "artTarget", "artPick", "artFilter"].find((k2) => was.dataset[k2] !== void 0);
|
|
50407
50899
|
const caret = was instanceof HTMLInputElement && mark === "artFilter" ? [was.selectionStart, was.selectionEnd] : null;
|
|
@@ -50438,7 +50930,7 @@ var ArtFrame = class {
|
|
|
50438
50930
|
const foot = Math.min(s2.footSize, most);
|
|
50439
50931
|
this.tail.innerHTML = check("source", "Source and commit", source ?? "This project is not a git repository", !source) + `<label class="ex-field art-size"><span>Size <output data-art-foot-size>${foot}%</output></span><input type="range" data-art="footSize" min="${FOOT_SIZE.least}" max="${most}" step="0.1" value="${foot}" aria-label="The foot's size, in hundredths of the picture's height"></label>`;
|
|
50440
50932
|
if (this.rect.w) this.placeStrips();
|
|
50441
|
-
for (const [k2, top] of
|
|
50933
|
+
for (const [k2, top] of scrolls3) {
|
|
50442
50934
|
const el = this.panel.querySelector(`[data-art-rows="${k2}"]`);
|
|
50443
50935
|
if (el) el.scrollTop = top;
|
|
50444
50936
|
}
|
|
@@ -50654,7 +51146,8 @@ function artPart(page) {
|
|
|
50654
51146
|
S7.artwork = { ...s2 };
|
|
50655
51147
|
store2.save();
|
|
50656
51148
|
},
|
|
50657
|
-
|
|
51149
|
+
// a picture is drawn by kind or by status: Mine, the reader's own, starts it by status
|
|
51150
|
+
now: () => ({ scheme: page.canvas.scheme === "kind" ? "kind" : "status", theme: document.documentElement.dataset.theme === "dark" ? "dark" : "light" }),
|
|
50658
51151
|
look: (s2) => {
|
|
50659
51152
|
const coming = !page.artLook && !!s2;
|
|
50660
51153
|
page.artLook = s2 && { ...s2 };
|
|
@@ -50747,6 +51240,7 @@ var OFFERED = [
|
|
|
50747
51240
|
{ label: "Only stale", c: { op: "and", q: { op: "status", statuses: ["stale"] } } },
|
|
50748
51241
|
{ label: "Only commented", c: { op: "and", q: { op: "status", statuses: ["commented"] } } },
|
|
50749
51242
|
{ label: "Except approved", c: { op: "except", q: { op: "status", statuses: ["approved"] } } },
|
|
51243
|
+
{ label: "Only not reviewed by me", c: { op: "and", q: { op: "mine", statuses: ["none"] } } },
|
|
50750
51244
|
{ label: "Only what an agent comments on", c: { op: "and", q: { op: "advice", verdicts: ["comment"] } } },
|
|
50751
51245
|
{ label: "Only theorems", c: { op: "and", q: { op: "kind", kinds: ["theorem"] } } },
|
|
50752
51246
|
{ label: "Only definitions", c: { op: "and", q: { op: "kind", kinds: ["def"] } } },
|
|
@@ -50801,7 +51295,7 @@ var BoardPanel = class {
|
|
|
50801
51295
|
if (!shut && fixedScope(v2.rec)) {
|
|
50802
51296
|
html += `<div class="scope" role="group" aria-label="Scope"><span class="schip" title="${escapeHtml(printQuery(v2.rec.scope))}">${escapeHtml(describe(base))}</span></div><div class="scope-help muted">${escapeHtml(PROJECT_SCOPE)}</div>`;
|
|
50803
51297
|
} else if (!shut && this.editing === "text") {
|
|
50804
|
-
html += `<form class="scope-edit" data-form="text"><input class="scope-input" value="${escapeHtml(printQuery(v2.rec.scope))}" spellcheck="false" autocomplete="off" aria-label="The scope, as a query"><div class="scope-help muted">all, tcb(A), uses(A), usedBy(A), decl(A), ns(P), file(P), trusted, external, kind(theorem), status(unreviewed), advice(comment), sorry, nonstandard \u2014 joined by and, or, except. Enter applies it for everyone; Esc leaves it.</div>` + (this.error ? `<div class="modal-err">${escapeHtml(this.error)}</div>` : "") + `</form>`;
|
|
51298
|
+
html += `<form class="scope-edit" data-form="text"><input class="scope-input" value="${escapeHtml(printQuery(v2.rec.scope))}" spellcheck="false" autocomplete="off" aria-label="The scope, as a query"><div class="scope-help muted">all, tcb(A), uses(A), usedBy(A), decl(A), ns(P), file(P), trusted, external, kind(theorem), status(unreviewed), advice(comment), mine(none), sorry, nonstandard \u2014 joined by and, or, except. Enter applies it for everyone; Esc leaves it.</div>` + (this.error ? `<div class="modal-err">${escapeHtml(this.error)}</div>` : "") + `</form>`;
|
|
50805
51299
|
} else if (!shut) {
|
|
50806
51300
|
html += `<div class="scope" role="group" aria-label="Scope"><button class="schip base" data-text title="${escapeHtml(printQuery(v2.rec.scope))} \u2014 click to write the scope as a query">${escapeHtml(describe(base))}</button>` + conditions.map((c3, k2) => `<span class="schip" title="${escapeHtml(text(c3))}">${escapeHtml(describeCondition(c3))}<button class="schip-x" data-rm="${k2}" title="Take this condition off, for everyone" aria-label="Remove">\xD7</button></span>`).join("") + `<button class="schip add${this.editing === "add" ? " on" : ""}" data-add title="Add a condition, for everyone">+</button></div>`;
|
|
50807
51301
|
if (this.editing === "add") {
|
|
@@ -51777,7 +52271,8 @@ function layoutPart(page) {
|
|
|
51777
52271
|
}
|
|
51778
52272
|
|
|
51779
52273
|
// src/web/src/legend.ts
|
|
51780
|
-
var NAME2 = { kind: "Kind", status: "Status" };
|
|
52274
|
+
var NAME2 = { kind: "Kind", status: "Status", mine: "Mine" };
|
|
52275
|
+
var WHAT = { kind: "kind", status: "status", mine: "your own review: your opinions alone" };
|
|
51781
52276
|
var Legend = class {
|
|
51782
52277
|
el;
|
|
51783
52278
|
hooks;
|
|
@@ -51805,29 +52300,60 @@ var Legend = class {
|
|
|
51805
52300
|
const scheme = this.hooks.scheme();
|
|
51806
52301
|
const { status, kinds } = this.hooks.counts();
|
|
51807
52302
|
const n3 = (x2) => x2.toLocaleString();
|
|
52303
|
+
const byReview = scheme !== "kind";
|
|
52304
|
+
const whose = scheme === "mine" ? this.hooks.mineWhose() : null;
|
|
52305
|
+
const none = scheme === "mine" && this.hooks.mineNone();
|
|
51808
52306
|
const counted2 = status.reduce((a3, b2) => a3 + b2, 0) - status[ST_TRUSTED];
|
|
51809
52307
|
const share = (k2) => counted2 ? 100 * status[k2] / counted2 : 0;
|
|
51810
|
-
const progress = `${n3(status[ST_APPROVED])} of ${n3(counted2)} approved`;
|
|
51811
|
-
const
|
|
52308
|
+
const progress = `${n3(status[ST_APPROVED])} of ${n3(counted2)} approved${scheme === "mine" ? ` by ${whose ?? "you"}` : ""}`;
|
|
52309
|
+
const name = whose ? `${whose}'s` : NAME2[scheme];
|
|
52310
|
+
const tip = `Colour by kind, by status or by your own review (c). ${byReview && !none ? `On this board: ${progress}. ` : ""}Click for the legend.`;
|
|
51812
52311
|
if (!this.hooks.isOpen()) {
|
|
51813
|
-
const pie =
|
|
51814
|
-
this.el.innerHTML = `<button class="lg-chip" data-lg-open aria-expanded="false" title="${escapeHtml(tip)}"><span class="lg-swatch lg-${scheme}"${pie ? ` style="${pie}"` : ""}></span>${
|
|
52312
|
+
const pie = byReview && !none ? `background: conic-gradient(var(--status-approved) 0 ${share(ST_APPROVED)}%, var(--status-commented) 0 ${share(ST_APPROVED) + share(ST_COMMENTED)}%, var(--status-stale) 0 ${share(ST_APPROVED) + share(ST_COMMENTED) + share(ST_STALE)}%, var(--status-unreviewed) 0)` : "";
|
|
52313
|
+
this.el.innerHTML = `<button class="lg-chip" data-lg-open aria-expanded="false" title="${escapeHtml(tip)}"><span class="lg-swatch lg-${scheme}"${pie ? ` style="${pie}"` : ""}></span>${escapeHtml(name)}` + (byReview && !none ? `<span class="lg-chip-n">${n3(status[ST_APPROVED])}/${n3(counted2)}</span>` : "") + `<span class="lg-chev" aria-hidden="true">\u25BE</span></button>`;
|
|
51815
52314
|
return;
|
|
51816
52315
|
}
|
|
51817
|
-
const row = (dot,
|
|
51818
|
-
const rows = scheme === "status" ? STATUSES2.map((st2, k2) => row(`<span class="dot ss s-${st2}"></span>`, STATUS_LABEL[st2], status[k2], STATUS_HINT[st2])).join("") : [...KINDS2, "external"].map((k2, j2) => row(`<span class="dot k-${k2}"></span>`, k2 === "external" ? "outside the project" : k2, kinds[j2], k2 === "axiom" ? "axiom: its point ringed,
|
|
51819
|
-
const summary3 =
|
|
51820
|
-
|
|
51821
|
-
|
|
52316
|
+
const row = (dot, name2, count2, title) => `<div class="lg-row${count2 ? "" : " none"}" title="${escapeHtml(title)}">${dot}<span class="lg-name">${escapeHtml(name2)}</span><span class="lg-n">${n3(count2)}</span></div>`;
|
|
52317
|
+
const rows = scheme === "status" ? STATUSES2.map((st2, k2) => row(`<span class="dot ss s-${st2}"></span>`, STATUS_LABEL[st2], status[k2], STATUS_HINT[st2])).join("") : scheme === "mine" ? MINE_STATES.map((k2) => row(`<span class="dot ss s-${STATUSES2[k2]}"></span>`, STATUS_LABEL[STATUSES2[k2]], status[k2], mineHint(k2, whose))).join("") : [...KINDS2, "external"].map((k2, j2) => row(`<span class="dot k-${k2}"></span>`, k2 === "external" ? "outside the project" : k2, kinds[j2], k2 === "axiom" ? "axiom: its point ringed, in every scheme" : k2)).join("");
|
|
52318
|
+
const summary3 = byReview && !none ? `<div class="lg-prog" title="Of the ${n3(counted2)} declarations on this board that need review (all but what is trusted)"><div class="rv-bar"><i class="ok" style="width:${share(ST_APPROVED).toFixed(1)}%"></i><i class="commented" style="width:${share(ST_COMMENTED).toFixed(1)}%"></i><i class="stale" style="width:${share(ST_STALE).toFixed(1)}%"></i></div><span>${progress}</span></div>` : "";
|
|
52319
|
+
const mineLine = scheme !== "mine" ? "" : none ? `<div class="lg-mine lg-none">You have no name yet, so no opinions of your own to show: give one (your name, top right) and the board is coloured by what you said.</div>` : `<div class="lg-mine">${whose ? `${escapeHtml(whose)}'s own opinions, as you follow ${escapeHtml(whose)}` : "Your own opinions alone: what others said is not here"}</div>`;
|
|
52320
|
+
this.el.innerHTML = `<div class="lg-card" role="group" aria-label="Legend"><div class="lg-head"><nav class="seg mini" aria-label="Colour by">` + SCHEMES_SHOWN.map((s2) => `<button data-scheme="${s2}" class="${s2 === scheme ? "on" : ""}" aria-pressed="${s2 === scheme}" title="Colour the points by ${WHAT[s2]} (c)">${NAME2[s2]}</button>`).join("") + `</nav><button class="lg-x" data-lg-close aria-expanded="true" title="Fold the legend" aria-label="Fold the legend">\u25BE</button></div>` + mineLine + summary3 + `<div class="lg-rows">${rows}</div>` + // by status or one's own, what says an axiom where its colour does not: its ring (by kind, its
|
|
52321
|
+
// row's dot)
|
|
52322
|
+
(byReview ? `<div class="lg-edge lg-ring" title="An axiom's point is ringed, in every scheme"><span class="dot axiom"></span>ringed: an axiom</div>` : "") + `<div class="lg-edge" title="An edge runs from the declaration that uses to the one it uses">uses<span class="edge-key"></span>used</div>` + (this.hooks.keyEdges() ? `<div class="lg-edge lg-keys" title="Under Keys, what is lit is joined by the key graph: an edge from A to B says A rests on B through declarations that are not key"><span class="lg-keys-l">rests on<span class="edge-key dashed"></span>key</span><span class="lg-keys-n">the key graph: through what is not key</span></div>` : "") + `</div>`;
|
|
51822
52323
|
}
|
|
51823
52324
|
};
|
|
51824
52325
|
|
|
51825
52326
|
// src/web/src/pagescheme.ts
|
|
51826
52327
|
function schemePart(page) {
|
|
51827
52328
|
const { store: store2, S: S7 } = page;
|
|
52329
|
+
const mineWhose = () => {
|
|
52330
|
+
const k2 = page.people.followedKey;
|
|
52331
|
+
return k2 && (k2.startsWith("v:") || k2.startsWith("n:")) ? k2.slice(2) : null;
|
|
52332
|
+
};
|
|
52333
|
+
const mineAuthor = () => {
|
|
52334
|
+
const whose = mineWhose();
|
|
52335
|
+
if (whose !== null) {
|
|
52336
|
+
const id = page.people.followedKey.startsWith("v:") ? invitedId(whose) : null;
|
|
52337
|
+
return id ? { by: whose, person: id } : { by: whose };
|
|
52338
|
+
}
|
|
52339
|
+
return readerAuthor();
|
|
52340
|
+
};
|
|
52341
|
+
const readerAuthor = () => {
|
|
52342
|
+
const me = page.people.name?.trim() || null;
|
|
52343
|
+
const person = page.people.person?.id ?? null;
|
|
52344
|
+
return person ? { by: me ?? "", person } : me ? { by: me } : null;
|
|
52345
|
+
};
|
|
52346
|
+
let mineWas = "";
|
|
52347
|
+
const mineKey = () => JSON.stringify(mineAuthor());
|
|
52348
|
+
const syncCodes = () => {
|
|
52349
|
+
const G2 = page.vg();
|
|
52350
|
+
const d2 = page.boardReview();
|
|
52351
|
+
mineWas = mineKey();
|
|
52352
|
+
page.canvas.setStatus(page.canvas.scheme === "mine" ? mineCodes(d2, G2, mineAuthor()) : statusCodes(d2, G2, page.pastShown() ? /* @__PURE__ */ new Map() : page.fileIndex));
|
|
52353
|
+
};
|
|
51828
52354
|
const syncStatus = () => {
|
|
51829
52355
|
const G2 = page.vg();
|
|
51830
|
-
|
|
52356
|
+
syncCodes();
|
|
51831
52357
|
page.canvas.setTargets(Object.keys(page.review.data.targets).map((n3) => G2.byName.get(n3)).filter((j2) => j2 !== void 0));
|
|
51832
52358
|
const r2 = page.reviewRoot();
|
|
51833
52359
|
const roots3 = r2 !== null ? [r2] : Object.keys(page.review.data.targets).map((n3) => page.g.byName.get(n3)).filter((j2) => j2 !== void 0);
|
|
@@ -51845,10 +52371,21 @@ function schemePart(page) {
|
|
|
51845
52371
|
legend.render();
|
|
51846
52372
|
page.art.refresh();
|
|
51847
52373
|
};
|
|
52374
|
+
const pointState = (i2) => {
|
|
52375
|
+
const g2 = page.g;
|
|
52376
|
+
const d2 = page.boardReview();
|
|
52377
|
+
if (page.canvas.scheme === "mine") return mineState(d2, g2, i2, mineAuthor());
|
|
52378
|
+
return statusState(d2, g2, i2, g2.isExt(i2) || page.pastShown() ? void 0 : page.fileIndex.get(g2.nodes[i2].module), g2.axiomsOf(i2).includes("sorryAx"));
|
|
52379
|
+
};
|
|
51848
52380
|
const onReview = () => page.reviewRoot() !== null;
|
|
51849
52381
|
const ownScheme = () => store2.schemeFor(onReview());
|
|
51850
52382
|
const applyScheme = () => {
|
|
52383
|
+
const was = page.canvas.scheme;
|
|
51851
52384
|
page.canvas.setScheme(page.artLook?.scheme ?? ownScheme());
|
|
52385
|
+
if (was === "mine" !== (page.canvas.scheme === "mine")) {
|
|
52386
|
+
syncCodes();
|
|
52387
|
+
page.drawVisitors();
|
|
52388
|
+
}
|
|
51852
52389
|
legend.render();
|
|
51853
52390
|
};
|
|
51854
52391
|
const chooseScheme = (s2) => {
|
|
@@ -51856,6 +52393,13 @@ function schemePart(page) {
|
|
|
51856
52393
|
applyScheme();
|
|
51857
52394
|
page.people.report();
|
|
51858
52395
|
};
|
|
52396
|
+
const nextScheme = () => SCHEMES_SHOWN[(SCHEMES_SHOWN.indexOf(ownScheme()) + 1) % SCHEMES_SHOWN.length];
|
|
52397
|
+
const mineChanged = () => {
|
|
52398
|
+
const k2 = mineKey();
|
|
52399
|
+
if (k2 === mineWas) return;
|
|
52400
|
+
mineWas = k2;
|
|
52401
|
+
page.reviewChanged();
|
|
52402
|
+
};
|
|
51859
52403
|
const legend = new Legend($("#legend"), {
|
|
51860
52404
|
scheme: () => page.canvas.scheme,
|
|
51861
52405
|
setScheme: chooseScheme,
|
|
@@ -51865,9 +52409,11 @@ function schemePart(page) {
|
|
|
51865
52409
|
S7.legend = open;
|
|
51866
52410
|
store2.save();
|
|
51867
52411
|
},
|
|
51868
|
-
keyEdges: () => S7.mode === "keys"
|
|
52412
|
+
keyEdges: () => S7.mode === "keys",
|
|
52413
|
+
mineWhose,
|
|
52414
|
+
mineNone: () => mineAuthor() === null
|
|
51869
52415
|
});
|
|
51870
|
-
return { syncStatus, ownScheme, applyScheme, chooseScheme, legend };
|
|
52416
|
+
return { syncStatus, ownScheme, applyScheme, chooseScheme, nextScheme, pointState, mineAuthor, mineWhose, readerAuthor, mineChanged, legend };
|
|
51871
52417
|
}
|
|
51872
52418
|
|
|
51873
52419
|
// src/web/src/pagefollow.ts
|
|
@@ -51900,6 +52446,8 @@ function followPart(page) {
|
|
|
51900
52446
|
colouring: () => ({ scheme: page.ownScheme() }),
|
|
51901
52447
|
edges: () => ({ edges: S7.showEdges }),
|
|
51902
52448
|
linear: () => ({ linear: page.linear.shown }),
|
|
52449
|
+
// the Export window (the owner's decision of 2026-10-20): open or closed, its settings, its job
|
|
52450
|
+
export: () => ({ export: page.exportModal.state() }),
|
|
51903
52451
|
artwork: () => ({ artwork: page.art.view() })
|
|
51904
52452
|
},
|
|
51905
52453
|
// what this page shows is this reader's own once following ends, so it is kept as shown: the
|
|
@@ -51907,15 +52455,22 @@ function followPart(page) {
|
|
|
51907
52455
|
apply: {
|
|
51908
52456
|
activity: (v2) => page.activity.mirror(v2.activity),
|
|
51909
52457
|
lostFound: (v2) => page.lostDrawer.toggle(v2.lostFound.open),
|
|
52458
|
+
// Mine is the followed reader's own opinions while following them (web/src/pagescheme.ts)
|
|
51910
52459
|
colouring: (v2) => {
|
|
51911
52460
|
if (page.ownScheme() !== v2.scheme) page.chooseScheme(v2.scheme);
|
|
52461
|
+
page.mineChanged();
|
|
51912
52462
|
},
|
|
51913
52463
|
edges: (v2) => page.setEdges(v2.edges),
|
|
51914
52464
|
linear: (v2) => v2.linear ? void page.linear.show("followed") : page.linear.hide("reader", "followed"),
|
|
52465
|
+
// their Export window over this reader's own, which it replaces; read from a snapshot (a page
|
|
52466
|
+
// that has none: Export makes pictures alone there), nothing
|
|
52467
|
+
export: (v2) => {
|
|
52468
|
+
if (!page.data.snapshot) page.exportModal.follow(v2.export ?? null);
|
|
52469
|
+
},
|
|
51915
52470
|
artwork: (v2) => page.art.follow(v2.artwork ?? null)
|
|
51916
52471
|
}
|
|
51917
52472
|
};
|
|
51918
|
-
const whereIAm = () => presenceOf(parts.read, page.nav.tabs.map((t2) => t2.id));
|
|
52473
|
+
const whereIAm = () => presenceOf(parts.read, page.nav.tabs.map((t2) => t2.id), page.people.followedKey);
|
|
51919
52474
|
const goWhere = async (v2, once) => {
|
|
51920
52475
|
const mode = TOOLS.includes(v2.mode) ? v2.mode : S7.mode;
|
|
51921
52476
|
const { id, scope: scope2 } = page.views.whereIs(v2);
|
|
@@ -52497,6 +53052,7 @@ function peoplePart(page) {
|
|
|
52497
53052
|
// following leaves"): the artwork mode's bar, all but Share and Search out of reach again; the
|
|
52498
53053
|
// linear form, which nothing on the screen says how to put away — the line does, once
|
|
52499
53054
|
unfollowed: () => {
|
|
53055
|
+
page.mineChanged();
|
|
52500
53056
|
page.sources.release();
|
|
52501
53057
|
page.papers.unfollowed();
|
|
52502
53058
|
page.artReach();
|
|
@@ -52507,6 +53063,7 @@ function peoplePart(page) {
|
|
|
52507
53063
|
renamed: () => {
|
|
52508
53064
|
page.showSelected();
|
|
52509
53065
|
page.renderStrip();
|
|
53066
|
+
page.mineChanged();
|
|
52510
53067
|
if (!reader) page.talk.identity();
|
|
52511
53068
|
},
|
|
52512
53069
|
// asking others to follow (CollabSpec decision 10): Esc declines a request shown, unless it is
|
|
@@ -52521,6 +53078,8 @@ function peoplePart(page) {
|
|
|
52521
53078
|
return true;
|
|
52522
53079
|
},
|
|
52523
53080
|
asked: (p2) => askMark(asking.tally.stateOf(p2.sessions.map((x2) => x2.id)), p2.name ?? "This reader"),
|
|
53081
|
+
// the room pointers are shown in (web/src/pointers.ts), made after this part
|
|
53082
|
+
roomChanged: () => page.pointers?.roomChanged(),
|
|
52524
53083
|
askAll: () => void asking.ask(null),
|
|
52525
53084
|
askWhy: () => reader ? READ_ONLY : asking.why(true)
|
|
52526
53085
|
});
|
|
@@ -52582,6 +53141,602 @@ function peoplePart(page) {
|
|
|
52582
53141
|
return { people, asking, syncPeers };
|
|
52583
53142
|
}
|
|
52584
53143
|
|
|
53144
|
+
// src/shared/pointer.ts
|
|
53145
|
+
var LEAD_MS = 60;
|
|
53146
|
+
var FOLLOW_MS = 100;
|
|
53147
|
+
var SHOWN2 = 5;
|
|
53148
|
+
var FADE_MS = 2e3;
|
|
53149
|
+
var STEPS_MAX = 16;
|
|
53150
|
+
function inRoom(page, other) {
|
|
53151
|
+
if (other.id === page.id || page.key !== null && other.key === page.key) return false;
|
|
53152
|
+
if (page.follows !== null && other.key === page.follows) return true;
|
|
53153
|
+
if (page.key !== null && other.follows === page.key) return true;
|
|
53154
|
+
return page.follows !== null && other.follows === page.follows;
|
|
53155
|
+
}
|
|
53156
|
+
|
|
53157
|
+
// src/web/src/pointers.ts
|
|
53158
|
+
var NOT_TEXT = '[aria-hidden="true"]';
|
|
53159
|
+
var CODE = "pre.code.src";
|
|
53160
|
+
var BOARD = "#canvas, #labels, #cards, #stickies";
|
|
53161
|
+
var clamp01 = (n3) => Math.min(1.5, Math.max(-0.5, n3));
|
|
53162
|
+
var round3 = (n3, d2 = 1e3) => Math.round(n3 * d2) / d2;
|
|
53163
|
+
function stepOf(e2) {
|
|
53164
|
+
const nth = e2.parentElement ? Array.prototype.indexOf.call(e2.parentElement.children, e2) : 0;
|
|
53165
|
+
if (e2.id && e2.id.length <= 160) return ["id", e2.id, nth];
|
|
53166
|
+
for (const a3 of Array.from(e2.attributes)) {
|
|
53167
|
+
if (!/^data-[a-z0-9-]{1,40}$/.test(a3.name)) continue;
|
|
53168
|
+
if (a3.value === "") return [a3.name, null, nth];
|
|
53169
|
+
if (a3.value.length <= 160 && !/[\u0000-\u001f\u007f]/.test(a3.value)) return [a3.name, a3.value, nth];
|
|
53170
|
+
}
|
|
53171
|
+
const cls = (e2.getAttribute("class") ?? "").split(/\s+/).find((c3) => /^[\w-]{1,60}$/.test(c3));
|
|
53172
|
+
return cls ? ["class", cls, nth] : [null, null, nth];
|
|
53173
|
+
}
|
|
53174
|
+
function isStep(k2, a3, v2) {
|
|
53175
|
+
if (!k2) return false;
|
|
53176
|
+
if (a3 === "class") return (k2.getAttribute("class") ?? "").split(/\s+/).includes(v2 ?? "");
|
|
53177
|
+
return v2 === null ? k2.hasAttribute(a3) : k2.getAttribute(a3) === v2;
|
|
53178
|
+
}
|
|
53179
|
+
function stepsTo(root, e2) {
|
|
53180
|
+
const chain = [];
|
|
53181
|
+
for (let x2 = e2; x2 && x2 !== root; x2 = x2.parentElement) chain.unshift(x2);
|
|
53182
|
+
if (chain.length && chain[0].parentElement !== root) return null;
|
|
53183
|
+
const kept = chain.slice(0, STEPS_MAX);
|
|
53184
|
+
return { steps: kept.map(stepOf), el: kept.at(-1) ?? root };
|
|
53185
|
+
}
|
|
53186
|
+
function follow(root, steps) {
|
|
53187
|
+
let e2 = root;
|
|
53188
|
+
for (const [a3, v2, n3] of steps) {
|
|
53189
|
+
const kids = e2.children;
|
|
53190
|
+
let next = kids[n3];
|
|
53191
|
+
if (a3 && !isStep(next, a3, v2)) next = Array.from(kids).find((k2) => isStep(k2, a3, v2)) ?? (v2 === null ? next : void 0);
|
|
53192
|
+
if (!next) return null;
|
|
53193
|
+
e2 = next;
|
|
53194
|
+
}
|
|
53195
|
+
return e2;
|
|
53196
|
+
}
|
|
53197
|
+
function texts(el) {
|
|
53198
|
+
const out = [];
|
|
53199
|
+
const walk2 = (n3) => {
|
|
53200
|
+
for (let c3 = n3.firstChild; c3; c3 = c3.nextSibling) {
|
|
53201
|
+
if (c3.nodeType === 3) out.push(c3);
|
|
53202
|
+
else if (c3.nodeType === 1 && !c3.matches(NOT_TEXT)) walk2(c3);
|
|
53203
|
+
}
|
|
53204
|
+
};
|
|
53205
|
+
walk2(el);
|
|
53206
|
+
return out;
|
|
53207
|
+
}
|
|
53208
|
+
function offsetIn2(el, node, offset) {
|
|
53209
|
+
if (!el.contains(node)) return null;
|
|
53210
|
+
if (node.nodeType === 3) {
|
|
53211
|
+
let n4 = 0;
|
|
53212
|
+
for (const t2 of texts(el)) {
|
|
53213
|
+
if (t2 === node) return n4 + Math.min(offset, t2.length);
|
|
53214
|
+
n4 += t2.length;
|
|
53215
|
+
}
|
|
53216
|
+
return null;
|
|
53217
|
+
}
|
|
53218
|
+
const at = document.createRange();
|
|
53219
|
+
at.setStart(node, offset);
|
|
53220
|
+
at.collapse(true);
|
|
53221
|
+
let n3 = 0;
|
|
53222
|
+
for (const t2 of texts(el)) {
|
|
53223
|
+
if (at.comparePoint(t2, 0) >= 0) break;
|
|
53224
|
+
n3 += t2.length;
|
|
53225
|
+
}
|
|
53226
|
+
return n3;
|
|
53227
|
+
}
|
|
53228
|
+
function pointIn(el, o2) {
|
|
53229
|
+
const all = texts(el);
|
|
53230
|
+
let n3 = 0;
|
|
53231
|
+
for (const t2 of all) {
|
|
53232
|
+
if (o2 <= n3 + t2.length) return { node: t2, offset: o2 - n3 };
|
|
53233
|
+
n3 += t2.length;
|
|
53234
|
+
}
|
|
53235
|
+
const last2 = all.at(-1);
|
|
53236
|
+
return last2 ? { node: last2, offset: last2.length } : null;
|
|
53237
|
+
}
|
|
53238
|
+
function lineColOf(text2, o2) {
|
|
53239
|
+
const before = text2.slice(0, o2);
|
|
53240
|
+
const nl = before.lastIndexOf("\n");
|
|
53241
|
+
let line = 0;
|
|
53242
|
+
for (let i2 = before.indexOf("\n"); i2 >= 0; i2 = before.indexOf("\n", i2 + 1)) line++;
|
|
53243
|
+
return [line, o2 - nl - 1];
|
|
53244
|
+
}
|
|
53245
|
+
function offsetOf(text2, [line, col]) {
|
|
53246
|
+
let at = 0;
|
|
53247
|
+
for (let l2 = 0; l2 < line; l2++) {
|
|
53248
|
+
const nl = text2.indexOf("\n", at);
|
|
53249
|
+
if (nl < 0) return null;
|
|
53250
|
+
at = nl + 1;
|
|
53251
|
+
}
|
|
53252
|
+
const end = text2.indexOf("\n", at);
|
|
53253
|
+
return at + Math.min(col, (end < 0 ? text2.length : end) - at);
|
|
53254
|
+
}
|
|
53255
|
+
var textOf2 = (el) => texts(el).map((t2) => t2.data).join("");
|
|
53256
|
+
function caretAt(x2, y2) {
|
|
53257
|
+
const d2 = document;
|
|
53258
|
+
if (typeof d2.caretPositionFromPoint === "function") {
|
|
53259
|
+
const p2 = d2.caretPositionFromPoint(x2, y2);
|
|
53260
|
+
return p2 ? { node: p2.offsetNode, offset: p2.offset } : null;
|
|
53261
|
+
}
|
|
53262
|
+
const r2 = document.caretRangeFromPoint?.(x2, y2);
|
|
53263
|
+
return r2 ? { node: r2.startContainer, offset: r2.startOffset } : null;
|
|
53264
|
+
}
|
|
53265
|
+
function rootOf(e2, h2) {
|
|
53266
|
+
const sw = e2.closest(".sw-win");
|
|
53267
|
+
if (sw) {
|
|
53268
|
+
const decl = h2.windowDecl(sw);
|
|
53269
|
+
return decl ? { root: { sw: decl }, el: sw } : null;
|
|
53270
|
+
}
|
|
53271
|
+
const pw = e2.closest(".pw-win");
|
|
53272
|
+
if (pw) return { root: { pw: true }, el: pw };
|
|
53273
|
+
for (let x2 = e2; x2 && x2 !== document.body; x2 = x2.parentElement) if (x2.id && /^[A-Za-z][\w-]{0,60}$/.test(x2.id)) return { root: { id: x2.id }, el: x2 };
|
|
53274
|
+
return null;
|
|
53275
|
+
}
|
|
53276
|
+
function rootEl(r2, h2) {
|
|
53277
|
+
if ("sw" in r2) return h2.windowOf(r2.sw);
|
|
53278
|
+
if ("pw" in r2) return document.querySelector(".pw-win");
|
|
53279
|
+
return document.getElementById(r2.id);
|
|
53280
|
+
}
|
|
53281
|
+
function anchorAt(x2, y2, t2, h2) {
|
|
53282
|
+
if (!t2 || h2.yours(t2)) return null;
|
|
53283
|
+
const lin = t2.closest("#linear") ? h2.linear() : null;
|
|
53284
|
+
if (lin) {
|
|
53285
|
+
const p2 = lin.at(x2, y2);
|
|
53286
|
+
return p2 ? { l: [p2[0], round3(p2[1]), round3(p2[2], 10)] } : null;
|
|
53287
|
+
}
|
|
53288
|
+
if (t2.closest(BOARD)) {
|
|
53289
|
+
const [wx, wy] = h2.toWorld(x2, y2);
|
|
53290
|
+
return { b: [round3(wx, 10), round3(wy, 10)] };
|
|
53291
|
+
}
|
|
53292
|
+
const sw = t2.closest(".sw-win");
|
|
53293
|
+
const code = sw ? t2.closest(CODE) : null;
|
|
53294
|
+
if (sw && code) {
|
|
53295
|
+
const decl = h2.windowDecl(sw);
|
|
53296
|
+
const c3 = caretAt(x2, y2);
|
|
53297
|
+
const o2 = decl && c3 ? offsetIn2(code, c3.node, c3.offset) : null;
|
|
53298
|
+
if (decl && o2 !== null) return { sw: decl, lc: lineColOf(textOf2(code), o2) };
|
|
53299
|
+
}
|
|
53300
|
+
const page = t2.closest(".pw-win .pw-page, .pw-win .pw-img");
|
|
53301
|
+
if (page) {
|
|
53302
|
+
const r3 = page.getBoundingClientRect();
|
|
53303
|
+
const n3 = page.classList.contains("pw-page") ? Number(page.dataset.n) : 0;
|
|
53304
|
+
if (r3.width > 0 && r3.height > 0 && Number.isInteger(n3)) return { pw: [n3, round3(clamp01((x2 - r3.left) / r3.width)), round3(clamp01((y2 - r3.top) / r3.height))] };
|
|
53305
|
+
}
|
|
53306
|
+
const from = rootOf(t2, h2);
|
|
53307
|
+
const path = from ? stepsTo(from.el, t2) : null;
|
|
53308
|
+
if (!from || !path) return null;
|
|
53309
|
+
const r2 = path.el.getBoundingClientRect();
|
|
53310
|
+
return { in: from.root, p: path.steps, f: [round3(clamp01((x2 - r2.left) / (r2.width || 1))), round3(clamp01((y2 - r2.top) / (r2.height || 1)))] };
|
|
53311
|
+
}
|
|
53312
|
+
function textAt(node, offset, h2) {
|
|
53313
|
+
const e2 = node.nodeType === 1 ? node : node.parentElement;
|
|
53314
|
+
if (!e2 || h2.yours(e2)) return null;
|
|
53315
|
+
const sw = e2.closest(".sw-win");
|
|
53316
|
+
const code = sw ? e2.closest(CODE) : null;
|
|
53317
|
+
if (sw && code) {
|
|
53318
|
+
const decl = h2.windowDecl(sw);
|
|
53319
|
+
const o3 = decl ? offsetIn2(code, node, offset) : null;
|
|
53320
|
+
return decl && o3 !== null ? { sw: decl, lc: lineColOf(textOf2(code), o3) } : null;
|
|
53321
|
+
}
|
|
53322
|
+
const from = rootOf(e2, h2);
|
|
53323
|
+
const path = from ? stepsTo(from.el, e2) : null;
|
|
53324
|
+
if (!from || !path) return null;
|
|
53325
|
+
const o2 = offsetIn2(path.el, node, offset);
|
|
53326
|
+
return o2 === null ? null : { in: from.root, p: path.steps, o: o2 };
|
|
53327
|
+
}
|
|
53328
|
+
function selectionAt(sel, h2) {
|
|
53329
|
+
if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return null;
|
|
53330
|
+
const r2 = sel.getRangeAt(0);
|
|
53331
|
+
const a3 = textAt(r2.startContainer, r2.startOffset, h2), b2 = textAt(r2.endContainer, r2.endOffset, h2);
|
|
53332
|
+
return a3 && b2 ? { a: a3, b: b2 } : null;
|
|
53333
|
+
}
|
|
53334
|
+
var LEADS = { side: { sel: "#side-btn", what: "in the side panel" } };
|
|
53335
|
+
var onScreen = (e2) => {
|
|
53336
|
+
const r2 = e2.getBoundingClientRect();
|
|
53337
|
+
return laidOut(e2) && r2.right > 0 && r2.bottom > 0 && r2.left < innerWidth && r2.top < innerHeight;
|
|
53338
|
+
};
|
|
53339
|
+
function leadTo(root, r2) {
|
|
53340
|
+
let lead = null;
|
|
53341
|
+
if ("id" in r2) {
|
|
53342
|
+
let l2;
|
|
53343
|
+
for (let x2 = root; x2 && !l2; x2 = x2.parentElement) l2 = LEADS[x2.id];
|
|
53344
|
+
const el = l2 ? document.querySelector(l2.sel) : null;
|
|
53345
|
+
if (l2 && el && onScreen(el)) lead = { el, what: l2.what, open: () => el.click() };
|
|
53346
|
+
} else if (root && onScreen(root)) lead = { el: root, what: "sw" in r2 ? "in its source window" : "in the reference window" };
|
|
53347
|
+
if (!lead) return null;
|
|
53348
|
+
const b2 = lead.el.getBoundingClientRect();
|
|
53349
|
+
const hit = typeof document.elementFromPoint === "function" ? document.elementFromPoint((b2.left + b2.right) / 2, (b2.top + b2.bottom) / 2) : lead.el;
|
|
53350
|
+
if (!hit || !(hit === lead.el || lead.el.contains(hit))) return null;
|
|
53351
|
+
return { x: (b2.left + b2.right) / 2, y: b2.bottom, box: { left: b2.left, top: b2.top, right: b2.right, bottom: b2.bottom }, lead };
|
|
53352
|
+
}
|
|
53353
|
+
var VIEWPORT = () => ({ left: 0, top: 0, right: innerWidth, bottom: innerHeight });
|
|
53354
|
+
var meet = (a3, b2) => ({ left: Math.max(a3.left, b2.left), top: Math.max(a3.top, b2.top), right: Math.min(a3.right, b2.right), bottom: Math.min(a3.bottom, b2.bottom) });
|
|
53355
|
+
var scrolls2 = /* @__PURE__ */ new WeakMap();
|
|
53356
|
+
function shownBox(e2, root) {
|
|
53357
|
+
let box = VIEWPORT();
|
|
53358
|
+
for (let x2 = e2.parentElement; x2; x2 = x2.parentElement) {
|
|
53359
|
+
let clips = scrolls2.get(x2);
|
|
53360
|
+
if (clips === void 0) {
|
|
53361
|
+
const s2 = getComputedStyle(x2);
|
|
53362
|
+
clips = /(auto|scroll|hidden|clip)/.test(s2.overflowY + s2.overflowX);
|
|
53363
|
+
scrolls2.set(x2, clips);
|
|
53364
|
+
}
|
|
53365
|
+
if (clips) box = meet(box, x2.getBoundingClientRect());
|
|
53366
|
+
if (x2 === root) break;
|
|
53367
|
+
}
|
|
53368
|
+
return box;
|
|
53369
|
+
}
|
|
53370
|
+
var laidOut = (e2) => e2.getClientRects().length > 0;
|
|
53371
|
+
function caretRect(p2) {
|
|
53372
|
+
const r2 = document.createRange();
|
|
53373
|
+
const at = Math.min(p2.offset, p2.node.length);
|
|
53374
|
+
if (at < p2.node.length) r2.setStart(p2.node, at), r2.setEnd(p2.node, at + 1);
|
|
53375
|
+
else if (at > 0) r2.setStart(p2.node, at - 1), r2.setEnd(p2.node, at);
|
|
53376
|
+
else return p2.node.parentElement?.getBoundingClientRect() ?? null;
|
|
53377
|
+
const rects = r2.getClientRects();
|
|
53378
|
+
const rect = rects[at < p2.node.length ? 0 : rects.length - 1] ?? r2.getBoundingClientRect();
|
|
53379
|
+
return at < p2.node.length ? rect : new DOMRect(rect.right, rect.top, 0, rect.height);
|
|
53380
|
+
}
|
|
53381
|
+
function textHere(t2, h2) {
|
|
53382
|
+
if ("lc" in t2) {
|
|
53383
|
+
const win2 = h2.windowOf(t2.sw);
|
|
53384
|
+
const code = win2?.querySelector(CODE);
|
|
53385
|
+
if (!win2 || !code) return null;
|
|
53386
|
+
const o2 = offsetOf(textOf2(code), t2.lc);
|
|
53387
|
+
const p3 = o2 === null ? null : pointIn(code, o2);
|
|
53388
|
+
return p3 ? { p: p3, holder: code, root: win2 } : null;
|
|
53389
|
+
}
|
|
53390
|
+
const root = rootEl(t2.in, h2);
|
|
53391
|
+
const el = root ? follow(root, t2.p) : null;
|
|
53392
|
+
const p2 = el ? pointIn(el, t2.o) : null;
|
|
53393
|
+
return p2 && root ? { p: p2, holder: el, root } : null;
|
|
53394
|
+
}
|
|
53395
|
+
function resolveAt(at, h2) {
|
|
53396
|
+
if ("b" in at) {
|
|
53397
|
+
const [x2, y2] = h2.toScreen(at.b[0], at.b[1]);
|
|
53398
|
+
return { x: x2, y: y2, box: meet(VIEWPORT(), h2.boardRoom()) };
|
|
53399
|
+
}
|
|
53400
|
+
if ("l" in at) {
|
|
53401
|
+
const lin = h2.linear();
|
|
53402
|
+
const p2 = lin?.screenOf(at.l);
|
|
53403
|
+
return lin && p2 ? { x: p2[0], y: p2[1], box: meet(VIEWPORT(), lin.room()), reveal: () => lin.reveal(at.l[0]) } : null;
|
|
53404
|
+
}
|
|
53405
|
+
if ("lc" in at) {
|
|
53406
|
+
const t2 = textHere(at, h2);
|
|
53407
|
+
const r3 = t2 ? caretRect(t2.p) : null;
|
|
53408
|
+
if (!t2 || !r3 || !laidOut(t2.holder)) return leadTo(h2.windowOf(at.sw), { sw: at.sw });
|
|
53409
|
+
const near = t2.p.node.parentElement ?? t2.holder;
|
|
53410
|
+
return { x: r3.left, y: r3.top + r3.height / 2, box: shownBox(t2.holder, t2.root), reveal: () => near.scrollIntoView({ block: "center", inline: "nearest" }) };
|
|
53411
|
+
}
|
|
53412
|
+
if ("pw" in at) {
|
|
53413
|
+
const win2 = document.querySelector(".pw-win");
|
|
53414
|
+
const page = win2?.querySelector(at.pw[0] ? `.pw-page[data-n="${at.pw[0]}"]` : ".pw-img");
|
|
53415
|
+
if (!win2 || !page || !laidOut(page)) return leadTo(win2, { pw: true });
|
|
53416
|
+
const r3 = page.getBoundingClientRect();
|
|
53417
|
+
return { x: r3.left + at.pw[1] * r3.width, y: r3.top + at.pw[2] * r3.height, box: shownBox(page, win2), reveal: () => page.scrollIntoView({ block: "nearest", inline: "nearest" }) };
|
|
53418
|
+
}
|
|
53419
|
+
const root = rootEl(at.in, h2);
|
|
53420
|
+
const el = root ? follow(root, at.p) : null;
|
|
53421
|
+
if (el && h2.yours(el)) return null;
|
|
53422
|
+
if (!root || !el || !laidOut(el) || !onScreen(root)) return leadTo(root, at.in);
|
|
53423
|
+
const r2 = el.getBoundingClientRect();
|
|
53424
|
+
return { x: r2.left + at.f[0] * r2.width, y: r2.top + at.f[1] * r2.height, box: shownBox(el, root), reveal: () => el.scrollIntoView({ block: "nearest", inline: "nearest" }) };
|
|
53425
|
+
}
|
|
53426
|
+
function resolveSel(s2, h2) {
|
|
53427
|
+
const a3 = textHere(s2.a, h2), b2 = textHere(s2.b, h2);
|
|
53428
|
+
if (!a3 || !b2 || !laidOut(a3.holder)) return null;
|
|
53429
|
+
const r2 = document.createRange();
|
|
53430
|
+
try {
|
|
53431
|
+
r2.setStart(a3.p.node, a3.p.offset);
|
|
53432
|
+
r2.setEnd(b2.p.node, b2.p.offset);
|
|
53433
|
+
if (r2.collapsed) {
|
|
53434
|
+
r2.setStart(b2.p.node, b2.p.offset);
|
|
53435
|
+
r2.setEnd(a3.p.node, a3.p.offset);
|
|
53436
|
+
}
|
|
53437
|
+
} catch {
|
|
53438
|
+
return null;
|
|
53439
|
+
}
|
|
53440
|
+
const box = shownBox(a3.holder, a3.root);
|
|
53441
|
+
const rects = [];
|
|
53442
|
+
for (const q2 of Array.from(r2.getClientRects()).slice(0, 200)) {
|
|
53443
|
+
const c3 = meet(box, q2);
|
|
53444
|
+
if (c3.right > c3.left && c3.bottom > c3.top) rects.push(c3);
|
|
53445
|
+
}
|
|
53446
|
+
const near = a3.p.node.parentElement ?? a3.holder;
|
|
53447
|
+
return { rects, box, reveal: () => near.scrollIntoView({ block: "center", inline: "nearest" }) };
|
|
53448
|
+
}
|
|
53449
|
+
var ARROW = `<svg viewBox="0 0 16 20" width="16" height="20" aria-hidden="true"><path d="M1.5 1.5v15.2l4.1-3.9 2.6 6 2.7-1.2-2.6-5.8h5.6z" fill="var(--c)" stroke="#fff" stroke-width="1.4" stroke-linejoin="round"/></svg>`;
|
|
53450
|
+
var Pointers = class {
|
|
53451
|
+
layer;
|
|
53452
|
+
hooks;
|
|
53453
|
+
others = /* @__PURE__ */ new Map();
|
|
53454
|
+
frame = 0;
|
|
53455
|
+
later = null;
|
|
53456
|
+
/** what this page said last, and when; what it has to say next */
|
|
53457
|
+
sent = { at: "null", sel: "null", when: 0 };
|
|
53458
|
+
wait = null;
|
|
53459
|
+
next = { at: null };
|
|
53460
|
+
/** the read-only page's word on whom it follows, as said last */
|
|
53461
|
+
toldFollows = void 0;
|
|
53462
|
+
still = typeof matchMedia === "function" ? matchMedia("(prefers-reduced-motion: reduce)") : null;
|
|
53463
|
+
constructor(layer, hooks) {
|
|
53464
|
+
this.layer = layer;
|
|
53465
|
+
this.hooks = hooks;
|
|
53466
|
+
layer.addEventListener("click", (e2) => {
|
|
53467
|
+
const b2 = e2.target.closest(".ptr-edge");
|
|
53468
|
+
const o2 = b2 ? this.others.get(b2.dataset.from ?? "") : void 0;
|
|
53469
|
+
if (!o2) return;
|
|
53470
|
+
const f2 = o2.at ? resolveAt(o2.at, this.hooks) : null;
|
|
53471
|
+
const s2 = o2.sel ? resolveSel(o2.sel, this.hooks) : null;
|
|
53472
|
+
(f2?.lead?.open ?? f2?.reveal ?? s2?.reveal)?.();
|
|
53473
|
+
});
|
|
53474
|
+
}
|
|
53475
|
+
// ---------------------------------------------------------------- what this page says
|
|
53476
|
+
/** Whether this page is in a room and says where its pointer is: listed (a private or read-only
|
|
53477
|
+
* reader's is shown to nobody), and following someone or followed — by someone unseen too. */
|
|
53478
|
+
speaks() {
|
|
53479
|
+
const me = this.hooks.me();
|
|
53480
|
+
if (!me || me.key === null || this.hooks.readOnly()) return false;
|
|
53481
|
+
if (me.follows !== null) return true;
|
|
53482
|
+
return this.hooks.privateFollowers() > 0 || this.hooks.unseenFollowers() || this.hooks.peers().some((p2) => !p2.agent && p2.view?.following === me.key);
|
|
53483
|
+
}
|
|
53484
|
+
/** The pointer moved (or pressed, `click`) at (x, y) over `t`: said, at most every LEAD_MS while
|
|
53485
|
+
* this reader is followed, FOLLOW_MS while they follow, and not at all out of a room. */
|
|
53486
|
+
moved(x2, y2, t2, click2 = false) {
|
|
53487
|
+
if (!this.speaks()) return;
|
|
53488
|
+
this.next = { at: anchorAt(x2, y2, t2, this.hooks), ...click2 || this.next.click ? { click: true } : {} };
|
|
53489
|
+
this.schedule(click2);
|
|
53490
|
+
}
|
|
53491
|
+
/** The pointer left the page. */
|
|
53492
|
+
left() {
|
|
53493
|
+
if (!this.speaks()) return;
|
|
53494
|
+
this.next = { at: null };
|
|
53495
|
+
this.schedule(false);
|
|
53496
|
+
}
|
|
53497
|
+
/** The text selection changed. */
|
|
53498
|
+
selected() {
|
|
53499
|
+
if (this.speaks()) this.schedule(false);
|
|
53500
|
+
}
|
|
53501
|
+
schedule(now) {
|
|
53502
|
+
const every = this.hooks.me()?.follows ? FOLLOW_MS : LEAD_MS;
|
|
53503
|
+
const due = this.sent.when + every - Date.now();
|
|
53504
|
+
if (now || due <= 0) return this.flush();
|
|
53505
|
+
if (!this.wait) this.wait = setTimeout(() => this.flush(), due);
|
|
53506
|
+
}
|
|
53507
|
+
flush() {
|
|
53508
|
+
if (this.wait) clearTimeout(this.wait);
|
|
53509
|
+
this.wait = null;
|
|
53510
|
+
const s2 = this.hooks.stream();
|
|
53511
|
+
if (!s2 || !this.speaks()) return;
|
|
53512
|
+
const sel = selectionAt(typeof document !== "undefined" ? document.getSelection() : null, this.hooks);
|
|
53513
|
+
const at = JSON.stringify(this.next.at), selText = JSON.stringify(sel);
|
|
53514
|
+
if (at === this.sent.at && selText === this.sent.sel && !this.next.click) return;
|
|
53515
|
+
this.hooks.send({ token: s2.token, at: this.next.at, sel, ...this.next.click ? { click: true } : {} });
|
|
53516
|
+
this.sent = { at, sel: selText, when: Date.now() };
|
|
53517
|
+
this.next = { at: this.next.at };
|
|
53518
|
+
}
|
|
53519
|
+
/** The page's stream (re)connected: the server knows nothing yet of whom a read-only page
|
|
53520
|
+
* follows. */
|
|
53521
|
+
connected() {
|
|
53522
|
+
this.toldFollows = void 0;
|
|
53523
|
+
this.roomChanged();
|
|
53524
|
+
}
|
|
53525
|
+
/** Who this page follows, or who is in its room, changed: a read-only page says whom it follows;
|
|
53526
|
+
* the others' marks of pages no longer in the room go; a page leaving every room says its pointer
|
|
53527
|
+
* is off once. */
|
|
53528
|
+
roomChanged() {
|
|
53529
|
+
const me = this.hooks.me();
|
|
53530
|
+
const s2 = this.hooks.stream();
|
|
53531
|
+
if (this.hooks.readOnly() && s2) {
|
|
53532
|
+
const f2 = me?.follows ?? null;
|
|
53533
|
+
if (f2 !== this.toldFollows) {
|
|
53534
|
+
this.toldFollows = f2;
|
|
53535
|
+
this.hooks.send({ token: s2.token, following: f2 });
|
|
53536
|
+
}
|
|
53537
|
+
}
|
|
53538
|
+
for (const o2 of [...this.others.values()]) if (!this.inMyRoom(o2.id)) this.drop(o2.id);
|
|
53539
|
+
if (!this.speaks() && this.sent.at !== "null" && s2 && me?.key) {
|
|
53540
|
+
this.hooks.send({ token: s2.token, at: null, sel: null });
|
|
53541
|
+
this.sent = { at: "null", sel: "null", when: Date.now() };
|
|
53542
|
+
}
|
|
53543
|
+
}
|
|
53544
|
+
// ---------------------------------------------------------------- what the others say
|
|
53545
|
+
inMyRoom(id) {
|
|
53546
|
+
const me = this.hooks.me();
|
|
53547
|
+
const p2 = this.hooks.peers().find((x2) => x2.id === id);
|
|
53548
|
+
if (!me || !p2 || p2.agent) return false;
|
|
53549
|
+
return inRoom(me, { id: p2.id, key: personKey(p2), follows: p2.view?.following ?? null });
|
|
53550
|
+
}
|
|
53551
|
+
/** Another page of the room said where its pointer is: drawn, its click a ripple where it is the
|
|
53552
|
+
* reader this page follows. */
|
|
53553
|
+
heard(n3) {
|
|
53554
|
+
if (!this.inMyRoom(n3.from)) return;
|
|
53555
|
+
const p2 = this.hooks.peers().find((x2) => x2.id === n3.from);
|
|
53556
|
+
let o2 = this.others.get(n3.from);
|
|
53557
|
+
if (!o2) {
|
|
53558
|
+
const cursor = document.createElement("div");
|
|
53559
|
+
cursor.className = "ptr";
|
|
53560
|
+
cursor.innerHTML = `${ARROW}<span class="ptr-who">${escapeHtml(p2.name ? initials(p2.name) : "?")}</span>`;
|
|
53561
|
+
cursor.hidden = true;
|
|
53562
|
+
const edge = document.createElement("button");
|
|
53563
|
+
edge.type = "button";
|
|
53564
|
+
edge.className = "ptr-edge";
|
|
53565
|
+
edge.dataset.from = n3.from;
|
|
53566
|
+
edge.tabIndex = -1;
|
|
53567
|
+
edge.hidden = true;
|
|
53568
|
+
this.layer.append(cursor, edge);
|
|
53569
|
+
o2 = { id: n3.from, name: p2.name ?? "A reader", color: p2.name ? colorOf(p2.name) : "var(--text-3)", at: null, sel: null, moved: 0, cursor, edge, marks: [], shown: null };
|
|
53570
|
+
for (const el of [cursor, edge]) el.style.setProperty("--c", o2.color);
|
|
53571
|
+
this.others.set(n3.from, o2);
|
|
53572
|
+
}
|
|
53573
|
+
const changed2 = JSON.stringify(n3.at) !== JSON.stringify(o2.at) || JSON.stringify(n3.sel) !== JSON.stringify(o2.sel);
|
|
53574
|
+
o2.at = n3.at;
|
|
53575
|
+
o2.sel = n3.sel;
|
|
53576
|
+
if (changed2 || n3.click) o2.moved = Date.now();
|
|
53577
|
+
const me = this.hooks.me();
|
|
53578
|
+
if (n3.click && n3.at && me?.follows === personKey(p2)) this.ripple(o2, n3.at);
|
|
53579
|
+
this.request();
|
|
53580
|
+
}
|
|
53581
|
+
/** A page's marks go: it left the room, or the page. */
|
|
53582
|
+
drop(id) {
|
|
53583
|
+
const o2 = this.others.get(id);
|
|
53584
|
+
if (!o2) return;
|
|
53585
|
+
o2.cursor.remove();
|
|
53586
|
+
o2.edge.remove();
|
|
53587
|
+
for (const m3 of o2.marks) m3.remove();
|
|
53588
|
+
this.others.delete(id);
|
|
53589
|
+
}
|
|
53590
|
+
ripple(o2, at) {
|
|
53591
|
+
const f2 = resolveAt(at, this.hooks);
|
|
53592
|
+
if (!f2 || f2.lead || !inside2(f2, f2.box)) return;
|
|
53593
|
+
const r2 = document.createElement("div");
|
|
53594
|
+
r2.className = "ptr-ripple";
|
|
53595
|
+
r2.style.setProperty("--c", o2.color);
|
|
53596
|
+
r2.style.translate = `${f2.x}px ${f2.y}px`;
|
|
53597
|
+
this.layer.append(r2);
|
|
53598
|
+
setTimeout(() => r2.remove(), 900);
|
|
53599
|
+
}
|
|
53600
|
+
request() {
|
|
53601
|
+
if (!this.frame) this.frame = requestAnimationFrame(() => this.draw());
|
|
53602
|
+
}
|
|
53603
|
+
/** Draw every pointer of the room where this page shows its place: the latest SHOWN to move, each
|
|
53604
|
+
* fading FADE_MS after it stopped; the others' selections; a mark at the edge for a place
|
|
53605
|
+
* scrolled away. Drawn every frame while one shows: the board's camera and the reader's scrolling
|
|
53606
|
+
* move them. */
|
|
53607
|
+
draw() {
|
|
53608
|
+
this.frame = 0;
|
|
53609
|
+
const now = Date.now();
|
|
53610
|
+
const still = this.still?.matches ?? false;
|
|
53611
|
+
const shownIds = new Set(drawnOf([...this.others.values()], now));
|
|
53612
|
+
const latest2 = [...this.others.values()].filter((o2) => shownIds.has(o2.id));
|
|
53613
|
+
let again = false, held2 = false;
|
|
53614
|
+
for (const o2 of this.others.values()) {
|
|
53615
|
+
const on = latest2.includes(o2);
|
|
53616
|
+
const age = now - o2.moved;
|
|
53617
|
+
const live = on && age < FADE_MS + 400;
|
|
53618
|
+
const f2 = live && o2.at ? resolveAt(o2.at, this.hooks) : null;
|
|
53619
|
+
if (f2 && !f2.lead && inside2(f2, f2.box)) {
|
|
53620
|
+
const to = { x: f2.x, y: f2.y };
|
|
53621
|
+
o2.shown = !o2.shown || still ? to : { x: o2.shown.x + (to.x - o2.shown.x) * 0.55, y: o2.shown.y + (to.y - o2.shown.y) * 0.55 };
|
|
53622
|
+
if (Math.abs(o2.shown.x - to.x) > 0.5 || Math.abs(o2.shown.y - to.y) > 0.5) again = true;
|
|
53623
|
+
o2.cursor.style.transform = `translate(${o2.shown.x}px, ${o2.shown.y}px)`;
|
|
53624
|
+
o2.cursor.style.opacity = age < FADE_MS ? "1" : "0";
|
|
53625
|
+
o2.cursor.hidden = false;
|
|
53626
|
+
o2.edge.hidden = true;
|
|
53627
|
+
} else {
|
|
53628
|
+
o2.cursor.hidden = true;
|
|
53629
|
+
o2.shown = null;
|
|
53630
|
+
this.edge(o2, f2, age);
|
|
53631
|
+
}
|
|
53632
|
+
if (live) again = true;
|
|
53633
|
+
const s2 = on && o2.sel ? resolveSel(o2.sel, this.hooks) : null;
|
|
53634
|
+
const rects = s2?.rects ?? [];
|
|
53635
|
+
while (o2.marks.length < rects.length) {
|
|
53636
|
+
const m3 = document.createElement("div");
|
|
53637
|
+
m3.className = "ptr-sel";
|
|
53638
|
+
m3.style.setProperty("--c", o2.color);
|
|
53639
|
+
this.layer.prepend(m3);
|
|
53640
|
+
o2.marks.push(m3);
|
|
53641
|
+
}
|
|
53642
|
+
o2.marks.forEach((m3, i2) => {
|
|
53643
|
+
const r2 = rects[i2];
|
|
53644
|
+
m3.hidden = !r2;
|
|
53645
|
+
if (r2) Object.assign(m3.style, { left: `${r2.left}px`, top: `${r2.top}px`, width: `${r2.right - r2.left}px`, height: `${r2.bottom - r2.top}px` });
|
|
53646
|
+
});
|
|
53647
|
+
if (rects.length) held2 = true;
|
|
53648
|
+
}
|
|
53649
|
+
if (again) this.request();
|
|
53650
|
+
else if (held2 && !this.later) this.later = setTimeout(() => (this.later = null, this.request()), 150);
|
|
53651
|
+
}
|
|
53652
|
+
/** The mark at the edge of what holds a place scrolled away ("↓ Alice"), while it moves; a click
|
|
53653
|
+
* on it scrolls there. */
|
|
53654
|
+
edge(o2, f2, age) {
|
|
53655
|
+
if (!f2 || age >= FADE_MS || f2.box.right <= f2.box.left || f2.box.bottom <= f2.box.top) {
|
|
53656
|
+
o2.edge.hidden = true;
|
|
53657
|
+
return;
|
|
53658
|
+
}
|
|
53659
|
+
if (f2.lead) {
|
|
53660
|
+
const said3 = `\u2022 ${o2.name}`;
|
|
53661
|
+
if (o2.edge.textContent !== said3) o2.edge.textContent = said3;
|
|
53662
|
+
o2.edge.title = `${o2.name}'s pointer is ${f2.lead.what}${f2.lead.open ? " \u2014 click to open it" : ""}`;
|
|
53663
|
+
o2.edge.classList.toggle("inert", !f2.lead.open);
|
|
53664
|
+
o2.edge.dataset.dir = "lead";
|
|
53665
|
+
o2.edge.style.left = `${f2.x}px`;
|
|
53666
|
+
o2.edge.style.top = `${f2.y + 10}px`;
|
|
53667
|
+
o2.edge.hidden = false;
|
|
53668
|
+
return;
|
|
53669
|
+
}
|
|
53670
|
+
const b2 = f2.box;
|
|
53671
|
+
const dir = f2.y < b2.top ? "above" : f2.y > b2.bottom ? "below" : f2.x < b2.left ? "left" : "right";
|
|
53672
|
+
const arrow = { above: "\u2191", below: "\u2193", left: "\u2190", right: "\u2192" }[dir];
|
|
53673
|
+
const x2 = Math.min(b2.right - 12, Math.max(b2.left + 12, f2.x));
|
|
53674
|
+
const y2 = Math.min(b2.bottom - 12, Math.max(b2.top + 12, f2.y));
|
|
53675
|
+
const said2 = `${arrow} ${o2.name}`;
|
|
53676
|
+
if (o2.edge.textContent !== said2) o2.edge.textContent = said2;
|
|
53677
|
+
o2.edge.title = `${o2.name}'s pointer is ${dir === "left" || dir === "right" ? `off to the ${dir}` : dir}${f2.reveal ? " \u2014 click to scroll there" : ""}`;
|
|
53678
|
+
o2.edge.classList.toggle("inert", !f2.reveal);
|
|
53679
|
+
o2.edge.dataset.dir = dir;
|
|
53680
|
+
o2.edge.style.left = `${x2}px`;
|
|
53681
|
+
o2.edge.style.top = `${y2}px`;
|
|
53682
|
+
o2.edge.hidden = false;
|
|
53683
|
+
}
|
|
53684
|
+
};
|
|
53685
|
+
var inside2 = (p2, b2) => p2.x >= b2.left && p2.x <= b2.right && p2.y >= b2.top && p2.y <= b2.bottom;
|
|
53686
|
+
function drawnOf(others, now) {
|
|
53687
|
+
return [...others].sort((a3, b2) => b2.moved - a3.moved).slice(0, SHOWN2).filter((o2) => now - o2.moved < FADE_MS + 400 || !!o2.sel).map((o2) => o2.id);
|
|
53688
|
+
}
|
|
53689
|
+
|
|
53690
|
+
// src/web/src/pagepointer.ts
|
|
53691
|
+
function pointerPart(page) {
|
|
53692
|
+
const { data } = page;
|
|
53693
|
+
const board2 = () => $("#canvas").getBoundingClientRect();
|
|
53694
|
+
const pointers = new Pointers($("#pointers"), {
|
|
53695
|
+
toWorld: (x2, y2) => {
|
|
53696
|
+
const r2 = board2();
|
|
53697
|
+
return page.canvas.toWorld(x2 - r2.left, y2 - r2.top);
|
|
53698
|
+
},
|
|
53699
|
+
toScreen: (x2, y2) => {
|
|
53700
|
+
const r2 = board2();
|
|
53701
|
+
const [sx, sy] = page.canvas.toScreen(x2, y2);
|
|
53702
|
+
return [sx + r2.left, sy + r2.top];
|
|
53703
|
+
},
|
|
53704
|
+
// the room the bars and panels leave the board: a point under them is not drawn over them
|
|
53705
|
+
boardRoom: () => {
|
|
53706
|
+
const r2 = board2();
|
|
53707
|
+
const i2 = page.canvas.screen.insets;
|
|
53708
|
+
return { left: r2.left + i2.left, top: r2.top + i2.top, right: r2.right - i2.right, bottom: r2.bottom - i2.bottom };
|
|
53709
|
+
},
|
|
53710
|
+
linear: () => page.linear.shown ? { at: (x2, y2) => page.linear.pointAt(x2, y2), screenOf: (p2) => page.linear.screenOf(p2), room: () => page.linear.room(), reveal: (k2) => page.linear.reveal(k2) } : null,
|
|
53711
|
+
windowDecl: (el) => page.sources.all.find((w2) => w2.el === el)?.name ?? null,
|
|
53712
|
+
// the window open on it, the following one first; a collapsed one is a pill, which holds no code
|
|
53713
|
+
windowOf: (decl) => {
|
|
53714
|
+
const all = page.sources.all.filter((w2) => w2.name === decl);
|
|
53715
|
+
return (all.find((w2) => !w2.collapsed) ?? all[0])?.el ?? null;
|
|
53716
|
+
},
|
|
53717
|
+
yours: (el) => inYours(el),
|
|
53718
|
+
stream: () => page.people.stream ? { token: page.people.stream.token, id: page.people.stream.id } : null,
|
|
53719
|
+
me: () => {
|
|
53720
|
+
const s2 = page.people.stream;
|
|
53721
|
+
if (!s2) return null;
|
|
53722
|
+
const me = page.people.listed;
|
|
53723
|
+
return { id: s2.id, key: me && !page.people.isPrivate && !page.reader ? personKey(me) : null, follows: page.people.followedKey };
|
|
53724
|
+
},
|
|
53725
|
+
peers: () => page.people.peers,
|
|
53726
|
+
privateFollowers: () => page.people.privateFollowing,
|
|
53727
|
+
unseenFollowers: () => page.people.unseenFollowing,
|
|
53728
|
+
readOnly: () => !!page.reader,
|
|
53729
|
+
send: (body) => data.pointer(body)
|
|
53730
|
+
});
|
|
53731
|
+
if (!data.snapshot) {
|
|
53732
|
+
window.addEventListener("pointermove", (e2) => pointers.moved(e2.clientX, e2.clientY, e2.target instanceof Element ? e2.target : null), { capture: true, passive: true });
|
|
53733
|
+
window.addEventListener("pointerdown", (e2) => pointers.moved(e2.clientX, e2.clientY, e2.target instanceof Element ? e2.target : null, true), { capture: true, passive: true });
|
|
53734
|
+
document.documentElement.addEventListener("pointerleave", () => pointers.left());
|
|
53735
|
+
document.addEventListener("selectionchange", () => pointers.selected());
|
|
53736
|
+
}
|
|
53737
|
+
return { pointers };
|
|
53738
|
+
}
|
|
53739
|
+
|
|
52585
53740
|
// src/web/src/tabs.ts
|
|
52586
53741
|
function starred(targets, short6) {
|
|
52587
53742
|
const s2 = targets.map((t2) => `\u2605${short6(t2)}`);
|
|
@@ -53039,17 +54194,8 @@ function planDoc(g2, set, mode, hidden, keyed = null) {
|
|
|
53039
54194
|
};
|
|
53040
54195
|
}
|
|
53041
54196
|
|
|
53042
|
-
// src/shared/doc/settings.ts
|
|
53043
|
-
var DEFAULT_SETTINGS = Object.freeze({
|
|
53044
|
-
paper: "a4",
|
|
53045
|
-
margin: 22,
|
|
53046
|
-
fontSize: 11,
|
|
53047
|
-
codeSize: 8.5,
|
|
53048
|
-
contents: true
|
|
53049
|
-
});
|
|
53050
|
-
|
|
53051
54197
|
// src/web/src/exportmodal.ts
|
|
53052
|
-
var COMMON =
|
|
54198
|
+
var COMMON = EXPORT_SETTINGS;
|
|
53053
54199
|
var CODE_SIZES = [7, 7.5, 8, 8.5, 9, 9.5, 10];
|
|
53054
54200
|
function common3(s2) {
|
|
53055
54201
|
const out = Object.fromEntries(COMMON.map((k2) => [k2, DEFAULT_SETTINGS[k2]]));
|
|
@@ -53103,17 +54249,99 @@ var ExportModal = class {
|
|
|
53103
54249
|
return !this.el.hidden;
|
|
53104
54250
|
}
|
|
53105
54251
|
open() {
|
|
53106
|
-
this.
|
|
54252
|
+
this.reveal(common3(this.hooks.saved()?.settings), true);
|
|
54253
|
+
}
|
|
54254
|
+
/** Open the window on the view on show, with `settings`, its focus in it where the reader opened it
|
|
54255
|
+
* (`focus`), not where following did. */
|
|
54256
|
+
reveal(settings, focus) {
|
|
54257
|
+
this.settings = settings;
|
|
53107
54258
|
this.view = this.hooks.view();
|
|
53108
|
-
this.
|
|
53109
|
-
this.job = null;
|
|
54259
|
+
this.dropJob();
|
|
53110
54260
|
this.head = "";
|
|
53111
54261
|
this.el.hidden = false;
|
|
53112
54262
|
this.btn.classList.add("on");
|
|
53113
54263
|
this.render();
|
|
53114
54264
|
this.hooks.shown?.(true);
|
|
53115
|
-
this.el.querySelector(".ex-box")?.focus();
|
|
54265
|
+
if (focus) this.el.querySelector(".ex-box")?.focus();
|
|
53116
54266
|
this.askHead();
|
|
54267
|
+
this.hooks.changed?.();
|
|
54268
|
+
}
|
|
54269
|
+
/** What those following this reader see of the window, as presence carries it (CollabSpec,
|
|
54270
|
+
* "Surfaces"): open or closed; open, its settings and the job it shows, by its id. */
|
|
54271
|
+
state() {
|
|
54272
|
+
if (this.el.hidden) return { open: false };
|
|
54273
|
+
const j2 = this.job;
|
|
54274
|
+
const job = j2 ? { id: j2.gone ? "" : j2.id, state: j2.gone ? "failed" : j2.state, ...j2.state === "failed" && j2.error ? { error: j2.error } : {} } : null;
|
|
54275
|
+
return { open: true, settings: { ...this.settings }, ...job ? { job } : {} };
|
|
54276
|
+
}
|
|
54277
|
+
/** A followed reader's window, or a link's (the owner's decision of 2026-10-20): open or closed as
|
|
54278
|
+
* theirs is, with their settings and the document they typeset — its progress, followed here by
|
|
54279
|
+
* its id until it is done, then its downloads. This reader's own window is replaced by it, and
|
|
54280
|
+
* what it shows stays, theirs, once following ends. Opened so, it takes no focus; closed so, it
|
|
54281
|
+
* gives none back. */
|
|
54282
|
+
follow(v2) {
|
|
54283
|
+
if (!v2?.open) return this.close(true);
|
|
54284
|
+
const settings = common3(v2.settings);
|
|
54285
|
+
if (this.el.hidden) this.reveal(settings, false);
|
|
54286
|
+
else this.settings = settings;
|
|
54287
|
+
this.take(v2.job ?? null);
|
|
54288
|
+
this.render();
|
|
54289
|
+
this.hooks.changed?.();
|
|
54290
|
+
}
|
|
54291
|
+
/** The job a followed reader's window shows, shown here: none; one the server has not named yet,
|
|
54292
|
+
* or refused; or one by its id, read from the server and followed until it is done, as their
|
|
54293
|
+
* window follows it. The job shown already changes nothing: it is followed here to its end. */
|
|
54294
|
+
take(j2) {
|
|
54295
|
+
const cur = this.job;
|
|
54296
|
+
if (!j2) {
|
|
54297
|
+
if (cur) this.dropJob();
|
|
54298
|
+
return;
|
|
54299
|
+
}
|
|
54300
|
+
if (cur && j2.id && cur.id === j2.id && !cur.gone && (cur.state === j2.state || cur.state === "running")) return;
|
|
54301
|
+
if (cur && !j2.id && !cur.id && cur.state === j2.state && (cur.error ?? "") === (j2.error ?? "")) return;
|
|
54302
|
+
if (!j2.id) {
|
|
54303
|
+
this.dropJob();
|
|
54304
|
+
if (j2.state === "running") {
|
|
54305
|
+
this.job = { id: "", state: "running" };
|
|
54306
|
+
this.started = Date.now();
|
|
54307
|
+
this.startTimer();
|
|
54308
|
+
} else this.job = { id: "", state: "failed", error: j2.error ?? "XeLaTeX stopped" };
|
|
54309
|
+
return;
|
|
54310
|
+
}
|
|
54311
|
+
void this.watch(j2.id, j2.state);
|
|
54312
|
+
}
|
|
54313
|
+
/** Follow a job by its id until it is done: its progress while it runs, counted from when it was
|
|
54314
|
+
* asked for, then its pages and downloads, or why it failed — or that it has left the cache. */
|
|
54315
|
+
async watch(id, state) {
|
|
54316
|
+
this.dropJob();
|
|
54317
|
+
const turn = this.turn;
|
|
54318
|
+
if (state === "running") {
|
|
54319
|
+
this.job = { id, state: "running" };
|
|
54320
|
+
this.started = Date.now();
|
|
54321
|
+
this.startTimer();
|
|
54322
|
+
}
|
|
54323
|
+
let j2 = await this.hooks.poll(id);
|
|
54324
|
+
while (typeof j2 !== "string" && j2.state === "running" && turn === this.turn && !this.el.hidden) {
|
|
54325
|
+
if (j2.startedHere) this.started = j2.startedHere;
|
|
54326
|
+
if (this.job?.state !== "running") {
|
|
54327
|
+
this.job = { id, state: "running" };
|
|
54328
|
+
this.startTimer();
|
|
54329
|
+
this.render();
|
|
54330
|
+
}
|
|
54331
|
+
await new Promise((ok) => setTimeout(ok, 700));
|
|
54332
|
+
j2 = await this.hooks.poll(id);
|
|
54333
|
+
}
|
|
54334
|
+
if (turn !== this.turn) return;
|
|
54335
|
+
this.stopTimer();
|
|
54336
|
+
this.job = typeof j2 === "string" ? { id, state: "failed", error: j2, gone: true } : j2;
|
|
54337
|
+
if (!this.el.hidden) this.render();
|
|
54338
|
+
this.hooks.changed?.();
|
|
54339
|
+
}
|
|
54340
|
+
/** The job shown is put away, and the answers still to come for it are not shown. */
|
|
54341
|
+
dropJob() {
|
|
54342
|
+
this.turn++;
|
|
54343
|
+
this.stopTimer();
|
|
54344
|
+
this.job = null;
|
|
53117
54345
|
}
|
|
53118
54346
|
/** The board on show changed (another view, another build, the view rescoped): the window, open,
|
|
53119
54347
|
* tells of the view on show now, whose outline the linear form draws beside it (ExportSpec
|
|
@@ -53126,11 +54354,10 @@ var ExportModal = class {
|
|
|
53126
54354
|
const other = !sameDoc(v2, this.view);
|
|
53127
54355
|
this.view = v2;
|
|
53128
54356
|
if (other) {
|
|
53129
|
-
this.
|
|
53130
|
-
this.stopTimer();
|
|
53131
|
-
this.job = null;
|
|
54357
|
+
this.dropJob();
|
|
53132
54358
|
this.head = "";
|
|
53133
54359
|
this.askHead();
|
|
54360
|
+
this.hooks.changed?.();
|
|
53134
54361
|
}
|
|
53135
54362
|
this.render();
|
|
53136
54363
|
}
|
|
@@ -53144,13 +54371,16 @@ var ExportModal = class {
|
|
|
53144
54371
|
this.render();
|
|
53145
54372
|
});
|
|
53146
54373
|
}
|
|
53147
|
-
|
|
54374
|
+
/** Close the window; `followed`: as the followed reader's closed, which gives no focus back but
|
|
54375
|
+
* where it was in it. */
|
|
54376
|
+
close(followed = false) {
|
|
53148
54377
|
if (this.el.hidden) return;
|
|
53149
|
-
focusBack(this.el, this.btn,
|
|
54378
|
+
focusBack(this.el, this.btn, !followed);
|
|
53150
54379
|
this.el.hidden = true;
|
|
53151
54380
|
this.btn.classList.remove("on");
|
|
53152
54381
|
this.stopTimer();
|
|
53153
54382
|
this.hooks.shown?.(false);
|
|
54383
|
+
this.hooks.changed?.();
|
|
53154
54384
|
}
|
|
53155
54385
|
changed(t2) {
|
|
53156
54386
|
const k2 = t2.dataset.set;
|
|
@@ -53160,6 +54390,7 @@ var ExportModal = class {
|
|
|
53160
54390
|
else if (k2 === "contents") s2[k2] = t2.checked;
|
|
53161
54391
|
else s2[k2] = t2.value;
|
|
53162
54392
|
this.render();
|
|
54393
|
+
this.hooks.changed?.();
|
|
53163
54394
|
}
|
|
53164
54395
|
/** Why the view makes no document, or null. */
|
|
53165
54396
|
refusal() {
|
|
@@ -53200,7 +54431,7 @@ var ExportModal = class {
|
|
|
53200
54431
|
const job = this.job;
|
|
53201
54432
|
const busy = job?.state === "running";
|
|
53202
54433
|
const refused = this.refusal();
|
|
53203
|
-
const result = !job ? "" : job.state === "running" ? `<div class="ex-prog"><div class="ex-bar"><i></i></div><span>Typesetting with XeLaTeX\u2026 <span class="ex-secs">${this.elapsed()}</span></span></div>` : job.state === "failed" ? `<div class="banner bad">Typesetting failed: ${esc2(sentence(job.error ?? "XeLaTeX stopped"))}</div>` + (job.log ? `<details class="ex-log"><summary>XeLaTeX's log</summary><pre>${esc2(job.log)}</pre></details>` : "") : `<div class="ex-done"><div><b>${job.pages ?? "?"} page${job.pages === 1 ? "" : "s"}</b>, typeset in ${((job.ms ?? 0) / 1e3).toFixed(1)} s.</div><div class="ex-dl"><a class="rv-btn primary" href="/api/export/file?id=${job.id}&what=pdf" download>Download PDF</a><a class="rv-btn" href="/api/export/file?id=${job.id}&what=zip" download title="The .tex, the style file visualproof.sty and the fonts: typeset it yourself, or make the style your own">LaTeX sources (.zip)</a><a class="link" href="/api/export/file?id=${job.id}&what=tex" download>.tex</a><a class="link" href="/api/export/file?id=${job.id}&what=sty" download>.sty</a></div>` + // how the document was made, which it does not say itself: folded, for the curious
|
|
54434
|
+
const result = !job ? "" : job.state === "running" ? `<div class="ex-prog"><div class="ex-bar"><i></i></div><span>Typesetting with XeLaTeX\u2026 <span class="ex-secs">${this.elapsed()}</span></span></div>` : job.gone ? `<div class="banner warn">${esc2(sentence(job.error ?? "That document is no longer in the export's cache"))} Generate makes it again.</div>` : job.state === "failed" ? `<div class="banner bad">Typesetting failed: ${esc2(sentence(job.error ?? "XeLaTeX stopped"))}</div>` + (job.log ? `<details class="ex-log"><summary>XeLaTeX's log</summary><pre>${esc2(job.log)}</pre></details>` : "") : `<div class="ex-done"><div><b>${job.pages ?? "?"} page${job.pages === 1 ? "" : "s"}</b>, typeset in ${((job.ms ?? 0) / 1e3).toFixed(1)} s.</div><div class="ex-dl"><a class="rv-btn primary" href="/api/export/file?id=${job.id}&what=pdf" download>Download PDF</a><a class="rv-btn" href="/api/export/file?id=${job.id}&what=zip" download title="The .tex, the style file visualproof.sty and the fonts: typeset it yourself, or make the style your own">LaTeX sources (.zip)</a><a class="link" href="/api/export/file?id=${job.id}&what=tex" download>.tex</a><a class="link" href="/api/export/file?id=${job.id}&what=sty" download>.sty</a></div>` + // how the document was made, which it does not say itself: folded, for the curious
|
|
53204
54435
|
(job.notes?.length ? `<details class="ex-log ex-notes"><summary>Notes (${job.notes.length})</summary><ul>${job.notes.map((x2) => `<li>${esc2(x2)}</li>`).join("")}</ul></details>` : "") + `</div>`;
|
|
53205
54436
|
const html = `<div class="modal-box glass ex-box" role="dialog" aria-modal="true" aria-label="Export a document" tabindex="-1"><div class="ex-head"><div class="modal-title">Export a document</div><button class="icon" data-ex-close title="Close (Esc)" aria-label="Close">\u2715</button></div>` + // the document, or the board as a picture (ExportSpec decision 19), which the page frames
|
|
53206
54437
|
(this.hooks.artwork ? `<div class="sh-tabs ex-tabs" role="tablist"><button role="tab" aria-selected="true">Document</button><button role="tab" aria-selected="false" data-ex-art title="The board as a picture, PNG or SVG, at the size you choose: frame it, then save it">Artwork</button></div>` : "") + `<div class="ex-sec">${this.summary()}</div><div class="modal-text">Sections and order follow the board: drag to reorder. Proofs and the review are not printed.</div>` + this.buildText() + (refused ? `<div class="banner warn ex-warn">${esc2(refused)}</div>` : "") + this.headRows() + `<div class="ex-sec ex-grid"><label class="ex-field">Paper<select data-set="paper">${opt("a4", "A4", s2.paper)}${opt("letter", "Letter", s2.paper)}</select></label><label class="ex-field">Text<select data-set="fontSize">${[10, 11, 12].map((n3) => opt(n3, `${n3} pt`, s2.fontSize)).join("")}</select></label><label class="ex-field">Code<select data-set="codeSize">${CODE_SIZES.map((n3) => opt(n3, `${n3} pt`, s2.codeSize)).join("")}</select></label><div class="ex-checks"><label class="ex-check" title="The sections with their pages (and the declarations, where the document is short), in two columns after the head card"><input type="checkbox" data-set="contents"${s2.contents ? " checked" : ""}> Table of contents</label></div></div>` + result + `<div class="modal-actions"><button class="rv-btn" data-ex-close>Close</button><button class="rv-btn primary" data-ex-go${refused || busy ? " disabled" : ""}>${busy ? "Generating\u2026" : job?.state === "done" ? "Generate again" : "Generate"}</button></div></div>`;
|
|
@@ -53226,6 +54457,14 @@ var ExportModal = class {
|
|
|
53226
54457
|
if (this.timer) clearInterval(this.timer);
|
|
53227
54458
|
this.timer = null;
|
|
53228
54459
|
}
|
|
54460
|
+
/** The seconds a job has been going, counted on the window while it runs. */
|
|
54461
|
+
startTimer() {
|
|
54462
|
+
this.stopTimer();
|
|
54463
|
+
this.timer = setInterval(() => {
|
|
54464
|
+
const secs = this.el.querySelector(".ex-secs");
|
|
54465
|
+
if (secs) secs.textContent = this.elapsed();
|
|
54466
|
+
}, 500);
|
|
54467
|
+
}
|
|
53229
54468
|
/** Typeset the view's document, and follow the job until it is done. */
|
|
53230
54469
|
async generate() {
|
|
53231
54470
|
const v2 = this.view;
|
|
@@ -53236,12 +54475,13 @@ var ExportModal = class {
|
|
|
53236
54475
|
this.started = Date.now();
|
|
53237
54476
|
this.job = { id: "", state: "running" };
|
|
53238
54477
|
this.render();
|
|
53239
|
-
this.
|
|
53240
|
-
this.
|
|
53241
|
-
const secs = this.el.querySelector(".ex-secs");
|
|
53242
|
-
if (secs) secs.textContent = this.elapsed();
|
|
53243
|
-
}, 500);
|
|
54478
|
+
this.startTimer();
|
|
54479
|
+
this.hooks.changed?.();
|
|
53244
54480
|
let j2 = await this.hooks.start({ view: v2.id, settings, ...v2.version !== void 0 ? { version: v2.version } : {} });
|
|
54481
|
+
if (turn === this.turn && typeof j2 !== "string" && j2.state === "running") {
|
|
54482
|
+
this.job = { id: j2.id, state: "running" };
|
|
54483
|
+
this.hooks.changed?.();
|
|
54484
|
+
}
|
|
53245
54485
|
while (typeof j2 !== "string" && j2.state === "running" && turn === this.turn && !this.el.hidden) {
|
|
53246
54486
|
await new Promise((ok) => setTimeout(ok, 700));
|
|
53247
54487
|
j2 = await this.hooks.poll(j2.id);
|
|
@@ -53250,6 +54490,7 @@ var ExportModal = class {
|
|
|
53250
54490
|
this.stopTimer();
|
|
53251
54491
|
this.job = typeof j2 === "string" ? { id: "", state: "failed", error: j2 } : j2;
|
|
53252
54492
|
if (!this.el.hidden) this.render();
|
|
54493
|
+
this.hooks.changed?.();
|
|
53253
54494
|
}
|
|
53254
54495
|
};
|
|
53255
54496
|
|
|
@@ -53311,7 +54552,9 @@ function sharePart(page) {
|
|
|
53311
54552
|
// following leaves")
|
|
53312
54553
|
shown: (open) => open ? void page.linear.show("export") : page.people.following ? page.linear.hide("export") : page.linear.hide("export", "followed"),
|
|
53313
54554
|
artwork: () => page.art.open(),
|
|
53314
|
-
artworkOnly: () => !!data.snapshot
|
|
54555
|
+
artworkOnly: () => !!data.snapshot,
|
|
54556
|
+
// those following see the window as it is (the owner's decision of 2026-10-20)
|
|
54557
|
+
changed: () => page.people.report()
|
|
53315
54558
|
});
|
|
53316
54559
|
if (data.snapshot) $("#library-btn").hidden = true;
|
|
53317
54560
|
return { exportModal };
|
|
@@ -54382,7 +55625,8 @@ function selectionPart(page) {
|
|
|
54382
55625
|
place: v2.place,
|
|
54383
55626
|
kind: page.g.isExt(i2) ? "external" : node.kind,
|
|
54384
55627
|
axiom: ringed(node.kind),
|
|
54385
|
-
|
|
55628
|
+
// in the scheme in force: Status's state, or Mine's
|
|
55629
|
+
status: page.pointState(i2),
|
|
54386
55630
|
target: Object.hasOwn(targets, v2.name),
|
|
54387
55631
|
key: r2 !== null && r2 !== i2 && page.flow.isKey(r2, i2),
|
|
54388
55632
|
board: edges.board,
|
|
@@ -54934,6 +56178,7 @@ function livePart(page) {
|
|
|
54934
56178
|
es.addEventListener("hello", (e2) => {
|
|
54935
56179
|
const hello = JSON.parse(e2.data);
|
|
54936
56180
|
void page.people.connected(hello).then(() => !reader && page.talk.connected());
|
|
56181
|
+
page.pointers.connected();
|
|
54937
56182
|
updatingTo = null;
|
|
54938
56183
|
reloader.hello(hello.server);
|
|
54939
56184
|
const release = hello.server?.version;
|
|
@@ -54945,7 +56190,8 @@ function livePart(page) {
|
|
|
54945
56190
|
renderBuild();
|
|
54946
56191
|
});
|
|
54947
56192
|
es.addEventListener("presence", (e2) => page.people.setPeers(JSON.parse(e2.data)));
|
|
54948
|
-
es.addEventListener("private", (e2) => page.people.setPrivateCount(JSON.parse(e2.data)
|
|
56193
|
+
es.addEventListener("private", (e2) => page.people.setPrivateCount(JSON.parse(e2.data)));
|
|
56194
|
+
es.addEventListener("pointer", (e2) => page.pointers.heard(JSON.parse(e2.data)));
|
|
54949
56195
|
es.addEventListener("people", (e2) => {
|
|
54950
56196
|
setPeople(JSON.parse(e2.data));
|
|
54951
56197
|
page.activity.changed();
|
|
@@ -55480,7 +56726,7 @@ function menuPart(page) {
|
|
|
55480
56726
|
});
|
|
55481
56727
|
const canName = () => !data.snapshot && !reader && (!!page.people.name || page.people.mode === "declared");
|
|
55482
56728
|
const sameSet2 = (a3, b2) => {
|
|
55483
|
-
const x2 = evaluate(a3, { g: page.g, review: page.boardReview() }), y2 = evaluate(b2, { g: page.g, review: page.boardReview() });
|
|
56729
|
+
const x2 = evaluate(a3, { g: page.g, review: page.boardReview(), me: page.mineAuthor() }), y2 = evaluate(b2, { g: page.g, review: page.boardReview(), me: page.mineAuthor() });
|
|
55484
56730
|
for (let j2 = 0; j2 < x2.length; j2++) if (x2[j2] !== y2[j2]) return false;
|
|
55485
56731
|
return true;
|
|
55486
56732
|
};
|
|
@@ -55491,11 +56737,11 @@ function menuPart(page) {
|
|
|
55491
56737
|
};
|
|
55492
56738
|
const menuContext = (part) => {
|
|
55493
56739
|
const rec = page.nav.board.rec;
|
|
55494
|
-
const has = part && evaluate(part, { g: page.g, review: page.boardReview() });
|
|
56740
|
+
const has = part && evaluate(part, { g: page.g, review: page.boardReview(), me: page.mineAuthor() });
|
|
55495
56741
|
const holds = (scope2) => {
|
|
55496
56742
|
if (!has) return false;
|
|
55497
56743
|
try {
|
|
55498
|
-
const set = evaluate(parseQuery(scope2), { g: page.g, review: page.boardReview() });
|
|
56744
|
+
const set = evaluate(parseQuery(scope2), { g: page.g, review: page.boardReview(), me: page.mineAuthor() });
|
|
55499
56745
|
for (let j2 = 0; j2 < has.length; j2++) if (has[j2] && !set[j2]) return false;
|
|
55500
56746
|
return true;
|
|
55501
56747
|
} catch {
|
|
@@ -55570,7 +56816,7 @@ function menuPart(page) {
|
|
|
55570
56816
|
const menuOnSelection = () => {
|
|
55571
56817
|
const I2 = page.canvas.insets;
|
|
55572
56818
|
const W2 = document.documentElement.clientWidth, H2 = document.documentElement.clientHeight;
|
|
55573
|
-
const
|
|
56819
|
+
const inside3 = (p2) => [Math.max(I2.left + 8, Math.min(W2 - I2.right - 8, p2[0])), Math.max(I2.top + 8, Math.min(H2 - I2.bottom - 8, p2[1]))];
|
|
55574
56820
|
const i2 = page.selected();
|
|
55575
56821
|
const c3 = page.shownCluster();
|
|
55576
56822
|
let t2 = null;
|
|
@@ -55586,7 +56832,7 @@ function menuPart(page) {
|
|
|
55586
56832
|
t2 = { kind: "cluster", c: c3 };
|
|
55587
56833
|
at = page.canvas.screenOf("cluster", page.canvas.layout.clusters[c3].key);
|
|
55588
56834
|
} else at = [I2.left + (W2 - I2.left - I2.right) / 2, I2.top + (H2 - I2.top - I2.bottom) / 2];
|
|
55589
|
-
const [x2, y2] =
|
|
56835
|
+
const [x2, y2] = inside3(at);
|
|
55590
56836
|
openMenu(t2, x2, y2, page.canvas.toWorld(x2, y2), true);
|
|
55591
56837
|
};
|
|
55592
56838
|
const copyText2 = async (text2, said2 = `Copied ${text2}`) => {
|
|
@@ -55884,7 +57130,7 @@ function notesPart(page) {
|
|
|
55884
57130
|
const derivedIn = (v2) => {
|
|
55885
57131
|
if (v2.id === page.nav.board.id) return derivesOn(page.cm(), page.vg().nodes, existsIn(page.nav.board.full.nodes), page.boardReview().links, page.nav.board.past?.past.nowName);
|
|
55886
57132
|
try {
|
|
55887
|
-
const set = evaluate(parseQuery(v2.scope), { g: page.g, review: page.review.data });
|
|
57133
|
+
const set = evaluate(parseQuery(v2.scope), { g: page.g, review: page.review.data, me: page.mineAuthor() });
|
|
55888
57134
|
return derivesOn(v2.clustering, page.g.nodes.filter((_2, i2) => set[i2]), existsIn(page.g.nodes), page.review.data.links);
|
|
55889
57135
|
} catch {
|
|
55890
57136
|
return null;
|
|
@@ -56493,7 +57739,7 @@ function keysPart(page) {
|
|
|
56493
57739
|
else if (e2.key === "e") page.toggleOutside();
|
|
56494
57740
|
else if (e2.key === "g") page.edgesBtn.click();
|
|
56495
57741
|
else if (e2.key === "o") page.linear.toggle();
|
|
56496
|
-
else if (e2.key === "c") page.chooseScheme(page.
|
|
57742
|
+
else if (e2.key === "c") page.chooseScheme(page.nextScheme());
|
|
56497
57743
|
else if (e2.key === "l") page.toggleLock();
|
|
56498
57744
|
else if (e2.key === "[") page.canvas.stepLevels(-1);
|
|
56499
57745
|
else if (e2.key === "]") page.canvas.stepLevels(1);
|
|
@@ -57749,7 +58995,7 @@ var KEYS = [
|
|
|
57749
58995
|
[
|
|
57750
58996
|
"Reviewing",
|
|
57751
58997
|
[
|
|
57752
|
-
{ k: ["a"], what: "approve the selection; in a source window, its declaration" },
|
|
58998
|
+
{ k: ["a"], what: "approve the selection (nothing where you approved it already); in a source window, its declaration" },
|
|
57753
58999
|
{ k: ["m"], what: "comment on it: write the comment, Esc, m again" },
|
|
57754
59000
|
{ k: ["k"], what: "mark it key for the focus (Focus \u25BE), or unmark it" }
|
|
57755
59001
|
]
|
|
@@ -57760,7 +59006,7 @@ var KEYS = [
|
|
|
57760
59006
|
{ k: ["e"], what: "the outside world on this board, for everyone" },
|
|
57761
59007
|
{ k: ["g"], what: "edges, for you" },
|
|
57762
59008
|
{ k: ["o"], what: "the linear form: the board as its document's outline, on one line" },
|
|
57763
|
-
{ k: ["c"], what: "colour by kind or by
|
|
59009
|
+
{ k: ["c"], what: "colour by kind, by status or by your own review (Mine), for you" },
|
|
57764
59010
|
{ k: ["b"], what: "build status" },
|
|
57765
59011
|
{ k: ["p"], what: "frame meter" },
|
|
57766
59012
|
{ k: ["?"], what: "this sheet: the tips, and the keys" }
|
|
@@ -58852,6 +60098,7 @@ async function boot() {
|
|
|
58852
60098
|
Object.assign(page, followPart(page));
|
|
58853
60099
|
Object.assign(page, talkPart(page));
|
|
58854
60100
|
Object.assign(page, peoplePart(page));
|
|
60101
|
+
Object.assign(page, pointerPart(page));
|
|
58855
60102
|
Object.assign(page, tabsPart(page));
|
|
58856
60103
|
Object.assign(page, sharePart(page));
|
|
58857
60104
|
Object.assign(page, timelinePart(page));
|