explico 0.3.0 → 0.5.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 (151) hide show
  1. package/CHANGELOG.md +344 -1
  2. package/README.md +117 -3
  3. package/dist/compiler/astro.d.ts +38 -0
  4. package/dist/compiler/astro.js +258 -0
  5. package/dist/compiler/cli.d.ts +13 -0
  6. package/dist/compiler/cli.js +32 -12
  7. package/dist/compiler/collections.d.ts +3 -2
  8. package/dist/compiler/collections.js +28 -1
  9. package/dist/compiler/course-config.d.ts +86 -4
  10. package/dist/compiler/course-config.js +39 -0
  11. package/dist/compiler/exports/standalone-html.d.ts +34 -0
  12. package/dist/compiler/exports/standalone-html.js +803 -0
  13. package/dist/compiler/lesson-derivation.d.ts +1 -1
  14. package/dist/compiler/lesson-derivation.js +2 -2
  15. package/dist/compiler/manifest.d.ts +112 -7
  16. package/dist/compiler/manifest.js +205 -40
  17. package/dist/compiler/resolution-report.d.ts +4 -0
  18. package/dist/reference/base-abbreviations.d.mts +30 -0
  19. package/dist/reference/base-abbreviations.mjs +60 -0
  20. package/dist/reference/base-operators.d.mts +15 -0
  21. package/dist/reference/base-operators.mjs +40 -0
  22. package/dist/reference/base-roman-labels.d.mts +35 -0
  23. package/dist/reference/base-roman-labels.mjs +43 -0
  24. package/dist/reference/consistency.d.ts +8 -2
  25. package/dist/reference/consistency.js +50 -3
  26. package/dist/reference/diagrams-validate.d.ts +21 -0
  27. package/dist/reference/diagrams-validate.js +13 -0
  28. package/dist/reference/equations-validate.d.ts +8 -3
  29. package/dist/reference/equations-validate.js +1 -1
  30. package/dist/reference/equations.d.mts +66 -35
  31. package/dist/reference/equations.mjs +142 -40
  32. package/dist/reference/gate-abbreviations.d.ts +17 -0
  33. package/dist/reference/gate-abbreviations.js +64 -0
  34. package/dist/reference/gate-math.d.ts +28 -5
  35. package/dist/reference/gate-math.js +5 -2
  36. package/dist/reference/gate-prose-notation.d.ts +60 -0
  37. package/dist/reference/gate-prose-notation.js +125 -0
  38. package/dist/reference/keyed-float-validate.d.ts +14 -8
  39. package/dist/reference/keyed-float-validate.js +1 -1
  40. package/dist/reference/keyed-jsx-floats.d.mts +24 -21
  41. package/dist/reference/keyed-jsx-floats.mjs +90 -41
  42. package/dist/reference/knowledge-checks-validate.d.ts +35 -0
  43. package/dist/reference/knowledge-checks-validate.js +78 -0
  44. package/dist/reference/knowledge-checks.d.mts +25 -0
  45. package/dist/reference/knowledge-checks.mjs +45 -0
  46. package/dist/reference/lab-math-scope.d.ts +9 -1
  47. package/dist/reference/lab-math-scope.js +32 -4
  48. package/dist/reference/math-glyphs.d.mts +30 -0
  49. package/dist/reference/math-glyphs.mjs +367 -0
  50. package/dist/reference/mdx-attributes.d.mts +13 -0
  51. package/dist/reference/mdx-attributes.mjs +38 -0
  52. package/dist/reference/mixed-content.d.ts +17 -0
  53. package/dist/reference/mixed-content.js +29 -0
  54. package/dist/reference/page-notation.d.ts +52 -0
  55. package/dist/reference/page-notation.js +171 -0
  56. package/dist/reference/raw-floats-validate.d.ts +18 -0
  57. package/dist/reference/raw-floats-validate.js +53 -0
  58. package/dist/reference/raw-floats.d.mts +18 -0
  59. package/dist/reference/raw-floats.mjs +129 -0
  60. package/dist/reference/rehype-heading-anchors.d.mts +1 -1
  61. package/dist/reference/rehype-heading-anchors.mjs +107 -1
  62. package/dist/reference/rehype-table-header-labels.d.mts +26 -0
  63. package/dist/reference/rehype-table-header-labels.mjs +152 -0
  64. package/dist/reference/remark-abbreviations.d.mts +7 -0
  65. package/dist/reference/remark-abbreviations.mjs +174 -0
  66. package/dist/reference/remark-memo.d.mts +16 -0
  67. package/dist/reference/remark-memo.mjs +339 -0
  68. package/dist/reference/remark-notation.d.mts +102 -5
  69. package/dist/reference/remark-notation.mjs +506 -50
  70. package/dist/reference/remark-short-note.d.mts +4 -0
  71. package/dist/reference/remark-short-note.mjs +237 -0
  72. package/dist/reference/types.d.ts +16 -1
  73. package/dist/reference/units-vocab.js +4 -0
  74. package/docs/VERSIONING.md +33 -4
  75. package/docs/authoring/README.md +12 -0
  76. package/docs/authoring/agents.md +17 -2
  77. package/docs/authoring/components.md +135 -0
  78. package/docs/authoring/migrating.md +154 -7
  79. package/docs/authoring/notation.md +568 -8
  80. package/docs/authoring/structure.md +251 -0
  81. package/docs/authoring/visualizations.md +36 -3
  82. package/package.json +5 -2
  83. package/src/compiler/astro.ts +332 -0
  84. package/src/compiler/cli.ts +33 -10
  85. package/src/compiler/collections.ts +45 -4
  86. package/src/compiler/course-config.ts +131 -3
  87. package/src/compiler/exports/standalone-html.ts +963 -0
  88. package/src/compiler/lesson-derivation.ts +2 -2
  89. package/src/compiler/manifest.ts +367 -49
  90. package/src/components/HoverPanel.astro +45 -4
  91. package/src/components/abbreviation/AbbreviationGlossary.astro +70 -0
  92. package/src/components/abbreviation/AbbreviationLayer.astro +127 -0
  93. package/src/components/assessments/AssessmentRunner.tsx +52 -17
  94. package/src/components/assessments/AssessmentSet.astro +98 -14
  95. package/src/components/assessments/RenderedContent.tsx +55 -0
  96. package/src/components/assessments/assessment-randomization.ts +16 -0
  97. package/src/components/diagram/Diagram.astro +444 -83
  98. package/src/components/disclosure/hover-preview.ts +202 -0
  99. package/src/components/disclosure/persisted-disclosure.ts +66 -0
  100. package/src/components/examples/CompactExamples.astro +2 -0
  101. package/src/components/figure/Figure.astro +279 -10
  102. package/src/components/memo/Memo.astro +453 -0
  103. package/src/components/memo/ShortNote.astro +223 -0
  104. package/src/components/notation/NotationFormula.astro +18 -1
  105. package/src/components/notation/NotationLayer.astro +116 -8
  106. package/src/components/notation/render-notation-math.ts +39 -2
  107. package/src/components/notation/safe-math-to-react.ts +50 -0
  108. package/src/components/reference/FloatRefLayer.astro +233 -15
  109. package/src/components/starlight/CollapsibleSections.astro +461 -0
  110. package/src/components/starlight/DiagramEnhancer.astro +385 -0
  111. package/src/components/starlight/HeadingAnchorEnhancer.astro +5 -17
  112. package/src/components/starlight/KeyedFloatEnhancer.astro +81 -3
  113. package/src/components/starlight/LayoutHeader.astro +50 -0
  114. package/src/components/starlight/LayoutSidebar.astro +62 -1
  115. package/src/components/starlight/LayoutSocialIcons.astro +41 -2
  116. package/src/components/starlight/LessonExportActions.astro +436 -0
  117. package/src/components/starlight/LessonFooter.astro +38 -2
  118. package/src/components/starlight/section-parts.ts +31 -0
  119. package/src/components/table/Table.astro +296 -9
  120. package/src/components/table/TableOverflowExpander.astro +489 -0
  121. package/src/content-config.ts +20 -0
  122. package/src/reference/base-abbreviations.mjs +60 -0
  123. package/src/reference/base-operators.mjs +40 -0
  124. package/src/reference/base-roman-labels.mjs +43 -0
  125. package/src/reference/consistency.ts +73 -2
  126. package/src/reference/diagrams-validate.ts +40 -0
  127. package/src/reference/equations-validate.ts +6 -4
  128. package/src/reference/equations.mjs +142 -40
  129. package/src/reference/gate-abbreviations.ts +128 -0
  130. package/src/reference/gate-math.ts +27 -7
  131. package/src/reference/gate-prose-notation.ts +224 -0
  132. package/src/reference/keyed-float-validate.ts +12 -9
  133. package/src/reference/keyed-jsx-floats.mjs +90 -41
  134. package/src/reference/knowledge-checks-validate.ts +130 -0
  135. package/src/reference/knowledge-checks.mjs +45 -0
  136. package/src/reference/lab-math-scope.ts +45 -3
  137. package/src/reference/math-glyphs.mjs +367 -0
  138. package/src/reference/mdx-attributes.mjs +38 -0
  139. package/src/reference/mixed-content.ts +69 -0
  140. package/src/reference/page-notation.ts +252 -0
  141. package/src/reference/raw-floats-validate.ts +103 -0
  142. package/src/reference/raw-floats.mjs +129 -0
  143. package/src/reference/rehype-heading-anchors.mjs +107 -1
  144. package/src/reference/rehype-table-header-labels.mjs +152 -0
  145. package/src/reference/remark-abbreviations.mjs +174 -0
  146. package/src/reference/remark-memo.mjs +339 -0
  147. package/src/reference/remark-notation.mjs +506 -50
  148. package/src/reference/remark-short-note.mjs +237 -0
  149. package/src/reference/types.ts +16 -0
  150. package/src/reference/units-vocab.ts +4 -0
  151. package/src/styles/global.css +1125 -50
