@nakafa/aksara-contracts 8.9.1 → 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 (160) hide show
  1. package/dist/assessment/choice.d.ts +26 -0
  2. package/dist/assessment/document.d.ts +39 -0
  3. package/dist/assessment/figure.d.ts +13 -0
  4. package/dist/assessment/hash.d.ts +711 -111
  5. package/dist/assessment/inline.d.ts +53 -0
  6. package/dist/assessment/inline.js +1 -0
  7. package/dist/assessment/interaction.d.ts +26 -0
  8. package/dist/assessment/item.d.ts +414 -36
  9. package/dist/assessment/paper.d.ts +731 -131
  10. package/dist/assessment/part.d.ts +13 -0
  11. package/dist/assessment/rows.d.ts +336 -36
  12. package/dist/assessment/snapshot.d.ts +773 -121
  13. package/dist/release/snapshot/data.d.ts +26 -0
  14. package/dist/release/snapshot/verify.d.ts +336 -36
  15. package/dist/transport/group.d.ts +78 -0
  16. package/dist/transport/request.d.ts +2195 -343
  17. package/dist/transport/snapshot.d.ts +52 -0
  18. package/dist/visual/base/math.d.ts +56 -6
  19. package/dist/visual/base/media.d.ts +56 -6
  20. package/dist/visual/biology/bacteria.d.ts +224 -24
  21. package/dist/visual/biology/binomial.d.ts +139 -0
  22. package/dist/visual/biology/binomial.js +46 -0
  23. package/dist/visual/biology/blood.d.ts +56 -6
  24. package/dist/visual/biology/bone.d.ts +141 -0
  25. package/dist/visual/biology/bone.js +46 -0
  26. package/dist/visual/biology/cell.d.ts +168 -18
  27. package/dist/visual/biology/chromosome.d.ts +139 -0
  28. package/dist/visual/biology/chromosome.js +42 -0
  29. package/dist/visual/biology/climate.d.ts +168 -18
  30. package/dist/visual/biology/control.d.ts +17 -0
  31. package/dist/visual/biology/control.js +21 -0
  32. package/dist/visual/biology/denature.d.ts +159 -0
  33. package/dist/visual/biology/denature.js +74 -0
  34. package/dist/visual/biology/drawing.d.ts +151 -0
  35. package/dist/visual/biology/drawing.js +69 -0
  36. package/dist/visual/biology/ecology.d.ts +224 -24
  37. package/dist/visual/biology/enzyme.d.ts +145 -0
  38. package/dist/visual/biology/enzyme.js +54 -0
  39. package/dist/visual/biology/equipment.d.ts +140 -0
  40. package/dist/visual/biology/equipment.js +64 -0
  41. package/dist/visual/biology/gametogenesis.d.ts +145 -0
  42. package/dist/visual/biology/gametogenesis.js +83 -0
  43. package/dist/visual/biology/heart.d.ts +56 -6
  44. package/dist/visual/biology/implantation.d.ts +138 -0
  45. package/dist/visual/biology/implantation.js +44 -0
  46. package/dist/visual/biology/joint.d.ts +140 -0
  47. package/dist/visual/biology/joint.js +47 -0
  48. package/dist/visual/biology/key.d.ts +141 -0
  49. package/dist/visual/biology/key.js +58 -0
  50. package/dist/visual/biology/kingdom.d.ts +142 -0
  51. package/dist/visual/biology/kingdom.js +82 -0
  52. package/dist/visual/biology/lactase.d.ts +147 -0
  53. package/dist/visual/biology/lactase.js +48 -0
  54. package/dist/visual/biology/limb.d.ts +139 -0
  55. package/dist/visual/biology/limb.js +44 -0
  56. package/dist/visual/biology/lipid.d.ts +144 -0
  57. package/dist/visual/biology/lipid.js +43 -0
  58. package/dist/visual/biology/locomotion.d.ts +141 -0
  59. package/dist/visual/biology/locomotion.js +48 -0
  60. package/dist/visual/biology/menstrual.d.ts +148 -0
  61. package/dist/visual/biology/menstrual.js +65 -0
  62. package/dist/visual/biology/metamorphosis.d.ts +140 -0
  63. package/dist/visual/biology/metamorphosis.js +34 -0
  64. package/dist/visual/biology/mitochondrion.d.ts +56 -6
  65. package/dist/visual/biology/muscle.d.ts +56 -6
  66. package/dist/visual/biology/neuron.d.ts +56 -6
  67. package/dist/visual/biology/paddy.d.ts +56 -6
  68. package/dist/visual/biology/physiology.d.ts +168 -18
  69. package/dist/visual/biology/placenta.d.ts +139 -0
  70. package/dist/visual/biology/placenta.js +52 -0
  71. package/dist/visual/biology/planes.d.ts +145 -0
  72. package/dist/visual/biology/planes.js +62 -0
  73. package/dist/visual/biology/plant.d.ts +280 -30
  74. package/dist/visual/biology/protein.d.ts +142 -0
  75. package/dist/visual/biology/protein.js +41 -0
  76. package/dist/visual/biology/saturation.d.ts +149 -0
  77. package/dist/visual/biology/saturation.js +40 -0
  78. package/dist/visual/biology/secretion.d.ts +149 -0
  79. package/dist/visual/biology/secretion.js +79 -0
  80. package/dist/visual/biology/spill.d.ts +165 -0
  81. package/dist/visual/biology/spill.js +58 -0
  82. package/dist/visual/biology/sugar.d.ts +152 -0
  83. package/dist/visual/biology/sugar.js +59 -0
  84. package/dist/visual/biology/synapse.d.ts +56 -6
  85. package/dist/visual/biology/taxon.d.ts +138 -0
  86. package/dist/visual/biology/taxon.js +50 -0
  87. package/dist/visual/biology/twins.d.ts +144 -0
  88. package/dist/visual/biology/twins.js +60 -0
  89. package/dist/visual/biology/vernacular.d.ts +141 -0
  90. package/dist/visual/biology/vernacular.js +57 -0
  91. package/dist/visual/biology/vertebra.d.ts +141 -0
  92. package/dist/visual/biology/vertebra.js +59 -0
  93. package/dist/visual/biology/vessel.d.ts +56 -6
  94. package/dist/visual/biology/waste.d.ts +140 -0
  95. package/dist/visual/biology/waste.js +57 -0
  96. package/dist/visual/biology/water.d.ts +152 -0
  97. package/dist/visual/biology/water.js +54 -0
  98. package/dist/visual/biology/yeast.d.ts +56 -6
  99. package/dist/visual/card.d.ts +67 -6
  100. package/dist/visual/card.js +17 -1
  101. package/dist/visual/catalog.d.ts +21584 -5487
  102. package/dist/visual/catalog.js +66 -0
  103. package/dist/visual/chemistry/atom.d.ts +168 -18
  104. package/dist/visual/chemistry/balance.d.ts +280 -30
  105. package/dist/visual/chemistry/bonding.d.ts +280 -30
  106. package/dist/visual/chemistry/discovery.d.ts +392 -42
  107. package/dist/visual/chemistry/electrochemistry.d.ts +112 -12
  108. package/dist/visual/chemistry/electron.d.ts +112 -12
  109. package/dist/visual/chemistry/laws.d.ts +224 -24
  110. package/dist/visual/chemistry/particles.d.ts +280 -30
  111. package/dist/visual/chemistry/periodic.d.ts +112 -12
  112. package/dist/visual/chemistry/rate.d.ts +56 -6
  113. package/dist/visual/chemistry/reaction.d.ts +168 -18
  114. package/dist/visual/chemistry/titration.d.ts +56 -6
  115. package/dist/visual/length.d.ts +56 -6
  116. package/dist/visual/mathematics/argument.d.ts +226 -0
  117. package/dist/visual/mathematics/argument.js +150 -0
  118. package/dist/visual/mathematics/chance.d.ts +168 -18
  119. package/dist/visual/mathematics/chart.d.ts +56 -6
  120. package/dist/visual/mathematics/charts.d.ts +280 -30
  121. package/dist/visual/mathematics/counterexample.d.ts +340 -0
  122. package/dist/visual/mathematics/counterexample.js +157 -0
  123. package/dist/visual/mathematics/function.d.ts +168 -18
  124. package/dist/visual/mathematics/journey.d.ts +56 -6
  125. package/dist/visual/mathematics/logic.d.ts +56 -6
  126. package/dist/visual/mathematics/network.d.ts +56 -6
  127. package/dist/visual/mathematics/numeral.d.ts +168 -18
  128. package/dist/visual/mathematics/sets.d.ts +56 -6
  129. package/dist/visual/physics/braking.d.ts +224 -24
  130. package/dist/visual/physics/circuit.d.ts +224 -24
  131. package/dist/visual/physics/circular.d.ts +112 -12
  132. package/dist/visual/physics/dynamics.d.ts +392 -42
  133. package/dist/visual/physics/efficiency.d.ts +336 -36
  134. package/dist/visual/physics/electronics.d.ts +168 -18
  135. package/dist/visual/physics/falling.d.ts +224 -24
  136. package/dist/visual/physics/field.d.ts +168 -18
  137. package/dist/visual/physics/fluid.d.ts +224 -24
  138. package/dist/visual/physics/force.d.ts +280 -30
  139. package/dist/visual/physics/gravity.d.ts +112 -12
  140. package/dist/visual/physics/heat.d.ts +168 -18
  141. package/dist/visual/physics/instrument.d.ts +392 -42
  142. package/dist/visual/physics/light.d.ts +224 -24
  143. package/dist/visual/physics/measurement.d.ts +224 -24
  144. package/dist/visual/physics/motion.d.ts +336 -36
  145. package/dist/visual/physics/nuclear.d.ts +168 -18
  146. package/dist/visual/physics/parabolic.d.ts +56 -6
  147. package/dist/visual/physics/position.d.ts +336 -36
  148. package/dist/visual/physics/power.d.ts +448 -48
  149. package/dist/visual/physics/precision.d.ts +392 -42
  150. package/dist/visual/physics/product.d.ts +224 -24
  151. package/dist/visual/physics/reading.d.ts +168 -18
  152. package/dist/visual/physics/record.d.ts +112 -12
  153. package/dist/visual/physics/relative.d.ts +168 -18
  154. package/dist/visual/physics/solar.d.ts +336 -36
  155. package/dist/visual/physics/thermodynamics.d.ts +56 -6
  156. package/dist/visual/physics/vector.d.ts +280 -30
  157. package/dist/visual/physics/velocity.d.ts +392 -42
  158. package/dist/visual/physics/wave.d.ts +224 -24
  159. package/dist/visual/politics.d.ts +336 -36
  160. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The waste lab. Why an item goes where it goes is the reasoning a question
