explico 0.11.1 → 0.13.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.
Files changed (298) hide show
  1. package/CHANGELOG.md +1292 -1
  2. package/README.md +91 -13
  3. package/dist/compiler/astro.d.ts +11 -4
  4. package/dist/compiler/astro.js +48 -15
  5. package/dist/compiler/cli.d.ts +27 -12
  6. package/dist/compiler/cli.js +96 -25
  7. package/dist/compiler/collections.d.ts +33 -2
  8. package/dist/compiler/collections.js +91 -19
  9. package/dist/compiler/content-schema.d.ts +31 -0
  10. package/dist/compiler/content-schema.js +82 -0
  11. package/dist/compiler/content-schemas.d.ts +422 -0
  12. package/dist/compiler/content-schemas.js +229 -0
  13. package/dist/compiler/course-config.d.ts +1 -1
  14. package/dist/compiler/course-config.js +30 -2
  15. package/dist/compiler/exports/combined-html.d.ts +97 -0
  16. package/dist/compiler/exports/combined-html.js +492 -0
  17. package/dist/compiler/exports/download-index.d.ts +9 -0
  18. package/dist/compiler/exports/download-index.js +33 -0
  19. package/dist/compiler/exports/export-chapters.d.ts +98 -0
  20. package/dist/compiler/exports/export-chapters.js +164 -0
  21. package/dist/compiler/exports/export-pages.d.ts +48 -0
  22. package/dist/compiler/exports/export-pages.js +22 -0
  23. package/dist/compiler/exports/html-tree.d.ts +22 -0
  24. package/dist/compiler/exports/html-tree.js +47 -0
  25. package/dist/compiler/exports/latex/capture.d.ts +106 -0
  26. package/dist/compiler/exports/latex/capture.js +435 -0
  27. package/dist/compiler/exports/latex/compile.d.ts +73 -0
  28. package/dist/compiler/exports/latex/compile.js +115 -0
  29. package/dist/compiler/exports/latex/document.d.ts +102 -0
  30. package/dist/compiler/exports/latex/document.js +349 -0
  31. package/dist/compiler/exports/latex/explico.cls +415 -0
  32. package/dist/compiler/exports/latex/numbering.d.ts +18 -0
  33. package/dist/compiler/exports/latex/numbering.js +57 -0
  34. package/dist/compiler/exports/latex/serialize.d.ts +112 -0
  35. package/dist/compiler/exports/latex/serialize.js +606 -0
  36. package/dist/compiler/exports/latex-export.d.ts +44 -0
  37. package/dist/compiler/exports/latex-export.js +169 -0
  38. package/dist/compiler/exports/markdown/serialize.d.ts +51 -0
  39. package/dist/compiler/exports/markdown/serialize.js +527 -0
  40. package/dist/compiler/exports/markdown-export.d.ts +39 -0
  41. package/dist/compiler/exports/markdown-export.js +240 -0
  42. package/dist/compiler/exports/standalone-html.d.ts +15 -5
  43. package/dist/compiler/exports/standalone-html.js +23 -51
  44. package/dist/compiler/exports/static-tree.d.ts +253 -0
  45. package/dist/compiler/exports/static-tree.js +625 -0
  46. package/dist/compiler/exports/zip.d.ts +16 -0
  47. package/dist/compiler/exports/zip.js +72 -0
  48. package/dist/compiler/lesson-derivation.d.ts +8 -2
  49. package/dist/compiler/lesson-derivation.js +6 -7
  50. package/dist/compiler/manifest.d.ts +115 -8
  51. package/dist/compiler/manifest.js +221 -39
  52. package/dist/compiler/render-diagnostics.d.ts +65 -0
  53. package/dist/compiler/render-diagnostics.js +56 -0
  54. package/dist/compiler/resolution-report.d.ts +3 -1
  55. package/dist/{course-config-Dsnri9Tk.d.ts → course-config-rRtME5UV.d.ts} +56 -13
  56. package/dist/curriculum/validation.d.ts +9 -3
  57. package/dist/curriculum/validation.js +35 -17
  58. package/dist/reference/base-abbreviations.d.mts +2 -2
  59. package/dist/reference/base-abbreviations.mjs +2 -2
  60. package/dist/reference/base-operators.d.mts +8 -2
  61. package/dist/reference/base-operators.mjs +8 -10
  62. package/dist/reference/base-roman-labels.d.mts +4 -3
  63. package/dist/reference/base-roman-labels.mjs +4 -3
  64. package/dist/reference/citation-format.d.mts +35 -0
  65. package/dist/reference/citation-format.mjs +74 -0
  66. package/dist/reference/consistency.d.ts +5 -9
  67. package/dist/reference/consistency.js +34 -38
  68. package/dist/reference/curriculum-alignment.js +3 -24
  69. package/dist/reference/derived-entries.d.ts +45 -0
  70. package/dist/reference/derived-entries.js +50 -0
  71. package/dist/reference/derived-notation.d.mts +125 -0
  72. package/dist/reference/derived-notation.mjs +121 -0
  73. package/dist/reference/diagram-fit.d.ts +45 -0
  74. package/dist/reference/diagram-fit.js +54 -0
  75. package/dist/reference/diagram-layout.d.ts +59 -10
  76. package/dist/reference/diagram-layout.js +85 -24
  77. package/dist/reference/diagrams-validate.d.ts +1 -1
  78. package/dist/reference/equations-validate.d.ts +1 -1
  79. package/dist/reference/equations-validate.js +26 -1
  80. package/dist/reference/equations.d.mts +27 -0
  81. package/dist/reference/equations.mjs +120 -22
  82. package/dist/reference/examples-validate.d.ts +1 -1
  83. package/dist/reference/figure-fit.d.ts +70 -0
  84. package/dist/reference/figure-fit.js +60 -0
  85. package/dist/reference/figure-pictures.d.ts +27 -0
  86. package/dist/reference/figure-pictures.js +49 -0
  87. package/dist/reference/figure-symbols.d.ts +32 -0
  88. package/dist/reference/figure-symbols.js +55 -0
  89. package/dist/reference/figures-validate.d.ts +1 -1
  90. package/dist/reference/gate-abbreviations.d.ts +1 -1
  91. package/dist/reference/gate-abbreviations.js +1 -1
  92. package/dist/reference/gate-course-rules.d.ts +4 -3
  93. package/dist/reference/gate-course-rules.js +9 -4
  94. package/dist/reference/gate-heading-length.d.ts +2 -0
  95. package/dist/reference/gate-heading-length.js +7 -5
  96. package/dist/reference/gate-heading-structure.js +26 -0
  97. package/dist/reference/gate-indices.d.ts +35 -0
  98. package/dist/reference/gate-indices.js +299 -0
  99. package/dist/reference/gate-math.d.ts +32 -2
  100. package/dist/reference/gate-math.js +68 -12
  101. package/dist/reference/gate-mdx-expression.d.ts +17 -0
  102. package/dist/reference/gate-mdx-expression.js +29 -0
  103. package/dist/reference/gate-non-chapter-pages.d.ts +39 -0
  104. package/dist/reference/gate-non-chapter-pages.js +156 -0
  105. package/dist/reference/gate-part-pages.d.ts +4 -2
  106. package/dist/reference/gate-part-pages.js +2 -1
  107. package/dist/reference/gate-prop-text.d.ts +28 -0
  108. package/dist/reference/gate-prop-text.js +106 -0
  109. package/dist/reference/gate-prose-notation.d.ts +3 -1
  110. package/dist/reference/gate-prose-notation.js +4 -2
  111. package/dist/reference/gate-retired-keys.d.ts +35 -0
  112. package/dist/reference/gate-retired-keys.js +58 -0
  113. package/dist/reference/gloss.d.ts +2 -0
  114. package/dist/reference/katex-measure.d.ts +17 -0
  115. package/dist/reference/katex-measure.js +223 -0
  116. package/dist/reference/keyed-float-validate.js +12 -0
  117. package/dist/reference/keyed-jsx-floats.d.mts +2 -2
  118. package/dist/reference/keyed-jsx-floats.mjs +11 -14
  119. package/dist/reference/lab-katex-validate.d.ts +43 -0
  120. package/dist/reference/lab-katex-validate.js +96 -0
  121. package/dist/reference/lab-math-scope.d.ts +1 -0
  122. package/dist/reference/lab-math-scope.js +13 -2
  123. package/dist/reference/lint-ignore.js +1 -1
  124. package/dist/reference/math-glyphs.d.mts +94 -2
  125. package/dist/reference/math-glyphs.mjs +851 -46
  126. package/dist/reference/mixed-content.d.ts +8 -3
  127. package/dist/reference/mixed-content.js +4 -2
  128. package/dist/reference/page-notation.d.ts +39 -7
  129. package/dist/reference/page-notation.js +62 -10
  130. package/dist/reference/raw-floats.mjs +37 -13
  131. package/dist/reference/references.d.ts +11 -1
  132. package/dist/reference/references.js +6 -0
  133. package/dist/reference/registry.js +115 -11
  134. package/dist/reference/rehype-fail-katex-errors.d.mts +9 -0
  135. package/dist/reference/rehype-fail-katex-errors.mjs +19 -0
  136. package/dist/reference/rehype-heading-anchors.mjs +11 -1
  137. package/dist/reference/remark-citation.mjs +0 -0
  138. package/dist/reference/remark-notation.mjs +275 -23
  139. package/dist/reference/render-lab-math.d.ts +13 -2
  140. package/dist/reference/render-lab-math.js +18 -6
  141. package/dist/reference/sections-validate.d.ts +28 -3
  142. package/dist/reference/sections-validate.js +31 -4
  143. package/dist/reference/sections.d.mts +24 -6
  144. package/dist/reference/sections.mjs +92 -17
  145. package/dist/reference/tables-validate.d.ts +1 -1
  146. package/dist/reference/tables-validate.js +24 -1
  147. package/dist/reference/text-measure.d.ts +10 -0
  148. package/dist/reference/text-measure.js +41 -0
  149. package/dist/reference/text-widths.d.ts +10 -0
  150. package/dist/reference/text-widths.js +1238 -0
  151. package/dist/reference/types.d.ts +64 -8
  152. package/dist/rules/catalog.js +223 -32
  153. package/dist/rules/in-effect.d.ts +1 -1
  154. package/dist/rules/rules.schema.json +100 -27
  155. package/dist/rules/settings.d.ts +1 -1
  156. package/dist/rules/settings.js +7 -0
  157. package/dist/session/PreferenceStore.d.ts +18 -1
  158. package/dist/session/PreferenceStore.js +29 -1
  159. package/docs/authoring/README.md +33 -21
  160. package/docs/authoring/agents.md +38 -7
  161. package/docs/authoring/components.md +115 -10
  162. package/docs/authoring/migrating.md +878 -0
  163. package/docs/authoring/notation.md +285 -30
  164. package/docs/authoring/retired.md +1 -0
  165. package/docs/authoring/structure-rules.md +84 -45
  166. package/docs/authoring/structure.md +67 -2
  167. package/docs/authoring/visualizations.md +167 -25
  168. package/package.json +12 -7
  169. package/src/compiler/astro.ts +72 -21
  170. package/src/compiler/cli.ts +143 -35
  171. package/src/compiler/collections.ts +158 -27
  172. package/src/compiler/content-schema.ts +108 -0
  173. package/src/compiler/content-schemas.ts +391 -0
  174. package/src/compiler/course-config.ts +86 -15
  175. package/src/compiler/exports/combined-html.ts +669 -0
  176. package/src/compiler/exports/download-index.ts +36 -0
  177. package/src/compiler/exports/export-chapters.ts +233 -0
  178. package/src/compiler/exports/export-pages.ts +44 -0
  179. package/src/compiler/exports/html-tree.ts +62 -0
  180. package/src/compiler/exports/latex/capture.ts +651 -0
  181. package/src/compiler/exports/latex/compile.ts +168 -0
  182. package/src/compiler/exports/latex/document.ts +479 -0
  183. package/src/compiler/exports/latex/explico.cls +415 -0
  184. package/src/compiler/exports/latex/numbering.ts +74 -0
  185. package/src/compiler/exports/latex/serialize.ts +787 -0
  186. package/src/compiler/exports/latex/texlive-packages.txt +76 -0
  187. package/src/compiler/exports/latex-export.ts +255 -0
  188. package/src/compiler/exports/markdown/serialize.ts +632 -0
  189. package/src/compiler/exports/markdown-export.ts +329 -0
  190. package/src/compiler/exports/standalone-html.ts +39 -70
  191. package/src/compiler/exports/static-tree.ts +944 -0
  192. package/src/compiler/exports/zip.ts +88 -0
  193. package/src/compiler/lesson-derivation.ts +13 -8
  194. package/src/compiler/manifest.ts +387 -40
  195. package/src/compiler/render-diagnostics.ts +111 -0
  196. package/src/components/CourseContents.astro +6 -0
  197. package/src/components/HoverPanel.astro +204 -6
  198. package/src/components/PartOverview.astro +18 -9
  199. package/src/components/abbreviation/AbbreviationGlossary.astro +6 -2
  200. package/src/components/abbreviation/AbbreviationLayer.astro +21 -12
  201. package/src/components/assessments/AssessmentRunner.tsx +7 -1
  202. package/src/components/assessments/AssessmentSet.astro +14 -1
  203. package/src/components/block-heading.ts +38 -0
  204. package/src/components/card-arrow.ts +18 -4
  205. package/src/components/card-carry.ts +406 -0
  206. package/src/components/card-drag.ts +1 -30
  207. package/src/components/card-fetch.ts +87 -0
  208. package/src/components/card-manager.ts +1222 -38
  209. package/src/components/card-memory.ts +5 -1
  210. package/src/components/card-placement.ts +211 -13
  211. package/src/components/card-side.ts +281 -31
  212. package/src/components/citation/CitationLayer.astro +45 -40
  213. package/src/components/diagram/Diagram.astro +123 -44
  214. package/src/components/disclosure/print-as-shown.ts +42 -6
  215. package/src/components/figure/Figure.astro +17 -1
  216. package/src/components/figure/FloatCaption.astro +4 -17
  217. package/src/components/figure/figure-state.ts +26 -17
  218. package/src/components/float-toolbar.ts +274 -0
  219. package/src/components/memo/Memo.astro +21 -10
  220. package/src/components/memo/ShortNote.astro +4 -0
  221. package/src/components/notation/NotationGlossary.astro +22 -17
  222. package/src/components/notation/NotationLayer.astro +300 -79
  223. package/src/components/notation/NotationMath.astro +8 -1
  224. package/src/components/notation/render-notation-math.ts +51 -5
  225. package/src/components/readable-text.ts +25 -0
  226. package/src/components/reference/FloatRefLayer.astro +162 -89
  227. package/src/components/starlight/HeadingAnchorEnhancer.astro +13 -8
  228. package/src/components/starlight/KeyedFloatEnhancer.astro +28 -9
  229. package/src/components/starlight/LayoutPageSidebar.astro +17 -3
  230. package/src/components/starlight/LayoutSocialIcons.astro +79 -29
  231. package/src/components/starlight/LessonExportActions.astro +384 -310
  232. package/src/components/starlight/LessonFooter.astro +66 -8
  233. package/src/components/starlight/PrintController.astro +28 -0
  234. package/src/components/starlight/TextSizeControl.astro +137 -0
  235. package/src/components/starlight/print-controller.ts +380 -0
  236. package/src/components/starlight/section-summary.ts +13 -5
  237. package/src/components/table/Table.astro +14 -22
  238. package/src/components/table/table-truncation.ts +15 -0
  239. package/src/content-config.ts +20 -312
  240. package/src/curriculum/validation.ts +72 -24
  241. package/src/reference/base-abbreviations.mjs +2 -2
  242. package/src/reference/base-operators.mjs +8 -10
  243. package/src/reference/base-roman-labels.mjs +4 -3
  244. package/src/reference/citation-format.mjs +74 -0
  245. package/src/reference/consistency.ts +47 -61
  246. package/src/reference/curriculum-alignment.ts +4 -41
  247. package/src/reference/derived-entries.ts +68 -0
  248. package/src/reference/derived-notation.mjs +121 -0
  249. package/src/reference/diagram-fit.ts +104 -0
  250. package/src/reference/diagram-layout.ts +182 -51
  251. package/src/reference/diagrams-validate.ts +2 -1
  252. package/src/reference/equations-validate.ts +41 -2
  253. package/src/reference/equations.mjs +120 -22
  254. package/src/reference/examples-validate.ts +1 -0
  255. package/src/reference/figure-fit.ts +139 -0
  256. package/src/reference/figure-pictures.ts +96 -0
  257. package/src/reference/figure-symbols.ts +117 -0
  258. package/src/reference/figures-validate.ts +2 -1
  259. package/src/reference/gate-abbreviations.ts +1 -1
  260. package/src/reference/gate-course-rules.ts +22 -7
  261. package/src/reference/gate-heading-length.ts +25 -7
  262. package/src/reference/gate-heading-structure.ts +40 -1
  263. package/src/reference/gate-indices.ts +470 -0
  264. package/src/reference/gate-math.ts +102 -13
  265. package/src/reference/gate-mdx-expression.ts +45 -0
  266. package/src/reference/gate-non-chapter-pages.ts +241 -0
  267. package/src/reference/gate-part-pages.ts +1 -1
  268. package/src/reference/gate-prop-text.ts +145 -0
  269. package/src/reference/gate-prose-notation.ts +19 -5
  270. package/src/reference/gate-retired-keys.ts +101 -0
  271. package/src/reference/gloss.ts +2 -0
  272. package/src/reference/katex-measure.ts +384 -0
  273. package/src/reference/keyed-float-validate.ts +22 -0
  274. package/src/reference/keyed-jsx-floats.mjs +11 -14
  275. package/src/reference/lab-katex-validate.ts +156 -0
  276. package/src/reference/lab-math-scope.ts +15 -1
  277. package/src/reference/lint-ignore.ts +4 -1
  278. package/src/reference/math-glyphs.mjs +851 -46
  279. package/src/reference/mixed-content.ts +11 -2
  280. package/src/reference/page-notation.ts +114 -14
  281. package/src/reference/raw-floats.mjs +37 -13
  282. package/src/reference/references.ts +14 -0
  283. package/src/reference/registry.ts +170 -9
  284. package/src/reference/rehype-fail-katex-errors.mjs +19 -0
  285. package/src/reference/rehype-heading-anchors.mjs +11 -1
  286. package/src/reference/remark-citation.mjs +0 -0
  287. package/src/reference/remark-notation.mjs +275 -23
  288. package/src/reference/render-lab-math.ts +40 -5
  289. package/src/reference/sections-validate.ts +67 -3
  290. package/src/reference/sections.mjs +92 -17
  291. package/src/reference/tables-validate.ts +40 -2
  292. package/src/reference/text-measure.ts +63 -0
  293. package/src/reference/text-widths.ts +133 -0
  294. package/src/reference/types.ts +75 -8
  295. package/src/rules/catalog.ts +241 -31
  296. package/src/rules/settings.ts +10 -0
  297. package/src/session/PreferenceStore.ts +53 -0
  298. package/src/styles/global.css +322 -83
