@nakafa/aksara-contracts 8.15.0 → 8.17.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/ecosystem.d.ts +425 -0
  4. package/dist/visual/biology/ecosystem.js +140 -0
  5. package/dist/visual/biology/respiration.d.ts +286 -0
  6. package/dist/visual/biology/respiration.js +97 -0
  7. package/dist/visual/biology.d.ts +11158 -205
  8. package/dist/visual/biology.js +104 -0
  9. package/dist/visual/catalog.d.ts +16 -41206
  10. package/dist/visual/catalog.js +8 -216
  11. package/dist/visual/chemistry/green.d.ts +282 -0
  12. package/dist/visual/chemistry/green.js +98 -0
  13. package/dist/visual/chemistry/groups.d.ts +276 -0
  14. package/dist/visual/chemistry/groups.js +85 -0
  15. package/dist/visual/chemistry/industry.d.ts +420 -0
  16. package/dist/visual/chemistry/industry.js +126 -0
  17. package/dist/visual/chemistry/materials.d.ts +416 -0
  18. package/dist/visual/chemistry/materials.js +116 -0
  19. package/dist/visual/chemistry/organic.d.ts +416 -0
  20. package/dist/visual/chemistry/organic.js +128 -0
  21. package/dist/visual/chemistry/polymer.d.ts +422 -0
  22. package/dist/visual/chemistry/polymer.js +126 -0
  23. package/dist/visual/chemistry/solution.d.ts +278 -0
  24. package/dist/visual/chemistry/solution.js +89 -0
  25. package/dist/visual/chemistry/stoichiometry.d.ts +287 -0
  26. package/dist/visual/chemistry/stoichiometry.js +83 -0
  27. package/dist/visual/chemistry.d.ts +8827 -0
  28. package/dist/visual/chemistry.js +50 -0
  29. package/dist/visual/mathematics/derivative.d.ts +425 -0
  30. package/dist/visual/mathematics/derivative.js +132 -0
  31. package/dist/visual/mathematics/integral.d.ts +428 -0
  32. package/dist/visual/mathematics/integral.js +146 -0
  33. package/dist/visual/mathematics/limit.d.ts +425 -0
  34. package/dist/visual/mathematics/limit.js +139 -0
  35. package/dist/visual/mathematics/linear.d.ts +425 -0
  36. package/dist/visual/mathematics/linear.js +140 -0
  37. package/dist/visual/mathematics/vector.d.ts +419 -0
  38. package/dist/visual/mathematics/vector.js +129 -0
  39. package/dist/visual/mathematics.d.ts +5148 -0
  40. package/dist/visual/mathematics.js +41 -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,428 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * Integral calculus 3D labs covering Riemann sum convergence, solids of