5
+ * asks for, so the reasons are answer state.
6
+ */
7
+ export declare function wasteVisuals<E>(rich: RichSlot<E>): {
8
+ WasteSortLab: 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 items: Schema.NonEmptyArray<Schema.Literals<readonly ["culture", "glove", "swab", "blade", "slide", "glass", "salt", "solvent"]>>;
129
+ readonly labels: Schema.Struct<{
130
+ readonly autoclave: RichSlot<E>;
131
+ readonly destination: RichSlot<E>;
132
+ readonly destinations: Schema.$Record<Schema.Literals<readonly ["sink", "chemical", "sharps", "glassBox", "biohazard"]>, RichSlot<E>>;
133
+ readonly item: Schema.Trimmed;
134
+ readonly items: Schema.$Record<Schema.Literals<readonly ["culture", "glove", "swab", "blade", "slide", "glass", "salt", "solvent"]>, Schema.optionalKey<Schema.Trimmed>>;
135
+ readonly reason: Schema.optionalKey<RichSlot<E>>;
136
+ readonly reasons: Schema.optionalKey<Schema.$Record<Schema.Literals<readonly ["culture", "glove", "swab", "blade", "slide", "glass", "salt", "solvent"]>, Schema.optionalKey<RichSlot<E>>>>;
137
+ readonly view: Schema.Trimmed;
138
+ }>;
139
+ }>, "figure">;
140
+ };
@@ -0,0 +1,57 @@
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
+ /**
5
+ * The waste a school laboratory sorts. Where each one goes is a fact the
6
+ * renderer knows: a living culture, a glove or swab that touched one go to
7
+ * the biohazard bag and the autoclave; a blade and a slide with a specimen to
8
+ * the sharps container; clean broken glass to its box; a dilute salt solution
9
+ * down the sink; an organic solvent to the chemical waste bottle.
10
+ */
11
+ const WASTE = [
12
+ "culture",
13
+ "glove",
14
+ "swab",
15
+ "blade",
16
+ "slide",
17
+ "glass",
18
+ "salt",
19
+ "solvent",
20
+ ];
21
+ /**
22
+ * Props of `WasteSortLab`: a waste station at the end of a bench with five
23
+ * places for waste (the sink, a chemical waste bottle, a sharps container, a
24
+ * broken glass box and a biohazard bag beside the autoclave) and a tray of
25
+ * `items`, each once. Picking an item carries it to its place; the readouts
26
+ * name the place and, when `labels.reasons` is given, why it goes there.
27
+ * `labels.autoclave` names the autoclave's steam, temperature and time.
28
+ */
29
+ function wasteSortLab(rich) {
30
+ return figure(Schema.Struct({
31
+ ...cardFields(rich),
32
+ items: Schema.NonEmptyArray(Schema.Literals(WASTE)).check(Schema.isUnique()),
33
+ labels: Schema.Struct({
34
+ autoclave: rich,
35
+ destination: rich,
36
+ destinations: byIds(["sink", "chemical", "sharps", "glassBox", "biohazard"], rich),
37
+ item: TextSchema,
38
+ items: byPickedIds(WASTE, TextSchema),
39
+ reason: Schema.optionalKey(rich),
40
+ reasons: Schema.optionalKey(byPickedIds(WASTE, rich)),
41
+ view: TextSchema,
42
+ }),
43
+ }).check(Schema.makeFilter(({ items, labels }) => namesEach(items, labels.items), {
44
+ message: "Expected a name for every item on the tray, and no other.",
45
+ }), Schema.makeFilter(({ items, labels }) => labels.reasons === undefined
46
+ ? labels.reason === undefined
47
+ : labels.reason !== undefined && namesEach(items, labels.reasons), {
48
+ message: "Expected the reasons, when given, to explain every item on the tray under a heading of their own.",
49
+ })), answerAt(["labels", "reasons"]));
50
+ }
51
+ /**
52
+ * The waste lab. Why an item goes where it goes is the reasoning a question
53
+ * asks for, so the reasons are answer state.
54
+ */
55
+ export function wasteVisuals(rich) {
56
+ return { WasteSortLab: wasteSortLab(rich) };
57
+ }
@@ -0,0 +1,152 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The water lab. The temperature rises and the capillary rise are what a
5
+ * question asks a learner to work out, so their readouts are answer state.
6
+ */
7
+ export declare function waterVisuals<E>(rich: RichSlot<E>): {
8
+ WaterBondLab: 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 heat: Schema.Struct<{
129
+ readonly max: Schema.Finite;
130
+ readonly min: Schema.Finite;
131
+ readonly value: Schema.Finite;
132
+ }>;
133
+ readonly labels: Schema.Struct<{
134
+ readonly ethanol: Schema.optionalKey<RichSlot<E>>;
135
+ readonly heat: Schema.Trimmed;
136
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["oxygen", "hydrogen", "bond", "wall"]>, Schema.Trimmed>;
137
+ readonly properties: Schema.$Record<Schema.Literals<readonly ["cohesion", "adhesion", "heat"]>, Schema.optionalKey<Schema.Trimmed>>;
138
+ readonly property: Schema.Trimmed;
139
+ readonly radius: Schema.Trimmed;
140
+ readonly rise: Schema.optionalKey<RichSlot<E>>;
141
+ readonly view: Schema.Trimmed;
142
+ readonly water: Schema.optionalKey<RichSlot<E>>;
143
+ }>;
144
+ readonly mass: Schema.Finite;
145
+ readonly properties: Schema.NonEmptyArray<Schema.Literals<readonly ["cohesion", "adhesion", "heat"]>>;
146
+ readonly radius: Schema.Struct<{
147
+ readonly max: Schema.Finite;
148
+ readonly min: Schema.Finite;
149
+ readonly value: Schema.Finite;
150
+ }>;
151
+ }>, "figure">;
152
+ };
@@ -0,0 +1,54 @@
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
+ /** An amount the lab measures: a finite number above zero. */
5
+ const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /** A slider: its range and its starting value, all above zero. */
7
+ const SliderSchema = Schema.Struct({
8
+ max: PositiveSchema,
9
+ min: PositiveSchema,
10
+ value: PositiveSchema,
11
+ }).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
12
+ message: "Expected a slider range whose minimum is below its maximum, with the starting value between them.",
13
+ }));
14
+ const PROPERTIES = ["cohesion", "adhesion", "heat"];
15
+ /**
16
+ * Props of `WaterBondLab`: water molecules held together by hydrogen bonds,
17
+ * showing one of `properties` at a time (each once, in the order the toggle
18
+ * lists them). Cohesion pulls a column of water up a xylem vessel whose
19
+ * radius the learner sets (`radius`, micrometres); adhesion makes water
20
+ * climb a glass wall; heat warms `mass` grams of water and of ethanol with
21
+ * the same energy (`heat`, joules) so their temperature rises compare. The
22
+ * readouts show the water's rise, the ethanol's rise and the capillary rise
23
+ * only when `labels.water`, `labels.ethanol` and `labels.rise` name them,
24
+ * so a question that asks for one leaves its name out.
25
+ */
26
+ function waterBondLab(rich) {
27
+ return figure(Schema.Struct({
28
+ ...cardFields(rich),
29
+ heat: SliderSchema,
30
+ labels: Schema.Struct({
31
+ ethanol: Schema.optionalKey(rich),
32
+ heat: TextSchema,
33
+ parts: byIds(["oxygen", "hydrogen", "bond", "wall"], TextSchema),
34
+ properties: byPickedIds(PROPERTIES, TextSchema),
35
+ property: TextSchema,
36
+ radius: TextSchema,
37
+ rise: Schema.optionalKey(rich),
38
+ view: TextSchema,
39
+ water: Schema.optionalKey(rich),
40
+ }),
41
+ mass: PositiveSchema,
42
+ properties: Schema.NonEmptyArray(Schema.Literals(PROPERTIES)).check(Schema.isUnique()),
43
+ radius: SliderSchema,
44
+ }).check(Schema.makeFilter(({ labels, properties }) => namesEach(properties, labels.properties), {
45
+ message: "Expected a name for every property the lab shows, and no other.",
46
+ })), answerAt(["labels", "water"], ["labels", "ethanol"], ["labels", "rise"]));
47
+ }
48
+ /**
49
+ * The water lab. The temperature rises and the capillary rise are what a
50
+ * question asks a learner to work out, so their readouts are answer state.
51
+ */
52
+ export function waterVisuals(rich) {
53
+ return { WaterBondLab: waterBondLab(rich) };
54
+ }
@@ -9,11 +9,64 @@ export declare function yeastVisuals<E>(rich: RichSlot<E>): {
9
9
  YeastFermentationLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
10
10
  readonly description: RichSlot<E>;
11
11
  readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
12
+ readonly marks?: readonly [{
13
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
14
+ } | {
15
+ readonly attrs: {
16
+ readonly href: string;
17
+ };
18
+ readonly type: "link";
19
+ } | {
20
+ readonly attrs: {
21
+ readonly variant: "success" | "warning" | null;
22
+ };
23
+ readonly type: "highlight";
24
+ }, ...({
25
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
26
+ } | {
27
+ readonly attrs: {
28
+ readonly href: string;
29
+ };
30
+ readonly type: "link";
31
+ } | {
32
+ readonly attrs: {
33
+ readonly variant: "success" | "warning" | null;
34
+ };
35
+ readonly type: "highlight";
36
+ })[]];
37
+ readonly text: string;
38
+ readonly type: "text";
39
+ } | {
12
40
  readonly attrs: {
13
41
  readonly latex: string;
14
42
  };
43
+ readonly marks?: readonly [{
44
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
45
+ } | {
46
+ readonly attrs: {
47
+ readonly href: string;
48
+ };
49
+ readonly type: "link";
50
+ } | {
51
+ readonly attrs: {
52
+ readonly variant: "success" | "warning" | null;
53
+ };
54
+ readonly type: "highlight";
55
+ }, ...({
56
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
57
+ } | {
58
+ readonly attrs: {
59
+ readonly href: string;
60
+ };
61
+ readonly type: "link";
62
+ } | {
63
+ readonly attrs: {
64
+ readonly variant: "success" | "warning" | null;
65
+ };
66
+ readonly type: "highlight";
67
+ })[]];
15
68
  readonly type: "mathInline";
16
- } | {
69
+ }, ...({
17
70
  readonly marks?: readonly [{
18
71
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
19
72
  } | {
@@ -41,12 +94,10 @@ export declare function yeastVisuals<E>(rich: RichSlot<E>): {
41
94
  })[]];
42
95
  readonly text: string;
43
96
  readonly type: "text";
44
- }, ...({
97
+ } | {
45
98
  readonly attrs: {
46
99
  readonly latex: string;
47
100
  };
48
- readonly type: "mathInline";
49
- } | {
50
101
  readonly marks?: readonly [{
51
102
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
52
103
  } | {
@@ -72,8 +123,7 @@ export declare function yeastVisuals<E>(rich: RichSlot<E>): {
72
123
  };
73
124
  readonly type: "highlight";
74
125
  })[]];
75
- readonly text: string;
76
- readonly type: "text";
126
+ readonly type: "mathInline";
77
127
  })[]], E, never, never>>;
