@nakafa/aksara-contracts 8.14.0 → 8.15.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.
@@ -0,0 +1,276 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * Flowering-plant reproduction labs covering flower anatomy and pollination
5
+ * contrast plus post-fertilisation seed and fruit development.
6
+ */
7
+ export declare function flowerVisuals<E>(rich: RichSlot<E>): {
8
+ FlowerAnatomyLab: 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 labels: Schema.Struct<{
129
+ readonly adaptation: Schema.optionalKey<RichSlot<E>>;
130
+ readonly mode: Schema.Trimmed;
131
+ readonly modes: Schema.$Record<Schema.Literals<readonly ["insect", "wind"]>, Schema.optionalKey<Schema.Struct<{
132
+ readonly adaptation: RichSlot<E>;
133
+ readonly name: Schema.Trimmed;
134
+ readonly pollen: RichSlot<E>;
135
+ }>>>;
136
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["sepal", "petal", "anther", "filament", "stigma", "style", "ovary", "ovule"]>, Schema.Trimmed>;
137
+ readonly pollen: Schema.optionalKey<RichSlot<E>>;
138
+ readonly view: Schema.Trimmed;
139
+ }>;
140
+ readonly modes: Schema.NonEmptyArray<Schema.Literals<readonly ["insect", "wind"]>>;
141
+ }>, "figure">;
142
+ FruitSeedDispersalLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
143
+ readonly description: RichSlot<E>;
144
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
145
+ readonly marks?: readonly [{
146
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
147
+ } | {
148
+ readonly attrs: {
149
+ readonly href: string;
150
+ };
151
+ readonly type: "link";
152
+ } | {
153
+ readonly attrs: {
154
+ readonly variant: "success" | "warning" | null;
155
+ };
156
+ readonly type: "highlight";
157
+ }, ...({
158
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
159
+ } | {
160
+ readonly attrs: {
161
+ readonly href: string;
162
+ };
163
+ readonly type: "link";
164
+ } | {
165
+ readonly attrs: {
166
+ readonly variant: "success" | "warning" | null;
167
+ };
168
+ readonly type: "highlight";
169
+ })[]];
170
+ readonly text: string;
171
+ readonly type: "text";
172
+ } | {
173
+ readonly attrs: {
174
+ readonly latex: string;
175
+ };
176
+ readonly marks?: readonly [{
177
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
178
+ } | {
179
+ readonly attrs: {
180
+ readonly href: string;
181
+ };
182
+ readonly type: "link";
183
+ } | {
184
+ readonly attrs: {
185
+ readonly variant: "success" | "warning" | null;
186
+ };
187
+ readonly type: "highlight";
188
+ }, ...({
189
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
190
+ } | {
191
+ readonly attrs: {
192
+ readonly href: string;
193
+ };
194
+ readonly type: "link";
195
+ } | {
196
+ readonly attrs: {
197
+ readonly variant: "success" | "warning" | null;
198
+ };
199
+ readonly type: "highlight";
200
+ })[]];
201
+ readonly type: "mathInline";
202
+ }, ...({
203
+ readonly marks?: readonly [{
204
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
205
+ } | {
206
+ readonly attrs: {
207
+ readonly href: string;
208
+ };
209
+ readonly type: "link";
210
+ } | {
211
+ readonly attrs: {
212
+ readonly variant: "success" | "warning" | null;
213
+ };
214
+ readonly type: "highlight";
215
+ }, ...({
216
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
217
+ } | {
218
+ readonly attrs: {
219
+ readonly href: string;
220
+ };
221
+ readonly type: "link";
222
+ } | {
223
+ readonly attrs: {
224
+ readonly variant: "success" | "warning" | null;
225
+ };
226
+ readonly type: "highlight";
227
+ })[]];
228
+ readonly text: string;
229
+ readonly type: "text";
230
+ } | {
231
+ readonly attrs: {
232
+ readonly latex: string;
233
+ };
234
+ readonly marks?: readonly [{
235
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
236
+ } | {
237
+ readonly attrs: {
238
+ readonly href: string;
239
+ };
240
+ readonly type: "link";
241
+ } | {
242
+ readonly attrs: {
243
+ readonly variant: "success" | "warning" | null;
244
+ };
245
+ readonly type: "highlight";
246
+ }, ...({
247
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
248
+ } | {
249
+ readonly attrs: {
250
+ readonly href: string;
251
+ };
252
+ readonly type: "link";
253
+ } | {
254
+ readonly attrs: {
255
+ readonly variant: "success" | "warning" | null;
256
+ };
257
+ readonly type: "highlight";
258
+ })[]];
259
+ readonly type: "mathInline";
260
+ })[]], E, never, never>>;
261
+ readonly title: RichSlot<E>;
262
+ readonly fruits: Schema.NonEmptyArray<Schema.Literals<readonly ["simple", "aggregate", "multiple"]>>;
263
+ readonly labels: Schema.Struct<{
264
+ readonly fruit: Schema.Trimmed;
265
+ readonly fruits: Schema.$Record<Schema.Literals<readonly ["simple", "aggregate", "multiple"]>, Schema.optionalKey<Schema.Struct<{
266
+ readonly name: Schema.Trimmed;
267
+ readonly origin: RichSlot<E>;
268
+ readonly structure: RichSlot<E>;
269
+ }>>>;
270
+ readonly origin: Schema.optionalKey<RichSlot<E>>;
271
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["pericarp", "testa", "cotyledon", "embryo", "endosperm"]>, Schema.Trimmed>;
272
+ readonly structure: Schema.optionalKey<RichSlot<E>>;
273
+ readonly view: Schema.Trimmed;
274
+ }>;
275
+ }>, "figure">;
276
+ };
@@ -0,0 +1,76 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ const POLLINATION_TYPES = ["insect", "wind"];
5
+ const FRUIT_TYPES = ["simple", "aggregate", "multiple"];
6
+ /**
7
+ * Props of `FlowerAnatomyLab`: a 3D cutaway complete flower comparing
8
+ * insect-pollinated and wind-pollinated adaptations across sepal, petal,
9
+ * anther, filament, stigma, style, ovary, and ovule. Pollinator match and
10
+ * pollen-trait readouts are optional answer state.
11
+ */
12
+ function flowerAnatomyLab(rich) {
13
+ return figure(Schema.Struct({
14
+ ...cardFields(rich),
15
+ labels: Schema.Struct({
16
+ adaptation: Schema.optionalKey(rich),
17
+ mode: TextSchema,
18
+ modes: byPickedIds(POLLINATION_TYPES, Schema.Struct({
19
+ adaptation: rich,
20
+ name: TextSchema,
21
+ pollen: rich,
22
+ })),
23
+ parts: byIds([
24
+ "sepal",
25
+ "petal",
26
+ "anther",
27
+ "filament",
28
+ "stigma",
29
+ "style",
30
+ "ovary",
31
+ "ovule",
32
+ ], TextSchema),
33
+ pollen: Schema.optionalKey(rich),
34
+ view: TextSchema,
35
+ }),
36
+ modes: Schema.NonEmptyArray(Schema.Literals(POLLINATION_TYPES)).check(Schema.isUnique()),
37
+ }).check(Schema.makeFilter(({ labels, modes }) => namesEach(modes, labels.modes), {
38
+ message: "Expected a name, pollen, and adaptation note for every pollination mode shown, and no other.",
39
+ })), answerAt(["labels", "adaptation"], ["labels", "pollen"]));
40
+ }
41
+ /**
42
+ * Props of `FruitSeedDispersalLab`: a 3D post-fertilisation cutaway showing
43
+ * how ovules become seeds (testa, cotyledon, embryo) while ovary walls form
44
+ * simple, aggregate, or multiple fruits. Origin and seed structure readouts
45
+ * are optional answer state.
46
+ */
47
+ function fruitSeedDispersalLab(rich) {
48
+ return figure(Schema.Struct({
49
+ ...cardFields(rich),
50
+ fruits: Schema.NonEmptyArray(Schema.Literals(FRUIT_TYPES)).check(Schema.isUnique()),
51
+ labels: Schema.Struct({
52
+ fruit: TextSchema,
53
+ fruits: byPickedIds(FRUIT_TYPES, Schema.Struct({
54
+ name: TextSchema,
55
+ origin: rich,
56
+ structure: rich,
57
+ })),
58
+ origin: Schema.optionalKey(rich),
59
+ parts: byIds(["pericarp", "testa", "cotyledon", "embryo", "endosperm"], TextSchema),
60
+ structure: Schema.optionalKey(rich),
61
+ view: TextSchema,
62
+ }),
63
+ }).check(Schema.makeFilter(({ fruits, labels }) => namesEach(fruits, labels.fruits), {
64
+ message: "Expected a name, origin, and structure note for every fruit type shown, and no other.",
65
+ })), answerAt(["labels", "origin"], ["labels", "structure"]));
66
+ }
67
+ /**
68
+ * Flowering-plant reproduction labs covering flower anatomy and pollination
69
+ * contrast plus post-fertilisation seed and fruit development.
70
+ */
71
+ export function flowerVisuals(rich) {
72
+ return {
73
+ FlowerAnatomyLab: flowerAnatomyLab(rich),
74
+ FruitSeedDispersalLab: fruitSeedDispersalLab(rich),
75
+ };
76
+ }
@@ -1,8 +1,8 @@
1
1
  import { Schema } from "effect";
