explico 0.1.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/README.md +108 -0
- package/dist/analytics/AnalyticsEmitter.d.ts +22 -0
- package/dist/analytics/AnalyticsEmitter.js +5 -0
- package/dist/compiler/cli.d.ts +189 -0
- package/dist/compiler/cli.js +552 -0
- package/dist/compiler/collections.d.ts +70 -0
- package/dist/compiler/collections.js +383 -0
- package/dist/compiler/course-config.d.ts +31 -0
- package/dist/compiler/course-config.js +0 -0
- package/dist/compiler/lesson-derivation.d.ts +89 -0
- package/dist/compiler/lesson-derivation.js +91 -0
- package/dist/compiler/manifest.d.ts +178 -0
- package/dist/compiler/manifest.js +345 -0
- package/dist/compiler/resolution-report.d.ts +45 -0
- package/dist/compiler/resolution-report.js +97 -0
- package/dist/curriculum/validation.d.ts +76 -0
- package/dist/curriculum/validation.js +320 -0
- package/dist/progress/ProgressRepository.d.ts +53 -0
- package/dist/progress/ProgressRepository.js +12 -0
- package/dist/reference/base-library.mjs +27 -0
- package/dist/reference/citation-format.mjs +133 -0
- package/dist/reference/consistency.d.ts +64 -0
- package/dist/reference/consistency.js +234 -0
- package/dist/reference/curriculum-alignment.d.ts +7 -0
- package/dist/reference/curriculum-alignment.js +166 -0
- package/dist/reference/equations-validate.d.ts +50 -0
- package/dist/reference/equations-validate.js +90 -0
- package/dist/reference/equations.mjs +144 -0
- package/dist/reference/gate-math.d.ts +41 -0
- package/dist/reference/gate-math.js +151 -0
- package/dist/reference/katex-options.mjs +91 -0
- package/dist/reference/lab-math-scope.d.ts +21 -0
- package/dist/reference/lab-math-scope.js +28 -0
- package/dist/reference/label.d.ts +11 -0
- package/dist/reference/label.js +38 -0
- package/dist/reference/lint-ignore.d.ts +32 -0
- package/dist/reference/lint-ignore.js +39 -0
- package/dist/reference/math-glyphs.mjs +830 -0
- package/dist/reference/prose.d.ts +15 -0
- package/dist/reference/prose.js +12 -0
- package/dist/reference/references.d.ts +17 -0
- package/dist/reference/references.js +42 -0
- package/dist/reference/registry.d.ts +6 -0
- package/dist/reference/registry.js +548 -0
- package/dist/reference/rehype-fail-katex-errors.mjs +55 -0
- package/dist/reference/remark-citation.mjs +0 -0
- package/dist/reference/remark-notation.mjs +753 -0
- package/dist/reference/render-lab-math.d.ts +21 -0
- package/dist/reference/render-lab-math.js +58 -0
- package/dist/reference/types.d.ts +151 -0
- package/dist/reference/types.js +0 -0
- package/dist/reference/units-vocab.d.ts +26 -0
- package/dist/reference/units-vocab.js +119 -0
- package/dist/session/PreferenceStore.d.ts +28 -0
- package/dist/session/PreferenceStore.js +30 -0
- package/dist/session/user-context.d.ts +7 -0
- package/dist/session/user-context.js +10 -0
- package/dist/session/user.d.ts +21 -0
- package/dist/session/user.js +8 -0
- package/package.json +53 -0
- package/src/analytics/AnalyticsEmitter.ts +23 -0
- package/src/compiler/cli.ts +866 -0
- package/src/compiler/collections.ts +554 -0
- package/src/compiler/course-config.ts +32 -0
- package/src/compiler/lesson-derivation.ts +186 -0
- package/src/compiler/manifest.ts +601 -0
- package/src/compiler/resolution-report.ts +150 -0
- package/src/components/CurriculumMap.astro +208 -0
- package/src/components/HoverPanel.astro +67 -0
- package/src/components/assessments/AssessmentRunner.tsx +320 -0
- package/src/components/assessments/AssessmentSet.astro +54 -0
- package/src/components/citation/CitationLayer.astro +173 -0
- package/src/components/examples/CompactExample.astro +34 -0
- package/src/components/examples/CompactExamples.astro +253 -0
- package/src/components/hover-panel.ts +273 -0
- package/src/components/notation/NotationGlossary.astro +412 -0
- package/src/components/notation/NotationLayer.astro +594 -0
- package/src/components/notation/NotationMath.astro +24 -0
- package/src/components/notation/SafeMathNode.astro +23 -0
- package/src/components/notation/render-notation-math.ts +223 -0
- package/src/components/starlight/EquationEnhancer.astro +72 -0
- package/src/components/starlight/LayoutHeader.astro +102 -0
- package/src/components/starlight/LayoutPageSidebar.astro +33 -0
- package/src/components/starlight/LayoutSidebar.astro +29 -0
- package/src/components/starlight/LessonFooter.astro +58 -0
- package/src/content-config.ts +259 -0
- package/src/curriculum/validation.ts +481 -0
- package/src/progress/ProgressRepository.ts +64 -0
- package/src/reference/base-library.mjs +27 -0
- package/src/reference/citation-format.mjs +133 -0
- package/src/reference/consistency.ts +375 -0
- package/src/reference/curriculum-alignment.ts +228 -0
- package/src/reference/equations-validate.ts +167 -0
- package/src/reference/equations.mjs +144 -0
- package/src/reference/gate-math.ts +250 -0
- package/src/reference/katex-options.mjs +91 -0
- package/src/reference/lab-math-scope.ts +54 -0
- package/src/reference/label.ts +47 -0
- package/src/reference/lint-ignore.ts +75 -0
- package/src/reference/math-glyphs.mjs +830 -0
- package/src/reference/prose.ts +21 -0
- package/src/reference/references.ts +82 -0
- package/src/reference/registry.ts +723 -0
- package/src/reference/rehype-fail-katex-errors.mjs +55 -0
- package/src/reference/remark-citation.mjs +0 -0
- package/src/reference/remark-notation.mjs +753 -0
- package/src/reference/render-lab-math.ts +99 -0
- package/src/reference/types.ts +182 -0
- package/src/reference/units-vocab.ts +143 -0
- package/src/session/PreferenceStore.ts +54 -0
- package/src/session/user-context.ts +18 -0
- package/src/session/user.ts +24 -0
- package/src/styles/global.css +763 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display label for a notation entry (Phase C1b, replacing the authored
|
|
3
|
+
* `title`). Default = the key humanized: split on `-`/`.`, upper-case known
|
|
4
|
+
* acronyms, capitalize the first word. An entry may still set an explicit
|
|
5
|
+
* `label` where the humanized key would read wrong.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const ACRONYMS = new Map<string, string>([
|
|
9
|
+
['cds', 'CDS'],
|
|
10
|
+
['cdx', 'CDX'],
|
|
11
|
+
['isda', 'ISDA'],
|
|
12
|
+
['pv', 'PV'],
|
|
13
|
+
['npv', 'NPV'],
|
|
14
|
+
['lgd', 'LGD'],
|
|
15
|
+
['ytm', 'YTM'],
|
|
16
|
+
['rop', 'RoP'],
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
// Adjacent key words that stay hyphenated (compound modifiers) rather than
|
|
20
|
+
// becoming a space.
|
|
21
|
+
const COMPOUNDS = new Set([
|
|
22
|
+
'risk-neutral',
|
|
23
|
+
'real-world',
|
|
24
|
+
'price-yield',
|
|
25
|
+
'market-standard',
|
|
26
|
+
'risk-free',
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
export function humanizeKey(key: string): string {
|
|
30
|
+
const words = key.split(/[-.]/).filter(Boolean);
|
|
31
|
+
const cased = words.map((word, index) => {
|
|
32
|
+
const acronym = ACRONYMS.get(word);
|
|
33
|
+
if (acronym) return acronym;
|
|
34
|
+
return index === 0 ? word.charAt(0).toUpperCase() + word.slice(1) : word;
|
|
35
|
+
});
|
|
36
|
+
let out = cased[0] ?? '';
|
|
37
|
+
for (let i = 1; i < cased.length; i += 1) {
|
|
38
|
+
const joiner = COMPOUNDS.has(`${words[i - 1]}-${words[i]}`) ? '-' : ' ';
|
|
39
|
+
out += joiner + cased[i];
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The label an entry resolves to: an explicit `label`, else the humanized key. */
|
|
45
|
+
export function resolveLabel(key: string, label?: string): string {
|
|
46
|
+
return label && label.trim().length > 0 ? label : humanizeKey(key);
|
|
47
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one reviewed suppression registry for consistency checks (Step D6).
|
|
3
|
+
*
|
|
4
|
+
* A corpus-level finding (a glyph that resolves to more than one meaning, a
|
|
5
|
+
* unit outside the controlled vocabulary, …) is a violation unless it is
|
|
6
|
+
* acknowledged here, in `lint-ignore.yml` at the repository root, with a
|
|
7
|
+
* reason. Silent suppression is disallowed: there is no per-file pragma and no
|
|
8
|
+
* inline comment that turns a check off.
|
|
9
|
+
*
|
|
10
|
+
* File grammar — one acknowledgement per line:
|
|
11
|
+
*
|
|
12
|
+
* <check-code>[:<detail>] — <reason>
|
|
13
|
+
*
|
|
14
|
+
* `<detail>` is optional and narrows the acknowledgement (a glyph for
|
|
15
|
+
* `glyph-unique-in-corpus`, a notation key otherwise); with no detail the line
|
|
16
|
+
* acknowledges every finding of that code. The separator is an em dash (`—`),
|
|
17
|
+
* or `--` / ` - ` in ASCII. Blank lines and `#` comments are ignored.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
|
|
23
|
+
const IGNORE_PATH = join(process.cwd(), 'lint-ignore.yml');
|
|
24
|
+
|
|
25
|
+
export interface LintIgnoreEntry {
|
|
26
|
+
readonly code: string;
|
|
27
|
+
readonly detail?: string;
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface LintIgnore {
|
|
32
|
+
readonly entries: readonly LintIgnoreEntry[];
|
|
33
|
+
/** True when a `<code>` (optionally `<code>:<detail>`) finding is acknowledged. */
|
|
34
|
+
matches(code: string, detail?: string): boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const LINE =
|
|
38
|
+
/^-\s*([a-z0-9-]+)(?::([^\s—-][^—-]*?))?\s*(?:—|--|\s-\s)\s*(.+?)\s*$/;
|
|
39
|
+
|
|
40
|
+
export function parseLintIgnore(text: string): LintIgnoreEntry[] {
|
|
41
|
+
const entries: LintIgnoreEntry[] = [];
|
|
42
|
+
for (const rawLine of text.split('\n')) {
|
|
43
|
+
const line = rawLine.replace(/#.*$/, '').trim();
|
|
44
|
+
if (line === '' || line === 'ignore:' || line === '[]') continue;
|
|
45
|
+
const match = LINE.exec(line);
|
|
46
|
+
if (!match) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`lint-ignore.yml: expected "- <code>[:<detail>] — <reason>", got ${JSON.stringify(rawLine)}`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const [, code, detail, reason] = match;
|
|
52
|
+
entries.push({
|
|
53
|
+
code: code as string,
|
|
54
|
+
...(detail && detail.trim() ? { detail: detail.trim() } : {}),
|
|
55
|
+
reason: (reason as string).trim(),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return entries;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function loadLintIgnore(): LintIgnore {
|
|
62
|
+
const entries = existsSync(IGNORE_PATH)
|
|
63
|
+
? parseLintIgnore(readFileSync(IGNORE_PATH, 'utf8'))
|
|
64
|
+
: [];
|
|
65
|
+
return {
|
|
66
|
+
entries,
|
|
67
|
+
matches(code, detail) {
|
|
68
|
+
return entries.some(
|
|
69
|
+
(entry) =>
|
|
70
|
+
entry.code === code &&
|
|
71
|
+
(entry.detail === undefined || entry.detail === detail),
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|