@nakafa/aksara-contracts 8.4.0 → 8.8.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 (238) hide show
  1. package/dist/assessment/document.d.ts +1 -1
  2. package/dist/assessment/document.js +1 -1
  3. package/dist/assessment/figure.d.ts +1 -1
  4. package/dist/assessment/figure.js +1 -1
  5. package/dist/assessment/fit.d.ts +3 -3
  6. package/dist/assessment/fit.js +3 -3
  7. package/dist/assessment/locales.d.ts +1 -1
  8. package/dist/assessment/scoring.d.ts +1 -1
  9. package/dist/assessment/scoring.js +1 -1
  10. package/dist/cache/content.d.ts +1 -1
  11. package/dist/cache/content.js +1 -1
  12. package/dist/content.d.ts +3 -2
  13. package/dist/graph/identity.d.ts +1 -1
  14. package/dist/graph/identity.js +1 -1
  15. package/dist/hash/sha256.d.ts +16 -0
  16. package/dist/hash/sha256.js +164 -0
  17. package/dist/hash/stream.d.ts +7 -5
  18. package/dist/hash/stream.js +13 -18
  19. package/dist/math/boundary.js +3 -22
  20. package/dist/math/bounds.d.ts +1 -1
  21. package/dist/math/collision.d.ts +1 -1
  22. package/dist/math/coordinate.d.ts +6 -5
  23. package/dist/math/coordinate.js +2 -2
  24. package/dist/math/edge.d.ts +11 -0
  25. package/dist/math/edge.js +74 -0
  26. package/dist/math/formula/compile.d.ts +1 -1
  27. package/dist/math/formula/compile.js +1 -1
  28. package/dist/math/formula/contour.d.ts +1 -1
  29. package/dist/math/formula/contour.js +1 -1
  30. package/dist/math/formula/field.js +1 -1
  31. package/dist/math/formula/mesh.d.ts +1 -1
  32. package/dist/math/formula/mesh.js +1 -1
  33. package/dist/math/formula/names.d.ts +1 -1
  34. package/dist/math/formula/names.js +1 -1
  35. package/dist/math/formula/parse.d.ts +1 -1
  36. package/dist/math/formula/parse.js +1 -1
  37. package/dist/math/formula/plane.d.ts +2 -2
  38. package/dist/math/formula/plane.js +3 -3
  39. package/dist/math/formula/reader.d.ts +2 -1
  40. package/dist/math/formula/reader.js +1 -1
  41. package/dist/math/formula/region.d.ts +2 -2
  42. package/dist/math/formula/region.js +3 -3
  43. package/dist/math/formula/sample.d.ts +1 -1
  44. package/dist/math/formula/scan.d.ts +1 -1
  45. package/dist/math/formula/scan.js +1 -1
  46. package/dist/math/formula/slider.d.ts +2 -2
  47. package/dist/math/formula/slider.js +1 -1
  48. package/dist/math/formula/space.d.ts +1 -1
  49. package/dist/math/formula/space.js +1 -1
  50. package/dist/math/graph.d.ts +9 -0
  51. package/dist/math/graph.js +66 -0
  52. package/dist/math/plane.js +6 -0
  53. package/dist/math/precision.d.ts +1 -1
  54. package/dist/math/precision.js +1 -1
  55. package/dist/math/resolution.js +1 -1
  56. package/dist/math/scene.d.ts +2 -2
  57. package/dist/math/shape.d.ts +392 -0
  58. package/dist/math/shape.js +59 -0
  59. package/dist/math/straight.d.ts +13 -0
  60. package/dist/math/straight.js +26 -0
  61. package/dist/math/vector.d.ts +1 -1
  62. package/dist/preview/spec.js +1 -1
  63. package/dist/program/curriculum.d.ts +1 -1
  64. package/dist/program/curriculum.js +1 -1
  65. package/dist/program/snapshot/digest.d.ts +1 -1
  66. package/dist/program/snapshot/digest.js +2 -2
  67. package/dist/program/snapshot/hash.d.ts +2 -2
  68. package/dist/projection/digest.d.ts +1 -1
  69. package/dist/projection/digest.js +1 -1
  70. package/dist/projection/hash.js +1 -1
  71. package/dist/projection/material.d.ts +1 -1
  72. package/dist/projection/material.js +1 -1
  73. package/dist/projection/verify.js +1 -1
  74. package/dist/quran/identity.d.ts +2 -1
  75. package/dist/quran/provenance.d.ts +2 -2
  76. package/dist/quran/provenance.js +1 -1
  77. package/dist/quran/snapshot/hash.d.ts +1 -1
  78. package/dist/quran/snapshot/row/hash.d.ts +1 -1
  79. package/dist/quran/snapshot/row/hash.js +1 -1
  80. package/dist/quran/snapshot/spec.js +1 -1
  81. package/dist/quran/source.d.ts +2 -2
  82. package/dist/release/current/evidence.d.ts +1 -1
  83. package/dist/release/current/evidence.js +1 -1
  84. package/dist/release/current/state.d.ts +1 -1
  85. package/dist/release/current/state.js +1 -1
  86. package/dist/release/head.js +1 -1
  87. package/dist/release/items.d.ts +1 -1
  88. package/dist/release/items.js +1 -1
  89. package/dist/release/policy.d.ts +1 -1
  90. package/dist/release/policy.js +1 -1
  91. package/dist/release/result/digest.d.ts +3 -3
  92. package/dist/release/result/digest.js +2 -2
  93. package/dist/release/rollback/digest.d.ts +1 -1
  94. package/dist/release/rollback/digest.js +1 -1
  95. package/dist/release/route/digest.d.ts +1 -1
  96. package/dist/release/route/digest.js +1 -1
  97. package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
  98. package/dist/release/snapshot/evidence/assessment.js +1 -1
  99. package/dist/release/snapshot/evidence/program.d.ts +1 -1
  100. package/dist/release/snapshot/evidence/program.js +1 -1
  101. package/dist/release/snapshot/evidence/quran.d.ts +1 -1
  102. package/dist/release/snapshot/evidence/quran.js +1 -1
  103. package/dist/release/snapshot/evidence/requirement.d.ts +3 -2
  104. package/dist/release/snapshot/evidence/requirement.js +1 -1
  105. package/dist/release/snapshot/spec.d.ts +2 -2
  106. package/dist/release/snapshot/spec.js +1 -1
  107. package/dist/release/snapshot/verify.d.ts +1 -1
  108. package/dist/release/snapshot/verify.js +1 -1
  109. package/dist/release/spec.d.ts +1 -1
  110. package/dist/release/verify.d.ts +1 -1
  111. package/dist/release/verify.js +1 -1
  112. package/dist/renderer/compatibility.d.ts +1 -1
  113. package/dist/renderer/compatibility.js +2 -2
  114. package/dist/renderer/contract.d.ts +1 -1
  115. package/dist/renderer/contract.js +1 -1
  116. package/dist/runtime/spec.js +2 -2
  117. package/dist/signature/spec.d.ts +3 -2
  118. package/dist/signature/verify.d.ts +2 -1
  119. package/dist/transport/request.d.ts +1 -1
  120. package/dist/visual/base/math.d.ts +1 -1
  121. package/dist/visual/base/media.d.ts +1 -1
  122. package/dist/visual/biology/bacteria.d.ts +1 -1
  123. package/dist/visual/biology/bacteria.js +1 -1
  124. package/dist/visual/biology/blood.d.ts +91 -0
  125. package/dist/visual/biology/blood.js +55 -0
  126. package/dist/visual/biology/cell.d.ts +1 -1
  127. package/dist/visual/biology/climate.d.ts +1 -1
  128. package/dist/visual/biology/climate.js +1 -1
  129. package/dist/visual/biology/ecology.d.ts +1 -1
  130. package/dist/visual/biology/heart.d.ts +92 -0
  131. package/dist/visual/biology/heart.js +54 -0
  132. package/dist/visual/biology/mitochondrion.d.ts +91 -0
  133. package/dist/visual/biology/mitochondrion.js +45 -0
  134. package/dist/visual/biology/muscle.d.ts +103 -0
  135. package/dist/visual/biology/muscle.js +62 -0
  136. package/dist/visual/biology/neuron.d.ts +97 -0
  137. package/dist/visual/biology/neuron.js +48 -0
  138. package/dist/visual/biology/paddy.d.ts +100 -0
  139. package/dist/visual/biology/paddy.js +54 -0
  140. package/dist/visual/biology/physiology.d.ts +1 -1
  141. package/dist/visual/biology/physiology.js +1 -1
  142. package/dist/visual/biology/plant.d.ts +1 -1
  143. package/dist/visual/biology/plant.js +1 -1
  144. package/dist/visual/biology/synapse.d.ts +101 -0
  145. package/dist/visual/biology/synapse.js +46 -0
  146. package/dist/visual/biology/vessel.d.ts +104 -0
  147. package/dist/visual/biology/vessel.js +60 -0
  148. package/dist/visual/biology/yeast.d.ts +108 -0
  149. package/dist/visual/biology/yeast.js +61 -0
  150. package/dist/visual/biology.d.ts +1 -1
  151. package/dist/visual/catalog.d.ts +2177 -778
  152. package/dist/visual/catalog.js +28 -0
  153. package/dist/visual/chemistry/atom.d.ts +1 -1
  154. package/dist/visual/chemistry/atom.js +1 -1
  155. package/dist/visual/chemistry/balance.d.ts +1 -1
  156. package/dist/visual/chemistry/balance.js +1 -1
  157. package/dist/visual/chemistry/bonding.d.ts +1 -1
  158. package/dist/visual/chemistry/discovery.d.ts +1 -1
  159. package/dist/visual/chemistry/electrochemistry.d.ts +1 -1
  160. package/dist/visual/chemistry/electrochemistry.js +1 -1
  161. package/dist/visual/chemistry/electron.d.ts +1 -1
  162. package/dist/visual/chemistry/electron.js +1 -1
  163. package/dist/visual/chemistry/laws.d.ts +1 -1
  164. package/dist/visual/chemistry/laws.js +1 -1
  165. package/dist/visual/chemistry/particles.d.ts +1 -1
  166. package/dist/visual/chemistry/periodic.d.ts +1 -1
  167. package/dist/visual/chemistry/periodic.js +1 -1
  168. package/dist/visual/chemistry/rate.d.ts +1 -1
  169. package/dist/visual/chemistry/rate.js +1 -1
  170. package/dist/visual/chemistry/reaction.d.ts +1 -1
  171. package/dist/visual/chemistry/reaction.js +1 -1
  172. package/dist/visual/chemistry/titration.d.ts +1 -1
  173. package/dist/visual/chemistry/titration.js +1 -1
  174. package/dist/visual/mathematics/chance.d.ts +1 -1
  175. package/dist/visual/mathematics/chance.js +1 -1
  176. package/dist/visual/mathematics/chart.d.ts +1 -1
  177. package/dist/visual/mathematics/charts.d.ts +1 -1
  178. package/dist/visual/mathematics/function.d.ts +1 -1
  179. package/dist/visual/mathematics/journey.d.ts +118 -0
  180. package/dist/visual/mathematics/journey.js +125 -0
  181. package/dist/visual/mathematics/logic.d.ts +90 -0
  182. package/dist/visual/mathematics/logic.js +49 -0
  183. package/dist/visual/mathematics/network.d.ts +101 -0
  184. package/dist/visual/mathematics/network.js +97 -0
  185. package/dist/visual/mathematics/numeral.d.ts +82 -1
  186. package/dist/visual/mathematics/numeral.js +49 -1
  187. package/dist/visual/mathematics/sets.d.ts +92 -0
  188. package/dist/visual/mathematics/sets.js +95 -0
  189. package/dist/visual/physics/braking.d.ts +1 -1
  190. package/dist/visual/physics/braking.js +1 -1
  191. package/dist/visual/physics/circuit.d.ts +1 -1
  192. package/dist/visual/physics/circular.d.ts +1 -1
  193. package/dist/visual/physics/circular.js +1 -1
  194. package/dist/visual/physics/dynamics.d.ts +1 -1
  195. package/dist/visual/physics/dynamics.js +1 -1
  196. package/dist/visual/physics/efficiency.d.ts +1 -1
  197. package/dist/visual/physics/efficiency.js +1 -1
  198. package/dist/visual/physics/electronics.d.ts +1 -1
  199. package/dist/visual/physics/falling.d.ts +1 -1
  200. package/dist/visual/physics/falling.js +1 -1
  201. package/dist/visual/physics/field.d.ts +1 -1
  202. package/dist/visual/physics/fluid.d.ts +1 -1
  203. package/dist/visual/physics/fluid.js +1 -1
  204. package/dist/visual/physics/force.d.ts +1 -1
  205. package/dist/visual/physics/gravity.d.ts +1 -1
  206. package/dist/visual/physics/heat.d.ts +1 -1
  207. package/dist/visual/physics/heat.js +1 -1
  208. package/dist/visual/physics/instrument.d.ts +1 -1
  209. package/dist/visual/physics/light.d.ts +1 -1
  210. package/dist/visual/physics/light.js +1 -1
  211. package/dist/visual/physics/measurement.d.ts +1 -1
  212. package/dist/visual/physics/measurement.js +1 -1
  213. package/dist/visual/physics/motion.d.ts +1 -1
  214. package/dist/visual/physics/nuclear.d.ts +1 -1
  215. package/dist/visual/physics/parabolic.d.ts +1 -1
  216. package/dist/visual/physics/position.d.ts +1 -1
  217. package/dist/visual/physics/position.js +1 -1
  218. package/dist/visual/physics/power.d.ts +1 -1
  219. package/dist/visual/physics/power.js +1 -1
  220. package/dist/visual/physics/precision.d.ts +1 -1
  221. package/dist/visual/physics/precision.js +1 -1
  222. package/dist/visual/physics/product.d.ts +1 -1
  223. package/dist/visual/physics/reading.d.ts +1 -1
  224. package/dist/visual/physics/reading.js +1 -1
  225. package/dist/visual/physics/record.d.ts +1 -1
  226. package/dist/visual/physics/record.js +1 -1
  227. package/dist/visual/physics/relative.d.ts +1 -1
  228. package/dist/visual/physics/relative.js +1 -1
  229. package/dist/visual/physics/solar.d.ts +1 -1
  230. package/dist/visual/physics/solar.js +1 -1
  231. package/dist/visual/physics/thermodynamics.d.ts +117 -0
  232. package/dist/visual/physics/thermodynamics.js +95 -0
  233. package/dist/visual/physics/vector.d.ts +1 -1
  234. package/dist/visual/physics/vector.js +1 -1
  235. package/dist/visual/physics/velocity.d.ts +1 -1
  236. package/dist/visual/physics/wave.d.ts +1 -1
  237. package/dist/visual/politics.d.ts +1 -1
  238. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { type RichSlot } from "#contracts/visual/card";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
