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.
- package/CHANGELOG.md +344 -1
- package/README.md +117 -3
- package/dist/compiler/astro.d.ts +38 -0
- package/dist/compiler/astro.js +258 -0
- package/dist/compiler/cli.d.ts +13 -0
- package/dist/compiler/cli.js +32 -12
- package/dist/compiler/collections.d.ts +3 -2
- package/dist/compiler/collections.js +28 -1
- package/dist/compiler/course-config.d.ts +86 -4
- package/dist/compiler/course-config.js +39 -0
- package/dist/compiler/exports/standalone-html.d.ts +34 -0
- package/dist/compiler/exports/standalone-html.js +803 -0
- package/dist/compiler/lesson-derivation.d.ts +1 -1
- package/dist/compiler/lesson-derivation.js +2 -2
- package/dist/compiler/manifest.d.ts +112 -7
- package/dist/compiler/manifest.js +205 -40
- package/dist/compiler/resolution-report.d.ts +4 -0
- package/dist/reference/base-abbreviations.d.mts +30 -0
- package/dist/reference/base-abbreviations.mjs +60 -0
- package/dist/reference/base-operators.d.mts +15 -0
- package/dist/reference/base-operators.mjs +40 -0
- package/dist/reference/base-roman-labels.d.mts +35 -0
- package/dist/reference/base-roman-labels.mjs +43 -0
- package/dist/reference/consistency.d.ts +8 -2
- package/dist/reference/consistency.js +50 -3
- package/dist/reference/diagrams-validate.d.ts +21 -0
- package/dist/reference/diagrams-validate.js +13 -0
- package/dist/reference/equations-validate.d.ts +8 -3
- package/dist/reference/equations-validate.js +1 -1
- package/dist/reference/equations.d.mts +66 -35
- package/dist/reference/equations.mjs +142 -40
- package/dist/reference/gate-abbreviations.d.ts +17 -0
- package/dist/reference/gate-abbreviations.js +64 -0
- package/dist/reference/gate-math.d.ts +28 -5
- package/dist/reference/gate-math.js +5 -2
- package/dist/reference/gate-prose-notation.d.ts +60 -0
- package/dist/reference/gate-prose-notation.js +125 -0
- package/dist/reference/keyed-float-validate.d.ts +14 -8
- package/dist/reference/keyed-float-validate.js +1 -1
- package/dist/reference/keyed-jsx-floats.d.mts +24 -21
- package/dist/reference/keyed-jsx-floats.mjs +90 -41
- package/dist/reference/knowledge-checks-validate.d.ts +35 -0
- package/dist/reference/knowledge-checks-validate.js +78 -0
- package/dist/reference/knowledge-checks.d.mts +25 -0
- package/dist/reference/knowledge-checks.mjs +45 -0
- package/dist/reference/lab-math-scope.d.ts +9 -1
- package/dist/reference/lab-math-scope.js +32 -4
- package/dist/reference/math-glyphs.d.mts +30 -0
- package/dist/reference/math-glyphs.mjs +367 -0
- package/dist/reference/mdx-attributes.d.mts +13 -0
- package/dist/reference/mdx-attributes.mjs +38 -0
- package/dist/reference/mixed-content.d.ts +17 -0
- package/dist/reference/mixed-content.js +29 -0
- package/dist/reference/page-notation.d.ts +52 -0
- package/dist/reference/page-notation.js +171 -0
- package/dist/reference/raw-floats-validate.d.ts +18 -0
- package/dist/reference/raw-floats-validate.js +53 -0
- package/dist/reference/raw-floats.d.mts +18 -0
- package/dist/reference/raw-floats.mjs +129 -0
- package/dist/reference/rehype-heading-anchors.d.mts +1 -1
- package/dist/reference/rehype-heading-anchors.mjs +107 -1
- package/dist/reference/rehype-table-header-labels.d.mts +26 -0
- package/dist/reference/rehype-table-header-labels.mjs +152 -0
- package/dist/reference/remark-abbreviations.d.mts +7 -0
- package/dist/reference/remark-abbreviations.mjs +174 -0
- package/dist/reference/remark-memo.d.mts +16 -0
- package/dist/reference/remark-memo.mjs +339 -0
- package/dist/reference/remark-notation.d.mts +102 -5
- package/dist/reference/remark-notation.mjs +506 -50
- package/dist/reference/remark-short-note.d.mts +4 -0
- package/dist/reference/remark-short-note.mjs +237 -0
- package/dist/reference/types.d.ts +16 -1
- package/dist/reference/units-vocab.js +4 -0
- package/docs/VERSIONING.md +33 -4
- package/docs/authoring/README.md +12 -0
- package/docs/authoring/agents.md +17 -2
- package/docs/authoring/components.md +135 -0
- package/docs/authoring/migrating.md +154 -7
- package/docs/authoring/notation.md +568 -8
- package/docs/authoring/structure.md +251 -0
- package/docs/authoring/visualizations.md +36 -3
- package/package.json +5 -2
- package/src/compiler/astro.ts +332 -0
- package/src/compiler/cli.ts +33 -10
- package/src/compiler/collections.ts +45 -4
- package/src/compiler/course-config.ts +131 -3
- package/src/compiler/exports/standalone-html.ts +963 -0
- package/src/compiler/lesson-derivation.ts +2 -2
- package/src/compiler/manifest.ts +367 -49
- package/src/components/HoverPanel.astro +45 -4
- package/src/components/abbreviation/AbbreviationGlossary.astro +70 -0
- package/src/components/abbreviation/AbbreviationLayer.astro +127 -0
- package/src/components/assessments/AssessmentRunner.tsx +52 -17
- package/src/components/assessments/AssessmentSet.astro +98 -14
- package/src/components/assessments/RenderedContent.tsx +55 -0
- package/src/components/assessments/assessment-randomization.ts +16 -0
- package/src/components/diagram/Diagram.astro +444 -83
- package/src/components/disclosure/hover-preview.ts +202 -0
- package/src/components/disclosure/persisted-disclosure.ts +66 -0
- package/src/components/examples/CompactExamples.astro +2 -0
- package/src/components/figure/Figure.astro +279 -10
- package/src/components/memo/Memo.astro +453 -0
- package/src/components/memo/ShortNote.astro +223 -0
- package/src/components/notation/NotationFormula.astro +18 -1
- package/src/components/notation/NotationLayer.astro +116 -8
- package/src/components/notation/render-notation-math.ts +39 -2
- package/src/components/notation/safe-math-to-react.ts +50 -0
- package/src/components/reference/FloatRefLayer.astro +233 -15
- package/src/components/starlight/CollapsibleSections.astro +461 -0
- package/src/components/starlight/DiagramEnhancer.astro +385 -0
- package/src/components/starlight/HeadingAnchorEnhancer.astro +5 -17
- package/src/components/starlight/KeyedFloatEnhancer.astro +81 -3
- package/src/components/starlight/LayoutHeader.astro +50 -0
- package/src/components/starlight/LayoutSidebar.astro +62 -1
- package/src/components/starlight/LayoutSocialIcons.astro +41 -2
- package/src/components/starlight/LessonExportActions.astro +436 -0
- package/src/components/starlight/LessonFooter.astro +38 -2
- package/src/components/starlight/section-parts.ts +31 -0
- package/src/components/table/Table.astro +296 -9
- package/src/components/table/TableOverflowExpander.astro +489 -0
- package/src/content-config.ts +20 -0
- package/src/reference/base-abbreviations.mjs +60 -0
- package/src/reference/base-operators.mjs +40 -0
- package/src/reference/base-roman-labels.mjs +43 -0
- package/src/reference/consistency.ts +73 -2
- package/src/reference/diagrams-validate.ts +40 -0
- package/src/reference/equations-validate.ts +6 -4
- package/src/reference/equations.mjs +142 -40
- package/src/reference/gate-abbreviations.ts +128 -0
- package/src/reference/gate-math.ts +27 -7
- package/src/reference/gate-prose-notation.ts +224 -0
- package/src/reference/keyed-float-validate.ts +12 -9
- package/src/reference/keyed-jsx-floats.mjs +90 -41
- package/src/reference/knowledge-checks-validate.ts +130 -0
- package/src/reference/knowledge-checks.mjs +45 -0
- package/src/reference/lab-math-scope.ts +45 -3
- package/src/reference/math-glyphs.mjs +367 -0
- package/src/reference/mdx-attributes.mjs +38 -0
- package/src/reference/mixed-content.ts +69 -0
- package/src/reference/page-notation.ts +252 -0
- package/src/reference/raw-floats-validate.ts +103 -0
- package/src/reference/raw-floats.mjs +129 -0
- package/src/reference/rehype-heading-anchors.mjs +107 -1
- package/src/reference/rehype-table-header-labels.mjs +152 -0
- package/src/reference/remark-abbreviations.mjs +174 -0
- package/src/reference/remark-memo.mjs +339 -0
- package/src/reference/remark-notation.mjs +506 -50
- package/src/reference/remark-short-note.mjs +237 -0
- package/src/reference/types.ts +16 -0
- package/src/reference/units-vocab.ts +4 -0
- package/src/styles/global.css +1125 -50
|
@@ -1,29 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The numbering inputs a lesson page needs, read off one manifest.
|
|
3
|
+
*
|
|
4
|
+
* Every number on a page comes from two places that MUST agree: the page's own
|
|
5
|
+
* counters (`numbering`) and the manifest tables a cross-page `[[slug#eq-key]]`
|
|
6
|
+
* is resolved against (`equations` / `tables` / `figures` / `diagrams` /
|
|
7
|
+
* `checks`).
|
|
8
|
+
* Deriving every input from the same manifest in one step stops a course config from
|
|
9
|
+
* supplying one without the other — the omission that produced page-local
|
|
10
|
+
* `(2.2)` and cross-page `(4.5)` for the same equation.
|
|
11
|
+
*
|
|
12
|
+
* `numbering` maps a lesson slug to
|
|
13
|
+
* `{ part, equations, tables, figures, diagrams, checks }`: the part's ordinal
|
|
14
|
+
* (the number before the dot) and, per numbered kind, how many earlier lessons
|
|
15
|
+
* of that part already used.
|
|
16
|
+
*/
|
|
17
|
+
export function numberingFromManifest(manifest: any): {
|
|
18
|
+
equations?: undefined;
|
|
19
|
+
tables?: undefined;
|
|
20
|
+
figures?: undefined;
|
|
21
|
+
diagrams?: undefined;
|
|
22
|
+
checks?: undefined;
|
|
23
|
+
numbering?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
equations: any;
|
|
26
|
+
tables: any;
|
|
27
|
+
figures: any;
|
|
28
|
+
diagrams: any;
|
|
29
|
+
checks: any;
|
|
30
|
+
numbering: {
|
|
31
|
+
[k: string]: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The options object `remarkNotation` needs for one manifest, in one call.
|
|
36
|
+
*
|
|
37
|
+
* A consumer used to hand-assemble `definitions`, `equations`, `tables`,
|
|
38
|
+
* `figures`, and `chapters` separately — easy to do partially, which is how a
|
|
39
|
+
* page ends up numbered under the legacy `##`-section scheme while the
|
|
40
|
+
* manifest (and every cross-page reference to that page) uses the part
|
|
41
|
+
* scheme. This does not return that literal four-map-plus-chapters shape:
|
|
42
|
+
* `chapters` is the superseded per-lesson form (see `pageNumbering` below),
|
|
43
|
+
* and passing `manifest` through already makes `numberingFromManifest()`
|
|
44
|
+
* derive `numbering` plus every `equations`/`tables`/`figures`/`diagrams`/
|
|
45
|
+
* `checks` map from the same source in one step — strictly more correct than
|
|
46
|
+
* reconstructing `chapters` by hand.
|
|
47
|
+
*
|
|
48
|
+
* `overrides` is spread last, so a caller can add `strict`, `unknown`,
|
|
49
|
+
* `resolve`, `base`, or override anything above:
|
|
50
|
+
*
|
|
51
|
+
* [remarkNotation, createRemarkNotationOptions(manifest, { strict: true })]
|
|
52
|
+
*
|
|
53
|
+
* @param {object} manifest - a compiled Explico manifest (`compileManifest()`).
|
|
54
|
+
* @param {object} [overrides] - additional/overriding `remarkNotation` options.
|
|
55
|
+
*/
|
|
56
|
+
export function createRemarkNotationOptions(manifest: object, overrides?: object): {
|
|
57
|
+
definitions: any;
|
|
58
|
+
manifest: object;
|
|
59
|
+
};
|
|
1
60
|
/**
|
|
2
61
|
* @param {{
|
|
3
62
|
* definitions?: Map<string, object> | readonly object[] | Record<string, object> | (() => Map<string, object> | readonly object[] | Record<string, object>),
|
|
4
63
|
* resolve?: (key: string, context: object) => object | undefined,
|
|
5
64
|
* unknown?: 'error' | 'warn' | 'ignore',
|
|
65
|
+
* strict?: boolean,
|
|
6
66
|
* base?: string,
|
|
67
|
+
* manifest?: object,
|
|
7
68
|
* equations?: Record<string, Record<string, string>>,
|
|
8
69
|
* tables?: Record<string, Record<string, string>>,
|
|
9
70
|
* figures?: Record<string, Record<string, string>>,
|
|
71
|
+
* diagrams?: Record<string, Record<string, string>>,
|
|
72
|
+
* checks?: Record<string, Record<string, string>>,
|
|
73
|
+
* numbering?: Record<string, { part: number, equations: number, tables: number, figures: number, diagrams: number, checks: number }>,
|
|
10
74
|
* chapters?: Record<string, number>,
|
|
11
75
|
* }} [options]
|
|
12
76
|
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
77
|
+
* `manifest` is the preferred wiring: pass the compiled manifest and all
|
|
78
|
+
* numbering inputs below are read off it together, so they cannot drift apart.
|
|
79
|
+
* They stay available individually for hand-built trees, and an explicitly
|
|
80
|
+
* supplied one still wins over the manifest.
|
|
81
|
+
*
|
|
82
|
+
* `numbering` maps a lesson slug to its **part** (the number before the dot)
|
|
83
|
+
* and, per kind of float, how many the earlier lessons of that part already
|
|
84
|
+
* used. Every display equation / `<Table>` / `<Figure>` / `<Diagram>` on the page is then
|
|
85
|
+
* numbered `‹part›.‹offset + n›`, with `##` and `###` headings ignored; with no
|
|
86
|
+
* entry the legacy `##`-section scheme applies. It must agree with
|
|
87
|
+
* `manifest.lessons[]`, which is what feeds `equations`/`tables`/`figures`/`diagrams`
|
|
88
|
+
* above — supplying the tables without `numbering` numbers the same equation
|
|
89
|
+
* twice, and `assertManifestNumberParity` turns that into a build error rather
|
|
90
|
+
* than a page whose references disagree with their targets.
|
|
91
|
+
*
|
|
92
|
+
* `chapters` is the superseded per-lesson form (slug → the lesson's course
|
|
93
|
+
* ordinal, no running offset). Still read when `numbering` has no entry, so a
|
|
94
|
+
* config written against the old option keeps building.
|
|
95
|
+
*
|
|
96
|
+
* `strict` (default `false`) additionally fails the build when a catalogued
|
|
97
|
+
* lesson contains an equation/`<Table>`/`<Figure>` — keyed or not — but has no
|
|
98
|
+
* `numbering` placement or no cross-page number table entry, instead of
|
|
99
|
+
* silently rendering it under the legacy `##`-section scheme. Off by default
|
|
100
|
+
* for backward compatibility; `createRemarkNotationOptions(manifest, { strict:
|
|
101
|
+
* true })` is the recommended way to turn it on for a course whose manifest
|
|
102
|
+
* covers every catalogued lesson.
|
|
18
103
|
*/
|
|
19
104
|
export default function remarkNotation(options?: {
|
|
20
105
|
definitions?: Map<string, object> | readonly object[] | Record<string, object> | (() => Map<string, object> | readonly object[] | Record<string, object>);
|
|
21
106
|
resolve?: (key: string, context: object) => object | undefined;
|
|
22
107
|
unknown?: "error" | "warn" | "ignore";
|
|
108
|
+
strict?: boolean;
|
|
23
109
|
base?: string;
|
|
110
|
+
manifest?: object;
|
|
24
111
|
equations?: Record<string, Record<string, string>>;
|
|
25
112
|
tables?: Record<string, Record<string, string>>;
|
|
26
113
|
figures?: Record<string, Record<string, string>>;
|
|
114
|
+
diagrams?: Record<string, Record<string, string>>;
|
|
115
|
+
checks?: Record<string, Record<string, string>>;
|
|
116
|
+
numbering?: Record<string, {
|
|
117
|
+
part: number;
|
|
118
|
+
equations: number;
|
|
119
|
+
tables: number;
|
|
120
|
+
figures: number;
|
|
121
|
+
diagrams: number;
|
|
122
|
+
checks: number;
|
|
123
|
+
}>;
|
|
27
124
|
chapters?: Record<string, number>;
|
|
28
125
|
}): (tree: any, file: any) => void;
|
|
29
126
|
/**
|