@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,143 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import type { RichSlot } from "#contracts/visual/card";
|
|
3
3
|
/**
|
|
4
|
-
* The props of the nuclear and quantum physics labs
|
|
5
|
-
*
|
|
4
|
+
* The props of the nuclear and quantum physics labs covering half-life,
|
|
5
|
+
* fission, binding-energy stability, and photoelectric emission.
|
|
6
6
|
*/
|
|
7
7
|
export declare function nuclearVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
FissionLab: 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 fragments: Schema.Tuple<readonly [Schema.Finite, Schema.Finite]>;
|
|
129
|
+
readonly labels: Schema.Struct<{
|
|
130
|
+
readonly defect: RichSlot<E>;
|
|
131
|
+
readonly energy: RichSlot<E>;
|
|
132
|
+
readonly kilograms: RichSlot<E>;
|
|
133
|
+
readonly viewLabel: Schema.Trimmed;
|
|
134
|
+
}>;
|
|
135
|
+
readonly lightSpeed: Schema.Finite;
|
|
136
|
+
readonly neutron: Schema.Finite;
|
|
137
|
+
readonly parent: Schema.Finite;
|
|
138
|
+
readonly released: Schema.Finite;
|
|
139
|
+
readonly unit: Schema.Finite;
|
|
140
|
+
}>, "figure">;
|
|
8
141
|
HalfLifeCounterLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
142
|
readonly description: RichSlot<E>;
|
|
10
143
|
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
@@ -136,7 +269,7 @@ export declare function nuclearVisuals<E>(rich: RichSlot<E>): {
|
|
|
136
269
|
readonly later: Schema.Finite;
|
|
137
270
|
readonly time: Schema.Finite;
|
|
138
271
|
}>, "figure">;
|
|
139
|
-
|
|
272
|
+
NuclearBindingCurveLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
140
273
|
readonly description: RichSlot<E>;
|
|
141
274
|
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
142
275
|
readonly marks?: readonly [{
|
|
@@ -256,18 +389,22 @@ export declare function nuclearVisuals<E>(rich: RichSlot<E>): {
|
|
|
256
389
|
readonly type: "mathInline";
|
|
257
390
|
})[]], E, never, never>>;
|
|
258
391
|
readonly title: RichSlot<E>;
|
|
259
|
-
readonly fragments: Schema.Tuple<readonly [Schema.Finite, Schema.Finite]>;
|
|
260
392
|
readonly labels: Schema.Struct<{
|
|
261
|
-
readonly
|
|
262
|
-
readonly
|
|
263
|
-
readonly
|
|
264
|
-
readonly
|
|
393
|
+
readonly bindingPerNucleon: Schema.optionalKey<RichSlot<E>>;
|
|
394
|
+
readonly massDefect: Schema.optionalKey<RichSlot<E>>;
|
|
395
|
+
readonly nuclide: Schema.Trimmed;
|
|
396
|
+
readonly nuclides: Schema.$Record<Schema.Literals<readonly ["deuterium", "helium4", "carbon12", "iron56", "uranium235"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
397
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["proton", "neutron", "ironPeak", "fusionZone", "fissionZone"]>, Schema.Trimmed>;
|
|
398
|
+
readonly process: Schema.Trimmed;
|
|
399
|
+
readonly processes: Schema.$Record<Schema.Literals<readonly ["fusion", "fission"]>, Schema.optionalKey<Schema.Struct<{
|
|
400
|
+
readonly detail: RichSlot<E>;
|
|
401
|
+
readonly name: Schema.Trimmed;
|
|
402
|
+
}>>>;
|
|
403
|
+
readonly stability: RichSlot<E>;
|
|
404
|
+
readonly view: Schema.Trimmed;
|
|
265
405
|
}>;
|
|
266
|
-
readonly
|
|
267
|
-
readonly
|
|
268
|
-
readonly parent: Schema.Finite;
|
|
269
|
-
readonly released: Schema.Finite;
|
|
270
|
-
readonly unit: Schema.Finite;
|
|
406
|
+
readonly nuclides: Schema.NonEmptyArray<Schema.Literals<readonly ["deuterium", "helium4", "carbon12", "iron56", "uranium235"]>>;
|
|
407
|
+
readonly processes: Schema.NonEmptyArray<Schema.Literals<readonly ["fusion", "fission"]>>;
|
|
271
408
|
}>, "figure">;
|
|
272
409
|
PhotoelectricLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
273
410
|
readonly description: RichSlot<E>;
|
|
@@ -1,6 +1,14 @@
|
|
|
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
|
+
const NUCLIDES = [
|
|
5
|
+
"deuterium",
|
|
6
|
+
"helium4",
|
|
7
|
+
"carbon12",
|
|
8
|
+
"iron56",
|
|
9
|
+
"uranium235",
|
|
10
|
+
];
|
|
11
|
+
const NUCLEAR_PROCESSES = ["fusion", "fission"];
|
|
4
12
|
/** Props of `HalfLifeCounterLab`: a Geiger-Muller counter in front of a radioactive sample records its rate over time. */
|
|
5
13
|
function halfLifeCounterLab(rich) {
|
|
6
14
|
return figure(Schema.Struct({
|
|
@@ -57,13 +65,44 @@ function photoelectricLab(rich) {
|
|
|
57
65
|
}));
|
|
58
66
|
}
|
|
59
67
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
68
|
+
* Props of `NuclearBindingCurveLab`: a 3D nucleon cluster and binding-energy
|
|
69
|
+
* per nucleon curve contrasting light fusion, the iron-56 stability peak, and
|
|
70
|
+
* heavy fission. Binding energy per nucleon and mass defect readouts are
|
|
71
|
+
* optional answer state.
|
|
72
|
+
*/
|
|
73
|
+
function nuclearBindingCurveLab(rich) {
|
|
74
|
+
return figure(Schema.Struct({
|
|
75
|
+
...cardFields(rich),
|
|
76
|
+
labels: Schema.Struct({
|
|
77
|
+
bindingPerNucleon: Schema.optionalKey(rich),
|
|
78
|
+
massDefect: Schema.optionalKey(rich),
|
|
79
|
+
nuclide: TextSchema,
|
|
80
|
+
nuclides: byPickedIds(NUCLIDES, TextSchema),
|
|
81
|
+
parts: byIds(["proton", "neutron", "ironPeak", "fusionZone", "fissionZone"], TextSchema),
|
|
82
|
+
process: TextSchema,
|
|
83
|
+
processes: byPickedIds(NUCLEAR_PROCESSES, Schema.Struct({
|
|
84
|
+
detail: rich,
|
|
85
|
+
name: TextSchema,
|
|
86
|
+
})),
|
|
87
|
+
stability: rich,
|
|
88
|
+
view: TextSchema,
|
|
89
|
+
}),
|
|
90
|
+
nuclides: Schema.NonEmptyArray(Schema.Literals(NUCLIDES)).check(Schema.isUnique()),
|
|
91
|
+
processes: Schema.NonEmptyArray(Schema.Literals(NUCLEAR_PROCESSES)).check(Schema.isUnique()),
|
|
92
|
+
}).check(Schema.makeFilter(({ labels, nuclides, processes }) => namesEach(nuclides, labels.nuclides) &&
|
|
93
|
+
namesEach(processes, labels.processes), {
|
|
94
|
+
message: "Expected a name for every nuclide and nuclear process shown, and no other.",
|
|
95
|
+
})), answerAt(["labels", "bindingPerNucleon"], ["labels", "massDefect"]));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The props of the nuclear and quantum physics labs covering half-life,
|
|
99
|
+
* fission, binding-energy stability, and photoelectric emission.
|
|
62
100
|
*/
|
|
63
101
|
export function nuclearVisuals(rich) {
|
|
64
102
|
return {
|
|
65
|
-
HalfLifeCounterLab: halfLifeCounterLab(rich),
|
|
66
103
|
FissionLab: fissionLab(rich),
|
|
104
|
+
HalfLifeCounterLab: halfLifeCounterLab(rich),
|
|
105
|
+
NuclearBindingCurveLab: nuclearBindingCurveLab(rich),
|
|
67
106
|
PhotoelectricLab: photoelectricLab(rich),
|
|
68
107
|
};
|
|
69
108
|
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* Quantum physics labs covering de Broglie matter-wave diffraction and
|
|
5
|
+
* Planck blackbody quantization.
|
|
6
|
+
*/
|
|
7
|
+
export declare function quantumVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
DeBroglieMatterWaveLab: 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 diffraction: Schema.optionalKey<RichSlot<E>>;
|
|
130
|
+
readonly momentum: RichSlot<E>;
|
|
131
|
+
readonly particle: Schema.Trimmed;
|
|
132
|
+
readonly particles: Schema.$Record<Schema.Literals<readonly ["electron", "proton", "neutron", "alpha"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
133
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["electronGun", "graphiteTarget", "matterWave", "diffractionRings", "screen"]>, Schema.Trimmed>;
|
|
134
|
+
readonly view: Schema.Trimmed;
|
|
135
|
+
readonly voltage: Schema.Trimmed;
|
|
136
|
+
readonly wavelength: Schema.optionalKey<RichSlot<E>>;
|
|
137
|
+
}>;
|
|
138
|
+
readonly particles: Schema.NonEmptyArray<Schema.Literals<readonly ["electron", "proton", "neutron", "alpha"]>>;
|
|
139
|
+
readonly voltage: Schema.Struct<{
|
|
140
|
+
readonly max: Schema.Finite;
|
|
141
|
+
readonly min: Schema.Finite;
|
|
142
|
+
readonly value: Schema.Finite;
|
|
143
|
+
}>;
|
|
144
|
+
}>, "figure">;
|
|
145
|
+
PlanckBlackbodyLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
146
|
+
readonly description: RichSlot<E>;
|
|
147
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
148
|
+
readonly marks?: readonly [{
|
|
149
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
150
|
+
} | {
|
|
151
|
+
readonly attrs: {
|
|
152
|
+
readonly href: string;
|
|
153
|
+
};
|
|
154
|
+
readonly type: "link";
|
|
155
|
+
} | {
|
|
156
|
+
readonly attrs: {
|
|
157
|
+
readonly variant: "success" | "warning" | null;
|
|
158
|
+
};
|
|
159
|
+
readonly type: "highlight";
|
|
160
|
+
}, ...({
|
|
161
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
162
|
+
} | {
|
|
163
|
+
readonly attrs: {
|
|
164
|
+
readonly href: string;
|
|
165
|
+
};
|
|
166
|
+
readonly type: "link";
|
|
167
|
+
} | {
|
|
168
|
+
readonly attrs: {
|
|
169
|
+
readonly variant: "success" | "warning" | null;
|
|
170
|
+
};
|
|
171
|
+
readonly type: "highlight";
|
|
172
|
+
})[]];
|
|
173
|
+
readonly text: string;
|
|
174
|
+
readonly type: "text";
|
|
175
|
+
} | {
|
|
176
|
+
readonly attrs: {
|
|
177
|
+
readonly latex: string;
|
|
178
|
+
};
|
|
179
|
+
readonly marks?: readonly [{
|
|
180
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
181
|
+
} | {
|
|
182
|
+
readonly attrs: {
|
|
183
|
+
readonly href: string;
|
|
184
|
+
};
|
|
185
|
+
readonly type: "link";
|
|
186
|
+
} | {
|
|
187
|
+
readonly attrs: {
|
|
188
|
+
readonly variant: "success" | "warning" | null;
|
|
189
|
+
};
|
|
190
|
+
readonly type: "highlight";
|
|
191
|
+
}, ...({
|
|
192
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
193
|
+
} | {
|
|
194
|
+
readonly attrs: {
|
|
195
|
+
readonly href: string;
|
|
196
|
+
};
|
|
197
|
+
readonly type: "link";
|
|
198
|
+
} | {
|
|
199
|
+
readonly attrs: {
|
|
200
|
+
readonly variant: "success" | "warning" | null;
|
|
201
|
+
};
|
|
202
|
+
readonly type: "highlight";
|
|
203
|
+
})[]];
|
|
204
|
+
readonly type: "mathInline";
|
|
205
|
+
}, ...({
|
|
206
|
+
readonly marks?: readonly [{
|
|
207
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
208
|
+
} | {
|
|
209
|
+
readonly attrs: {
|
|
210
|
+
readonly href: string;
|
|
211
|
+
};
|
|
212
|
+
readonly type: "link";
|
|
213
|
+
} | {
|
|
214
|
+
readonly attrs: {
|
|
215
|
+
readonly variant: "success" | "warning" | null;
|
|
216
|
+
};
|
|
217
|
+
readonly type: "highlight";
|
|
218
|
+
}, ...({
|
|
219
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
220
|
+
} | {
|
|
221
|
+
readonly attrs: {
|
|
222
|
+
readonly href: string;
|
|
223
|
+
};
|
|
224
|
+
readonly type: "link";
|
|
225
|
+
} | {
|
|
226
|
+
readonly attrs: {
|
|
227
|
+
readonly variant: "success" | "warning" | null;
|
|
228
|
+
};
|
|
229
|
+
readonly type: "highlight";
|
|
230
|
+
})[]];
|
|
231
|
+
readonly text: string;
|
|
232
|
+
readonly type: "text";
|
|
233
|
+
} | {
|
|
234
|
+
readonly attrs: {
|
|
235
|
+
readonly latex: string;
|
|
236
|
+
};
|
|
237
|
+
readonly marks?: readonly [{
|
|
238
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
239
|
+
} | {
|
|
240
|
+
readonly attrs: {
|
|
241
|
+
readonly href: string;
|
|
242
|
+
};
|
|
243
|
+
readonly type: "link";
|
|
244
|
+
} | {
|
|
245
|
+
readonly attrs: {
|
|
246
|
+
readonly variant: "success" | "warning" | null;
|
|
247
|
+
};
|
|
248
|
+
readonly type: "highlight";
|
|
249
|
+
}, ...({
|
|
250
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
251
|
+
} | {
|
|
252
|
+
readonly attrs: {
|
|
253
|
+
readonly href: string;
|
|
254
|
+
};
|
|
255
|
+
readonly type: "link";
|
|
256
|
+
} | {
|
|
257
|
+
readonly attrs: {
|
|
258
|
+
readonly variant: "success" | "warning" | null;
|
|
259
|
+
};
|
|
260
|
+
readonly type: "highlight";
|
|
261
|
+
})[]];
|
|
262
|
+
readonly type: "mathInline";
|
|
263
|
+
})[]], E, never, never>>;
|
|
264
|
+
readonly title: RichSlot<E>;
|
|
265
|
+
readonly labels: Schema.Struct<{
|
|
266
|
+
readonly model: Schema.Trimmed;
|
|
267
|
+
readonly models: Schema.$Record<Schema.Literals<readonly ["planck", "classical"]>, Schema.optionalKey<Schema.Trimmed>>;
|
|
268
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["cavity", "planckCurve", "classicalCurve", "visibleBand", "peakMarker"]>, Schema.Trimmed>;
|
|
269
|
+
readonly peakWavelength: Schema.optionalKey<RichSlot<E>>;
|
|
270
|
+
readonly photonEnergy: Schema.optionalKey<RichSlot<E>>;
|
|
271
|
+
readonly spectrum: RichSlot<E>;
|
|
272
|
+
readonly temperature: Schema.Trimmed;
|
|
273
|
+
readonly view: Schema.Trimmed;
|
|
274
|
+
}>;
|
|
275
|
+
readonly models: Schema.NonEmptyArray<Schema.Literals<readonly ["planck", "classical"]>>;
|
|
276
|
+
readonly temperature: Schema.Struct<{
|
|
277
|
+
readonly max: Schema.Finite;
|
|
278
|
+
readonly min: Schema.Finite;
|
|
279
|
+
readonly value: Schema.Finite;
|
|
280
|
+
}>;
|
|
281
|
+
}>, "figure">;
|
|
282
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 setting for quantum physics 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 slider range whose minimum is below its maximum, with the starting value between them.",
|
|
13
|
+
}));
|
|
14
|
+
const PARTICLES = ["electron", "proton", "neutron", "alpha"];
|
|
15
|
+
const RADIATION_MODELS = ["planck", "classical"];
|
|
16
|
+
/**
|
|
17
|
+
* Props of `DeBroglieMatterWaveLab`: a 3D electron-diffraction tube and
|
|
18
|
+
* standing matter-wave view linking accelerating voltage and particle mass to
|
|
19
|
+
* de Broglie wavelength and diffraction ring spacing. Wavelength and
|
|
20
|
+
* diffraction readouts are optional answer state.
|
|
21
|
+
*/
|
|
22
|
+
function deBroglieMatterWaveLab(rich) {
|
|
23
|
+
return figure(Schema.Struct({
|
|
24
|
+
...cardFields(rich),
|
|
25
|
+
labels: Schema.Struct({
|
|
26
|
+
diffraction: Schema.optionalKey(rich),
|
|
27
|
+
momentum: rich,
|
|
28
|
+
particle: TextSchema,
|
|
29
|
+
particles: byPickedIds(PARTICLES, TextSchema),
|
|
30
|
+
parts: byIds([
|
|
31
|
+
"electronGun",
|
|
32
|
+
"graphiteTarget",
|
|
33
|
+
"matterWave",
|
|
34
|
+
"diffractionRings",
|
|
35
|
+
"screen",
|
|
36
|
+
], TextSchema),
|
|
37
|
+
view: TextSchema,
|
|
38
|
+
voltage: TextSchema,
|
|
39
|
+
wavelength: Schema.optionalKey(rich),
|
|
40
|
+
}),
|
|
41
|
+
particles: Schema.NonEmptyArray(Schema.Literals(PARTICLES)).check(Schema.isUnique()),
|
|
42
|
+
voltage: PositiveSliderSchema,
|
|
43
|
+
}).check(Schema.makeFilter(({ labels, particles }) => namesEach(particles, labels.particles), {
|
|
44
|
+
message: "Expected a name for every particle shown in the matter-wave lab, and no other.",
|
|
45
|
+
})), answerAt(["labels", "diffraction"], ["labels", "wavelength"]));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Props of `PlanckBlackbodyLab`: a 3D heated cavity radiator synchronized with
|
|
49
|
+
* Planck's quantized blackbody spectrum and the classical Rayleigh-Jeans curve
|
|
50
|
+
* across Kelvin temperature. Peak wavelength and photon energy readouts are
|
|
51
|
+
* optional answer state.
|
|
52
|
+
*/
|
|
53
|
+
function planckBlackbodyLab(rich) {
|
|
54
|
+
return figure(Schema.Struct({
|
|
55
|
+
...cardFields(rich),
|
|
56
|
+
labels: Schema.Struct({
|
|
57
|
+
model: TextSchema,
|
|
58
|
+
models: byPickedIds(RADIATION_MODELS, TextSchema),
|
|
59
|
+
parts: byIds([
|
|
60
|
+
"cavity",
|
|
61
|
+
"planckCurve",
|
|
62
|
+
"classicalCurve",
|
|
63
|
+
"visibleBand",
|
|
64
|
+
"peakMarker",
|
|
65
|
+
], TextSchema),
|
|
66
|
+
peakWavelength: Schema.optionalKey(rich),
|
|
67
|
+
photonEnergy: Schema.optionalKey(rich),
|
|
68
|
+
spectrum: rich,
|
|
69
|
+
temperature: TextSchema,
|
|
70
|
+
view: TextSchema,
|
|
71
|
+
}),
|
|
72
|
+
models: Schema.NonEmptyArray(Schema.Literals(RADIATION_MODELS)).check(Schema.isUnique()),
|
|
73
|
+
temperature: PositiveSliderSchema,
|
|
74
|
+
}).check(Schema.makeFilter(({ labels, models }) => namesEach(models, labels.models), {
|
|
75
|
+
message: "Expected a name for every radiation model shown, and no other.",
|
|
76
|
+
})), answerAt(["labels", "peakWavelength"], ["labels", "photonEnergy"]));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Quantum physics labs covering de Broglie matter-wave diffraction and
|
|
80
|
+
* Planck blackbody quantization.
|
|
81
|
+
*/
|
|
82
|
+
export function quantumVisuals(rich) {
|
|
83
|
+
return {
|
|
84
|
+
DeBroglieMatterWaveLab: deBroglieMatterWaveLab(rich),
|
|
85
|
+
PlanckBlackbodyLab: planckBlackbodyLab(rich),
|
|
86
|
+
};
|
|
87
|
+
}
|
package/package.json
CHANGED