@@ -0,0 +1,72 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { crc32, deflateRawSync } from "node:zlib";
3
+ const DOS_DATE_1980_01_01 = 33;
4
+ const UTF8_NAMES = 2048;
5
+ const REGULAR_FILE_644 = 33188 << 16;
6
+ function zip(entries) {
7
+ const sorted = [...entries].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
8
+ const seen = /* @__PURE__ */ new Set();
9
+ const locals = [];
10
+ const centrals = [];
11
+ let offset = 0;
12
+ for (const entry of sorted) {
13
+ if (!entry.path || entry.path.startsWith("/") || entry.path.split("/").includes("..")) {
14
+ throw new Error(`Zip entry path ${JSON.stringify(entry.path)} is not a relative path.`);
15
+ }
16
+ if (seen.has(entry.path)) throw new Error(`Zip entry ${entry.path} appears twice.`);
17
+ seen.add(entry.path);
18
+ const name = Buffer.from(entry.path, "utf8");
19
+ const data = typeof entry.content === "string" ? Buffer.from(entry.content, "utf8") : Buffer.from(entry.content);
20
+ const deflated = deflateRawSync(data, { level: 9 });
21
+ const stored = deflated.length >= data.length;
22
+ const body = stored ? data : deflated;
23
+ const checksum = crc32(data) >>> 0;
24
+ const local = Buffer.alloc(30);
25
+ local.writeUInt32LE(67324752, 0);
26
+ local.writeUInt16LE(20, 4);
27
+ local.writeUInt16LE(UTF8_NAMES, 6);
28
+ local.writeUInt16LE(stored ? 0 : 8, 8);
29
+ local.writeUInt16LE(0, 10);
30
+ local.writeUInt16LE(DOS_DATE_1980_01_01, 12);
31
+ local.writeUInt32LE(checksum, 14);
32
+ local.writeUInt32LE(body.length, 18);
33
+ local.writeUInt32LE(data.length, 22);
34
+ local.writeUInt16LE(name.length, 26);
35
+ local.writeUInt16LE(0, 28);
36
+ locals.push(local, name, body);
37
+ const central = Buffer.alloc(46);
38
+ central.writeUInt32LE(33639248, 0);
39
+ central.writeUInt16LE(3 << 8 | 20, 4);
40
+ central.writeUInt16LE(20, 6);
41
+ central.writeUInt16LE(UTF8_NAMES, 8);
42
+ central.writeUInt16LE(stored ? 0 : 8, 10);
43
+ central.writeUInt16LE(0, 12);
44
+ central.writeUInt16LE(DOS_DATE_1980_01_01, 14);
45
+ central.writeUInt32LE(checksum, 16);
46
+ central.writeUInt32LE(body.length, 20);
47
+ central.writeUInt32LE(data.length, 24);
48
+ central.writeUInt16LE(name.length, 28);
49
+ central.writeUInt16LE(0, 30);
50
+ central.writeUInt16LE(0, 32);
51
+ central.writeUInt16LE(0, 34);
52
+ central.writeUInt16LE(0, 36);
53
+ central.writeUInt32LE(REGULAR_FILE_644 >>> 0, 38);
54
+ central.writeUInt32LE(offset, 42);
55
+ centrals.push(central, name);
56
+ offset += local.length + name.length + body.length;
57
+ }
58
+ const directory = Buffer.concat(centrals);
59
+ const end = Buffer.alloc(22);
60
+ end.writeUInt32LE(101010256, 0);
61
+ end.writeUInt16LE(0, 4);
62
+ end.writeUInt16LE(0, 6);
63
+ end.writeUInt16LE(sorted.length, 8);
64
+ end.writeUInt16LE(sorted.length, 10);
65
+ end.writeUInt32LE(directory.length, 12);
66
+ end.writeUInt32LE(offset, 16);
67
+ end.writeUInt16LE(0, 20);
68
+ return Buffer.concat([...locals, directory, end]);
69
+ }
70
+ export {
71
+ zip
72
+ };
@@ -5,7 +5,7 @@
5
5
  * layout, the tests) goes through that one loader.