2
2
  import type { RichSlot } from "#contracts/visual/card";
3
3
  /**
4
- * Membrane transport labs covering ATP-driven carrier pumps and osmotic
5
- * plasmolysis across plant and animal cells.
4
+ * Membrane transport labs covering fluid-mosaic structure, ATP-driven carrier
5
+ * pumps, and osmotic plasmolysis across plant and animal cells.
6
6
  */
7
7
  export declare function membraneVisuals<E>(rich: RichSlot<E>): {
8
8
  ActiveTransportPumpLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
@@ -145,6 +145,145 @@ export declare function membraneVisuals<E>(rich: RichSlot<E>): {
145
145
  }>;
146
146
  readonly modes: Schema.NonEmptyArray<Schema.Literals<readonly ["simpleDiffusion", "facilitated", "activePump"]>>;
147
147
  }>, "figure">;
148
+ FluidMosaicMembraneLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
149
+ readonly description: RichSlot<E>;
150
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
151
+ readonly marks?: readonly [{
152
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
153
+ } | {
154
+ readonly attrs: {
155
+ readonly href: string;
156
+ };
157
+ readonly type: "link";
158
+ } | {
159
+ readonly attrs: {
160
+ readonly variant: "success" | "warning" | null;
161
+ };
162
+ readonly type: "highlight";
163
+ }, ...({
164
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
165
+ } | {
166
+ readonly attrs: {
167
+ readonly href: string;
168
+ };
169
+ readonly type: "link";
170
+ } | {
171
+ readonly attrs: {
172
+ readonly variant: "success" | "warning" | null;
173
+ };
174
+ readonly type: "highlight";
175
+ })[]];
176
+ readonly text: string;
177
+ readonly type: "text";
178
+ } | {
179
+ readonly attrs: {
180
+ readonly latex: string;
181
+ };
182
+ readonly marks?: readonly [{
183
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
184
+ } | {
185
+ readonly attrs: {
186
+ readonly href: string;
187
+ };
188
+ readonly type: "link";
189
+ } | {
190
+ readonly attrs: {
191
+ readonly variant: "success" | "warning" | null;
192
+ };
193
+ readonly type: "highlight";
194
+ }, ...({
195
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
196
+ } | {
197
+ readonly attrs: {
198
+ readonly href: string;
199
+ };
200
+ readonly type: "link";
201
+ } | {
202
+ readonly attrs: {
203
+ readonly variant: "success" | "warning" | null;
204
+ };
205
+ readonly type: "highlight";
206
+ })[]];
207
+ readonly type: "mathInline";
208
+ }, ...({
209
+ readonly marks?: readonly [{
210
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
211
+ } | {
212
+ readonly attrs: {
213
+ readonly href: string;
214
+ };
215
+ readonly type: "link";
216
+ } | {
217
+ readonly attrs: {
218
+ readonly variant: "success" | "warning" | null;
219
+ };
220
+ readonly type: "highlight";
221
+ }, ...({
222
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
223
+ } | {
224
+ readonly attrs: {
225
+ readonly href: string;
226
+ };
227
+ readonly type: "link";
228
+ } | {
229
+ readonly attrs: {
230
+ readonly variant: "success" | "warning" | null;
231
+ };
232
+ readonly type: "highlight";
233
+ })[]];
234
+ readonly text: string;
235
+ readonly type: "text";
236
+ } | {
237
+ readonly attrs: {
238
+ readonly latex: string;
239
+ };
240
+ readonly marks?: readonly [{
241
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
242
+ } | {
243
+ readonly attrs: {
244
+ readonly href: string;
245
+ };
246
+ readonly type: "link";
247
+ } | {
248
+ readonly attrs: {
249
+ readonly variant: "success" | "warning" | null;
250
+ };
251
+ readonly type: "highlight";
252
+ }, ...({
253
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
254
+ } | {
255
+ readonly attrs: {
256
+ readonly href: string;
257
+ };
258
+ readonly type: "link";
259
+ } | {
260
+ readonly attrs: {
261
+ readonly variant: "success" | "warning" | null;
262
+ };
263
+ readonly type: "highlight";
264
+ })[]];
265
+ readonly type: "mathInline";
266
+ })[]], E, never, never>>;
267
+ readonly title: RichSlot<E>;
268
+ readonly components: Schema.NonEmptyArray<Schema.Literals<readonly ["phospholipid", "cholesterol", "integralProtein", "glycoprotein"]>>;
269
+ readonly labels: Schema.Struct<{
270
+ readonly component: Schema.Trimmed;
271
+ readonly components: Schema.$Record<Schema.Literals<readonly ["phospholipid", "cholesterol", "integralProtein", "glycoprotein"]>, Schema.optionalKey<Schema.Struct<{
272
+ readonly name: Schema.Trimmed;
273
+ readonly role: RichSlot<E>;
274
+ }>>>;
275
+ readonly fluidity: Schema.optionalKey<RichSlot<E>>;
276
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["hydrophilicHead", "hydrophobicTail", "cholesterol", "integralProtein", "glycoprotein", "glycolipid"]>, Schema.Trimmed>;
277
+ readonly role: Schema.optionalKey<RichSlot<E>>;
278
+ readonly temperature: Schema.Trimmed;
279
+ readonly view: Schema.Trimmed;
280
+ }>;
281
+ readonly temperature: Schema.Struct<{
282
+ readonly max: Schema.Finite;
283
+ readonly min: Schema.Finite;
284
+ readonly value: Schema.Finite;
285
+ }>;
286
+ }>, "figure">;
148
287
  PlasmolysisCellLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
