@nakafa/aksara-contracts 8.10.0 → 8.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/dist/visual/biology/binomial.d.ts +139 -0
- package/dist/visual/biology/binomial.js +46 -0
- package/dist/visual/biology/bone.d.ts +141 -0
- package/dist/visual/biology/bone.js +46 -0
- package/dist/visual/biology/chromosome.d.ts +139 -0
- package/dist/visual/biology/chromosome.js +42 -0
- package/dist/visual/biology/control.d.ts +17 -0
- package/dist/visual/biology/control.js +21 -0
- package/dist/visual/biology/denature.d.ts +159 -0
- package/dist/visual/biology/denature.js +74 -0
- package/dist/visual/biology/drawing.d.ts +151 -0
- package/dist/visual/biology/drawing.js +69 -0
- package/dist/visual/biology/enzyme.d.ts +145 -0
- package/dist/visual/biology/enzyme.js +54 -0
- package/dist/visual/biology/equipment.d.ts +140 -0
- package/dist/visual/biology/equipment.js +64 -0
- package/dist/visual/biology/gametogenesis.d.ts +145 -0
- package/dist/visual/biology/gametogenesis.js +83 -0
- package/dist/visual/biology/implantation.d.ts +138 -0
- package/dist/visual/biology/implantation.js +44 -0
- package/dist/visual/biology/joint.d.ts +140 -0
- package/dist/visual/biology/joint.js +47 -0
- package/dist/visual/biology/key.d.ts +141 -0
- package/dist/visual/biology/key.js +58 -0
- package/dist/visual/biology/kingdom.d.ts +142 -0
- package/dist/visual/biology/kingdom.js +82 -0
- package/dist/visual/biology/lactase.d.ts +147 -0
- package/dist/visual/biology/lactase.js +48 -0
- package/dist/visual/biology/leaf.d.ts +436 -0
- package/dist/visual/biology/leaf.js +151 -0
- package/dist/visual/biology/limb.d.ts +139 -0
- package/dist/visual/biology/limb.js +44 -0
- package/dist/visual/biology/lipid.d.ts +144 -0
- package/dist/visual/biology/lipid.js +43 -0
- package/dist/visual/biology/locomotion.d.ts +141 -0
- package/dist/visual/biology/locomotion.js +48 -0
- package/dist/visual/biology/menstrual.d.ts +148 -0
- package/dist/visual/biology/menstrual.js +65 -0
- package/dist/visual/biology/metamorphosis.d.ts +140 -0
- package/dist/visual/biology/metamorphosis.js +34 -0
- package/dist/visual/biology/placenta.d.ts +139 -0
- package/dist/visual/biology/placenta.js +52 -0
- package/dist/visual/biology/planes.d.ts +145 -0
- package/dist/visual/biology/planes.js +62 -0
- package/dist/visual/biology/protein.d.ts +142 -0
- package/dist/visual/biology/protein.js +41 -0
- package/dist/visual/biology/saturation.d.ts +149 -0
- package/dist/visual/biology/saturation.js +40 -0
- package/dist/visual/biology/secretion.d.ts +149 -0
- package/dist/visual/biology/secretion.js +79 -0
- package/dist/visual/biology/spill.d.ts +165 -0
- package/dist/visual/biology/spill.js +58 -0
- package/dist/visual/biology/sugar.d.ts +152 -0
- package/dist/visual/biology/sugar.js +59 -0
- package/dist/visual/biology/taxon.d.ts +138 -0
- package/dist/visual/biology/taxon.js +50 -0
- package/dist/visual/biology/tissue.d.ts +424 -0
- package/dist/visual/biology/tissue.js +140 -0
- package/dist/visual/biology/twins.d.ts +144 -0
- package/dist/visual/biology/twins.js +60 -0
- package/dist/visual/biology/vernacular.d.ts +141 -0
- package/dist/visual/biology/vernacular.js +57 -0
- package/dist/visual/biology/vertebra.d.ts +141 -0
- package/dist/visual/biology/vertebra.js +59 -0
- package/dist/visual/biology/waste.d.ts +140 -0
- package/dist/visual/biology/waste.js +57 -0
- package/dist/visual/biology/water.d.ts +152 -0
- package/dist/visual/biology/water.js +54 -0
- package/dist/visual/card.d.ts +11 -0
- package/dist/visual/card.js +17 -1
- package/dist/visual/catalog.d.ts +6886 -754
- package/dist/visual/catalog.js +72 -0
- package/dist/visual/chemistry/equilibrium.d.ts +449 -0
- package/dist/visual/chemistry/equilibrium.js +135 -0
- package/dist/visual/mathematics/argument.d.ts +226 -0
- package/dist/visual/mathematics/argument.js +150 -0
- package/dist/visual/mathematics/counterexample.d.ts +340 -0
- package/dist/visual/mathematics/counterexample.js +157 -0
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The joint lab. Every prop names what the learner explores; none is answer state. */
|
|
4
|
+
export declare function jointVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
JointMovementLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
8
|
+
readonly marks?: readonly [{
|
|
9
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
10
|
+
} | {
|
|
11
|
+
readonly attrs: {
|
|
12
|
+
readonly href: string;
|
|
13
|
+
};
|
|
14
|
+
readonly type: "link";
|
|
15
|
+
} | {
|
|
16
|
+
readonly attrs: {
|
|
17
|
+
readonly variant: "success" | "warning" | null;
|
|
18
|
+
};
|
|
19
|
+
readonly type: "highlight";
|
|
20
|
+
}, ...({
|
|
21
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
22
|
+
} | {
|
|
23
|
+
readonly attrs: {
|
|
24
|
+
readonly href: string;
|
|
25
|
+
};
|
|
26
|
+
readonly type: "link";
|
|
27
|
+
} | {
|
|
28
|
+
readonly attrs: {
|
|
29
|
+
readonly variant: "success" | "warning" | null;
|
|
30
|
+
};
|
|
31
|
+
readonly type: "highlight";
|
|
32
|
+
})[]];
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly type: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly attrs: {
|
|
37
|
+
readonly latex: string;
|
|
38
|
+
};
|
|
39
|
+
readonly marks?: readonly [{
|
|
40
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
41
|
+
} | {
|
|
42
|
+
readonly attrs: {
|
|
43
|
+
readonly href: string;
|
|
44
|
+
};
|
|
45
|
+
readonly type: "link";
|
|
46
|
+
} | {
|
|
47
|
+
readonly attrs: {
|
|
48
|
+
readonly variant: "success" | "warning" | null;
|
|
49
|
+
};
|
|
50
|
+
readonly type: "highlight";
|
|
51
|
+
}, ...({
|
|
52
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
53
|
+
} | {
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly href: string;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "link";
|
|
58
|
+
} | {
|
|
59
|
+
readonly attrs: {
|
|
60
|
+
readonly variant: "success" | "warning" | null;
|
|
61
|
+
};
|
|
62
|
+
readonly type: "highlight";
|
|
63
|
+
})[]];
|
|
64
|
+
readonly type: "mathInline";
|
|
65
|
+
}, ...({
|
|
66
|
+
readonly marks?: readonly [{
|
|
67
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
68
|
+
} | {
|
|
69
|
+
readonly attrs: {
|
|
70
|
+
readonly href: string;
|
|
71
|
+
};
|
|
72
|
+
readonly type: "link";
|
|
73
|
+
} | {
|
|
74
|
+
readonly attrs: {
|
|
75
|
+
readonly variant: "success" | "warning" | null;
|
|
76
|
+
};
|
|
77
|
+
readonly type: "highlight";
|
|
78
|
+
}, ...({
|
|
79
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
80
|
+
} | {
|
|
81
|
+
readonly attrs: {
|
|
82
|
+
readonly href: string;
|
|
83
|
+
};
|
|
84
|
+
readonly type: "link";
|
|
85
|
+
} | {
|
|
86
|
+
readonly attrs: {
|
|
87
|
+
readonly variant: "success" | "warning" | null;
|
|
88
|
+
};
|
|
89
|
+
readonly type: "highlight";
|
|
90
|
+
})[]];
|
|
91
|
+
readonly text: string;
|
|
92
|
+
readonly type: "text";
|
|
93
|
+
} | {
|
|
94
|
+
readonly attrs: {
|
|
95
|
+
readonly latex: string;
|
|
96
|
+
};
|
|
97
|
+
readonly marks?: readonly [{
|
|
98
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
99
|
+
} | {
|
|
100
|
+
readonly attrs: {
|
|
101
|
+
readonly href: string;
|
|
102
|
+
};
|
|
103
|
+
readonly type: "link";
|
|
104
|
+
} | {
|
|
105
|
+
readonly attrs: {
|
|
106
|
+
readonly variant: "success" | "warning" | null;
|
|
107
|
+
};
|
|
108
|
+
readonly type: "highlight";
|
|
109
|
+
}, ...({
|
|
110
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
111
|
+
} | {
|
|
112
|
+
readonly attrs: {
|
|
113
|
+
readonly href: string;
|
|
114
|
+
};
|
|
115
|
+
readonly type: "link";
|
|
116
|
+
} | {
|
|
117
|
+
readonly attrs: {
|
|
118
|
+
readonly variant: "success" | "warning" | null;
|
|
119
|
+
};
|
|
120
|
+
readonly type: "highlight";
|
|
121
|
+
})[]];
|
|
122
|
+
readonly type: "mathInline";
|
|
123
|
+
})[]], E, never, never>>;
|
|
124
|
+
readonly title: RichSlot<E>;
|
|
125
|
+
readonly joints: Schema.NonEmptyArray<Schema.Literals<readonly ["suture", "disc", "hinge", "ballSocket"]>>;
|
|
126
|
+
readonly labels: Schema.Struct<{
|
|
127
|
+
readonly example: RichSlot<E>;
|
|
128
|
+
readonly joint: Schema.Trimmed;
|
|
129
|
+
readonly joints: Schema.$Record<Schema.Literals<readonly ["suture", "disc", "hinge", "ballSocket"]>, Schema.optionalKey<Schema.Struct<{
|
|
130
|
+
readonly example: RichSlot<E>;
|
|
131
|
+
readonly movement: RichSlot<E>;
|
|
132
|
+
readonly name: Schema.Trimmed;
|
|
133
|
+
}>>>;
|
|
134
|
+
readonly move: Schema.Trimmed;
|
|
135
|
+
readonly movement: RichSlot<E>;
|
|
136
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["bone", "cartilage", "membrane", "fluid", "ligament", "tendon", "muscle"]>, Schema.Trimmed>;
|
|
137
|
+
readonly view: Schema.Trimmed;
|
|
138
|
+
}>;
|
|
139
|
+
}>, "figure">;
|
|
140
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { figure } from "#contracts/visual/entry";
|
|
4
|
+
/**
|
|
5
|
+
* The joints the lab can show, from the least to the most movable: a skull
|
|
6
|
+
* suture, the cartilage joint between two vertebrae, a hinge joint (the elbow)
|
|
7
|
+
* and a ball-and-socket joint (the shoulder).
|
|
8
|
+
*/
|
|
9
|
+
const JOINTS = ["suture", "disc", "hinge", "ballSocket"];
|
|
10
|
+
/**
|
|
11
|
+
* Props of `JointMovementLab`: one human joint at a time, picked from
|
|
12
|
+
* `joints` (each once, in the order the toggle lists them). The learner moves
|
|
13
|
+
* the bone with a slider labelled `labels.move` as far as the joint allows;
|
|
14
|
+
* the readouts give an example of the joint and how it moves, words from
|
|
15
|
+
* `labels.joints`, one entry for each joint shown and no other. The scene
|
|
16
|
+
* labels the bone, cartilage, synovial membrane and fluid, ligament, tendon
|
|
17
|
+
* and muscle.
|
|
18
|
+
*/
|
|
19
|
+
function jointMovementLab(rich) {
|
|
20
|
+
return figure(Schema.Struct({
|
|
21
|
+
...cardFields(rich),
|
|
22
|
+
joints: Schema.NonEmptyArray(Schema.Literals(JOINTS)).check(Schema.isUnique()),
|
|
23
|
+
labels: Schema.Struct({
|
|
24
|
+
example: rich,
|
|
25
|
+
joint: TextSchema,
|
|
26
|
+
joints: byPickedIds(JOINTS, Schema.Struct({ example: rich, movement: rich, name: TextSchema })),
|
|
27
|
+
move: TextSchema,
|
|
28
|
+
movement: rich,
|
|
29
|
+
parts: byIds([
|
|
30
|
+
"bone",
|
|
31
|
+
"cartilage",
|
|
32
|
+
"membrane",
|
|
33
|
+
"fluid",
|
|
34
|
+
"ligament",
|
|
35
|
+
"tendon",
|
|
36
|
+
"muscle",
|
|
37
|
+
], TextSchema),
|
|
38
|
+
view: TextSchema,
|
|
39
|
+
}),
|
|
40
|
+
}).check(Schema.makeFilter(({ joints, labels }) => namesEach(joints, labels.joints), {
|
|
41
|
+
message: "Expected words for every joint the lab shows, and no other.",
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
/** The joint lab. Every prop names what the learner explores; none is answer state. */
|
|
45
|
+
export function jointVisuals(rich) {
|
|
46
|
+
return { JointMovementLab: jointMovementLab(rich) };
|
|
47
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The key builder lab. The key's result is shown as the learner runs it; no prop is answer state. */
|
|
4
|
+
export declare function keyVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
KeyBuilderLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
8
|
+
readonly marks?: readonly [{
|
|
9
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
10
|
+
} | {
|
|
11
|
+
readonly attrs: {
|
|
12
|
+
readonly href: string;
|
|
13
|
+
};
|
|
14
|
+
readonly type: "link";
|
|
15
|
+
} | {
|
|
16
|
+
readonly attrs: {
|
|
17
|
+
readonly variant: "success" | "warning" | null;
|
|
18
|
+
};
|
|
19
|
+
readonly type: "highlight";
|
|
20
|
+
}, ...({
|
|
21
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
22
|
+
} | {
|
|
23
|
+
readonly attrs: {
|
|
24
|
+
readonly href: string;
|
|
25
|
+
};
|
|
26
|
+
readonly type: "link";
|
|
27
|
+
} | {
|
|
28
|
+
readonly attrs: {
|
|
29
|
+
readonly variant: "success" | "warning" | null;
|
|
30
|
+
};
|
|
31
|
+
readonly type: "highlight";
|
|
32
|
+
})[]];
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly type: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly attrs: {
|
|
37
|
+
readonly latex: string;
|
|
38
|
+
};
|
|
39
|
+
readonly marks?: readonly [{
|
|
40
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
41
|
+
} | {
|
|
42
|
+
readonly attrs: {
|
|
43
|
+
readonly href: string;
|
|
44
|
+
};
|
|
45
|
+
readonly type: "link";
|
|
46
|
+
} | {
|
|
47
|
+
readonly attrs: {
|
|
48
|
+
readonly variant: "success" | "warning" | null;
|
|
49
|
+
};
|
|
50
|
+
readonly type: "highlight";
|
|
51
|
+
}, ...({
|
|
52
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
53
|
+
} | {
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly href: string;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "link";
|
|
58
|
+
} | {
|
|
59
|
+
readonly attrs: {
|
|
60
|
+
readonly variant: "success" | "warning" | null;
|
|
61
|
+
};
|
|
62
|
+
readonly type: "highlight";
|
|
63
|
+
})[]];
|
|
64
|
+
readonly type: "mathInline";
|
|
65
|
+
}, ...({
|
|
66
|
+
readonly marks?: readonly [{
|
|
67
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
68
|
+
} | {
|
|
69
|
+
readonly attrs: {
|
|
70
|
+
readonly href: string;
|
|
71
|
+
};
|
|
72
|
+
readonly type: "link";
|
|
73
|
+
} | {
|
|
74
|
+
readonly attrs: {
|
|
75
|
+
readonly variant: "success" | "warning" | null;
|
|
76
|
+
};
|
|
77
|
+
readonly type: "highlight";
|
|
78
|
+
}, ...({
|
|
79
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
80
|
+
} | {
|
|
81
|
+
readonly attrs: {
|
|
82
|
+
readonly href: string;
|
|
83
|
+
};
|
|
84
|
+
readonly type: "link";
|
|
85
|
+
} | {
|
|
86
|
+
readonly attrs: {
|
|
87
|
+
readonly variant: "success" | "warning" | null;
|
|
88
|
+
};
|
|
89
|
+
readonly type: "highlight";
|
|
90
|
+
})[]];
|
|
91
|
+
readonly text: string;
|
|
92
|
+
readonly type: "text";
|
|
93
|
+
} | {
|
|
94
|
+
readonly attrs: {
|
|
95
|
+
readonly latex: string;
|
|
96
|
+
};
|
|
97
|
+
readonly marks?: readonly [{
|
|
98
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
99
|
+
} | {
|
|
100
|
+
readonly attrs: {
|
|
101
|
+
readonly href: string;
|
|
102
|
+
};
|
|
103
|
+
readonly type: "link";
|
|
104
|
+
} | {
|
|
105
|
+
readonly attrs: {
|
|
106
|
+
readonly variant: "success" | "warning" | null;
|
|
107
|
+
};
|
|
108
|
+
readonly type: "highlight";
|
|
109
|
+
}, ...({
|
|
110
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
111
|
+
} | {
|
|
112
|
+
readonly attrs: {
|
|
113
|
+
readonly href: string;
|
|
114
|
+
};
|
|
115
|
+
readonly type: "link";
|
|
116
|
+
} | {
|
|
117
|
+
readonly attrs: {
|
|
118
|
+
readonly variant: "success" | "warning" | null;
|
|
119
|
+
};
|
|
120
|
+
readonly type: "highlight";
|
|
121
|
+
})[]];
|
|
122
|
+
readonly type: "mathInline";
|
|
123
|
+
})[]], E, never, never>>;
|
|
124
|
+
readonly title: RichSlot<E>;
|
|
125
|
+
readonly animals: Schema.NonEmptyArray<Schema.Literals<readonly ["ant", "dragonfly", "spider", "centipede", "earthworm", "snail"]>>;
|
|
126
|
+
readonly couplets: Schema.NonEmptyArray<Schema.Literals<readonly ["legs", "pairs", "wings", "segments", "shell", "size", "colour", "overlap"]>>;
|
|
127
|
+
readonly labels: Schema.Struct<{
|
|
128
|
+
readonly animals: Schema.$Record<Schema.Literals<readonly ["ant", "dragonfly", "spider", "centipede", "earthworm", "snail"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
129
|
+
readonly couplets: Schema.$Record<Schema.Literals<readonly ["legs", "pairs", "wings", "segments", "shell", "size", "colour", "overlap"]>, Schema.optionalKey<Schema.Struct<{
|
|
130
|
+
readonly a: Schema.Trimmed;
|
|
131
|
+
readonly b: Schema.Trimmed;
|
|
132
|
+
}>>>;
|
|
133
|
+
readonly failed: RichSlot<E>;
|
|
134
|
+
readonly reached: RichSlot<E>;
|
|
135
|
+
readonly run: Schema.Trimmed;
|
|
136
|
+
readonly sorted: RichSlot<E>;
|
|
137
|
+
readonly step: Schema.Trimmed;
|
|
138
|
+
readonly view: Schema.Trimmed;
|
|
139
|
+
}>;
|
|
140
|
+
}>, "figure">;
|
|
141
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { figure } from "#contracts/visual/entry";
|
|
4
|
+
/** Small animals a school key sorts, each with the features the couplets ask about. */
|
|
5
|
+
const ANIMALS = [
|
|
6
|
+
"ant",
|
|
7
|
+
"dragonfly",
|
|
8
|
+
"spider",
|
|
9
|
+
"centipede",
|
|
10
|
+
"earthworm",
|
|
11
|
+
"snail",
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Couplets a learner can use to build a key: good ones ask about a feature
|
|
15
|
+
* that is plainly there or not (legs, pairs of legs, wings, segments, shell);
|
|
16
|
+
* poor ones ask about size, colour or two features that overlap.
|
|
17
|
+
*/
|
|
18
|
+
const COUPLETS = [
|
|
19
|
+
"legs",
|
|
20
|
+
"pairs",
|
|
21
|
+
"wings",
|
|
22
|
+
"segments",
|
|
23
|
+
"shell",
|
|
24
|
+
"size",
|
|
25
|
+
"colour",
|
|
26
|
+
"overlap",
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Props of `KeyBuilderLab`: a tray of `animals` (each once) beside a
|
|
30
|
+
* dichotomous key the learner builds from `couplets` (each once). Running the
|
|
31
|
+
* key sends each animal down it step by step; the readouts give how many reach
|
|
32
|
+
* their own name, the step where an animal jams, or that the key works for
|
|
33
|
+
* every animal. `labels.couplets` gives both statements of each couplet.
|
|
34
|
+
*/
|
|
35
|
+
function keyBuilderLab(rich) {
|
|
36
|
+
return figure(Schema.Struct({
|
|
37
|
+
...cardFields(rich),
|
|
38
|
+
animals: Schema.NonEmptyArray(Schema.Literals(ANIMALS)).check(Schema.isUnique()),
|
|
39
|
+
couplets: Schema.NonEmptyArray(Schema.Literals(COUPLETS)).check(Schema.isUnique()),
|
|
40
|
+
labels: Schema.Struct({
|
|
41
|
+
animals: byPickedIds(ANIMALS, TextSchema),
|
|
42
|
+
couplets: byPickedIds(COUPLETS, Schema.Struct({ a: TextSchema, b: TextSchema })),
|
|
43
|
+
failed: rich,
|
|
44
|
+
reached: rich,
|
|
45
|
+
run: TextSchema,
|
|
46
|
+
sorted: rich,
|
|
47
|
+
step: TextSchema,
|
|
48
|
+
view: TextSchema,
|
|
49
|
+
}),
|
|
50
|
+
}).check(Schema.makeFilter(({ animals, couplets, labels }) => namesEach(animals, labels.animals) &&
|
|
51
|
+
namesEach(couplets, labels.couplets), {
|
|
52
|
+
message: "Expected a name for every animal and both statements of every couplet the lab shows, and no other.",
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
/** The key builder lab. The key's result is shown as the learner runs it; no prop is answer state. */
|
|
56
|
+
export function keyVisuals(rich) {
|
|
57
|
+
return { KeyBuilderLab: keyBuilderLab(rich) };
|
|
58
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The kingdom lab. The feedback after a placement tells the learner the
|
|
5
|
+
* answer, so it is answer state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function kingdomVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
KingdomSortLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
|
+
readonly description: RichSlot<E>;
|
|
10
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
11
|
+
readonly marks?: readonly [{
|
|
12
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
13
|
+
} | {
|
|
14
|
+
readonly attrs: {
|
|
15
|
+
readonly href: string;
|
|
16
|
+
};
|
|
17
|
+
readonly type: "link";
|
|
18
|
+
} | {
|
|
19
|
+
readonly attrs: {
|
|
20
|
+
readonly variant: "success" | "warning" | null;
|
|
21
|
+
};
|
|
22
|
+
readonly type: "highlight";
|
|
23
|
+
}, ...({
|
|
24
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
25
|
+
} | {
|
|
26
|
+
readonly attrs: {
|
|
27
|
+
readonly href: string;
|
|
28
|
+
};
|
|
29
|
+
readonly type: "link";
|
|
30
|
+
} | {
|
|
31
|
+
readonly attrs: {
|
|
32
|
+
readonly variant: "success" | "warning" | null;
|
|
33
|
+
};
|
|
34
|
+
readonly type: "highlight";
|
|
35
|
+
})[]];
|
|
36
|
+
readonly text: string;
|
|
37
|
+
readonly type: "text";
|
|
38
|
+
} | {
|
|
39
|
+
readonly attrs: {
|
|
40
|
+
readonly latex: string;
|
|
41
|
+
};
|
|
42
|
+
readonly marks?: readonly [{
|
|
43
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
44
|
+
} | {
|
|
45
|
+
readonly attrs: {
|
|
46
|
+
readonly href: string;
|
|
47
|
+
};
|
|
48
|
+
readonly type: "link";
|
|
49
|
+
} | {
|
|
50
|
+
readonly attrs: {
|
|
51
|
+
readonly variant: "success" | "warning" | null;
|
|
52
|
+
};
|
|
53
|
+
readonly type: "highlight";
|
|
54
|
+
}, ...({
|
|
55
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
56
|
+
} | {
|
|
57
|
+
readonly attrs: {
|
|
58
|
+
readonly href: string;
|
|
59
|
+
};
|
|
60
|
+
readonly type: "link";
|
|
61
|
+
} | {
|
|
62
|
+
readonly attrs: {
|
|
63
|
+
readonly variant: "success" | "warning" | null;
|
|
64
|
+
};
|
|
65
|
+
readonly type: "highlight";
|
|
66
|
+
})[]];
|
|
67
|
+
readonly type: "mathInline";
|
|
68
|
+
}, ...({
|
|
69
|
+
readonly marks?: readonly [{
|
|
70
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
71
|
+
} | {
|
|
72
|
+
readonly attrs: {
|
|
73
|
+
readonly href: string;
|
|
74
|
+
};
|
|
75
|
+
readonly type: "link";
|
|
76
|
+
} | {
|
|
77
|
+
readonly attrs: {
|
|
78
|
+
readonly variant: "success" | "warning" | null;
|
|
79
|
+
};
|
|
80
|
+
readonly type: "highlight";
|
|
81
|
+
}, ...({
|
|
82
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
83
|
+
} | {
|
|
84
|
+
readonly attrs: {
|
|
85
|
+
readonly href: string;
|
|
86
|
+
};
|
|
87
|
+
readonly type: "link";
|
|
88
|
+
} | {
|
|
89
|
+
readonly attrs: {
|
|
90
|
+
readonly variant: "success" | "warning" | null;
|
|
91
|
+
};
|
|
92
|
+
readonly type: "highlight";
|
|
93
|
+
})[]];
|
|
94
|
+
readonly text: string;
|
|
95
|
+
readonly type: "text";
|
|
96
|
+
} | {
|
|
97
|
+
readonly attrs: {
|
|
98
|
+
readonly latex: string;
|
|
99
|
+
};
|
|
100
|
+
readonly marks?: readonly [{
|
|
101
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
102
|
+
} | {
|
|
103
|
+
readonly attrs: {
|
|
104
|
+
readonly href: string;
|
|
105
|
+
};
|
|
106
|
+
readonly type: "link";
|
|
107
|
+
} | {
|
|
108
|
+
readonly attrs: {
|
|
109
|
+
readonly variant: "success" | "warning" | null;
|
|
110
|
+
};
|
|
111
|
+
readonly type: "highlight";
|
|
112
|
+
}, ...({
|
|
113
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
114
|
+
} | {
|
|
115
|
+
readonly attrs: {
|
|
116
|
+
readonly href: string;
|
|
117
|
+
};
|
|
118
|
+
readonly type: "link";
|
|
119
|
+
} | {
|
|
120
|
+
readonly attrs: {
|
|
121
|
+
readonly variant: "success" | "warning" | null;
|
|
122
|
+
};
|
|
123
|
+
readonly type: "highlight";
|
|
124
|
+
})[]];
|
|
125
|
+
readonly type: "mathInline";
|
|
126
|
+
})[]], E, never, never>>;
|
|
127
|
+
readonly title: RichSlot<E>;
|
|
128
|
+
readonly labels: Schema.Struct<{
|
|
129
|
+
readonly checks: Schema.$Record<Schema.Literals<readonly ["nucleus", "cells", "wall", "food"]>, Schema.Trimmed>;
|
|
130
|
+
readonly kingdom: Schema.optionalKey<RichSlot<E>>;
|
|
131
|
+
readonly kingdoms: Schema.$Record<Schema.Literals<readonly ["archaebacteria", "eubacteria", "protista", "fungi", "plantae", "animalia"]>, Schema.Trimmed>;
|
|
132
|
+
readonly place: Schema.Trimmed;
|
|
133
|
+
readonly right: Schema.optionalKey<RichSlot<E>>;
|
|
134
|
+
readonly specimen: Schema.Trimmed;
|
|
135
|
+
readonly specimens: Schema.$Record<Schema.Literals<readonly ["sulfolobus", "thermus", "paramecium", "spirogyra", "slimeMould", "yeast", "mushroom", "fern", "padi", "hydra"]>, Schema.optionalKey<RichSlot<E>>>;
|
|
136
|
+
readonly values: Schema.$Record<Schema.Literals<readonly ["yes", "no", "one", "many", "tissue", "none", "peptidoglycan", "noPeptidoglycan", "chitin", "cellulose", "photosynthesis", "absorbs", "ingests", "either"]>, Schema.Trimmed>;
|
|
137
|
+
readonly view: Schema.Trimmed;
|
|
138
|
+
readonly wrong: Schema.optionalKey<RichSlot<E>>;
|
|
139
|
+
}>;
|
|
140
|
+
readonly specimens: Schema.NonEmptyArray<Schema.Literals<readonly ["sulfolobus", "thermus", "paramecium", "spirogyra", "slimeMould", "yeast", "mushroom", "fern", "padi", "hydra"]>>;
|
|
141
|
+
}>, "figure">;
|
|
142
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/**
|
|
5
|
+
* Specimens that each match exactly one of the six kingdoms on four features
|
|
6
|
+
* (nucleus, number of cells, cell wall, how it gets food); which one is a fact
|
|
7
|
+
* the renderer's model holds.
|
|
8
|
+
*/
|
|
9
|
+
const SPECIMENS = [
|
|
10
|
+
"sulfolobus",
|
|
11
|
+
"thermus",
|
|
12
|
+
"paramecium",
|
|
13
|
+
"spirogyra",
|
|
14
|
+
"slimeMould",
|
|
15
|
+
"yeast",
|
|
16
|
+
"mushroom",
|
|
17
|
+
"fern",
|
|
18
|
+
"padi",
|
|
19
|
+
"hydra",
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Props of `KingdomSortLab`: a lab bench with a microscope, `specimens`
|
|
23
|
+
* (each once) and six kingdom trays. The learner looks at a specimen's four
|
|
24
|
+
* features, words from `labels.checks` and `labels.values`, and places it in
|
|
25
|
+
* a tray. Whether the placement is right, and the correct kingdom, show only
|
|
26
|
+
* when `labels.right`, `labels.wrong` and `labels.kingdom` are all given, so a
|
|
27
|
+
* question can leave all three out.
|
|
28
|
+
*/
|
|
29
|
+
function kingdomSortLab(rich) {
|
|
30
|
+
return figure(Schema.Struct({
|
|
31
|
+
...cardFields(rich),
|
|
32
|
+
labels: Schema.Struct({
|
|
33
|
+
checks: byIds(["nucleus", "cells", "wall", "food"], TextSchema),
|
|
34
|
+
kingdom: Schema.optionalKey(rich),
|
|
35
|
+
kingdoms: byIds([
|
|
36
|
+
"archaebacteria",
|
|
37
|
+
"eubacteria",
|
|
38
|
+
"protista",
|
|
39
|
+
"fungi",
|
|
40
|
+
"plantae",
|
|
41
|
+
"animalia",
|
|
42
|
+
], TextSchema),
|
|
43
|
+
place: TextSchema,
|
|
44
|
+
right: Schema.optionalKey(rich),
|
|
45
|
+
specimen: TextSchema,
|
|
46
|
+
specimens: byPickedIds(SPECIMENS, rich),
|
|
47
|
+
values: byIds([
|
|
48
|
+
"yes",
|
|
49
|
+
"no",
|
|
50
|
+
"one",
|
|
51
|
+
"many",
|
|
52
|
+
"tissue",
|
|
53
|
+
"none",
|
|
54
|
+
"peptidoglycan",
|
|
55
|
+
"noPeptidoglycan",
|
|
56
|
+
"chitin",
|
|
57
|
+
"cellulose",
|
|
58
|
+
"photosynthesis",
|
|
59
|
+
"absorbs",
|
|
60
|
+
"ingests",
|
|
61
|
+
"either",
|
|
62
|
+
], TextSchema),
|
|
63
|
+
view: TextSchema,
|
|
64
|
+
wrong: Schema.optionalKey(rich),
|
|
65
|
+
}),
|
|
66
|
+
specimens: Schema.NonEmptyArray(Schema.Literals(SPECIMENS)).check(Schema.isUnique()),
|
|
67
|
+
}).check(Schema.makeFilter(({ labels, specimens }) => {
|
|
68
|
+
const feedback = [labels.kingdom, labels.right, labels.wrong];
|
|
69
|
+
return (namesEach(specimens, labels.specimens) &&
|
|
70
|
+
(Arr.every(feedback, (word) => word === undefined) ||
|
|
71
|
+
Arr.every(feedback, (word) => word !== undefined)));
|
|
72
|
+
}, {
|
|
73
|
+
message: "Expected a name for every specimen shown, and the right, wrong and kingdom feedback all given or all left out.",
|
|
74
|
+
})), answerAt(["labels", "right"], ["labels", "wrong"], ["labels", "kingdom"]));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The kingdom lab. The feedback after a placement tells the learner the
|
|
78
|
+
* answer, so it is answer state.
|
|
79
|
+
*/
|
|
80
|
+
export function kingdomVisuals(rich) {
|
|
81
|
+
return { KingdomSortLab: kingdomSortLab(rich) };
|
|
82
|
+
}
|