3
  /**
4
4
  * The props of the ecology and disease labs. No prop states the conclusion a
5
5
  * lab leads to, so none holds answer state.
@@ -0,0 +1,92 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The heart labs. Only the read-out results hold answer state. */
4
+ export declare function heartVisuals<E>(rich: RichSlot<E>): {
5
+ HeartCycleLab: 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 labels: Schema.Struct<{
76
+ readonly aorta: RichSlot<E>;
77
+ readonly output: Schema.optionalKey<RichSlot<E>>;
78
+ readonly phase: RichSlot<E>;
79
+ readonly phases: Schema.$Record<Schema.Literals<readonly ["atrial", "ventricular", "diastole"]>, RichSlot<E>>;
80
+ readonly pressure: RichSlot<E>;
81
+ readonly rate: Schema.Trimmed;
82
+ readonly stroke: Schema.optionalKey<RichSlot<E>>;
83
+ readonly view: Schema.Trimmed;
84
+ readonly volume: RichSlot<E>;
85
+ }>;
86
+ readonly rate: Schema.Finite;
87
+ readonly volumes: Schema.Struct<{
88
+ readonly endDiastolic: Schema.Finite;
89
+ readonly endSystolic: Schema.Finite;
90
+ }>;
91
+ }>, "figure">;
92
+ };
@@ -0,0 +1,54 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** A volume of blood: a finite number of millilitres above zero. */
5
+ const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /**
7
+ * A heart rate the lab's slider reaches, in beats a minute: from the slow
8
+ * resting rate of a trained athlete up to the 200 a young adult reaches at
9
+ * most (OpenStax Anatomy and Physiology 2e, 19.4).
10
+ */
11
+ const RateSchema = Schema.Finite.check(Schema.isBetween({ maximum: 200, minimum: 40 }));
12
+ /**
13
+ * The left ventricle's volumes: it fills to `endDiastolic` and keeps
14
+ * `endSystolic`, so it must keep less than it filled with.
15
+ */
16
+ const VolumesSchema = Schema.Struct({
17
+ endDiastolic: PositiveSchema,
18
+ endSystolic: PositiveSchema,
19
+ }).check(Schema.makeFilter(({ endDiastolic, endSystolic }) => endSystolic < endDiastolic, {
20
+ message: "Expected an end-systolic volume below the end-diastolic volume.",
21
+ }));
22
+ /**
23
+ * Props of `HeartCycleLab`: a human heart cut open from the front, beating
24
+ * through the cardiac cycle at `rate` beats a minute (the learner moves it
25
+ * with a slider labelled `labels.rate`). The left ventricle
26
+ * fills to `volumes.endDiastolic` and empties to `volumes.endSystolic`
27
+ * millilitres, so its stroke volume is their difference. The stroke volume
28
+ * and the cardiac output the lab reads out are results a question may ask
29
+ * for, so their labels are answer state.
30
+ */
31
+ function heartCycleLab(rich) {
32
+ return Schema.Struct({
33
+ ...cardFields(rich),
34
+ labels: Schema.Struct({
35
+ aorta: rich,
36
+ output: Schema.optionalKey(rich),
37
+ phase: rich,
38
+ phases: byIds(["atrial", "ventricular", "diastole"], rich),
39
+ pressure: rich,
40
+ rate: TextSchema,
41
+ stroke: Schema.optionalKey(rich),
42
+ view: TextSchema,
43
+ volume: rich,
44
+ }),
45
+ rate: RateSchema,
46
+ volumes: VolumesSchema,
47
+ });
48
+ }
49
+ /** The heart labs. Only the read-out results hold answer state. */
50
+ export function heartVisuals(rich) {
51
+ return {
52
+ HeartCycleLab: figure(heartCycleLab(rich), answerAt(["labels", "stroke"], ["labels", "output"])),
53
+ };
54
+ }
@@ -0,0 +1,91 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The visuals of this lab. */
4
+ export declare function mitochondrionVisuals<E>(rich: RichSlot<E>): {
5
+ MitochondrionLab: 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 atp: Schema.Int;
76
+ readonly cells: Schema.NonEmptyArray<Schema.Literals<readonly ["muscle", "yeast"]>>;
77
+ readonly labels: Schema.Struct<{
78
+ readonly atp: RichSlot<E>;
79
+ readonly carbonDioxide: RichSlot<E>;
80
+ readonly cell: Schema.Trimmed;
81
+ readonly cells: Schema.$Record<Schema.Literals<readonly ["muscle", "yeast"]>, Schema.Trimmed>;
82
+ readonly energy: Schema.optionalKey<RichSlot<E>>;
83
+ readonly oxygen: Schema.Trimmed;
84
+ readonly oxygens: Schema.$Record<Schema.Literals<readonly ["present", "absent"]>, Schema.Trimmed>;
85
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["cytoplasm", "outer", "inner", "cristae", "matrix"]>, Schema.Trimmed>;
86
+ readonly product: RichSlot<E>;
87
+ readonly products: Schema.$Record<Schema.Literals<readonly ["aerobic", "lactic", "alcoholic"]>, RichSlot<E>>;
88
+ readonly view: Schema.Trimmed;
89
+ }>;
90
+ }>, "figure">;
91
+ };
@@ -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
+ }