@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.
Files changed (73) hide show
  1. package/dist/visual/biology/binomial.d.ts +139 -0
  2. package/dist/visual/biology/binomial.js +46 -0
  3. package/dist/visual/biology/bone.d.ts +141 -0
  4. package/dist/visual/biology/bone.js +46 -0
  5. package/dist/visual/biology/chromosome.d.ts +139 -0
  6. package/dist/visual/biology/chromosome.js +42 -0
  7. package/dist/visual/biology/control.d.ts +17 -0
  8. package/dist/visual/biology/control.js +21 -0
  9. package/dist/visual/biology/denature.d.ts +159 -0
  10. package/dist/visual/biology/denature.js +74 -0
  11. package/dist/visual/biology/drawing.d.ts +151 -0
  12. package/dist/visual/biology/drawing.js +69 -0
  13. package/dist/visual/biology/enzyme.d.ts +145 -0
  14. package/dist/visual/biology/enzyme.js +54 -0
  15. package/dist/visual/biology/equipment.d.ts +140 -0
  16. package/dist/visual/biology/equipment.js +64 -0
  17. package/dist/visual/biology/gametogenesis.d.ts +145 -0
  18. package/dist/visual/biology/gametogenesis.js +83 -0
  19. package/dist/visual/biology/implantation.d.ts +138 -0
  20. package/dist/visual/biology/implantation.js +44 -0
  21. package/dist/visual/biology/joint.d.ts +140 -0
  22. package/dist/visual/biology/joint.js +47 -0
  23. package/dist/visual/biology/key.d.ts +141 -0
  24. package/dist/visual/biology/key.js +58 -0
  25. package/dist/visual/biology/kingdom.d.ts +142 -0
  26. package/dist/visual/biology/kingdom.js +82 -0
  27. package/dist/visual/biology/lactase.d.ts +147 -0
  28. package/dist/visual/biology/lactase.js +48 -0
  29. package/dist/visual/biology/limb.d.ts +139 -0
  30. package/dist/visual/biology/limb.js +44 -0
  31. package/dist/visual/biology/lipid.d.ts +144 -0
  32. package/dist/visual/biology/lipid.js +43 -0
  33. package/dist/visual/biology/locomotion.d.ts +141 -0
  34. package/dist/visual/biology/locomotion.js +48 -0
  35. package/dist/visual/biology/menstrual.d.ts +148 -0
  36. package/dist/visual/biology/menstrual.js +65 -0
  37. package/dist/visual/biology/metamorphosis.d.ts +140 -0
  38. package/dist/visual/biology/metamorphosis.js +34 -0
  39. package/dist/visual/biology/placenta.d.ts +139 -0
  40. package/dist/visual/biology/placenta.js +52 -0
  41. package/dist/visual/biology/planes.d.ts +145 -0
  42. package/dist/visual/biology/planes.js +62 -0
  43. package/dist/visual/biology/protein.d.ts +142 -0
  44. package/dist/visual/biology/protein.js +41 -0
  45. package/dist/visual/biology/saturation.d.ts +149 -0
  46. package/dist/visual/biology/saturation.js +40 -0
  47. package/dist/visual/biology/secretion.d.ts +149 -0
  48. package/dist/visual/biology/secretion.js +79 -0
  49. package/dist/visual/biology/spill.d.ts +165 -0
  50. package/dist/visual/biology/spill.js +58 -0
  51. package/dist/visual/biology/sugar.d.ts +152 -0
  52. package/dist/visual/biology/sugar.js +59 -0
  53. package/dist/visual/biology/taxon.d.ts +138 -0
  54. package/dist/visual/biology/taxon.js +50 -0
  55. package/dist/visual/biology/twins.d.ts +144 -0
  56. package/dist/visual/biology/twins.js +60 -0
  57. package/dist/visual/biology/vernacular.d.ts +141 -0
  58. package/dist/visual/biology/vernacular.js +57 -0
  59. package/dist/visual/biology/vertebra.d.ts +141 -0
  60. package/dist/visual/biology/vertebra.js +59 -0
  61. package/dist/visual/biology/waste.d.ts +140 -0
  62. package/dist/visual/biology/waste.js +57 -0
  63. package/dist/visual/biology/water.d.ts +152 -0
  64. package/dist/visual/biology/water.js +54 -0
  65. package/dist/visual/card.d.ts +11 -0
  66. package/dist/visual/card.js +17 -1
  67. package/dist/visual/catalog.d.ts +5345 -498
  68. package/dist/visual/catalog.js +66 -0
  69. package/dist/visual/mathematics/argument.d.ts +226 -0
  70. package/dist/visual/mathematics/argument.js +150 -0
  71. package/dist/visual/mathematics/counterexample.d.ts +340 -0
  72. package/dist/visual/mathematics/counterexample.js +157 -0
  73. package/package.json +1 -1