6
6
  *
7
7
  * Authored per lesson after C2: `title`, `description`, `teaches`, `assumptions`,
8
- * `editorialStatus`, `notation.local`. Everything below is derived:
8
+ * `notation.local`. Everything below is derived:
9
9
  *
10
10
  * - `lessonId` — the doc slug, `/` → `.` (`foundations/discount-factors`).
11
11
  * - `requires` — direct competency-graph prerequisites of `teaches`, minus
@@ -31,6 +31,12 @@ declare function lessonIdFromSlug(slug: string): string;
31
31
  * future `<section>/index` page would not be one either.
32
32
  */
33
33
  declare function isLessonSlug(slug: string): boolean;
34
+ /**
35
+ * The docs slugs a Starlight route id can stand for. The glob loader shortens
36
+ * `<dir>/index.mdx` to the id `<dir>`, and may give the landing page an empty
37
+ * one, so a manifest entry matches its route either way.
38
+ */
39
+ declare function docsSlugsForRoute(routeSlug: string): readonly string[];
34
40
  /**
35
41
  * Direct prerequisites of everything the lesson `teaches`, minus the taught
36
42
  * competencies themselves, sorted. Editorial "you should also know" extras that
@@ -103,4 +109,4 @@ declare function buildSidebar(tracks: readonly TrackLike[], lessonSlugs: readonl
103
109
  readonly floatIndex?: boolean;
104
110
  }): SidebarGroup[];
105
111
 
106
- export { PART_OVERVIEW_CLASS, type SidebarGroup, type SidebarItem, type SidebarSection, buildSidebar, citedSourceIds, deriveRequires, deriveSources, isLessonSlug, lessonIdFromSlug, mergeTrackOrder, parseCheckList };
112
+ export { PART_OVERVIEW_CLASS, type SidebarGroup, type SidebarItem, type SidebarSection, buildSidebar, citedSourceIds, deriveRequires, deriveSources, docsSlugsForRoute, isLessonSlug, lessonIdFromSlug, mergeTrackOrder, parseCheckList };
@@ -1,3 +1,4 @@
1
+ import { citedIds, withoutLinkCitations } from "../reference/citation-format.mjs";
1
2
  function lessonIdFromSlug(slug) {
2
3
  return slug.replace(/\.(md|mdx)$/, "").replace(/\//g, ".");
3
4
  }
@@ -5,6 +6,9 @@ function isLessonSlug(slug) {
5
6
  const clean = slug.replace(/\.(md|mdx)$/, "");
6
7
  return clean.includes("/") && !clean.endsWith("/index");
7
8
  }
9
+ function docsSlugsForRoute(routeSlug) {
10
+ return routeSlug === "" ? ["index"] : [routeSlug, `${routeSlug}/index`];
11
+ }
8
12
  function deriveRequires(teaches, prerequisitesById) {
9
13
  const taught = new Set(teaches);
10
14
  const required = /* @__PURE__ */ new Set();
