@nakafa/aksara-contracts 8.4.1 → 8.9.1

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 (78) hide show
  1. package/dist/assessment/answer.d.ts +2 -0
  2. package/dist/assessment/answer.js +5 -3
  3. package/dist/assessment/closure.js +2 -1
  4. package/dist/assessment/fit.d.ts +16 -2
  5. package/dist/assessment/fit.js +23 -5
  6. package/dist/assessment/graphic.d.ts +27 -0
  7. package/dist/assessment/graphic.js +17 -1
  8. package/dist/assessment/hash.d.ts +71 -3
  9. package/dist/assessment/interaction.d.ts +18 -1
  10. package/dist/assessment/interaction.js +2 -1
  11. package/dist/assessment/item.d.ts +85 -0
  12. package/dist/assessment/item.js +1 -1
  13. package/dist/assessment/joint.d.ts +4 -3
  14. package/dist/assessment/joint.js +4 -3
  15. package/dist/assessment/key.d.ts +138 -0
  16. package/dist/assessment/key.js +6 -0
  17. package/dist/assessment/paper.d.ts +316 -0
  18. package/dist/assessment/profile.d.ts +3 -3
  19. package/dist/assessment/profile.js +4 -4
  20. package/dist/assessment/rows.d.ts +285 -3
  21. package/dist/assessment/scoring.d.ts +12 -6
  22. package/dist/assessment/scoring.js +25 -8
  23. package/dist/assessment/sketch.d.ts +125 -0
  24. package/dist/assessment/sketch.js +175 -0
  25. package/dist/assessment/snapshot.d.ts +746 -10
  26. package/dist/assessment/structure.js +4 -4
  27. package/dist/hash/sha256.d.ts +16 -0
  28. package/dist/hash/sha256.js +164 -0
  29. package/dist/hash/stream.d.ts +7 -5
  30. package/dist/hash/stream.js +13 -18
  31. package/dist/math/boundary.js +3 -22
  32. package/dist/math/edge.d.ts +11 -0
  33. package/dist/math/edge.js +74 -0
  34. package/dist/math/graph.d.ts +9 -0
  35. package/dist/math/graph.js +66 -0
  36. package/dist/math/plane.js +6 -0
  37. package/dist/math/shape.d.ts +392 -0
  38. package/dist/math/shape.js +59 -0
  39. package/dist/math/straight.d.ts +13 -0
  40. package/dist/math/straight.js +26 -0
  41. package/dist/release/snapshot/data.d.ts +88 -2
  42. package/dist/release/snapshot/verify.d.ts +285 -3
  43. package/dist/transport/group.d.ts +264 -6
  44. package/dist/transport/request.d.ts +1886 -22
  45. package/dist/transport/snapshot.d.ts +176 -4
  46. package/dist/visual/biology/blood.d.ts +91 -0
  47. package/dist/visual/biology/blood.js +55 -0
  48. package/dist/visual/biology/heart.d.ts +92 -0
  49. package/dist/visual/biology/heart.js +54 -0
  50. package/dist/visual/biology/mitochondrion.d.ts +91 -0
  51. package/dist/visual/biology/mitochondrion.js +45 -0
  52. package/dist/visual/biology/muscle.d.ts +103 -0
  53. package/dist/visual/biology/muscle.js +62 -0
  54. package/dist/visual/biology/neuron.d.ts +97 -0
  55. package/dist/visual/biology/neuron.js +48 -0
  56. package/dist/visual/biology/paddy.d.ts +100 -0
  57. package/dist/visual/biology/paddy.js +54 -0
  58. package/dist/visual/biology/synapse.d.ts +101 -0
  59. package/dist/visual/biology/synapse.js +46 -0
  60. package/dist/visual/biology/vessel.d.ts +104 -0
  61. package/dist/visual/biology/vessel.js +60 -0
  62. package/dist/visual/biology/yeast.d.ts +108 -0
  63. package/dist/visual/biology/yeast.js +61 -0
  64. package/dist/visual/catalog.d.ts +2177 -778
  65. package/dist/visual/catalog.js +28 -0
  66. package/dist/visual/mathematics/journey.d.ts +118 -0
  67. package/dist/visual/mathematics/journey.js +125 -0
  68. package/dist/visual/mathematics/logic.d.ts +90 -0
  69. package/dist/visual/mathematics/logic.js +49 -0
  70. package/dist/visual/mathematics/network.d.ts +101 -0
  71. package/dist/visual/mathematics/network.js +97 -0
  72. package/dist/visual/mathematics/numeral.d.ts +81 -0
  73. package/dist/visual/mathematics/numeral.js +48 -0
  74. package/dist/visual/mathematics/sets.d.ts +92 -0
  75. package/dist/visual/mathematics/sets.js +95 -0
  76. package/dist/visual/physics/thermodynamics.d.ts +117 -0
  77. package/dist/visual/physics/thermodynamics.js +95 -0
  78. package/package.json +2 -2
