@nakafa/aksara-contracts 8.14.0 → 8.16.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 (43) hide show
  1. package/dist/visual/base.d.ts +785 -0
  2. package/dist/visual/base.js +13 -0
  3. package/dist/visual/biology/flower.d.ts +276 -0
  4. package/dist/visual/biology/flower.js +76 -0
  5. package/dist/visual/biology/membrane.d.ts +141 -2
  6. package/dist/visual/biology/membrane.js +44 -2
  7. package/dist/visual/biology/mendelian.d.ts +410 -0
  8. package/dist/visual/biology/mendelian.js +107 -0
  9. package/dist/visual/biology/nutrition.d.ts +410 -0
  10. package/dist/visual/biology/nutrition.js +112 -0
  11. package/dist/visual/biology/phytohormone.d.ts +275 -0
  12. package/dist/visual/biology/phytohormone.js +75 -0
  13. package/dist/visual/biology/variation.d.ts +421 -0
  14. package/dist/visual/biology/variation.js +123 -0
  15. package/dist/visual/biology/vascular.d.ts +425 -0
  16. package/dist/visual/biology/vascular.js +107 -0
  17. package/dist/visual/biology.d.ts +12427 -0
  18. package/dist/visual/biology.js +112 -0
  19. package/dist/visual/catalog.d.ts +16 -38898
  20. package/dist/visual/catalog.js +8 -216
  21. package/dist/visual/chemistry/green.d.ts +282 -0
  22. package/dist/visual/chemistry/green.js +98 -0
  23. package/dist/visual/chemistry/groups.d.ts +276 -0
  24. package/dist/visual/chemistry/groups.js +85 -0
  25. package/dist/visual/chemistry/industry.d.ts +420 -0
  26. package/dist/visual/chemistry/industry.js +126 -0
  27. package/dist/visual/chemistry/materials.d.ts +416 -0
  28. package/dist/visual/chemistry/materials.js +116 -0
  29. package/dist/visual/chemistry/organic.d.ts +416 -0
  30. package/dist/visual/chemistry/organic.js +128 -0
  31. package/dist/visual/chemistry/polymer.d.ts +422 -0
  32. package/dist/visual/chemistry/polymer.js +126 -0
  33. package/dist/visual/chemistry/solution.d.ts +278 -0
  34. package/dist/visual/chemistry/solution.js +89 -0
  35. package/dist/visual/chemistry/stoichiometry.d.ts +287 -0
  36. package/dist/visual/chemistry/stoichiometry.js +83 -0
  37. package/dist/visual/chemistry.d.ts +8827 -0
  38. package/dist/visual/chemistry.js +50 -0
  39. package/dist/visual/mathematics.d.ts +3065 -0
  40. package/dist/visual/mathematics.js +30 -0
  41. package/dist/visual/physics.d.ts +17875 -0
  42. package/dist/visual/physics.js +70 -0
  43. package/package.json +1 -1