78
128
  readonly title: RichSlot<E>;
79
129
  readonly glucose: Schema.Finite;
@@ -26,11 +26,64 @@ export declare const FOOTER_CHARACTERS = 90;
26
26
  export declare function cardFields<E>(rich: RichSlot<E>): {
27
27
  description: RichSlot<E>;
28
28
  footer: Schema.optionalKey<Schema.Codec<readonly [{
29
+ readonly marks?: readonly [{
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 type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
43
+ } | {
44
+ readonly attrs: {
45
+ readonly href: string;
46
+ };
47
+ readonly type: "link";
48
+ } | {
49
+ readonly attrs: {
50
+ readonly variant: "success" | "warning" | null;
51
+ };
52
+ readonly type: "highlight";
53
+ })[]];
54
+ readonly text: string;
55
+ readonly type: "text";
56
+ } | {
29
57
  readonly attrs: {
30
58
  readonly latex: string;
31
59
  };
60
+ readonly marks?: readonly [{
61
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
62
+ } | {
63
+ readonly attrs: {
64
+ readonly href: string;
65
+ };
66
+ readonly type: "link";
67
+ } | {
68
+ readonly attrs: {
69
+ readonly variant: "success" | "warning" | null;
70
+ };
71
+ readonly type: "highlight";
72
+ }, ...({
73
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
74
+ } | {
75
+ readonly attrs: {
76
+ readonly href: string;
77
+ };
78
+ readonly type: "link";
79
+ } | {
80
+ readonly attrs: {
81
+ readonly variant: "success" | "warning" | null;
82
+ };
83
+ readonly type: "highlight";
84
+ })[]];
32
85
  readonly type: "mathInline";
33
- } | {
86
+ }, ...({
34
87
  readonly marks?: readonly [{
35
88
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
36
89
  } | {
@@ -58,12 +111,10 @@ export declare function cardFields<E>(rich: RichSlot<E>): {
58
111
  })[]];
59
112
  readonly text: string;
60
113
  readonly type: "text";
61
- }, ...({
114
+ } | {
62
115
  readonly attrs: {
63
116
  readonly latex: string;
64
117
  };
65
- readonly type: "mathInline";
66
- } | {
67
118
  readonly marks?: readonly [{
68
119
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
69
120
  } | {
@@ -89,8 +140,7 @@ export declare function cardFields<E>(rich: RichSlot<E>): {
89
140
  };
90
141
  readonly type: "highlight";
91
142
  })[]];
92
- readonly text: string;
93
- readonly type: "text";
143
+ readonly type: "mathInline";
94
144
  })[]], E, never, never>>;
