@nakafa/aksara-contracts 8.12.0 → 8.14.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.
- package/dist/assessment/document.d.ts +15 -2
- package/dist/assessment/document.js +12 -3
- package/dist/visual/biology/homeostasis.d.ts +284 -0
- package/dist/visual/biology/homeostasis.js +101 -0
- package/dist/visual/biology/leaf.d.ts +436 -0
- package/dist/visual/biology/leaf.js +151 -0
- package/dist/visual/biology/membrane.d.ts +282 -0
- package/dist/visual/biology/membrane.js +87 -0
- package/dist/visual/biology/neuron.d.ts +136 -1
- package/dist/visual/biology/neuron.js +41 -2
- package/dist/visual/biology/tissue.d.ts +424 -0
- package/dist/visual/biology/tissue.js +140 -0
- package/dist/visual/catalog.d.ts +5419 -2190
- package/dist/visual/catalog.js +12 -0
- package/dist/visual/chemistry/equilibrium.d.ts +449 -0
- package/dist/visual/chemistry/equilibrium.js +135 -0
- package/dist/visual/chemistry/rate.d.ts +280 -1
- package/dist/visual/chemistry/rate.js +81 -3
- package/dist/visual/physics/electronics.d.ts +163 -24
- package/dist/visual/physics/electronics.js +50 -5
- package/dist/visual/physics/gravity.d.ts +139 -4
- package/dist/visual/physics/gravity.js +46 -4
- package/dist/visual/physics/heat.d.ts +307 -12
- package/dist/visual/physics/heat.js +84 -5
- package/dist/visual/physics/nuclear.d.ts +150 -13
- package/dist/visual/physics/nuclear.js +44 -5
- package/dist/visual/physics/quantum.d.ts +282 -0
- package/dist/visual/physics/quantum.js +87 -0
- package/package.json +1 -1
|
@@ -1,10 +1,145 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
-
/**
|
|
4
|
-
* The props of the gravitation labs. Each prop is a value from the item the lab
|
|
5
|
-
* draws, never the conclusion it leads to, so none holds answer state.
|
|
6
|
-
*/
|
|
3
|
+
/** The props of the gravitation and Kepler orbital labs. */
|
|
7
4
|
export declare function gravityVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
KeplerOrbitPeriodLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
8
|
+
readonly marks?: readonly [{
|
|
9
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
10
|
+
} | {
|
|
11
|
+
readonly attrs: {
|
|
12
|
+
readonly href: string;
|
|
13
|
+
};
|
|
14
|
+
readonly type: "link";
|
|
15
|
+
} | {
|
|
16
|
+
readonly attrs: {
|
|
17
|
+
readonly variant: "success" | "warning" | null;
|
|
18
|
+
};
|
|
19
|
+
readonly type: "highlight";
|
|
20
|
+
}, ...({
|
|
21
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
22
|
+
} | {
|
|
23
|
+
readonly attrs: {
|
|
24
|
+
readonly href: string;
|
|
25
|
+
};
|
|
26
|
+
readonly type: "link";
|
|
27
|
+
} | {
|
|
28
|
+
readonly attrs: {
|
|
29
|
+
readonly variant: "success" | "warning" | null;
|
|
30
|
+
};
|
|
31
|
+
readonly type: "highlight";
|
|
32
|
+
})[]];
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly type: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly attrs: {
|
|
37
|
+
readonly latex: string;
|
|
38
|
+
};
|
|
39
|
+
readonly marks?: readonly [{
|
|
40
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
41
|
+
} | {
|
|
42
|
+
readonly attrs: {
|
|
43
|
+
readonly href: string;
|
|
44
|
+
};
|
|
45
|
+
readonly type: "link";
|
|
46
|
+
} | {
|
|
47
|
+
readonly attrs: {
|
|
48
|
+
readonly variant: "success" | "warning" | null;
|
|
49
|
+
};
|
|
50
|
+
readonly type: "highlight";
|
|
51
|
+
}, ...({
|
|
52
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
53
|
+
} | {
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly href: string;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "link";
|
|
58
|
+
} | {
|
|
59
|
+
readonly attrs: {
|
|
60
|
+
readonly variant: "success" | "warning" | null;
|
|
61
|
+
};
|
|
62
|
+
readonly type: "highlight";
|
|
63
|
+
})[]];
|
|
64
|
+
readonly type: "mathInline";
|
|
65
|
+
}, ...({
|
|
66
|
+
readonly marks?: readonly [{
|
|
67
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
68
|
+
} | {
|
|
69
|
+
readonly attrs: {
|
|
70
|
+
readonly href: string;
|
|
71
|
+
};
|
|
72
|
+
readonly type: "link";
|
|
73
|
+
} | {
|
|
74
|
+
readonly attrs: {
|
|
75
|
+
readonly variant: "success" | "warning" | null;
|
|
76
|
+
};
|
|
77
|
+
readonly type: "highlight";
|
|
78
|
+
}, ...({
|
|
79
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
80
|
+
} | {
|
|
81
|
+
readonly attrs: {
|
|
82
|
+
readonly href: string;
|
|
83
|
+
};
|
|
84
|
+
readonly type: "link";
|
|
85
|
+
} | {
|
|
86
|
+
readonly attrs: {
|
|
87
|
+
readonly variant: "success" | "warning" | null;
|
|
88
|
+
};
|
|
89
|
+
readonly type: "highlight";
|
|
90
|
+
})[]];
|
|
91
|
+
readonly text: string;
|
|
92
|
+
readonly type: "text";
|
|
93
|
+
} | {
|
|
94
|
+
readonly attrs: {
|
|
95
|
+
readonly latex: string;
|
|
96
|
+
};
|
|
97
|
+
readonly marks?: readonly [{
|
|
98
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
99
|
+
} | {
|
|
100
|
+
readonly attrs: {
|
|
101
|
+
readonly href: string;
|
|
102
|
+
};
|
|
103
|
+
readonly type: "link";
|
|
104
|
+
} | {
|
|
105
|
+
readonly attrs: {
|
|
106
|
+
readonly variant: "success" | "warning" | null;
|
|
107
|
+
};
|
|
108
|
+
readonly type: "highlight";
|
|
109
|
+
}, ...({
|
|
110
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
111
|
+
} | {
|
|
112
|
+
readonly attrs: {
|
|
113
|
+
readonly href: string;
|
|
114
|
+
};
|
|
115
|
+
readonly type: "link";
|
|
116
|
+
} | {
|
|
117
|
+
readonly attrs: {
|
|
118
|
+
readonly variant: "success" | "warning" | null;
|
|
119
|
+
};
|
|
120
|
+
readonly type: "highlight";
|
|
121
|
+
})[]];
|
|
122
|
+
readonly type: "mathInline";
|
|
123
|
+
})[]], E, never, never>>;
|
|
124
|
+
readonly title: RichSlot<E>;
|
|
125
|
+
readonly bodies: Schema.NonEmptyArray<Schema.Literals<readonly ["mercury", "venus", "earth", "mars", "jupiter", "comet"]>>;
|
|
126
|
+
readonly eccentricity: Schema.Struct<{
|
|
127
|
+
readonly max: Schema.Finite;
|
|
128
|
+
readonly min: Schema.Finite;
|
|
129
|
+
readonly value: Schema.Finite;
|
|
130
|
+
}>;
|
|
131
|
+
readonly labels: Schema.Struct<{
|
|
132
|
+
readonly bodies: Schema.$Record<Schema.Literals<readonly ["mercury", "venus", "earth", "mars", "jupiter", "comet"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
133
|
+
readonly body: Schema.Trimmed;
|
|
134
|
+
readonly eccentricity: Schema.Trimmed;
|
|
135
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["sun", "planet", "perihelion", "aphelion", "focus", "areaSector"]>, Schema.Trimmed>;
|
|
136
|
+
readonly period: Schema.optionalKey<RichSlot<E>>;
|
|
137
|
+
readonly radius: RichSlot<E>;
|
|
138
|
+
readonly ratio: RichSlot<E>;
|
|
139
|
+
readonly speed: Schema.optionalKey<RichSlot<E>>;
|
|
140
|
+
readonly view: Schema.Trimmed;
|
|
141
|
+
}>;
|
|
142
|
+
}>, "figure">;
|
|
8
143
|
OrbitRadiusLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
144
|
readonly description: RichSlot<E>;
|
|
10
145
|
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { cardFields, TextSchema } from "#contracts/visual/card";
|
|
3
|
-
import { figure } from "#contracts/visual/entry";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** Orbital eccentricity bounded inside an elliptical orbit (0 <= e <= 0.85). */
|
|
5
|
+
const EccentricitySchema = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(0.85));
|
|
6
|
+
/** An eccentricity slider whose minimum sits below its maximum. */
|
|
7
|
+
const EccentricitySliderSchema = Schema.Struct({
|
|
8
|
+
max: EccentricitySchema,
|
|
9
|
+
min: EccentricitySchema,
|
|
10
|
+
value: EccentricitySchema,
|
|
11
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
12
|
+
message: "Expected an eccentricity range whose minimum is below its maximum, with the starting value between them.",
|
|
13
|
+
}));
|
|
14
|
+
const ORBITING_BODIES = [
|
|
15
|
+
"mercury",
|
|
16
|
+
"venus",
|
|
17
|
+
"earth",
|
|
18
|
+
"mars",
|
|
19
|
+
"jupiter",
|
|
20
|
+
"comet",
|
|
21
|
+
];
|
|
4
22
|
/** Props of `OrbitRadiusLab`: two satellites in circular orbits round the Earth, drawn to scale. */
|
|
5
23
|
function orbitRadiusLab(rich) {
|
|
6
24
|
return figure(Schema.Struct({
|
|
@@ -36,11 +54,35 @@ function planetCompareLab(rich) {
|
|
|
36
54
|
}));
|
|
37
55
|
}
|
|
38
56
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
57
|
+
* Props of `KeplerOrbitPeriodLab`: a 3D heliocentric elliptical orbit lab
|
|
58
|
+
* demonstrating Kepler's three laws, equal-area sweeps between perihelion and
|
|
59
|
+
* aphelion, and the constant T squared over r cubed ratio. Orbital period and
|
|
60
|
+
* speed readouts are optional answer state.
|
|
41
61
|
*/
|
|
62
|
+
function keplerOrbitPeriodLab(rich) {
|
|
63
|
+
return figure(Schema.Struct({
|
|
64
|
+
...cardFields(rich),
|
|
65
|
+
bodies: Schema.NonEmptyArray(Schema.Literals(ORBITING_BODIES)).check(Schema.isUnique()),
|
|
66
|
+
eccentricity: EccentricitySliderSchema,
|
|
67
|
+
labels: Schema.Struct({
|
|
68
|
+
bodies: byPickedIds(ORBITING_BODIES, TextSchema),
|
|
69
|
+
body: TextSchema,
|
|
70
|
+
eccentricity: TextSchema,
|
|
71
|
+
parts: byIds(["sun", "planet", "perihelion", "aphelion", "focus", "areaSector"], TextSchema),
|
|
72
|
+
period: Schema.optionalKey(rich),
|
|
73
|
+
radius: rich,
|
|
74
|
+
ratio: rich,
|
|
75
|
+
speed: Schema.optionalKey(rich),
|
|
76
|
+
view: TextSchema,
|
|
77
|
+
}),
|
|
78
|
+
}).check(Schema.makeFilter(({ bodies, labels }) => namesEach(bodies, labels.bodies), {
|
|
79
|
+
message: "Expected a name for every orbiting body shown in the Kepler lab, and no other.",
|
|
80
|
+
})), answerAt(["labels", "period"], ["labels", "speed"]));
|
|
81
|
+
}
|
|
82
|
+
/** The props of the gravitation and Kepler orbital labs. */
|
|
42
83
|
export function gravityVisuals(rich) {
|
|
43
84
|
return {
|
|
85
|
+
KeplerOrbitPeriodLab: keplerOrbitPeriodLab(rich),
|
|
44
86
|
OrbitRadiusLab: orbitRadiusLab(rich),
|
|
45
87
|
PlanetCompareLab: planetCompareLab(rich),
|
|
46
88
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import type { RichSlot } from "#contracts/visual/card";
|
|
3
3
|
/**
|
|
4
|
-
* The props of the heat labs
|
|
5
|
-
*
|
|
4
|
+
* The props of the heat labs covering heating curves, calorimetry, ice
|
|
5
|
+
* melting, and thermal gas laws.
|
|
6
6
|
*/
|
|
7
7
|
export declare function heatVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
-
|
|
8
|
+
GasLawThermalLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
9
|
readonly description: RichSlot<E>;
|
|
10
10
|
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
11
11
|
readonly marks?: readonly [{
|
|
@@ -125,17 +125,31 @@ export declare function heatVisuals<E>(rich: RichSlot<E>): {
|
|
|
125
125
|
readonly type: "mathInline";
|
|
126
126
|
})[]], E, never, never>>;
|
|
127
127
|
readonly title: RichSlot<E>;
|
|
128
|
-
readonly finalTemperature: Schema.Finite;
|
|
129
128
|
readonly labels: Schema.Struct<{
|
|
130
|
-
readonly
|
|
131
|
-
readonly
|
|
132
|
-
readonly
|
|
129
|
+
readonly collisions: Schema.optionalKey<RichSlot<E>>;
|
|
130
|
+
readonly constant: RichSlot<E>;
|
|
131
|
+
readonly law: Schema.Trimmed;
|
|
132
|
+
readonly laws: Schema.$Record<Schema.Literals<readonly ["boyle", "charles", "gayLussac"]>, Schema.optionalKey<Schema.Struct<{
|
|
133
|
+
readonly name: Schema.Trimmed;
|
|
134
|
+
readonly relation: RichSlot<E>;
|
|
135
|
+
}>>>;
|
|
136
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["piston", "cylinder", "gauge", "heater", "molecules"]>, Schema.Trimmed>;
|
|
137
|
+
readonly pressure: Schema.optionalKey<RichSlot<E>>;
|
|
138
|
+
readonly temperature: Schema.Trimmed;
|
|
139
|
+
readonly view: Schema.Trimmed;
|
|
140
|
+
readonly volume: Schema.Trimmed;
|
|
141
|
+
}>;
|
|
142
|
+
readonly laws: Schema.NonEmptyArray<Schema.Literals<readonly ["boyle", "charles", "gayLussac"]>>;
|
|
143
|
+
readonly temperature: Schema.Struct<{
|
|
144
|
+
readonly max: Schema.Finite;
|
|
145
|
+
readonly min: Schema.Finite;
|
|
146
|
+
readonly value: Schema.Finite;
|
|
147
|
+
}>;
|
|
148
|
+
readonly volume: Schema.Struct<{
|
|
149
|
+
readonly max: Schema.Finite;
|
|
150
|
+
readonly min: Schema.Finite;
|
|
151
|
+
readonly value: Schema.Finite;
|
|
133
152
|
}>;
|
|
134
|
-
readonly liquidHeat: Schema.Finite;
|
|
135
|
-
readonly mass: Schema.Finite;
|
|
136
|
-
readonly meltingPoint: Schema.Finite;
|
|
137
|
-
readonly meltMinutes: Schema.Finite;
|
|
138
|
-
readonly warmMinutes: Schema.Finite;
|
|
139
153
|
}>, "figure">;
|
|
140
154
|
GasPistonLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
141
155
|
readonly description: RichSlot<E>;
|
|
@@ -270,6 +284,138 @@ export declare function heatVisuals<E>(rich: RichSlot<E>): {
|
|
|
270
284
|
readonly temperature: Schema.Finite;
|
|
271
285
|
readonly volumeRatio: Schema.Finite;
|
|
272
286
|
}>, "figure">;
|
|
287
|
+
HeatingCurveLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
288
|
+
readonly description: RichSlot<E>;
|
|
289
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
290
|
+
readonly marks?: readonly [{
|
|
291
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
292
|
+
} | {
|
|
293
|
+
readonly attrs: {
|
|
294
|
+
readonly href: string;
|
|
295
|
+
};
|
|
296
|
+
readonly type: "link";
|
|
297
|
+
} | {
|
|
298
|
+
readonly attrs: {
|
|
299
|
+
readonly variant: "success" | "warning" | null;
|
|
300
|
+
};
|
|
301
|
+
readonly type: "highlight";
|
|
302
|
+
}, ...({
|
|
303
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
304
|
+
} | {
|
|
305
|
+
readonly attrs: {
|
|
306
|
+
readonly href: string;
|
|
307
|
+
};
|
|
308
|
+
readonly type: "link";
|
|
309
|
+
} | {
|
|
310
|
+
readonly attrs: {
|
|
311
|
+
readonly variant: "success" | "warning" | null;
|
|
312
|
+
};
|
|
313
|
+
readonly type: "highlight";
|
|
314
|
+
})[]];
|
|
315
|
+
readonly text: string;
|
|
316
|
+
readonly type: "text";
|
|
317
|
+
} | {
|
|
318
|
+
readonly attrs: {
|
|
319
|
+
readonly latex: string;
|
|
320
|
+
};
|
|
321
|
+
readonly marks?: readonly [{
|
|
322
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
323
|
+
} | {
|
|
324
|
+
readonly attrs: {
|
|
325
|
+
readonly href: string;
|
|
326
|
+
};
|
|
327
|
+
readonly type: "link";
|
|
328
|
+
} | {
|
|
329
|
+
readonly attrs: {
|
|
330
|
+
readonly variant: "success" | "warning" | null;
|
|
331
|
+
};
|
|
332
|
+
readonly type: "highlight";
|
|
333
|
+
}, ...({
|
|
334
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
335
|
+
} | {
|
|
336
|
+
readonly attrs: {
|
|
337
|
+
readonly href: string;
|
|
338
|
+
};
|
|
339
|
+
readonly type: "link";
|
|
340
|
+
} | {
|
|
341
|
+
readonly attrs: {
|
|
342
|
+
readonly variant: "success" | "warning" | null;
|
|
343
|
+
};
|
|
344
|
+
readonly type: "highlight";
|
|
345
|
+
})[]];
|
|
346
|
+
readonly type: "mathInline";
|
|
347
|
+
}, ...({
|
|
348
|
+
readonly marks?: readonly [{
|
|
349
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
350
|
+
} | {
|
|
351
|
+
readonly attrs: {
|
|
352
|
+
readonly href: string;
|
|
353
|
+
};
|
|
354
|
+
readonly type: "link";
|
|
355
|
+
} | {
|
|
356
|
+
readonly attrs: {
|
|
357
|
+
readonly variant: "success" | "warning" | null;
|
|
358
|
+
};
|
|
359
|
+
readonly type: "highlight";
|
|
360
|
+
}, ...({
|
|
361
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
362
|
+
} | {
|
|
363
|
+
readonly attrs: {
|
|
364
|
+
readonly href: string;
|
|
365
|
+
};
|
|
366
|
+
readonly type: "link";
|
|
367
|
+
} | {
|
|
368
|
+
readonly attrs: {
|
|
369
|
+
readonly variant: "success" | "warning" | null;
|
|
370
|
+
};
|
|
371
|
+
readonly type: "highlight";
|
|
372
|
+
})[]];
|
|
373
|
+
readonly text: string;
|
|
374
|
+
readonly type: "text";
|
|
375
|
+
} | {
|
|
376
|
+
readonly attrs: {
|
|
377
|
+
readonly latex: string;
|
|
378
|
+
};
|
|
379
|
+
readonly marks?: readonly [{
|
|
380
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
381
|
+
} | {
|
|
382
|
+
readonly attrs: {
|
|
383
|
+
readonly href: string;
|
|
384
|
+
};
|
|
385
|
+
readonly type: "link";
|
|
386
|
+
} | {
|
|
387
|
+
readonly attrs: {
|
|
388
|
+
readonly variant: "success" | "warning" | null;
|
|
389
|
+
};
|
|
390
|
+
readonly type: "highlight";
|
|
391
|
+
}, ...({
|
|
392
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
393
|
+
} | {
|
|
394
|
+
readonly attrs: {
|
|
395
|
+
readonly href: string;
|
|
396
|
+
};
|
|
397
|
+
readonly type: "link";
|
|
398
|
+
} | {
|
|
399
|
+
readonly attrs: {
|
|
400
|
+
readonly variant: "success" | "warning" | null;
|
|
401
|
+
};
|
|
402
|
+
readonly type: "highlight";
|
|
403
|
+
})[]];
|
|
404
|
+
readonly type: "mathInline";
|
|
405
|
+
})[]], E, never, never>>;
|
|
406
|
+
readonly title: RichSlot<E>;
|
|
407
|
+
readonly finalTemperature: Schema.Finite;
|
|
408
|
+
readonly labels: Schema.Struct<{
|
|
409
|
+
readonly latent: RichSlot<E>;
|
|
410
|
+
readonly power: RichSlot<E>;
|
|
411
|
+
readonly viewLabel: Schema.Trimmed;
|
|
412
|
+
}>;
|
|
413
|
+
readonly liquidHeat: Schema.Finite;
|
|
414
|
+
readonly mass: Schema.Finite;
|
|
415
|
+
readonly meltingPoint: Schema.Finite;
|
|
416
|
+
readonly meltMinutes: Schema.Finite;
|
|
417
|
+
readonly warmMinutes: Schema.Finite;
|
|
418
|
+
}>, "figure">;
|
|
273
419
|
IceMeltingLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
274
420
|
readonly description: RichSlot<E>;
|
|
275
421
|
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
@@ -402,4 +548,153 @@ export declare function heatVisuals<E>(rich: RichSlot<E>): {
|
|
|
402
548
|
readonly waterMass: Schema.Finite;
|
|
403
549
|
readonly waterTemperature: Schema.Finite;
|
|
404
550
|
}>, "figure">;
|
|
551
|
+
SpecificHeatCalorimeterLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
552
|
+
readonly description: RichSlot<E>;
|
|
553
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
554
|
+
readonly marks?: readonly [{
|
|
555
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
556
|
+
} | {
|
|
557
|
+
readonly attrs: {
|
|
558
|
+
readonly href: string;
|
|
559
|
+
};
|
|
560
|
+
readonly type: "link";
|
|
561
|
+
} | {
|
|
562
|
+
readonly attrs: {
|
|
563
|
+
readonly variant: "success" | "warning" | null;
|
|
564
|
+
};
|
|
565
|
+
readonly type: "highlight";
|
|
566
|
+
}, ...({
|
|
567
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
568
|
+
} | {
|
|
569
|
+
readonly attrs: {
|
|
570
|
+
readonly href: string;
|
|
571
|
+
};
|
|
572
|
+
readonly type: "link";
|
|
573
|
+
} | {
|
|
574
|
+
readonly attrs: {
|
|
575
|
+
readonly variant: "success" | "warning" | null;
|
|
576
|
+
};
|
|
577
|
+
readonly type: "highlight";
|
|
578
|
+
})[]];
|
|
579
|
+
readonly text: string;
|
|
580
|
+
readonly type: "text";
|
|
581
|
+
} | {
|
|
582
|
+
readonly attrs: {
|
|
583
|
+
readonly latex: string;
|
|
584
|
+
};
|
|
585
|
+
readonly marks?: readonly [{
|
|
586
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
587
|
+
} | {
|
|
588
|
+
readonly attrs: {
|
|
589
|
+
readonly href: string;
|
|
590
|
+
};
|
|
591
|
+
readonly type: "link";
|
|
592
|
+
} | {
|
|
593
|
+
readonly attrs: {
|
|
594
|
+
readonly variant: "success" | "warning" | null;
|
|
595
|
+
};
|
|
596
|
+
readonly type: "highlight";
|
|
597
|
+
}, ...({
|
|
598
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
599
|
+
} | {
|
|
600
|
+
readonly attrs: {
|
|
601
|
+
readonly href: string;
|
|
602
|
+
};
|
|
603
|
+
readonly type: "link";
|
|
604
|
+
} | {
|
|
605
|
+
readonly attrs: {
|
|
606
|
+
readonly variant: "success" | "warning" | null;
|
|
607
|
+
};
|
|
608
|
+
readonly type: "highlight";
|
|
609
|
+
})[]];
|
|
610
|
+
readonly type: "mathInline";
|
|
611
|
+
}, ...({
|
|
612
|
+
readonly marks?: readonly [{
|
|
613
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
614
|
+
} | {
|
|
615
|
+
readonly attrs: {
|
|
616
|
+
readonly href: string;
|
|
617
|
+
};
|
|
618
|
+
readonly type: "link";
|
|
619
|
+
} | {
|
|
620
|
+
readonly attrs: {
|
|
621
|
+
readonly variant: "success" | "warning" | null;
|
|
622
|
+
};
|
|
623
|
+
readonly type: "highlight";
|
|
624
|
+
}, ...({
|
|
625
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
626
|
+
} | {
|
|
627
|
+
readonly attrs: {
|
|
628
|
+
readonly href: string;
|
|
629
|
+
};
|
|
630
|
+
readonly type: "link";
|
|
631
|
+
} | {
|
|
632
|
+
readonly attrs: {
|
|
633
|
+
readonly variant: "success" | "warning" | null;
|
|
634
|
+
};
|
|
635
|
+
readonly type: "highlight";
|
|
636
|
+
})[]];
|
|
637
|
+
readonly text: string;
|
|
638
|
+
readonly type: "text";
|
|
639
|
+
} | {
|
|
640
|
+
readonly attrs: {
|
|
641
|
+
readonly latex: string;
|
|
642
|
+
};
|
|
643
|
+
readonly marks?: readonly [{
|
|
644
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
645
|
+
} | {
|
|
646
|
+
readonly attrs: {
|
|
647
|
+
readonly href: string;
|
|
648
|
+
};
|
|
649
|
+
readonly type: "link";
|
|
650
|
+
} | {
|
|
651
|
+
readonly attrs: {
|
|
652
|
+
readonly variant: "success" | "warning" | null;
|
|
653
|
+
};
|
|
654
|
+
readonly type: "highlight";
|
|
655
|
+
}, ...({
|
|
656
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
657
|
+
} | {
|
|
658
|
+
readonly attrs: {
|
|
659
|
+
readonly href: string;
|
|
660
|
+
};
|
|
661
|
+
readonly type: "link";
|
|
662
|
+
} | {
|
|
663
|
+
readonly attrs: {
|
|
664
|
+
readonly variant: "success" | "warning" | null;
|
|
665
|
+
};
|
|
666
|
+
readonly type: "highlight";
|
|
667
|
+
})[]];
|
|
668
|
+
readonly type: "mathInline";
|
|
669
|
+
})[]], E, never, never>>;
|
|
670
|
+
readonly title: RichSlot<E>;
|
|
671
|
+
readonly labels: Schema.Struct<{
|
|
672
|
+
readonly energy: RichSlot<E>;
|
|
673
|
+
readonly mass: Schema.Trimmed;
|
|
674
|
+
readonly material: Schema.Trimmed;
|
|
675
|
+
readonly materials: Schema.$Record<Schema.Literals<readonly ["water", "aluminium", "copper", "iron", "oil"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
676
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["heater", "thermometer", "stirrer", "insulation", "sample"]>, Schema.Trimmed>;
|
|
677
|
+
readonly power: Schema.Trimmed;
|
|
678
|
+
readonly specificHeat: Schema.optionalKey<RichSlot<E>>;
|
|
679
|
+
readonly temperatureRise: Schema.optionalKey<RichSlot<E>>;
|
|
680
|
+
readonly time: Schema.Trimmed;
|
|
681
|
+
readonly view: Schema.Trimmed;
|
|
682
|
+
}>;
|
|
683
|
+
readonly mass: Schema.Struct<{
|
|
684
|
+
readonly max: Schema.Finite;
|
|
685
|
+
readonly min: Schema.Finite;
|
|
686
|
+
readonly value: Schema.Finite;
|
|
687
|
+
}>;
|
|
688
|
+
readonly materials: Schema.NonEmptyArray<Schema.Literals<readonly ["water", "aluminium", "copper", "iron", "oil"]>>;
|
|
689
|
+
readonly minutes: Schema.Struct<{
|
|
690
|
+
readonly max: Schema.Finite;
|
|
691
|
+
readonly min: Schema.Finite;
|
|
692
|
+
readonly value: Schema.Finite;
|
|
693
|
+
}>;
|
|
694
|
+
readonly power: Schema.Struct<{
|
|
695
|
+
readonly max: Schema.Finite;
|
|
696
|
+
readonly min: Schema.Finite;
|
|
697
|
+
readonly value: Schema.Finite;
|
|
698
|
+
}>;
|
|
699
|
+
}>, "figure">;
|
|
405
700
|
};
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
|
|
3
|
-
import { figure } from "#contracts/visual/entry";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** A strictly positive finite setting for thermal lab sliders. */
|
|
5
|
+
const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
|
|
6
|
+
/** A strictly 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 thermal slider range whose minimum is below its maximum, with the starting value between them.",
|
|
13
|
+
}));
|
|
14
|
+
const CALORIMETER_MATERIALS = [
|
|
15
|
+
"water",
|
|
16
|
+
"aluminium",
|
|
17
|
+
"copper",
|
|
18
|
+
"iron",
|
|
19
|
+
"oil",
|
|
20
|
+
];
|
|
21
|
+
const GAS_LAWS = ["boyle", "charles", "gayLussac"];
|
|
4
22
|
/** Props of `HeatingCurveLab`: an immersion heater of constant power melts a solid in a beaker and then warms the liquid. */
|
|
5
23
|
function heatingCurveLab(rich) {
|
|
6
24
|
return figure(Schema.Struct({
|
|
@@ -54,13 +72,74 @@ function iceMeltingLab(rich) {
|
|
|
54
72
|
}));
|
|
55
73
|
}
|
|
56
74
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
75
|
+
* Props of `SpecificHeatCalorimeterLab`: a 3D insulated electrical calorimeter
|
|
76
|
+
* comparing specific heat capacity across materials with adjustable mass,
|
|
77
|
+
* heater power, and heating time. Specific heat and temperature-rise readouts
|
|
78
|
+
* are optional answer state.
|
|
79
|
+
*/
|
|
80
|
+
function specificHeatCalorimeterLab(rich) {
|
|
81
|
+
return figure(Schema.Struct({
|
|
82
|
+
...cardFields(rich),
|
|
83
|
+
labels: Schema.Struct({
|
|
84
|
+
energy: rich,
|
|
85
|
+
mass: TextSchema,
|
|
86
|
+
material: TextSchema,
|
|
87
|
+
materials: byPickedIds(CALORIMETER_MATERIALS, TextSchema),
|
|
88
|
+
parts: byIds(["heater", "thermometer", "stirrer", "insulation", "sample"], TextSchema),
|
|
89
|
+
power: TextSchema,
|
|
90
|
+
specificHeat: Schema.optionalKey(rich),
|
|
91
|
+
temperatureRise: Schema.optionalKey(rich),
|
|
92
|
+
time: TextSchema,
|
|
93
|
+
view: TextSchema,
|
|
94
|
+
}),
|
|
95
|
+
mass: PositiveSliderSchema,
|
|
96
|
+
materials: Schema.NonEmptyArray(Schema.Literals(CALORIMETER_MATERIALS)).check(Schema.isUnique()),
|
|
97
|
+
minutes: PositiveSliderSchema,
|
|
98
|
+
power: PositiveSliderSchema,
|
|
99
|
+
}).check(Schema.makeFilter(({ labels, materials }) => namesEach(materials, labels.materials), {
|
|
100
|
+
message: "Expected a name for every calorimeter material shown, and no other.",
|
|
101
|
+
})), answerAt(["labels", "specificHeat"], ["labels", "temperatureRise"]));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Props of `GasLawThermalLab`: a 3D piston-cylinder gas chamber exploring
|
|
105
|
+
* Boyle's, Charles's, and Gay-Lussac's laws with live particle collisions
|
|
106
|
+
* across temperature and volume controls. Collision rate and pressure readouts
|
|
107
|
+
* are optional answer state.
|
|
108
|
+
*/
|
|
109
|
+
function gasLawThermalLab(rich) {
|
|
110
|
+
return figure(Schema.Struct({
|
|
111
|
+
...cardFields(rich),
|
|
112
|
+
labels: Schema.Struct({
|
|
113
|
+
collisions: Schema.optionalKey(rich),
|
|
114
|
+
constant: rich,
|
|
115
|
+
law: TextSchema,
|
|
116
|
+
laws: byPickedIds(GAS_LAWS, Schema.Struct({
|
|
117
|
+
name: TextSchema,
|
|
118
|
+
relation: rich,
|
|
119
|
+
})),
|
|
120
|
+
parts: byIds(["piston", "cylinder", "gauge", "heater", "molecules"], TextSchema),
|
|
121
|
+
pressure: Schema.optionalKey(rich),
|
|
122
|
+
temperature: TextSchema,
|
|
123
|
+
view: TextSchema,
|
|
124
|
+
volume: TextSchema,
|
|
125
|
+
}),
|
|
126
|
+
laws: Schema.NonEmptyArray(Schema.Literals(GAS_LAWS)).check(Schema.isUnique()),
|
|
127
|
+
temperature: PositiveSliderSchema,
|
|
128
|
+
volume: PositiveSliderSchema,
|
|
129
|
+
}).check(Schema.makeFilter(({ labels, laws }) => namesEach(laws, labels.laws), {
|
|
130
|
+
message: "Expected a name and relation note for every gas law shown, and no other.",
|
|
131
|
+
})), answerAt(["labels", "collisions"], ["labels", "pressure"]));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The props of the heat labs covering heating curves, calorimetry, ice
|
|
135
|
+
* melting, and thermal gas laws.
|
|
59
136
|
*/
|
|
60
137
|
export function heatVisuals(rich) {
|
|
61
138
|
return {
|
|
62
|
-
|
|
139
|
+
GasLawThermalLab: gasLawThermalLab(rich),
|
|
63
140
|
GasPistonLab: gasPistonLab(rich),
|
|
141
|
+
HeatingCurveLab: heatingCurveLab(rich),
|
|
64
142
|
IceMeltingLab: iceMeltingLab(rich),
|
|
143
|
+
SpecificHeatCalorimeterLab: specificHeatCalorimeterLab(rich),
|
|
65
144
|
};
|
|
66
145
|
}
|