@nakafa/aksara-contracts 8.13.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.
Files changed (37) hide show
  1. package/dist/assessment/document.d.ts +15 -2
  2. package/dist/assessment/document.js +12 -3
  3. package/dist/visual/biology/flower.d.ts +276 -0
  4. package/dist/visual/biology/flower.js +76 -0
  5. package/dist/visual/biology/homeostasis.d.ts +284 -0
  6. package/dist/visual/biology/homeostasis.js +101 -0
  7. package/dist/visual/biology/membrane.d.ts +421 -0
  8. package/dist/visual/biology/membrane.js +129 -0
  9. package/dist/visual/biology/mendelian.d.ts +410 -0
  10. package/dist/visual/biology/mendelian.js +107 -0
  11. package/dist/visual/biology/neuron.d.ts +136 -1
  12. package/dist/visual/biology/neuron.js +41 -2
  13. package/dist/visual/biology/nutrition.d.ts +410 -0
  14. package/dist/visual/biology/nutrition.js +112 -0
  15. package/dist/visual/biology/phytohormone.d.ts +275 -0
  16. package/dist/visual/biology/phytohormone.js +75 -0
  17. package/dist/visual/biology/variation.d.ts +421 -0
  18. package/dist/visual/biology/variation.js +123 -0
  19. package/dist/visual/biology/vascular.d.ts +425 -0
  20. package/dist/visual/biology/vascular.js +107 -0
  21. package/dist/visual/biology.d.ts +2169 -0
  22. package/dist/visual/biology.js +12 -0
  23. package/dist/visual/catalog.d.ts +7460 -3208
  24. package/dist/visual/catalog.js +6 -0
  25. package/dist/visual/chemistry/rate.d.ts +280 -1
  26. package/dist/visual/chemistry/rate.js +81 -3
  27. package/dist/visual/physics/electronics.d.ts +163 -24
  28. package/dist/visual/physics/electronics.js +50 -5
  29. package/dist/visual/physics/gravity.d.ts +139 -4
  30. package/dist/visual/physics/gravity.js +46 -4
  31. package/dist/visual/physics/heat.d.ts +307 -12
  32. package/dist/visual/physics/heat.js +84 -5
  33. package/dist/visual/physics/nuclear.d.ts +150 -13
  34. package/dist/visual/physics/nuclear.js +44 -5
  35. package/dist/visual/physics/quantum.d.ts +282 -0
  36. package/dist/visual/physics/quantum.js +87 -0
  37. package/package.json +1 -1
@@ -124,6 +124,19 @@ declare const MathBlockSchema: Schema.Struct<{
124
124
  }>;
125
125
  readonly type: Schema.Literal<"mathBlock">;
126
126
  }>;
127
+ /**
128
+ * A vertical stack of consecutive block formulas from one derivation or
129
+ * comparison, matching `<MathContainer>` in lessons and articles.
130
+ */
131
+ declare const MathContainerSchema: Schema.Struct<{
132
+ readonly content: Schema.NonEmptyArray<Schema.Struct<{
133
+ readonly attrs: Schema.Struct<{
134
+ readonly latex: Schema.Trimmed;
135
+ }>;
136
+ readonly type: Schema.Literal<"mathBlock">;
137
+ }>>;
138
+ readonly type: Schema.Literal<"mathContainer">;
139
+ }>;
127
140
  declare const ImageNodeSchema: Schema.Struct<{
128
141
  readonly attrs: Schema.Struct<{
129
142
  readonly alt: Schema.Trimmed;
@@ -149,7 +162,7 @@ export type InteractionNode = typeof InteractionNodeSchema.Type;
149
162
  * out here, because a recursive schema needs its type named in its own
150
163
  * definition; every other node type is derived from its schema.
151
164
  */
152
- export type BlockNode = ParagraphNode | typeof HeadingSchema.Type | typeof CodeBlockSchema.Type | typeof MathBlockSchema.Type | typeof FigureNodeSchema.Type | typeof ImageNodeSchema.Type | InteractionNode | {
165
+ export type BlockNode = ParagraphNode | typeof HeadingSchema.Type | typeof CodeBlockSchema.Type | typeof MathBlockSchema.Type | typeof MathContainerSchema.Type | typeof FigureNodeSchema.Type | typeof ImageNodeSchema.Type | InteractionNode | {
153
166
  readonly content: readonly [ListItemNode, ...ListItemNode[]];
154
167
  readonly type: "bulletList";
155
168
  } | {
@@ -166,7 +179,7 @@ export type BlockNode = ParagraphNode | typeof HeadingSchema.Type | typeof CodeB
166
179
  readonly type: "table";
167
180
  } | {
168
181
  readonly content: readonly [BlockNode, ...BlockNode[]];
169
- readonly type: "contentBlock" | "contentStack";
182
+ readonly type: "contentBlock" | "contentGrid" | "contentStack";
170
183
  };
171
184
  export type ListItemNode = typeof ListItemSchema.Type;
172
185
  export type TableRowNode = typeof TableRowSchema.Type;
@@ -37,6 +37,14 @@ const MathBlockSchema = Schema.Struct({
37
37
  attrs: Schema.Struct({ latex: LatexSchema }),
38
38
  type: Schema.Literal("mathBlock"),
39
39
  });
40
+ /**
41
+ * A vertical stack of consecutive block formulas from one derivation or
42
+ * comparison, matching `<MathContainer>` in lessons and articles.
43
+ */
44
+ const MathContainerSchema = Schema.Struct({
45
+ content: Schema.NonEmptyArray(MathBlockSchema),
46
+ type: Schema.Literal("mathContainer"),
47
+ });
40
48
  const ImageNodeSchema = Schema.Struct({
41
49
  attrs: ImageSchema,
42
50
  type: Schema.Literal("image"),
@@ -79,12 +87,12 @@ const TableCellSchema = Schema.Struct({
79
87
  });
80
88
  /**
81
89
  * A group of blocks, as a lesson groups them: `contentStack` stacks related
82
- * blocks, such as a formula and the graph it draws, and `contentBlock` sets one
83
- * block apart with space around it.
90
+ * blocks, `contentGrid` arranges related visuals or blocks in a responsive grid,
91
+ * and `contentBlock` sets one block apart with space around it.
84
92
  */
85
93
  const ContentGroupSchema = Schema.Struct({
86
94
  content: Schema.NonEmptyArray(BlockRef),
87
- type: Schema.Literals(["contentBlock", "contentStack"]),
95
+ type: Schema.Literals(["contentBlock", "contentGrid", "contentStack"]),
88
96
  });
89
97
  const TableRowSchema = Schema.Struct({
90
98
  content: Schema.NonEmptyArray(TableCellSchema),
@@ -100,6 +108,7 @@ export const BlockSchema = Schema.Union([
100
108
  HeadingSchema,
101
109
  CodeBlockSchema,
102
110
  MathBlockSchema,
111
+ MathContainerSchema,
103
112
  FigureNodeSchema,
104
113
  ImageNodeSchema,
105
114
  InteractionNodeSchema,
@@ -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
+ }