95
145
  title: RichSlot<E>;
96
146
  };
@@ -99,6 +149,17 @@ export declare function cardFields<E>(rich: RichSlot<E>): {
99
149
  * samples of a lab: one value for every identifier, and no other key.
100
150
  */
101
151
  export declare function byIds<const Ids extends readonly [string, ...string[]], Value extends Schema.Top>(ids: Ids, value: Value): Schema.$Record<Schema.Literals<Ids>, Value>;
152
+ /**
153
+ * The words of one component for the options a document picks from a fixed
154
+ * list, such as the items a lab shows: at most one value for each identifier.
155
+ * `namesEach` checks that the picked options and the named ones are the same.
156
+ */
157
+ export declare function byPickedIds<const Ids extends readonly [string, ...string[]], Value extends Schema.Top>(ids: Ids, value: Value): Schema.$Record<Schema.Literals<Ids>, Schema.optionalKey<Value>>;
158
+ /**
159
+ * Checks that words written with `byPickedIds` name every picked option and
160
+ * no other one, so no option goes unnamed and no word goes unused.
161
+ */
162
+ export declare function namesEach(picked: readonly string[], words: Readonly<Record<string, unknown>>): boolean;
102
163
  /** One fact a lab lists: a plain label and a rich value. */
103
164
  export declare function factSchema<E>(rich: RichSlot<E>): Schema.Struct<{
104
165
  readonly label: Schema.Trimmed;
@@ -1,4 +1,4 @@
1
- import { Schema } from "effect";
1
+ import { Array as Arr, Predicate, Record as Rec, Schema } from "effect";
2
2
  import { PlainTextSchema } from "#contracts/assessment/scalar";
3
3
  import { atMostVisible } from "#contracts/visual/length";
4
4
  /**
@@ -32,6 +32,22 @@ export function cardFields(rich) {
32
32
  export function byIds(ids, value) {
33
33
  return Schema.Record(Schema.Literals(ids), value);
34
34
  }
35
+ /**
36
+ * The words of one component for the options a document picks from a fixed
37
+ * list, such as the items a lab shows: at most one value for each identifier.
38
+ * `namesEach` checks that the picked options and the named ones are the same.
39
+ */
40
+ export function byPickedIds(ids, value) {
41
+ return Schema.Record(Schema.Literals(ids), Schema.optionalKey(value));
42
+ }
43
+ /**
44
+ * Checks that words written with `byPickedIds` name every picked option and
45
+ * no other one, so no option goes unnamed and no word goes unused.
46
+ */
47
+ export function namesEach(picked, words) {
48
+ return (Rec.size(words) === Arr.dedupe(picked).length &&
49
+ Arr.every(picked, (id) => Predicate.hasProperty(words, id)));
50
+ }
35
51
  /** One fact a lab lists: a plain label and a rich value. */
36
52
  export function factSchema(rich) {
37
53
  return Schema.Struct({ label: TextSchema, value: rich });