@nakafa/aksara-contracts 8.10.0 → 8.12.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/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/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 +5345 -498
- package/dist/visual/catalog.js +66 -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,152 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The sugar lab. How many bonds a chain has and how much water it releases
|
|
5
|
+
* are what a question asks for, so their readouts are answer state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sugarVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
GlycosidicBondLab: 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 bond: Schema.Trimmed;
|
|
130
|
+
readonly bonds: Schema.optionalKey<RichSlot<E>>;
|
|
131
|
+
readonly monomers: Schema.$Record<Schema.Literals<readonly ["glucose", "fructose", "galactose"]>, Schema.Trimmed>;
|
|
132
|
+
readonly polysaccharide: Schema.Trimmed;
|
|
133
|
+
readonly polysaccharides: Schema.$Record<Schema.Literals<readonly ["starch", "glycogen", "cellulose"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
134
|
+
readonly reaction: Schema.Trimmed;
|
|
135
|
+
readonly reactions: Schema.$Record<Schema.Literals<readonly ["condensation", "hydrolysis"]>, Schema.Trimmed>;
|
|
136
|
+
readonly scale: Schema.Trimmed;
|
|
137
|
+
readonly scales: Schema.$Record<Schema.Literals<readonly ["pair", "chain"]>, Schema.Trimmed>;
|
|
138
|
+
readonly sugar: Schema.Trimmed;
|
|
139
|
+
readonly sugars: Schema.$Record<Schema.Literals<readonly ["maltose", "sucrose", "lactose"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
140
|
+
readonly units: Schema.Trimmed;
|
|
141
|
+
readonly view: Schema.Trimmed;
|
|
142
|
+
readonly water: Schema.optionalKey<RichSlot<E>>;
|
|
143
|
+
}>;
|
|
144
|
+
readonly polysaccharides: Schema.NonEmptyArray<Schema.Literals<readonly ["starch", "glycogen", "cellulose"]>>;
|
|
145
|
+
readonly sugars: Schema.NonEmptyArray<Schema.Literals<readonly ["maltose", "sucrose", "lactose"]>>;
|
|
146
|
+
readonly units: Schema.Struct<{
|
|
147
|
+
readonly max: Schema.Int;
|
|
148
|
+
readonly min: Schema.Int;
|
|
149
|
+
readonly value: Schema.Int;
|
|
150
|
+
}>;
|
|
151
|
+
}>, "figure">;
|
|
152
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
const SUGARS = ["maltose", "sucrose", "lactose"];
|
|
5
|
+
const POLYSACCHARIDES = ["starch", "glycogen", "cellulose"];
|
|
6
|
+
/**
|
|
7
|
+
* How many monosaccharide units the chain has: a slider over whole numbers
|
|
8
|
+
* from two, up to the longest chain the scene draws unit by unit.
|
|
9
|
+
*/
|
|
10
|
+
const UnitsSchema = Schema.Struct({
|
|
11
|
+
max: Schema.Int.check(Schema.isLessThanOrEqualTo(24)),
|
|
12
|
+
min: Schema.Int.check(Schema.isGreaterThanOrEqualTo(2)),
|
|
13
|
+
value: Schema.Int,
|
|
14
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
15
|
+
message: "Expected a unit range whose minimum is below its maximum, with the starting count between them.",
|
|
16
|
+
}));
|
|
17
|
+
/**
|
|
18
|
+
* Props of `GlycosidicBondLab`: monosaccharides joining by condensation and
|
|
19
|
+
* splitting by hydrolysis. At the pair scale the learner builds one of
|
|
20
|
+
* `sugars` (each once) from its two monosaccharides; at the chain scale one of
|
|
21
|
+
* `polysaccharides` (each once) grows to `units` glucose units. The readouts
|
|
22
|
+
* show the glycosidic bonds and the water molecules released or used only
|
|
23
|
+
* when `labels.bonds` and `labels.water` name them, so a question that asks
|
|
24
|
+
* for a count leaves its name out.
|
|
25
|
+
*/
|
|
26
|
+
function glycosidicBondLab(rich) {
|
|
27
|
+
return figure(Schema.Struct({
|
|
28
|
+
...cardFields(rich),
|
|
29
|
+
labels: Schema.Struct({
|
|
30
|
+
bond: TextSchema,
|
|
31
|
+
bonds: Schema.optionalKey(rich),
|
|
32
|
+
monomers: byIds(["glucose", "fructose", "galactose"], TextSchema),
|
|
33
|
+
polysaccharide: TextSchema,
|
|
34
|
+
polysaccharides: byPickedIds(POLYSACCHARIDES, TextSchema),
|
|
35
|
+
reaction: TextSchema,
|
|
36
|
+
reactions: byIds(["condensation", "hydrolysis"], TextSchema),
|
|
37
|
+
scale: TextSchema,
|
|
38
|
+
scales: byIds(["pair", "chain"], TextSchema),
|
|
39
|
+
sugar: TextSchema,
|
|
40
|
+
sugars: byPickedIds(SUGARS, TextSchema),
|
|
41
|
+
units: TextSchema,
|
|
42
|
+
view: TextSchema,
|
|
43
|
+
water: Schema.optionalKey(rich),
|
|
44
|
+
}),
|
|
45
|
+
polysaccharides: Schema.NonEmptyArray(Schema.Literals(POLYSACCHARIDES)).check(Schema.isUnique()),
|
|
46
|
+
sugars: Schema.NonEmptyArray(Schema.Literals(SUGARS)).check(Schema.isUnique()),
|
|
47
|
+
units: UnitsSchema,
|
|
48
|
+
}).check(Schema.makeFilter(({ labels, polysaccharides, sugars }) => namesEach(sugars, labels.sugars) &&
|
|
49
|
+
namesEach(polysaccharides, labels.polysaccharides), {
|
|
50
|
+
message: "Expected a name for every sugar and polysaccharide the lab shows, and no other.",
|
|
51
|
+
})), answerAt(["labels", "bonds"], ["labels", "water"]));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The sugar lab. How many bonds a chain has and how much water it releases
|
|
55
|
+
* are what a question asks for, so their readouts are answer state.
|
|
56
|
+
*/
|
|
57
|
+
export function sugarVisuals(rich) {
|
|
58
|
+
return { GlycosidicBondLab: glycosidicBondLab(rich) };
|
|
59
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The taxon lab. The shared ranks are shown as the learner compares; no prop is answer state. */
|
|
4
|
+
export declare function taxonVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
TaxonRankLab: 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 labels: Schema.Struct<{
|
|
126
|
+
readonly count: RichSlot<E>;
|
|
127
|
+
readonly first: Schema.Trimmed;
|
|
128
|
+
readonly none: RichSlot<E>;
|
|
129
|
+
readonly organisms: Schema.$Record<Schema.Literals<readonly ["tiger", "leopard", "leopardCat", "sunBear", "tapir", "hornbill", "birdwing", "padi"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
130
|
+
readonly ranks: Schema.$Record<Schema.Literals<readonly ["kingdom", "phylum", "class", "order", "family", "genus", "species"]>, Schema.Trimmed>;
|
|
131
|
+
readonly second: Schema.Trimmed;
|
|
132
|
+
readonly shared: RichSlot<E>;
|
|
133
|
+
readonly view: Schema.Trimmed;
|
|
134
|
+
}>;
|
|
135
|
+
readonly organisms: Schema.NonEmptyArray<Schema.Literals<readonly ["tiger", "leopard", "leopardCat", "sunBear", "tapir", "hornbill", "birdwing", "padi"]>>;
|
|
136
|
+
readonly pair: Schema.Tuple<readonly [Schema.Literals<readonly ["tiger", "leopard", "leopardCat", "sunBear", "tapir", "hornbill", "birdwing", "padi"]>, Schema.Literals<readonly ["tiger", "leopard", "leopardCat", "sunBear", "tapir", "hornbill", "birdwing", "padi"]>]>;
|
|
137
|
+
}>, "figure">;
|
|
138
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { figure } from "#contracts/visual/entry";
|
|
4
|
+
/**
|
|
5
|
+
* Organisms whose full classification from kingdom to species is cited data
|
|
6
|
+
* in the renderer's model: four cats and bears that share more or fewer ranks,
|
|
7
|
+
* the Malayan tapir, the rhinoceros hornbill, Rajah Brooke's birdwing and rice.
|
|
8
|
+
*/
|
|
9
|
+
const ORGANISMS = [
|
|
10
|
+
"tiger",
|
|
11
|
+
"leopard",
|
|
12
|
+
"leopardCat",
|
|
13
|
+
"sunBear",
|
|
14
|
+
"tapir",
|
|
15
|
+
"hornbill",
|
|
16
|
+
"birdwing",
|
|
17
|
+
"padi",
|
|
18
|
+
];
|
|
19
|
+
const OrganismSchema = Schema.Literals(ORGANISMS);
|
|
20
|
+
/**
|
|
21
|
+
* Props of `TaxonRankLab`: seven nested trays from kingdom down to species,
|
|
22
|
+
* holding small models of `organisms` (each once). The learner picks two of
|
|
23
|
+
* them, starting with `pair`, and the trays they share light up; the
|
|
24
|
+
* readouts give the lowest rank they share and how many ranks that is.
|
|
25
|
+
*/
|
|
26
|
+
function taxonRankLab(rich) {
|
|
27
|
+
return figure(Schema.Struct({
|
|
28
|
+
...cardFields(rich),
|
|
29
|
+
labels: Schema.Struct({
|
|
30
|
+
count: rich,
|
|
31
|
+
first: TextSchema,
|
|
32
|
+
none: rich,
|
|
33
|
+
organisms: byPickedIds(ORGANISMS, TextSchema),
|
|
34
|
+
ranks: byIds(["kingdom", "phylum", "class", "order", "family", "genus", "species"], TextSchema),
|
|
35
|
+
second: TextSchema,
|
|
36
|
+
shared: rich,
|
|
37
|
+
view: TextSchema,
|
|
38
|
+
}),
|
|
39
|
+
organisms: Schema.NonEmptyArray(OrganismSchema).check(Schema.isUnique()),
|
|
40
|
+
pair: Schema.Tuple([OrganismSchema, OrganismSchema]),
|
|
41
|
+
}).check(Schema.makeFilter(({ labels, organisms, pair }) => namesEach(organisms, labels.organisms) &&
|
|
42
|
+
pair[0] !== pair[1] &&
|
|
43
|
+
Arr.every(pair, (organism) => Arr.contains(organisms, organism)), {
|
|
44
|
+
message: "Expected a name for every organism shown, and a starting pair of two different organisms from them.",
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
/** The taxon lab. The shared ranks are shown as the learner compares; no prop is answer state. */
|
|
48
|
+
export function taxonVisuals(rich) {
|
|
49
|
+
return { TaxonRankLab: taxonRankLab(rich) };
|
|
50
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The twins lab. Every prop names what the learner explores; none is answer state. */
|
|
4
|
+
export declare function twinsVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
TwinsLab: 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 kinds: Schema.NonEmptyArray<Schema.Literals<readonly ["identical", "fraternal"]>>;
|
|
126
|
+
readonly labels: Schema.Struct<{
|
|
127
|
+
readonly genes: RichSlot<E>;
|
|
128
|
+
readonly kind: Schema.Trimmed;
|
|
129
|
+
readonly kinds: Schema.$Record<Schema.Literals<readonly ["identical", "fraternal"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
130
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["ovary", "oocyte", "sperm", "blastocyst", "innerCellMass", "disc", "placenta", "amnion", "chorion", "foetus"]>, Schema.Trimmed>;
|
|
131
|
+
readonly placentas: RichSlot<E>;
|
|
132
|
+
readonly results: Schema.$Record<Schema.Literals<readonly ["same", "different", "either", "joined"]>, Schema.Trimmed>;
|
|
133
|
+
readonly sacs: RichSlot<E>;
|
|
134
|
+
readonly sex: RichSlot<E>;
|
|
135
|
+
readonly split: Schema.Trimmed;
|
|
136
|
+
readonly view: Schema.Trimmed;
|
|
137
|
+
}>;
|
|
138
|
+
readonly split: Schema.Struct<{
|
|
139
|
+
readonly max: Schema.Int;
|
|
140
|
+
readonly min: Schema.Int;
|
|
141
|
+
readonly value: Schema.Int;
|
|
142
|
+
}>;
|
|
143
|
+
}>, "figure">;
|
|
144
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { figure } from "#contracts/visual/entry";
|
|
4
|
+
const KINDS = ["identical", "fraternal"];
|
|
5
|
+
/** A whole number of days, zero or more. */
|
|
6
|
+
const DaySchema = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
7
|
+
/**
|
|
8
|
+
* The day after fertilisation an identical twin embryo splits: a slider over
|
|
9
|
+
* whole days, its range and its starting day.
|
|
10
|
+
*/
|
|
11
|
+
const SplitSchema = Schema.Struct({
|
|
12
|
+
max: DaySchema,
|
|
13
|
+
min: DaySchema,
|
|
14
|
+
value: DaySchema,
|
|
15
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
16
|
+
message: "Expected a split day range whose minimum is below its maximum, with the starting day between them.",
|
|
17
|
+
}));
|
|
18
|
+
/**
|
|
19
|
+
* Props of `TwinsLab`: how twins form, picked from `kinds` (each once).
|
|
20
|
+
* Fraternal twins come from two eggs and two sperm; identical twins from one
|
|
21
|
+
* embryo that splits on the day the learner sets with `split`, and that day
|
|
22
|
+
* decides whether they share a placenta and an amniotic sac. The readouts
|
|
23
|
+
* give the placentas, the sacs, whether the genes and the sex match.
|
|
24
|
+
*/
|
|
25
|
+
function twinsLab(rich) {
|
|
26
|
+
return figure(Schema.Struct({
|
|
27
|
+
...cardFields(rich),
|
|
28
|
+
kinds: Schema.NonEmptyArray(Schema.Literals(KINDS)).check(Schema.isUnique()),
|
|
29
|
+
labels: Schema.Struct({
|
|
30
|
+
genes: rich,
|
|
31
|
+
kind: TextSchema,
|
|
32
|
+
kinds: byPickedIds(KINDS, TextSchema),
|
|
33
|
+
parts: byIds([
|
|
34
|
+
"ovary",
|
|
35
|
+
"oocyte",
|
|
36
|
+
"sperm",
|
|
37
|
+
"blastocyst",
|
|
38
|
+
"innerCellMass",
|
|
39
|
+
"disc",
|
|
40
|
+
"placenta",
|
|
41
|
+
"amnion",
|
|
42
|
+
"chorion",
|
|
43
|
+
"foetus",
|
|
44
|
+
], TextSchema),
|
|
45
|
+
placentas: rich,
|
|
46
|
+
results: byIds(["same", "different", "either", "joined"], TextSchema),
|
|
47
|
+
sacs: rich,
|
|
48
|
+
sex: rich,
|
|
49
|
+
split: TextSchema,
|
|
50
|
+
view: TextSchema,
|
|
51
|
+
}),
|
|
52
|
+
split: SplitSchema,
|
|
53
|
+
}).check(Schema.makeFilter(({ kinds, labels }) => namesEach(kinds, labels.kinds), {
|
|
54
|
+
message: "Expected a name for every kind of twin shown, and no other.",
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
/** The twins lab. Every prop names what the learner explores; none is answer state. */
|
|
58
|
+
export function twinsVisuals(rich) {
|
|
59
|
+
return { TwinsLab: twinsLab(rich) };
|
|
60
|
+
}
|