@seikika/astro-report 0.0.0-stage → 0.1.0
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/LICENSE +9 -0
- package/README.md +32 -2
- package/integration.d.mts +13 -0
- package/integration.mjs +44 -0
- package/package.json +57 -3
- package/src/ReportApp.vue +220 -0
- package/src/ReportContent.vue +13 -0
- package/src/ReportView.vue +88 -0
- package/src/layouts/DefaultLayout.astro +17 -0
- package/src/lib/bars.ts +290 -0
- package/src/lib/basis.ts +157 -0
- package/src/lib/campaigns.ts +410 -0
- package/src/lib/compare.ts +204 -0
- package/src/lib/dom.ts +43 -0
- package/src/lib/kinds.ts +84 -0
- package/src/lib/levels.ts +61 -0
- package/src/lib/rings.ts +244 -0
- package/src/lib/routes.ts +118 -0
- package/src/lib/rules.ts +143 -0
- package/src/lib/status.ts +150 -0
- package/src/lib/summary.ts +231 -0
- package/src/lib/text.ts +57 -0
- package/src/lib/tracks.ts +264 -0
- package/src/lib/words.ts +72 -0
- package/src/report-view.ts +37 -0
- package/src/report.astro +27 -0
- package/src/report.css +359 -0
- package/src/types.ts +141 -0
- package/src/views/campaigns.ts +265 -0
- package/src/views/catalog.ts +456 -0
- package/src/views/compare.ts +676 -0
- package/src/views/entity.ts +443 -0
- package/src/views/overview.ts +639 -0
- package/src/views/rule.ts +153 -0
- package/src/views/scorecards.ts +947 -0
- package/src/views/tracks.ts +294 -0
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import type { ReportViews } from "../report-view";
|
|
2
|
+
import type { Comparison, ReportData, RuleDef } from "../types";
|
|
3
|
+
import { grow } from "../lib/bars";
|
|
4
|
+
import { basisBadge, basisCounts, basisKey, basisOf, refs, whyEl } from "../lib/basis";
|
|
5
|
+
import { TIMED_UNITS, cmpWord, humanize, magnitude, measureLabel, num, ruleValue, setupBrief, valueLine } from "../lib/compare";
|
|
6
|
+
import { el, enc, link } from "../lib/dom";
|
|
7
|
+
import { UNSCORED } from "../lib/levels";
|
|
8
|
+
import { countWords, productName, shortId, title } from "../lib/rings";
|
|
9
|
+
import { trackPath } from "../lib/routes";
|
|
10
|
+
import { ruleTitle } from "../lib/rules";
|
|
11
|
+
import { rich } from "../lib/text";
|
|
12
|
+
import { STANDING_MARK, byMajority, factorChip, standingBy, standingChip, standingColor, standingPhrase } from "../lib/tracks";
|
|
13
|
+
import { andList, firstSentence, lowerFirst, plural, sentences } from "../lib/words";
|
|
14
|
+
|
|
15
|
+
// The number a factor leads with: rules behind, else ahead, else at parity; both when it is ahead on some and behind on
|
|
16
|
+
// others; or, before any record, that none has values.
|
|
17
|
+
function tallyPhrase(n, total, key) {
|
|
18
|
+
if (n.unknown === total) return "Not measured: none of " + plural(total, "rule") + " has values";
|
|
19
|
+
if (n.behind && n.ahead) return n.ahead + " ahead, " + n.behind + " behind, of " + plural(total, "rule");
|
|
20
|
+
return (n[key] || 0) + " of " + plural(total, "rule") + " " + (key === "parity" ? "at parity" : key);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const compareViews = {
|
|
24
|
+
factorCards(D: ReportData, names, current?) {
|
|
25
|
+
var all = D.comparisons || {};
|
|
26
|
+
var order = { behind: 0, unknown: 1, parity: 2, ahead: 3 };
|
|
27
|
+
var verdictOf = function (n) {
|
|
28
|
+
var c = all[n];
|
|
29
|
+
return (c.verdict || {})[(c.peers || [])[0]] || "unknown";
|
|
30
|
+
};
|
|
31
|
+
return el(
|
|
32
|
+
"div",
|
|
33
|
+
{ className: "factors" },
|
|
34
|
+
...names
|
|
35
|
+
.slice()
|
|
36
|
+
.sort(function (a, b) {
|
|
37
|
+
return order[verdictOf(a)] - order[verdictOf(b)] || title(D, a).localeCompare(title(D, b));
|
|
38
|
+
})
|
|
39
|
+
.map(function (n) {
|
|
40
|
+
var c = all[n];
|
|
41
|
+
var def = (D.scorecards || {})[n] || {};
|
|
42
|
+
var peer = (c.peers || [])[0];
|
|
43
|
+
var v = verdictOf(n);
|
|
44
|
+
var counts = { ahead: 0, parity: 0, behind: 0, unknown: 0 };
|
|
45
|
+
Object.keys(c.rules || {}).forEach(function (r) {
|
|
46
|
+
var x = (c.rules[r] || {})[peer] || "unknown";
|
|
47
|
+
counts[x] = (counts[x] || 0) + 1;
|
|
48
|
+
});
|
|
49
|
+
var segs = ["ahead", "parity", "behind", "unknown"].filter(function (k) {
|
|
50
|
+
return counts[k];
|
|
51
|
+
});
|
|
52
|
+
var spans = segs.map(function (k) {
|
|
53
|
+
return el("span", { style: "flex-grow:0;flex-basis:0;background:" + (k === "unknown" ? UNSCORED : standingColor(k)) });
|
|
54
|
+
});
|
|
55
|
+
grow(
|
|
56
|
+
spans,
|
|
57
|
+
segs.map(function (k) {
|
|
58
|
+
return counts[k];
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
var bar = el("div", { className: "bar xs" }, ...spans);
|
|
62
|
+
bar.setAttribute("role", "img");
|
|
63
|
+
var tallyText = segs
|
|
64
|
+
.map(function (k) {
|
|
65
|
+
return counts[k] + " " + k;
|
|
66
|
+
})
|
|
67
|
+
.join(" · ");
|
|
68
|
+
bar.setAttribute("aria-label", "Rules: " + tallyText);
|
|
69
|
+
// Every card leads with the same number, rules behind (else ahead, else at parity); its widest measured lead follows.
|
|
70
|
+
var best = null as { ratio: number; r: string; word: string } | null;
|
|
71
|
+
Object.keys(c.rules || {}).forEach(function (r) {
|
|
72
|
+
var rd = (def.rules || {})[r] || {};
|
|
73
|
+
if ((c.rules[r] || {})[peer] !== "ahead" || !rd.better) return;
|
|
74
|
+
var x = ruleValue(c, r, c.subject);
|
|
75
|
+
var y = ruleValue(c, r, peer);
|
|
76
|
+
if (typeof x !== "number" || typeof y !== "number" || x <= 0 || y <= 0) return;
|
|
77
|
+
var ratio = Math.max(x, y) / Math.min(x, y);
|
|
78
|
+
if (!best || ratio > best.ratio) best = { ratio: ratio, r: r, word: cmpWord(rd, rd.better === "lower") };
|
|
79
|
+
});
|
|
80
|
+
var total = Object.keys(c.rules || {}).length;
|
|
81
|
+
var fxKey = counts.behind ? "behind" : counts.ahead ? "ahead" : "parity";
|
|
82
|
+
var fx = total
|
|
83
|
+
? el(
|
|
84
|
+
"div",
|
|
85
|
+
{ className: "fx" },
|
|
86
|
+
el("b", { className: counts.unknown === total ? "unmeasured" : counts.behind && counts.ahead ? "mixed" : "", textContent: tallyPhrase(counts, total, fxKey) }),
|
|
87
|
+
best ? el("span", { textContent: "widest lead: " + lowerFirst(measureLabel(c, best.r)) + ", " + (best.ratio >= 10 ? Math.round(best.ratio).toLocaleString("en-US") : best.ratio.toFixed(1)) + "× " + best.word }) : null,
|
|
88
|
+
)
|
|
89
|
+
: null;
|
|
90
|
+
var a = link("compare/" + enc(n), "factor", [
|
|
91
|
+
el("div", { className: "fh" }, el("span", { textContent: def.title || n }), standingChip(v, factorChip(v, counts, total))),
|
|
92
|
+
fx,
|
|
93
|
+
def.rationale || def.description ? el("p", {}, ...rich(firstSentence(def.rationale || def.description))) : null,
|
|
94
|
+
el("div", { className: "fbar" }, bar, el("span", { className: "fc", textContent: tallyText })),
|
|
95
|
+
]);
|
|
96
|
+
a.style.setProperty("--st", standingColor(v));
|
|
97
|
+
if (n === current) a.setAttribute("aria-current", "true");
|
|
98
|
+
return a;
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// One row per factor: the share of its rules behind grows left of the axis, ahead grows right; parity is the gap.
|
|
104
|
+
headToHead(D: ReportData, all, names, peer, current?) {
|
|
105
|
+
var rows = names
|
|
106
|
+
.map(function (n) {
|
|
107
|
+
var c = { ahead: 0, parity: 0, behind: 0, total: 0 };
|
|
108
|
+
Object.keys(all[n].rules || {}).forEach(function (r) {
|
|
109
|
+
var v = ((all[n].rules[r] || {})[peer]) || "unknown";
|
|
110
|
+
if (v in c) c[v]++;
|
|
111
|
+
c.total++;
|
|
112
|
+
});
|
|
113
|
+
return { n: n, c: c };
|
|
114
|
+
})
|
|
115
|
+
.sort(function (a, b) {
|
|
116
|
+
return b.c.behind / Math.max(1, b.c.total) - a.c.behind / Math.max(1, a.c.total) || a.c.ahead / Math.max(1, a.c.total) - b.c.ahead / Math.max(1, b.c.total);
|
|
117
|
+
});
|
|
118
|
+
var pct = function (k, c) {
|
|
119
|
+
return Math.round((100 * c[k]) / Math.max(1, c.total));
|
|
120
|
+
};
|
|
121
|
+
if (!rows.some(function (r) {
|
|
122
|
+
return r.c.ahead || r.c.behind || r.c.parity;
|
|
123
|
+
})) {
|
|
124
|
+
return el("p", { className: "empty", textContent: "Not measured yet. No factor has a value, so there is no ahead, parity, or behind to chart." });
|
|
125
|
+
}
|
|
126
|
+
var box = el(
|
|
127
|
+
"div",
|
|
128
|
+
{ className: "h2h" },
|
|
129
|
+
el("div", { className: "h2h-head", ariaHidden: "true" }, el("span", {}), el("span", { className: "behind", textContent: STANDING_MARK.behind + " behind" }), el("span", { className: "ahead", textContent: "ahead " + STANDING_MARK.ahead })),
|
|
130
|
+
...rows.map(function (r) {
|
|
131
|
+
var a = link("compare/" + enc(r.n), "h2h-row", [
|
|
132
|
+
el("span", { className: "h2h-name", textContent: title(D, r.n) }),
|
|
133
|
+
el("span", { className: "h2h-l" }, el("span", { style: "width:" + pct("behind", r.c) + "%" })),
|
|
134
|
+
el("span", { className: "h2h-r" }, el("span", { style: "width:" + pct("ahead", r.c) + "%" })),
|
|
135
|
+
]);
|
|
136
|
+
a.setAttribute("aria-label", title(D, r.n) + ": " + r.c.behind + " behind, " + r.c.parity + " at parity, " + r.c.ahead + " ahead, of " + r.c.total + " rules");
|
|
137
|
+
a.title = r.c.behind + " behind · " + r.c.parity + " at parity · " + r.c.ahead + " ahead, of " + r.c.total + " rules";
|
|
138
|
+
if (r.n === current) a.setAttribute("aria-current", "true");
|
|
139
|
+
return a;
|
|
140
|
+
}),
|
|
141
|
+
el("div", { className: "h2h-foot", textContent: "Share of each factor's rules; the gap is parity" }),
|
|
142
|
+
);
|
|
143
|
+
return box;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
compare(D: ReportData, name) {
|
|
147
|
+
var all = D.comparisons || {};
|
|
148
|
+
var names = Object.keys(all).sort();
|
|
149
|
+
if (!names.length) return el("section", {}, el("div", { className: "empty", textContent: "No comparative scorecards in this portal." }));
|
|
150
|
+
var first = all[names[0]];
|
|
151
|
+
var subject = first.subject;
|
|
152
|
+
var peer = (first.peers || [])[0];
|
|
153
|
+
var who = function (id) {
|
|
154
|
+
for (var i = 0; i < names.length; i++) {
|
|
155
|
+
var t = (all[names[i]].titles || {})[id];
|
|
156
|
+
if (t && t !== id) return t;
|
|
157
|
+
}
|
|
158
|
+
return productName(D, id);
|
|
159
|
+
};
|
|
160
|
+
var verdictOf = function (n) {
|
|
161
|
+
return ((all[n].verdict || {})[peer]) || "unknown";
|
|
162
|
+
};
|
|
163
|
+
var counts = { ahead: 0, parity: 0, behind: 0, unknown: 0 };
|
|
164
|
+
names.forEach(function (n) {
|
|
165
|
+
counts[verdictOf(n)]++;
|
|
166
|
+
});
|
|
167
|
+
if (name) return this.compareDetail(D, name, names, who);
|
|
168
|
+
var behindNames = names.filter(function (n) {
|
|
169
|
+
return verdictOf(n) === "behind";
|
|
170
|
+
});
|
|
171
|
+
var ruleCounts = { ahead: 0, parity: 0, behind: 0 };
|
|
172
|
+
var ruleTotal = 0;
|
|
173
|
+
var behindRules = {};
|
|
174
|
+
names.forEach(function (n) {
|
|
175
|
+
var rs = all[n].rules || {};
|
|
176
|
+
behindRules[n] = 0;
|
|
177
|
+
Object.keys(rs).forEach(function (r) {
|
|
178
|
+
var v = (rs[r] || {})[peer];
|
|
179
|
+
ruleTotal++;
|
|
180
|
+
if (v in ruleCounts) ruleCounts[v]++;
|
|
181
|
+
if (v === "behind") behindRules[n]++;
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
// A factor count alone overstates a lead built on parity, so the headline pairs it with rules.
|
|
185
|
+
var unmeasured = counts.unknown >= names.length;
|
|
186
|
+
var majority = byMajority(D, names);
|
|
187
|
+
var both = { strict: { ahead: 0, parity: 0, behind: 0, unknown: 0 }, majority: { ahead: 0, parity: 0, behind: 0, unknown: 0 } };
|
|
188
|
+
names.forEach(function (n) {
|
|
189
|
+
var rs = all[n].rules || {};
|
|
190
|
+
var k = { ahead: 0, parity: 0, behind: 0, unknown: 0 };
|
|
191
|
+
Object.keys(rs).forEach(function (r) {
|
|
192
|
+
var v = (rs[r] || {})[peer];
|
|
193
|
+
k[v in k ? v : "unknown"]++;
|
|
194
|
+
});
|
|
195
|
+
both.strict[standingBy(k, false)]++;
|
|
196
|
+
both.majority[standingBy(k, true)]++;
|
|
197
|
+
});
|
|
198
|
+
var tallyOf = function (c) {
|
|
199
|
+
return "ahead on " + c.ahead + " of " + plural(names.length, "factor") + (c.behind ? ", behind on " + c.behind : "") + (c.parity ? ", at parity on " + c.parity : "") + (c.unknown ? ", " + c.unknown + " not measured" : "");
|
|
200
|
+
};
|
|
201
|
+
var strictWords = tallyOf(both.strict);
|
|
202
|
+
var majorityWords = tallyOf(both.majority);
|
|
203
|
+
// The headline is the declared verdict; the other count follows once, as a secondary line.
|
|
204
|
+
var verdictWords = majority ? majorityWords : strictWords;
|
|
205
|
+
var countsDiffer = !unmeasured && strictWords !== majorityWords;
|
|
206
|
+
var countName = majority ? "majority" : "strict";
|
|
207
|
+
var otherName = majority ? "strict" : "majority";
|
|
208
|
+
var headline = unmeasured
|
|
209
|
+
? "Not measured yet: none of the " + plural(names.length, "factor") + " has values for both products."
|
|
210
|
+
: "Ahead on " + verdictWords.slice("ahead on ".length) + ", by the " + countName + " count.";
|
|
211
|
+
// The other count keeps its own name. It sits in the disclosure, with the method, so the hero stays the verdict.
|
|
212
|
+
var otherCount = unmeasured
|
|
213
|
+
? null
|
|
214
|
+
: el(
|
|
215
|
+
"p",
|
|
216
|
+
{ className: "sub", style: "margin:6px 0 0" },
|
|
217
|
+
countsDiffer ? "By the " + otherName + " count, " + (majority ? countWords(both.strict, "strict") : countWords(both.majority)) + "." : "The " + otherName + " count agrees.",
|
|
218
|
+
);
|
|
219
|
+
var lean = counts.behind > counts.ahead ? "behind" : counts.ahead > counts.behind ? "ahead" : "parity";
|
|
220
|
+
var hero = el(
|
|
221
|
+
"section",
|
|
222
|
+
{ className: "cmp-hero" },
|
|
223
|
+
el(
|
|
224
|
+
"div",
|
|
225
|
+
{ className: "cmp-main" },
|
|
226
|
+
el("div", { className: "kicker", textContent: "Head to head" }),
|
|
227
|
+
el("h2", { className: "big", textContent: who(subject) + " vs " + who(peer) }),
|
|
228
|
+
el("p", { className: "verdict", style: "margin:0;font-size:18px" }, el("b", { textContent: headline }), behindNames.length ? el("span", {}, " Behind on ", ...behindNames.map(function (n, i) {
|
|
229
|
+
return el("span", {}, i ? ", " : "", link("compare/" + enc(n), "", title(D, n)), " (" + behindRules[n] + " of " + Object.keys(all[n].rules || {}).length + " rules)");
|
|
230
|
+
}), behindNames.length === 1 ? ": " + andList(Object.keys(all[behindNames[0]].rules || {}).filter(function (r) {
|
|
231
|
+
return (all[behindNames[0]].rules[r] || {})[peer] === "behind";
|
|
232
|
+
}).sort().map(function (r) {
|
|
233
|
+
return ruleTitle(behindNames[0], r);
|
|
234
|
+
})) + ". If your teams rely on those, start with " + title(D, behindNames[0]) + "." : ": if your teams rely on what those factors measure, read them first.") : unmeasured ? " Run the comparison's harness and commit its records to fill this in." : counts.unknown ? " Not behind on any measured factor." : " Never behind."),
|
|
235
|
+
unmeasured
|
|
236
|
+
? el("p", { className: "rule-tally", textContent: "Rule by rule: none of " + plural(ruleTotal, "rule") + " has values for both products yet." })
|
|
237
|
+
: el(
|
|
238
|
+
"p",
|
|
239
|
+
{ className: "rule-tally" },
|
|
240
|
+
"Rule by rule: ",
|
|
241
|
+
el("b", { className: "ahead", textContent: ruleCounts.ahead + " ahead" }),
|
|
242
|
+
" · ",
|
|
243
|
+
el("b", { className: "parity", textContent: ruleCounts.parity + " at parity" }),
|
|
244
|
+
" · ",
|
|
245
|
+
el("b", { className: "behind", textContent: ruleCounts.behind + " behind" }),
|
|
246
|
+
". Factors are not weighted, so the factor count is a tally, not an overall score.",
|
|
247
|
+
),
|
|
248
|
+
el(
|
|
249
|
+
"details",
|
|
250
|
+
{ className: "sub cmp-def cmp-brief", style: "margin:6px 0 0" },
|
|
251
|
+
el("summary", { textContent: "How a factor and a rule are counted" }),
|
|
252
|
+
"A factor is a scorecard that scores both products on the same rules. On a rule, a product is ahead when its measured value is better (within the rule's tolerance is parity) or it passes a bar the other misses. Factors are counted two ways on every portal. By the strict count, " + who(subject) + " is behind on a factor if it is behind on any one of its rules, and ahead if it is ahead on some and behind on none. By the majority count, it is ahead when it is ahead on more of the factor's rules than it is behind on, behind when it is behind on more, and at parity when they are even. Each comparison declares which count is its verdict; this one declares the " + countName + " count. A factor with any unmeasured rule is not measured. “Mixed” means ahead on some rules and behind on others; “narrowly ahead” means ahead on fewer than half of that factor's rules, at parity on the rest.",
|
|
253
|
+
otherCount,
|
|
254
|
+
),
|
|
255
|
+
),
|
|
256
|
+
el(
|
|
257
|
+
"div",
|
|
258
|
+
{ className: "cmp-side" },
|
|
259
|
+
el("div", { className: "kicker", textContent: unmeasured ? "Factors" : "Verdict: " + countName + " count" }),
|
|
260
|
+
el(
|
|
261
|
+
"div",
|
|
262
|
+
{ className: "tally3" },
|
|
263
|
+
...["ahead", "parity", "behind"].map(function (k) {
|
|
264
|
+
var mixed = unmeasured
|
|
265
|
+
? 0
|
|
266
|
+
: names.filter(function (n) {
|
|
267
|
+
var vs = Object.keys(all[n].rules || {}).map(function (r) {
|
|
268
|
+
return (all[n].rules[r] || {})[peer];
|
|
269
|
+
});
|
|
270
|
+
return verdictOf(n) === k && vs.indexOf("ahead") >= 0 && vs.indexOf("behind") >= 0;
|
|
271
|
+
}).length;
|
|
272
|
+
return el("div", {}, el("strong", { textContent: unmeasured ? "—" : String(counts[k]), style: "color:" + (unmeasured ? "var(--muted)" : standingColor(k)) }), el("span", { textContent: STANDING_MARK[k] + " " + k }), mixed ? el("small", { className: "mixed", title: "Mixed means ahead on some of this factor's rules and behind on others.", textContent: mixed + (mixed === 1 ? " of these is mixed" : " of these are mixed") }) : null);
|
|
273
|
+
}),
|
|
274
|
+
),
|
|
275
|
+
unmeasured ? null : el("div", { className: "kicker", style: "margin-top:10px", textContent: "Rules" }),
|
|
276
|
+
unmeasured
|
|
277
|
+
? null
|
|
278
|
+
: el(
|
|
279
|
+
"div",
|
|
280
|
+
{ className: "tally3 rules" },
|
|
281
|
+
...["ahead", "parity", "behind"].map(function (k) {
|
|
282
|
+
return el("div", {}, el("strong", { textContent: String(ruleCounts[k]), style: "color:" + standingColor(k) }), el("span", { textContent: STANDING_MARK[k] + " " + k }));
|
|
283
|
+
}),
|
|
284
|
+
),
|
|
285
|
+
this.headToHead(D, all, names, peer),
|
|
286
|
+
),
|
|
287
|
+
);
|
|
288
|
+
hero.style.setProperty("--st", standingColor(lean));
|
|
289
|
+
hero.dataset.focus = "";
|
|
290
|
+
|
|
291
|
+
// The setup: facts no rule reads (version, corpus, harness, runs) describe how it was measured.
|
|
292
|
+
var read = {};
|
|
293
|
+
var fields = {};
|
|
294
|
+
names.forEach(function (n) {
|
|
295
|
+
Object.values(all[n].reads || {}).forEach(function (fs) {
|
|
296
|
+
(fs || []).forEach(function (f) {
|
|
297
|
+
read[f] = true;
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
Object.assign(fields, all[n].fields || {});
|
|
301
|
+
});
|
|
302
|
+
var facts = first.facts || {};
|
|
303
|
+
var ids = [subject].concat(first.peers || []);
|
|
304
|
+
var context = {};
|
|
305
|
+
ids.forEach(function (id) {
|
|
306
|
+
Object.keys(facts[id] || {}).forEach(function (f) {
|
|
307
|
+
if (!read[f] && f !== "title") context[f] = true;
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
var show = function (v) {
|
|
311
|
+
return typeof v === "number" ? num(v) : typeof v === "boolean" ? (v ? "yes" : "no") : String(v);
|
|
312
|
+
};
|
|
313
|
+
var setup = el(
|
|
314
|
+
"div",
|
|
315
|
+
{ className: "setup" },
|
|
316
|
+
...Object.keys(context)
|
|
317
|
+
.sort()
|
|
318
|
+
.map(function (f) {
|
|
319
|
+
var vals = ids.map(function (id) {
|
|
320
|
+
return (facts[id] || {})[f];
|
|
321
|
+
});
|
|
322
|
+
var same = vals.every(function (v) {
|
|
323
|
+
return JSON.stringify(v) === JSON.stringify(vals[0]);
|
|
324
|
+
});
|
|
325
|
+
return el(
|
|
326
|
+
"div",
|
|
327
|
+
{},
|
|
328
|
+
el("b", { textContent: humanize(f) }),
|
|
329
|
+
same
|
|
330
|
+
? el("span", { textContent: show(vals[0]) })
|
|
331
|
+
: el(
|
|
332
|
+
"span",
|
|
333
|
+
{},
|
|
334
|
+
...ids.map(function (id, i) {
|
|
335
|
+
return vals[i] == null ? null : el("span", { style: "display:block" }, el("span", { className: "sub", textContent: who(id) + ": " }), show(vals[i]));
|
|
336
|
+
}),
|
|
337
|
+
),
|
|
338
|
+
fields[f] ? el("small", { textContent: firstSentence(fields[f]), title: fields[f] }) : null,
|
|
339
|
+
vals.some(function (v) {
|
|
340
|
+
return /\+uncommitted\b/.test(String(v));
|
|
341
|
+
})
|
|
342
|
+
? el("small", { className: "warn-note", textContent: "“+uncommitted”: the harness had local changes when it ran, so this exact code is not in the repository and a rerun from the commit may differ." })
|
|
343
|
+
: null,
|
|
344
|
+
);
|
|
345
|
+
}),
|
|
346
|
+
);
|
|
347
|
+
var trackName = ((D.scorecards || {})[names[0]] || {}).track;
|
|
348
|
+
var track = trackName ? (D.tracks || {})[trackName] : undefined;
|
|
349
|
+
var bases = { measured: 0, judged: 0 };
|
|
350
|
+
names.forEach(function (n) {
|
|
351
|
+
var b = basisCounts(((D.scorecards || {})[n] || {}).rules);
|
|
352
|
+
bases.measured += b.measured;
|
|
353
|
+
bases.judged += b.judged;
|
|
354
|
+
});
|
|
355
|
+
// The hero carries the description's first sentence; the method section continues from there.
|
|
356
|
+
var desc = (track && track.description) || "";
|
|
357
|
+
var lead = desc ? firstSentence(desc) : "";
|
|
358
|
+
var rest = lead ? desc.trim().slice(lead.length).trim() : "";
|
|
359
|
+
// A "Not covered:" sentence is the scope a reader needs before trusting the verdict, so it moves up beside the method.
|
|
360
|
+
var restSentences = rest ? sentences(rest) : [];
|
|
361
|
+
var scope = restSentences.filter(function (x) {
|
|
362
|
+
return /^Not (covered|measured)\s*:/i.test(x);
|
|
363
|
+
})[0];
|
|
364
|
+
restSentences = restSentences.filter(function (x) {
|
|
365
|
+
return x !== scope;
|
|
366
|
+
});
|
|
367
|
+
var method = el(
|
|
368
|
+
"section",
|
|
369
|
+
{},
|
|
370
|
+
el("div", { className: "head" }, el("h2", { textContent: "How it was measured" }), track ? link(trackPath(D, trackName), "", "Track: " + (track.title || trackName) + " →") : null),
|
|
371
|
+
restSentences.length ? el("ul", { className: "method-lede" }, ...restSentences.map(function (x) {
|
|
372
|
+
return el("li", {}, ...rich(x));
|
|
373
|
+
})) : null,
|
|
374
|
+
Object.keys(context).length ? setup : null,
|
|
375
|
+
unmeasured ? el("p", { className: "sub", style: "margin:8px 0 0", textContent: "Nothing is measured in this build. Once the harness runs and its records are committed, the rules are decided like this:" }) : null,
|
|
376
|
+
basisKey(bases),
|
|
377
|
+
);
|
|
378
|
+
var brief = setupBrief(context, ids, facts, who);
|
|
379
|
+
var sources = track ? refs(track.links, false) : null;
|
|
380
|
+
if (brief.length || sources)
|
|
381
|
+
(hero.querySelector(".rule-tally") as HTMLElement).after(
|
|
382
|
+
el(
|
|
383
|
+
"div",
|
|
384
|
+
{ className: "sub cmp-prov" },
|
|
385
|
+
sources ? el("span", { className: "cmp-src" }, el("b", { textContent: "Evidence: " }), sources, unmeasured ? " (no results are recorded in this build yet)" : null) : null,
|
|
386
|
+
),
|
|
387
|
+
);
|
|
388
|
+
(hero.querySelector("details.cmp-def") as HTMLElement).append(
|
|
389
|
+
el(
|
|
390
|
+
"p",
|
|
391
|
+
{ className: "cmp-method", style: "margin:8px 0 0" },
|
|
392
|
+
el("b", { textContent: lead ? "Method: " : "How it was measured: " }),
|
|
393
|
+
...(lead ? rich(lead + " ") : [(brief.length ? brief.join(" · ") + ". " : "") + "Every rule is " + (bases.judged ? "measured or agent-judged" : "measured by script") + ". "]),
|
|
394
|
+
),
|
|
395
|
+
);
|
|
396
|
+
// The scope sits in the hero, beside the tally. A reader who stops at the verdict still sees what was not measured.
|
|
397
|
+
(hero.querySelector(".rule-tally") as HTMLElement).after(
|
|
398
|
+
el(
|
|
399
|
+
"p",
|
|
400
|
+
{ className: "cmp-method", style: "margin:8px 0 0" },
|
|
401
|
+
el("b", { textContent: "Not covered: " }),
|
|
402
|
+
...(scope ? rich(scope.replace(/^Not (covered|measured)\s*:\s*/i, "")) : [el("span", { className: "sub", textContent: "not stated. The track's description has no “Not covered:” sentence." })]),
|
|
403
|
+
),
|
|
404
|
+
el("p", { className: "cmp-method", style: "margin:8px 0 0" }, el("button", {
|
|
405
|
+
className: "link",
|
|
406
|
+
textContent: track && track.description ? "The full method, and who checked it ↓" : "Versions, setup and sources ↓",
|
|
407
|
+
onclick: function () {
|
|
408
|
+
method.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
409
|
+
},
|
|
410
|
+
})),
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
var behindRows: Node[] = [];
|
|
414
|
+
var behindIn: string[] = [];
|
|
415
|
+
var behindBases = {};
|
|
416
|
+
names.forEach(function (n) {
|
|
417
|
+
var def = (D.scorecards || {})[n] || {};
|
|
418
|
+
Object.keys(all[n].rules || {}).forEach(function (r) {
|
|
419
|
+
if ((all[n].rules[r] || {})[peer] === "behind") behindBases[basisOf((def.rules || {})[r] || {})] = true;
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
var oneBasis = Object.keys(behindBases).length === 1 ? Object.keys(behindBases)[0] : null;
|
|
423
|
+
names.forEach(function (n) {
|
|
424
|
+
var c = all[n];
|
|
425
|
+
var def = (D.scorecards || {})[n] || {};
|
|
426
|
+
Object.keys(c.rules || {}).forEach(function (r) {
|
|
427
|
+
if ((c.rules[r] || {})[peer] !== "behind") return;
|
|
428
|
+
var rd = (def.rules || {})[r] || {};
|
|
429
|
+
behindRows.push(
|
|
430
|
+
el(
|
|
431
|
+
"div",
|
|
432
|
+
{ className: "behind-row" },
|
|
433
|
+
el(
|
|
434
|
+
"div",
|
|
435
|
+
{},
|
|
436
|
+
el("div", { style: "font-weight:650", textContent: measureLabel(c, r) }),
|
|
437
|
+
el("div", { className: "sub" }, link("compare/" + enc(n), "", def.title || n), " · ", el("code", { textContent: r }), oneBasis ? null : " ", oneBasis ? null : basisBadge(basisOf(rd), true)),
|
|
438
|
+
el("div", { className: "bh-val" }, valueLine(c, r, rd, ids, who)),
|
|
439
|
+
),
|
|
440
|
+
el(
|
|
441
|
+
"div",
|
|
442
|
+
{},
|
|
443
|
+
rd.rationale ? el("p", { className: "why" }, el("b", { textContent: "Why it matters: " }), ...rich(rd.rationale), (rd.links || []).length ? " " : null, refs(rd.links)) : null,
|
|
444
|
+
rd.fix ? el("p", { className: "why bh-fix" }, el("b", { textContent: "To close it: " }), ...rich(rd.fix)) : null,
|
|
445
|
+
),
|
|
446
|
+
),
|
|
447
|
+
);
|
|
448
|
+
if (behindIn.indexOf(n) < 0) behindIn.push(n);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
var behind = el(
|
|
452
|
+
"section",
|
|
453
|
+
{},
|
|
454
|
+
el("div", { className: "head" }, el("h2", { textContent: unmeasured ? "Where each product leads (not measured yet)" : "Where " + who(subject) + " is behind" }), behindIn.length
|
|
455
|
+
? el(
|
|
456
|
+
"span",
|
|
457
|
+
{ className: "sub" },
|
|
458
|
+
plural(behindRows.length, "rule") + (oneBasis ? ", all " : ""),
|
|
459
|
+
oneBasis ? basisBadge(oneBasis, true) : null,
|
|
460
|
+
"; in full: ",
|
|
461
|
+
...behindIn.flatMap(function (n, i) {
|
|
462
|
+
return [i ? ", " : "", link("compare/" + enc(n), "", title(D, n) + " →")];
|
|
463
|
+
}),
|
|
464
|
+
)
|
|
465
|
+
: null),
|
|
466
|
+
behindRows.length ? el("div", {}, ...behindRows) : unmeasured ? el("p", { className: "empty", textContent: "Nothing to compare yet: no rule has values for both products." }) : el("p", { className: "empty good", textContent: "✓ Not behind on any rule." }),
|
|
467
|
+
);
|
|
468
|
+
// Measured gaps as ratios, widest first: where the subject leads, and where it trails.
|
|
469
|
+
var ratioRows = function (side) {
|
|
470
|
+
var rows: { n: string; c: Comparison; r: string; rd: Partial<RuleDef>; a: number; b: number; ratio: number }[] = [];
|
|
471
|
+
names.forEach(function (n) {
|
|
472
|
+
var c = all[n];
|
|
473
|
+
var def = (D.scorecards || {})[n] || {};
|
|
474
|
+
Object.keys(c.rules || {}).forEach(function (r) {
|
|
475
|
+
var rd = (def.rules || {})[r] || {};
|
|
476
|
+
if ((c.rules[r] || {})[peer] !== side || !rd.better) return;
|
|
477
|
+
var a = ruleValue(c, r, subject);
|
|
478
|
+
var b = ruleValue(c, r, peer);
|
|
479
|
+
if (typeof a !== "number" || typeof b !== "number" || a <= 0 || b <= 0) return;
|
|
480
|
+
rows.push({ n: n, c: c, r: r, rd: rd, a: a, b: b, ratio: Math.max(a, b) / Math.min(a, b) });
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
return rows.sort(function (x, y) {
|
|
484
|
+
return y.ratio - x.ratio;
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
var leadRows = ratioRows("ahead");
|
|
488
|
+
var gapRows = ratioRows("behind");
|
|
489
|
+
var unitOf = function (rd, v) {
|
|
490
|
+
return num(v) + (rd.unit ? " " + rd.unit : "");
|
|
491
|
+
};
|
|
492
|
+
var times = function (l) {
|
|
493
|
+
return l.ratio >= 10 ? Math.round(l.ratio).toLocaleString("en-US") : l.ratio.toFixed(1);
|
|
494
|
+
};
|
|
495
|
+
var widest = function (label, l, gap?) {
|
|
496
|
+
return el("p", { className: "cmp-lead" + (gap ? " gaps" : "") }, el("b", { textContent: label }), link("compare/" + enc(l.n), "", [lowerFirst(measureLabel(l.c, l.r)) + ", ", el("span", { className: "lead-x", textContent: (gap ? STANDING_MARK.behind + " " : "") + times(l) + "× " + cmpWord(l.rd, l.a < l.b) })]), " (" + who(subject) + " " + unitOf(l.rd, l.a) + ", " + who(peer) + " " + unitOf(l.rd, l.b) + ").");
|
|
497
|
+
};
|
|
498
|
+
var tiles = function (rows, gap?) {
|
|
499
|
+
return el(
|
|
500
|
+
"div",
|
|
501
|
+
{ className: gap ? "leads gaps" : "leads" },
|
|
502
|
+
...rows.slice(0, 3).map(function (l) {
|
|
503
|
+
var vs = who(subject) + " " + unitOf(l.rd, l.a) + " vs " + who(peer) + " " + unitOf(l.rd, l.b);
|
|
504
|
+
return link("compare/" + enc(l.n), "lead-tile", [
|
|
505
|
+
el("span", { className: "lead-x", textContent: (gap ? STANDING_MARK.behind + " " : "") + times(l) + "×" }),
|
|
506
|
+
" ",
|
|
507
|
+
el("span", { className: "lead-dir", textContent: cmpWord(l.rd, l.a < l.b) }),
|
|
508
|
+
el("span", { className: "sr", textContent: ":" }),
|
|
509
|
+
" ",
|
|
510
|
+
el("span", { className: "lead-what", textContent: measureLabel(l.c, l.r) }),
|
|
511
|
+
el("span", { className: "sr", textContent: "." }),
|
|
512
|
+
" ",
|
|
513
|
+
el("span", { className: "sub", textContent: vs + " · " + title(D, l.n) }),
|
|
514
|
+
]);
|
|
515
|
+
}),
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
var verdictEl = hero.querySelector(".verdict") as HTMLElement;
|
|
519
|
+
if (gapRows[0]) verdictEl.after(widest("Widest gap: ", gapRows[0], true));
|
|
520
|
+
if (leadRows[0]) verdictEl.after(widest("Widest lead: ", leadRows[0]));
|
|
521
|
+
if (gapRows.length) (behind.querySelector(".head") as HTMLElement).after(el("p", { className: "sub", style: "margin:0 0 6px", textContent: "Measured values only, largest ratio first; every rule behind is listed below." }), tiles(gapRows, true));
|
|
522
|
+
var leads = leadRows.length
|
|
523
|
+
? el(
|
|
524
|
+
"section",
|
|
525
|
+
{},
|
|
526
|
+
el("div", { className: "head" }, el("h2", { textContent: "Where " + who(subject) + " leads by the most" }), el("span", { className: "sub", textContent: "Measured values only, largest ratio first" })),
|
|
527
|
+
tiles(leadRows),
|
|
528
|
+
)
|
|
529
|
+
: null;
|
|
530
|
+
var factors = el("section", {}, el("div", { className: "head" }, el("h2", { textContent: "Factors" }), el("span", { className: "sub", textContent: unmeasured ? "By name" : "Behind first" })), this.factorCards(D, names));
|
|
531
|
+
var jumps = (
|
|
532
|
+
[
|
|
533
|
+
["Factors", factors],
|
|
534
|
+
[unmeasured ? "Who leads" : "Behind", behind],
|
|
535
|
+
["Leads", leads],
|
|
536
|
+
["Method", method],
|
|
537
|
+
] as [string, HTMLElement | null][]
|
|
538
|
+
).filter(function (j) {
|
|
539
|
+
return j[1];
|
|
540
|
+
});
|
|
541
|
+
var jump = el(
|
|
542
|
+
"nav",
|
|
543
|
+
{ className: "jump", ariaLabel: "On this page" },
|
|
544
|
+
el("span", { className: "sub", textContent: "On this page: " }),
|
|
545
|
+
...jumps.map(function (j, i) {
|
|
546
|
+
return el("span", {}, i ? " · " : "", el("button", { className: "link", textContent: j[0], onclick: function () {
|
|
547
|
+
(j[1] as HTMLElement).scrollIntoView({ behavior: "smooth", block: "start" });
|
|
548
|
+
} }));
|
|
549
|
+
}),
|
|
550
|
+
);
|
|
551
|
+
return el("div", {}, hero, jump, factors, behind, leads, method);
|
|
552
|
+
},
|
|
553
|
+
|
|
554
|
+
compareDetail(D: ReportData, name, names, who) {
|
|
555
|
+
var c = (D.comparisons || {})[name];
|
|
556
|
+
var def = (D.scorecards || {})[name] || {};
|
|
557
|
+
var peer = (c.peers || [])[0];
|
|
558
|
+
var ids = [c.subject].concat(c.peers || []);
|
|
559
|
+
var v = (c.verdict || {})[peer] || "unknown";
|
|
560
|
+
var order = { behind: 0, unknown: 1, ahead: 2, parity: 3 };
|
|
561
|
+
var rules = Object.keys(def.rules || {}).sort(function (a, b) {
|
|
562
|
+
var sa = (c.rules[a] || {})[peer] || "unknown";
|
|
563
|
+
var sb = (c.rules[b] || {})[peer] || "unknown";
|
|
564
|
+
return order[sa] - order[sb] || a.localeCompare(b);
|
|
565
|
+
});
|
|
566
|
+
var rows = rules.map(function (r) {
|
|
567
|
+
var rd = def.rules[r];
|
|
568
|
+
var st = (c.rules[r] || {})[peer] || "unknown";
|
|
569
|
+
return el(
|
|
570
|
+
"div",
|
|
571
|
+
{ className: "measure" },
|
|
572
|
+
el(
|
|
573
|
+
"div",
|
|
574
|
+
{ className: "mt" },
|
|
575
|
+
measureLabel(c, r),
|
|
576
|
+
el("small", {}, el("code", { textContent: r }), basisBadge(basisOf(rd), true), rd.better ? el("span", { textContent: rd.better + " is better" }) : null),
|
|
577
|
+
),
|
|
578
|
+
valueLine(c, r, rd, ids, who),
|
|
579
|
+
el("div", { className: "ms" }, standingChip(st, st === "parity" ? "parity" : st === "unknown" ? "not measured" : who(c.subject) + " " + st), magnitude(c, r, rd, who)),
|
|
580
|
+
el(
|
|
581
|
+
"div",
|
|
582
|
+
{ className: "full" },
|
|
583
|
+
whyEl(rd),
|
|
584
|
+
el(
|
|
585
|
+
"details",
|
|
586
|
+
{},
|
|
587
|
+
el("summary", { textContent: "How it is scored" }),
|
|
588
|
+
el(
|
|
589
|
+
"p",
|
|
590
|
+
{ className: "sub", style: "margin:6px 0 0" },
|
|
591
|
+
((c.reads || {})[r] || []).length
|
|
592
|
+
? "The benchmark harness recorded " +
|
|
593
|
+
((c.reads || {})[r] || [])
|
|
594
|
+
.map(function (f) {
|
|
595
|
+
return "“" + ((c.fields || {})[f] || humanize(f)).replace(/\.$/, "") + "”";
|
|
596
|
+
})
|
|
597
|
+
.join(" and ") +
|
|
598
|
+
" for each product, on the versions and machine under "
|
|
599
|
+
: "Scored on the versions and machine under ",
|
|
600
|
+
link("compare", "", "How it was measured"),
|
|
601
|
+
". " + (rd.better ? "The " + rd.better + " value is ahead." : "Passing beats failing."),
|
|
602
|
+
),
|
|
603
|
+
el("div", { className: "cel", ariaLabel: "Expression", textContent: rd.check + (rd.value ? "\nvalue: " + rd.value : "") }),
|
|
604
|
+
),
|
|
605
|
+
rd.fix && st === "behind" ? el("p", { className: "sub", style: "margin:4px 0 0" }, el("b", { textContent: "What would close it: " }), ...rich(rd.fix)) : null,
|
|
606
|
+
),
|
|
607
|
+
);
|
|
608
|
+
});
|
|
609
|
+
// Parity sorts last; when it is most of a long factor, it folds so the rules that differ lead.
|
|
610
|
+
var atParity = rules.filter(function (r) {
|
|
611
|
+
return ((c.rules[r] || {})[peer] || "unknown") === "parity";
|
|
612
|
+
}).length;
|
|
613
|
+
var fold = atParity >= 3 && atParity < rules.length;
|
|
614
|
+
var read = {};
|
|
615
|
+
names.forEach(function (n) {
|
|
616
|
+
Object.values(((D.comparisons || {})[n] || {}).reads || {}).forEach(function (fs) {
|
|
617
|
+
(fs || []).forEach(function (f) {
|
|
618
|
+
read[f] = true;
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
var context = {};
|
|
623
|
+
ids.forEach(function (id) {
|
|
624
|
+
Object.keys((c.facts || {})[id] || {}).forEach(function (f) {
|
|
625
|
+
if (!read[f] && f !== "title") context[f] = true;
|
|
626
|
+
});
|
|
627
|
+
});
|
|
628
|
+
// Numeric setup facts (a corpus size, a run count) parameterise timed runs; a factor with no timed
|
|
629
|
+
// rule was probed once, so only the builds it probed apply.
|
|
630
|
+
var timed = Object.values(def.rules || {}).some(function (rd) {
|
|
631
|
+
return TIMED_UNITS.indexOf(String(rd.unit || "").toLowerCase()) >= 0;
|
|
632
|
+
});
|
|
633
|
+
if (!timed)
|
|
634
|
+
Object.keys(context).forEach(function (f) {
|
|
635
|
+
if (ids.some(function (id) { return typeof ((c.facts || {})[id] || {})[f] === "number"; })) delete context[f];
|
|
636
|
+
});
|
|
637
|
+
var brief = setupBrief(context, ids, c.facts || {}, who);
|
|
638
|
+
var tallyBy = new Map();
|
|
639
|
+
rules.forEach(function (r) {
|
|
640
|
+
var s = (c.rules[r] || {})[peer] || "unknown";
|
|
641
|
+
tallyBy.set(s, (tallyBy.get(s) || 0) + 1);
|
|
642
|
+
});
|
|
643
|
+
var tallyKey = tallyBy.get("behind") ? "behind" : tallyBy.get("ahead") ? "ahead" : "parity";
|
|
644
|
+
var tallyNote = rules.length ? " · " + tallyPhrase({ unknown: tallyBy.get("unknown") || 0, behind: tallyBy.get("behind"), ahead: tallyBy.get("ahead"), parity: tallyBy.get("parity") }, rules.length, tallyKey) : "";
|
|
645
|
+
var allUnknown = rules.length > 0 && (tallyBy.get("unknown") || 0) === rules.length;
|
|
646
|
+
var head = el(
|
|
647
|
+
"section",
|
|
648
|
+
{ className: basisCounts(def.rules).judged || !basisCounts(def.rules).measured ? "" : "allmeasured" },
|
|
649
|
+
el("nav", { className: "crumb", ariaLabel: "Breadcrumb" }, link("compare", "", "Compare"), " / " + (def.title || name)),
|
|
650
|
+
el("div", { className: "head" }, el("h2", { textContent: def.title || name, tabIndex: -1 }), standingChip(v, rules.length && (tallyBy.get("unknown") || 0) === rules.length ? tallyNote.slice(3) : standingPhrase(who(c.subject), v, who(peer)) + tallyNote)),
|
|
651
|
+
brief.length ? el("p", { className: "sub provenance" }, el("b", { textContent: timed ? "Timed on: " : "Probed once on: " }), brief.join(" · ") + ". ", /\+uncommitted\b/.test(brief.join(" ")) ? "“+uncommitted” means the harness had local changes when it ran, so a rerun from that commit may differ. " : "", link("compare", "", "How it was measured, and who checked it →")) : null,
|
|
652
|
+
def.description ? el("p", { className: "lede" }, ...rich(def.description)) : null,
|
|
653
|
+
def.rationale || (def.links || []).length ? el("div", { className: "rationale" }, el("b", { textContent: "Why this factor matters" }), def.rationale ? el("div", {}, ...rich(def.rationale)) : null, refs(def.links)) : null,
|
|
654
|
+
allUnknown
|
|
655
|
+
? el("p", { className: "sub", textContent: "None of these rules has a value for both products yet, so this factor has no verdict." })
|
|
656
|
+
: el("p", { className: "sub", textContent: "Each rule scores both products. Where both have a measured value, the better value decides; otherwise passing beats failing. By the strict count, " + who(c.subject) + " is behind on the factor if it is behind on any rule; by the majority count, it follows whichever side more of the rules are on. This comparison's verdict is the " + (c.verdictRule === "majority" ? "majority" : "strict") + " count." }),
|
|
657
|
+
basisKey(basisCounts(def.rules)),
|
|
658
|
+
el("div", {}, ...(fold ? rows.slice(0, rows.length - atParity) : rows)),
|
|
659
|
+
fold
|
|
660
|
+
? el(
|
|
661
|
+
"details",
|
|
662
|
+
{
|
|
663
|
+
className: "parity-fold",
|
|
664
|
+
ontoggle: function (this: HTMLDetailsElement) {
|
|
665
|
+
(this.firstChild as Node).textContent = (this.open ? "Hide the " : "Show the ") + atParity + " rules at parity (neither product leads)";
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
el("summary", { textContent: "Show the " + atParity + " rules at parity (neither product leads)" }),
|
|
669
|
+
...rows.slice(rows.length - atParity),
|
|
670
|
+
)
|
|
671
|
+
: null,
|
|
672
|
+
);
|
|
673
|
+
head.dataset.focus = "";
|
|
674
|
+
return el("div", {}, head, el("section", {}, el("div", { className: "head" }, el("h2", { textContent: "Every factor" }), link("compare", "", "← Back to the summary")), el("div", { className: "h2h-wide" }, this.headToHead(D, D.comparisons, names, peer, name))));
|
|
675
|
+
},
|
|
676
|
+
} satisfies ThisType<ReportViews>;
|