archsutra-ai 0.1.4 → 0.2.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/CHANGELOG.md +56 -6
- package/README.md +84 -12
- package/dist/audit.js +125 -44
- package/dist/cli.js +184 -96
- package/dist/drift.js +29 -15
- package/dist/fsutil.js +117 -20
- package/dist/history.js +40 -0
- package/dist/html.js +10 -8
- package/dist/map.js +26 -5
- package/dist/mcp.js +70 -55
- package/dist/redact.js +24 -11
- package/dist/report.js +69 -19
- package/dist/rules-extra.js +59 -0
- package/dist/secret-patterns.js +69 -0
- package/dist/suppress.js +31 -19
- package/dist/verify.js +2 -2
- package/dist/write.js +71 -0
- package/docs/architecture/overview.html +29 -12
- package/docs/architecture/overview.md +2 -2
- package/docs/architecture/threat-model.html +28 -11
- package/docs/assets/charts/coverage-dark.svg +11 -0
- package/docs/assets/charts/coverage.svg +11 -0
- package/docs/assets/charts/finding-anatomy-dark.svg +20 -0
- package/docs/assets/charts/finding-anatomy.svg +20 -0
- package/docs/assets/charts/pipeline-dark.svg +13 -0
- package/docs/assets/charts/pipeline.svg +13 -0
- package/docs/assets/charts/precision-by-batch-dark.svg +12 -0
- package/docs/assets/charts/precision-by-batch.svg +12 -0
- package/docs/assets/charts/precision-by-rule-dark.svg +12 -0
- package/docs/assets/charts/precision-by-rule.svg +12 -0
- package/docs/assets/charts/sample-findings-by-severity-dark.svg +11 -0
- package/docs/assets/charts/sample-findings-by-severity.svg +11 -0
- package/docs/assets/charts/scan-time-dark.svg +11 -0
- package/docs/assets/charts/scan-time.svg +11 -0
- package/docs/assets/site.css +259 -138
- package/docs/assets/site.js +92 -6
- package/docs/community/good-first-issues.html +28 -11
- package/docs/compatibility/matrix.html +28 -11
- package/docs/compatibility/smoke-tests/index.html +28 -11
- package/docs/decisions/ADR-0001-deterministic-cli-plus-ide-skills.html +28 -11
- package/docs/guides/cheat-sheet.html +100 -0
- package/docs/guides/cheat-sheet.md +146 -0
- package/docs/guides/ci-recipes.html +170 -0
- package/docs/guides/ci-recipes.md +176 -0
- package/docs/guides/evidence-at-a-glance.html +93 -0
- package/docs/guides/evidence-at-a-glance.md +65 -0
- package/docs/guides/getting-started.html +151 -0
- package/docs/guides/getting-started.md +160 -0
- package/docs/guides/how-it-works.html +161 -0
- package/docs/guides/how-it-works.md +148 -0
- package/docs/guides/mcp-server.html +99 -0
- package/docs/guides/mcp-server.md +81 -0
- package/docs/guides/reading-a-report.html +119 -0
- package/docs/guides/reading-a-report.md +111 -0
- package/docs/guides/real-world-scenarios.html +287 -0
- package/docs/guides/real-world-scenarios.md +377 -0
- package/docs/handbook/01-executive-summary.html +30 -13
- package/docs/handbook/01-executive-summary.md +2 -2
- package/docs/handbook/02-functional-specification.html +30 -13
- package/docs/handbook/02-functional-specification.md +3 -3
- package/docs/handbook/03-technical-specification.html +31 -14
- package/docs/handbook/03-technical-specification.md +3 -3
- package/docs/handbook/04-architecture.html +29 -12
- package/docs/handbook/04-architecture.md +1 -1
- package/docs/handbook/05-user-guide.html +33 -15
- package/docs/handbook/05-user-guide.md +5 -4
- package/docs/handbook/06-cli-reference.html +52 -16
- package/docs/handbook/06-cli-reference.md +47 -4
- package/docs/handbook/07-security-privacy-legal.html +31 -12
- package/docs/handbook/07-security-privacy-legal.md +4 -0
- package/docs/handbook/08-testing-and-proof.html +32 -15
- package/docs/handbook/08-testing-and-proof.md +4 -4
- package/docs/handbook/09-compatibility-and-roadmap.html +29 -12
- package/docs/handbook/09-compatibility-and-roadmap.md +3 -2
- package/docs/handbook/10-contributor-guide.html +29 -12
- package/docs/handbook/10-contributor-guide.md +1 -1
- package/docs/handbook/11-glossary-and-faq.html +34 -13
- package/docs/handbook/11-glossary-and-faq.md +7 -1
- package/docs/handbook/12-rule-catalog.html +59 -19
- package/docs/handbook/12-rule-catalog.md +62 -5
- package/docs/handbook/13-trust-and-assurance.html +29 -12
- package/docs/handbook/13-trust-and-assurance.md +1 -1
- package/docs/handbook/14-real-world-evaluation.html +28 -11
- package/docs/handbook/15-supply-chain-and-release.html +28 -11
- package/docs/handbook/16-performance-and-quality-metrics.html +28 -11
- package/docs/handbook/16-performance-and-quality-metrics.md +1 -1
- package/docs/handbook/README.md +4 -2
- package/docs/handbook/index.html +31 -13
- package/docs/index.html +101 -51
- package/docs/legal/legal-review-brief.html +28 -11
- package/docs/legal/trademark-and-name-clearance.html +28 -11
- package/docs/proof/accessibility.html +28 -11
- package/docs/proof/benchmarks.json +9 -9
- package/docs/proof/benchmarks.md +4 -4
- package/docs/proof/test-results.txt +56 -40
- package/docs/rfc/0001-archsutra-v0.1.html +28 -11
- package/docs/sample-report/architecture-register.json +46 -0
- package/docs/sample-report/audit-report.html +123 -0
- package/docs/sample-report/audit-report.md +314 -0
- package/docs/sample-report/current-state.html +77 -0
- package/docs/sample-report/current-state.md +51 -0
- package/docs/sample-report/findings.json +478 -0
- package/docs/sample-report/findings.sarif +754 -0
- package/docs/sample-report/index.html +57 -0
- package/docs/sample-report/overview.md +11 -0
- package/docs/search-index.json +1 -0
- package/docs/sitemap.xml +39 -28
- package/llms.txt +11 -2
- package/package.json +3 -2
- package/schemas/findings.schema.json +4 -3
- package/skills/architecture-audit/SKILL.md +2 -2
- package/skills/architecture-audit/references/report-template.md +1 -1
- package/skills/architecture-verification/references/fitness-functions.md +1 -1
package/docs/assets/site.css
CHANGED
|
@@ -1,181 +1,302 @@
|
|
|
1
|
-
/* ArchSutra AI documentation site. Hand-written, no framework. */
|
|
1
|
+
/* ArchSutra AI documentation site. Hand-written, no framework. Light by default; dark only when chosen. */
|
|
2
2
|
:root {
|
|
3
|
-
--bg: #
|
|
3
|
+
--bg: #ffffff;
|
|
4
|
+
--bg-soft: #f6f7fb;
|
|
4
5
|
--surface: #ffffff;
|
|
5
|
-
--surface-2: #
|
|
6
|
-
--text: #
|
|
7
|
-
--muted: #
|
|
8
|
-
--
|
|
9
|
-
--
|
|
6
|
+
--surface-2: #f1f3f9;
|
|
7
|
+
--text: #0f172a;
|
|
8
|
+
--muted: #475569;
|
|
9
|
+
--subtle: #64748b;
|
|
10
|
+
--line: #e2e8f0;
|
|
11
|
+
--line-strong: #cbd5e1;
|
|
12
|
+
--accent: #4f46e5;
|
|
13
|
+
--accent-hover: #4338ca;
|
|
10
14
|
--accent-ink: #ffffff;
|
|
11
|
-
--accent-soft: #
|
|
12
|
-
--ok: #
|
|
13
|
-
--warn: #
|
|
14
|
-
--
|
|
15
|
-
--
|
|
16
|
-
--
|
|
15
|
+
--accent-soft: #eef2ff;
|
|
16
|
+
--ok: #15803d;
|
|
17
|
+
--warn: #b45309;
|
|
18
|
+
--danger: #b91c1c;
|
|
19
|
+
--code-bg: #f1f5f9;
|
|
20
|
+
--shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
|
|
21
|
+
--shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .07);
|
|
22
|
+
--shadow-lg: 0 2px 4px rgba(15, 23, 42, .05), 0 24px 60px rgba(15, 23, 42, .12);
|
|
23
|
+
--radius: 14px;
|
|
24
|
+
--radius-sm: 8px;
|
|
25
|
+
--header-h: 64px;
|
|
17
26
|
--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
18
27
|
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
|
|
19
28
|
color-scheme: light;
|
|
20
29
|
}
|
|
21
|
-
@media (prefers-color-scheme: dark) {
|
|
22
|
-
:root:not([data-theme="light"]) {
|
|
23
|
-
--bg: #0c0f14; --surface: #131820; --surface-2: #1a202a; --text: #e8ebf2; --muted: #a2abbb; --line: #262e3b;
|
|
24
|
-
--accent: #a5a8ff; --accent-ink: #0c0f14; --accent-soft: #1f2340; --ok: #5fd39a; --warn: #f0c36a; --code-bg: #10151d;
|
|
25
|
-
--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
30
|
:root[data-theme="dark"] {
|
|
29
|
-
--bg: #
|
|
30
|
-
--
|
|
31
|
-
--
|
|
31
|
+
--bg: #0b1020;
|
|
32
|
+
--bg-soft: #0f1630;
|
|
33
|
+
--surface: #121a33;
|
|
34
|
+
--surface-2: #18223f;
|
|
35
|
+
--text: #e6eaf5;
|
|
36
|
+
--muted: #aab4cc;
|
|
37
|
+
--subtle: #8b97b4;
|
|
38
|
+
--line: #243050;
|
|
39
|
+
--line-strong: #34436b;
|
|
40
|
+
--accent: #a5b4fc;
|
|
41
|
+
--accent-hover: #c7d2fe;
|
|
42
|
+
--accent-ink: #0b1020;
|
|
43
|
+
--accent-soft: #1b2347;
|
|
44
|
+
--ok: #5fd39a;
|
|
45
|
+
--warn: #f0c36a;
|
|
46
|
+
--danger: #ff9b92;
|
|
47
|
+
--code-bg: #0e1530;
|
|
48
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
|
|
49
|
+
--shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
|
|
50
|
+
--shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 60px rgba(0, 0, 0, .5);
|
|
51
|
+
color-scheme: dark;
|
|
32
52
|
}
|
|
33
53
|
|
|
34
54
|
*, *::before, *::after { box-sizing: border-box; }
|
|
35
|
-
html { scroll-behavior: smooth; scroll-padding-top:
|
|
36
|
-
body { margin: 0; background: var(--bg); color: var(--text); font:
|
|
37
|
-
a { color: var(--accent); text-underline-offset: 3px; }
|
|
38
|
-
a:hover { text-decoration-thickness: 2px; }
|
|
39
|
-
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius:
|
|
40
|
-
code, pre { font-family: var(--mono); font-size: .
|
|
41
|
-
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); padding: .
|
|
55
|
+
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
|
|
56
|
+
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.7 var(--font); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
|
|
57
|
+
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
|
|
58
|
+
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
|
|
59
|
+
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
|
|
60
|
+
code, pre { font-family: var(--mono); font-size: .88em; }
|
|
61
|
+
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); padding: .12em .4em; border-radius: 6px; overflow-wrap: anywhere; }
|
|
42
62
|
img, svg { max-width: 100%; }
|
|
43
|
-
|
|
44
|
-
.
|
|
63
|
+
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; }
|
|
64
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
65
|
+
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 200; }
|
|
45
66
|
.skip:focus { left: 8px; }
|
|
67
|
+
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
|
|
46
68
|
|
|
47
|
-
/*
|
|
48
|
-
.topbar { position: sticky; top: 0; z-index:
|
|
49
|
-
.topbar-inner { display: flex; align-items: center; gap:
|
|
50
|
-
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight:
|
|
51
|
-
.brand svg { color: var(--accent); }
|
|
69
|
+
/* ---------- Header ---------- */
|
|
70
|
+
.topbar { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
|
|
71
|
+
.topbar-inner { display: flex; align-items: center; gap: 14px; max-width: 1240px; height: var(--header-h); margin: 0 auto; padding: 0 20px; }
|
|
72
|
+
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; color: var(--text); text-decoration: none; }
|
|
73
|
+
.brand svg { width: 30px; height: 30px; color: var(--accent); }
|
|
52
74
|
.brand b { color: var(--accent); }
|
|
53
|
-
.top-links { display: flex; gap:
|
|
54
|
-
.top-links a { color: var(--
|
|
55
|
-
.top-links a:hover { background: var(--surface-2); }
|
|
56
|
-
.
|
|
57
|
-
.
|
|
75
|
+
.top-links { display: flex; gap: 2px; margin-left: 18px; }
|
|
76
|
+
.top-links a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 500; }
|
|
77
|
+
.top-links a:hover { background: var(--surface-2); color: var(--text); }
|
|
78
|
+
.top-links a[aria-current="true"] { color: var(--accent); }
|
|
79
|
+
.spacer { flex: 1; }
|
|
80
|
+
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
|
|
81
|
+
.icon-btn:hover { background: var(--surface-2); }
|
|
58
82
|
.theme-btn .moon { display: none; }
|
|
59
83
|
:root[data-theme="dark"] .theme-btn .sun { display: none; }
|
|
60
|
-
:root[data-theme="dark"] .theme-btn .moon { display:
|
|
61
|
-
@media (prefers-color-scheme: dark) {
|
|
62
|
-
:root:not([data-theme="light"]) .theme-btn .sun { display: none; }
|
|
63
|
-
:root:not([data-theme="light"]) .theme-btn .moon { display: inline; }
|
|
64
|
-
}
|
|
84
|
+
:root[data-theme="dark"] .theme-btn .moon { display: block; }
|
|
65
85
|
.menu-btn { display: none; }
|
|
86
|
+
.gh-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 600; }
|
|
87
|
+
.gh-btn:hover { background: var(--surface-2); color: var(--text); }
|
|
88
|
+
|
|
89
|
+
.search { position: relative; }
|
|
90
|
+
.search input { font: inherit; font-size: .92rem; width: 210px; height: 40px; padding: 0 14px 0 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% no-repeat; color: var(--text); }
|
|
91
|
+
.search input:focus { width: 280px; border-color: var(--accent); }
|
|
92
|
+
.search input::placeholder { color: var(--subtle); }
|
|
93
|
+
.results { position: absolute; right: 0; top: 48px; width: min(440px, 92vw); max-height: 70vh; overflow: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 120; }
|
|
94
|
+
.results li a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
|
|
95
|
+
.results li a:hover, .results li a:focus { background: var(--accent-soft); }
|
|
96
|
+
.results .rt { font-weight: 650; }
|
|
97
|
+
.results .rs { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; }
|
|
98
|
+
.results .none { padding: 12px; color: var(--muted); font-size: .92rem; }
|
|
66
99
|
|
|
67
|
-
/*
|
|
68
|
-
.
|
|
69
|
-
.
|
|
70
|
-
.
|
|
100
|
+
/* ---------- Drawer (mobile navigation) ---------- */
|
|
101
|
+
.drawer { position: fixed; inset: 0; z-index: 150; display: none; }
|
|
102
|
+
.drawer.open { display: block; }
|
|
103
|
+
.drawer-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); }
|
|
104
|
+
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); background: var(--bg); box-shadow: var(--shadow-lg); overflow-y: auto; padding: 16px 18px 28px; }
|
|
105
|
+
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
|
|
106
|
+
.drawer .primary-links a { display: block; padding: 12px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
|
|
107
|
+
.drawer .primary-links a:hover { background: var(--surface-2); }
|
|
108
|
+
.drawer .nav-title { margin-top: 20px; }
|
|
109
|
+
|
|
110
|
+
/* ---------- Docs layout ---------- */
|
|
111
|
+
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 230px; gap: 44px; max-width: 1240px; margin: 0 auto; padding: 34px 20px 80px; }
|
|
112
|
+
.sidebar, .rail { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; font-size: .92rem; scrollbar-width: thin; }
|
|
113
|
+
.nav-title { text-transform: uppercase; letter-spacing: .09em; font-size: .72rem; font-weight: 700; color: var(--subtle); margin: 22px 0 8px 10px; }
|
|
71
114
|
.nav-group:first-child .nav-title { margin-top: 0; }
|
|
72
|
-
.sidebar ul, .rail ul { list-style: none; margin: 0; padding: 0; }
|
|
73
|
-
.sidebar a { display: block; padding:
|
|
74
|
-
.sidebar a:hover { background: var(--surface-2); }
|
|
75
|
-
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight:
|
|
76
|
-
.rail a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--line); }
|
|
115
|
+
.sidebar ul, .rail ul, .drawer ul { list-style: none; margin: 0; padding: 0; }
|
|
116
|
+
.sidebar a, .drawer .nav-group a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1.35; }
|
|
117
|
+
.sidebar a:hover, .drawer .nav-group a:hover { background: var(--surface-2); color: var(--text); }
|
|
118
|
+
.sidebar a[aria-current="page"], .drawer .nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
|
|
119
|
+
.rail a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--line); line-height: 1.4; }
|
|
77
120
|
.rail a:hover, .rail a.active { color: var(--accent); border-left-color: var(--accent); }
|
|
78
121
|
.rail .l3 a { padding-left: 22px; font-size: .86rem; }
|
|
79
|
-
|
|
80
122
|
.content { min-width: 0; }
|
|
81
|
-
.prose { max-width:
|
|
82
|
-
.prose h1 { font-size: clamp(
|
|
83
|
-
.prose h2 { font-size: 1.
|
|
84
|
-
.prose h3 { font-size: 1.
|
|
85
|
-
.prose h4 { font-size:
|
|
86
|
-
.prose h2 .anchor, .prose h3 .anchor { margin-left: .4em; opacity: 0; text-decoration: none; color: var(--
|
|
123
|
+
.prose { max-width: 780px; }
|
|
124
|
+
.prose h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.03em; margin: .15em 0 .3em; line-height: 1.1; }
|
|
125
|
+
.prose h2 { font-size: 1.65rem; margin: 2.3em 0 .6em; padding-top: 1.2em; border-top: 1px solid var(--line); }
|
|
126
|
+
.prose h3 { font-size: 1.2rem; margin: 1.8em 0 .5em; }
|
|
127
|
+
.prose h4 { font-size: 1.02rem; margin: 1.4em 0 .4em; }
|
|
128
|
+
.prose h2 .anchor, .prose h3 .anchor { margin-left: .4em; opacity: 0; text-decoration: none; color: var(--subtle); font-weight: 400; }
|
|
87
129
|
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
|
|
88
|
-
.crumbs { color: var(--
|
|
89
|
-
.crumbs a { color: var(--
|
|
90
|
-
.
|
|
91
|
-
.
|
|
130
|
+
.crumbs { color: var(--subtle); font-size: .86rem; margin: 0; }
|
|
131
|
+
.crumbs a { color: var(--subtle); text-decoration: none; }
|
|
132
|
+
.crumbs a:hover { color: var(--accent); }
|
|
133
|
+
.lede { font-size: 1.2rem; color: var(--muted); margin: 0 0 .7em; line-height: 1.6; }
|
|
134
|
+
.meta { color: var(--subtle); font-size: .84rem; margin: 0 0 2em; }
|
|
92
135
|
.prose p, .prose li { overflow-wrap: break-word; }
|
|
93
136
|
.prose ul, .prose ol { padding-left: 1.4em; }
|
|
94
|
-
.prose li { margin: .
|
|
95
|
-
.prose li
|
|
96
|
-
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.
|
|
97
|
-
blockquote { margin: 1.
|
|
137
|
+
.prose li { margin: .35em 0; }
|
|
138
|
+
.prose li::marker { color: var(--subtle); }
|
|
139
|
+
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.6em 0; }
|
|
140
|
+
blockquote { margin: 1.5em 0; padding: 14px 18px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: var(--radius); }
|
|
98
141
|
blockquote p { margin: 0; }
|
|
142
|
+
blockquote.callout { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
|
|
143
|
+
blockquote.callout > strong:first-child { display: inline-block; margin-right: .55em; padding: 1px 10px; border-radius: 999px; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); }
|
|
144
|
+
blockquote.callout-real-output > strong:first-child { background: var(--ok); }
|
|
145
|
+
blockquote.callout-illustrative > strong:first-child { background: var(--warn); }
|
|
146
|
+
blockquote.callout-warning { background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
|
|
147
|
+
blockquote.callout-warning > strong:first-child { background: var(--warn); }
|
|
148
|
+
blockquote.callout-note > strong:first-child { background: var(--subtle); }
|
|
149
|
+
:root[data-theme="dark"] blockquote.callout > strong:first-child { color: #0b1020; }
|
|
99
150
|
|
|
100
|
-
/* Tables */
|
|
101
|
-
.table-wrap { overflow-x: auto; margin: 1.
|
|
102
|
-
table { border-collapse: collapse; width: 100%; font-size: .
|
|
103
|
-
th, td { text-align: left; vertical-align: top; padding:
|
|
104
|
-
th { background: var(--surface-2); font-weight: 650; white-space: nowrap;
|
|
151
|
+
/* ---------- Tables, code, figures ---------- */
|
|
152
|
+
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch; }
|
|
153
|
+
table { border-collapse: collapse; width: 100%; font-size: .92rem; line-height: 1.55; }
|
|
154
|
+
th, td { text-align: left; vertical-align: top; padding: 11px 15px; border-bottom: 1px solid var(--line); }
|
|
155
|
+
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; font-size: .85rem; color: var(--muted); }
|
|
105
156
|
tbody tr:last-child td { border-bottom: 0; }
|
|
106
|
-
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
.code {
|
|
110
|
-
|
|
111
|
-
.
|
|
112
|
-
|
|
113
|
-
.
|
|
114
|
-
figure.diagram {
|
|
115
|
-
figure.diagram figcaption { color: var(--muted); font-size: .8rem; margin-top: 8px; }
|
|
157
|
+
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
|
|
158
|
+
.code { position: relative; margin: 1.4em 0; }
|
|
159
|
+
pre { margin: 0; overflow: auto; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; line-height: 1.6; tab-size: 2; -webkit-overflow-scrolling: touch; }
|
|
160
|
+
.code pre { padding-right: 78px; }
|
|
161
|
+
.copy { position: absolute; top: 9px; right: 9px; font: inherit; font-size: .76rem; font-weight: 600; padding: 4px 11px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
|
|
162
|
+
.copy:hover { background: var(--surface-2); color: var(--text); }
|
|
163
|
+
figure { margin: 0; }
|
|
164
|
+
figure.diagram { margin: 1.6em 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; }
|
|
165
|
+
figure.diagram figcaption { color: var(--subtle); font-size: .78rem; margin-top: 8px; text-align: center; }
|
|
116
166
|
pre.mermaid { background: transparent; border: 0; padding: 0; text-align: center; white-space: pre; }
|
|
117
167
|
pre.mermaid[data-processed="true"] ~ figcaption { display: none; }
|
|
168
|
+
.figure { margin: 1.8em 0; text-align: center; }
|
|
169
|
+
.figure img { max-width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
|
|
170
|
+
.figure figcaption { color: var(--subtle); font-size: .84rem; margin-top: 10px; }
|
|
171
|
+
.prose p > img { max-width: 100%; height: auto; }
|
|
172
|
+
.theme-dark { display: none; }
|
|
173
|
+
:root[data-theme="dark"] .theme-light { display: none; }
|
|
174
|
+
:root[data-theme="dark"] .theme-dark { display: inline-block; }
|
|
118
175
|
|
|
119
|
-
|
|
120
|
-
.
|
|
121
|
-
.
|
|
122
|
-
.
|
|
123
|
-
.
|
|
176
|
+
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 3.5em 0 0; padding-top: 1.6em; border-top: 1px solid var(--line); }
|
|
177
|
+
.pn a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); box-shadow: var(--shadow-sm); }
|
|
178
|
+
.pn a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
|
|
179
|
+
.pn small { display: block; color: var(--subtle); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
|
|
180
|
+
.pn span { color: var(--text); font-weight: 650; }
|
|
181
|
+
.pn .next { text-align: right; grid-column: 2; }
|
|
182
|
+
.edit { margin-top: 1.2em; font-size: .88rem; color: var(--subtle); }
|
|
124
183
|
|
|
125
|
-
/*
|
|
126
|
-
.
|
|
127
|
-
.
|
|
128
|
-
.
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.
|
|
133
|
-
.
|
|
134
|
-
.
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.
|
|
139
|
-
.
|
|
140
|
-
.
|
|
141
|
-
.
|
|
142
|
-
.
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
184
|
+
/* ---------- Footer ---------- */
|
|
185
|
+
.footer { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: 0; }
|
|
186
|
+
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 44px 20px 36px; }
|
|
187
|
+
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
|
|
188
|
+
.footer h4 { margin: 0 0 12px; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--subtle); }
|
|
189
|
+
.footer ul { list-style: none; margin: 0; padding: 0; }
|
|
190
|
+
.footer li { margin: 7px 0; }
|
|
191
|
+
.footer a { color: var(--muted); text-decoration: none; font-size: .94rem; }
|
|
192
|
+
.footer a:hover { color: var(--accent); text-decoration: underline; }
|
|
193
|
+
.footer .about { color: var(--muted); font-size: .94rem; max-width: 36ch; }
|
|
194
|
+
.footer .fine { color: var(--subtle); font-size: .8rem; max-width: 100ch; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
|
|
195
|
+
|
|
196
|
+
/* ---------- Landing ---------- */
|
|
197
|
+
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
|
|
198
|
+
.landing section { padding: 72px 0; }
|
|
199
|
+
.landing h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -.03em; margin: 0 0 12px; }
|
|
200
|
+
.landing .eyebrow-s { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
|
|
201
|
+
.section-lede { color: var(--muted); max-width: 66ch; margin: 0 0 28px; font-size: 1.08rem; }
|
|
202
|
+
.hero { padding: 78px 0 56px !important; position: relative; background:
|
|
203
|
+
radial-gradient(900px 420px at 8% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
|
|
204
|
+
radial-gradient(700px 380px at 96% 0%, color-mix(in srgb, #14b8a6 14%, transparent), transparent 70%); }
|
|
205
|
+
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; }
|
|
206
|
+
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--muted); background: var(--surface); box-shadow: var(--shadow-sm); }
|
|
207
|
+
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
|
|
208
|
+
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); line-height: 1.05; letter-spacing: -.04em; margin: 0 0 20px; }
|
|
209
|
+
.hero h1 em { font-style: normal; color: var(--accent); }
|
|
210
|
+
.hero-lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 56ch; margin: 0 0 28px; line-height: 1.6; }
|
|
211
|
+
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 22px; }
|
|
212
|
+
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 650; font-size: .98rem; box-shadow: var(--shadow-sm); }
|
|
213
|
+
.btn:hover { background: var(--surface-2); color: var(--text); }
|
|
214
|
+
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
|
|
215
|
+
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
|
|
216
|
+
.btn.ghost { background: transparent; box-shadow: none; }
|
|
217
|
+
.hero-note { color: var(--subtle); font-size: .88rem; margin: 0; }
|
|
218
|
+
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
|
|
219
|
+
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; color: var(--muted); }
|
|
220
|
+
|
|
221
|
+
.terminal { background: #0b1220; color: #dbe4f3; border: 1px solid #1f2a44; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
|
|
222
|
+
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: #121a2e; border-bottom: 1px solid #1f2a44; }
|
|
223
|
+
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #334263; }
|
|
224
|
+
.term-bar span:nth-child(1) { background: #ff6b6b; } .term-bar span:nth-child(2) { background: #ffd166; } .term-bar span:nth-child(3) { background: #5fd39a; }
|
|
225
|
+
.term-bar b { margin-left: 10px; font-size: .78rem; font-weight: 500; color: #8fa0c0; font-family: var(--mono); }
|
|
226
|
+
.terminal pre { background: transparent; border: 0; border-radius: 0; color: inherit; font-size: .8rem; line-height: 1.6; margin: 0; padding: 18px 20px; overflow-x: auto; }
|
|
227
|
+
.terminal .p { color: #7dd3fc; } .terminal .m { color: #8fa0c0; } .terminal .ok { color: #5fd39a; } .terminal .bad { color: #ff9b92; font-weight: 700; }
|
|
228
|
+
.terminal .sev { font-weight: 700; padding: 0 6px; border-radius: 4px; }
|
|
229
|
+
.terminal .sev.high { background: #4a1d1d; color: #ffb4a9; }
|
|
230
|
+
.terminal .sev.med { background: #46340c; color: #f6d27a; }
|
|
231
|
+
|
|
232
|
+
.stats ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
|
|
233
|
+
.landing section.stats { padding: 0 0 8px; margin-top: -8px; }
|
|
234
|
+
.stats li { padding: 22px 12px; text-align: center; border-right: 1px solid var(--line); }
|
|
146
235
|
.stats li:last-child { border-right: 0; }
|
|
147
|
-
.stats .num { display: block; font-size:
|
|
148
|
-
.stats .lbl { display: block; color: var(--muted); font-size: .82rem; }
|
|
149
|
-
.band { background: var(--
|
|
150
|
-
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(
|
|
151
|
-
.cards.two { grid-template-columns: repeat(auto-fit, minmax(
|
|
152
|
-
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding:
|
|
153
|
-
.card h3 { margin: 0 0 8px; font-size: 1.
|
|
154
|
-
.card p { margin: 0; color: var(--muted); font-size: .
|
|
236
|
+
.stats .num { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -.04em; color: var(--accent); line-height: 1.1; }
|
|
237
|
+
.stats .lbl { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; line-height: 1.3; }
|
|
238
|
+
.band { background: var(--bg-soft); border-block: 1px solid var(--line); }
|
|
239
|
+
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
|
|
240
|
+
.cards.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
|
|
241
|
+
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); position: relative; }
|
|
242
|
+
.card h3 { margin: 0 0 8px; font-size: 1.1rem; letter-spacing: -.01em; }
|
|
243
|
+
.card p { margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.6; }
|
|
155
244
|
.card > a { display: inline-block; margin-top: 12px; font-weight: 600; }
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
.
|
|
159
|
-
.
|
|
160
|
-
.
|
|
161
|
-
.
|
|
162
|
-
.
|
|
245
|
+
.card .ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
|
|
246
|
+
.card .num-b { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .85rem; margin-bottom: 12px; }
|
|
247
|
+
a.card.link { text-decoration: none; color: inherit; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
|
|
248
|
+
a.card.link:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
|
|
249
|
+
a.card.link h3::after { content: " \2192"; color: var(--accent); }
|
|
250
|
+
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 22px; }
|
|
251
|
+
.steps article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
|
|
252
|
+
.steps h3 { margin: 10px 0 6px; }
|
|
253
|
+
.steps p { margin: 0; color: var(--muted); font-size: .96rem; }
|
|
254
|
+
.stepno { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
|
|
255
|
+
.honest { margin-top: 24px; padding: 16px 20px; border: 1px dashed var(--warn); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
|
|
256
|
+
.muted { color: var(--muted); font-size: .94rem; }
|
|
257
|
+
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 20px; margin: 10px 0; box-shadow: var(--shadow-sm); }
|
|
258
|
+
.faq summary { cursor: pointer; font-weight: 650; padding: 15px 0; list-style-position: outside; }
|
|
259
|
+
.faq details[open] summary { color: var(--accent); }
|
|
260
|
+
.faq details p { margin: 0 0 16px; color: var(--muted); }
|
|
261
|
+
.cta-band { text-align: center; }
|
|
262
|
+
.cta-band .cta { justify-content: center; }
|
|
263
|
+
.cta-band .section-lede { margin-inline: auto; }
|
|
163
264
|
|
|
164
|
-
/* Responsive */
|
|
165
|
-
@media (max-width: 1100px) { .layout { grid-template-columns:
|
|
166
|
-
@media (max-width:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.
|
|
170
|
-
.
|
|
171
|
-
.
|
|
172
|
-
.
|
|
265
|
+
/* ---------- Responsive ---------- */
|
|
266
|
+
@media (max-width: 1100px) { .layout { grid-template-columns: 250px minmax(0, 1fr); gap: 34px; } .rail { display: none; } .top-links { margin-left: 8px; } .search input { width: 160px; } }
|
|
267
|
+
@media (max-width: 900px) {
|
|
268
|
+
:root { --header-h: 58px; }
|
|
269
|
+
body { font-size: 16.5px; }
|
|
270
|
+
.top-links, .gh-btn, .search { display: none; }
|
|
271
|
+
.menu-btn { display: inline-grid; }
|
|
272
|
+
.layout { grid-template-columns: minmax(0, 1fr); padding-top: 22px; }
|
|
273
|
+
.sidebar { display: none; }
|
|
274
|
+
.hero-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
|
|
275
|
+
.hero { padding: 48px 0 36px !important; }
|
|
276
|
+
.landing section { padding: 52px 0; }
|
|
277
|
+
.stats ul { grid-template-columns: repeat(3, 1fr); }
|
|
173
278
|
.stats li { border-bottom: 1px solid var(--line); }
|
|
174
|
-
.
|
|
279
|
+
.stats li:nth-child(3) { border-right: 0; }
|
|
280
|
+
.footer-grid { grid-template-columns: 1fr 1fr; }
|
|
281
|
+
.footer .about-col { grid-column: 1 / -1; }
|
|
282
|
+
}
|
|
283
|
+
@media (max-width: 560px) {
|
|
284
|
+
.wrap, .topbar-inner, .layout, .footer-inner { padding-left: 16px; padding-right: 16px; }
|
|
285
|
+
.cards, .cards.two { grid-template-columns: minmax(0, 1fr); }
|
|
286
|
+
.stats ul { grid-template-columns: repeat(2, 1fr); }
|
|
287
|
+
.stats li:nth-child(3) { border-right: 1px solid var(--line); }
|
|
288
|
+
.stats li:nth-child(2n) { border-right: 0; }
|
|
289
|
+
.cta .btn { flex: 1 1 100%; }
|
|
290
|
+
.prose h2 { font-size: 1.45rem; }
|
|
291
|
+
th, td { padding: 9px 11px; }
|
|
292
|
+
.pn { grid-template-columns: 1fr; }
|
|
293
|
+
.pn .next { grid-column: 1; }
|
|
294
|
+
.terminal pre { font-size: .72rem; padding: 14px; }
|
|
295
|
+
.footer-grid { grid-template-columns: 1fr; }
|
|
175
296
|
}
|
|
176
297
|
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
|
|
177
298
|
@media print {
|
|
178
|
-
.topbar, .sidebar, .rail, .footer, .copy, .skip { display: none !important; }
|
|
299
|
+
.topbar, .sidebar, .rail, .footer, .copy, .skip, .pn, .drawer { display: none !important; }
|
|
179
300
|
.layout { display: block; padding: 0; }
|
|
180
301
|
body { background: #fff; color: #000; }
|
|
181
302
|
a { color: #000; }
|
package/docs/assets/site.js
CHANGED
|
@@ -7,23 +7,36 @@ const store = {
|
|
|
7
7
|
set: (k, v) => { try { localStorage.setItem(k, v); } catch { /* storage unavailable */ } },
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
// Light is the default. Dark applies only when the reader chooses it (stored in this browser).
|
|
10
11
|
function currentTheme() {
|
|
11
|
-
return root.getAttribute('data-theme')
|
|
12
|
+
return root.getAttribute('data-theme') === 'dark' ? 'dark' : 'light';
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
document.querySelector('.theme-btn')?.addEventListener('click', () => {
|
|
15
16
|
const next = currentTheme() === 'dark' ? 'light' : 'dark';
|
|
16
|
-
root.setAttribute('data-theme',
|
|
17
|
+
if (next === 'dark') root.setAttribute('data-theme', 'dark');
|
|
18
|
+
else root.removeAttribute('data-theme');
|
|
17
19
|
store.set('as-theme', next);
|
|
18
20
|
renderDiagrams();
|
|
19
21
|
});
|
|
20
22
|
|
|
23
|
+
// Mobile drawer: menu button opens it, scrim, close button, Escape and any link close it.
|
|
24
|
+
const drawer = document.getElementById('drawer');
|
|
21
25
|
const menu = document.querySelector('.menu-btn');
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
menu
|
|
26
|
+
const setDrawer = (open) => {
|
|
27
|
+
drawer?.classList.toggle('open', open);
|
|
28
|
+
drawer?.setAttribute('aria-hidden', String(!open));
|
|
29
|
+
menu?.setAttribute('aria-expanded', String(open));
|
|
30
|
+
document.body.style.overflow = open ? 'hidden' : '';
|
|
31
|
+
if (open) drawer?.querySelector('[data-close]')?.nextElementSibling?.querySelector('button, a')?.focus();
|
|
32
|
+
};
|
|
33
|
+
menu?.addEventListener('click', () => setDrawer(true));
|
|
34
|
+
drawer?.addEventListener('click', (e) => {
|
|
35
|
+
const t = e.target;
|
|
36
|
+
if (t instanceof Element && (t.closest('[data-close]') || t.closest('a'))) setDrawer(false);
|
|
26
37
|
});
|
|
38
|
+
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && drawer?.classList.contains('open')) { setDrawer(false); menu?.focus(); } });
|
|
39
|
+
matchMedia('(min-width: 901px)').addEventListener('change', (e) => { if (e.matches) setDrawer(false); });
|
|
27
40
|
|
|
28
41
|
document.querySelectorAll('.copy').forEach((btn) => {
|
|
29
42
|
btn.addEventListener('click', async () => {
|
|
@@ -77,3 +90,76 @@ async function renderDiagrams() {
|
|
|
77
90
|
}
|
|
78
91
|
}
|
|
79
92
|
renderDiagrams();
|
|
93
|
+
|
|
94
|
+
// ---- search: tiny client-side index (docs/search-index.json) ----
|
|
95
|
+
const input = document.getElementById('q');
|
|
96
|
+
const list = document.getElementById('results');
|
|
97
|
+
if (input && list) {
|
|
98
|
+
const base = document.body.dataset.root ?? '';
|
|
99
|
+
let docs = null;
|
|
100
|
+
const load = async () => {
|
|
101
|
+
if (docs) return docs;
|
|
102
|
+
try { docs = await (await fetch(`${base}search-index.json`)).json(); } catch { docs = []; }
|
|
103
|
+
return docs;
|
|
104
|
+
};
|
|
105
|
+
const score = (d, terms) => {
|
|
106
|
+
const t = d.t.toLowerCase(), h = d.h.join(' ').toLowerCase(), s = d.s.toLowerCase();
|
|
107
|
+
let n = 0;
|
|
108
|
+
for (const w of terms) {
|
|
109
|
+
if (!(t.includes(w) || h.includes(w) || s.includes(w))) return 0;
|
|
110
|
+
if (t.includes(w)) n += 6;
|
|
111
|
+
if (h.includes(w)) n += 3;
|
|
112
|
+
if (s.includes(w)) n += 2;
|
|
113
|
+
}
|
|
114
|
+
return n;
|
|
115
|
+
};
|
|
116
|
+
const render = (items) => {
|
|
117
|
+
list.replaceChildren();
|
|
118
|
+
if (!items.length) {
|
|
119
|
+
const li = document.createElement('li');
|
|
120
|
+
li.className = 'none';
|
|
121
|
+
li.textContent = 'No matches. Try a rule ID, a command or a topic.';
|
|
122
|
+
list.append(li);
|
|
123
|
+
}
|
|
124
|
+
for (const d of items) {
|
|
125
|
+
const li = document.createElement('li');
|
|
126
|
+
const a = document.createElement('a');
|
|
127
|
+
a.href = `${base}${d.u}`;
|
|
128
|
+
const rt = document.createElement('span');
|
|
129
|
+
rt.className = 'rt';
|
|
130
|
+
rt.textContent = d.t;
|
|
131
|
+
const rs = document.createElement('span');
|
|
132
|
+
rs.className = 'rs';
|
|
133
|
+
rs.textContent = d.s.length > 110 ? `${d.s.slice(0, 107)}...` : d.s;
|
|
134
|
+
a.append(rt, rs);
|
|
135
|
+
li.append(a);
|
|
136
|
+
list.append(li);
|
|
137
|
+
}
|
|
138
|
+
list.hidden = false;
|
|
139
|
+
input.setAttribute('aria-expanded', 'true');
|
|
140
|
+
};
|
|
141
|
+
const close = () => { list.hidden = true; input.setAttribute('aria-expanded', 'false'); };
|
|
142
|
+
input.addEventListener('input', async () => {
|
|
143
|
+
const q = input.value.trim().toLowerCase();
|
|
144
|
+
if (q.length < 2) return close();
|
|
145
|
+
const terms = q.split(/\s+/);
|
|
146
|
+
const all = await load();
|
|
147
|
+
render(all.map((d) => [score(d, terms), d]).filter(([n]) => n > 0).sort((a, b) => b[0] - a[0]).slice(0, 8).map(([, d]) => d));
|
|
148
|
+
});
|
|
149
|
+
input.addEventListener('keydown', (e) => {
|
|
150
|
+
if (e.key === 'Escape') { close(); input.blur(); }
|
|
151
|
+
if (e.key === 'Enter') list.querySelector('a')?.click();
|
|
152
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); list.querySelector('a')?.focus(); }
|
|
153
|
+
});
|
|
154
|
+
list.addEventListener('keydown', (e) => {
|
|
155
|
+
const links = [...list.querySelectorAll('a')];
|
|
156
|
+
const i = links.indexOf(document.activeElement);
|
|
157
|
+
if (e.key === 'ArrowDown' && links[i + 1]) { e.preventDefault(); links[i + 1].focus(); }
|
|
158
|
+
if (e.key === 'ArrowUp') { e.preventDefault(); (links[i - 1] ?? input).focus(); }
|
|
159
|
+
if (e.key === 'Escape') { close(); input.focus(); }
|
|
160
|
+
});
|
|
161
|
+
document.addEventListener('click', (e) => { if (!e.target.closest?.('.search')) close(); });
|
|
162
|
+
document.addEventListener('keydown', (e) => {
|
|
163
|
+
if (e.key === '/' && !['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName)) { e.preventDefault(); input.focus(); }
|
|
164
|
+
});
|
|
165
|
+
}
|