@@ -0,0 +1,45 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { figure } from "#contracts/visual/entry";
4
+ /**
5
+ * The aerobic ATP one glucose makes, which textbooks give differently: about
6
+ * 30 to 32 in OpenStax Biology 2e, 36 or 38 in many school syllabi. A whole
7
+ * number above the 2 of glycolysis alone and at most the theoretical 38.
8
+ */
9
+ const AtpSchema = Schema.Int.check(Schema.isGreaterThan(2), Schema.isLessThanOrEqualTo(38));
10
+ /** The cells the lab can show without oxygen: a muscle cell makes lactic acid, a yeast cell ethanol and carbon dioxide. */
11
+ const CellSchema = Schema.Literals(["muscle", "yeast"]);
12
+ /**
13
+ * Props of `MitochondrionLab`: one mitochondrion cut open lengthwise in the
14
+ * cytoplasm of a cell, where each stage of cellular respiration happens and
15
+ * what oxygen changes. `atp` is the aerobic ATP per glucose the lesson
16
+ * teaches; `cells` the cells a learner can choose between, each at most once
17
+ * and the first shown first. The words name the oxygen and cell toggles, the
18
+ * readouts (ATP and carbon dioxide per glucose, the end products of each
19
+ * condition and, when given, the energy released) and the 3D labels of the
20
+ * parts. No prop states the conclusion, so none holds answer state.
21
+ */
22
+ function mitochondrionLab(rich) {
23
+ return figure(Schema.Struct({
24
+ ...cardFields(rich),
25
+ atp: AtpSchema,
26
+ cells: Schema.NonEmptyArray(CellSchema).check(Schema.isUnique()),
27
+ labels: Schema.Struct({
28
+ atp: rich,
29
+ carbonDioxide: rich,
30
+ cell: TextSchema,
31
+ cells: byIds(["muscle", "yeast"], TextSchema),
32
+ energy: Schema.optionalKey(rich),
33
+ oxygen: TextSchema,
34
+ oxygens: byIds(["present", "absent"], TextSchema),
35
+ parts: byIds(["cytoplasm", "outer", "inner", "cristae", "matrix"], TextSchema),
36
+ product: rich,
37
+ products: byIds(["aerobic", "lactic", "alcoholic"], rich),
38
+ view: TextSchema,
39
+ }),
40
+ }));
41
+ }
42
+ /** The visuals of this lab. */
43
+ export function mitochondrionVisuals(rich) {
44
+ return { MitochondrionLab: mitochondrionLab(rich) };
45
+ }
@@ -0,0 +1,103 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The visuals of the working muscle. Its props set up the run and name its
5
+ * words; none states a conclusion the lab leads to, so none holds answer
6
+ * state.
7
+ */
8
+ export declare function muscleVisuals<E>(rich: RichSlot<E>): {
9
+ OxygenDebtLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
10
+ readonly description: RichSlot<E>;
11
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
12
+ readonly attrs: {
13
+ readonly latex: string;
14
+ };
15
+ readonly type: "mathInline";
16
+ } | {
17
+ readonly marks?: readonly [{
18
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
19
+ } | {
20
+ readonly attrs: {
21
+ readonly href: string;
22
+ };
23
+ readonly type: "link";
24
+ } | {
25
+ readonly attrs: {
26
+ readonly variant: "success" | "warning" | null;
27
+ };
28
+ readonly type: "highlight";
29
+ }, ...({
30
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
31
+ } | {
32
+ readonly attrs: {
33
+ readonly href: string;
34
+ };
35
+ readonly type: "link";
36
+ } | {
37
+ readonly attrs: {
38
+ readonly variant: "success" | "warning" | null;
39
+ };
40
+ readonly type: "highlight";
41
+ })[]];
42
+ readonly text: string;
43
+ readonly type: "text";
44
+ }, ...({
45
+ readonly attrs: {
46
+ readonly latex: string;
47
+ };
48
+ readonly type: "mathInline";
49
+ } | {
50
+ readonly marks?: readonly [{
51
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
52
+ } | {
53
+ readonly attrs: {
54
+ readonly href: string;
55
+ };
56
+ readonly type: "link";
57
+ } | {
58
+ readonly attrs: {
59
+ readonly variant: "success" | "warning" | null;
60
+ };
61
+ readonly type: "highlight";
62
+ }, ...({
63
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
64
+ } | {
65
+ readonly attrs: {
66
+ readonly href: string;
67
+ };
68
+ readonly type: "link";
69
+ } | {
70
+ readonly attrs: {
71
+ readonly variant: "success" | "warning" | null;
72
+ };
73
+ readonly type: "highlight";
74
+ })[]];
75
+ readonly text: string;
76
+ readonly type: "text";
77
+ })[]], E, never, never>>;
78
+ readonly title: RichSlot<E>;
79
+ readonly demand: Schema.Struct<{
80
+ readonly max: Schema.Finite;
81
+ readonly min: Schema.Finite;
82
+ readonly value: Schema.Finite;
83
+ }>;
84
+ readonly labels: Schema.Struct<{
85
+ readonly debt: RichSlot<E>;
86
+ readonly demand: Schema.Trimmed;
87
+ readonly force: Schema.optionalKey<RichSlot<E>>;
88
+ readonly lactic: RichSlot<E>;
89
+ readonly need: Schema.optionalKey<RichSlot<E>>;
90
+ readonly parts: Schema.Struct<{
91
+ readonly capillary: Schema.Trimmed;
92
+ readonly cell: Schema.Trimmed;
93
+ readonly fibre: Schema.Trimmed;
94
+ readonly liver: Schema.optionalKey<Schema.Trimmed>;
95
+ }>;
96
+ readonly shortfall: RichSlot<E>;
97
+ readonly time: Schema.Trimmed;
98
+ readonly uptake: RichSlot<E>;
99
+ readonly view: Schema.Trimmed;
100
+ }>;
101
+ readonly rest: Schema.Finite;
102
+ }>, "figure">;
103
+ };
@@ -0,0 +1,62 @@
1
+ import { Schema } from "effect";
2
+ import { cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { figure } from "#contracts/visual/entry";
4
+ /** A rate of oxygen uptake, in litres a minute: a finite number above zero. */
5
+ const RateSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /**
7
+ * The range of the demand slider and where it opens, in litres a minute
8
+ * above the resting rate: the minimum below the maximum, and the value
9
+ * between them.
10
+ */
11
+ const DemandSchema = Schema.Struct({
12
+ max: RateSchema,
13
+ min: RateSchema,
14
+ value: RateSchema,
15
+ }).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
16
+ message: "Expected a demand range whose minimum is below its maximum, with the value between them.",
17
+ }));
18
+ /**
19
+ * Props of `OxygenDebtLab`: a working skeletal muscle at tissue scale that
20
+ * runs short of oxygen, builds lactic acid, and repays the oxygen debt.
21
+ * `rest` is the resting oxygen uptake and `demand` the extra oxygen the
22
+ * exercise needs, both in litres a minute; the lab exercises from minute 2 to
23
+ * minute 8 and records until minute 16, on the lesson's oxygen-debt curves.
24
+ * `labels.demand` names the slider of the extra demand. `labels.parts` names
25
+ * the fibre, the capillary and the red blood cell. Optional: `labels.need`
26
+ * adds a readout of the whole demand at the moment shown, `labels.force` a
27
+ * readout of the force the fatigued fibres still give, and
28
+ * `labels.parts.liver` a callout on the arrow that carries lactic acid away
29
+ * to the liver.
30
+ */
31
+ function oxygenDebtLab(rich) {
32
+ return figure(Schema.Struct({
33
+ ...cardFields(rich),
34
+ demand: DemandSchema,
35
+ labels: Schema.Struct({
36
+ debt: rich,
37
+ demand: TextSchema,
38
+ force: Schema.optionalKey(rich),
39
+ lactic: rich,
40
+ need: Schema.optionalKey(rich),
41
+ parts: Schema.Struct({
42
+ capillary: TextSchema,
43
+ cell: TextSchema,
44
+ fibre: TextSchema,
45
+ liver: Schema.optionalKey(TextSchema),
46
+ }),
47
+ shortfall: rich,
48
+ time: TextSchema,
49
+ uptake: rich,
50
+ view: TextSchema,
51
+ }),
52
+ rest: RateSchema,
53
+ }));
54
+ }
55
+ /**
56
+ * The visuals of the working muscle. Its props set up the run and name its
57
+ * words; none states a conclusion the lab leads to, so none holds answer
58
+ * state.
59
+ */
60
+ export function muscleVisuals(rich) {
61
+ return { OxygenDebtLab: oxygenDebtLab(rich) };
62
+ }
@@ -0,0 +1,97 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The neuron labs. The read-out travel time is answer state. */
4
+ export declare function neuronVisuals<E>(rich: RichSlot<E>): {
5
+ NeuronImpulseLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
6
+ readonly description: RichSlot<E>;
7
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
8
+ readonly attrs: {
9
+ readonly latex: string;
10
+ };
11
+ readonly type: "mathInline";
12
+ } | {
13
+ readonly marks?: readonly [{
14
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
15
+ } | {
16
+ readonly attrs: {
17
+ readonly href: string;
18
+ };
19
+ readonly type: "link";
20
+ } | {
21
+ readonly attrs: {
22
+ readonly variant: "success" | "warning" | null;
23
+ };
24
+ readonly type: "highlight";
25
+ }, ...({
26
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
27
+ } | {
28
+ readonly attrs: {
29
+ readonly href: string;
30
+ };
31
+ readonly type: "link";
32
+ } | {
33
+ readonly attrs: {
34
+ readonly variant: "success" | "warning" | null;
35
+ };
36
+ readonly type: "highlight";
37
+ })[]];
38
+ readonly text: string;
39
+ readonly type: "text";
40
+ }, ...({
41
+ readonly attrs: {
42
+ readonly latex: string;
43
+ };
44
+ readonly type: "mathInline";
45
+ } | {
46
+ readonly marks?: readonly [{
47
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
48
+ } | {
49
+ readonly attrs: {
50
+ readonly href: string;
51
+ };
52
+ readonly type: "link";
53
+ } | {
54
+ readonly attrs: {
55
+ readonly variant: "success" | "warning" | null;
56
+ };
57
+ readonly type: "highlight";
58
+ }, ...({
59
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
60
+ } | {
61
+ readonly attrs: {
62
+ readonly href: string;
63
+ };
64
+ readonly type: "link";
65
+ } | {
66
+ readonly attrs: {
67
+ readonly variant: "success" | "warning" | null;
68
+ };
69
+ readonly type: "highlight";
70
+ })[]];
71
+ readonly text: string;
72
+ readonly type: "text";
73
+ })[]], E, never, never>>;
74
+ readonly title: RichSlot<E>;
75
+ readonly fibres: Schema.NonEmptyArray<Schema.Struct<{
76
+ readonly diameter: Schema.Finite;
77
+ readonly myelinated: Schema.Boolean;
78
+ readonly name: Schema.Trimmed;
79
+ }>>;
80
+ readonly labels: Schema.Struct<{
81
+ readonly fibre: Schema.Trimmed;
82
+ readonly parts: Schema.Struct<{
83
+ readonly axon: Schema.Trimmed;
84
+ readonly dendrite: Schema.Trimmed;
85
+ readonly myelin: Schema.Trimmed;
86
+ readonly node: Schema.Trimmed;
87
+ readonly soma: Schema.Trimmed;
88
+ readonly terminal: Schema.Trimmed;
89
+ }>;
90
+ readonly potential: RichSlot<E>;
91
+ readonly speed: RichSlot<E>;
92
+ readonly time: Schema.optionalKey<RichSlot<E>>;
93
+ readonly view: Schema.Trimmed;
94
+ }>;
95
+ readonly length: Schema.Finite;
96
+ }>, "figure">;
97
+ };
@@ -0,0 +1,48 @@
1
+ import { Schema } from "effect";
2
+ import { cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** A length or a diameter the lab divides by: a finite number above zero. */
5
+ const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /** One nerve fibre the reader can send an impulse along. */
7
+ const FibreSchema = Schema.Struct({
8
+ diameter: PositiveSchema,
9
+ myelinated: Schema.Boolean,
10
+ name: TextSchema,
11
+ });
12
+ /** The words the lab writes beside the parts of the neuron it draws. */
13
+ const PartsSchema = Schema.Struct({
14
+ axon: TextSchema,
15
+ dendrite: TextSchema,
16
+ myelin: TextSchema,
17
+ node: TextSchema,
18
+ soma: TextSchema,
19
+ terminal: TextSchema,
20
+ });
21
+ /**
22
+ * Props of `NeuronImpulseLab`: a motor neuron whose impulse runs `length`
23
+ * metres along one of the `fibres`, each `diameter` micrometres across, with
24
+ * or without a myelin sheath, and the words for the parts it labels. The
25
+ * travel time it reads out is a result a question may ask for, so its label
26
+ * is answer state.
27
+ */
28
+ function neuronImpulseLab(rich) {
29
+ return Schema.Struct({
30
+ ...cardFields(rich),
31
+ fibres: Schema.NonEmptyArray(FibreSchema),
32
+ labels: Schema.Struct({
33
+ fibre: TextSchema,
34
+ parts: PartsSchema,
35
+ potential: rich,
36
+ speed: rich,
37
+ time: Schema.optionalKey(rich),
38
+ view: TextSchema,
39
+ }),
40
+ length: PositiveSchema,
41
+ });
42
+ }
43
+ /** The neuron labs. The read-out travel time is answer state. */
44
+ export function neuronVisuals(rich) {
45
+ return {
46
+ NeuronImpulseLab: figure(neuronImpulseLab(rich), answerAt(["labels", "time"])),
47
+ };
48
+ }
@@ -0,0 +1,100 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The visuals of the paddy lab. Its props set up the field and name its words;
5
+ * none states the conclusion the lab leads to, so none holds answer state.
6
+ */
7
+ export declare function paddyVisuals<E>(rich: RichSlot<E>): {
8
+ PaddyRootLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
9
+ readonly description: RichSlot<E>;
10
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
11
+ readonly attrs: {
12
+ readonly latex: string;
13
+ };
14
+ readonly type: "mathInline";
15
+ } | {
16
+ readonly marks?: readonly [{
17
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
18
+ } | {
19
+ readonly attrs: {
20
+ readonly href: string;
21
+ };
22
+ readonly type: "link";
23
+ } | {
24
+ readonly attrs: {
25
+ readonly variant: "success" | "warning" | null;
26
+ };
27
+ readonly type: "highlight";
28
+ }, ...({
29
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
30
+ } | {
31
+ readonly attrs: {
32
+ readonly href: string;
33
+ };
34
+ readonly type: "link";
35
+ } | {
36
+ readonly attrs: {
37
+ readonly variant: "success" | "warning" | null;
38
+ };
39
+ readonly type: "highlight";
40
+ })[]];
41
+ readonly text: string;
42
+ readonly type: "text";
43
+ }, ...({
44
+ readonly attrs: {
45
+ readonly latex: string;
46
+ };
47
+ readonly type: "mathInline";
48
+ } | {
49
+ readonly marks?: readonly [{
50
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
51
+ } | {
52
+ readonly attrs: {
53
+ readonly href: string;
54
+ };
55
+ readonly type: "link";
56
+ } | {
57
+ readonly attrs: {
58
+ readonly variant: "success" | "warning" | null;
59
+ };
60
+ readonly type: "highlight";
61
+ }, ...({
62
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
63
+ } | {
64
+ readonly attrs: {
65
+ readonly href: string;
66
+ };
67
+ readonly type: "link";
68
+ } | {
69
+ readonly attrs: {
70
+ readonly variant: "success" | "warning" | null;
71
+ };
72
+ readonly type: "highlight";
73
+ })[]];
74
+ readonly text: string;
75
+ readonly type: "text";
76
+ })[]], E, never, never>>;
77
+ readonly title: RichSlot<E>;
78
+ readonly atp: Schema.Int;
79
+ readonly labels: Schema.Struct<{
80
+ readonly damaged: RichSlot<E>;
81
+ readonly ethanol: RichSlot<E>;
82
+ readonly fermentation: RichSlot<E>;
83
+ readonly healthy: RichSlot<E>;
84
+ readonly oxygen: RichSlot<E>;
85
+ readonly parts: Schema.Struct<{
86
+ readonly aerenchyma: Schema.Trimmed;
87
+ readonly mud: Schema.Trimmed;
88
+ readonly root: Schema.Trimmed;
89
+ readonly water: Schema.Trimmed;
90
+ }>;
91
+ readonly plant: Schema.Trimmed;
92
+ readonly plants: Schema.$Record<Schema.Literals<readonly ["rice", "dryland"]>, Schema.Trimmed>;
93
+ readonly roots: RichSlot<E>;
94
+ readonly view: Schema.Trimmed;
95
+ readonly water: Schema.Trimmed;
96
+ readonly waters: Schema.$Record<Schema.Literals<readonly ["drained", "flooded"]>, Schema.Trimmed>;
97
+ }>;
98
+ readonly plants: Schema.NonEmptyArray<Schema.Literals<readonly ["rice", "dryland"]>>;
99
+ }>, "figure">;
100
+ };
@@ -0,0 +1,54 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { figure } from "#contracts/visual/entry";
4
+ /** ATP from one glucose in aerobic respiration: a whole number above zero. */
5
+ const AtpSchema = Schema.Int.check(Schema.isGreaterThan(0));
6
+ /**
7
+ * The crops the lab grows: paddy rice, a wetland crop with air channels
8
+ * (aerenchyma) in its roots, and a dryland crop with almost none, drawn as
9
+ * maize.
10
+ */
11
+ const PlantSchema = Schema.Literals(["rice", "dryland"]);
12
+ /**
13
+ * Props of `PaddyRootLab`: a paddy field at real size in endless terrain,
14
+ * flooded or drained, with rice or a dryland crop growing in it, the soil and
15
+ * roots seen in an X-ray view through the mud, an oxygen strip down the soil,
16
+ * and a lens on one root's cross-section. `atp` is the ATP one glucose yields in aerobic respiration as the
17
+ * lesson counts it; fermentation yields 2. `plants` lists the crops in tab
18
+ * order. The lab reads out the soil's oxygen at the root tips, the share of
19
+ * the roots' energy from fermentation, the ethanol made per glucose, and
20
+ * whether the roots stay healthy (`healthy`) or their tips die (`damaged`).
21
+ */
22
+ function paddyRootLab(rich) {
23
+ return figure(Schema.Struct({
24
+ ...cardFields(rich),
25
+ atp: AtpSchema,
26
+ labels: Schema.Struct({
27
+ damaged: rich,
28
+ ethanol: rich,
29
+ fermentation: rich,
30
+ healthy: rich,
31
+ oxygen: rich,
32
+ parts: Schema.Struct({
33
+ aerenchyma: TextSchema,
34
+ mud: TextSchema,
35
+ root: TextSchema,
36
+ water: TextSchema,
37
+ }),
38
+ plant: TextSchema,
39
+ plants: byIds(["rice", "dryland"], TextSchema),
40
+ roots: rich,
41
+ view: TextSchema,
42
+ water: TextSchema,
43
+ waters: byIds(["drained", "flooded"], TextSchema),
44
+ }),
45
+ plants: Schema.NonEmptyArray(PlantSchema),
46
+ }));
47
+ }
48
+ /**
49
+ * The visuals of the paddy lab. Its props set up the field and name its words;
50
+ * none states the conclusion the lab leads to, so none holds answer state.
51
+ */
52
+ export function paddyVisuals(rich) {
53
+ return { PaddyRootLab: paddyRootLab(rich) };
54
+ }
@@ -0,0 +1,101 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The synapse labs. Each prop sets up the synapse or names its words; none
5
+ * states the conclusion the lab leads to.
6
+ */
7
+ export declare function synapseVisuals<E>(rich: RichSlot<E>): {
8
+ SynapseLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
9
+ readonly description: RichSlot<E>;
10
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
11
+ readonly attrs: {
12
+ readonly latex: string;
13
+ };
14
+ readonly type: "mathInline";
15
+ } | {
16
+ readonly marks?: readonly [{
17
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
18
+ } | {
19
+ readonly attrs: {
20
+ readonly href: string;
21
+ };
22
+ readonly type: "link";
23
+ } | {
24
+ readonly attrs: {
25
+ readonly variant: "success" | "warning" | null;
26
+ };
27
+ readonly type: "highlight";
28
+ }, ...({
29
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
30
+ } | {
31
+ readonly attrs: {
32
+ readonly href: string;
33
+ };
34
+ readonly type: "link";
35
+ } | {
36
+ readonly attrs: {
37
+ readonly variant: "success" | "warning" | null;
38
+ };
39
+ readonly type: "highlight";
40
+ })[]];
41
+ readonly text: string;
42
+ readonly type: "text";
43
+ }, ...({
44
+ readonly attrs: {
45
+ readonly latex: string;
46
+ };
47
+ readonly type: "mathInline";
48
+ } | {
49
+ readonly marks?: readonly [{
50
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
51
+ } | {
52
+ readonly attrs: {
53
+ readonly href: string;
54
+ };
55
+ readonly type: "link";
56
+ } | {
57
+ readonly attrs: {
58
+ readonly variant: "success" | "warning" | null;
59
+ };
60
+ readonly type: "highlight";
61
+ }, ...({
62
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
63
+ } | {
64
+ readonly attrs: {
65
+ readonly href: string;
66
+ };
67
+ readonly type: "link";
68
+ } | {
69
+ readonly attrs: {
70
+ readonly variant: "success" | "warning" | null;
71
+ };
72
+ readonly type: "highlight";
73
+ })[]];
74
+ readonly text: string;
75
+ readonly type: "text";
76
+ })[]], E, never, never>>;
77
+ readonly title: RichSlot<E>;
78
+ readonly drugs: Schema.optionalKey<Schema.NonEmptyArray<Schema.Literals<readonly ["nicotine", "curare", "organophosphate", "botulinum"]>>>;
79
+ readonly labels: Schema.Struct<{
80
+ readonly drug: Schema.Trimmed;
81
+ readonly drugs: Schema.optionalKey<Schema.$Record<Schema.Literals<readonly ["nicotine", "curare", "organophosphate", "botulinum"]>, Schema.Trimmed>>;
82
+ readonly fires: RichSlot<E>;
83
+ readonly none: Schema.Trimmed;
84
+ readonly parts: Schema.Struct<{
85
+ readonly channel: RichSlot<E>;
86
+ readonly cleft: RichSlot<E>;
87
+ readonly enzyme: RichSlot<E>;
88
+ readonly mitochondrion: RichSlot<E>;
89
+ readonly receptor: RichSlot<E>;
90
+ readonly transporter: RichSlot<E>;
91
+ readonly vesicle: RichSlot<E>;
92
+ }>;
93
+ readonly potential: RichSlot<E>;
94
+ readonly rate: Schema.Trimmed;
95
+ readonly rests: RichSlot<E>;
96
+ readonly response: RichSlot<E>;
97
+ readonly transmitter: RichSlot<E>;
98
+ readonly view: Schema.Trimmed;
99
+ }>;
100
+ }>, "figure">;
101
+ };
@@ -0,0 +1,46 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { figure } from "#contracts/visual/entry";
4
+ /** The drugs the synapse lab can add to the cleft. */
5
+ const DRUGS = ["nicotine", "curare", "organophosphate", "botulinum"];
6
+ /**
7
+ * Props of `SynapseLab`: a cholinergic synapse between two neurons. Impulses
8
+ * arrive at the presynaptic bouton at a rate the reader sets, and each of the
9
+ * `drugs` can be added to see how it changes the transmission. `labels.parts`
10
+ * names the parts the scene points at; `labels.drugs` names the drugs, and is
11
+ * needed whenever `drugs` is set.
12
+ */
13
+ function synapseLab(rich) {
14
+ return figure(Schema.Struct({
15
+ ...cardFields(rich),
16
+ drugs: Schema.optionalKey(Schema.NonEmptyArray(Schema.Literals(DRUGS))),
17
+ labels: Schema.Struct({
18
+ drug: TextSchema,
19
+ drugs: Schema.optionalKey(byIds(DRUGS, TextSchema)),
20
+ fires: rich,
21
+ none: TextSchema,
22
+ parts: Schema.Struct({
23
+ channel: rich,
24
+ cleft: rich,
25
+ enzyme: rich,
26
+ mitochondrion: rich,
27
+ receptor: rich,
28
+ transporter: rich,
29
+ vesicle: rich,
30
+ }),
31
+ potential: rich,
32
+ rate: TextSchema,
33
+ rests: rich,
34
+ response: rich,
35
+ transmitter: rich,
36
+ view: TextSchema,
37
+ }),
38
+ }).check(Schema.makeFilter(({ drugs, labels }) => drugs === undefined || labels.drugs !== undefined, { message: "Expected names for the drugs whenever drugs are offered." })));
39
+ }
40
+ /**
41
+ * The synapse labs. Each prop sets up the synapse or names its words; none
42
+ * states the conclusion the lab leads to.
43
+ */
44
+ export function synapseVisuals(rich) {
45
+ return { SynapseLab: synapseLab(rich) };
46
+ }