explico 0.12.0 → 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.
- package/CHANGELOG.md +1122 -1
- package/README.md +91 -13
- package/dist/compiler/astro.d.ts +4 -3
- package/dist/compiler/astro.js +45 -15
- package/dist/compiler/cli.d.ts +26 -12
- package/dist/compiler/cli.js +96 -25
- package/dist/compiler/collections.d.ts +9 -1
- package/dist/compiler/collections.js +55 -16
- package/dist/compiler/content-schema.d.ts +31 -0
- package/dist/compiler/content-schema.js +82 -0
- package/dist/compiler/content-schemas.d.ts +422 -0
- package/dist/compiler/content-schemas.js +229 -0
- package/dist/compiler/course-config.d.ts +1 -1
- package/dist/compiler/course-config.js +30 -2
- package/dist/compiler/exports/combined-html.d.ts +97 -0
- package/dist/compiler/exports/combined-html.js +492 -0
- package/dist/compiler/exports/download-index.d.ts +9 -0
- package/dist/compiler/exports/download-index.js +33 -0
- package/dist/compiler/exports/export-chapters.d.ts +98 -0
- package/dist/compiler/exports/export-chapters.js +164 -0
- package/dist/compiler/exports/export-pages.d.ts +48 -0
- package/dist/compiler/exports/export-pages.js +22 -0
- package/dist/compiler/exports/html-tree.d.ts +22 -0
- package/dist/compiler/exports/html-tree.js +47 -0
- package/dist/compiler/exports/latex/capture.d.ts +106 -0
- package/dist/compiler/exports/latex/capture.js +435 -0
- package/dist/compiler/exports/latex/compile.d.ts +73 -0
- package/dist/compiler/exports/latex/compile.js +115 -0
- package/dist/compiler/exports/latex/document.d.ts +102 -0
- package/dist/compiler/exports/latex/document.js +349 -0
- package/dist/compiler/exports/latex/explico.cls +415 -0
- package/dist/compiler/exports/latex/numbering.d.ts +18 -0
- package/dist/compiler/exports/latex/numbering.js +57 -0
- package/dist/compiler/exports/latex/serialize.d.ts +112 -0
- package/dist/compiler/exports/latex/serialize.js +606 -0
- package/dist/compiler/exports/latex-export.d.ts +44 -0
- package/dist/compiler/exports/latex-export.js +169 -0
- package/dist/compiler/exports/markdown/serialize.d.ts +51 -0
- package/dist/compiler/exports/markdown/serialize.js +527 -0
- package/dist/compiler/exports/markdown-export.d.ts +39 -0
- package/dist/compiler/exports/markdown-export.js +240 -0
- package/dist/compiler/exports/standalone-html.d.ts +14 -5
- package/dist/compiler/exports/standalone-html.js +23 -51
- package/dist/compiler/exports/static-tree.d.ts +253 -0
- package/dist/compiler/exports/static-tree.js +625 -0
- package/dist/compiler/exports/zip.d.ts +16 -0
- package/dist/compiler/exports/zip.js +72 -0
- package/dist/compiler/lesson-derivation.d.ts +8 -2
- package/dist/compiler/lesson-derivation.js +6 -7
- package/dist/compiler/manifest.d.ts +87 -6
- package/dist/compiler/manifest.js +174 -31
- package/dist/compiler/render-diagnostics.d.ts +65 -0
- package/dist/compiler/render-diagnostics.js +56 -0
- package/dist/compiler/resolution-report.d.ts +2 -1
- package/dist/{course-config-Dsnri9Tk.d.ts → course-config-rRtME5UV.d.ts} +56 -13
- package/dist/curriculum/validation.d.ts +9 -3
- package/dist/curriculum/validation.js +35 -17
- package/dist/reference/base-abbreviations.d.mts +2 -2
- package/dist/reference/base-abbreviations.mjs +2 -2
- package/dist/reference/base-operators.d.mts +2 -2
- package/dist/reference/base-operators.mjs +2 -2
- package/dist/reference/base-roman-labels.d.mts +4 -3
- package/dist/reference/base-roman-labels.mjs +4 -3
- package/dist/reference/citation-format.d.mts +35 -0
- package/dist/reference/citation-format.mjs +74 -0
- package/dist/reference/consistency.d.ts +5 -9
- package/dist/reference/consistency.js +34 -38
- package/dist/reference/curriculum-alignment.js +3 -24
- package/dist/reference/derived-entries.d.ts +45 -0
- package/dist/reference/derived-entries.js +50 -0
- package/dist/reference/derived-notation.d.mts +125 -0
- package/dist/reference/derived-notation.mjs +121 -0
- package/dist/reference/diagram-fit.d.ts +45 -0
- package/dist/reference/diagram-fit.js +54 -0
- package/dist/reference/diagram-layout.d.ts +59 -10
- package/dist/reference/diagram-layout.js +85 -24
- package/dist/reference/diagrams-validate.d.ts +1 -1
- package/dist/reference/equations-validate.d.ts +1 -1
- package/dist/reference/equations-validate.js +26 -1
- package/dist/reference/equations.d.mts +27 -0
- package/dist/reference/equations.mjs +120 -22
- package/dist/reference/examples-validate.d.ts +1 -1
- package/dist/reference/figure-fit.d.ts +70 -0
- package/dist/reference/figure-fit.js +60 -0
- package/dist/reference/figure-pictures.d.ts +27 -0
- package/dist/reference/figure-pictures.js +49 -0
- package/dist/reference/figures-validate.d.ts +1 -1
- package/dist/reference/gate-abbreviations.d.ts +1 -1
- package/dist/reference/gate-abbreviations.js +1 -1
- package/dist/reference/gate-course-rules.d.ts +4 -3
- package/dist/reference/gate-course-rules.js +9 -4
- package/dist/reference/gate-heading-length.d.ts +2 -0
- package/dist/reference/gate-heading-length.js +7 -5
- package/dist/reference/gate-heading-structure.js +26 -0
- package/dist/reference/gate-indices.d.ts +35 -0
- package/dist/reference/gate-indices.js +299 -0
- package/dist/reference/gate-math.d.ts +32 -2
- package/dist/reference/gate-math.js +68 -12
- package/dist/reference/gate-mdx-expression.d.ts +17 -0
- package/dist/reference/gate-mdx-expression.js +29 -0
- package/dist/reference/gate-part-pages.d.ts +1 -1
- package/dist/reference/gate-prop-text.d.ts +28 -0
- package/dist/reference/gate-prop-text.js +106 -0
- package/dist/reference/gate-prose-notation.d.ts +3 -1
- package/dist/reference/gate-prose-notation.js +4 -2
- package/dist/reference/gate-retired-keys.d.ts +35 -0
- package/dist/reference/gate-retired-keys.js +58 -0
- package/dist/reference/gloss.d.ts +2 -0
- package/dist/reference/katex-measure.d.ts +17 -0
- package/dist/reference/katex-measure.js +223 -0
- package/dist/reference/keyed-float-validate.js +12 -0
- package/dist/reference/keyed-jsx-floats.d.mts +2 -2
- package/dist/reference/keyed-jsx-floats.mjs +11 -14
- package/dist/reference/lab-math-scope.d.ts +1 -0
- package/dist/reference/lab-math-scope.js +13 -2
- package/dist/reference/math-glyphs.d.mts +94 -2
- package/dist/reference/math-glyphs.mjs +851 -46
- package/dist/reference/mixed-content.d.ts +8 -3
- package/dist/reference/mixed-content.js +4 -2
- package/dist/reference/page-notation.d.ts +34 -4
- package/dist/reference/page-notation.js +54 -2
- package/dist/reference/references.d.ts +11 -1
- package/dist/reference/references.js +6 -0
- package/dist/reference/registry.js +104 -10
- package/dist/reference/rehype-fail-katex-errors.d.mts +9 -0
- package/dist/reference/rehype-fail-katex-errors.mjs +19 -0
- package/dist/reference/rehype-heading-anchors.mjs +11 -1
- package/dist/reference/remark-citation.mjs +0 -0
- package/dist/reference/remark-notation.mjs +84 -20
- package/dist/reference/render-lab-math.d.ts +2 -0
- package/dist/reference/render-lab-math.js +17 -5
- package/dist/reference/sections-validate.d.ts +28 -3
- package/dist/reference/sections-validate.js +31 -4
- package/dist/reference/sections.d.mts +24 -6
- package/dist/reference/sections.mjs +92 -17
- package/dist/reference/tables-validate.d.ts +1 -1
- package/dist/reference/tables-validate.js +24 -1
- package/dist/reference/text-measure.d.ts +10 -0
- package/dist/reference/text-measure.js +41 -0
- package/dist/reference/text-widths.d.ts +10 -0
- package/dist/reference/text-widths.js +1238 -0
- package/dist/reference/types.d.ts +64 -8
- package/dist/rules/catalog.js +191 -30
- package/dist/rules/in-effect.d.ts +1 -1
- package/dist/rules/rules.schema.json +79 -24
- package/dist/rules/settings.d.ts +1 -1
- package/dist/rules/settings.js +7 -0
- package/dist/session/PreferenceStore.d.ts +18 -1
- package/dist/session/PreferenceStore.js +29 -1
- package/docs/authoring/README.md +32 -21
- package/docs/authoring/agents.md +38 -7
- package/docs/authoring/components.md +111 -6
- package/docs/authoring/migrating.md +663 -0
- package/docs/authoring/notation.md +281 -29
- package/docs/authoring/retired.md +1 -0
- package/docs/authoring/structure-rules.md +10 -41
- package/docs/authoring/structure.md +53 -2
- package/docs/authoring/visualizations.md +144 -18
- package/package.json +12 -7
- package/src/compiler/astro.ts +57 -17
- package/src/compiler/cli.ts +143 -35
- package/src/compiler/collections.ts +92 -19
- package/src/compiler/content-schema.ts +108 -0
- package/src/compiler/content-schemas.ts +391 -0
- package/src/compiler/course-config.ts +86 -15
- package/src/compiler/exports/combined-html.ts +669 -0
- package/src/compiler/exports/download-index.ts +36 -0
- package/src/compiler/exports/export-chapters.ts +233 -0
- package/src/compiler/exports/export-pages.ts +44 -0
- package/src/compiler/exports/html-tree.ts +62 -0
- package/src/compiler/exports/latex/capture.ts +651 -0
- package/src/compiler/exports/latex/compile.ts +168 -0
- package/src/compiler/exports/latex/document.ts +479 -0
- package/src/compiler/exports/latex/explico.cls +415 -0
- package/src/compiler/exports/latex/numbering.ts +74 -0
- package/src/compiler/exports/latex/serialize.ts +787 -0
- package/src/compiler/exports/latex/texlive-packages.txt +76 -0
- package/src/compiler/exports/latex-export.ts +255 -0
- package/src/compiler/exports/markdown/serialize.ts +632 -0
- package/src/compiler/exports/markdown-export.ts +329 -0
- package/src/compiler/exports/standalone-html.ts +39 -70
- package/src/compiler/exports/static-tree.ts +944 -0
- package/src/compiler/exports/zip.ts +88 -0
- package/src/compiler/lesson-derivation.ts +13 -8
- package/src/compiler/manifest.ts +299 -28
- package/src/compiler/render-diagnostics.ts +111 -0
- package/src/components/HoverPanel.astro +204 -6
- package/src/components/PartOverview.astro +12 -9
- package/src/components/abbreviation/AbbreviationLayer.astro +21 -12
- package/src/components/assessments/AssessmentRunner.tsx +7 -1
- package/src/components/assessments/AssessmentSet.astro +14 -1
- package/src/components/block-heading.ts +38 -0
- package/src/components/card-arrow.ts +18 -4
- package/src/components/card-carry.ts +406 -0
- package/src/components/card-drag.ts +1 -30
- package/src/components/card-fetch.ts +87 -0
- package/src/components/card-manager.ts +1222 -38
- package/src/components/card-memory.ts +5 -1
- package/src/components/card-placement.ts +211 -13
- package/src/components/card-side.ts +281 -31
- package/src/components/citation/CitationLayer.astro +45 -40
- package/src/components/diagram/Diagram.astro +123 -44
- package/src/components/figure/Figure.astro +11 -0
- package/src/components/figure/FloatCaption.astro +4 -17
- package/src/components/float-toolbar.ts +274 -0
- package/src/components/memo/Memo.astro +21 -10
- package/src/components/memo/ShortNote.astro +4 -0
- package/src/components/notation/NotationGlossary.astro +22 -17
- package/src/components/notation/NotationLayer.astro +300 -79
- package/src/components/notation/NotationMath.astro +8 -1
- package/src/components/notation/render-notation-math.ts +51 -5
- package/src/components/readable-text.ts +25 -0
- package/src/components/reference/FloatRefLayer.astro +162 -89
- package/src/components/starlight/HeadingAnchorEnhancer.astro +13 -8
- package/src/components/starlight/KeyedFloatEnhancer.astro +28 -9
- package/src/components/starlight/LayoutPageSidebar.astro +17 -3
- package/src/components/starlight/LayoutSocialIcons.astro +79 -29
- package/src/components/starlight/LessonExportActions.astro +384 -310
- package/src/components/starlight/LessonFooter.astro +47 -9
- package/src/components/starlight/PrintController.astro +28 -0
- package/src/components/starlight/TextSizeControl.astro +137 -0
- package/src/components/starlight/print-controller.ts +380 -0
- package/src/components/starlight/section-summary.ts +13 -5
- package/src/components/table/Table.astro +13 -21
- package/src/components/table/table-truncation.ts +15 -0
- package/src/content-config.ts +20 -312
- package/src/curriculum/validation.ts +72 -24
- package/src/reference/base-abbreviations.mjs +2 -2
- package/src/reference/base-operators.mjs +2 -2
- package/src/reference/base-roman-labels.mjs +4 -3
- package/src/reference/citation-format.mjs +74 -0
- package/src/reference/consistency.ts +47 -61
- package/src/reference/curriculum-alignment.ts +4 -41
- package/src/reference/derived-entries.ts +68 -0
- package/src/reference/derived-notation.mjs +121 -0
- package/src/reference/diagram-fit.ts +104 -0
- package/src/reference/diagram-layout.ts +182 -51
- package/src/reference/diagrams-validate.ts +2 -1
- package/src/reference/equations-validate.ts +41 -2
- package/src/reference/equations.mjs +120 -22
- package/src/reference/examples-validate.ts +1 -0
- package/src/reference/figure-fit.ts +139 -0
- package/src/reference/figure-pictures.ts +96 -0
- package/src/reference/figures-validate.ts +2 -1
- package/src/reference/gate-abbreviations.ts +1 -1
- package/src/reference/gate-course-rules.ts +22 -7
- package/src/reference/gate-heading-length.ts +25 -7
- package/src/reference/gate-heading-structure.ts +40 -1
- package/src/reference/gate-indices.ts +470 -0
- package/src/reference/gate-math.ts +102 -13
- package/src/reference/gate-mdx-expression.ts +45 -0
- package/src/reference/gate-prop-text.ts +145 -0
- package/src/reference/gate-prose-notation.ts +19 -5
- package/src/reference/gate-retired-keys.ts +101 -0
- package/src/reference/gloss.ts +2 -0
- package/src/reference/katex-measure.ts +384 -0
- package/src/reference/keyed-float-validate.ts +22 -0
- package/src/reference/keyed-jsx-floats.mjs +11 -14
- package/src/reference/lab-math-scope.ts +15 -1
- package/src/reference/math-glyphs.mjs +851 -46
- package/src/reference/mixed-content.ts +11 -2
- package/src/reference/page-notation.ts +100 -3
- package/src/reference/references.ts +14 -0
- package/src/reference/registry.ts +154 -8
- package/src/reference/rehype-fail-katex-errors.mjs +19 -0
- package/src/reference/rehype-heading-anchors.mjs +11 -1
- package/src/reference/remark-citation.mjs +0 -0
- package/src/reference/remark-notation.mjs +84 -20
- package/src/reference/render-lab-math.ts +29 -5
- package/src/reference/sections-validate.ts +67 -3
- package/src/reference/sections.mjs +92 -17
- package/src/reference/tables-validate.ts +40 -2
- package/src/reference/text-measure.ts +63 -0
- package/src/reference/text-widths.ts +133 -0
- package/src/reference/types.ts +75 -8
- package/src/rules/catalog.ts +205 -29
- package/src/rules/settings.ts +10 -0
- package/src/session/PreferenceStore.ts +53 -0
- package/src/styles/global.css +291 -75
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The content collections' schemas, one definition for both readers of
|
|
5
|
+
* `content/`: Astro's collections (`src/content-config.ts`, which wraps each
|
|
6
|
+
* in `defineCollection`) and the manifest walk, which checks every record
|
|
7
|
+
* against the same schema (`content-schema.ts`, `validateContentSchemas`) so
|
|
8
|
+
* `pnpm validate:content` rejects what `astro build` would.
|
|
9
|
+
*
|
|
10
|
+
* Plain zod only — no `astro:content` — so the manifest can import it outside
|
|
11
|
+
* Vite.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const contentId: z.ZodString;
|
|
15
|
+
/**
|
|
16
|
+
* Notation `meaning` / `summary`: plain prose (no `$`, `\`, backticks), and —
|
|
17
|
+
* the C1b safeguard — substantive, not a placeholder. A short or blocklisted
|
|
18
|
+
* phrase fails the build so a local symbol cannot get a glossary-style panel
|
|
19
|
+
* for a throwaway definition.
|
|
20
|
+
*/
|
|
21
|
+
declare const notationProse: z.ZodString;
|
|
22
|
+
/** An index entry's latex: a subscript on an empty group, `{}_0`. */
|
|
23
|
+
declare function isIndexEntryLatex(latex: string): boolean;
|
|
24
|
+
declare const notationEntryShape: z.ZodObject<{
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
latex: z.ZodString;
|
|
27
|
+
meaning: z.ZodString;
|
|
28
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
29
|
+
units: z.ZodOptional<z.ZodString>;
|
|
30
|
+
dimensionless: z.ZodOptional<z.ZodLiteral<true>>;
|
|
31
|
+
seeAlso: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
locator: z.ZodString;
|
|
35
|
+
}, z.core.$strip>]>>>;
|
|
36
|
+
alignment: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"competency">;
|
|
38
|
+
introducedByCompetency: z.ZodString;
|
|
39
|
+
introducedInLesson: z.ZodString;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"general">;
|
|
42
|
+
rationale: z.ZodString;
|
|
43
|
+
}, z.core.$strip>], "kind">>;
|
|
44
|
+
label: z.ZodOptional<z.ZodString>;
|
|
45
|
+
glosses: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
46
|
+
latex: z.ZodString;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
units: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
reads: z.ZodOptional<z.ZodString>;
|
|
51
|
+
range: z.ZodOptional<z.ZodString>;
|
|
52
|
+
fixedIndex: z.ZodOptional<z.ZodLiteral<true>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
/**
|
|
55
|
+
* Lesson frontmatter — reduced shape (Phase C1 schema, C2 codemod applied):
|
|
56
|
+
* the fields explico adds to Starlight's own (`title`, `description`, …).
|
|
57
|
+
*
|
|
58
|
+
* Authored: `teaches` (ordered — the curriculum contract, never derived),
|
|
59
|
+
* `assumptions`, `studyMinutes` (optional reader-facing estimate),
|
|
60
|
+
* `notation.local` (page-local symbols only).
|
|
61
|
+
* Derived (in `compiler/collections.ts` + `compiler/lesson-derivation.ts`,
|
|
62
|
+
* never authored): `lessonId` (doc slug), `requires` (direct
|
|
63
|
+
* competency-DAG prerequisites of `teaches`, minus `teaches`),
|
|
64
|
+
* `sources` (`[@…]` occurrences), `assessments` (colocated
|
|
65
|
+
* `<lesson>.checks.yml`), `sidebar` order (track order).
|
|
66
|
+
* Dropped: `aiAssisted`, `lastReviewed`, `riskTier` (git history carries
|
|
67
|
+
* provenance); `editorialStatus`, the draft / in-review / reviewed
|
|
68
|
+
* flag, because lessons are reviewed continuously and never earn a
|
|
69
|
+
* one-time stamp (a file that still sets it fails the build, see
|
|
70
|
+
* `reference/gate-retired-keys.ts`); `estimatedMinutes`, whose
|
|
71
|
+
* reader-facing half returned as the optional `studyMinutes` once
|
|
72
|
+
* part pages had somewhere to total it; `notation.uses` (D3 — a
|
|
73
|
+
* shared symbol is imported by using it).
|
|
74
|
+
*/
|
|
75
|
+
declare const lessonFrontmatterSchema: z.ZodObject<{
|
|
76
|
+
teaches: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
77
|
+
assumptions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
78
|
+
studyMinutes: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>>;
|
|
79
|
+
notation: z.ZodDefault<z.ZodObject<{
|
|
80
|
+
local: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
81
|
+
key: z.ZodString;
|
|
82
|
+
latex: z.ZodString;
|
|
83
|
+
meaning: z.ZodString;
|
|
84
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
85
|
+
units: z.ZodOptional<z.ZodString>;
|
|
86
|
+
dimensionless: z.ZodOptional<z.ZodLiteral<true>>;
|
|
87
|
+
seeAlso: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
88
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
locator: z.ZodString;
|
|
91
|
+
}, z.core.$strip>]>>>;
|
|
92
|
+
alignment: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"competency">;
|
|
94
|
+
introducedByCompetency: z.ZodString;
|
|
95
|
+
introducedInLesson: z.ZodString;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"general">;
|
|
98
|
+
rationale: z.ZodString;
|
|
99
|
+
}, z.core.$strip>], "kind">>;
|
|
100
|
+
label: z.ZodOptional<z.ZodString>;
|
|
101
|
+
glosses: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
102
|
+
latex: z.ZodString;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
units: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>>>;
|
|
106
|
+
reads: z.ZodOptional<z.ZodString>;
|
|
107
|
+
range: z.ZodOptional<z.ZodString>;
|
|
108
|
+
fixedIndex: z.ZodOptional<z.ZodLiteral<true>>;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
suspend: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
111
|
+
operator: z.ZodString;
|
|
112
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
declare const competencySchema: z.ZodObject<{
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
title: z.ZodString;
|
|
119
|
+
domain: z.ZodString;
|
|
120
|
+
facet: z.ZodEnum<{
|
|
121
|
+
knowledge: "knowledge";
|
|
122
|
+
calculation: "calculation";
|
|
123
|
+
interpretation: "interpretation";
|
|
124
|
+
convention: "convention";
|
|
125
|
+
risk: "risk";
|
|
126
|
+
}>;
|
|
127
|
+
outcome: z.ZodString;
|
|
128
|
+
prerequisites: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
129
|
+
evidence: z.ZodObject<{
|
|
130
|
+
minimumIndependentItems: z.ZodNumber;
|
|
131
|
+
requiresTransfer: z.ZodBoolean;
|
|
132
|
+
requiresUnassistedPass: z.ZodBoolean;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
misconceptions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
declare const assessmentSchema: z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
title: z.ZodString;
|
|
139
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
competencyId: z.ZodString;
|
|
142
|
+
evidenceKind: z.ZodEnum<{
|
|
143
|
+
direct: "direct";
|
|
144
|
+
transfer: "transfer";
|
|
145
|
+
}>;
|
|
146
|
+
prompt: z.ZodString;
|
|
147
|
+
explanation: z.ZodString;
|
|
148
|
+
type: z.ZodLiteral<"numeric">;
|
|
149
|
+
answer: z.ZodObject<{
|
|
150
|
+
value: z.ZodNumber;
|
|
151
|
+
tolerance: z.ZodNumber;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
154
|
+
id: z.ZodString;
|
|
155
|
+
competencyId: z.ZodString;
|
|
156
|
+
evidenceKind: z.ZodEnum<{
|
|
157
|
+
direct: "direct";
|
|
158
|
+
transfer: "transfer";
|
|
159
|
+
}>;
|
|
160
|
+
prompt: z.ZodString;
|
|
161
|
+
explanation: z.ZodString;
|
|
162
|
+
type: z.ZodLiteral<"single-choice">;
|
|
163
|
+
options: z.ZodArray<z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
label: z.ZodString;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
correctOptionId: z.ZodString;
|
|
168
|
+
}, z.core.$strip>], "type">>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
declare const trackSchema: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
title: z.ZodString;
|
|
173
|
+
description: z.ZodString;
|
|
174
|
+
audience: z.ZodString;
|
|
175
|
+
entryAssumptions: z.ZodArray<z.ZodString>;
|
|
176
|
+
lessons: z.ZodArray<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
declare const sourceSchema: z.ZodObject<{
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
type: z.ZodEnum<{
|
|
181
|
+
primary: "primary";
|
|
182
|
+
"official-guidance": "official-guidance";
|
|
183
|
+
paper: "paper";
|
|
184
|
+
book: "book";
|
|
185
|
+
secondary: "secondary";
|
|
186
|
+
}>;
|
|
187
|
+
title: z.ZodString;
|
|
188
|
+
authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
189
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
190
|
+
edition: z.ZodOptional<z.ZodString>;
|
|
191
|
+
publisher: z.ZodOptional<z.ZodString>;
|
|
192
|
+
year: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
isbn: z.ZodOptional<z.ZodString>;
|
|
194
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
195
|
+
locator: z.ZodOptional<z.ZodString>;
|
|
196
|
+
accessed: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
197
|
+
licenseNotes: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
/**
|
|
200
|
+
* Standalone notation collection — the one `notationEntry` shape plus the
|
|
201
|
+
* shared-only extras: `domain`, `aliases`, and a Markdown body.
|
|
202
|
+
*/
|
|
203
|
+
declare const notationSchema: z.ZodObject<{
|
|
204
|
+
key: z.ZodString;
|
|
205
|
+
latex: z.ZodString;
|
|
206
|
+
meaning: z.ZodString;
|
|
207
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
208
|
+
units: z.ZodOptional<z.ZodString>;
|
|
209
|
+
dimensionless: z.ZodOptional<z.ZodLiteral<true>>;
|
|
210
|
+
seeAlso: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
211
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
212
|
+
id: z.ZodString;
|
|
213
|
+
locator: z.ZodString;
|
|
214
|
+
}, z.core.$strip>]>>>;
|
|
215
|
+
alignment: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
216
|
+
kind: z.ZodLiteral<"competency">;
|
|
217
|
+
introducedByCompetency: z.ZodString;
|
|
218
|
+
introducedInLesson: z.ZodString;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
kind: z.ZodLiteral<"general">;
|
|
221
|
+
rationale: z.ZodString;
|
|
222
|
+
}, z.core.$strip>], "kind">>;
|
|
223
|
+
label: z.ZodOptional<z.ZodString>;
|
|
224
|
+
glosses: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
225
|
+
latex: z.ZodString;
|
|
226
|
+
name: z.ZodString;
|
|
227
|
+
units: z.ZodOptional<z.ZodString>;
|
|
228
|
+
}, z.core.$strip>>>;
|
|
229
|
+
reads: z.ZodOptional<z.ZodString>;
|
|
230
|
+
range: z.ZodOptional<z.ZodString>;
|
|
231
|
+
fixedIndex: z.ZodOptional<z.ZodLiteral<true>>;
|
|
232
|
+
domain: z.ZodString;
|
|
233
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
234
|
+
aiAssisted: z.ZodDefault<z.ZodBoolean>;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
/**
|
|
237
|
+
* Abbreviations table (rule N14) — deliberately a lighter tier than a
|
|
238
|
+
* `notation` card: just a name resolution, no `formula`, `units`, or
|
|
239
|
+
* curriculum `alignment`. `abbr` is the canonical written form (`OLS`);
|
|
240
|
+
* `aliases` are other written forms of the same abbreviation that should
|
|
241
|
+
* resolve the same way (`w.r.t.` might alias `wrt`).
|
|
242
|
+
*/
|
|
243
|
+
declare const abbreviationSchema: z.ZodObject<{
|
|
244
|
+
key: z.ZodString;
|
|
245
|
+
abbr: z.ZodString;
|
|
246
|
+
expansion: z.ZodString;
|
|
247
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
248
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
/**
|
|
251
|
+
* Each collection's directory under `content/` and the schema a record there
|
|
252
|
+
* must satisfy. `docs` checks only the fields explico adds; Starlight's own
|
|
253
|
+
* (`title`, `description`, …) are Starlight's schema's to judge.
|
|
254
|
+
*/
|
|
255
|
+
declare const CONTENT_SCHEMAS: {
|
|
256
|
+
readonly docs: z.ZodObject<{
|
|
257
|
+
teaches: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
258
|
+
assumptions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
259
|
+
studyMinutes: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>>;
|
|
260
|
+
notation: z.ZodDefault<z.ZodObject<{
|
|
261
|
+
local: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
262
|
+
key: z.ZodString;
|
|
263
|
+
latex: z.ZodString;
|
|
264
|
+
meaning: z.ZodString;
|
|
265
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
266
|
+
units: z.ZodOptional<z.ZodString>;
|
|
267
|
+
dimensionless: z.ZodOptional<z.ZodLiteral<true>>;
|
|
268
|
+
seeAlso: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
269
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
270
|
+
id: z.ZodString;
|
|
271
|
+
locator: z.ZodString;
|
|
272
|
+
}, z.core.$strip>]>>>;
|
|
273
|
+
alignment: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
274
|
+
kind: z.ZodLiteral<"competency">;
|
|
275
|
+
introducedByCompetency: z.ZodString;
|
|
276
|
+
introducedInLesson: z.ZodString;
|
|
277
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
278
|
+
kind: z.ZodLiteral<"general">;
|
|
279
|
+
rationale: z.ZodString;
|
|
280
|
+
}, z.core.$strip>], "kind">>;
|
|
281
|
+
label: z.ZodOptional<z.ZodString>;
|
|
282
|
+
glosses: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
283
|
+
latex: z.ZodString;
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
units: z.ZodOptional<z.ZodString>;
|
|
286
|
+
}, z.core.$strip>>>;
|
|
287
|
+
reads: z.ZodOptional<z.ZodString>;
|
|
288
|
+
range: z.ZodOptional<z.ZodString>;
|
|
289
|
+
fixedIndex: z.ZodOptional<z.ZodLiteral<true>>;
|
|
290
|
+
}, z.core.$strip>>>;
|
|
291
|
+
suspend: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
292
|
+
operator: z.ZodString;
|
|
293
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, z.core.$strip>>>;
|
|
295
|
+
}, z.core.$strip>>;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
readonly competencies: z.ZodObject<{
|
|
298
|
+
id: z.ZodString;
|
|
299
|
+
title: z.ZodString;
|
|
300
|
+
domain: z.ZodString;
|
|
301
|
+
facet: z.ZodEnum<{
|
|
302
|
+
knowledge: "knowledge";
|
|
303
|
+
calculation: "calculation";
|
|
304
|
+
interpretation: "interpretation";
|
|
305
|
+
convention: "convention";
|
|
306
|
+
risk: "risk";
|
|
307
|
+
}>;
|
|
308
|
+
outcome: z.ZodString;
|
|
309
|
+
prerequisites: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
310
|
+
evidence: z.ZodObject<{
|
|
311
|
+
minimumIndependentItems: z.ZodNumber;
|
|
312
|
+
requiresTransfer: z.ZodBoolean;
|
|
313
|
+
requiresUnassistedPass: z.ZodBoolean;
|
|
314
|
+
}, z.core.$strip>;
|
|
315
|
+
misconceptions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
316
|
+
}, z.core.$strip>;
|
|
317
|
+
readonly assessments: z.ZodObject<{
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
title: z.ZodString;
|
|
320
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
321
|
+
id: z.ZodString;
|
|
322
|
+
competencyId: z.ZodString;
|
|
323
|
+
evidenceKind: z.ZodEnum<{
|
|
324
|
+
direct: "direct";
|
|
325
|
+
transfer: "transfer";
|
|
326
|
+
}>;
|
|
327
|
+
prompt: z.ZodString;
|
|
328
|
+
explanation: z.ZodString;
|
|
329
|
+
type: z.ZodLiteral<"numeric">;
|
|
330
|
+
answer: z.ZodObject<{
|
|
331
|
+
value: z.ZodNumber;
|
|
332
|
+
tolerance: z.ZodNumber;
|
|
333
|
+
}, z.core.$strip>;
|
|
334
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
335
|
+
id: z.ZodString;
|
|
336
|
+
competencyId: z.ZodString;
|
|
337
|
+
evidenceKind: z.ZodEnum<{
|
|
338
|
+
direct: "direct";
|
|
339
|
+
transfer: "transfer";
|
|
340
|
+
}>;
|
|
341
|
+
prompt: z.ZodString;
|
|
342
|
+
explanation: z.ZodString;
|
|
343
|
+
type: z.ZodLiteral<"single-choice">;
|
|
344
|
+
options: z.ZodArray<z.ZodObject<{
|
|
345
|
+
id: z.ZodString;
|
|
346
|
+
label: z.ZodString;
|
|
347
|
+
}, z.core.$strip>>;
|
|
348
|
+
correctOptionId: z.ZodString;
|
|
349
|
+
}, z.core.$strip>], "type">>;
|
|
350
|
+
}, z.core.$strip>;
|
|
351
|
+
readonly tracks: z.ZodObject<{
|
|
352
|
+
id: z.ZodString;
|
|
353
|
+
title: z.ZodString;
|
|
354
|
+
description: z.ZodString;
|
|
355
|
+
audience: z.ZodString;
|
|
356
|
+
entryAssumptions: z.ZodArray<z.ZodString>;
|
|
357
|
+
lessons: z.ZodArray<z.ZodString>;
|
|
358
|
+
}, z.core.$strip>;
|
|
359
|
+
readonly sources: z.ZodObject<{
|
|
360
|
+
id: z.ZodString;
|
|
361
|
+
type: z.ZodEnum<{
|
|
362
|
+
primary: "primary";
|
|
363
|
+
"official-guidance": "official-guidance";
|
|
364
|
+
paper: "paper";
|
|
365
|
+
book: "book";
|
|
366
|
+
secondary: "secondary";
|
|
367
|
+
}>;
|
|
368
|
+
title: z.ZodString;
|
|
369
|
+
authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
370
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
371
|
+
edition: z.ZodOptional<z.ZodString>;
|
|
372
|
+
publisher: z.ZodOptional<z.ZodString>;
|
|
373
|
+
year: z.ZodOptional<z.ZodNumber>;
|
|
374
|
+
isbn: z.ZodOptional<z.ZodString>;
|
|
375
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
376
|
+
locator: z.ZodOptional<z.ZodString>;
|
|
377
|
+
accessed: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
378
|
+
licenseNotes: z.ZodOptional<z.ZodString>;
|
|
379
|
+
}, z.core.$strip>;
|
|
380
|
+
readonly notation: z.ZodObject<{
|
|
381
|
+
key: z.ZodString;
|
|
382
|
+
latex: z.ZodString;
|
|
383
|
+
meaning: z.ZodString;
|
|
384
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
385
|
+
units: z.ZodOptional<z.ZodString>;
|
|
386
|
+
dimensionless: z.ZodOptional<z.ZodLiteral<true>>;
|
|
387
|
+
seeAlso: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
388
|
+
sources: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
389
|
+
id: z.ZodString;
|
|
390
|
+
locator: z.ZodString;
|
|
391
|
+
}, z.core.$strip>]>>>;
|
|
392
|
+
alignment: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
393
|
+
kind: z.ZodLiteral<"competency">;
|
|
394
|
+
introducedByCompetency: z.ZodString;
|
|
395
|
+
introducedInLesson: z.ZodString;
|
|
396
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
397
|
+
kind: z.ZodLiteral<"general">;
|
|
398
|
+
rationale: z.ZodString;
|
|
399
|
+
}, z.core.$strip>], "kind">>;
|
|
400
|
+
label: z.ZodOptional<z.ZodString>;
|
|
401
|
+
glosses: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
402
|
+
latex: z.ZodString;
|
|
403
|
+
name: z.ZodString;
|
|
404
|
+
units: z.ZodOptional<z.ZodString>;
|
|
405
|
+
}, z.core.$strip>>>;
|
|
406
|
+
reads: z.ZodOptional<z.ZodString>;
|
|
407
|
+
range: z.ZodOptional<z.ZodString>;
|
|
408
|
+
fixedIndex: z.ZodOptional<z.ZodLiteral<true>>;
|
|
409
|
+
domain: z.ZodString;
|
|
410
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
411
|
+
aiAssisted: z.ZodDefault<z.ZodBoolean>;
|
|
412
|
+
}, z.core.$strip>;
|
|
413
|
+
readonly abbreviations: z.ZodObject<{
|
|
414
|
+
key: z.ZodString;
|
|
415
|
+
abbr: z.ZodString;
|
|
416
|
+
expansion: z.ZodString;
|
|
417
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
418
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
419
|
+
}, z.core.$strip>;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
export { CONTENT_SCHEMAS, abbreviationSchema, assessmentSchema, competencySchema, contentId, isIndexEntryLatex, lessonFrontmatterSchema, notationEntryShape, notationProse, notationSchema, sourceSchema, trackSchema };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { z } from "astro/zod";
|
|
2
|
+
import { isSubstantiveMeaning } from "../reference/prose.js";
|
|
3
|
+
import { glossKeySegment } from "../reference/gloss.js";
|
|
4
|
+
import { BASE_PLACEHOLDER } from "../reference/derived-notation.mjs";
|
|
5
|
+
const contentId = z.string().regex(/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/);
|
|
6
|
+
const id = contentId;
|
|
7
|
+
const notationProse = z.string().min(1).refine((value) => !/[\\$`]/.test(value), {
|
|
8
|
+
message: 'Notation meaning/summary must be plain prose: no `$`, `\\` or backtick. Put a symbol or formula in its own field (`latex`, `formula`), and write an amount of money in words or with its currency code ("USD 5").'
|
|
9
|
+
}).refine(isSubstantiveMeaning, {
|
|
10
|
+
message: "Notation meaning must be substantive prose (at least four words, not a placeholder)."
|
|
11
|
+
});
|
|
12
|
+
const notationAlignment = z.discriminatedUnion("kind", [
|
|
13
|
+
z.object({
|
|
14
|
+
kind: z.literal("competency"),
|
|
15
|
+
introducedByCompetency: id,
|
|
16
|
+
introducedInLesson: id
|
|
17
|
+
}),
|
|
18
|
+
z.object({
|
|
19
|
+
kind: z.literal("general"),
|
|
20
|
+
rationale: z.string().min(1)
|
|
21
|
+
})
|
|
22
|
+
]);
|
|
23
|
+
const notationAlignmentDefault = notationAlignment.default({
|
|
24
|
+
kind: "general",
|
|
25
|
+
rationale: "General notation."
|
|
26
|
+
});
|
|
27
|
+
const notationSource = z.union([
|
|
28
|
+
id,
|
|
29
|
+
z.object({ id, locator: z.string().min(1) })
|
|
30
|
+
]);
|
|
31
|
+
const notationGloss = z.object({
|
|
32
|
+
latex: z.string().min(1),
|
|
33
|
+
name: z.string().min(1).refine((value) => glossKeySegment(value) !== void 0, {
|
|
34
|
+
message: "A gloss name must contain letters or digits so a key can be derived from it."
|
|
35
|
+
}).refine((value) => !/[\\$`\n]/.test(value), {
|
|
36
|
+
message: "A gloss name is a plain noun phrase; put the symbol in `latex`, not in the name."
|
|
37
|
+
}),
|
|
38
|
+
units: z.string().min(1).optional()
|
|
39
|
+
});
|
|
40
|
+
function isIndexEntryLatex(latex) {
|
|
41
|
+
return /^\s*\{\s*\}\s*_/.test(latex);
|
|
42
|
+
}
|
|
43
|
+
const notationEntryObject = z.object({
|
|
44
|
+
key: id,
|
|
45
|
+
latex: z.string().min(1),
|
|
46
|
+
meaning: notationProse,
|
|
47
|
+
formula: z.string().min(1).optional(),
|
|
48
|
+
units: z.string().min(1).optional(),
|
|
49
|
+
dimensionless: z.literal(true).optional(),
|
|
50
|
+
seeAlso: z.array(id).default([]),
|
|
51
|
+
sources: z.array(notationSource).default([]),
|
|
52
|
+
alignment: notationAlignmentDefault,
|
|
53
|
+
label: z.string().min(1).optional(),
|
|
54
|
+
glosses: z.array(notationGloss).default([]),
|
|
55
|
+
/**
|
|
56
|
+
* An index entry's title for the symbol it indexes (rule N23):
|
|
57
|
+
* `"{base} evaluated at t = 0"`. Defaults to `"<label> of {base}"`.
|
|
58
|
+
*/
|
|
59
|
+
reads: z.string().min(1).refine((value) => value.includes(BASE_PLACEHOLDER), {
|
|
60
|
+
message: `reads names the indexed symbol with ${BASE_PLACEHOLDER}, e.g. "${BASE_PLACEHOLDER} evaluated at t = 0".`
|
|
61
|
+
}).refine((value) => !/[\\$`]/.test(value), {
|
|
62
|
+
message: "reads is plain prose: no `$`, `\\` or backtick."
|
|
63
|
+
}).optional(),
|
|
64
|
+
/** The set a running index letter runs over (rule N23): `1, \dots, n`. */
|
|
65
|
+
range: z.string().min(1).optional(),
|
|
66
|
+
/** As an index, this letter (or this entry's own index) is a fixed label. */
|
|
67
|
+
fixedIndex: z.literal(true).optional()
|
|
68
|
+
});
|
|
69
|
+
function refineIndexFields(entry, context) {
|
|
70
|
+
const index = isIndexEntryLatex(entry.latex);
|
|
71
|
+
if (entry.reads !== void 0 && !index) {
|
|
72
|
+
context.addIssue({
|
|
73
|
+
code: z.ZodIssueCode.custom,
|
|
74
|
+
path: ["reads"],
|
|
75
|
+
message: "reads belongs on an index entry, whose latex is a subscript on an empty group ({}_0)."
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
for (const field of ["range", "fixedIndex", "units", "dimensionless"]) {
|
|
79
|
+
if (index && entry[field] !== void 0) {
|
|
80
|
+
context.addIssue({
|
|
81
|
+
code: z.ZodIssueCode.custom,
|
|
82
|
+
path: [field],
|
|
83
|
+
message: `An index entry ({}_\u2026) takes no ${field}: a derived card takes its units from the symbol it indexes, and the index it names is fixed already.`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const notationEntryShape = notationEntryObject.superRefine(refineIndexFields);
|
|
89
|
+
const notationSuspension = z.object({
|
|
90
|
+
operator: z.string().min(1),
|
|
91
|
+
reason: z.string().min(1).optional()
|
|
92
|
+
});
|
|
93
|
+
const lessonNotation = z.object({
|
|
94
|
+
// `notation.uses` is retired (D3): a lesson pulls a shared key into scope
|
|
95
|
+
// by referencing it in prose (`[[key]]`) or math (`\explain`).
|
|
96
|
+
local: z.array(notationEntryShape).default([]),
|
|
97
|
+
suspend: z.array(notationSuspension).default([])
|
|
98
|
+
}).default({ local: [], suspend: [] });
|
|
99
|
+
const studyMinutes = z.union([
|
|
100
|
+
z.number().int().positive(),
|
|
101
|
+
z.tuple([z.number().int().positive(), z.number().int().positive()])
|
|
102
|
+
]).refine((value) => !Array.isArray(value) || value[0] <= value[1], {
|
|
103
|
+
message: "studyMinutes as a range is [low, high]; the low end cannot exceed the high end."
|
|
104
|
+
});
|
|
105
|
+
const lessonFrontmatterSchema = z.object({
|
|
106
|
+
teaches: z.array(id).default([]),
|
|
107
|
+
assumptions: z.array(z.string().min(1)).default([]),
|
|
108
|
+
studyMinutes: studyMinutes.optional(),
|
|
109
|
+
notation: lessonNotation
|
|
110
|
+
});
|
|
111
|
+
const competencySchema = z.object({
|
|
112
|
+
id,
|
|
113
|
+
title: z.string().min(1),
|
|
114
|
+
domain: id,
|
|
115
|
+
facet: z.enum([
|
|
116
|
+
"knowledge",
|
|
117
|
+
"calculation",
|
|
118
|
+
"interpretation",
|
|
119
|
+
"convention",
|
|
120
|
+
"risk"
|
|
121
|
+
]),
|
|
122
|
+
outcome: z.string().min(1),
|
|
123
|
+
prerequisites: z.array(id).default([]),
|
|
124
|
+
evidence: z.object({
|
|
125
|
+
minimumIndependentItems: z.number().int().min(1),
|
|
126
|
+
requiresTransfer: z.boolean(),
|
|
127
|
+
requiresUnassistedPass: z.boolean()
|
|
128
|
+
}),
|
|
129
|
+
misconceptions: z.array(z.string().min(1)).default([])
|
|
130
|
+
});
|
|
131
|
+
const assessmentItemBase = z.object({
|
|
132
|
+
id,
|
|
133
|
+
competencyId: id,
|
|
134
|
+
evidenceKind: z.enum(["direct", "transfer"]),
|
|
135
|
+
prompt: z.string().min(1),
|
|
136
|
+
explanation: z.string().min(1)
|
|
137
|
+
});
|
|
138
|
+
const assessmentTitle = z.string().min(1).refine((value) => !/^knowledge check\b/i.test(value), {
|
|
139
|
+
message: 'Assessment title must not start with "Knowledge check" \u2014 AssessmentSet already renders "Knowledge check {number} \u2014 {title}", so a title with the same prefix duplicates it. Use just the topic, e.g. "AIC and KL risk".'
|
|
140
|
+
});
|
|
141
|
+
const assessmentSchema = z.object({
|
|
142
|
+
id,
|
|
143
|
+
title: assessmentTitle,
|
|
144
|
+
items: z.array(
|
|
145
|
+
z.discriminatedUnion("type", [
|
|
146
|
+
assessmentItemBase.extend({
|
|
147
|
+
type: z.literal("numeric"),
|
|
148
|
+
answer: z.object({
|
|
149
|
+
value: z.number(),
|
|
150
|
+
tolerance: z.number().positive()
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
assessmentItemBase.extend({
|
|
154
|
+
type: z.literal("single-choice"),
|
|
155
|
+
options: z.array(
|
|
156
|
+
z.object({
|
|
157
|
+
id,
|
|
158
|
+
label: z.string().min(1)
|
|
159
|
+
})
|
|
160
|
+
).min(2),
|
|
161
|
+
correctOptionId: id
|
|
162
|
+
})
|
|
163
|
+
])
|
|
164
|
+
).min(1)
|
|
165
|
+
});
|
|
166
|
+
const trackSchema = z.object({
|
|
167
|
+
id,
|
|
168
|
+
title: z.string().min(1),
|
|
169
|
+
description: z.string().min(1),
|
|
170
|
+
audience: z.string().min(1),
|
|
171
|
+
entryAssumptions: z.array(z.string().min(1)),
|
|
172
|
+
lessons: z.array(id).min(1)
|
|
173
|
+
});
|
|
174
|
+
const sourceSchema = z.object({
|
|
175
|
+
id,
|
|
176
|
+
type: z.enum([
|
|
177
|
+
"primary",
|
|
178
|
+
"official-guidance",
|
|
179
|
+
"paper",
|
|
180
|
+
"book",
|
|
181
|
+
"secondary"
|
|
182
|
+
]),
|
|
183
|
+
title: z.string().min(1),
|
|
184
|
+
authors: z.array(z.string().min(1)).optional(),
|
|
185
|
+
organization: z.string().min(1).optional(),
|
|
186
|
+
edition: z.string().optional(),
|
|
187
|
+
publisher: z.string().optional(),
|
|
188
|
+
year: z.number().int().optional(),
|
|
189
|
+
isbn: z.string().optional(),
|
|
190
|
+
url: z.url().optional(),
|
|
191
|
+
locator: z.string().optional(),
|
|
192
|
+
accessed: z.coerce.date().optional(),
|
|
193
|
+
licenseNotes: z.string().optional()
|
|
194
|
+
});
|
|
195
|
+
const notationSchema = notationEntryObject.extend({
|
|
196
|
+
domain: id,
|
|
197
|
+
aliases: z.array(z.string().min(1)).default([]),
|
|
198
|
+
aiAssisted: z.boolean().default(false)
|
|
199
|
+
}).superRefine(refineIndexFields);
|
|
200
|
+
const abbreviationSchema = z.object({
|
|
201
|
+
key: id,
|
|
202
|
+
abbr: z.string().min(1),
|
|
203
|
+
expansion: notationProse,
|
|
204
|
+
aliases: z.array(z.string().min(1)).default([]),
|
|
205
|
+
domain: id.optional()
|
|
206
|
+
});
|
|
207
|
+
const CONTENT_SCHEMAS = {
|
|
208
|
+
docs: lessonFrontmatterSchema,
|
|
209
|
+
competencies: competencySchema,
|
|
210
|
+
assessments: assessmentSchema,
|
|
211
|
+
tracks: trackSchema,
|
|
212
|
+
sources: sourceSchema,
|
|
213
|
+
notation: notationSchema,
|
|
214
|
+
abbreviations: abbreviationSchema
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
CONTENT_SCHEMAS,
|
|
218
|
+
abbreviationSchema,
|
|
219
|
+
assessmentSchema,
|
|
220
|
+
competencySchema,
|
|
221
|
+
contentId,
|
|
222
|
+
isIndexEntryLatex,
|
|
223
|
+
lessonFrontmatterSchema,
|
|
224
|
+
notationEntryShape,
|
|
225
|
+
notationProse,
|
|
226
|
+
notationSchema,
|
|
227
|
+
sourceSchema,
|
|
228
|
+
trackSchema
|
|
229
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { s as BLOCK_LABELS_DEFAULT, B as BlockLabels,
|
|
1
|
+
export { s as BLOCK_LABELS_DEFAULT, B as BlockLabels, t as CARDS_DEFAULTS, h as CourseAbbreviations, u as CourseAbout, g as CourseAccents, v as CourseAuthor, w as CourseCards, C as CourseConfig, x as CourseDisclosure, y as CourseHeadingDisclosure, z as CourseNumbering, A as CourseOpenDefault, e as CourseOperators, D as CoursePart, f as CourseRomanLabels, E as CourseSection, F as DISCLOSURE_DEFAULTS, L as LessonExportsConfig, c as NormalizedCards, a as NormalizedDisclosure, N as NormalizedLessonExports, b as NormalizedNumbering, i as NormalizedPartPages, G as coursePartsOf, H as normalizeBlockLabels, I as normalizeCards, J as normalizeDisclosure, K as normalizeLessonExports, O as normalizeNumbering } from '../course-config-rRtME5UV.js';
|
|
2
2
|
import '../rules/course-rules.js';
|
|
3
3
|
import '../rules/catalog.js';
|