literally-aeo 0.4.2 → 0.4.4
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 +21 -1
- package/dist/cli.mjs +1528 -551
- package/dist/lib/agents/methodology.js +9 -9
- package/dist/lib/bundle/contracts.js +1 -1
- package/dist/lib/bundle/export.js +18 -18
- package/dist/lib/bundle/journal.js +2 -2
- package/dist/lib/bundle/project-journal.js +5 -5
- package/dist/lib/bundle/project.js +16 -16
- package/dist/lib/bundle/read.js +19 -19
- package/dist/lib/bundle/recorder.js +3 -3
- package/dist/lib/bundle/redact.js +2 -2
- package/dist/lib/bundle/trace-coverage.js +2 -2
- package/dist/lib/bundle/verify-integrity.js +4 -4
- package/dist/lib/bundle/verify-measurement.js +2 -2
- package/dist/lib/bundle/verify-report.js +3 -3
- package/dist/lib/bundle/verify.js +8 -8
- package/dist/lib/checks/run-checks.js +4 -4
- package/dist/lib/chunks/{chunk-U4AROC2Z.js → chunk-22QIMTQJ.js} +1 -1
- package/dist/lib/chunks/{chunk-KFYTORIT.js → chunk-2IZ2LTBQ.js} +4 -4
- package/dist/lib/chunks/{chunk-22SP35NA.js → chunk-2S2NKIK2.js} +1 -1
- package/dist/lib/chunks/{chunk-3USKGGFT.js → chunk-2WBJER62.js} +15 -5
- package/dist/lib/chunks/{chunk-DU3MAXVC.js → chunk-3RSF2PY4.js} +6 -1
- package/dist/lib/chunks/{chunk-ITLJZUKL.js → chunk-4M6CQKSH.js} +1 -1
- package/dist/lib/chunks/{chunk-RR63UE5H.js → chunk-4SPKLFJK.js} +4 -4
- package/dist/lib/chunks/{chunk-5EM6J7TG.js → chunk-4VURIRL7.js} +2 -2
- package/dist/lib/chunks/{chunk-T4Z3GAEH.js → chunk-5EE3IOLY.js} +1 -1
- package/dist/lib/chunks/{chunk-ATKP5ZW6.js → chunk-5YXU5WAK.js} +1 -1
- package/dist/lib/chunks/{chunk-RWVXK7XE.js → chunk-6OV2GIKK.js} +5 -5
- package/dist/lib/chunks/{chunk-XT5M3PPQ.js → chunk-6ZZ4MHYW.js} +3 -3
- package/dist/lib/chunks/{chunk-T5Q5CBTA.js → chunk-AC5YND5N.js} +1 -1
- package/dist/lib/chunks/{chunk-NZOKSFIA.js → chunk-ALORJCG4.js} +3 -3
- package/dist/lib/chunks/{chunk-OF3WIGG7.js → chunk-AQVARUFR.js} +6 -6
- package/dist/lib/chunks/{chunk-BKAERR7J.js → chunk-AR2LGUP4.js} +2 -2
- package/dist/lib/chunks/{chunk-EZ23TKTX.js → chunk-ATYDD4EM.js} +2 -2
- package/dist/lib/chunks/{chunk-ENPRRXH5.js → chunk-BC53CVOM.js} +1 -1
- package/dist/lib/chunks/chunk-BWBPEXEU.js +83 -0
- package/dist/lib/chunks/chunk-C34NR35E.js +472 -0
- package/dist/lib/chunks/{chunk-32LZRJ3P.js → chunk-CYTHCMYY.js} +2 -2
- package/dist/lib/chunks/{chunk-WIRVKAYB.js → chunk-DH7D4KNR.js} +12 -12
- package/dist/lib/chunks/{chunk-QJX6YXXQ.js → chunk-DOV622W3.js} +3 -3
- package/dist/lib/chunks/{chunk-DI4LZR37.js → chunk-EI6P2B4R.js} +3 -3
- package/dist/lib/chunks/{chunk-CRXJFOCK.js → chunk-FX4Y7GVR.js} +4 -4
- package/dist/lib/chunks/{chunk-R2HFGAOO.js → chunk-GKLCM5K2.js} +2 -2
- package/dist/lib/chunks/{chunk-BWI4M36B.js → chunk-GTQORFWR.js} +4 -4
- package/dist/lib/chunks/{chunk-HJEIEMPE.js → chunk-GV47I7MF.js} +4 -4
- package/dist/lib/chunks/{chunk-M4XGUJMO.js → chunk-GVDOWLYF.js} +1 -1
- package/dist/lib/chunks/{chunk-JGBJQ3TO.js → chunk-GZRG3QSS.js} +1 -1
- package/dist/lib/chunks/{chunk-JKBXKACC.js → chunk-J66AN3MF.js} +7 -7
- package/dist/lib/chunks/{chunk-YRXYTCMY.js → chunk-JHUI2K5X.js} +1 -1
- package/dist/lib/chunks/{chunk-3DVFQMJT.js → chunk-JMWS4PZR.js} +8 -3
- package/dist/lib/chunks/chunk-JQFLWUCA.js +123 -0
- package/dist/lib/chunks/{chunk-FXCUGNFL.js → chunk-JXQOWHWB.js} +1 -1
- package/dist/lib/chunks/{chunk-STNUFF7H.js → chunk-K6MHEUSS.js} +2 -2
- package/dist/lib/chunks/{chunk-CMB2KSW2.js → chunk-KNX75J6T.js} +16 -7
- package/dist/lib/chunks/{chunk-6P7EZJI7.js → chunk-KSJ3NZIJ.js} +4 -2
- package/dist/lib/chunks/{chunk-FBMO6UV4.js → chunk-L5FM3KGF.js} +1 -1
- package/dist/lib/chunks/{chunk-7QYZSP7Q.js → chunk-LQIBRJWR.js} +4 -0
- package/dist/lib/chunks/{chunk-A2RW4ZMR.js → chunk-MI4GIMHK.js} +1 -1
- package/dist/lib/chunks/{chunk-YPGJN232.js → chunk-MKA2EP7M.js} +1 -1
- package/dist/lib/chunks/{chunk-NWABYXDQ.js → chunk-NAFSRHVZ.js} +2 -2
- package/dist/lib/chunks/{chunk-JN4332MJ.js → chunk-OSELZPPA.js} +1 -1
- package/dist/lib/chunks/{chunk-TD47AB37.js → chunk-OXNS5JNZ.js} +2 -2
- package/dist/lib/chunks/{chunk-KC35BXW7.js → chunk-R5VAHYBF.js} +1 -1
- package/dist/lib/chunks/{chunk-Q6TZB2OQ.js → chunk-RF2V6XQ3.js} +1 -1
- package/dist/lib/chunks/{chunk-AMK6IHJD.js → chunk-SVVA7MIE.js} +1 -1
- package/dist/lib/chunks/{chunk-RYV25YGT.js → chunk-V4VBRJEK.js} +1 -1
- package/dist/lib/chunks/chunk-VFN2J4Z3.js +626 -0
- package/dist/lib/chunks/{chunk-AMF3T5A3.js → chunk-WQXXNDBO.js} +1 -1
- package/dist/lib/chunks/{chunk-VOK4TUXV.js → chunk-WZ5A77WN.js} +1 -1
- package/dist/lib/chunks/{chunk-DKR7LSP2.js → chunk-YGW3HTTH.js} +1 -1
- package/dist/lib/chunks/{chunk-FFDMGNRO.js → chunk-YHHWIOO5.js} +6 -6
- package/dist/lib/cli/bundle-commands.js +64 -39
- package/dist/lib/cli/guide-command.js +1 -1
- package/dist/lib/cli/run-commands.js +43 -43
- package/dist/lib/cli/status-command.js +25 -25
- package/dist/lib/codex-workflow/aggregate.js +2 -2
- package/dist/lib/codex-workflow/author.js +3 -3
- package/dist/lib/codex-workflow/capture.js +12 -12
- package/dist/lib/codex-workflow/copy-editor.js +3 -3
- package/dist/lib/codex-workflow/copy.js +2 -2
- package/dist/lib/codex-workflow/finish.js +11 -11
- package/dist/lib/codex-workflow/loop.js +19 -19
- package/dist/lib/codex-workflow/run-source.js +5 -5
- package/dist/lib/codex-workflow/stage.js +5 -5
- package/dist/lib/engine/audit-file.js +9 -9
- package/dist/lib/engine/author.js +16 -16
- package/dist/lib/engine/cost-estimate.js +9 -9
- package/dist/lib/engine/local-run.js +24 -24
- package/dist/lib/engine/preflight.js +10 -10
- package/dist/lib/engine/rejudge.js +31 -31
- package/dist/lib/engine/resources.js +1 -1
- package/dist/lib/engine/run-bindings.js +9 -9
- package/dist/lib/engine/run-method.js +2 -2
- package/dist/lib/engine/run-models.js +4 -4
- package/dist/lib/engine/run-status.js +25 -25
- package/dist/lib/engine/templates.js +10 -10
- package/dist/lib/grounding/grounding-runtime.js +5 -5
- package/dist/lib/grounding/recorded-tools.js +4 -4
- package/dist/lib/pipeline.js +11 -11
- package/dist/lib/probes/adapters/cli-agents.js +6 -6
- package/dist/lib/probes/adapters/cli-claude-code.js +3 -3
- package/dist/lib/probes/adapters/cli-codex.js +3 -3
- package/dist/lib/probes/adapters/cli-cursor.js +3 -3
- package/dist/lib/probes/adapters/cli-process.js +2 -2
- package/dist/lib/probes/agent-clis.js +7 -7
- package/dist/lib/probes/bindings.js +8 -8
- package/dist/lib/probes/charged-trace.js +9 -9
- package/dist/lib/probes/child-process.js +1 -1
- package/dist/lib/probes/probes.js +9 -9
- package/dist/lib/viewer/alternatives.js +8 -0
- package/dist/lib/viewer/cited-domains.js +8 -0
- package/dist/lib/viewer/page.js +3 -1
- package/dist/lib/viewer/presentation.js +41 -0
- package/dist/lib/viewer/server.js +15 -10
- package/dist/types/bundle/contracts.d.ts +1 -1
- package/dist/types/engine/resources.d.ts +2 -0
- package/dist/types/engine/templates.d.ts +1 -1
- package/dist/types/viewer/alternatives.d.ts +16 -0
- package/dist/types/viewer/cited-domains.d.ts +22 -0
- package/dist/types/viewer/page.d.ts +9 -2
- package/dist/types/viewer/presentation.d.ts +112 -0
- package/dist/types/viewer/server.d.ts +7 -3
- package/package.json +2 -1
- package/resources/fonts/Mulish-OFL.txt +93 -0
- package/resources/fonts/Mulish-VariableFont_wght.ttf +0 -0
- package/resources/fonts/SourceCodePro-OFL.txt +93 -0
- package/resources/fonts/SourceCodePro-VariableFont_wght.ttf +0 -0
- package/resources/guide/OPERATOR.md +4 -1
- package/src/bundle/contracts.ts +1 -1
- package/src/cli/bundle-commands.ts +21 -0
- package/src/engine/guide/OPERATOR.md +4 -1
- package/src/engine/preflight.ts +4 -1
- package/src/engine/resources.ts +9 -5
- package/src/engine/templates.ts +5 -0
- package/src/probes/adapters/cli-claude-code.ts +14 -4
- package/src/probes/child-process.ts +4 -0
- package/src/report/core/rate-interval.ts +1 -2
- package/src/viewer/alternatives.ts +202 -0
- package/src/viewer/cited-domains.ts +127 -0
- package/src/viewer/page.ts +549 -236
- package/src/viewer/presentation.ts +759 -0
- package/src/viewer/server.ts +25 -4
- package/dist/lib/chunks/chunk-3TF4JGQA.js +0 -323
package/src/viewer/page.ts
CHANGED
|
@@ -1,65 +1,227 @@
|
|
|
1
1
|
// ============================================================================
|
|
2
2
|
// The local report viewer's page (specs/aeo-open-source-cli-spec.md §4.3,
|
|
3
|
-
// §10, §12)
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// §10, §12), in the hosted report's design language: a pale amber hero with
|
|
4
|
+
// the hard-shadow measurement card, then full-width bands that alternate
|
|
5
|
+
// white and grey, one per market section. One self-contained document, no
|
|
6
|
+
// remote fonts, scripts or images. The server derives every figure
|
|
7
|
+
// (presentation.ts); this script only renders it. Every captured or
|
|
8
|
+
// model-written string is inserted with textContent, never as markup, and
|
|
9
|
+
// source links open only when clicked.
|
|
7
10
|
// ============================================================================
|
|
8
11
|
|
|
9
12
|
const styles = `
|
|
10
13
|
:root {
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
--
|
|
14
|
+
--darkest: #000; --lightest: #fff; --brand-1: #ffd08a; --brand-1-light: #ffedd2;
|
|
15
|
+
--neutral-1: #f1f1f1; --neutral-2: #c8c8c8; --positive: #059669;
|
|
16
|
+
--positive-deep: #065f46; --mention: #8b5cf6; --mention-deep: #5b21b6;
|
|
17
|
+
--negative: #ef4444; --muted: rgb(0 0 0 / 0.6); --muted-strong: rgb(0 0 0 / 0.7);
|
|
18
|
+
--backdrop: rgb(0 0 0 / 0.25);
|
|
19
|
+
--font-body: Mulish, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
20
|
+
--font-mono: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
21
|
+
/* Light only, as the hosted report is, whatever the system theme. */
|
|
14
22
|
color-scheme: light;
|
|
15
23
|
}
|
|
16
|
-
@media (prefers-color-scheme: dark) {
|
|
17
|
-
:root {
|
|
18
|
-
--bg: #111317; --fg: #e8eaee; --muted: #9aa1ad; --line: #2a2e36;
|
|
19
|
-
--panel: #181b21; --accent: #8fa2ff; --pass: #5fd08f; --fail: #ff8a80;
|
|
20
|
-
--warn: #e5b45a;
|
|
21
|
-
color-scheme: dark;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
24
|
* { box-sizing: border-box; }
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
h1
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
html { -webkit-text-size-adjust: 100%; }
|
|
26
|
+
body { margin: 0; background: var(--lightest); color: var(--darkest);
|
|
27
|
+
font: 16px/1.5 var(--font-body); }
|
|
28
|
+
p, h1, h2, h3, ul { margin: 0; }
|
|
29
|
+
ul { padding: 0; list-style: none; }
|
|
30
|
+
button { font: inherit; color: inherit; }
|
|
31
|
+
button:not(:disabled) { cursor: pointer; }
|
|
32
|
+
:focus-visible { outline: 2px solid var(--darkest); outline-offset: 2px; }
|
|
33
|
+
.mono { font-family: var(--font-mono); }
|
|
31
34
|
.muted { color: var(--muted); }
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.
|
|
35
|
+
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
|
|
36
|
+
.band { background: var(--lightest); }
|
|
37
|
+
.band.soft { background: var(--neutral-1); }
|
|
38
|
+
.band > .container > .band-inner { padding: 60px 0; }
|
|
39
|
+
.banner { background: var(--darkest); color: var(--lightest); padding: 12px 20px;
|
|
40
|
+
text-align: center; font-size: 14px; }
|
|
41
|
+
.eyebrow { font-family: var(--font-mono); font-size: 14px; line-height: 20px;
|
|
42
|
+
font-weight: 500; text-transform: uppercase; }
|
|
43
|
+
.h1 { font-size: 32px; line-height: 37px; font-weight: 900; text-wrap: balance; }
|
|
44
|
+
.h2 { font-size: 28px; line-height: 34px; font-weight: 900; text-wrap: balance; }
|
|
45
|
+
.h5 { font-size: 18px; line-height: 25px; font-weight: 800; }
|
|
46
|
+
.body-1 { font-size: 20px; line-height: 24px; font-weight: 500; }
|
|
47
|
+
.body-2 { font-size: 18px; line-height: 22px; font-weight: 500; }
|
|
48
|
+
.hero { background: var(--brand-1-light); }
|
|
49
|
+
.hero-grid { display: grid; gap: 40px; padding: 40px 0 60px; }
|
|
50
|
+
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
|
|
51
|
+
.hero-copy .body-1 { max-width: 720px; }
|
|
52
|
+
.measured { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--muted); }
|
|
53
|
+
.measurement { border: 1px solid var(--neutral-2); border-radius: 8px; background: var(--lightest);
|
|
54
|
+
padding: 20px; box-shadow: 8px 8px var(--neutral-2); }
|
|
55
|
+
.measurement-figure { font-size: 50px; line-height: 56px; font-weight: 900; margin-top: 12px; }
|
|
56
|
+
.facts { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
|
|
57
|
+
.facts li { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 500;
|
|
58
|
+
border: 1px solid var(--neutral-2); border-radius: 4px; background: var(--neutral-1); padding: 12px; }
|
|
59
|
+
.header { display: grid; gap: 16px; }
|
|
60
|
+
.header-title { display: flex; flex-direction: column; gap: 12px; }
|
|
61
|
+
.header.center { display: flex; flex-direction: column; align-items: center; text-align: center; }
|
|
62
|
+
.header.center .body-2 { max-width: 820px; }
|
|
63
|
+
.scorecards { margin-top: 40px; border-radius: 16px; background: var(--brand-1-light); padding: 30px 20px; }
|
|
64
|
+
.scorecards-grid { display: grid; grid-template-columns: 1fr; gap: 30px; }
|
|
65
|
+
.stat { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
|
|
66
|
+
.stat-figure { font-family: var(--font-mono); font-size: 40px; line-height: 36px;
|
|
67
|
+
font-variant-numeric: tabular-nums; }
|
|
68
|
+
.stat-label { font-size: 16px; font-weight: 700; }
|
|
69
|
+
.stat-detail { font-size: 14px; color: var(--muted-strong); }
|
|
70
|
+
.interval { display: block; }
|
|
71
|
+
.tip-trigger { background: none; border: 0; padding: 0; margin: 0; text-align: left;
|
|
72
|
+
font-size: 14px; color: var(--muted-strong); text-decoration: underline dotted;
|
|
73
|
+
text-underline-offset: 4px; cursor: help; }
|
|
74
|
+
.tip { display: block; margin-top: 4px; font-size: 12px; color: var(--muted-strong); }
|
|
44
75
|
.tip[hidden] { display: none; }
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
.subsection { margin-top: 40px; }
|
|
77
|
+
.card { margin-top: 20px; border: 1px solid var(--neutral-2); border-radius: 8px;
|
|
78
|
+
background: var(--lightest); padding: 20px; }
|
|
79
|
+
.card-title { font-size: 16px; font-weight: 700; }
|
|
80
|
+
.card-lead { margin-top: 4px; font-size: 14px; color: var(--muted); }
|
|
81
|
+
.scroll { overflow-x: auto; }
|
|
82
|
+
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
|
|
83
|
+
th { font-family: var(--font-mono); font-weight: 500; color: var(--muted); text-align: left;
|
|
84
|
+
border-bottom: 1px solid var(--neutral-2); padding: 8px 12px; }
|
|
85
|
+
td { border-bottom: 1px solid var(--neutral-2); padding: 10px 12px; vertical-align: top; }
|
|
86
|
+
.num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
87
|
+
.rate { font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
88
|
+
tr.total td { border-bottom: 0; font-weight: 700; color: var(--darkest); }
|
|
89
|
+
tr.selectable { cursor: pointer; }
|
|
90
|
+
tr.selectable:hover { background: var(--neutral-1); }
|
|
91
|
+
.row-button { background: none; border: 0; padding: 0; text-align: left; }
|
|
92
|
+
.matrix-card { margin-top: 40px; padding: 16px; }
|
|
93
|
+
.matrix { min-width: 640px; }
|
|
94
|
+
.matrix th, .matrix td { text-align: center; padding: 8px 12px; }
|
|
95
|
+
.matrix th.prompt-head, .matrix td.prompt { text-align: left; position: sticky; left: 0;
|
|
96
|
+
z-index: 1; background: var(--lightest); }
|
|
97
|
+
.matrix td.prompt { max-width: 280px; }
|
|
98
|
+
.matrix .group { border-bottom: 0; padding-bottom: 4px; font-size: 11px; letter-spacing: 0.05em;
|
|
99
|
+
text-transform: uppercase; }
|
|
100
|
+
.matrix .agents-start { border-left: 1px solid var(--neutral-2); }
|
|
101
|
+
.prompt-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
|
102
|
+
overflow: hidden; font-size: 12px; line-height: 1.375; }
|
|
103
|
+
.prompt-category { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em;
|
|
104
|
+
text-transform: uppercase; color: var(--muted); }
|
|
105
|
+
.cell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
|
|
106
|
+
gap: 2px; min-width: 36px; min-height: 36px; padding: 4px 6px; border: 1px solid transparent;
|
|
107
|
+
border-radius: 6px; background: none; }
|
|
108
|
+
.cell:hover { border-color: var(--neutral-2); background: var(--neutral-1); }
|
|
109
|
+
.cell-count { font-size: 9px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
110
|
+
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-2); }
|
|
111
|
+
.dot.primary { width: 10px; height: 10px; background: var(--positive); }
|
|
112
|
+
.dot.mentioned { background: var(--mention); }
|
|
113
|
+
.dot.absent { background: var(--negative); opacity: 0.7; }
|
|
114
|
+
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 12px; font-size: 11px; color: var(--muted); }
|
|
115
|
+
.legend li { display: flex; align-items: center; gap: 8px; }
|
|
116
|
+
.hint { margin-top: 12px; border: 1px solid var(--brand-1); border-radius: 6px;
|
|
117
|
+
background: var(--brand-1-light); padding: 8px 12px; font-size: 12px; line-height: 1.625; }
|
|
118
|
+
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
|
|
119
|
+
.bars li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr auto; align-items: center; gap: 12px; }
|
|
120
|
+
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
|
|
121
|
+
.bar-domain { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--muted); }
|
|
122
|
+
.bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--neutral-1); }
|
|
123
|
+
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--darkest); }
|
|
124
|
+
.bar-value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
125
|
+
.hosts { margin-left: 8px; font-size: 12px; color: var(--muted); }
|
|
126
|
+
.more { margin-top: 12px; background: none; border: 0; padding: 0; font-family: var(--font-mono);
|
|
127
|
+
font-size: 12px; text-decoration: underline; text-decoration-color: var(--brand-1);
|
|
128
|
+
text-decoration-thickness: 2px; text-underline-offset: 4px; }
|
|
129
|
+
.label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.14em;
|
|
130
|
+
text-transform: uppercase; color: var(--muted); }
|
|
131
|
+
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
|
|
132
|
+
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--neutral-2);
|
|
133
|
+
border-radius: 999px; background: var(--neutral-1); padding: 4px 10px; font-size: 12px; }
|
|
134
|
+
.pill.plain { background: var(--lightest); }
|
|
135
|
+
.pill.dashed { border-style: dashed; background: none; color: var(--muted); }
|
|
136
|
+
.pill.mono { font-family: var(--font-mono); }
|
|
137
|
+
.pill.pass, .pill.primary { border-color: rgb(5 150 105 / 0.3); background: rgb(5 150 105 / 0.1);
|
|
138
|
+
color: var(--positive-deep); font-weight: 500; }
|
|
139
|
+
.pill.mentioned { border-color: rgb(139 92 246 / 0.3); background: rgb(139 92 246 / 0.1);
|
|
140
|
+
color: var(--mention-deep); font-weight: 500; }
|
|
141
|
+
.pill.fail, .pill.absent { border-color: rgb(239 68 68 / 0.2); background: rgb(239 68 68 / 0.1);
|
|
142
|
+
font-weight: 500; }
|
|
143
|
+
.pill-count { color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
144
|
+
.verification td:nth-child(2) { white-space: nowrap; }
|
|
145
|
+
.footer { max-width: 720px; margin: 0 auto; text-align: center; font-size: 14px;
|
|
146
|
+
line-height: 1.625; color: var(--muted); }
|
|
147
|
+
.footer > * + * { margin-top: 12px; }
|
|
148
|
+
.footer h2 { margin-top: 24px; font-size: 14px; font-weight: 700; color: var(--muted-strong); }
|
|
149
|
+
.footer ul { margin-top: 8px; padding-left: 20px; list-style: disc; text-align: left; }
|
|
150
|
+
.footer ul li + li { margin-top: 4px; }
|
|
151
|
+
.footer-note { margin-top: 32px; border-top: 1px solid var(--neutral-2); padding-top: 24px; }
|
|
152
|
+
.sheet-backdrop { position: fixed; inset: 0; z-index: 1000; background: var(--backdrop); cursor: pointer; }
|
|
153
|
+
.sheet { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; display: flex;
|
|
154
|
+
flex-direction: column; width: 100%; max-width: 560px; background: var(--lightest);
|
|
155
|
+
padding: 20px; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
|
|
156
|
+
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
|
|
157
|
+
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
158
|
+
.sheet-description { margin-top: 4px; font-size: 14px; color: var(--muted); }
|
|
159
|
+
.sheet-close { flex-shrink: 0; border: 1px solid var(--neutral-2); border-radius: 6px;
|
|
160
|
+
background: none; padding: 4px 10px; font-family: var(--font-mono); font-size: 14px; }
|
|
161
|
+
.sheet-close:hover { background: var(--neutral-1); }
|
|
162
|
+
.sheet-body { display: flex; flex-direction: column; gap: 20px; flex: 1; min-height: 0;
|
|
163
|
+
margin-top: 20px; padding-right: 4px; overflow-y: auto; }
|
|
164
|
+
.prompt-box { border: 1px solid var(--neutral-2); border-radius: 8px; background: var(--neutral-1); padding: 16px; }
|
|
165
|
+
.prompt-box p { margin-top: 8px; font-size: 14px; line-height: 1.625; }
|
|
166
|
+
.prompt-box p.prompt-category { font-size: 11px; letter-spacing: 0.14em; }
|
|
167
|
+
.run { border: 1px solid var(--neutral-2); border-radius: 8px; background: var(--lightest); padding: 16px; }
|
|
168
|
+
.run-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
|
|
169
|
+
.run-head .pills { margin-top: 0; justify-content: flex-end; }
|
|
170
|
+
.run-title { font-size: 14px; font-weight: 700; }
|
|
171
|
+
.run-surface { font-size: 12px; color: var(--muted); }
|
|
172
|
+
.run-block { margin-top: 16px; }
|
|
173
|
+
.snippet { margin-top: 16px; border-radius: 6px; background: var(--neutral-1); padding: 12px; }
|
|
174
|
+
.answer { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.625; }
|
|
175
|
+
.answer mark { background: var(--brand-1-light); color: inherit; border-radius: 2px;
|
|
176
|
+
box-shadow: 0 0 0 1px var(--brand-1); }
|
|
177
|
+
.links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
|
|
178
|
+
.source { max-width: 100%; background: none; border: 0; padding: 0; text-align: left;
|
|
179
|
+
overflow-wrap: anywhere; font-size: 12px; font-weight: 500; text-decoration: underline;
|
|
180
|
+
text-decoration-color: var(--brand-1); text-decoration-thickness: 2px; text-underline-offset: 4px; }
|
|
181
|
+
.source:hover { text-decoration-color: var(--darkest); }
|
|
182
|
+
.source-meta { margin-top: 2px; font-size: 11px; color: var(--muted); }
|
|
183
|
+
.empty { border: 1px dashed var(--neutral-2); border-radius: 6px; padding: 12px; font-size: 14px; color: var(--muted); }
|
|
184
|
+
@media (min-width: 480px) {
|
|
185
|
+
.h1 { font-size: 40px; line-height: 50px; }
|
|
186
|
+
.h2 { font-size: 32px; line-height: 38px; }
|
|
187
|
+
.scorecards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
188
|
+
.sheet { padding: 32px; }
|
|
189
|
+
}
|
|
190
|
+
@media (min-width: 768px) {
|
|
191
|
+
.container { padding: 0 30px; }
|
|
192
|
+
.h1 { font-size: 44px; line-height: 56px; }
|
|
193
|
+
.h2 { font-size: 36px; line-height: 42px; }
|
|
194
|
+
.h5 { font-size: 20px; }
|
|
195
|
+
.body-1 { font-size: 22px; line-height: 28px; }
|
|
196
|
+
.body-2 { font-size: 20px; line-height: 25px; }
|
|
197
|
+
.hero-grid { padding-top: 80px; }
|
|
198
|
+
.measurement { padding: 30px; }
|
|
199
|
+
.header.split { grid-template-columns: 0.8fr 1fr; align-items: start; gap: 40px; }
|
|
200
|
+
.scorecards { padding: 30px 40px; }
|
|
201
|
+
.scorecards-grid { gap: 40px; }
|
|
202
|
+
.matrix-card { padding: 20px; }
|
|
203
|
+
}
|
|
204
|
+
@media (min-width: 992px) {
|
|
205
|
+
.container { padding: 0 40px; }
|
|
206
|
+
.band > .container > .band-inner { padding: 100px 0; }
|
|
207
|
+
.eyebrow { font-size: 16px; }
|
|
208
|
+
.h2 { font-size: 42px; line-height: 50px; }
|
|
209
|
+
.body-1 { font-size: 24px; line-height: 30px; }
|
|
210
|
+
.hero-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.62fr); align-items: center;
|
|
211
|
+
padding: 100px 0; }
|
|
212
|
+
.measurement-figure { font-size: 72px; line-height: 78px; }
|
|
213
|
+
.facts li { font-size: 16px; }
|
|
214
|
+
.scorecards { padding: 40px 60px; }
|
|
215
|
+
.scorecards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
216
|
+
.scorecards-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
217
|
+
.stat-figure { font-size: 56px; line-height: 48px; }
|
|
218
|
+
}
|
|
219
|
+
@media (min-width: 1280px) {
|
|
220
|
+
.scorecards-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
221
|
+
}
|
|
222
|
+
@media (prefers-reduced-motion: reduce) {
|
|
223
|
+
* { scroll-behavior: auto; transition: none; }
|
|
224
|
+
}
|
|
63
225
|
`;
|
|
64
226
|
|
|
65
227
|
const script = `
|
|
@@ -76,46 +238,31 @@ const el = (tag, attrs = {}, ...children) => {
|
|
|
76
238
|
else if (key.startsWith('on')) node.addEventListener(key.slice(2), value);
|
|
77
239
|
else node.setAttribute(key, value);
|
|
78
240
|
}
|
|
79
|
-
for (const child of children) {
|
|
80
|
-
if (child === null || child === undefined) continue;
|
|
241
|
+
for (const child of children.flat()) {
|
|
242
|
+
if (child === null || child === undefined || child === false) continue;
|
|
81
243
|
node.append(typeof child === 'string' ? document.createTextNode(child) : child);
|
|
82
244
|
}
|
|
83
245
|
return node;
|
|
84
246
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
evidence && isShare(evidence.low) && isShare(evidence.high) && evidence.low <= evidence.high
|
|
94
|
-
&& isCount(evidence.count) && isCount(evidence.captured) && isCount(evidence.planned)
|
|
95
|
-
? evidence : null;
|
|
96
|
-
// Outward to whole percents, so the range shown always contains the computed
|
|
97
|
-
// interval. The bounds are stored to 6 decimals; scaling them to an integer
|
|
98
|
-
// first keeps a bound of 0.07 (7.000000000000001 once multiplied) at 7%.
|
|
99
|
-
// The rule of report/core/rate-interval.ts, repeated here because this page
|
|
100
|
-
// is one self-contained script; page.spec.ts holds the two to the same
|
|
101
|
-
// answers.
|
|
102
|
-
const intervalText = (evidence) =>
|
|
103
|
-
Math.floor(Math.round(evidence.low * 1e6) / 1e4) + '–'
|
|
104
|
-
+ Math.ceil(Math.round(evidence.high * 1e6) / 1e4) + '%';
|
|
247
|
+
const plural = (count, noun) => count + ' ' + noun + (count === 1 ? '' : 's');
|
|
248
|
+
|
|
249
|
+
// Escape closes whatever is open: a tooltip, or the evidence sheet.
|
|
250
|
+
const dismissals = [];
|
|
251
|
+
document.addEventListener('keydown', (event) => {
|
|
252
|
+
if (event.key === 'Escape') for (const dismiss of dismissals) dismiss();
|
|
253
|
+
});
|
|
254
|
+
|
|
105
255
|
// The counts behind an interval, in a tooltip (WCAG 1.4.13). It opens on
|
|
106
256
|
// hover, on keyboard focus and on a tap; it stays open while the pointer is
|
|
107
257
|
// over it; Escape closes it; and a screen reader reads it as the interval's
|
|
108
258
|
// description. It sits in the flow under the interval, so a scrolling table
|
|
109
259
|
// cannot clip it and it hides nothing.
|
|
110
|
-
const tipDismissals = [];
|
|
111
|
-
document.addEventListener('keydown', (event) => {
|
|
112
|
-
if (event.key === 'Escape') for (const dismiss of tipDismissals) dismiss();
|
|
113
|
-
});
|
|
114
260
|
let tipCount = 0;
|
|
115
|
-
const
|
|
261
|
+
const intervalOf = (interval) => {
|
|
262
|
+
if (!interval) return null;
|
|
116
263
|
tipCount += 1;
|
|
117
264
|
const id = 'tip-' + tipCount;
|
|
118
|
-
const tip = el('span', { class: 'tip', role: 'tooltip', id, hidden: '' },
|
|
265
|
+
const tip = el('span', { class: 'tip', role: 'tooltip', id, hidden: '' }, interval.counts);
|
|
119
266
|
let hovered = false;
|
|
120
267
|
let focused = false;
|
|
121
268
|
const sync = () => {
|
|
@@ -123,186 +270,330 @@ const withTip = (label, name, text) => {
|
|
|
123
270
|
else tip.setAttribute('hidden', '');
|
|
124
271
|
};
|
|
125
272
|
const trigger = el('button', { type: 'button', class: 'tip-trigger',
|
|
126
|
-
'aria-label':
|
|
273
|
+
'aria-label': interval.label, 'aria-describedby': id,
|
|
127
274
|
// Safari focuses no button on a click or a tap, and a button that kept
|
|
128
275
|
// focus through Escape gets no new focus event: a click (or Enter or
|
|
129
276
|
// Space) opens the tip itself, until focus moves on.
|
|
130
277
|
onclick: () => { trigger.focus(); focused = true; sync(); },
|
|
131
278
|
onfocus: () => { focused = true; sync(); },
|
|
132
279
|
onblur: () => { focused = false; sync(); },
|
|
133
|
-
},
|
|
134
|
-
|
|
280
|
+
}, interval.text);
|
|
281
|
+
dismissals.push(() => { hovered = false; focused = false; sync(); });
|
|
135
282
|
return el('span', { class: 'interval',
|
|
136
283
|
onmouseenter: () => { hovered = true; sync(); },
|
|
137
284
|
onmouseleave: () => { hovered = false; sync(); },
|
|
138
285
|
}, trigger, tip);
|
|
139
286
|
};
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
287
|
+
|
|
288
|
+
// External sources open only on a deliberate click, in a new context.
|
|
289
|
+
const sourceLink = (url) => el('button', { class: 'source', type: 'button',
|
|
290
|
+
onclick: () => { if (/^https?:\\/\\//.test(url)) window.open(url, '_blank', 'noopener,noreferrer'); },
|
|
291
|
+
}, url);
|
|
292
|
+
|
|
293
|
+
// The brand's name marked in a captured answer, every piece of it text.
|
|
294
|
+
const highlighted = (text, term) => {
|
|
295
|
+
const needle = term.trim().toLowerCase();
|
|
296
|
+
if (!needle) return [text];
|
|
297
|
+
const haystack = text.toLowerCase();
|
|
298
|
+
const pieces = [];
|
|
299
|
+
let from = 0;
|
|
300
|
+
for (let at = haystack.indexOf(needle); at !== -1; at = haystack.indexOf(needle, from)) {
|
|
301
|
+
pieces.push(text.slice(from, at), el('mark', {}, text.slice(at, at + needle.length)));
|
|
302
|
+
from = at + needle.length;
|
|
303
|
+
}
|
|
304
|
+
pieces.push(text.slice(from));
|
|
305
|
+
return pieces.filter((piece) => piece !== '');
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// The side sheet behind a matrix cell or a cited domain.
|
|
309
|
+
const createSheet = () => {
|
|
310
|
+
const title = el('h2', { class: 'h5', id: 'sheet-title' });
|
|
311
|
+
const description = el('p', { class: 'sheet-description' });
|
|
312
|
+
const body = el('div', { class: 'sheet-body' });
|
|
313
|
+
let opener = null;
|
|
314
|
+
let isOpen = false;
|
|
315
|
+
const backdrop = el('div', { class: 'sheet-backdrop', hidden: '', onclick: () => close() });
|
|
316
|
+
const closeButton = el('button', { type: 'button', class: 'sheet-close', onclick: () => close() }, 'Close');
|
|
317
|
+
const panel = el('div', { class: 'sheet', role: 'dialog', 'aria-modal': 'true',
|
|
318
|
+
'aria-labelledby': 'sheet-title', hidden: '' },
|
|
319
|
+
el('div', { class: 'sheet-head' }, el('div', {}, title, description), closeButton), body);
|
|
320
|
+
const close = () => {
|
|
321
|
+
if (!isOpen) return;
|
|
322
|
+
isOpen = false;
|
|
323
|
+
backdrop.setAttribute('hidden', '');
|
|
324
|
+
panel.setAttribute('hidden', '');
|
|
325
|
+
// Focus returns to what opened the sheet.
|
|
326
|
+
opener?.focus();
|
|
327
|
+
};
|
|
328
|
+
dismissals.push(close);
|
|
329
|
+
const open = (from, heading, summary, content) => {
|
|
330
|
+
opener = from;
|
|
331
|
+
title.replaceChildren(heading);
|
|
332
|
+
description.replaceChildren(summary);
|
|
333
|
+
body.replaceChildren(...content);
|
|
334
|
+
backdrop.removeAttribute('hidden');
|
|
335
|
+
panel.removeAttribute('hidden');
|
|
336
|
+
isOpen = true;
|
|
337
|
+
closeButton.focus();
|
|
338
|
+
};
|
|
339
|
+
return { nodes: [backdrop, panel], open };
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const band = (tone, ...content) => el('section', { class: tone === 'soft' ? 'band soft' : 'band' },
|
|
343
|
+
el('div', { class: 'container' }, el('div', { class: 'band-inner' }, ...content)));
|
|
344
|
+
|
|
345
|
+
const sectionHeader = (eyebrow, heading, lead, layout) => {
|
|
346
|
+
const title = el('div', { class: 'header-title' },
|
|
347
|
+
el('p', { class: 'eyebrow' }, eyebrow), el('h2', { class: 'h2' }, heading));
|
|
348
|
+
return el('div', { class: 'header ' + (layout || (lead ? 'split' : '')) },
|
|
349
|
+
title, lead ? el('p', { class: 'body-2' }, lead) : null);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
const statusLabels = { primary: 'Primary', mentioned: 'Mentioned', absent: 'Absent', no_overview: 'No AI Overview' };
|
|
353
|
+
const retrievalLabels = { searched: 'searched the web', memory: 'answered from memory', unknown: 'retrieval unknown' };
|
|
354
|
+
|
|
355
|
+
const runCard = (run, brandName) => el('article', { class: 'run' },
|
|
356
|
+
el('div', { class: 'run-head' },
|
|
357
|
+
el('div', {}, el('p', { class: 'run-title' }, 'Run ' + run.runNumber),
|
|
358
|
+
el('p', { class: 'run-surface' }, run.surface + (run.cliVersion ? ' · ' + run.cliVersion : ''))),
|
|
359
|
+
el('div', { class: 'pills' },
|
|
360
|
+
run.retrieval ? el('span', { class: 'pill mono' + (run.retrieval === 'unknown' ? ' dashed' : '') },
|
|
361
|
+
retrievalLabels[run.retrieval]) : null,
|
|
362
|
+
el('span', { class: 'pill ' + (run.status === 'no_overview' ? 'dashed' : run.status) }, statusLabels[run.status]))),
|
|
363
|
+
run.snippet ? el('div', { class: 'snippet' }, el('p', { class: 'label' }, 'Detected mention'),
|
|
364
|
+
el('p', { class: 'answer' }, ...highlighted(run.snippet, brandName))) : null,
|
|
365
|
+
run.answer ? el('div', { class: 'run-block' }, el('p', { class: 'label' }, 'Full captured answer'),
|
|
366
|
+
el('p', { class: 'answer' }, ...highlighted(run.answer, brandName)))
|
|
367
|
+
: el('p', { class: 'empty run-block' }, run.status === 'no_overview'
|
|
368
|
+
? 'The results page showed no AI Overview: there is no answer to show.'
|
|
369
|
+
: 'No captured answer in this bundle matches this run.'),
|
|
370
|
+
run.mentionedBrands.length ? el('div', { class: 'run-block' }, el('p', { class: 'label' }, 'Mentioned companies'),
|
|
371
|
+
el('ul', { class: 'pills' }, run.mentionedBrands.map((brand) => el('li', {}, el('span', { class: 'pill plain' }, brand))))) : null,
|
|
372
|
+
run.citedUrls.length ? el('div', { class: 'run-block' }, el('p', { class: 'label' }, 'URLs in response'),
|
|
373
|
+
el('ul', { class: 'links' }, run.citedUrls.map((url) => el('li', {}, sourceLink(url))))) : null,
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
const scorecards = (cards) => el('div', { class: 'scorecards' },
|
|
377
|
+
el('div', { class: cards.length >= 5 ? 'scorecards-grid five' : 'scorecards-grid' },
|
|
378
|
+
cards.map((card) => el('div', { class: 'stat' },
|
|
379
|
+
el('p', { class: 'stat-figure' }, card.headline),
|
|
380
|
+
intervalOf(card.headlineInterval),
|
|
381
|
+
el('p', { class: 'stat-label' }, card.label),
|
|
382
|
+
card.detail ? el('p', { class: 'stat-detail' }, card.detail) : null,
|
|
383
|
+
intervalOf(card.detailInterval)))));
|
|
384
|
+
|
|
385
|
+
const surfaceRates = (rows) => rows.length === 0 ? null : el('section', { class: 'subsection', 'aria-label': 'Rates by AI surface' },
|
|
386
|
+
el('p', { class: 'h5' }, 'By AI surface'),
|
|
387
|
+
el('div', { class: 'scroll' }, el('table', { class: 'by-model' },
|
|
388
|
+
el('thead', {}, el('tr', {}, el('th', {}, 'AI surface'), el('th', {}, 'Share of voice'), el('th', {}, 'Citation rate'))),
|
|
389
|
+
el('tbody', {}, rows.map((row) => el('tr', {},
|
|
390
|
+
el('td', {}, row.surface),
|
|
391
|
+
el('td', {}, el('span', { class: 'rate' }, row.shareOfVoice.percent), intervalOf(row.shareOfVoice.interval)),
|
|
392
|
+
el('td', {}, el('span', { class: 'rate' }, row.citationRate.percent), intervalOf(row.citationRate.interval))))))));
|
|
393
|
+
|
|
394
|
+
const dot = (status) => el('span', { class: 'dot ' + status, role: 'img',
|
|
395
|
+
'aria-label': { primary: 'Primary mention', mentioned: 'Secondary mention', absent: 'Not mentioned', no_data: 'No data' }[status] });
|
|
396
|
+
|
|
397
|
+
const matrix = (section, brandName, sheet) => {
|
|
398
|
+
const { assistantSurfaces, agentSurfaces, rows } = section.matrix;
|
|
399
|
+
const surfaces = [...assistantSurfaces, ...agentSurfaces];
|
|
400
|
+
const firstAgent = assistantSurfaces.length;
|
|
401
|
+
const edge = (index, base) => base + (agentSurfaces.length && index === firstAgent ? ' agents-start' : '');
|
|
402
|
+
const groups = agentSurfaces.length === 0 ? null : el('tr', {},
|
|
403
|
+
el('td', { class: 'prompt group', 'aria-hidden': 'true' }),
|
|
404
|
+
assistantSurfaces.length ? el('th', { class: 'group', colspan: String(assistantSurfaces.length), scope: 'colgroup' }, 'AI assistants') : null,
|
|
405
|
+
el('th', { class: 'group agents-start', colspan: String(agentSurfaces.length), scope: 'colgroup' }, 'Coding agents'));
|
|
406
|
+
const body = rows.map((row, promptIdx) => el('tr', {},
|
|
407
|
+
el('td', { class: 'prompt', title: row.prompt },
|
|
408
|
+
el('span', { class: 'prompt-text' }, row.prompt), el('span', { class: 'prompt-category' }, row.category)),
|
|
409
|
+
row.cells.map((cell, index) => el('td', { class: edge(index, '') },
|
|
410
|
+
cell.status === 'no_data' ? dot('no_data') : (() => {
|
|
411
|
+
const button = el('button', { type: 'button', class: 'cell',
|
|
412
|
+
'aria-label': surfaces[index] + ', prompt ' + (promptIdx + 1) + ': ' + cell.status + '. Inspect evidence.',
|
|
413
|
+
onclick: () => sheet.open(button, surfaces[index] + ' evidence',
|
|
414
|
+
'Prompt ' + (promptIdx + 1) + ' · ' + cell.mentioned + '/' + cell.runs.length + ' runs mentioned ' + brandName,
|
|
415
|
+
[el('section', { class: 'prompt-box' }, el('h3', { class: 'label' }, 'Prompt'), el('p', {}, row.prompt),
|
|
416
|
+
el('p', { class: 'prompt-category' }, row.category)),
|
|
417
|
+
...cell.runs.map((run) => runCard(run, brandName))]),
|
|
418
|
+
}, dot(cell.status), el('span', { class: 'cell-count' }, cell.mentioned + '/' + cell.runs.length));
|
|
419
|
+
return button;
|
|
420
|
+
})()))));
|
|
421
|
+
return el('div', { class: 'card matrix-card' },
|
|
422
|
+
el('div', { class: 'scroll', role: 'group', 'aria-label': 'AI answer evidence matrix', tabindex: '0' },
|
|
423
|
+
el('table', { class: 'matrix' },
|
|
424
|
+
el('thead', {}, groups, el('tr', {}, el('th', { class: 'prompt-head' }, 'Prompt'),
|
|
425
|
+
surfaces.map((surface, index) => el('th', { class: edge(index, '') }, surface)))),
|
|
426
|
+
el('tbody', {}, body))),
|
|
427
|
+
el('ul', { class: 'legend' },
|
|
428
|
+
[['primary', 'Primary recommendation'], ['mentioned', 'Mentioned secondarily'], ['absent', 'Not mentioned'], ['no_data', 'No data']]
|
|
429
|
+
.map(([status, text]) => el('li', {}, el('span', { class: 'dot ' + status }), text))),
|
|
430
|
+
el('p', { class: 'hint' }, 'Click any dot with a run count to inspect the captured AI answers, cited URLs, and highlighted mentions behind that result.'));
|
|
151
431
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
432
|
+
|
|
433
|
+
const alternatives = (rows) => rows.length === 0 ? null : el('div', { class: 'card' },
|
|
434
|
+
el('h3', { class: 'card-title' }, 'Who buyers hear about instead'),
|
|
435
|
+
el('p', { class: 'card-lead' }, 'Competing companies and products named in the answers, ranked by share of voice (answers that mention them / answers captured).'),
|
|
436
|
+
el('ul', { class: 'bars' }, rows.map((row) => {
|
|
437
|
+
const fill = el('span', { class: 'bar-fill' });
|
|
438
|
+
// CSSOM, which the page's Content Security Policy allows, unlike a style attribute.
|
|
439
|
+
if (fill.style) fill.style.width = (row.share * 100) + '%';
|
|
440
|
+
return el('li', {},
|
|
441
|
+
el('span', { class: 'bar-name', title: row.domain || row.name }, row.name,
|
|
442
|
+
row.domain && row.domain.toLowerCase() !== row.name.trim().toLowerCase() ? el('span', { class: 'bar-domain' }, row.domain) : null),
|
|
443
|
+
el('span', { class: 'bar' }, fill),
|
|
444
|
+
el('span', { class: 'bar-value' }, row.percent + ' ' + row.mentioning + '/' + row.captured));
|
|
445
|
+
})));
|
|
446
|
+
|
|
447
|
+
const citedDomains = (domains, sheet) => {
|
|
448
|
+
const total = domains.reduce((sum, domain) => sum + domain.count, 0);
|
|
449
|
+
const shown = 10;
|
|
450
|
+
const body = el('tbody');
|
|
451
|
+
const more = el('button', { type: 'button', class: 'more' });
|
|
452
|
+
let showAll = false;
|
|
453
|
+
const rowOf = (domain) => {
|
|
454
|
+
const inspect = (from) => sheet.open(from, domain.domain, plural(domain.count, 'citation') + ' across the captured answers',
|
|
455
|
+
[el('ul', { class: 'links' }, domain.urls.map((url) => el('li', {}, sourceLink(url.url),
|
|
456
|
+
el('p', { class: 'source-meta' }, plural(url.count, 'citation') + ' · ' + url.surfaces.join(', ')),
|
|
457
|
+
...url.prompts.map((prompt) => el('p', { class: 'source-meta' }, prompt)))))]);
|
|
458
|
+
const name = el('span', { class: domain.isBrand ? 'rate' : '' }, domain.domain);
|
|
459
|
+
const hosts = domain.hosts ? el('span', { class: 'hosts' }, domain.hosts.map((host) => host.label + ' ' + host.count).join(' · ')) : null;
|
|
460
|
+
if (domain.count === 0) return el('tr', {}, el('td', {}, name, hosts), el('td', { class: 'num' }, '0'));
|
|
461
|
+
const button = el('button', { type: 'button', class: 'row-button',
|
|
462
|
+
'aria-label': 'Inspect the ' + domain.count + ' cited URLs behind ' + domain.domain,
|
|
463
|
+
onclick: (event) => { event.stopPropagation?.(); inspect(button); } }, name, hosts);
|
|
464
|
+
return el('tr', { class: 'selectable', onclick: () => inspect(button) },
|
|
465
|
+
el('td', {}, button), el('td', { class: 'num' }, String(domain.count)));
|
|
466
|
+
};
|
|
467
|
+
const sync = () => {
|
|
468
|
+
body.replaceChildren(...(showAll ? domains : domains.slice(0, shown)).map(rowOf));
|
|
469
|
+
const hidden = domains.length - shown;
|
|
470
|
+
more.replaceChildren(showAll ? 'Show fewer domains' : '+' + plural(hidden, 'more domain'));
|
|
471
|
+
if (hidden > 0) more.removeAttribute('hidden'); else more.setAttribute('hidden', '');
|
|
472
|
+
};
|
|
473
|
+
more.addEventListener('click', () => { showAll = !showAll; sync(); });
|
|
474
|
+
sync();
|
|
475
|
+
return el('div', { class: 'card' },
|
|
476
|
+
el('h3', { class: 'card-title' }, 'What gets cited'),
|
|
477
|
+
el('p', { class: 'card-lead' }, 'Domains behind the URLs cited in these answers'
|
|
478
|
+
+ (total > 0 ? ' (' + total + ' citations captured). Click a domain to inspect the URLs behind it.' : '.')),
|
|
479
|
+
el('div', { class: 'scroll' }, el('table', {},
|
|
480
|
+
el('thead', {}, el('tr', {}, el('th', {}, 'Domain'), el('th', { class: 'num' }, 'Citations'))), body)),
|
|
481
|
+
more);
|
|
171
482
|
};
|
|
172
|
-
const answerKey = (section, promptId, surface, runIndex) =>
|
|
173
|
-
section + '|' + promptId + '|' + surface + '|' + runIndex;
|
|
174
483
|
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
})
|
|
181
|
-
|
|
484
|
+
const sourceCategories = [['owned', 'Owned'], ['competitor', 'Competitor'], ['social', 'Social & community'],
|
|
485
|
+
['institutional', 'Institutional'], ['earned', 'Earned']];
|
|
486
|
+
|
|
487
|
+
const sourceMix = (mix) => !mix || mix.rows.length === 0 ? null : el('div', { class: 'card' },
|
|
488
|
+
el('h3', { class: 'card-title' }, 'Where the citations come from'),
|
|
489
|
+
el('p', { class: 'card-lead' }, 'Every cited URL classified: the brand’s own pages, competitor pages, social and community threads, institutional references, or earned media. Each surface leans differently.'),
|
|
490
|
+
el('div', { class: 'scroll', role: 'group', 'aria-label': 'Citation sources by AI surface', tabindex: '0' },
|
|
491
|
+
el('table', {},
|
|
492
|
+
el('thead', {}, el('tr', {}, el('th', {}, 'Surface'), sourceCategories.map(([, label]) => el('th', { class: 'num' }, label)))),
|
|
493
|
+
el('tbody', {},
|
|
494
|
+
mix.rows.map((row) => el('tr', {}, el('td', { class: 'rate' }, row.surface),
|
|
495
|
+
sourceCategories.map(([key]) => el('td', { class: 'num' }, row.counts[key] ? String(row.counts[key]) : '—')))),
|
|
496
|
+
el('tr', { class: 'total' }, el('td', {}, 'All surfaces'),
|
|
497
|
+
sourceCategories.map(([key]) => el('td', { class: 'num' }, mix.total[key] ? String(mix.total[key]) : '—')))))));
|
|
498
|
+
|
|
499
|
+
const perception = (view, brandName) => {
|
|
500
|
+
if (!view) return null;
|
|
501
|
+
const mentions = view.positive + view.neutral + view.negative;
|
|
502
|
+
if (mentions === 0 && view.phrases.length === 0) return null;
|
|
503
|
+
return el('div', { class: 'card' },
|
|
504
|
+
el('h3', { class: 'card-title' }, 'How the answers talk about ' + brandName),
|
|
505
|
+
mentions > 0 ? el('p', { class: 'card-lead' }, 'Across ' + mentions + ' answers that mention ' + brandName + ': '
|
|
506
|
+
+ view.positive + ' positive, ' + view.neutral + ' neutral, ' + view.negative + ' negative.') : null,
|
|
507
|
+
view.phrases.length ? el('div', { class: 'run-block' },
|
|
508
|
+
el('p', { class: 'label' }, 'Phrases the answers attach to ' + brandName),
|
|
509
|
+
el('ul', { class: 'pills' }, view.phrases.map((phrase) => el('li', {},
|
|
510
|
+
el('span', { class: 'pill', title: 'Said by ' + phrase.surfaces.join(', ') },
|
|
511
|
+
el('span', {}, '“' + phrase.text + '”'),
|
|
512
|
+
phrase.count > 1 ? el('span', { class: 'pill-count' }, '×' + phrase.count) : null))))) : null);
|
|
182
513
|
};
|
|
183
514
|
|
|
515
|
+
const verification = (result) => el('div', { class: 'card' },
|
|
516
|
+
el('h3', { class: 'card-title' }, 'Checks'),
|
|
517
|
+
el('p', { class: 'card-lead' }, 'Capture authenticity: self-reported. Checks run on this machine, offline.'),
|
|
518
|
+
el('div', { class: 'scroll' }, el('table', { class: 'verification' },
|
|
519
|
+
el('thead', {}, el('tr', {}, el('th', {}, 'Check'), el('th', {}, 'Outcome'), el('th', {}, 'Why'))),
|
|
520
|
+
el('tbody', {}, result.checks.map((check) => el('tr', {},
|
|
521
|
+
el('td', {}, check.title),
|
|
522
|
+
el('td', {}, el('span', { class: 'pill ' + (check.outcome === 'pass' ? 'pass' : check.outcome === 'fail' ? 'fail' : 'dashed') },
|
|
523
|
+
check.outcome.replace('_', ' '))),
|
|
524
|
+
el('td', { class: 'muted' }, check.outcome === 'pass' ? '' : check.explanation)))))));
|
|
525
|
+
|
|
526
|
+
const hero = (report, info) => el('section', { class: 'hero' }, el('div', { class: 'container' },
|
|
527
|
+
el('div', { class: 'hero-grid' },
|
|
528
|
+
el('div', { class: 'hero-copy' },
|
|
529
|
+
el('p', { class: 'eyebrow' }, 'AI visibility audit'),
|
|
530
|
+
el('h1', { class: 'h1' }, report.hero.title),
|
|
531
|
+
el('p', { class: 'body-1' }, report.hero.subtitle),
|
|
532
|
+
el('p', { class: 'measured' }, 'Measured ' + report.hero.measuredOn + ' · ' + info.originLabel)),
|
|
533
|
+
el('div', { class: 'measurement' },
|
|
534
|
+
el('p', { class: 'eyebrow' }, 'The measurement'),
|
|
535
|
+
el('p', { class: 'measurement-figure' }, String(report.hero.probeCount)),
|
|
536
|
+
el('p', { class: 'h5' }, 'captured AI answers'),
|
|
537
|
+
el('ul', { class: 'facts' }, report.hero.facts.map((fact) => el('li', {}, fact)))))));
|
|
538
|
+
|
|
539
|
+
const plainHero = (info) => el('section', { class: 'hero' }, el('div', { class: 'container' },
|
|
540
|
+
el('div', { class: 'hero-grid' }, el('div', { class: 'hero-copy' },
|
|
541
|
+
el('p', { class: 'eyebrow' }, 'Literally.dev AEO'),
|
|
542
|
+
el('h1', { class: 'h1' }, 'AI visibility audit'),
|
|
543
|
+
el('p', { class: 'measured' }, info.originLabel)))));
|
|
544
|
+
|
|
184
545
|
const render = async () => {
|
|
185
546
|
const root = document.getElementById('app');
|
|
186
|
-
const [info,
|
|
187
|
-
get('__viewer'), get('__verification'), get('report/snapshot.json'),
|
|
188
|
-
get('captures/units.json'), get('inputs/config.json'),
|
|
189
|
-
]);
|
|
547
|
+
const [info, result, report] = await Promise.all([get('__viewer'), get('__verification'), get('__report')]);
|
|
190
548
|
root.replaceChildren();
|
|
191
|
-
if (!info) {
|
|
192
|
-
root.append(el('p', {}, 'This viewer link is not valid. Start it again with literally-aeo view.'));
|
|
549
|
+
if (!info || !report) {
|
|
550
|
+
root.append(el('p', { class: 'container' }, 'This viewer link is not valid. Start it again with literally-aeo view.'));
|
|
193
551
|
return;
|
|
194
552
|
}
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
root.append(
|
|
198
|
-
el('h1', {}, brand + ': AI visibility audit'),
|
|
199
|
-
el('p', { class: 'muted' }, info.originLabel + ' · ' + info.source),
|
|
200
|
-
);
|
|
553
|
+
const sheet = createSheet();
|
|
554
|
+
const shown = report.outcome === 'shown';
|
|
201
555
|
if (info.workingState) {
|
|
202
|
-
root.append(el('div', { class: 'banner
|
|
556
|
+
root.append(el('div', { class: 'banner' },
|
|
203
557
|
'Working state, not a finalized revision: this is not an integrity receipt. Export the run to finalize it.'));
|
|
204
558
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
check.outcome.replace('_', ' ')),
|
|
210
|
-
el('td', { class: 'muted' }, check.outcome === 'pass' ? '' : check.explanation),
|
|
211
|
-
));
|
|
212
|
-
root.append(el('h2', {}, 'Verification'),
|
|
213
|
-
el('p', { class: 'muted' }, 'Capture authenticity: self-reported. Checks run on this machine, offline.'),
|
|
214
|
-
el('div', { class: 'table-wrap' }, el('table', {}, el('tbody', {}, ...rows))));
|
|
215
|
-
}
|
|
216
|
-
if (!snapshot) {
|
|
217
|
-
root.append(el('div', { class: 'banner' }, 'This run has no report yet: the measurement did not finish.'));
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const answers = new Map();
|
|
221
|
-
for (const record of captures || []) {
|
|
222
|
-
answers.set(answerKey(record.sectionKey, record.promptId, record.surface, record.runIndex), record);
|
|
559
|
+
root.append(shown ? hero(report, info) : plainHero(info));
|
|
560
|
+
const bands = [];
|
|
561
|
+
if (shown && report.intro) {
|
|
562
|
+
bands.push([sectionHeader('AI search visibility', report.intro.heading, report.intro.lead, 'center')]);
|
|
223
563
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
// its ID. Like every string of a bundle, a label is inserted as text.
|
|
234
|
-
const labels = (snapshot.meta && snapshot.meta.surfaceLabels) || {};
|
|
235
|
-
const labelOf = (surface) =>
|
|
236
|
-
typeof labels[surface] === 'string' && labels[surface] ? labels[surface] : surface;
|
|
237
|
-
|
|
238
|
-
for (const section of snapshot.sections) {
|
|
239
|
-
const { summary, matrix, prompts } = section.visibility;
|
|
240
|
-
root.append(el('h2', {}, 'Section ' + section.key));
|
|
241
|
-
root.append(el('div', { class: 'grid' },
|
|
242
|
-
rateStat('Assistant share of voice', summary.prospectShareOfVoice,
|
|
243
|
-
summary.prospectShareOfVoiceEvidence, 'Mentioned'),
|
|
244
|
-
rateStat('Assistant citation rate', summary.prospectCitationRate,
|
|
245
|
-
summary.prospectCitationRateEvidence, 'Cited'),
|
|
246
|
-
rateStat('Coding-agent share of voice', summary.agentShareOfVoice,
|
|
247
|
-
summary.agentShareOfVoiceEvidence, 'Mentioned'),
|
|
248
|
-
rateStat('Coding-agent citation rate', summary.agentCitationRate,
|
|
249
|
-
summary.agentCitationRateEvidence, 'Cited'),
|
|
250
|
-
// The scraped consumer apps, only for a run that planned one.
|
|
251
|
-
...(summary.consumerShareOfVoice === undefined ? [] : [
|
|
252
|
-
rateStat('Consumer-app share of voice', summary.consumerShareOfVoice,
|
|
253
|
-
summary.consumerShareOfVoiceEvidence, 'Mentioned'),
|
|
254
|
-
rateStat('Consumer-app citation rate', summary.consumerCitationRate,
|
|
255
|
-
summary.consumerCitationRateEvidence, 'Cited'),
|
|
256
|
-
]),
|
|
257
|
-
el('div', { class: 'stat' }, el('b', {}, summary.topCompetitorDomain || 'none'), 'Most mentioned competitor'),
|
|
258
|
-
));
|
|
259
|
-
root.append(el('p', { class: 'muted' },
|
|
260
|
-
'Share of voice is how often the measured answers name the product, not market share.'));
|
|
261
|
-
root.append(...modelTable(summary.byModel, labelOf));
|
|
262
|
-
const drawer = el('div', { class: 'drawer', hidden: '' });
|
|
263
|
-
const body = el('tbody');
|
|
264
|
-
for (const row of matrix) {
|
|
265
|
-
const prompt = prompts[row.promptIdx] || { text: '' };
|
|
266
|
-
const promptId = (promptIds.get(section.key) || [])[row.promptIdx];
|
|
267
|
-
const record = answers.get(answerKey(section.key, promptId, row.surface, row.runIndex || 0));
|
|
268
|
-
const open = () => {
|
|
269
|
-
drawer.removeAttribute('hidden');
|
|
270
|
-
drawer.replaceChildren(
|
|
271
|
-
el('h3', {}, labelOf(row.surface) + ', run ' + (row.runIndex || 0)),
|
|
272
|
-
el('p', {}, prompt.text),
|
|
273
|
-
record ? el('pre', {}, record.probe.text)
|
|
274
|
-
: el('p', { class: 'limited' }, 'The answer is not in this bundle.'),
|
|
275
|
-
...(row.citedUrls && row.citedUrls.length
|
|
276
|
-
? [el('h3', {}, 'Cited sources'), ...row.citedUrls.map((url) => el('div', {}, sourceLink(url)))]
|
|
277
|
-
: []),
|
|
278
|
-
);
|
|
279
|
-
drawer.scrollIntoView({ block: 'nearest' });
|
|
280
|
-
};
|
|
281
|
-
body.append(el('tr', { class: 'row', tabindex: '0', onclick: open,
|
|
282
|
-
onkeydown: (event) => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); open(); } } },
|
|
283
|
-
el('td', {}, prompt.text),
|
|
284
|
-
el('td', {}, labelOf(row.surface)),
|
|
285
|
-
el('td', {}, String(row.runIndex || 0)),
|
|
286
|
-
el('td', {}, row.prospectMentioned ? 'mentioned' + (row.prospectPosition ? ' (' + row.prospectPosition + ')' : '') : 'not mentioned'),
|
|
287
|
-
el('td', {}, (row.qualifiedCompetitors || []).map((entry) => entry.name).join(', ')),
|
|
288
|
-
));
|
|
289
|
-
}
|
|
290
|
-
root.append(el('div', { class: 'table-wrap' }, el('table', {},
|
|
291
|
-
el('thead', {}, el('tr', {}, el('th', {}, 'Question'), el('th', {}, 'Surface'),
|
|
292
|
-
el('th', {}, 'Run'), el('th', {}, 'Product'), el('th', {}, 'Alternatives named'))),
|
|
293
|
-
body)), drawer);
|
|
564
|
+
if (result || !shown) {
|
|
565
|
+
// A working state is not verified: no claim that it was.
|
|
566
|
+
bands.push([sectionHeader('Evidence', 'Verification', result
|
|
567
|
+
? 'The bundle re-checked on this machine: its hashes, its event chain and every metric recomputed from its own judgments. A check that cannot run says so.'
|
|
568
|
+
: undefined),
|
|
569
|
+
result ? verification(result) : null,
|
|
570
|
+
shown ? null : el('p', { class: 'card empty' }, report.outcome === 'missing'
|
|
571
|
+
? 'This run has no report yet: the measurement did not finish.'
|
|
572
|
+
: 'The report cannot be shown: ' + report.reason)]);
|
|
294
573
|
}
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
574
|
+
for (const section of shown ? report.sections : []) {
|
|
575
|
+
bands.push([
|
|
576
|
+
sectionHeader('AI search visibility', section.title),
|
|
577
|
+
scorecards(section.scorecards),
|
|
578
|
+
surfaceRates(section.surfaceRates),
|
|
579
|
+
matrix(section, report.brand.name, sheet),
|
|
580
|
+
alternatives(section.alternatives),
|
|
581
|
+
citedDomains(section.citedDomains, sheet),
|
|
582
|
+
sourceMix(section.sourceMix),
|
|
583
|
+
perception(section.perception, report.brand.name),
|
|
584
|
+
]);
|
|
302
585
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
586
|
+
bands.push([el('div', { class: 'footer' },
|
|
587
|
+
shown ? el('p', {}, report.footer.baseline) : null,
|
|
588
|
+
shown && report.footer.methodology.length ? el('section', { 'aria-labelledby': 'methodology' },
|
|
589
|
+
el('h2', { id: 'methodology' }, 'Methodology'),
|
|
590
|
+
el('ul', { class: 'methodology' }, report.footer.methodology.map((sentence) => el('li', {}, sentence)))) : null,
|
|
591
|
+
...(shown ? report.footer.notes : []).map((note) => el('p', {}, note)),
|
|
592
|
+
el('p', { class: 'footer-note' },
|
|
593
|
+
'Generated with Literally.dev AEO ' + info.toolVersion + ', an open-source AI visibility audit tool. '
|
|
594
|
+
+ info.originLabel + '. Literally.dev did not review this result. Bundle: ' + info.source + '.'))]);
|
|
595
|
+
bands.forEach((content, index) => root.append(band(index % 2 === 1 ? 'soft' : 'plain', ...content)));
|
|
596
|
+
root.append(...sheet.nodes);
|
|
306
597
|
};
|
|
307
598
|
|
|
308
599
|
render().catch((error) => {
|
|
@@ -310,8 +601,30 @@ render().catch((error) => {
|
|
|
310
601
|
});
|
|
311
602
|
`;
|
|
312
603
|
|
|
313
|
-
/**
|
|
314
|
-
|
|
604
|
+
/** The hosted report's two typefaces, shipped unmodified under the SIL Open
|
|
605
|
+
* Font License (src/viewer/fonts) and served by the viewer itself. */
|
|
606
|
+
export const viewerFontFiles = {
|
|
607
|
+
body: 'Mulish-VariableFont_wght.ttf',
|
|
608
|
+
mono: 'SourceCodePro-VariableFont_wght.ttf',
|
|
609
|
+
} as const;
|
|
610
|
+
|
|
611
|
+
const fontFaces = (token: string): string => {
|
|
612
|
+
const source = (file: string) =>
|
|
613
|
+
`url("/fonts/${file}?t=${encodeURIComponent(token)}") format("truetype")`;
|
|
614
|
+
|
|
615
|
+
return `
|
|
616
|
+
@font-face { font-family: Mulish; font-weight: 200 1000; font-display: swap;
|
|
617
|
+
src: ${source(viewerFontFiles.body)}; }
|
|
618
|
+
@font-face { font-family: "Source Code Pro"; font-weight: 200 900; font-display: swap;
|
|
619
|
+
src: ${source(viewerFontFiles.mono)}; }
|
|
620
|
+
`;
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
/** viewerPage is the document served at /, bound to one launch's nonce. The
|
|
624
|
+
* launch token, when the viewer serves fonts, is what their URLs carry. */
|
|
625
|
+
export const viewerPage = (nonce: string, fontToken?: string): string => {
|
|
626
|
+
const faces = fontToken === undefined ? '' : fontFaces(fontToken);
|
|
627
|
+
|
|
315
628
|
return `<!doctype html>
|
|
316
629
|
<html lang="en">
|
|
317
630
|
<head>
|
|
@@ -319,10 +632,10 @@ export const viewerPage = (nonce: string): string => {
|
|
|
319
632
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
320
633
|
<meta name="referrer" content="no-referrer">
|
|
321
634
|
<title>Literally.dev AEO</title>
|
|
322
|
-
<style nonce="${nonce}">${styles}</style>
|
|
635
|
+
<style nonce="${nonce}">${faces}${styles}</style>
|
|
323
636
|
</head>
|
|
324
637
|
<body>
|
|
325
|
-
<main id="app"><p class="
|
|
638
|
+
<main id="app"><p class="container">Loading the audit…</p></main>
|
|
326
639
|
<script nonce="${nonce}">${script}</script>
|
|
327
640
|
</body>
|
|
328
641
|
</html>`;
|