@altnovatrail/skill-map 0.0.0-stage → 0.1.1
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/LICENSE +201 -0
- package/NOTICE +6 -0
- package/README.md +62 -2
- package/lib/core/attributes.d.ts +18 -0
- package/lib/core/attributes.js +44 -0
- package/lib/core/index.d.ts +10 -0
- package/lib/core/index.js +15 -0
- package/lib/core/layout.d.ts +68 -0
- package/lib/core/layout.js +109 -0
- package/lib/core/lines.d.ts +29 -0
- package/lib/core/lines.js +55 -0
- package/lib/core/states.d.ts +70 -0
- package/lib/core/states.js +134 -0
- package/lib/element/anchor-titles.d.ts +8 -0
- package/lib/element/anchor-titles.js +16 -0
- package/lib/element/icons.d.ts +59 -0
- package/lib/element/icons.js +80 -0
- package/lib/element/index.d.ts +43 -0
- package/lib/element/index.js +126 -0
- package/lib/element/lines.d.ts +11 -0
- package/lib/element/lines.js +61 -0
- package/lib/element/styles.d.ts +2 -0
- package/lib/element/styles.js +185 -0
- package/lib/element/tree.d.ts +31 -0
- package/lib/element/tree.js +454 -0
- package/lib/element/words.d.ts +68 -0
- package/lib/element/words.js +124 -0
- package/package.json +41 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Holding, MapState, Reason } from "../core/states.js";
|
|
2
|
+
/** A phrase with a number in {count}: a form for each plural category of CLDR, and `other`. */
|
|
3
|
+
export type Plural = {
|
|
4
|
+
readonly other: string;
|
|
5
|
+
} & Partial<Readonly<Record<Exclude<Intl.LDMLPluralRule, "other">, string>>>;
|
|
6
|
+
/** The words of one language. */
|
|
7
|
+
export interface Words {
|
|
8
|
+
/** The language's tag, the lang of the map's own words. */
|
|
9
|
+
readonly lang: string;
|
|
10
|
+
/** The heading of a tier's band without a name, with {tier}: "Tier 3". */
|
|
11
|
+
readonly tier: string;
|
|
12
|
+
/** The heading of a tier's band with a name, with {tier} and {name}: "Tier 2 · Sharing". */
|
|
13
|
+
readonly tierNamed: string;
|
|
14
|
+
/** The heading of the band of anchor skills. */
|
|
15
|
+
readonly anchors: string;
|
|
16
|
+
/** Between the parts of a tile's accessible name: "Quarters, Locked". */
|
|
17
|
+
readonly separator: string;
|
|
18
|
+
readonly states: Readonly<Record<MapState, string>>;
|
|
19
|
+
/** The marks of a skill of rubric or none. */
|
|
20
|
+
readonly marks: Readonly<Record<"rubric" | "none", string>>;
|
|
21
|
+
readonly holdings: Readonly<Record<Holding, string>>;
|
|
22
|
+
readonly reasons: Readonly<Record<Reason, string>>;
|
|
23
|
+
/** The labels of the tiles linked to the expanded one. */
|
|
24
|
+
readonly neededBefore: string;
|
|
25
|
+
readonly opensAfter: string;
|
|
26
|
+
/** The parts of the details. */
|
|
27
|
+
readonly buildsOn: string;
|
|
28
|
+
readonly opens: string;
|
|
29
|
+
readonly teaches: string;
|
|
30
|
+
readonly neededBy: string;
|
|
31
|
+
/** A prerequisite of a locked skill, with {skill}. */
|
|
32
|
+
readonly notMastered: string;
|
|
33
|
+
/** An anchor skill's holding with its reason, with {holding} and {reason}. */
|
|
34
|
+
readonly holdingReason: string;
|
|
35
|
+
/** An anchor skill a skill teaches, with {skill} and {holding}. */
|
|
36
|
+
readonly taught: string;
|
|
37
|
+
/** The button that chooses the skill for a lesson. */
|
|
38
|
+
readonly practise: string;
|
|
39
|
+
/** What a locked skill waits for, with {skills}: its prerequisites' titles as a list. */
|
|
40
|
+
readonly waitsFor: string;
|
|
41
|
+
/** The adult's details: the number of answers, in {count}. */
|
|
42
|
+
readonly evidence: Plural;
|
|
43
|
+
/** The day of the last answer, with {date}. */
|
|
44
|
+
readonly lastPractised: string;
|
|
45
|
+
/** The mastery band, with {band}: its title from the manifest. */
|
|
46
|
+
readonly band: string;
|
|
47
|
+
/** The day of the next review, with {date}. */
|
|
48
|
+
readonly reviewOn: string;
|
|
49
|
+
readonly reviewDue: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The words by language, each a language tag in lower case. A map, not an object: a tag such as
|
|
53
|
+
* "constructor" finds nothing of an object's prototype in it.
|
|
54
|
+
*/
|
|
55
|
+
export declare const WORDS: ReadonlyMap<string, Words>;
|
|
56
|
+
/** The words of the language an attribute `lang` names, and English when the table has none. */
|
|
57
|
+
export declare function wordsFor(attribute: string | null): Words;
|
|
58
|
+
/** How a language writes lists, numbers and days, made once for each language. */
|
|
59
|
+
export interface Formats {
|
|
60
|
+
readonly list: Intl.ListFormat;
|
|
61
|
+
readonly plural: Intl.PluralRules;
|
|
62
|
+
readonly number: Intl.NumberFormat;
|
|
63
|
+
readonly date: Intl.DateTimeFormat;
|
|
64
|
+
}
|
|
65
|
+
/** The formats of the language of a table of words. */
|
|
66
|
+
export declare function formatsOf(words: Words): Formats;
|
|
67
|
+
/** The form of a phrase with a number that the language's plural rules choose for it. */
|
|
68
|
+
export declare function formOf(phrase: Plural, count: number, formats: Formats): string;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// The words of the map: the package's own table, in each language of the interface, English and
|
|
2
|
+
// Russian (R91 spec, R92 spec; R10 in docs/decisions.md). The table is data alone. A phrase with
|
|
3
|
+
// something in it is a template with named places, {tier} or {skills}, which the tree fills with
|
|
4
|
+
// text or with nodes of their own language, so that a language orders it as it needs: no phrase is
|
|
5
|
+
// glued from pieces. A phrase with a number has a form for each category of CLDR the language
|
|
6
|
+
// uses, and `other` always. No phrase tells the learner's gender. The language is the element's own
|
|
7
|
+
// attribute `lang`, found in the table by languageOf of the core, and English otherwise.
|
|
8
|
+
import { languageOf } from "../core/attributes.js";
|
|
9
|
+
/** The words in English, the code's own language: those of any language the table has not. */
|
|
10
|
+
const EN = {
|
|
11
|
+
lang: "en",
|
|
12
|
+
tier: "Tier {tier}",
|
|
13
|
+
tierNamed: "Tier {tier} · {name}",
|
|
14
|
+
anchors: "Skills from other modules",
|
|
15
|
+
separator: ", ",
|
|
16
|
+
states: {
|
|
17
|
+
review: "Time to review",
|
|
18
|
+
mastered: "Mastered",
|
|
19
|
+
practising: "In progress",
|
|
20
|
+
ready: "Ready to start",
|
|
21
|
+
locked: "Locked",
|
|
22
|
+
},
|
|
23
|
+
marks: { rubric: "Feedback by criteria", none: "Not assessed" },
|
|
24
|
+
holdings: { held: "Held", "not-held": "Not held", unknown: "Unknown" },
|
|
25
|
+
reasons: {
|
|
26
|
+
"not-mastered": "a skill that teaches it is not mastered yet",
|
|
27
|
+
"no-evidence": "no skill that teaches it has answers yet",
|
|
28
|
+
"nobody-teaches": "no module teaches it",
|
|
29
|
+
"only-unassessable": "only skills without a verdict teach it",
|
|
30
|
+
},
|
|
31
|
+
neededBefore: "needed before",
|
|
32
|
+
opensAfter: "opens after",
|
|
33
|
+
buildsOn: "Builds on",
|
|
34
|
+
opens: "Opens",
|
|
35
|
+
teaches: "Teaches",
|
|
36
|
+
neededBy: "Needed by",
|
|
37
|
+
notMastered: "{skill} — not mastered yet",
|
|
38
|
+
holdingReason: "{holding} — {reason}",
|
|
39
|
+
taught: "{skill} — {holding}",
|
|
40
|
+
practise: "Practise",
|
|
41
|
+
waitsFor: "Waits for: {skills}",
|
|
42
|
+
evidence: { one: "{count} answer", other: "{count} answers" },
|
|
43
|
+
lastPractised: "Last practised {date}",
|
|
44
|
+
band: "Mastery band: {band}",
|
|
45
|
+
reviewOn: "Review on {date}",
|
|
46
|
+
reviewDue: "Time to review",
|
|
47
|
+
};
|
|
48
|
+
const RU = {
|
|
49
|
+
lang: "ru",
|
|
50
|
+
tier: "Ярус {tier}",
|
|
51
|
+
tierNamed: "Ярус {tier} · {name}",
|
|
52
|
+
anchors: "Навыки других модулей",
|
|
53
|
+
separator: ", ",
|
|
54
|
+
states: {
|
|
55
|
+
review: "Пора повторить",
|
|
56
|
+
mastered: "Освоено",
|
|
57
|
+
practising: "В работе",
|
|
58
|
+
ready: "Можно начинать",
|
|
59
|
+
locked: "Ещё закрыт",
|
|
60
|
+
},
|
|
61
|
+
marks: { rubric: "Отзыв по критериям", none: "Без оценки" },
|
|
62
|
+
holdings: { held: "Владеет", "not-held": "Не владеет", unknown: "Неизвестно" },
|
|
63
|
+
reasons: {
|
|
64
|
+
"not-mastered": "не освоен навык, который ему учит",
|
|
65
|
+
"no-evidence": "у навыков, которые ему учат, ещё нет ответов",
|
|
66
|
+
"nobody-teaches": "ему не учит ни один модуль",
|
|
67
|
+
"only-unassessable": "ему учат только навыки без вердикта",
|
|
68
|
+
},
|
|
69
|
+
neededBefore: "нужен раньше",
|
|
70
|
+
opensAfter: "откроется после",
|
|
71
|
+
buildsOn: "Опирается на",
|
|
72
|
+
opens: "Открывает",
|
|
73
|
+
teaches: "Учит",
|
|
74
|
+
neededBy: "Нужен для",
|
|
75
|
+
notMastered: "{skill} — ещё не освоен",
|
|
76
|
+
holdingReason: "{holding} — {reason}",
|
|
77
|
+
taught: "{skill} — {holding}",
|
|
78
|
+
practise: "Заниматься",
|
|
79
|
+
waitsFor: "Ждёт: {skills}",
|
|
80
|
+
evidence: {
|
|
81
|
+
one: "{count} ответ",
|
|
82
|
+
few: "{count} ответа",
|
|
83
|
+
many: "{count} ответов",
|
|
84
|
+
other: "{count} ответа",
|
|
85
|
+
},
|
|
86
|
+
lastPractised: "Последнее занятие: {date}",
|
|
87
|
+
band: "Полоса освоения: {band}",
|
|
88
|
+
reviewOn: "Повторить {date}",
|
|
89
|
+
reviewDue: "Пора повторить",
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The words by language, each a language tag in lower case. A map, not an object: a tag such as
|
|
93
|
+
* "constructor" finds nothing of an object's prototype in it.
|
|
94
|
+
*/
|
|
95
|
+
export const WORDS = new Map([
|
|
96
|
+
["en", EN],
|
|
97
|
+
["ru", RU],
|
|
98
|
+
]);
|
|
99
|
+
const LANGUAGES = new Set(WORDS.keys());
|
|
100
|
+
/** The words of the language an attribute `lang` names, and English when the table has none. */
|
|
101
|
+
export function wordsFor(attribute) {
|
|
102
|
+
const lang = languageOf(attribute, LANGUAGES);
|
|
103
|
+
return (lang === null ? undefined : WORDS.get(lang)) ?? EN;
|
|
104
|
+
}
|
|
105
|
+
const FORMATS = new Map();
|
|
106
|
+
/** The formats of the language of a table of words. */
|
|
107
|
+
export function formatsOf(words) {
|
|
108
|
+
let formats = FORMATS.get(words.lang);
|
|
109
|
+
if (formats === undefined) {
|
|
110
|
+
formats = {
|
|
111
|
+
list: new Intl.ListFormat(words.lang, { type: "conjunction" }),
|
|
112
|
+
plural: new Intl.PluralRules(words.lang),
|
|
113
|
+
number: new Intl.NumberFormat(words.lang),
|
|
114
|
+
date: new Intl.DateTimeFormat(words.lang, { dateStyle: "medium" }),
|
|
115
|
+
};
|
|
116
|
+
FORMATS.set(words.lang, formats);
|
|
117
|
+
}
|
|
118
|
+
return formats;
|
|
119
|
+
}
|
|
120
|
+
/** The form of a phrase with a number that the language's plural rules choose for it. */
|
|
121
|
+
export function formOf(phrase, count, formats) {
|
|
122
|
+
const category = formats.plural.select(count);
|
|
123
|
+
return category === "other" ? phrase.other : (phrase[category] ?? phrase.other);
|
|
124
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altnovatrail/skill-map",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "NovaTrail's skill map: a module's skill graph in tiers, with the learner model's state over it.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/altnovatrail/skill-map.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"lib",
|
|
13
|
+
"NOTICE"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./lib/element/index.d.ts",
|
|
18
|
+
"default": "./lib/element/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./lib/element/index.js",
|
|
23
|
+
"./src/element/index.ts"
|
|
24
|
+
],
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@altnovatrail/contracts": "0.9.5",
|
|
27
|
+
"@biomejs/biome": "2.6.5",
|
|
28
|
+
"@iconify-json/material-symbols": "1.2.97",
|
|
29
|
+
"@iconify/utils": "3.1.7",
|
|
30
|
+
"@types/node": "24.19.2",
|
|
31
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
32
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
33
|
+
"axe-core": "4.14.0",
|
|
34
|
+
"playwright": "1.64.1",
|
|
35
|
+
"typescript": "7.0.2",
|
|
36
|
+
"vite": "8.3.5",
|
|
37
|
+
"vitest": "5.1.0",
|
|
38
|
+
"yaml": "2.9.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@altnovatrail/spec": "0.9.5"
|
|
42
|
+
}
|
|
43
|
+
}
|