5
+ * revolution, and enclosed areas between curves.
6
+ */
7
+ export declare function integralVisuals<E>(rich: RichSlot<E>): {
8
+ AreaBetweenCurvesLab: 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 enclosedArea: Schema.optionalKey<RichSlot<E>>;
130
+ readonly heightGap: Schema.optionalKey<RichSlot<E>>;
131
+ readonly pair: Schema.Trimmed;
132
+ readonly pairs: Schema.$Record<Schema.Literals<readonly ["lineAndParabola", "twoParabolas", "sineAndCosine"]>, Schema.optionalKey<Schema.Struct<{
133
+ readonly formula: RichSlot<E>;
134
+ readonly name: Schema.Trimmed;
135
+ }>>>;
136
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["upperCurve", "lowerCurve", "shadedRibbon", "verticalStrip", "intersectionPins"]>, Schema.Trimmed>;
137
+ readonly upperBound: Schema.Trimmed;
138
+ readonly view: Schema.Trimmed;
139
+ }>;
140
+ readonly pairs: Schema.NonEmptyArray<Schema.Literals<readonly ["lineAndParabola", "twoParabolas", "sineAndCosine"]>>;
141
+ readonly upperBound: Schema.Struct<{
142
+ readonly max: Schema.Finite;
143
+ readonly min: Schema.Finite;
144
+ readonly value: Schema.Finite;
145
+ }>;
146
+ }>, "figure">;
147
+ RiemannSumConvergenceLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
148
+ readonly description: RichSlot<E>;
149
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
150
+ readonly marks?: readonly [{
151
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
152
+ } | {
153
+ readonly attrs: {
154
+ readonly href: string;
155
+ };
156
+ readonly type: "link";
157
+ } | {
158
+ readonly attrs: {
159
+ readonly variant: "success" | "warning" | null;
160
+ };
161
+ readonly type: "highlight";
162
+ }, ...({
163
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
164
+ } | {
165
+ readonly attrs: {
166
+ readonly href: string;
167
+ };
168
+ readonly type: "link";
169
+ } | {
170
+ readonly attrs: {
171
+ readonly variant: "success" | "warning" | null;
172
+ };
173
+ readonly type: "highlight";
174
+ })[]];
175
+ readonly text: string;
176
+ readonly type: "text";
177
+ } | {
178
+ readonly attrs: {
179
+ readonly latex: string;
180
+ };
181
+ readonly marks?: readonly [{
182
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
183
+ } | {
184
+ readonly attrs: {
185
+ readonly href: string;
186
+ };
187
+ readonly type: "link";
188
+ } | {
189
+ readonly attrs: {
190
+ readonly variant: "success" | "warning" | null;
191
+ };
192
+ readonly type: "highlight";
193
+ }, ...({
194
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
195
+ } | {
196
+ readonly attrs: {
197
+ readonly href: string;
198
+ };
199
+ readonly type: "link";
200
+ } | {
201
+ readonly attrs: {
202
+ readonly variant: "success" | "warning" | null;
203
+ };
204
+ readonly type: "highlight";
205
+ })[]];
206
+ readonly type: "mathInline";
207
+ }, ...({
208
+ readonly marks?: readonly [{
209
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
210
+ } | {
211
+ readonly attrs: {
212
+ readonly href: string;
213
+ };
214
+ readonly type: "link";
215
+ } | {
216
+ readonly attrs: {
217
+ readonly variant: "success" | "warning" | null;
218
+ };
219
+ readonly type: "highlight";
220
+ }, ...({
221
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
222
+ } | {
223
+ readonly attrs: {
224
+ readonly href: string;
225
+ };
226
+ readonly type: "link";
227
+ } | {
228
+ readonly attrs: {
229
+ readonly variant: "success" | "warning" | null;
230
+ };
231
+ readonly type: "highlight";
232
+ })[]];
233
+ readonly text: string;
234
+ readonly type: "text";
235
+ } | {
236
+ readonly attrs: {
237
+ readonly latex: string;
238
+ };
239
+ readonly marks?: readonly [{
240
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
241
+ } | {
242
+ readonly attrs: {
243
+ readonly href: string;
244
+ };
245
+ readonly type: "link";
246
+ } | {
247
+ readonly attrs: {
248
+ readonly variant: "success" | "warning" | null;
249
+ };
250
+ readonly type: "highlight";
251
+ }, ...({
252
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
253
+ } | {
254
+ readonly attrs: {
255
+ readonly href: string;
256
+ };
257
+ readonly type: "link";
258
+ } | {
259
+ readonly attrs: {
260
+ readonly variant: "success" | "warning" | null;
261
+ };
262
+ readonly type: "highlight";
263
+ })[]];
264
+ readonly type: "mathInline";
265
+ })[]], E, never, never>>;
266
+ readonly title: RichSlot<E>;
267
+ readonly curves: Schema.NonEmptyArray<Schema.Literals<readonly ["parabola", "sineArch", "exponential"]>>;
268
+ readonly labels: Schema.Struct<{
269
+ readonly approxArea: Schema.optionalKey<RichSlot<E>>;
270
+ readonly curve: Schema.Trimmed;
271
+ readonly curves: Schema.$Record<Schema.Literals<readonly ["parabola", "sineArch", "exponential"]>, Schema.optionalKey<Schema.Struct<{
272
+ readonly formula: RichSlot<E>;
273
+ readonly name: Schema.Trimmed;
274
+ }>>>;
275
+ readonly exactIntegral: Schema.optionalKey<RichSlot<E>>;
276
+ readonly method: Schema.Trimmed;
277
+ readonly methods: Schema.$Record<Schema.Literals<readonly ["left", "right", "midpoint", "trapezoid"]>, Schema.optionalKey<Schema.Trimmed>>;
278
+ readonly partitions: Schema.Trimmed;
279
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["curveSurface", "riemannPrisms", "samplePoints", "exactArea", "baseAxis"]>, Schema.Trimmed>;
280
+ readonly view: Schema.Trimmed;
281
+ }>;
282
+ readonly methods: Schema.NonEmptyArray<Schema.Literals<readonly ["left", "right", "midpoint", "trapezoid"]>>;
283
+ readonly partitions: Schema.Struct<{
284
+ readonly max: Schema.Int;
285
+ readonly min: Schema.Int;
286
+ readonly value: Schema.Int;
287
+ }>;
288
+ }>, "figure">;
289
+ SolidOfRevolutionLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
290
+ readonly description: RichSlot<E>;
291
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
292
+ readonly marks?: readonly [{
293
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
294
+ } | {
295
+ readonly attrs: {
296
+ readonly href: string;
297
+ };
298
+ readonly type: "link";
299
+ } | {
300
+ readonly attrs: {
301
+ readonly variant: "success" | "warning" | null;
302
+ };
303
+ readonly type: "highlight";
304
+ }, ...({
305
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
306
+ } | {
307
+ readonly attrs: {
308
+ readonly href: string;
309
+ };
310
+ readonly type: "link";
311
+ } | {
312
+ readonly attrs: {
313
+ readonly variant: "success" | "warning" | null;
314
+ };
315
+ readonly type: "highlight";
316
+ })[]];
317
+ readonly text: string;
318
+ readonly type: "text";
319
+ } | {
320
+ readonly attrs: {
321
+ readonly latex: string;
322
+ };
323
+ readonly marks?: readonly [{
324
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
325
+ } | {
326
+ readonly attrs: {
327
+ readonly href: string;
328
+ };
329
+ readonly type: "link";
330
+ } | {
331
+ readonly attrs: {
332
+ readonly variant: "success" | "warning" | null;
333
+ };
334
+ readonly type: "highlight";
335
+ }, ...({
336
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
337
+ } | {
338
+ readonly attrs: {
339
+ readonly href: string;
340
+ };
341
+ readonly type: "link";
342
+ } | {
343
+ readonly attrs: {
344
+ readonly variant: "success" | "warning" | null;
345
+ };
346
+ readonly type: "highlight";
347
+ })[]];
348
+ readonly type: "mathInline";
349
+ }, ...({
350
+ readonly marks?: readonly [{
351
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
352
+ } | {
353
+ readonly attrs: {
354
+ readonly href: string;
355
+ };
356
+ readonly type: "link";
357
+ } | {
358
+ readonly attrs: {
359
+ readonly variant: "success" | "warning" | null;
360
+ };
361
+ readonly type: "highlight";
362
+ }, ...({
363
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
364
+ } | {
365
+ readonly attrs: {
366
+ readonly href: string;
367
+ };
368
+ readonly type: "link";
369
+ } | {
370
+ readonly attrs: {
371
+ readonly variant: "success" | "warning" | null;
372
+ };
373
+ readonly type: "highlight";
374
+ })[]];
375
+ readonly text: string;
376
+ readonly type: "text";
377
+ } | {
378
+ readonly attrs: {
379
+ readonly latex: string;
380
+ };
381
+ readonly marks?: readonly [{
382
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
383
+ } | {
384
+ readonly attrs: {
385
+ readonly href: string;
386
+ };
387
+ readonly type: "link";
388
+ } | {
389
+ readonly attrs: {
390
+ readonly variant: "success" | "warning" | null;
391
+ };
392
+ readonly type: "highlight";
393
+ }, ...({
394
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
395
+ } | {
396
+ readonly attrs: {
397
+ readonly href: string;
398
+ };
399
+ readonly type: "link";
400
+ } | {
401
+ readonly attrs: {
402
+ readonly variant: "success" | "warning" | null;
403
+ };
404
+ readonly type: "highlight";
405
+ })[]];
406
+ readonly type: "mathInline";
407
+ })[]], E, never, never>>;
408
+ readonly title: RichSlot<E>;
409
+ readonly labels: Schema.Struct<{
410
+ readonly parts: Schema.$Record<Schema.Literals<readonly ["profileCurve", "revolvedShell", "crossSectionDisk", "rotationAxis", "radiusArrow"]>, Schema.Trimmed>;
411
+ readonly profile: Schema.Trimmed;
412
+ readonly profiles: Schema.$Record<Schema.Literals<readonly ["paraboloid", "trumpetHorn", "washerBowl", "frustumCone"]>, Schema.optionalKey<Schema.Struct<{
413
+ readonly formula: RichSlot<E>;
414
+ readonly name: Schema.Trimmed;
415
+ }>>>;
416
+ readonly sliceArea: Schema.optionalKey<RichSlot<E>>;
417
+ readonly sweepAngle: Schema.Trimmed;
418
+ readonly totalVolume: Schema.optionalKey<RichSlot<E>>;
419
+ readonly view: Schema.Trimmed;
420
+ }>;
421
+ readonly profiles: Schema.NonEmptyArray<Schema.Literals<readonly ["paraboloid", "trumpetHorn", "washerBowl", "frustumCone"]>>;
422
+ readonly sweepAngle: Schema.Struct<{
423
+ readonly max: Schema.Finite;
424
+ readonly min: Schema.Finite;
425
+ readonly value: Schema.Finite;
426
+ }>;
427
+ }>, "figure">;
428
+ };
@@ -0,0 +1,146 @@
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
+ /** A strictly positive finite bound for integral sliders. */
5
+ const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
6
+ /** A positive slider whose minimum sits below its maximum. */
7
+ const PositiveSliderSchema = 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 positive slider range whose minimum is below its maximum, with the starting value between them.",
13
+ }));
14
+ /** An integer partition slider for Riemann sums. */
15
+ const PartitionSliderSchema = Schema.Struct({
16
+ max: Schema.Int.check(Schema.isGreaterThan(1)),
17
+ min: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
18
+ value: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
19
+ }).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
20
+ message: "Expected a partition range whose minimum is below its maximum, with the starting value between them.",
21
+ }));
22
+ const RIEMANN_METHODS = ["left", "right", "midpoint", "trapezoid"];
23
+ const RIEMANN_CURVES = ["parabola", "sineArch", "exponential"];
24
+ const REVOLUTION_PROFILES = [
25
+ "paraboloid",
26
+ "trumpetHorn",
27
+ "washerBowl",
28
+ "frustumCone",
29
+ ];
30
+ const CURVE_PAIRS = [
31
+ "lineAndParabola",
32
+ "twoParabolas",
33
+ "sineAndCosine",
34
+ ];
35
+ /**
36
+ * Props of `RiemannSumConvergenceLab`: a 3D prism stage comparing left, right,
37
+ * midpoint, and trapezoid Riemann sums converging toward the exact definite
38
+ * integral as partition count grows. Approximate area and exact integral
39
+ * readouts are optional answer state.
40
+ */
41
+ function riemannSumConvergenceLab(rich) {
42
+ return figure(Schema.Struct({
43
+ ...cardFields(rich),
44
+ curves: Schema.NonEmptyArray(Schema.Literals(RIEMANN_CURVES)).check(Schema.isUnique()),
45
+ labels: Schema.Struct({
46
+ approxArea: Schema.optionalKey(rich),
47
+ curve: TextSchema,
48
+ curves: byPickedIds(RIEMANN_CURVES, Schema.Struct({
49
+ formula: rich,
50
+ name: TextSchema,
51
+ })),
52
+ exactIntegral: Schema.optionalKey(rich),
53
+ method: TextSchema,
54
+ methods: byPickedIds(RIEMANN_METHODS, TextSchema),
55
+ partitions: TextSchema,
56
+ parts: byIds([
57
+ "curveSurface",
58
+ "riemannPrisms",
59
+ "samplePoints",
60
+ "exactArea",
61
+ "baseAxis",
62
+ ], TextSchema),
63
+ view: TextSchema,
64
+ }),
65
+ methods: Schema.NonEmptyArray(Schema.Literals(RIEMANN_METHODS)).check(Schema.isUnique()),
66
+ partitions: PartitionSliderSchema,
67
+ }).check(Schema.makeFilter(({ curves, labels, methods }) => namesEach(curves, labels.curves) &&
68
+ namesEach(methods, labels.methods), {
69
+ message: "Expected a name for every Riemann method and curve shown, and no other.",
70
+ })), answerAt(["labels", "approxArea"], ["labels", "exactIntegral"]));
71
+ }
72
+ /**
73
+ * Props of `SolidOfRevolutionLab`: a 3D lathe solid swept around the x-axis
74
+ * from 0 to 360 degrees with a highlighted disk or washer cross-section. Slice
75
+ * area and total volume readouts are optional answer state.
76
+ */
77
+ function solidOfRevolutionLab(rich) {
78
+ return figure(Schema.Struct({
79
+ ...cardFields(rich),
80
+ labels: Schema.Struct({
81
+ parts: byIds([
82
+ "profileCurve",
83
+ "revolvedShell",
84
+ "crossSectionDisk",
85
+ "rotationAxis",
86
+ "radiusArrow",
87
+ ], TextSchema),
88
+ profile: TextSchema,
89
+ profiles: byPickedIds(REVOLUTION_PROFILES, Schema.Struct({
90
+ formula: rich,
91
+ name: TextSchema,
92
+ })),
93
+ sliceArea: Schema.optionalKey(rich),
94
+ sweepAngle: TextSchema,
95
+ totalVolume: Schema.optionalKey(rich),
96
+ view: TextSchema,
97
+ }),
98
+ profiles: Schema.NonEmptyArray(Schema.Literals(REVOLUTION_PROFILES)).check(Schema.isUnique()),
99
+ sweepAngle: PositiveSliderSchema,
100
+ }).check(Schema.makeFilter(({ labels, profiles }) => namesEach(profiles, labels.profiles), {
101
+ message: "Expected a name and formula for every solid-of-revolution profile shown, and no other.",
102
+ })), answerAt(["labels", "sliceArea"], ["labels", "totalVolume"]));
103
+ }
104
+ /**
105
+ * Props of `AreaBetweenCurvesLab`: a 3D ribbon bounded between an upper curve
106
+ * f(x) and lower curve g(x) with intersection pins and a sliding vertical
107
+ * strip. Enclosed area and height gap readouts are optional answer state.
108
+ */
109
+ function areaBetweenCurvesLab(rich) {
110
+ return figure(Schema.Struct({
111
+ ...cardFields(rich),
112
+ labels: Schema.Struct({
113
+ enclosedArea: Schema.optionalKey(rich),
114
+ heightGap: Schema.optionalKey(rich),
115
+ pair: TextSchema,
116
+ pairs: byPickedIds(CURVE_PAIRS, Schema.Struct({
117
+ formula: rich,
118
+ name: TextSchema,
119
+ })),
120
+ parts: byIds([
121
+ "upperCurve",
122
+ "lowerCurve",
123
+ "shadedRibbon",
124
+ "verticalStrip",
125
+ "intersectionPins",
126
+ ], TextSchema),
127
+ upperBound: TextSchema,
128
+ view: TextSchema,
129
+ }),
130
+ pairs: Schema.NonEmptyArray(Schema.Literals(CURVE_PAIRS)).check(Schema.isUnique()),
131
+ upperBound: PositiveSliderSchema,
132
+ }).check(Schema.makeFilter(({ labels, pairs }) => namesEach(pairs, labels.pairs), {
133
+ message: "Expected a name and formula for every curve pair shown, and no other.",
134
+ })), answerAt(["labels", "enclosedArea"], ["labels", "heightGap"]));
135
+ }
136
+ /**
137
+ * Integral calculus 3D labs covering Riemann sum convergence, solids of
138
+ * revolution, and enclosed areas between curves.
139
+ */
140
+ export function integralVisuals(rich) {
141
+ return {
142
+ AreaBetweenCurvesLab: areaBetweenCurvesLab(rich),
143
+ RiemannSumConvergenceLab: riemannSumConvergenceLab(rich),
144
+ SolidOfRevolutionLab: solidOfRevolutionLab(rich),
145
+ };
146
+ }