@wxxb789/anc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +295 -0
  3. package/astro.config.mjs +255 -0
  4. package/bin/anc.mjs +798 -0
  5. package/package.json +93 -0
  6. package/public/_headers +45 -0
  7. package/public/favicon.ico +0 -0
  8. package/public/favicon.svg +9 -0
  9. package/public/fonts/Temml.woff2 +0 -0
  10. package/scripts/build-snapshot.js +69 -0
  11. package/scripts/build-wasm.js +67 -0
  12. package/scripts/build-workspace.js +50 -0
  13. package/scripts/copy-snapshot.js +48 -0
  14. package/scripts/copy-wasm.js +57 -0
  15. package/scripts/emit-redirects.js +64 -0
  16. package/scripts/generate-corpus.js +421 -0
  17. package/scripts/init-repository.js +249 -0
  18. package/scripts/load-config.js +975 -0
  19. package/scripts/markdown-to-artifact.js +1286 -0
  20. package/scripts/preview-site.js +364 -0
  21. package/scripts/publish-set-review.js +157 -0
  22. package/scripts/resolve-links.js +640 -0
  23. package/scripts/run-pagefind.js +125 -0
  24. package/scripts/scan-residue.js +1016 -0
  25. package/scripts/scan-secrets.js +268 -0
  26. package/scripts/seed-gitignore.js +410 -0
  27. package/scripts/snapshot-rows.js +205 -0
  28. package/scripts/validate-content.js +95 -0
  29. package/scripts/vendor-provenance.js +307 -0
  30. package/scripts/verify-output-inventory.js +307 -0
  31. package/scripts/write-report.js +351 -0
  32. package/scripts/write-snapshot.js +136 -0
  33. package/src/components/CollectionExplorer.astro +149 -0
  34. package/src/components/FacetIndex.astro +45 -0
  35. package/src/components/LinkedNotes.astro +94 -0
  36. package/src/components/NoteGraph.astro +434 -0
  37. package/src/components/NoteList.astro +54 -0
  38. package/src/components/SiteMetadata.astro +143 -0
  39. package/src/components/TableOfContents.astro +69 -0
  40. package/src/components/TagBrowser.astro +70 -0
  41. package/src/layouts/Layout.astro +305 -0
  42. package/src/lib/artifact-source.js +72 -0
  43. package/src/lib/build-bindings.js +11 -0
  44. package/src/lib/collection-navigation.js +145 -0
  45. package/src/lib/content.js +92 -0
  46. package/src/lib/diagram-mode.js +18 -0
  47. package/src/lib/graph-layout.js +219 -0
  48. package/src/lib/graph-selection.js +84 -0
  49. package/src/lib/graph.js +42 -0
  50. package/src/lib/link-resolution.js +389 -0
  51. package/src/lib/markdown.js +1469 -0
  52. package/src/lib/math-mode.js +31 -0
  53. package/src/lib/math-output.js +131 -0
  54. package/src/lib/math.js +165 -0
  55. package/src/lib/mermaid-environment.js +475 -0
  56. package/src/lib/mermaid-render.js +769 -0
  57. package/src/lib/preview-model.js +96 -0
  58. package/src/lib/relations.js +242 -0
  59. package/src/lib/rendered-marker.js +55 -0
  60. package/src/lib/route-path.js +192 -0
  61. package/src/lib/routes.js +342 -0
  62. package/src/lib/schema.js +578 -0
  63. package/src/lib/site.js +578 -0
  64. package/src/lib/snapshot-contract.js +216 -0
  65. package/src/lib/snapshot-operations.js +147 -0
  66. package/src/lib/snapshot-queries.js +216 -0
  67. package/src/lib/snapshot-reader.js +210 -0
  68. package/src/lib/snapshot.js +233 -0
  69. package/src/lib/sqlite-warning.js +22 -0
  70. package/src/lib/sqlite.js +14 -0
  71. package/src/lib/tag-browser-model.js +18 -0
  72. package/src/lib/translations.js +533 -0
  73. package/src/lib/wasm-asset.js +47 -0
  74. package/src/lib/worker-protocol.js +93 -0
  75. package/src/pages/404.astro +35 -0
  76. package/src/pages/about.astro +100 -0
  77. package/src/pages/collections/[slug].astro +36 -0
  78. package/src/pages/collections/index.astro +33 -0
  79. package/src/pages/graph.astro +64 -0
  80. package/src/pages/index.astro +33 -0
  81. package/src/pages/notes/[slug].astro +509 -0
  82. package/src/pages/privacy.astro +121 -0
  83. package/src/pages/private.astro +59 -0
  84. package/src/pages/recent.astro +33 -0
  85. package/src/pages/robots.txt.js +15 -0
  86. package/src/pages/rss.xml.js +21 -0
  87. package/src/pages/sitemap.xml.js +20 -0
  88. package/src/pages/tags/[tag].astro +56 -0
  89. package/src/pages/tags/index.astro +37 -0
  90. package/src/scripts/code-copy.js +45 -0
  91. package/src/scripts/diagram-disabled.js +16 -0
  92. package/src/scripts/diagram.js +322 -0
  93. package/src/scripts/graph-client.js +222 -0
  94. package/src/scripts/graph-draw.js +166 -0
  95. package/src/scripts/link-preview.js +334 -0
  96. package/src/scripts/math-disabled.js +18 -0
  97. package/src/scripts/math.js +133 -0
  98. package/src/scripts/preferences.js +123 -0
  99. package/src/scripts/search-dialog.js +651 -0
  100. package/src/scripts/snapshot-client.js +157 -0
  101. package/src/scripts/snapshot-worker.js +341 -0
  102. package/src/scripts/tag-browser.js +153 -0
  103. package/src/scripts/theme-init.js +35 -0
  104. package/src/scripts/toc-active.js +38 -0
  105. package/src/styles/code.css +152 -0
  106. package/src/styles/diagram.css +149 -0
  107. package/src/styles/global.css +1739 -0
  108. package/src/styles/graph.css +317 -0
  109. package/src/styles/math.css +376 -0
  110. package/src/styles/tokens.css +171 -0
  111. package/tsconfig.json +25 -0
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Design tokens.
3
+ *
4
+ * Both palettes are declared once with `light-dark()`, so a token carries its
5
+ * light and dark value together and `prefers-color-scheme` is honoured natively
6
+ * with no media query and no script. An explicit user choice overrides it by
7
+ * setting `color-scheme` on the root element — one property, not a second
8
+ * palette. The plain block below is the fallback for a browser without
9
+ * `light-dark()`: it resolves to the light palette, which is readable rather
10
+ * than unstyled.
11
+ *
12
+ * Contrast, measured against WCAG 2.2 (AA text needs 4.5:1, AA large text and
13
+ * non-text UI need 3:1). `tests/design-tokens.test.ts` recomputes every row
14
+ * below from the declarations that follow, so a documented number cannot drift
15
+ * from the palette it describes. Every text-bearing background is covered.
16
+ *
17
+ * token pair light dark
18
+ * text on bg 15.87 16.23
19
+ * text on surface 16.56 14.73
20
+ * text on surface-alt 14.53 13.62
21
+ * muted on bg 6.41 8.66
22
+ * muted on surface 6.69 7.86
23
+ * muted on surface-alt 5.87 7.27
24
+ * accent on bg 5.92 11.12
25
+ * accent on surface 6.18 10.09
26
+ * accent on surface-alt 5.42 9.33
27
+ * link on bg 6.72 10.37
28
+ * link on surface 7.01 9.41
29
+ * link on surface-alt 6.16 8.71
30
+ * focus on bg 5.92 11.12
31
+ * focus on surface 6.18 10.09
32
+ * focus on surface-alt 5.42 9.33
33
+ * syntax-keyword on bg 7.07 9.55
34
+ * syntax-keyword on surface 7.38 8.67
35
+ * syntax-keyword on surface-alt 6.48 8.01
36
+ * syntax-literal on bg 6.97 10.23
37
+ * syntax-literal on surface 7.28 9.28
38
+ * syntax-literal on surface-alt 6.38 8.58
39
+ * line-strong on bg 3.98 3.96
40
+ * line-strong on surface 4.16 3.59
41
+ * line-strong on surface-alt 3.65 3.32
42
+ *
43
+ * The two `syntax-*` pairs are measured on all three backgrounds even though
44
+ * code only ever sits on `surface-alt`: a token that meets AA on the tightest
45
+ * of the three cannot fail if a later ticket moves the code block.
46
+ *
47
+ * `--color-line` is deliberately absent: at 1.33:1 light / 1.48:1 dark it is a
48
+ * decorative divider only, used where the layout already conveys the boundary.
49
+ * Anything that carries information — a focus ring, a table gridline — uses
50
+ * `--color-line-strong`.
51
+ */
52
+
53
+ :root {
54
+ /* Fallback palette: light, for browsers without `light-dark()`. */
55
+ --color-bg: #fbfaf7;
56
+ --color-surface: #ffffff;
57
+ --color-surface-alt: #f2f0ea;
58
+ --color-text: #1b1f24;
59
+ --color-muted: #535d69;
60
+ --color-line: #d8dbe0;
61
+ --color-line-strong: #767d87;
62
+ --color-accent: #1f6f3c;
63
+ --color-link: #125e8a;
64
+ --color-focus: #1f6f3c;
65
+ --color-shadow: rgb(27 31 36 / 0.14);
66
+ --color-wash: rgb(31 111 60 / 0.07);
67
+ --color-syntax-keyword: #6b3fa0;
68
+ --color-syntax-literal: #8f3f10;
69
+ }
70
+
71
+ @supports (color: light-dark(#000, #fff)) {
72
+ :root {
73
+ color-scheme: light dark;
74
+
75
+ --color-bg: light-dark(#fbfaf7, #0d1013);
76
+ --color-surface: light-dark(#ffffff, #161b21);
77
+ --color-surface-alt: light-dark(#f2f0ea, #1c222a);
78
+ --color-text: light-dark(#1b1f24, #e9edf2);
79
+ --color-muted: light-dark(#535d69, #a4b0be);
80
+ --color-line: light-dark(#d8dbe0, #2b323c);
81
+ --color-line-strong: light-dark(#767d87, #69737f);
82
+ --color-accent: light-dark(#1f6f3c, #8ad884);
83
+ --color-link: light-dark(#125e8a, #86c8e6);
84
+ --color-focus: light-dark(#1f6f3c, #8ad884);
85
+ --color-shadow: light-dark(rgb(27 31 36 / 0.14), rgb(0 0 0 / 0.55));
86
+ --color-wash: light-dark(rgb(31 111 60 / 0.07), rgb(138 216 132 / 0.06));
87
+
88
+ /*
89
+ * Syntax highlighting reuses the palette wherever it can — comments are
90
+ * `muted`, strings are `accent`, punctuation is `text` — and adds exactly
91
+ * two hues, because four distinguishable colours is what a Prism token
92
+ * stream actually needs and the existing three cannot separate a keyword
93
+ * from a string. Every highlighted token is also distinguished by weight or
94
+ * style, never by colour alone (WCAG 1.4.1).
95
+ */
96
+ --color-syntax-keyword: light-dark(#6b3fa0, #cfa8f0);
97
+ --color-syntax-literal: light-dark(#8f3f10, #efb08c);
98
+ }
99
+
100
+ /*
101
+ * The explicit user choice. `theme-init.js` sets the attribute before paint.
102
+ *
103
+ * Both rules live inside `@supports` deliberately. Outside it there is no
104
+ * dark palette to switch to, so `color-scheme: dark` alone would darken the
105
+ * scrollbars and form widgets while every `--color-*` stayed light — a dark
106
+ * frame around a light page, which is worse than no toggle. In a browser
107
+ * without `light-dark()` the toggle is inert and the page stays consistently
108
+ * light.
109
+ */
110
+ :root[data-theme='light'] {
111
+ color-scheme: light;
112
+ }
113
+
114
+ :root[data-theme='dark'] {
115
+ color-scheme: dark;
116
+ }
117
+ }
118
+
119
+ :root {
120
+ /* Type. Every face here is one the reader's own system provides: no webfont
121
+ ships, so there is no font request, no FOUT, and no `font-src` beyond
122
+ `'self'` to justify. A CJK face follows the Latin faces in every stack so
123
+ mixed zh/en text renders in one visual family instead of a browser default.
124
+ `Inter` was named here until TK-12 with no `@font-face` and no font file
125
+ anywhere in the repository — it resolved to nothing on almost every
126
+ machine. Naming a face means shipping it. */
127
+ --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
128
+ 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Source Han Sans SC', sans-serif;
129
+ --font-mono: ui-monospace, 'Cascadia Code', SFMono-Regular, Menlo, Consolas, 'Noto Sans Mono CJK SC', monospace;
130
+
131
+ --text-xs: 0.8125rem;
132
+ --text-sm: 0.9375rem;
133
+ --text-base: 1.0625rem;
134
+ --text-lg: 1.1875rem;
135
+ --text-xl: clamp(1.35rem, 1.15rem + 1vw, 1.75rem);
136
+ --text-2xl: clamp(1.6rem, 1.25rem + 1.75vw, 2.25rem);
137
+ --text-3xl: clamp(2rem, 1.4rem + 3vw, 3.25rem);
138
+
139
+ --leading-tight: 1.2;
140
+ --leading-body: 1.7;
141
+
142
+ /* Space */
143
+ --space-1: 0.25rem;
144
+ --space-2: 0.5rem;
145
+ --space-3: 0.75rem;
146
+ --space-4: 1rem;
147
+ --space-6: 1.5rem;
148
+ --space-8: 2rem;
149
+ --space-12: 3rem;
150
+ --space-16: 4rem;
151
+
152
+ --radius-sm: 6px;
153
+ --radius-md: 12px;
154
+ --radius-lg: 18px;
155
+
156
+ --elevation-1: 0 1px 2px var(--color-shadow);
157
+ --elevation-2: 0 12px 32px var(--color-shadow);
158
+
159
+ --motion-fast: 120ms;
160
+ --ease: cubic-bezier(0.2, 0, 0, 1);
161
+
162
+ /* Width. `--measure` keeps prose near 65-80 characters. */
163
+ --measure: 68ch;
164
+ --width-page: 68rem;
165
+ /* The collection rail. Wide enough for a two-line note title at
166
+ `--text-sm` without hyphenation, narrow enough that the article keeps its
167
+ full measure on a 1024 px viewport — which is the width the two-column
168
+ layout switches on. */
169
+ --width-rail: 15rem;
170
+ --gutter: clamp(1rem, 4vw, 2rem);
171
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "compilerOptions": {
4
+ // Every script here runs under `node --experimental-strip-types`, which
5
+ // erases annotations and cannot emit code, so a TypeScript-only construct
6
+ // that *does* emit — `enum`, `namespace`, a parameter property — fails at
7
+ // run time rather than at check time. `src/lib/math.ts:150-157` records a
8
+ // parameter property being rejected for exactly this reason.
9
+ //
10
+ // It is also what keeps the two ways this code runs from diverging:
11
+ // `scripts/compile-package.ts` compiles these same sources for the tarball
12
+ // and inherits this file, so a construct Node would reject cannot slip into
13
+ // the published package by being merely compilable.
14
+ "erasableSyntaxOnly": true
15
+ },
16
+ // The dot-directory pattern is explicit: TypeScript's `**/*` glob does not
17
+ // match dot-directories, so the Action-parity gate scripts under
18
+ // `.github/scripts/` would otherwise never be part of `astro check` even
19
+ // though the workflow runs them with the same pinned Node. The pattern ends
20
+ // without a file extension so TypeScript resolves the supported extensions
21
+ // itself; a literal `.ts` here would be a specifier the tarball does not
22
+ // carry, which `tests/packaging.test.ts` refuses.
23
+ "include": [".astro/types.d.ts", "**/*", ".github/scripts/*"],
24
+ "exclude": ["dist"]
25
+ }