@@ -0,0 +1,410 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * Plant nutrition labs covering mineral deficiency culture trials, root-hair
5
+ * water and ion uptake, and carnivorous, parasitic, and epiphytic nutrition.
6
+ */
7
+ export declare function nutritionVisuals<E>(rich: RichSlot<E>): {
8
+ CarnivorousPlantLab: 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 ["carnivorous", "parasitic", "epiphytic"]>, Schema.optionalKey<Schema.Struct<{
132
+ readonly adaptation: RichSlot<E>;
133
+ readonly name: Schema.Trimmed;
134
+ readonly source: RichSlot<E>;
135
+ }>>>;
136
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["trapLeaf", "haustorium", "aerialRoot", "hostStem", "insect"]>, Schema.Trimmed>;
137
+ readonly source: Schema.optionalKey<RichSlot<E>>;
138
+ readonly view: Schema.Trimmed;
139
+ }>;
140
+ readonly modes: Schema.NonEmptyArray<Schema.Literals<readonly ["carnivorous", "parasitic", "epiphytic"]>>;
141
+ }>, "figure">;
142
+ MineralDeficiencyLab: 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 labels: Schema.Struct<{
263
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["leaf", "stem", "root", "solution", "airTube"]>, Schema.Trimmed>;
264
+ readonly role: Schema.optionalKey<RichSlot<E>>;
265
+ readonly solution: Schema.Trimmed;
266
+ readonly solutions: Schema.$Record<Schema.Literals<readonly ["complete", "noNitrogen", "noPhosphorus", "noPotassium", "noMagnesium"]>, Schema.optionalKey<Schema.Struct<{
267
+ readonly name: Schema.Trimmed;
268
+ readonly role: RichSlot<E>;
269
+ readonly symptom: RichSlot<E>;
270
+ }>>>;
271
+ readonly symptom: Schema.optionalKey<RichSlot<E>>;
272
+ readonly view: Schema.Trimmed;
273
+ }>;
274
+ readonly solutions: Schema.NonEmptyArray<Schema.Literals<readonly ["complete", "noNitrogen", "noPhosphorus", "noPotassium", "noMagnesium"]>>;
275
+ }>, "figure">;
276
+ RootHairUptakeLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
277
+ readonly description: RichSlot<E>;
278
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
279
+ readonly marks?: readonly [{
280
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
281
+ } | {
282
+ readonly attrs: {
283
+ readonly href: string;
284
+ };
285
+ readonly type: "link";
286
+ } | {
287
+ readonly attrs: {
288
+ readonly variant: "success" | "warning" | null;
289
+ };
290
+ readonly type: "highlight";
291
+ }, ...({
292
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
293
+ } | {
294
+ readonly attrs: {
295
+ readonly href: string;
296
+ };
297
+ readonly type: "link";
298
+ } | {
299
+ readonly attrs: {
300
+ readonly variant: "success" | "warning" | null;
301
+ };
302
+ readonly type: "highlight";
303
+ })[]];
304
+ readonly text: string;
305
+ readonly type: "text";
306
+ } | {
307
+ readonly attrs: {
308
+ readonly latex: string;
309
+ };
310
+ readonly marks?: readonly [{
311
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
312
+ } | {
313
+ readonly attrs: {
314
+ readonly href: string;
315
+ };
316
+ readonly type: "link";
317
+ } | {
318
+ readonly attrs: {
319
+ readonly variant: "success" | "warning" | null;
320
+ };
321
+ readonly type: "highlight";
322
+ }, ...({
323
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
324
+ } | {
325
+ readonly attrs: {
326
+ readonly href: string;
327
+ };
328
+ readonly type: "link";
329
+ } | {
330
+ readonly attrs: {
331
+ readonly variant: "success" | "warning" | null;
332
+ };
333
+ readonly type: "highlight";
334
+ })[]];
335
+ readonly type: "mathInline";
336
+ }, ...({
337
+ readonly marks?: readonly [{
338
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
339
+ } | {
340
+ readonly attrs: {
341
+ readonly href: string;
342
+ };
343
+ readonly type: "link";
344
+ } | {
345
+ readonly attrs: {
346
+ readonly variant: "success" | "warning" | null;
347
+ };
348
+ readonly type: "highlight";
349
+ }, ...({
350
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
351
+ } | {
352
+ readonly attrs: {
353
+ readonly href: string;
354
+ };
355
+ readonly type: "link";
356
+ } | {
357
+ readonly attrs: {
358
+ readonly variant: "success" | "warning" | null;
359
+ };
360
+ readonly type: "highlight";
361
+ })[]];
362
+ readonly text: string;
363
+ readonly type: "text";
364
+ } | {
365
+ readonly attrs: {
366
+ readonly latex: string;
367
+ };
368
+ readonly marks?: readonly [{
369
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
370
+ } | {
371
+ readonly attrs: {
372
+ readonly href: string;
373
+ };
374
+ readonly type: "link";
375
+ } | {
376
+ readonly attrs: {
377
+ readonly variant: "success" | "warning" | null;
378
+ };
379
+ readonly type: "highlight";
380
+ }, ...({
381
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
382
+ } | {
383
+ readonly attrs: {
384
+ readonly href: string;
385
+ };
386
+ readonly type: "link";
387
+ } | {
388
+ readonly attrs: {
389
+ readonly variant: "success" | "warning" | null;
390
+ };
391
+ readonly type: "highlight";
392
+ })[]];
393
+ readonly type: "mathInline";
394
+ })[]], E, never, never>>;
395
+ readonly title: RichSlot<E>;
396
+ readonly labels: Schema.Struct<{
397
+ readonly directions: Schema.$Record<Schema.Literals<readonly ["intoRoot", "balanced", "outOfRoot"]>, Schema.Trimmed>;
398
+ readonly ionUptake: Schema.optionalKey<RichSlot<E>>;
399
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["rootHair", "epidermis", "cortex", "endodermis", "xylem", "soilWater"]>, Schema.Trimmed>;
400
+ readonly soilConcentration: Schema.Trimmed;
401
+ readonly view: Schema.Trimmed;
402
+ readonly waterDirection: Schema.optionalKey<RichSlot<E>>;
403
+ }>;
404
+ readonly soilConcentration: Schema.Struct<{
405
+ readonly max: Schema.Finite;
406
+ readonly min: Schema.Finite;
407
+ readonly value: Schema.Finite;
408
+ }>;
409
+ }>, "figure">;
410
+ };
@@ -0,0 +1,112 @@
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 PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
5
+ const NonNegativeSchema = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
6
+ const SliderSchema = Schema.Struct({
7
+ max: PositiveSchema,
8
+ min: NonNegativeSchema,
9
+ value: NonNegativeSchema,
10
+ }).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
11
+ message: "Expected a slider range whose minimum is below its maximum, with the starting value between them.",
12
+ }));
13
+ const SOLUTIONS = [
14
+ "complete",
15
+ "noNitrogen",
16
+ "noPhosphorus",
17
+ "noPotassium",
18
+ "noMagnesium",
19
+ ];
20
+ const SPECIAL_MODES = ["carnivorous", "parasitic", "epiphytic"];
21
+ /**
22
+ * Props of `MineralDeficiencyLab`: a 3D seedling grown in Knop's culture
23
+ * solution contrasting complete nutrients against single-element omissions
24
+ * (nitrogen, phosphorus, potassium, magnesium), showing leaf colour, root
25
+ * length, and stem vigour. Symptom and missing-role readouts are optional
26
+ * answer state.
27
+ */
28
+ function mineralDeficiencyLab(rich) {
29
+ return figure(Schema.Struct({
30
+ ...cardFields(rich),
31
+ labels: Schema.Struct({
32
+ parts: byIds(["leaf", "stem", "root", "solution", "airTube"], TextSchema),
33
+ role: Schema.optionalKey(rich),
34
+ solution: TextSchema,
35
+ solutions: byPickedIds(SOLUTIONS, Schema.Struct({
36
+ name: TextSchema,
37
+ role: rich,
38
+ symptom: rich,
39
+ })),
40
+ symptom: Schema.optionalKey(rich),
41
+ view: TextSchema,
42
+ }),
43
+ solutions: Schema.NonEmptyArray(Schema.Literals(SOLUTIONS)).check(Schema.isUnique()),
44
+ }).check(Schema.makeFilter(({ labels, solutions }) => namesEach(solutions, labels.solutions), {
45
+ message: "Expected a name, role, and symptom note for every culture solution shown, and no other.",
46
+ })), answerAt(["labels", "role"], ["labels", "symptom"]));
47
+ }
48
+ /**
49
+ * Props of `RootHairUptakeLab`: a 3D cross-section of a young dicot root
50
+ * showing epidermal root hair extensions, soil concentration slider, osmotic
51
+ * water entry across cortex and endodermis, and ATP-assisted mineral ion
52
+ * uptake into the xylem. Water direction and uptake mode readouts are
53
+ * optional answer state.
54
+ */
55
+ function rootHairUptakeLab(rich) {
56
+ return figure(Schema.Struct({
57
+ ...cardFields(rich),
58
+ labels: Schema.Struct({
59
+ directions: byIds(["intoRoot", "balanced", "outOfRoot"], TextSchema),
60
+ ionUptake: Schema.optionalKey(rich),
61
+ parts: byIds([
62
+ "rootHair",
63
+ "epidermis",
64
+ "cortex",
65
+ "endodermis",
66
+ "xylem",
67
+ "soilWater",
68
+ ], TextSchema),
69
+ soilConcentration: TextSchema,
70
+ view: TextSchema,
71
+ waterDirection: Schema.optionalKey(rich),
72
+ }),
73
+ soilConcentration: SliderSchema,
74
+ }), answerAt(["labels", "ionUptake"], ["labels", "waterDirection"]));
75
+ }
76
+ /**
77
+ * Props of `CarnivorousPlantLab`: a 3D gallery of special plant nutrition
78
+ * strategies (carnivorous pitcher or flytrap, parasitic dodder, epiphytic
79
+ * orchid) comparing how each obtains organic food, water, and mineral ions.
80
+ * Nutrient source and adaptation readouts are optional answer state.
81
+ */
82
+ function carnivorousPlantLab(rich) {
83
+ return figure(Schema.Struct({
84
+ ...cardFields(rich),
85
+ labels: Schema.Struct({
86
+ adaptation: Schema.optionalKey(rich),
87
+ mode: TextSchema,
88
+ modes: byPickedIds(SPECIAL_MODES, Schema.Struct({
89
+ adaptation: rich,
90
+ name: TextSchema,
91
+ source: rich,
92
+ })),
93
+ parts: byIds(["trapLeaf", "haustorium", "aerialRoot", "hostStem", "insect"], TextSchema),
94
+ source: Schema.optionalKey(rich),
95
+ view: TextSchema,
96
+ }),
97
+ modes: Schema.NonEmptyArray(Schema.Literals(SPECIAL_MODES)).check(Schema.isUnique()),
98
+ }).check(Schema.makeFilter(({ labels, modes }) => namesEach(modes, labels.modes), {
99
+ message: "Expected a name, source, and adaptation note for every special nutrition mode shown, and no other.",
100
+ })), answerAt(["labels", "adaptation"], ["labels", "source"]));
101
+ }
102
+ /**
103
+ * Plant nutrition labs covering mineral deficiency culture trials, root-hair
104
+ * water and ion uptake, and carnivorous, parasitic, and epiphytic nutrition.
105
+ */
106
+ export function nutritionVisuals(rich) {
107
+ return {
108
+ CarnivorousPlantLab: carnivorousPlantLab(rich),
109
+ MineralDeficiencyLab: mineralDeficiencyLab(rich),
110
+ RootHairUptakeLab: rootHairUptakeLab(rich),
111
+ };
112
+ }