@@ -0,0 +1,159 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The denaturation lab. The learner finds each optimum by trying, so none is answer state. */
4
+ export declare function denatureVisuals<E>(rich: RichSlot<E>): {
5
+ DenatureLab: 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 enzymes: Schema.NonEmptyArray<Schema.Literals<readonly ["amylase", "pepsin"]>>;
126
+ readonly labels: Schema.Struct<{
127
+ readonly active: RichSlot<E>;
128
+ readonly collisions: RichSlot<E>;
129
+ readonly endpoint: RichSlot<E>;
130
+ readonly enzyme: Schema.Trimmed;
131
+ readonly enzymes: Schema.$Record<Schema.Literals<readonly ["amylase", "pepsin"]>, Schema.optionalKey<Schema.Trimmed>>;
132
+ readonly never: RichSlot<E>;
133
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["bath", "tube", "tile", "thermometer", "lens"]>, Schema.Trimmed>;
134
+ readonly ph: Schema.optionalKey<Schema.Trimmed>;
135
+ readonly rate: RichSlot<E>;
136
+ readonly restore: Schema.Trimmed;
137
+ readonly temperature: Schema.optionalKey<Schema.Trimmed>;
138
+ readonly test: RichSlot<E>;
139
+ readonly tests: Schema.Struct<{
140
+ readonly clear: Schema.optionalKey<RichSlot<E>>;
141
+ readonly cloudy: Schema.optionalKey<RichSlot<E>>;
142
+ readonly noStarch: Schema.optionalKey<RichSlot<E>>;
143
+ readonly starch: Schema.optionalKey<RichSlot<E>>;
144
+ }>;
145
+ readonly time: Schema.Trimmed;
146
+ readonly view: Schema.Trimmed;
147
+ }>;
148
+ readonly ph: Schema.optionalKey<Schema.Struct<{
149
+ readonly max: Schema.Codec<number, number, never, never>;
150
+ readonly min: Schema.Codec<number, number, never, never>;
151
+ readonly value: Schema.Codec<number, number, never, never>;
152
+ }>>;
153
+ readonly temperature: Schema.optionalKey<Schema.Struct<{
154
+ readonly max: Schema.Codec<number, number, never, never>;
155
+ readonly min: Schema.Codec<number, number, never, never>;
156
+ readonly value: Schema.Codec<number, number, never, never>;
157
+ }>>;
158
+ }>, "figure">;
159
+ };
@@ -0,0 +1,74 @@
1
+ import { Array as Arr, Schema } from "effect";
2
+ import { givenWhen, pickedFrom, sliderOf, } from "#contracts/visual/biology/control";
3
+ import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
4
+ import { figure } from "#contracts/visual/entry";
5
+ /**
6
+ * The two experiments: salivary amylase digesting starch in a water bath
7
+ * whose temperature the learner sets, and pepsin digesting a cloudy albumen
8
+ * suspension at 37 degrees Celsius in a solution whose pH the learner sets.
9
+ * Each enzyme's optimum and the ranges where it slows or denatures are cited
10
+ * facts the renderer knows.
11
+ */
12
+ const ENZYMES = ["amylase", "pepsin"];
13
+ /** A water bath temperature in degrees Celsius, from freezing to boiling. */
14
+ const TemperatureSchema = Schema.Finite.check(Schema.isBetween({ maximum: 100, minimum: 0 }));
15
+ /** A pH on the scale from 0 to 14. */
16
+ const PhSchema = Schema.Finite.check(Schema.isBetween({ maximum: 14, minimum: 0 }));
17
+ /**
18
+ * Props of `DenatureLab`: a water bath with a test tube, a spotting tile and
19
+ * a lens on one enzyme's active site. The learner picks one of `enzymes`
20
+ * (each once, in toggle order): amylase runs over the `temperature` slider
21
+ * and is tested with iodine, pepsin runs over the `ph` slider and clears its
22
+ * suspension. Each slider and its words are given exactly when its
23
+ * experiment is shown. The readouts give the test result, the time until the
24
+ * substrate is used up, the relative rate, the share of intact active sites
25
+ * and the effective collisions per second.
26
+ */
27
+ function denatureLab(rich) {
28
+ return figure(Schema.Struct({
29
+ ...cardFields(rich),
30
+ enzymes: pickedFrom(ENZYMES),
31
+ labels: Schema.Struct({
32
+ active: rich,
33
+ collisions: rich,
34
+ endpoint: rich,
35
+ enzyme: TextSchema,
36
+ enzymes: byPickedIds(ENZYMES, TextSchema),
37
+ never: rich,
38
+ parts: byIds(["bath", "tube", "tile", "thermometer", "lens"], TextSchema),
39
+ ph: Schema.optionalKey(TextSchema),
40
+ rate: rich,
41
+ restore: TextSchema,
42
+ temperature: Schema.optionalKey(TextSchema),
43
+ test: rich,
44
+ tests: Schema.Struct({
45
+ clear: Schema.optionalKey(rich),
46
+ cloudy: Schema.optionalKey(rich),
47
+ noStarch: Schema.optionalKey(rich),
48
+ starch: Schema.optionalKey(rich),
49
+ }),
50
+ time: TextSchema,
51
+ view: TextSchema,
52
+ }),
53
+ ph: Schema.optionalKey(sliderOf(PhSchema)),
54
+ temperature: Schema.optionalKey(sliderOf(TemperatureSchema)),
55
+ }).check(Schema.makeFilter(({ enzymes, labels, ph, temperature }) => namesEach(enzymes, labels.enzymes) &&
56
+ givenWhen(Arr.contains(enzymes, "amylase"), [
57
+ temperature,
58
+ labels.temperature,
59
+ labels.tests.starch,
60
+ labels.tests.noStarch,
61
+ ]) &&
62
+ givenWhen(Arr.contains(enzymes, "pepsin"), [
63
+ ph,
64
+ labels.ph,
65
+ labels.tests.cloudy,
66
+ labels.tests.clear,
67
+ ]), {
68
+ message: "Expected a name for every experiment shown, the temperature slider and the iodine results exactly when amylase is shown, and the pH slider and the albumen results exactly when pepsin is shown.",
69
+ })));
70
+ }
71
+ /** The denaturation lab. The learner finds each optimum by trying, so none is answer state. */
72
+ export function denatureVisuals(rich) {
73
+ return { DenatureLab: denatureLab(rich) };
74
+ }
@@ -0,0 +1,151 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The drawing lab. The magnification is what a question asks a learner to
5
+ * work out, so its readout is answer state.
6
+ */
7
+ export declare function drawingVisuals<E>(rich: RichSlot<E>): {
8
+ SpecimenDrawingLab: 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 actual: Schema.Finite;
129
+ readonly drawing: Schema.Struct<{
130
+ readonly max: Schema.Finite;
131
+ readonly min: Schema.Finite;
132
+ readonly value: Schema.Finite;
133
+ }>;
134
+ readonly labels: Schema.Struct<{
135
+ readonly drawing: Schema.Trimmed;
136
+ readonly faults: Schema.$Record<Schema.Literals<readonly ["shading", "sketchy", "arrows", "title"]>, RichSlot<E>>;
137
+ readonly magnification: Schema.optionalKey<RichSlot<E>>;
138
+ readonly parts: Schema.Struct<{
139
+ readonly cytoplasm: Schema.Trimmed;
140
+ readonly membrane: Schema.optionalKey<Schema.Trimmed>;
141
+ readonly nucleus: Schema.Trimmed;
142
+ readonly wall: Schema.optionalKey<Schema.Trimmed>;
143
+ }>;
144
+ readonly size: RichSlot<E>;
145
+ readonly version: Schema.Trimmed;
146
+ readonly versions: Schema.$Record<Schema.Literals<readonly ["correct", "faulty"]>, Schema.Trimmed>;
147
+ readonly view: Schema.Trimmed;
148
+ }>;
149
+ readonly specimen: Schema.Literals<readonly ["cheek", "onion"]>;
150
+ }>, "figure">;
151
+ };
@@ -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
+ /** A length the lab divides by: a finite number above zero. */
5
+ const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /**
7
+ * How long the learner draws the cell, in millimetres: a range for the slider
8
+ * and its starting value. The longest drawing still fits an A4 sheet.
9
+ */
10
+ const DrawingSchema = Schema.Struct({
11
+ max: PositiveSchema.check(Schema.isLessThanOrEqualTo(200)),
12
+ min: PositiveSchema,
13
+ value: PositiveSchema,
14
+ }).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
15
+ message: "Expected a drawing size range whose minimum is below its maximum, with the starting size between them.",
16
+ }));
17
+ /**
18
+ * The parts a drawing labels. Every cell drawn shows its nucleus and
19
+ * cytoplasm; a cheek cell is bounded by its plasma membrane and has no cell
20
+ * wall, and an onion epidermis cell is bounded by its cell wall.
21
+ */
22
+ const PartsSchema = Schema.Struct({
23
+ cytoplasm: TextSchema,
24
+ membrane: Schema.optionalKey(TextSchema),
25
+ nucleus: TextSchema,
26
+ wall: Schema.optionalKey(TextSchema),
27
+ });
28
+ /**
29
+ * Props of `SpecimenDrawingLab`: a microscope's field of view of a stained
30
+ * `specimen` next to a sheet of drawing paper, where a pencil drawing of one
31
+ * cell builds up line by line. The cell is `actual` micrometres long; the
32
+ * learner sets how long the drawing is with a slider over `drawing`, in
33
+ * millimetres, and the readout shows the magnification, the drawing length
34
+ * over the actual length in the same unit. A toggle switches to a faulty
35
+ * drawing that breaks each rule in `labels.faults`: shading, doubled sketchy
36
+ * lines, crossed label lines with arrowheads, and no title or magnification.
37
+ * The magnification readout shows only when `labels.magnification` names it,
38
+ * so a question that asks for the magnification leaves it out.
39
+ */
40
+ function specimenDrawingLab(rich) {
41
+ return figure(Schema.Struct({
42
+ ...cardFields(rich),
43
+ actual: PositiveSchema.check(Schema.isLessThanOrEqualTo(1000)),
44
+ drawing: DrawingSchema,
45
+ labels: Schema.Struct({
46
+ drawing: TextSchema,
47
+ faults: byIds(["shading", "sketchy", "arrows", "title"], rich),
48
+ magnification: Schema.optionalKey(rich),
49
+ parts: PartsSchema,
50
+ size: rich,
51
+ version: TextSchema,
52
+ versions: byIds(["correct", "faulty"], TextSchema),
53
+ view: TextSchema,
54
+ }),
55
+ specimen: Schema.Literals(["cheek", "onion"]),
56
+ }).check(Schema.makeFilter(({ labels, specimen }) => specimen === "cheek"
57
+ ? labels.parts.membrane !== undefined &&
58
+ labels.parts.wall === undefined
59
+ : labels.parts.wall !== undefined, {
60
+ message: "Expected a cheek cell labelled with its plasma membrane and no cell wall, or an onion cell labelled with its cell wall.",
61
+ })), answerAt(["labels", "magnification"]));
62
+ }
63
+ /**
64
+ * The drawing lab. The magnification is what a question asks a learner to
65
+ * work out, so its readout is answer state.
66
+ */
67
+ export function drawingVisuals(rich) {
68
+ return { SpecimenDrawingLab: specimenDrawingLab(rich) };
69
+ }
@@ -0,0 +1,145 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The active site lab. Whether a substrate fits is what the learner tries out, so none is answer state. */
4
+ export declare function enzymeVisuals<E>(rich: RichSlot<E>): {
5
+ ActiveSiteLab: 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 enzymes: Schema.NonEmptyArray<Schema.Literals<readonly ["lactase", "sucrase", "maltase"]>>;
126
+ readonly labels: Schema.Struct<{
127
+ readonly enzyme: Schema.Trimmed;
128
+ readonly enzymes: Schema.$Record<Schema.Literals<readonly ["lactase", "sucrase", "maltase"]>, Schema.optionalKey<Schema.Trimmed>>;
129
+ readonly fits: RichSlot<E>;
130
+ readonly model: Schema.Trimmed;
131
+ readonly models: Schema.$Record<Schema.Literals<readonly ["lockKey", "inducedFit"]>, Schema.optionalKey<Schema.Trimmed>>;
132
+ readonly no: RichSlot<E>;
133
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["site", "complex", "water"]>, Schema.Trimmed>;
134
+ readonly products: RichSlot<E>;
135
+ readonly reused: RichSlot<E>;
136
+ readonly substrate: Schema.Trimmed;
137
+ readonly substrates: Schema.$Record<Schema.Literals<readonly ["lactose", "sucrose", "maltose"]>, Schema.optionalKey<Schema.Trimmed>>;
138
+ readonly sugars: Schema.$Record<Schema.Literals<readonly ["glucose", "galactose", "fructose"]>, Schema.Trimmed>;
139
+ readonly view: Schema.Trimmed;
140
+ readonly yes: RichSlot<E>;
141
+ }>;
142
+ readonly models: Schema.NonEmptyArray<Schema.Literals<readonly ["lockKey", "inducedFit"]>>;
143
+ readonly substrates: Schema.NonEmptyArray<Schema.Literals<readonly ["lactose", "sucrose", "maltose"]>>;
144
+ }>, "figure">;
145
+ };
@@ -0,0 +1,54 @@
1
+ import { Schema } from "effect";
2
+ import { pickedFrom } from "#contracts/visual/biology/control";
3
+ import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
4
+ import { figure } from "#contracts/visual/entry";
5
+ /**
6
+ * Three disaccharidases and their substrates. Which substrate fits which
7
+ * active site, and the monosaccharides each makes, are facts the renderer
8
+ * knows: lactase splits lactose into glucose and galactose, sucrase splits
9
+ * sucrose into glucose and fructose, maltase splits maltose into two glucose.
10
+ */
11
+ const ENZYMES = ["lactase", "sucrase", "maltase"];
12
+ const SUBSTRATES = ["lactose", "sucrose", "maltose"];
13
+ /** The two models of how a substrate meets an active site. */
14
+ const MODELS = ["lockKey", "inducedFit"];
15
+ /**
16
+ * Props of `ActiveSiteLab`: one enzyme molecule with its active site among
17
+ * sugar molecules. The learner picks one of `enzymes`, one of `substrates`
18
+ * and one of `models` (each list holds its options once, in toggle order);
19
+ * the scene shows whether the substrate fits, forms the enzyme-substrate
20
+ * complex, splits it with water into its products and frees the unchanged
21
+ * enzyme, counting the substrates it has broken down.
22
+ */
23
+ function activeSiteLab(rich) {
24
+ return figure(Schema.Struct({
25
+ ...cardFields(rich),
26
+ enzymes: pickedFrom(ENZYMES),
27
+ labels: Schema.Struct({
28
+ enzyme: TextSchema,
29
+ enzymes: byPickedIds(ENZYMES, TextSchema),
30
+ fits: rich,
31
+ model: TextSchema,
32
+ models: byPickedIds(MODELS, TextSchema),
33
+ no: rich,
34
+ parts: byIds(["site", "complex", "water"], TextSchema),
35
+ products: rich,
36
+ reused: rich,
37
+ substrate: TextSchema,
38
+ substrates: byPickedIds(SUBSTRATES, TextSchema),
39
+ sugars: byIds(["glucose", "galactose", "fructose"], TextSchema),
40
+ view: TextSchema,
41
+ yes: rich,
42
+ }),
43
+ models: pickedFrom(MODELS),
44
+ substrates: pickedFrom(SUBSTRATES),
45
+ }).check(Schema.makeFilter(({ enzymes, labels, models, substrates }) => namesEach(enzymes, labels.enzymes) &&
46
+ namesEach(substrates, labels.substrates) &&
47
+ namesEach(models, labels.models), {
48
+ message: "Expected a name for every enzyme, substrate and model the lab shows, and for no other.",
49
+ })));
50
+ }
51
+ /** The active site lab. Whether a substrate fits is what the learner tries out, so none is answer state. */
52
+ export function enzymeVisuals(rich) {
53
+ return { ActiveSiteLab: activeSiteLab(rich) };
54
+ }