149
288
  readonly description: RichSlot<E>;
150
289
  readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
@@ -20,6 +20,12 @@ const TRANSPORT_MODES = [
20
20
  ];
21
21
  const CELL_KINDS = ["plant", "redBlood"];
22
22
  const TONICITIES = ["hypotonic", "isotonic", "hypertonic"];
23
+ const MEMBRANE_PARTS = [
24
+ "phospholipid",
25
+ "cholesterol",
26
+ "integralProtein",
27
+ "glycoprotein",
28
+ ];
23
29
  /**
24
30
  * Props of `ActiveTransportPumpLab`: a 3D phospholipid bilayer contrasting
25
31
  * simple diffusion, facilitated diffusion through channel proteins, and
@@ -76,12 +82,48 @@ function plasmolysisCellLab(rich) {
76
82
  })), answerAt(["labels", "outcome"], ["labels", "waterFlow"]));
77
83
  }
78
84
  /**
79
- * Membrane transport labs covering ATP-driven carrier pumps and osmotic
80
- * plasmolysis across plant and animal cells.
85
+ * Props of `FluidMosaicMembraneLab`: a 3D Singer-Nicolson fluid-mosaic
86
+ * plasma membrane showing hydrophilic heads, hydrophobic fatty-acid tails,
87
+ * cholesterol buffers, integral proteins, and surface glycoproteins with a
88
+ * temperature slider affecting bilayer fluidity. Role and fluidity readouts
89
+ * are optional answer state.
90
+ */
91
+ function fluidMosaicMembraneLab(rich) {
92
+ return figure(Schema.Struct({
93
+ ...cardFields(rich),
94
+ components: Schema.NonEmptyArray(Schema.Literals(MEMBRANE_PARTS)).check(Schema.isUnique()),
95
+ labels: Schema.Struct({
96
+ component: TextSchema,
97
+ components: byPickedIds(MEMBRANE_PARTS, Schema.Struct({
98
+ name: TextSchema,
99
+ role: rich,
100
+ })),
101
+ fluidity: Schema.optionalKey(rich),
102
+ parts: byIds([
103
+ "hydrophilicHead",
104
+ "hydrophobicTail",
105
+ "cholesterol",
106
+ "integralProtein",
107
+ "glycoprotein",
108
+ "glycolipid",
109
+ ], TextSchema),
110
+ role: Schema.optionalKey(rich),
111
+ temperature: TextSchema,
112
+ view: TextSchema,
113
+ }),
114
+ temperature: GradientSliderSchema,
115
+ }).check(Schema.makeFilter(({ components, labels }) => namesEach(components, labels.components), {
116
+ message: "Expected a name and role note for every membrane component shown, and no other.",
117
+ })), answerAt(["labels", "fluidity"], ["labels", "role"]));
118
+ }
119
+ /**
120
+ * Membrane transport labs covering fluid-mosaic structure, ATP-driven carrier
121
+ * pumps, and osmotic plasmolysis across plant and animal cells.
81
122
  */
82
123
  export function membraneVisuals(rich) {
83
124
  return {
84
125
  ActiveTransportPumpLab: activeTransportPumpLab(rich),
126
+ FluidMosaicMembraneLab: fluidMosaicMembraneLab(rich),
85
127
  PlasmolysisCellLab: plasmolysisCellLab(rich),
86
128
  };
87
129
  }