@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,139 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The garden name lab. Every prop names what the learner explores; none is answer state. */
|
|
4
|
+
export declare function binomialVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
GardenNameLab: 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 epithet: RichSlot<E>;
|
|
127
|
+
readonly family: RichSlot<E>;
|
|
128
|
+
readonly genus: RichSlot<E>;
|
|
129
|
+
readonly match: Schema.Trimmed;
|
|
130
|
+
readonly matches: Schema.$Record<Schema.Literals<readonly ["genus", "epithet"]>, Schema.Trimmed>;
|
|
131
|
+
readonly plant: Schema.Trimmed;
|
|
132
|
+
readonly plants: Schema.$Record<Schema.Literals<readonly ["kangkung", "sweetPotato", "mango", "beluntas", "neem", "padi"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
133
|
+
readonly style: Schema.Trimmed;
|
|
134
|
+
readonly styles: Schema.$Record<Schema.Literals<readonly ["printed", "handwritten"]>, Schema.Trimmed>;
|
|
135
|
+
readonly view: Schema.Trimmed;
|
|
136
|
+
}>;
|
|
137
|
+
readonly plants: Schema.NonEmptyArray<Schema.Literals<readonly ["kangkung", "sweetPotato", "mango", "beluntas", "neem", "padi"]>>;
|
|
138
|
+
}>, "figure">;
|
|
139
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
* Garden plants whose scientific names the renderer's model holds as cited
|
|
6
|
+
* data: three share the second word `indica` or the genus `Ipomoea`, so the
|
|
7
|
+
* learner sees which word names the genus.
|
|
8
|
+
*/
|
|
9
|
+
const PLANTS = [
|
|
10
|
+
"kangkung",
|
|
11
|
+
"sweetPotato",
|
|
12
|
+
"mango",
|
|
13
|
+
"beluntas",
|
|
14
|
+
"neem",
|
|
15
|
+
"padi",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Props of `GardenNameLab`: a school garden with `plants` (each once), each
|
|
19
|
+
* with a name tag. The learner switches the tags between printed and
|
|
20
|
+
* handwritten style and highlights the plants that share the first or the
|
|
21
|
+
* second word; the readouts give the genus, the second word and the family.
|
|
22
|
+
*/
|
|
23
|
+
function gardenNameLab(rich) {
|
|
24
|
+
return figure(Schema.Struct({
|
|
25
|
+
...cardFields(rich),
|
|
26
|
+
labels: Schema.Struct({
|
|
27
|
+
epithet: rich,
|
|
28
|
+
family: rich,
|
|
29
|
+
genus: rich,
|
|
30
|
+
match: TextSchema,
|
|
31
|
+
matches: byIds(["genus", "epithet"], TextSchema),
|
|
32
|
+
plant: TextSchema,
|
|
33
|
+
plants: byPickedIds(PLANTS, TextSchema),
|
|
34
|
+
style: TextSchema,
|
|
35
|
+
styles: byIds(["printed", "handwritten"], TextSchema),
|
|
36
|
+
view: TextSchema,
|
|
37
|
+
}),
|
|
38
|
+
plants: Schema.NonEmptyArray(Schema.Literals(PLANTS)).check(Schema.isUnique()),
|
|
39
|
+
}).check(Schema.makeFilter(({ labels, plants }) => namesEach(plants, labels.plants), {
|
|
40
|
+
message: "Expected a name for every plant shown, and no other.",
|
|
41
|
+
})));
|
|
42
|
+
}
|
|
43
|
+
/** The garden name lab. Every prop names what the learner explores; none is answer state. */
|
|
44
|
+
export function binomialVisuals(rich) {
|
|
45
|
+
return { GardenNameLab: gardenNameLab(rich) };
|
|
46
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The bone health lab. Every prop names what the learner explores; none is answer state. */
|
|
4
|
+
export declare function boneVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
BoneHealthLab: 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 conditions: Schema.NonEmptyArray<Schema.Literals<readonly ["osteoporosis", "osteomalacia", "rickets", "arthritis", "scoliosis"]>>;
|
|
126
|
+
readonly labels: Schema.Struct<{
|
|
127
|
+
readonly change: RichSlot<E>;
|
|
128
|
+
readonly condition: Schema.Trimmed;
|
|
129
|
+
readonly conditions: Schema.$Record<Schema.Literals<readonly ["osteoporosis", "osteomalacia", "rickets", "arthritis", "scoliosis"]>, Schema.optionalKey<Schema.Struct<{
|
|
130
|
+
readonly change: RichSlot<E>;
|
|
131
|
+
readonly name: Schema.Trimmed;
|
|
132
|
+
readonly who: RichSlot<E>;
|
|
133
|
+
}>>>;
|
|
134
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["spongy", "mineral", "cartilage", "membrane", "spine", "growth"]>, Schema.Trimmed>;
|
|
135
|
+
readonly state: Schema.Trimmed;
|
|
136
|
+
readonly states: Schema.$Record<Schema.Literals<readonly ["healthy", "affected"]>, Schema.Trimmed>;
|
|
137
|
+
readonly view: Schema.Trimmed;
|
|
138
|
+
readonly who: RichSlot<E>;
|
|
139
|
+
}>;
|
|
140
|
+
}>, "figure">;
|
|
141
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 conditions of the skeleton the lab can show: osteoporosis,
|
|
6
|
+
* osteomalacia, rickets, arthritis and scoliosis. Where each one shows on the
|
|
7
|
+
* skeleton is a fact the renderer knows.
|
|
8
|
+
*/
|
|
9
|
+
const CONDITIONS = [
|
|
10
|
+
"osteoporosis",
|
|
11
|
+
"osteomalacia",
|
|
12
|
+
"rickets",
|
|
13
|
+
"arthritis",
|
|
14
|
+
"scoliosis",
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Props of `BoneHealthLab`: a human skeleton with a lens over the part one of
|
|
18
|
+
* `conditions` affects (each once, in the order the toggle lists them). The
|
|
19
|
+
* learner switches between the healthy and the affected state; the readouts
|
|
20
|
+
* give what changes and who is most at risk, words from `labels.conditions`,
|
|
21
|
+
* one entry for each condition shown and no other. The lens labels spongy
|
|
22
|
+
* bone, bone mineral, joint cartilage, the synovial membrane, the spine and a
|
|
23
|
+
* growth plate.
|
|
24
|
+
*/
|
|
25
|
+
function boneHealthLab(rich) {
|
|
26
|
+
return figure(Schema.Struct({
|
|
27
|
+
...cardFields(rich),
|
|
28
|
+
conditions: Schema.NonEmptyArray(Schema.Literals(CONDITIONS)).check(Schema.isUnique()),
|
|
29
|
+
labels: Schema.Struct({
|
|
30
|
+
change: rich,
|
|
31
|
+
condition: TextSchema,
|
|
32
|
+
conditions: byPickedIds(CONDITIONS, Schema.Struct({ change: rich, name: TextSchema, who: rich })),
|
|
33
|
+
parts: byIds(["spongy", "mineral", "cartilage", "membrane", "spine", "growth"], TextSchema),
|
|
34
|
+
state: TextSchema,
|
|
35
|
+
states: byIds(["healthy", "affected"], TextSchema),
|
|
36
|
+
view: TextSchema,
|
|
37
|
+
who: rich,
|
|
38
|
+
}),
|
|
39
|
+
}).check(Schema.makeFilter(({ conditions, labels }) => namesEach(conditions, labels.conditions), {
|
|
40
|
+
message: "Expected words for every condition the lab shows, and no other.",
|
|
41
|
+
})));
|
|
42
|
+
}
|
|
43
|
+
/** The bone health lab. Every prop names what the learner explores; none is answer state. */
|
|
44
|
+
export function boneVisuals(rich) {
|
|
45
|
+
return { BoneHealthLab: boneHealthLab(rich) };
|
|
46
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* The chromosome lab. How long the DNA would be is what a question asks a
|
|
5
|
+
* learner to work out, so that readout is answer state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function chromosomeVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
ChromosomePackingLab: 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 basePairs: Schema.Int;
|
|
129
|
+
readonly labels: Schema.Struct<{
|
|
130
|
+
readonly length: Schema.optionalKey<RichSlot<E>>;
|
|
131
|
+
readonly level: Schema.Trimmed;
|
|
132
|
+
readonly levels: Schema.$Record<Schema.Literals<readonly ["nucleotide", "helix", "nucleosome", "fibre", "chromosome"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
133
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["phosphate", "sugar", "base", "histone", "chromatid", "centromere"]>, Schema.Trimmed>;
|
|
134
|
+
readonly view: Schema.Trimmed;
|
|
135
|
+
readonly width: RichSlot<E>;
|
|
136
|
+
}>;
|
|
137
|
+
readonly levels: Schema.NonEmptyArray<Schema.Literals<readonly ["nucleotide", "helix", "nucleosome", "fibre", "chromosome"]>>;
|
|
138
|
+
}>, "figure">;
|
|
139
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 LEVELS = [
|
|
5
|
+
"nucleotide",
|
|
6
|
+
"helix",
|
|
7
|
+
"nucleosome",
|
|
8
|
+
"fibre",
|
|
9
|
+
"chromosome",
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Props of `ChromosomePackingLab`: one DNA molecule of `basePairs` base pairs
|
|
13
|
+
* zoomed from a single nucleotide to a whole chromosome, through the levels
|
|
14
|
+
* the learner picks from `levels` (each once, smallest first). The readouts
|
|
15
|
+
* give the width at each level and, only when `labels.length` names it, how
|
|
16
|
+
* long the stretched-out DNA would be, so a question that asks for the length
|
|
17
|
+
* leaves its name out.
|
|
18
|
+
*/
|
|
19
|
+
function chromosomePackingLab(rich) {
|
|
20
|
+
return figure(Schema.Struct({
|
|
21
|
+
...cardFields(rich),
|
|
22
|
+
basePairs: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
23
|
+
labels: Schema.Struct({
|
|
24
|
+
length: Schema.optionalKey(rich),
|
|
25
|
+
level: TextSchema,
|
|
26
|
+
levels: byPickedIds(LEVELS, TextSchema),
|
|
27
|
+
parts: byIds(["phosphate", "sugar", "base", "histone", "chromatid", "centromere"], TextSchema),
|
|
28
|
+
view: TextSchema,
|
|
29
|
+
width: rich,
|
|
30
|
+
}),
|
|
31
|
+
levels: Schema.NonEmptyArray(Schema.Literals(LEVELS)).check(Schema.isUnique()),
|
|
32
|
+
}).check(Schema.makeFilter(({ labels, levels }) => namesEach(levels, labels.levels), {
|
|
33
|
+
message: "Expected a name for every level the lab shows, and no other.",
|
|
34
|
+
})), answerAt(["labels", "length"]));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The chromosome lab. How long the DNA would be is what a question asks a
|
|
38
|
+
* learner to work out, so that readout is answer state.
|
|
39
|
+
*/
|
|
40
|
+
export function chromosomeVisuals(rich) {
|
|
41
|
+
return { ChromosomePackingLab: chromosomePackingLab(rich) };
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The options a lab offers from a fixed list: at least one, each once, in the
|
|
4
|
+
* order its toggle lists them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pickedFrom<const Ids extends readonly [string, ...string[]]>(ids: Ids): Schema.NonEmptyArray<Schema.Literals<Ids>>;
|
|
7
|
+
/**
|
|
8
|
+
* A slider over values of one kind: its range and its starting value, with
|
|
9
|
+
* the minimum below the maximum and the start between them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sliderOf(value: Schema.Codec<number>): Schema.Struct<{
|
|
12
|
+
readonly max: Schema.Codec<number, number, never, never>;
|
|
13
|
+
readonly min: Schema.Codec<number, number, never, never>;
|
|
14
|
+
readonly value: Schema.Codec<number, number, never, never>;
|
|
15
|
+
}>;
|
|
16
|
+
/** Checks that some words are all given when what they describe is shown, and none otherwise. */
|
|
17
|
+
export declare function givenWhen(shown: boolean, words: readonly unknown[]): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The options a lab offers from a fixed list: at least one, each once, in the
|
|
4
|
+
* order its toggle lists them.
|
|
5
|
+
*/
|
|
6
|
+
export function pickedFrom(ids) {
|
|
7
|
+
return Schema.NonEmptyArray(Schema.Literals(ids)).check(Schema.isUnique());
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A slider over values of one kind: its range and its starting value, with
|
|
11
|
+
* the minimum below the maximum and the start between them.
|
|
12
|
+
*/
|
|
13
|
+
export function sliderOf(value) {
|
|
14
|
+
return Schema.Struct({ max: value, min: value, value }).check(Schema.makeFilter(({ max, min, value: start }) => min < max && min <= start && start <= max, {
|
|
15
|
+
message: "Expected a slider range whose minimum is below its maximum, with the starting value between them.",
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/** Checks that some words are all given when what they describe is shown, and none otherwise. */
|
|
19
|
+
export function givenWhen(shown, words) {
|
|
20
|
+
return Arr.every(words, (word) => (word !== undefined) === shown);
|
|
21
|
+
}
|