@@ -17,13 +21,7 @@ function deriveRequires(teaches, prerequisitesById) {
17
21
  }
18
22
  function citedSourceIds(body) {
19
23
  const withoutCode = body.replace(/```[\s\S]*?```/g, "").replace(/`[^`\n]*`/g, "");
20
- const ids = /* @__PURE__ */ new Set();
21
- for (const match of withoutCode.matchAll(
22
- /\[@([a-z0-9][a-z0-9.-]*)(?:;[^\]]*)?\]/g
23
- )) {
24
- ids.add((match[1] ?? "").trim());
25
- }
26
- return ids;
24
+ return citedIds(withoutLinkCitations(withoutCode));
27
25
  }
28
26
  function deriveSources(body) {
29
27
  return [...citedSourceIds(body)].sort();
@@ -99,6 +97,7 @@ export {
99
97
  citedSourceIds,
100
98
  deriveRequires,
101
99
  deriveSources,
100
+ docsSlugsForRoute,
102
101
  isLessonSlug,
103
102
  lessonIdFromSlug,
104
103
  mergeTrackOrder,
@@ -8,15 +8,17 @@ import { ExampleLabelRecord, ExampleDiagnostic } from '../reference/examples-val
8
8
  import { FoldDiagnostic } from '../reference/folds-validate.js';
9
9
  import { KnowledgeCheckLabelRecord, KnowledgeCheckDiagnostic } from '../reference/knowledge-checks-validate.js';
10
10
  import { RawFloatDiagnostic } from '../reference/raw-floats-validate.js';
11
+ import { LabKatexDiagnostic } from '../reference/lab-katex-validate.js';
11
12
  import { MathGateDiagnostic } from '../reference/gate-math.js';
12
13
  import { ContentSegment } from '../reference/mixed-content.js';
13
14
  import { GlyphScopeEntry } from '../reference/gloss.js';
14
- import { NotationDefinitionRecord, NotationPageBundle, NotationBacklink, NotationDiagnostic, EditorialStatus, NotationGlossEntry } from '../reference/types.js';
15
- import { b as NormalizedLessonExports, c as NormalizedDisclosure, d as NormalizedNumbering, B as BlockLabels, M as ManifestRules, e as ConfigDiagnostic, C as CourseConfig } from '../course-config-Dsnri9Tk.js';
15
+ import { NotationDefinitionRecord, NotationPageBundle, NotationBacklink, NotationDiagnostic, NotationGlossEntry } from '../reference/types.js';
16
+ import { N as NormalizedLessonExports, a as NormalizedDisclosure, b as NormalizedNumbering, B as BlockLabels, c as NormalizedCards, M as ManifestRules, d as ConfigDiagnostic, C as CourseConfig } from '../course-config-rRtME5UV.js';
16
17
  import { WaiverDiagnostic } from '../rules/waivers.js';
17
18
  import { KnowledgeVersionDiagnostic } from './knowledge-version.js';
18
19
  import { SidebarGroup } from './lesson-derivation.js';
19
20
  import './collections.js';
21
+ import '../reference/gate-retired-keys.js';
20
22
  import '../reference/lint-ignore.js';
21
23
  import '../reference/keyed-float-validate.js';
22
24
  import '../rules/catalog.js';
@@ -167,8 +169,48 @@ import '../rules/course-rules.js';
167
169
  * state of a `<Fold>`; `disclosure.figures` now says whether a lab's tools
168
170
  * start open; `diagnostics.folds` holds `fold-unnamed`
169
171
  * (docs/plans/figures-and-short-captions.md, Parts 1–2).
172
+ *
173
+ * v25 (cards on non-chapter pages, rule S10): `pages` — every docs page that
174
+ * is not a chapter (the landing page, a part's overview page, …) with its
175
+ * `id`, `slug`, `file` and a `notation` bundle of the lesson shape, so the
176
+ * footer renders the cards its `[[key]]` terms and math open.
177
+ * `notation.bundles` and `notation.backlinks` now carry those pages' ids too.
178
+ *
179
+ * v26 (carried cards, additive): `cards` — the course's `cards` settings with
180
+ * the engine defaults applied: whether "Carry cards" starts on (rule K1).
181
+ *
182
+ * v27 (LaTeX export): `lessonExports.latex` and `lessonExports.latexPaper`;
183
+ * every `assessmentContent` item carries its `type`, a choice item's
184
+ * `options` (plain-text labels) and `correctOptionId`, and a
185
+ * numeric item's `answer`, so an answer key can be printed without re-reading
186
+ * `content/assessments/`.
187
+ *
188
+ * v28 (Markdown export): `lessonExports.markdown`.
189
+ *
190
+ * v29 (no editorial status): the draft / in-review / reviewed flag is gone —
191
+ * `lessons[].status`, `editorialStatus` on the notation definitions of
192
+ * `lessons[]` and `pages[]`, and `status` on `notation.definitions[]` and
193
+ * `notation.bundles[]`. `diagnostics.curriculum` carries `retired-key`, with
194
+ * `file` and `line`, for a content file that still sets the key, and the
195
+ * lesson-assumptions check reports `missing-assumptions`, not `review-state`.
196
+ *
197
+ * v30 (headings with math, additive): `lessons[].headings[].text` is what a
198
+ * reader sees — inline math as it reads (`$\explain{k}{R}$` is `R`, not its
199
+ * LaTeX) and a `[[key]]` term as its label — and `math: true` marks a heading
200
+ * with inline math. A heading's `slug` is unchanged. Each choice option of
201
+ * `assessmentContent` carries `labelSegments`, its label split into text and
202
+ * math like `promptSegments`, so a label's math renders.
203
+ *
204
+ * v31 (indexed symbols, rule N23): the `notation` bundle of `lessons[]` and
205
+ * `pages[]` gains `derived` — the derived cards its body math uses, each
206
+ * composed from a base entry and an index entry (`\mathbf{v}_0` from
207
+ * `\mathbf{v}` and `{}_0`), keyed `<base>.sub.<index>`. A notation
208
+ * definition carries `reads`, `range`, `fixedIndex` and an index entry's
209
+ * `formulaTemplate` when its entry sets them, and a bundle definition its
210
+ * `range`. `diagnostics.math` carries `index-explained`, `index-swallowed`,
211
+ * `index-range` and `derived-key-taken`.
170
212
  */
171
- declare const MANIFEST_SCHEMA_VERSION = 24;
213
+ declare const MANIFEST_SCHEMA_VERSION = 31;
172
214
  declare const MANIFEST_PATH: string;
173
215
  interface ManifestCitation {
174
216
  readonly id: string;
@@ -200,10 +242,11 @@ interface ManifestLessonNotation {
200
242
  readonly notation: string;
201
243
  readonly label: string;
202
244
  readonly summary: string;
203
- readonly editorialStatus: EditorialStatus;
204
245
  readonly seeAlso: readonly string[];
205
246
  readonly units?: string;
206
247
  readonly formula?: string;
248
+ /** Rule N23: the set a running index letter runs over, shown on its card (v31). */
249
+ readonly range?: string;
207
250
  /** Symbols the formula names that have no card of their own (D15). */
208
251
  readonly glosses: readonly NotationGlossEntry[];
209
252
  /**
@@ -213,6 +256,26 @@ interface ManifestLessonNotation {
213
256
  */
214
257
  readonly formulaScope: readonly GlyphScopeEntry[];
215
258
  }
259
+ /**
260
+ * A derived card (rule N23, v31): the card of a symbol with a subscript that
261
+ * an index entry explains, composed from the `base` entry and the `index`
262
+ * entry by `derived-notation.mjs`. Its title and summary are about the
263
+ * indexed symbol; its formula names the base, whose card is one level deeper.
264
+ * It is listed nowhere — not in the Page notation panel, the glossary or an
265
+ * export's notation section — and opens only from the symbol.
266
+ */
267
+ interface ManifestDerivedNotation {
268
+ readonly key: string;
269
+ readonly base: string;
270
+ readonly index: string;
271
+ readonly notation: string;
272
+ readonly label: string;
273
+ readonly summary: string;
274
+ readonly units?: string;
275
+ readonly formula?: string;
276
+ readonly glosses: readonly NotationGlossEntry[];
277
+ readonly formulaScope: readonly GlyphScopeEntry[];
278
+ }
216
279
  /**
217
280
  * One keyed float of a lesson (v21): its key and number, and its caption pair
218
281
  * — `short` (an equation's `\caption{…}`, or the `short` prop) and, for a
@@ -280,9 +343,12 @@ interface ManifestLesson {
280
343
  */
281
344
  readonly headings: readonly {
282
345
  readonly slug: string;
346
+ /** What a reader sees: math as it reads, a `[[key]]` term as its label (v30). */
283
347
  readonly text: string;
284
348
  readonly level: number;
285
349
  readonly number?: string;
350
+ /** The heading has inline math (v30). */
351
+ readonly math?: true;
286
352
  }[];
287
353
  readonly file: string;
288
354
  readonly title: string;
@@ -292,7 +358,6 @@ interface ManifestLesson {
292
358
  readonly min: number;
293
359
  readonly max: number;
294
360
  };
295
- readonly status: EditorialStatus;
296
361
  /** Ordered — the curriculum contract. */
297
362
  readonly teaches: readonly string[];
298
363
  readonly requires: readonly string[];
@@ -336,10 +401,25 @@ interface ManifestLesson {
336
401
  }[];
337
402
  readonly definitionIds: readonly string[];
338
403
  readonly definitions: readonly ManifestLessonNotation[];
404
+ /** The derived cards (rule N23) the page's body math uses (v31). */
405
+ readonly derived: readonly ManifestDerivedNotation[];
339
406
  /** Every `[[key]]` / `\explain{key}` occurrence, resolved and located. */
340
407
  readonly resolution: readonly ManifestNotationResolution[];
341
408
  };
342
409
  }
410
+ /**
411
+ * A docs page that is not a chapter (v25, rule S10) — the landing page, a
412
+ * part's overview page, any page outside a part directory. It numbers
413
+ * nothing, so it carries only what its cards need: the notation bundle its
414
+ * `[[key]]` terms and math reach, shared entries only.
415
+ */
416
+ interface ManifestPage {
417
+ /** `index`, `motion.index`, `glossary` — `lessonIdFromSlug` of the slug; never a lesson id. */
418
+ readonly id: string;
419
+ readonly slug: string;
420
+ readonly file: string;
421
+ readonly notation: ManifestLesson['notation'];
422
+ }
343
423
  /** The reader-facing "about this material" bundle — the `[?]` panel's data. */
344
424
  interface ManifestAbout {
345
425
  /** `explico`'s own identity, from its `package.json` (the version's golden source). */
@@ -376,6 +456,25 @@ interface ManifestAssessmentItemContent {
376
456
  readonly itemId: string;
377
457
  readonly promptSegments: readonly ContentSegment[];
378
458
  readonly explanationSegments: readonly ContentSegment[];
459
+ /** What kind of answer the item takes (v27). */
460
+ readonly type: 'single-choice' | 'numeric';
461
+ /**
462
+ * A choice item's options in authored order: the label as authored, and
463
+ * split into text and math like the prompt (`labelSegments`, v30), so a
464
+ * label's math renders.
465
+ */
466
+ readonly options?: readonly {
467
+ readonly id: string;
468
+ readonly label: string;
469
+ readonly labelSegments: readonly ContentSegment[];
470
+ }[];
471
+ /** A choice item's correct option. */
472
+ readonly correctOptionId?: string;
473
+ /** A numeric item's accepted value and tolerance. */
474
+ readonly answer?: {
475
+ readonly value: number;
476
+ readonly tolerance: number;
477
+ };
379
478
  }
380
479
  /**
381
480
  * One **part** (v17) — a sidebar group and the directory its chapters live in,
@@ -419,6 +518,8 @@ interface Manifest {
419
518
  readonly numbering: NormalizedNumbering;
420
519
  /** How a check's and an example set's heading names its kind (`CourseConfig.blockLabels`). */
421
520
  readonly blockLabels: BlockLabels;
521
+ /** How the explanation cards start for a reader, defaults applied (`CourseConfig.cards`). */
522
+ readonly cards: NormalizedCards;
422
523
  /** Reader-facing identity + versions (the `[?]` About panel). */
423
524
  readonly about: ManifestAbout;
424
525
  readonly notation: {
@@ -438,6 +539,8 @@ interface Manifest {
438
539
  /** The course's parts in config order, with their chapters and overview pages. */
439
540
  readonly parts: readonly ManifestPart[];
440
541
  readonly lessons: readonly ManifestLesson[];
542
+ /** Every docs page that is not a chapter, by id (v25). */
543
+ readonly pages: readonly ManifestPage[];
441
544
  /** Full competency prerequisite graph. */
442
545
  readonly prereqEdges: readonly PrereqEdge[];
443
546
  /** Equation identity (D7): every labelled display equation + the render-path lookup. */
@@ -501,8 +604,12 @@ interface Manifest {
501
604
  readonly equations: readonly EquationDiagnostic[];
502
605
  /** `<Table>` identity checks (F-tables-figures) — same codes, `tab-` prefixed. */
503
606
  readonly tables: readonly TableDiagnostic[];
504
- /** `<Figure>` identity checks (F-tables-figures) — same codes, `fig-` prefixed. */
505
- readonly figures: readonly FigureDiagnostic[];
607
+ /**
608
+ * `<Figure>` identity checks (F-tables-figures) — same codes, `fig-`
609
+ * prefixed — and rule V3's `lab-katex-direct`: a file a lesson imports
610
+ * that calls KaTeX itself.
611
+ */
612
+ readonly figures: readonly (FigureDiagnostic | LabKatexDiagnostic)[];
506
613
  /** `<Diagram>` identity checks — same codes, `dia-` prefixed. */
507
614
  readonly diagrams: readonly DiagramDiagnostic[];
508
615
  /** Knowledge-check identity and `[[check-…]]` reference checks. */
@@ -549,4 +656,4 @@ declare function readManifestSync(): Manifest;
549
656
  */
550
657
  declare function loadManifest(courseConfig?: CourseConfig): Promise<Manifest>;
551
658
 
552
- export { MANIFEST_PATH, MANIFEST_SCHEMA_VERSION, type Manifest, type ManifestAbout, type ManifestAssessmentItemContent, type ManifestCitation, type ManifestLesson, type ManifestLessonFloat, type ManifestLessonNotation, type ManifestNotationResolution, type ManifestPart, type ManifestTitledBlock, type PrereqEdge, compileManifest, loadManifest, readManifestSync, serializeManifest, writeManifest };
659
+ export { MANIFEST_PATH, MANIFEST_SCHEMA_VERSION, type Manifest, type ManifestAbout, type ManifestAssessmentItemContent, type ManifestCitation, type ManifestDerivedNotation, type ManifestLesson, type ManifestLessonFloat, type ManifestLessonNotation, type ManifestNotationResolution, type ManifestPage, type ManifestPart, type ManifestTitledBlock, type PrereqEdge, compileManifest, loadManifest, readManifestSync, serializeManifest, writeManifest };