@nakafa/aksara-contracts 6.5.0 → 7.0.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/dist/assessment/catalog.d.ts +18 -5
- package/dist/assessment/catalog.js +18 -8
- package/dist/assessment/choice.d.ts +10 -0
- package/dist/assessment/closure.d.ts +2 -1
- package/dist/assessment/closure.js +43 -62
- package/dist/assessment/document.d.ts +18 -0
- package/dist/assessment/document.js +10 -0
- package/dist/assessment/figure.d.ts +47605 -1555
- package/dist/assessment/figure.js +14 -217
- package/dist/assessment/hash.d.ts +274 -4
- package/dist/assessment/inline.d.ts +25 -0
- package/dist/assessment/inline.js +22 -3
- package/dist/assessment/interaction.d.ts +10 -0
- package/dist/assessment/item.d.ts +864 -0
- package/dist/assessment/item.js +10 -2
- package/dist/assessment/locales.d.ts +10 -0
- package/dist/assessment/locales.js +58 -0
- package/dist/assessment/paper.d.ts +1349 -12
- package/dist/assessment/paper.js +93 -9
- package/dist/assessment/part.d.ts +5 -0
- package/dist/assessment/profile.d.ts +4 -4
- package/dist/assessment/rows.d.ts +1409 -0
- package/dist/assessment/rows.js +44 -0
- package/dist/assessment/scalar.d.ts +1 -1
- package/dist/assessment/scoring.d.ts +1 -1
- package/dist/assessment/snapshot.d.ts +372 -20
- package/dist/assessment/structure.d.ts +6 -0
- package/dist/assessment/structure.js +22 -2
- package/dist/locale.d.ts +9 -9
- package/dist/locale.js +4 -3
- package/dist/program/snapshot/hash.d.ts +2 -2
- package/dist/program/snapshot/spec.d.ts +2 -2
- package/dist/projection/material.d.ts +10 -0
- package/dist/projection/material.js +1 -1
- package/dist/quran/attribution.d.ts +2 -2
- package/dist/quran/identity.d.ts +31 -10
- package/dist/quran/identity.js +15 -3
- package/dist/quran/provenance.d.ts +16 -16
- package/dist/quran/provenance.js +4 -1
- package/dist/quran/snapshot/hash.d.ts +2 -2
- package/dist/quran/snapshot/row/hash.d.ts +48 -15
- package/dist/quran/snapshot/row.d.ts +18 -8
- package/dist/quran/snapshot/spec.d.ts +2 -2
- package/dist/quran/source.d.ts +17 -7
- package/dist/quran/source.js +13 -1
- package/dist/quran/spec.d.ts +4 -4
- package/dist/quran/spec.js +2 -1
- package/dist/release/current/evidence.d.ts +9 -9
- package/dist/release/current/state.d.ts +11 -11
- package/dist/release/hash.d.ts +2 -2
- package/dist/release/identity.d.ts +1 -1
- package/dist/release/lifecycle.d.ts +7 -7
- package/dist/release/policy.d.ts +1 -1
- package/dist/release/snapshot/data.d.ts +36 -11
- package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence.d.ts +3 -3
- package/dist/release/snapshot/verify.d.ts +179 -12
- package/dist/release/spec.d.ts +13 -13
- package/dist/release/verify.d.ts +2 -2
- package/dist/runtime/spec.d.ts +6 -6
- package/dist/runtime/verify.d.ts +4 -4
- package/dist/transport/group.d.ts +108 -33
- package/dist/transport/request.d.ts +1166 -114
- package/dist/transport/response.d.ts +64 -64
- package/dist/transport/snapshot.d.ts +72 -22
- package/dist/visual/base/layout.d.ts +27 -0
- package/dist/visual/base/layout.js +35 -0
- package/dist/visual/base/math.d.ts +523 -0
- package/dist/visual/base/math.js +72 -0
- package/dist/visual/base/media.d.ts +13 -0
- package/dist/visual/base/media.js +25 -0
- package/dist/visual/biology.d.ts +203 -0
- package/dist/visual/biology.js +108 -0
- package/dist/visual/card.d.ts +32 -0
- package/dist/visual/card.js +30 -0
- package/dist/visual/catalog.d.ts +28633 -0
- package/dist/visual/catalog.js +73 -0
- package/dist/visual/chemistry/atom.d.ts +79 -0
- package/dist/visual/chemistry/atom.js +109 -0
- package/dist/visual/chemistry/electron.d.ts +41 -0
- package/dist/visual/chemistry/electron.js +69 -0
- package/dist/visual/chemistry/laws.d.ts +86 -0
- package/dist/visual/chemistry/laws.js +117 -0
- package/dist/visual/chemistry/particles.d.ts +114 -0
- package/dist/visual/chemistry/particles.js +149 -0
- package/dist/visual/chemistry/periodic.d.ts +52 -0
- package/dist/visual/chemistry/periodic.js +85 -0
- package/dist/visual/chemistry/reaction.d.ts +60 -0
- package/dist/visual/chemistry/reaction.js +76 -0
- package/dist/visual/entry.d.ts +42 -0
- package/dist/visual/entry.js +48 -0
- package/dist/visual/mathematics/chart.d.ts +30 -0
- package/dist/{assessment → visual/mathematics}/chart.js +26 -18
- package/dist/visual/mathematics/charts.d.ts +118 -0
- package/dist/visual/mathematics/charts.js +100 -0
- package/dist/visual/mathematics/function.d.ts +82 -0
- package/dist/visual/mathematics/function.js +102 -0
- package/dist/visual/mathematics/geometry.d.ts +222 -0
- package/dist/visual/mathematics/geometry.js +81 -0
- package/dist/visual/mathematics/line.d.ts +179 -0
- package/dist/visual/mathematics/line.js +156 -0
- package/dist/visual/mathematics/number.d.ts +21 -0
- package/dist/visual/mathematics/number.js +53 -0
- package/dist/visual/physics/measurement.d.ts +66 -0
- package/dist/visual/physics/measurement.js +85 -0
- package/dist/visual/physics/motion.d.ts +85 -0
- package/dist/visual/physics/motion.js +110 -0
- package/dist/visual/physics/parabolic.d.ts +42 -0
- package/dist/visual/physics/parabolic.js +56 -0
- package/dist/visual/physics/velocity.d.ts +112 -0
- package/dist/visual/physics/velocity.js +144 -0
- package/dist/visual/politics.d.ts +92 -0
- package/dist/visual/politics.js +76 -0
- package/package.json +13 -5
- package/dist/assessment/chart.d.ts +0 -62
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Array as Arr, Order, Record as Rec, Schema } from "effect";
|
|
2
|
+
import { RichTextSchema } from "#contracts/assessment/inline";
|
|
3
|
+
import { layoutVisuals } from "#contracts/visual/base/layout";
|
|
4
|
+
import { mathVisuals } from "#contracts/visual/base/math";
|
|
5
|
+
import { mediaVisuals } from "#contracts/visual/base/media";
|
|
6
|
+
import { biologyVisuals } from "#contracts/visual/biology";
|
|
7
|
+
import { atomVisuals } from "#contracts/visual/chemistry/atom";
|
|
8
|
+
import { electronVisuals } from "#contracts/visual/chemistry/electron";
|
|
9
|
+
import { lawVisuals } from "#contracts/visual/chemistry/laws";
|
|
10
|
+
import { particleVisuals } from "#contracts/visual/chemistry/particles";
|
|
11
|
+
import { periodicVisuals } from "#contracts/visual/chemistry/periodic";
|
|
12
|
+
import { reactionVisuals } from "#contracts/visual/chemistry/reaction";
|
|
13
|
+
import { chartVisuals } from "#contracts/visual/mathematics/charts";
|
|
14
|
+
import { functionVisuals } from "#contracts/visual/mathematics/function";
|
|
15
|
+
import { geometryVisuals } from "#contracts/visual/mathematics/geometry";
|
|
16
|
+
import { measurementVisuals } from "#contracts/visual/physics/measurement";
|
|
17
|
+
import { motionVisuals } from "#contracts/visual/physics/motion";
|
|
18
|
+
import { parabolicVisuals } from "#contracts/visual/physics/parabolic";
|
|
19
|
+
import { velocityVisuals } from "#contracts/visual/physics/velocity";
|
|
20
|
+
import { politicsVisuals } from "#contracts/visual/politics";
|
|
21
|
+
/**
|
|
22
|
+
* The Visual Catalog: every component Nakafa's renderer draws, each with the
|
|
23
|
+
* schema of its props and the reader of the answer state they hold. It is the
|
|
24
|
+
* one list of visuals. A lesson element and an assessment figure check the same
|
|
25
|
+
* component against the same schema; only the schema of rich text differs by
|
|
26
|
+
* document kind, so `rich` is the schema a document kind writes rich text in,
|
|
27
|
+
* and every kind decodes it to the same inline nodes.
|
|
28
|
+
* Nakafa's renderer manifest names exactly these components.
|
|
29
|
+
*/
|
|
30
|
+
export function visualCatalog(rich) {
|
|
31
|
+
return {
|
|
32
|
+
...layoutVisuals(),
|
|
33
|
+
...mathVisuals(rich),
|
|
34
|
+
...mediaVisuals(rich),
|
|
35
|
+
...biologyVisuals(rich),
|
|
36
|
+
...atomVisuals(rich),
|
|
37
|
+
...electronVisuals(rich),
|
|
38
|
+
...lawVisuals(rich),
|
|
39
|
+
...particleVisuals(rich),
|
|
40
|
+
...periodicVisuals(rich),
|
|
41
|
+
...reactionVisuals(rich),
|
|
42
|
+
...chartVisuals(rich),
|
|
43
|
+
...functionVisuals(rich),
|
|
44
|
+
...geometryVisuals(rich),
|
|
45
|
+
...measurementVisuals(rich),
|
|
46
|
+
...motionVisuals(rich),
|
|
47
|
+
...parabolicVisuals(rich),
|
|
48
|
+
...velocityVisuals(rich),
|
|
49
|
+
...politicsVisuals(rich),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The catalog of an assessment, which stores rich text as inline nodes. Its
|
|
54
|
+
* names, kinds, and answer state are the same in every document kind.
|
|
55
|
+
*/
|
|
56
|
+
export const assessmentVisuals = visualCatalog(RichTextSchema);
|
|
57
|
+
/** The catalog read for the parts that no document kind changes. */
|
|
58
|
+
const plainCatalog = assessmentVisuals;
|
|
59
|
+
/** Every catalog name, in code-unit order. */
|
|
60
|
+
export const VISUAL_NAMES = Arr.sort(Rec.keys(plainCatalog), Order.String);
|
|
61
|
+
/** The catalog components a document draws as a figure, in code-unit order. */
|
|
62
|
+
export const FIGURE_NAMES = Arr.filter(VISUAL_NAMES, (name) => plainCatalog[name].kind === "figure");
|
|
63
|
+
/** The name of one catalog component. */
|
|
64
|
+
export const VisualNameSchema = Schema.Literals(VISUAL_NAMES);
|
|
65
|
+
/** The name of one catalog component that a document draws as a figure. */
|
|
66
|
+
export const FigureNameSchema = Schema.Literals(FIGURE_NAMES);
|
|
67
|
+
/**
|
|
68
|
+
* Lists the answer state that the props of one component hold, each as the
|
|
69
|
+
* dotted path of a present prop. A prompt or a reading may show none of it.
|
|
70
|
+
*/
|
|
71
|
+
export function answerState(component, props) {
|
|
72
|
+
return plainCatalog[component].answer(props);
|
|
73
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The atoms the shell model lab can show. */
|
|
4
|
+
export declare const SHELL_SAMPLES: readonly ["neon", "magnesium", "chlorine", "argon", "potassium", "calcium"];
|
|
5
|
+
/**
|
|
6
|
+
* The atom labs. A sample note of the shell model states the configuration
|
|
7
|
+
* and the outer shell it leads to, so it is answer state; every other label
|
|
8
|
+
* names what the lab draws.
|
|
9
|
+
*/
|
|
10
|
+
export declare function atomVisuals<E>(rich: RichSlot<E>): {
|
|
11
|
+
AncientAtomLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
12
|
+
readonly description: RichSlot<E>;
|
|
13
|
+
readonly title: RichSlot<E>;
|
|
14
|
+
readonly labels: Schema.Struct<{
|
|
15
|
+
readonly aristotleBody: RichSlot<E>;
|
|
16
|
+
readonly aristotleLabel: Schema.Trimmed;
|
|
17
|
+
readonly chooseLevel: Schema.Trimmed;
|
|
18
|
+
readonly democritusBody: RichSlot<E>;
|
|
19
|
+
readonly democritusLabel: Schema.Trimmed;
|
|
20
|
+
readonly levels: Schema.$Record<Schema.Literals<readonly ["whole", "first-cut", "second-cut", "fine-cut"]>, Schema.Struct<{
|
|
21
|
+
readonly tab: Schema.Trimmed;
|
|
22
|
+
}>>;
|
|
23
|
+
}>;
|
|
24
|
+
}>>;
|
|
25
|
+
AtomShellLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
26
|
+
readonly defaultSampleId: Schema.optionalKey<Schema.Literals<readonly ["neon", "magnesium", "chlorine", "argon", "potassium", "calcium"]>>;
|
|
27
|
+
readonly description: Schema.optionalKey<RichSlot<E>>;
|
|
28
|
+
readonly labels: Schema.Struct<{
|
|
29
|
+
readonly atomicNumber: Schema.Trimmed;
|
|
30
|
+
readonly chooseAtom: Schema.Trimmed;
|
|
31
|
+
readonly configuration: Schema.Trimmed;
|
|
32
|
+
readonly electronTotal: Schema.Trimmed;
|
|
33
|
+
readonly maximumCapacity: Schema.Trimmed;
|
|
34
|
+
readonly outerShell: Schema.Trimmed;
|
|
35
|
+
readonly samples: Schema.$Record<Schema.Literals<readonly ["neon", "magnesium", "chlorine", "argon", "potassium", "calcium"]>, Schema.Struct<{
|
|
36
|
+
readonly name: Schema.optionalKey<Schema.Trimmed>;
|
|
37
|
+
readonly note: Schema.optionalKey<RichSlot<E>>;
|
|
38
|
+
readonly tab: Schema.Trimmed;
|
|
39
|
+
}>>;
|
|
40
|
+
}>;
|
|
41
|
+
readonly title: Schema.optionalKey<RichSlot<E>>;
|
|
42
|
+
}>>;
|
|
43
|
+
AtomSymbolLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
44
|
+
readonly description: RichSlot<E>;
|
|
45
|
+
readonly title: RichSlot<E>;
|
|
46
|
+
readonly labels: Schema.Struct<{
|
|
47
|
+
readonly atomicNumber: Schema.Trimmed;
|
|
48
|
+
readonly chooseAtom: Schema.Trimmed;
|
|
49
|
+
readonly electronCount: Schema.Trimmed;
|
|
50
|
+
readonly elementSymbol: Schema.Trimmed;
|
|
51
|
+
readonly massNumber: Schema.Trimmed;
|
|
52
|
+
readonly neutralAtom: Schema.Trimmed;
|
|
53
|
+
readonly neutronCount: Schema.Trimmed;
|
|
54
|
+
readonly protonCount: Schema.Trimmed;
|
|
55
|
+
readonly samples: Schema.$Record<Schema.Literals<readonly ["carbon-12", "oxygen-16", "sodium-23", "chlorine-35"]>, Schema.Struct<{
|
|
56
|
+
readonly ariaName: Schema.Trimmed;
|
|
57
|
+
readonly name: RichSlot<E>;
|
|
58
|
+
readonly tab: RichSlot<E>;
|
|
59
|
+
}>>;
|
|
60
|
+
}>;
|
|
61
|
+
}>>;
|
|
62
|
+
DaltonEvidenceLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
63
|
+
readonly description: RichSlot<E>;
|
|
64
|
+
readonly title: RichSlot<E>;
|
|
65
|
+
readonly labels: Schema.Struct<{
|
|
66
|
+
readonly chooseMode: Schema.Trimmed;
|
|
67
|
+
readonly modes: Schema.$Record<Schema.Literals<readonly ["conservation", "fixed", "multiple"]>, Schema.Struct<{
|
|
68
|
+
readonly afterTitle: Schema.Trimmed;
|
|
69
|
+
readonly beforeTitle: Schema.Trimmed;
|
|
70
|
+
readonly expression: Schema.Trimmed;
|
|
71
|
+
readonly facts: Schema.$Array<Schema.Struct<{
|
|
72
|
+
readonly label: Schema.Trimmed;
|
|
73
|
+
readonly value: Schema.Trimmed;
|
|
74
|
+
}>>;
|
|
75
|
+
readonly tab: Schema.Trimmed;
|
|
76
|
+
}>>;
|
|
77
|
+
}>;
|
|
78
|
+
}>>;
|
|
79
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, cardFields, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The cutting stages of the ancient atom thought experiment. */
|
|
5
|
+
const ANCIENT_LEVELS = [
|
|
6
|
+
"whole",
|
|
7
|
+
"first-cut",
|
|
8
|
+
"second-cut",
|
|
9
|
+
"fine-cut",
|
|
10
|
+
];
|
|
11
|
+
/** The atoms the shell model lab can show. */
|
|
12
|
+
export const SHELL_SAMPLES = [
|
|
13
|
+
"neon",
|
|
14
|
+
"magnesium",
|
|
15
|
+
"chlorine",
|
|
16
|
+
"argon",
|
|
17
|
+
"potassium",
|
|
18
|
+
"calcium",
|
|
19
|
+
];
|
|
20
|
+
/** The nuclides the atom symbol lab reads. */
|
|
21
|
+
const SYMBOL_SAMPLES = [
|
|
22
|
+
"carbon-12",
|
|
23
|
+
"oxygen-16",
|
|
24
|
+
"sodium-23",
|
|
25
|
+
"chlorine-35",
|
|
26
|
+
];
|
|
27
|
+
/** The three pieces of evidence for Dalton's atomic theory. */
|
|
28
|
+
const DALTON_MODES = ["conservation", "fixed", "multiple"];
|
|
29
|
+
/** Props of `AncientAtomLab`: cutting matter until it can be cut no more. */
|
|
30
|
+
function ancientAtomLab(rich) {
|
|
31
|
+
return figure(Schema.Struct({
|
|
32
|
+
...cardFields(rich),
|
|
33
|
+
labels: Schema.Struct({
|
|
34
|
+
aristotleBody: rich,
|
|
35
|
+
aristotleLabel: TextSchema,
|
|
36
|
+
chooseLevel: TextSchema,
|
|
37
|
+
democritusBody: rich,
|
|
38
|
+
democritusLabel: TextSchema,
|
|
39
|
+
levels: byIds(ANCIENT_LEVELS, Schema.Struct({ tab: TextSchema })),
|
|
40
|
+
}),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
/** Props of `AtomShellLab`: the electron shells of one atom at a time. */
|
|
44
|
+
function atomShellLab(rich) {
|
|
45
|
+
return figure(Schema.Struct({
|
|
46
|
+
defaultSampleId: Schema.optionalKey(Schema.Literals(SHELL_SAMPLES)),
|
|
47
|
+
description: Schema.optionalKey(rich),
|
|
48
|
+
labels: Schema.Struct({
|
|
49
|
+
atomicNumber: TextSchema,
|
|
50
|
+
chooseAtom: TextSchema,
|
|
51
|
+
configuration: TextSchema,
|
|
52
|
+
electronTotal: TextSchema,
|
|
53
|
+
maximumCapacity: TextSchema,
|
|
54
|
+
outerShell: TextSchema,
|
|
55
|
+
samples: byIds(SHELL_SAMPLES, Schema.Struct({
|
|
56
|
+
name: Schema.optionalKey(TextSchema),
|
|
57
|
+
note: Schema.optionalKey(rich),
|
|
58
|
+
tab: TextSchema,
|
|
59
|
+
})),
|
|
60
|
+
}),
|
|
61
|
+
title: Schema.optionalKey(rich),
|
|
62
|
+
}), answerAt(["labels", "samples", "*", "note"]));
|
|
63
|
+
}
|
|
64
|
+
/** Props of `AtomSymbolLab`: reading the particles of a nuclide from its symbol. */
|
|
65
|
+
function atomSymbolLab(rich) {
|
|
66
|
+
return figure(Schema.Struct({
|
|
67
|
+
...cardFields(rich),
|
|
68
|
+
labels: Schema.Struct({
|
|
69
|
+
atomicNumber: TextSchema,
|
|
70
|
+
chooseAtom: TextSchema,
|
|
71
|
+
electronCount: TextSchema,
|
|
72
|
+
elementSymbol: TextSchema,
|
|
73
|
+
massNumber: TextSchema,
|
|
74
|
+
neutralAtom: TextSchema,
|
|
75
|
+
neutronCount: TextSchema,
|
|
76
|
+
protonCount: TextSchema,
|
|
77
|
+
samples: byIds(SYMBOL_SAMPLES, Schema.Struct({ ariaName: TextSchema, name: rich, tab: rich })),
|
|
78
|
+
}),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
/** Props of `DaltonEvidenceLab`: the reactions behind Dalton's theory. */
|
|
82
|
+
function daltonEvidenceLab(rich) {
|
|
83
|
+
return figure(Schema.Struct({
|
|
84
|
+
...cardFields(rich),
|
|
85
|
+
labels: Schema.Struct({
|
|
86
|
+
chooseMode: TextSchema,
|
|
87
|
+
modes: byIds(DALTON_MODES, Schema.Struct({
|
|
88
|
+
afterTitle: TextSchema,
|
|
89
|
+
beforeTitle: TextSchema,
|
|
90
|
+
expression: TextSchema,
|
|
91
|
+
facts: Schema.Array(Schema.Struct({ label: TextSchema, value: TextSchema })),
|
|
92
|
+
tab: TextSchema,
|
|
93
|
+
})),
|
|
94
|
+
}),
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The atom labs. A sample note of the shell model states the configuration
|
|
99
|
+
* and the outer shell it leads to, so it is answer state; every other label
|
|
100
|
+
* names what the lab draws.
|
|
101
|
+
*/
|
|
102
|
+
export function atomVisuals(rich) {
|
|
103
|
+
return {
|
|
104
|
+
AncientAtomLab: ancientAtomLab(rich),
|
|
105
|
+
AtomShellLab: atomShellLab(rich),
|
|
106
|
+
AtomSymbolLab: atomSymbolLab(rich),
|
|
107
|
+
DaltonEvidenceLab: daltonEvidenceLab(rich),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The electron labs. A sample note states the configuration it leads to, and
|
|
5
|
+
* a tendency states how the atom reacts, so both are answer state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function electronVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
ElectronConfigurationLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
|
+
readonly description: RichSlot<E>;
|
|
10
|
+
readonly title: RichSlot<E>;
|
|
11
|
+
readonly labels: Schema.Struct<{
|
|
12
|
+
readonly atomicNumber: Schema.Trimmed;
|
|
13
|
+
readonly chooseAtom: Schema.Trimmed;
|
|
14
|
+
readonly configuration: Schema.Trimmed;
|
|
15
|
+
readonly electronTotal: Schema.Trimmed;
|
|
16
|
+
readonly outerShell: Schema.Trimmed;
|
|
17
|
+
readonly samples: Schema.$Record<Schema.Literals<readonly ["hydrogen", "helium", "carbon", "neon", "sodium", "magnesium", "chlorine", "calcium"]>, Schema.Struct<{
|
|
18
|
+
readonly name: Schema.Trimmed;
|
|
19
|
+
readonly note: RichSlot<E>;
|
|
20
|
+
}>>;
|
|
21
|
+
}>;
|
|
22
|
+
}>>;
|
|
23
|
+
ValenceElectronLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
24
|
+
readonly description: RichSlot<E>;
|
|
25
|
+
readonly title: RichSlot<E>;
|
|
26
|
+
readonly labels: Schema.Struct<{
|
|
27
|
+
readonly atomicNumber: Schema.Trimmed;
|
|
28
|
+
readonly behavior: Schema.Trimmed;
|
|
29
|
+
readonly chooseAtom: Schema.Trimmed;
|
|
30
|
+
readonly configuration: Schema.Trimmed;
|
|
31
|
+
readonly outerShell: Schema.Trimmed;
|
|
32
|
+
readonly samples: Schema.$Record<Schema.Literals<readonly ["hydrogen", "helium", "sodium", "magnesium", "aluminum", "chlorine", "argon", "calcium"]>, Schema.Struct<{
|
|
33
|
+
readonly name: Schema.Trimmed;
|
|
34
|
+
readonly note: RichSlot<E>;
|
|
35
|
+
readonly tab: Schema.Trimmed;
|
|
36
|
+
readonly tendency: RichSlot<E>;
|
|
37
|
+
}>>;
|
|
38
|
+
readonly valenceElectron: Schema.Trimmed;
|
|
39
|
+
}>;
|
|
40
|
+
}>>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, cardFields, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The atoms the electron configuration lab can show. */
|
|
5
|
+
const CONFIGURATION_SAMPLES = [
|
|
6
|
+
"hydrogen",
|
|
7
|
+
"helium",
|
|
8
|
+
"carbon",
|
|
9
|
+
"neon",
|
|
10
|
+
"sodium",
|
|
11
|
+
"magnesium",
|
|
12
|
+
"chlorine",
|
|
13
|
+
"calcium",
|
|
14
|
+
];
|
|
15
|
+
/** The atoms the valence electron lab can show. */
|
|
16
|
+
const VALENCE_SAMPLES = [
|
|
17
|
+
"hydrogen",
|
|
18
|
+
"helium",
|
|
19
|
+
"sodium",
|
|
20
|
+
"magnesium",
|
|
21
|
+
"aluminum",
|
|
22
|
+
"chlorine",
|
|
23
|
+
"argon",
|
|
24
|
+
"calcium",
|
|
25
|
+
];
|
|
26
|
+
/** Props of `ElectronConfigurationLab`: filling shells for one atom at a time. */
|
|
27
|
+
function electronConfigurationLab(rich) {
|
|
28
|
+
return figure(Schema.Struct({
|
|
29
|
+
...cardFields(rich),
|
|
30
|
+
labels: Schema.Struct({
|
|
31
|
+
atomicNumber: TextSchema,
|
|
32
|
+
chooseAtom: TextSchema,
|
|
33
|
+
configuration: TextSchema,
|
|
34
|
+
electronTotal: TextSchema,
|
|
35
|
+
outerShell: TextSchema,
|
|
36
|
+
samples: byIds(CONFIGURATION_SAMPLES, Schema.Struct({ name: TextSchema, note: rich })),
|
|
37
|
+
}),
|
|
38
|
+
}), answerAt(["labels", "samples", "*", "note"]));
|
|
39
|
+
}
|
|
40
|
+
/** Props of `ValenceElectronLab`: the outer electrons and what they tend to do. */
|
|
41
|
+
function valenceElectronLab(rich) {
|
|
42
|
+
return figure(Schema.Struct({
|
|
43
|
+
...cardFields(rich),
|
|
44
|
+
labels: Schema.Struct({
|
|
45
|
+
atomicNumber: TextSchema,
|
|
46
|
+
behavior: TextSchema,
|
|
47
|
+
chooseAtom: TextSchema,
|
|
48
|
+
configuration: TextSchema,
|
|
49
|
+
outerShell: TextSchema,
|
|
50
|
+
samples: byIds(VALENCE_SAMPLES, Schema.Struct({
|
|
51
|
+
name: TextSchema,
|
|
52
|
+
note: rich,
|
|
53
|
+
tab: TextSchema,
|
|
54
|
+
tendency: rich,
|
|
55
|
+
})),
|
|
56
|
+
valenceElectron: TextSchema,
|
|
57
|
+
}),
|
|
58
|
+
}), answerAt(["labels", "samples", "*", "note"], ["labels", "samples", "*", "tendency"]));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The electron labs. A sample note states the configuration it leads to, and
|
|
62
|
+
* a tendency states how the atom reacts, so both are answer state.
|
|
63
|
+
*/
|
|
64
|
+
export function electronVisuals(rich) {
|
|
65
|
+
return {
|
|
66
|
+
ElectronConfigurationLab: electronConfigurationLab(rich),
|
|
67
|
+
ValenceElectronLab: valenceElectronLab(rich),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The labs of the basic chemical laws. A ratio, a leftover, and a calculation
|
|
5
|
+
* state the result each law predicts, so they are answer state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function lawVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
CombiningVolumesLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
|
+
readonly description: RichSlot<E>;
|
|
10
|
+
readonly title: RichSlot<E>;
|
|
11
|
+
readonly labels: Schema.Struct<{
|
|
12
|
+
readonly chooseMode: Schema.Trimmed;
|
|
13
|
+
readonly exampleLabel: Schema.Trimmed;
|
|
14
|
+
readonly modes: Schema.$Record<Schema.Literals<readonly ["water-vapor", "ammonia-synthesis", "ammonia-decomposition"]>, Schema.Struct<{
|
|
15
|
+
readonly example: RichSlot<E>;
|
|
16
|
+
readonly helperCaption: RichSlot<E>;
|
|
17
|
+
readonly ratio: RichSlot<E>;
|
|
18
|
+
readonly tab: RichSlot<E>;
|
|
19
|
+
readonly tabLabel: Schema.Trimmed;
|
|
20
|
+
}>>;
|
|
21
|
+
readonly products: Schema.Trimmed;
|
|
22
|
+
readonly ratioLabel: Schema.Trimmed;
|
|
23
|
+
readonly reactants: Schema.Trimmed;
|
|
24
|
+
readonly reactionView: Schema.Trimmed;
|
|
25
|
+
readonly volumeUnit: Schema.Trimmed;
|
|
26
|
+
}>;
|
|
27
|
+
}>>;
|
|
28
|
+
ConstantCompositionLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
29
|
+
readonly description: RichSlot<E>;
|
|
30
|
+
readonly title: RichSlot<E>;
|
|
31
|
+
readonly labels: Schema.Struct<{
|
|
32
|
+
readonly after: Schema.Trimmed;
|
|
33
|
+
readonly before: Schema.Trimmed;
|
|
34
|
+
readonly chooseMode: Schema.Trimmed;
|
|
35
|
+
readonly leftoverLabel: Schema.Trimmed;
|
|
36
|
+
readonly modes: Schema.$Record<Schema.Literals<readonly ["exact", "hydrogen-excess", "oxygen-excess"]>, Schema.Struct<{
|
|
37
|
+
readonly helperCaption: RichSlot<E>;
|
|
38
|
+
readonly leftover: RichSlot<E>;
|
|
39
|
+
readonly ratio: RichSlot<E>;
|
|
40
|
+
readonly readoutAfter: RichSlot<E>;
|
|
41
|
+
readonly readoutBefore: RichSlot<E>;
|
|
42
|
+
readonly tab: RichSlot<E>;
|
|
43
|
+
readonly tabLabel: Schema.Trimmed;
|
|
44
|
+
}>>;
|
|
45
|
+
readonly ratioLabel: Schema.Trimmed;
|
|
46
|
+
readonly reactionView: Schema.Trimmed;
|
|
47
|
+
}>;
|
|
48
|
+
}>>;
|
|
49
|
+
MassConservationLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
50
|
+
readonly description: RichSlot<E>;
|
|
51
|
+
readonly title: RichSlot<E>;
|
|
52
|
+
readonly labels: Schema.Struct<{
|
|
53
|
+
readonly after: Schema.Trimmed;
|
|
54
|
+
readonly before: Schema.Trimmed;
|
|
55
|
+
readonly calculationLabel: Schema.Trimmed;
|
|
56
|
+
readonly chooseMode: Schema.Trimmed;
|
|
57
|
+
readonly modes: Schema.$Record<Schema.Literals<readonly ["closed", "open"]>, Schema.Struct<{
|
|
58
|
+
readonly calculation: RichSlot<E>;
|
|
59
|
+
readonly helperCaption: RichSlot<E>;
|
|
60
|
+
readonly readoutAfter: RichSlot<E>;
|
|
61
|
+
readonly readoutBefore: RichSlot<E>;
|
|
62
|
+
readonly system: RichSlot<E>;
|
|
63
|
+
readonly tab: Schema.Trimmed;
|
|
64
|
+
}>>;
|
|
65
|
+
readonly reactionView: Schema.Trimmed;
|
|
66
|
+
readonly systemLabel: Schema.Trimmed;
|
|
67
|
+
}>;
|
|
68
|
+
}>>;
|
|
69
|
+
MultipleProportionsLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
70
|
+
readonly description: RichSlot<E>;
|
|
71
|
+
readonly title: RichSlot<E>;
|
|
72
|
+
readonly labels: Schema.Struct<{
|
|
73
|
+
readonly changingLabel: Schema.Trimmed;
|
|
74
|
+
readonly chooseMode: Schema.Trimmed;
|
|
75
|
+
readonly comparisonView: Schema.Trimmed;
|
|
76
|
+
readonly fixedLabel: Schema.Trimmed;
|
|
77
|
+
readonly modes: Schema.$Record<Schema.Literals<readonly ["water-peroxide", "carbon-oxides", "nitrogen-oxides"]>, Schema.Struct<{
|
|
78
|
+
readonly changing: RichSlot<E>;
|
|
79
|
+
readonly fixed: RichSlot<E>;
|
|
80
|
+
readonly helperCaption: RichSlot<E>;
|
|
81
|
+
readonly tab: RichSlot<E>;
|
|
82
|
+
readonly tabLabel: Schema.Trimmed;
|
|
83
|
+
}>>;
|
|
84
|
+
}>;
|
|
85
|
+
}>>;
|
|
86
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, cardFields, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The reactions of the law of combining volumes. */
|
|
5
|
+
const COMBINING_MODES = [
|
|
6
|
+
"water-vapor",
|
|
7
|
+
"ammonia-synthesis",
|
|
8
|
+
"ammonia-decomposition",
|
|
9
|
+
];
|
|
10
|
+
/** The mixtures of the law of constant composition. */
|
|
11
|
+
const CONSTANT_MODES = ["exact", "hydrogen-excess", "oxygen-excess"];
|
|
12
|
+
/** The systems of the law of conservation of mass. */
|
|
13
|
+
const CONSERVATION_MODES = ["closed", "open"];
|
|
14
|
+
/** The compound pairs of the law of multiple proportions. */
|
|
15
|
+
const MULTIPLE_MODES = [
|
|
16
|
+
"water-peroxide",
|
|
17
|
+
"carbon-oxides",
|
|
18
|
+
"nitrogen-oxides",
|
|
19
|
+
];
|
|
20
|
+
/** Props of `CombiningVolumesLab`: gas volumes that react in whole ratios. */
|
|
21
|
+
function combiningVolumesLab(rich) {
|
|
22
|
+
return figure(Schema.Struct({
|
|
23
|
+
...cardFields(rich),
|
|
24
|
+
labels: Schema.Struct({
|
|
25
|
+
chooseMode: TextSchema,
|
|
26
|
+
exampleLabel: TextSchema,
|
|
27
|
+
modes: byIds(COMBINING_MODES, Schema.Struct({
|
|
28
|
+
example: rich,
|
|
29
|
+
helperCaption: rich,
|
|
30
|
+
ratio: rich,
|
|
31
|
+
tab: rich,
|
|
32
|
+
tabLabel: TextSchema,
|
|
33
|
+
})),
|
|
34
|
+
products: TextSchema,
|
|
35
|
+
ratioLabel: TextSchema,
|
|
36
|
+
reactants: TextSchema,
|
|
37
|
+
reactionView: TextSchema,
|
|
38
|
+
volumeUnit: TextSchema,
|
|
39
|
+
}),
|
|
40
|
+
}), answerAt(["labels", "modes", "*", "ratio"]));
|
|
41
|
+
}
|
|
42
|
+
/** Props of `ConstantCompositionLab`: one compound, one mass ratio. */
|
|
43
|
+
function constantCompositionLab(rich) {
|
|
44
|
+
return figure(Schema.Struct({
|
|
45
|
+
...cardFields(rich),
|
|
46
|
+
labels: Schema.Struct({
|
|
47
|
+
after: TextSchema,
|
|
48
|
+
before: TextSchema,
|
|
49
|
+
chooseMode: TextSchema,
|
|
50
|
+
leftoverLabel: TextSchema,
|
|
51
|
+
modes: byIds(CONSTANT_MODES, Schema.Struct({
|
|
52
|
+
helperCaption: rich,
|
|
53
|
+
leftover: rich,
|
|
54
|
+
ratio: rich,
|
|
55
|
+
readoutAfter: rich,
|
|
56
|
+
readoutBefore: rich,
|
|
57
|
+
tab: rich,
|
|
58
|
+
tabLabel: TextSchema,
|
|
59
|
+
})),
|
|
60
|
+
ratioLabel: TextSchema,
|
|
61
|
+
reactionView: TextSchema,
|
|
62
|
+
}),
|
|
63
|
+
}), answerAt(["labels", "modes", "*", "leftover"], ["labels", "modes", "*", "ratio"]));
|
|
64
|
+
}
|
|
65
|
+
/** Props of `MassConservationLab`: the mass of a closed and an open system. */
|
|
66
|
+
function massConservationLab(rich) {
|
|
67
|
+
return figure(Schema.Struct({
|
|
68
|
+
...cardFields(rich),
|
|
69
|
+
labels: Schema.Struct({
|
|
70
|
+
after: TextSchema,
|
|
71
|
+
before: TextSchema,
|
|
72
|
+
calculationLabel: TextSchema,
|
|
73
|
+
chooseMode: TextSchema,
|
|
74
|
+
modes: byIds(CONSERVATION_MODES, Schema.Struct({
|
|
75
|
+
calculation: rich,
|
|
76
|
+
helperCaption: rich,
|
|
77
|
+
readoutAfter: rich,
|
|
78
|
+
readoutBefore: rich,
|
|
79
|
+
system: rich,
|
|
80
|
+
tab: TextSchema,
|
|
81
|
+
})),
|
|
82
|
+
reactionView: TextSchema,
|
|
83
|
+
systemLabel: TextSchema,
|
|
84
|
+
}),
|
|
85
|
+
}), answerAt(["labels", "modes", "*", "calculation"]));
|
|
86
|
+
}
|
|
87
|
+
/** Props of `MultipleProportionsLab`: one element fixed, the other in small ratios. */
|
|
88
|
+
function multipleProportionsLab(rich) {
|
|
89
|
+
return figure(Schema.Struct({
|
|
90
|
+
...cardFields(rich),
|
|
91
|
+
labels: Schema.Struct({
|
|
92
|
+
changingLabel: TextSchema,
|
|
93
|
+
chooseMode: TextSchema,
|
|
94
|
+
comparisonView: TextSchema,
|
|
95
|
+
fixedLabel: TextSchema,
|
|
96
|
+
modes: byIds(MULTIPLE_MODES, Schema.Struct({
|
|
97
|
+
changing: rich,
|
|
98
|
+
fixed: rich,
|
|
99
|
+
helperCaption: rich,
|
|
100
|
+
tab: rich,
|
|
101
|
+
tabLabel: TextSchema,
|
|
102
|
+
})),
|
|
103
|
+
}),
|
|
104
|
+
}), answerAt(["labels", "modes", "*", "changing"]));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The labs of the basic chemical laws. A ratio, a leftover, and a calculation
|
|
108
|
+
* state the result each law predicts, so they are answer state.
|
|
109
|
+
*/
|
|
110
|
+
export function lawVisuals(rich) {
|
|
111
|
+
return {
|
|
112
|
+
CombiningVolumesLab: combiningVolumesLab(rich),
|
|
113
|
+
ConstantCompositionLab: constantCompositionLab(rich),
|
|
114
|
+
MassConservationLab: massConservationLab(rich),
|
|
115
|
+
MultipleProportionsLab: multipleProportionsLab(rich),
|
|
116
|
+
};
|
|
117
|
+
}
|