@@ -1,15 +1,29 @@
1
1
  # Upgrading the explico engine
2
2
 
3
- What a course repo has to change when it bumps its `explico` dependency across a
4
- version that carries **Breaking** notes. Each section is the concrete work; the
5
- matching `CHANGELOG.md` entry (shipped in the installed package) is the full
6
- list of what moved and why.
3
+ This is the agent-readable migration artifact shipped with `explico`. It lives
4
+ at `node_modules/explico/docs/authoring/migrating.md` in an installed course, so
5
+ the instructions always accompany the engine version they describe.
6
+
7
+ There is one newest-first section for **every** published version, not only for a
8
+ version whose changelog contains **Breaking** notes. A section contains the
9
+ concrete work for consumer-owned content, configuration, source wiring, scripts,
10
+ dependencies, and generated artifacts. When a release needs none of those, its
11
+ section says **No course changes required** explicitly. The matching
12
+ `CHANGELOG.md` entry (also shipped in the package) remains the full list of what
13
+ moved and why; it is context, not a replacement for these steps.
7
14
 
8
15
  The pattern every time:
9
16
 
10
- 1. `pnpm add -D explico@<version>`
11
- 2. Do the per-version steps below.
12
- 3. `pnpm validate:content` (run it **twice** — the first run regenerates
17
+ 1. Record the currently installed version before changing it:
18
+ `node -p "require('explico/package.json').version"`.
19
+ 2. `pnpm add -D explico@<version>`.
20
+ 3. Read this file from the newly installed package and apply **every** section
21
+ after the old version through the target version, oldest first. Do not skip a
22
+ section merely because its changelog entry is not labelled **Breaking**.
23
+ 4. Make every required course-side change named by those sections, including
24
+ changes under `content/`, Astro/source configuration, and course scripts; do
25
+ not stop after changing the dependency declaration.
26
+ 5. `pnpm validate:content` (run it **twice** — the first run regenerates
13
27
  `build/resolution/*` and reports it stale; the second is clean), then
14
28
  `pnpm content check --changed`, then `astro check`, then `astro build`.
15
29
  Each stage names what it doesn't like; fix and re-run.
@@ -19,6 +33,139 @@ required config block throws with the section of this file to read.
19
33
 
20
34
  ---
21
35
 
36
+ ## 0.4.x → 0.5.0
37
+
38
+ ### 1. Rule N14: catalogue every abbreviation used in lesson prose
39
+
40
+ Every acronym (`OLS`, `MSE`) or dotted abbreviation (`w.r.t.`, `i.i.d.`) used in
41
+ plain prose must now be on the shipped baseline
42
+ (`base-abbreviations.mjs`), listed in `course.config.ts`'s new
43
+ `abbreviations.allow` / `abbreviations.deny`, given an entry in the new
44
+ `content/abbreviations/*.md` collection, or already explained as a math
45
+ quantity via N8/N10. This is build-enforced, same error-severity and
46
+ no-`lint-ignore.yml`-escape-hatch shape as N9.
47
+
48
+ ```ts
49
+ export const courseConfig = {
50
+ // …existing fields…
51
+ abbreviations: {
52
+ allow: ['GDP'], // treat as universal, skip the check
53
+ deny: ['ETA'], // demote a baseline entry back to "must be explained"
54
+ },
55
+ } satisfies CourseConfig;
56
+ ```
57
+
58
+ ```markdown
59
+ ---
60
+ key: ols
61
+ abbr: OLS
62
+ expansion: Ordinary least squares
63
+ aliases: []
64
+ ---
65
+ ```
66
+
67
+ Run `pnpm validate:content` (twice) and `pnpm content check --changed`. Fix
68
+ every `abbreviation-explained` diagnostic by adding a
69
+ `content/abbreviations/<key>.md` entry or an `allow` entry in
70
+ `course.config.ts`.
71
+
72
+ ### 2. Manifest schema is v13 (additive: v10 → v11 → v12 → v13)
73
+
74
+ `lessons[].lessonExports`-derived fields (v11), `manifest.abbreviations` (v12),
75
+ and `manifest.diagnostics.rawFloats` (v13) are new. A client asserting on
76
+ `MANIFEST_SCHEMA_VERSION` by exact equality needs the bump; nothing existing
77
+ changed shape.
78
+
79
+ ### 3. Optional: enable standalone HTML / print lesson exports
80
+
81
+ No action required to keep building. To opt in, add to
82
+ `content/course.config.ts`:
83
+
84
+ ```ts
85
+ lessonExports: {
86
+ standaloneHtml: true,
87
+ print: true,
88
+ },
89
+ canonicalBaseUrl: 'https://your-course.example.com',
90
+ ```
91
+
92
+ ### 4. Optional: turn on strict numbering cross-checks
93
+
94
+ `remarkNotation`'s new `strict: true` option — recommended via
95
+ `createRemarkNotationOptions(manifest, { strict: true })` — fails the build on
96
+ any catalogued lesson that has an equation, `<Table>`, or `<Figure>` (keyed or
97
+ not) with no placement, instead of silently falling back to legacy `##`-section
98
+ numbering. Off by default; turn it on once existing content is clean.
99
+
100
+ ### Verification
101
+
102
+ `pnpm validate:content` (run it twice), then `pnpm content check --changed`,
103
+ then `astro check`, then `astro build`.
104
+
105
+ ---
106
+
107
+ ## 0.3.x → 0.4.0
108
+
109
+ ### 1. Rename `sections` to `parts` in `content/course.config.ts`
110
+
111
+ A sidebar group is now a **part** — "section" only ever means an `##` heading
112
+ inside a lesson. See [`structure.md`](structure.md) for the full taxonomy.
113
+
114
+ ```diff
115
+ - sections: [
116
+ + parts: [
117
+ { dir: 'foundations', label: 'Foundations' },
118
+ { dir: 'bonds', label: 'Bonds' },
119
+ ],
120
+ ```
121
+
122
+ `sections` is still read, so this is not urgent; it is removed in the next
123
+ MINOR release.
124
+
125
+ ### 2. Pass the manifest to `remarkNotation`
126
+
127
+ Replace the individual numbering options with the manifest itself. This is what
128
+ guarantees the number a page prints and the number a reference to it prints are
129
+ computed from the same inputs — supplying one without the other is what made an
130
+ equation read `(2.2)` on its own page and `(4.5)` everywhere else.
131
+
132
+ ```diff
133
+ [remarkNotation, {
134
+ definitions: manifest.notation.raw,
135
+ - equations: manifest.equations.numbersBySlug,
136
+ + manifest,
137
+ base: publicBase,
138
+ }],
139
+ ```
140
+
141
+ The engine now cross-checks the two and **fails the build** when they disagree,
142
+ so a config left half-wired errors instead of shipping wrong numbers.
143
+
144
+ ### 3. Expect every equation, table, and figure number to change
145
+
146
+ Numbers are now `‹part›.‹n›`: the prefix is the part's ordinal, and `n` runs
147
+ across the whole part rather than restarting on each page. A course whose
148
+ lessons were chapters 1…16 now has as many prefixes as it has sidebar groups.
149
+
150
+ Nothing in `content/` needs editing — numbers were never hand-typed, and every
151
+ `[[eq-key]]` / `[[slug#eq-key]]` reference keeps resolving. Two things to check:
152
+
153
+ - **Prose that spells a number out** ("as equation 4.5 showed") was already
154
+ against rule N-references; find it with `grep -rnE '\((1?[0-9])\.[0-9]+\)'
155
+ content/` and convert it to a `[[eq-key]]` reference.
156
+ - **External links to a positional anchor** (`#eq-2-4`, an *unkeyed* equation)
157
+ now point elsewhere. Keyed anchors (`#eq-<key>`) are stable and unaffected —
158
+ give an equation a `\label{eq:…}` if you need to link to it from outside.
159
+
160
+ ### 4. Manifest schema is v7
161
+
162
+ `lessons[].part` is new; `lessons[].chapter` now means the lesson's ordinal
163
+ *within its part*, not down the whole course; `lessons[].numbering` carries the
164
+ running float counts each chapter starts from. A client asserting on
165
+ `MANIFEST_SCHEMA_VERSION` needs the bump.
166
+
167
+ ---
168
+
22
169
  ## 0.2.x → 0.3.0
23
170
 
24
171
  ### 1. Add the required `about` block to `content/course.config.ts`